jpeg_abort:
   33|   293k|{
   34|   293k|  int pool;
   35|       |
   36|       |  /* Do nothing if called on a not-initialized or destroyed JPEG object. */
   37|   293k|  if (cinfo->mem == NULL)
  ------------------
  |  Branch (37:7): [True: 0, False: 293k]
  ------------------
   38|      0|    return;
   39|       |
   40|       |  /* Releasing pools in reverse order might help avoid fragmentation
   41|       |   * with some (brain-damaged) malloc libraries.
   42|       |   */
   43|   587k|  for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  827|   293k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  825|   587k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (43:35): [True: 293k, False: 293k]
  ------------------
   44|   293k|    (*cinfo->mem->free_pool) (cinfo, pool);
   45|   293k|  }
   46|       |
   47|       |  /* Reset overall state for possible reuse of object */
   48|   293k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (48:7): [True: 293k, False: 0]
  ------------------
   49|   293k|    cinfo->global_state = DSTATE_START;
  ------------------
  |  |   35|   293k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
   50|       |    /* Try to keep application from accessing now-deleted marker list.
   51|       |     * A bit kludgy to do it here, but this is the most central place.
   52|       |     */
   53|   293k|    ((j_decompress_ptr)cinfo)->marker_list = NULL;
   54|   293k|  } else {
   55|      0|    cinfo->global_state = CSTATE_START;
  ------------------
  |  |   31|      0|#define CSTATE_START     100    /* after create_compress */
  ------------------
   56|      0|  }
   57|   293k|}
jpeg_destroy:
   73|  18.1k|{
   74|       |  /* We need only tell the memory manager to release everything. */
   75|       |  /* NB: mem pointer is NULL if memory mgr failed to initialize. */
   76|  18.1k|  if (cinfo->mem != NULL)
  ------------------
  |  Branch (76:7): [True: 18.1k, False: 0]
  ------------------
   77|  18.1k|    (*cinfo->mem->self_destruct) (cinfo);
   78|  18.1k|  cinfo->mem = NULL;            /* be safe if jpeg_destroy is called twice */
   79|  18.1k|  cinfo->global_state = 0;      /* mark it destroyed */
   80|  18.1k|}
jpeg_alloc_quant_table:
   90|  25.3k|{
   91|  25.3k|  JQUANT_TBL *tbl;
   92|       |
   93|  25.3k|  tbl = (JQUANT_TBL *)
   94|  25.3k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JQUANT_TBL));
  ------------------
  |  |  825|  25.3k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
   95|  25.3k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  206|  25.3k|#define FALSE   0               /* values of boolean */
  ------------------
   96|  25.3k|  return tbl;
   97|  25.3k|}
jpeg_alloc_huff_table:
  102|  74.1k|{
  103|  74.1k|  JHUFF_TBL *tbl;
  104|       |
  105|  74.1k|  tbl = (JHUFF_TBL *)
  106|  74.1k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JHUFF_TBL));
  ------------------
  |  |  825|  74.1k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  107|  74.1k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  206|  74.1k|#define FALSE   0               /* values of boolean */
  ------------------
  108|  74.1k|  return tbl;
  109|  74.1k|}

jpeg_CreateDecompress:
   35|  18.1k|{
   36|  18.1k|  int i;
   37|       |
   38|       |  /* Guard against version mismatches between library and caller. */
   39|  18.1k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   40|  18.1k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  18.1k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (40:7): [True: 0, False: 18.1k]
  ------------------
   41|      0|    ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
  ------------------
  |  |  242|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  243|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   42|  18.1k|  if (structsize != sizeof(struct jpeg_decompress_struct))
  ------------------
  |  Branch (42:7): [True: 0, False: 18.1k]
  ------------------
   43|      0|    ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
  ------------------
  |  |  242|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  243|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   44|  18.1k|             (int)sizeof(struct jpeg_decompress_struct), (int)structsize);
   45|       |
   46|       |  /* For debugging purposes, we zero the whole master structure.
   47|       |   * But the application has already set the err pointer, and may have set
   48|       |   * client_data, so we have to save and restore those fields.
   49|       |   * Note: if application hasn't set client_data, tools like Purify may
   50|       |   * complain here.
   51|       |   */
   52|  18.1k|  {
   53|  18.1k|    struct jpeg_error_mgr *err = cinfo->err;
   54|  18.1k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   55|  18.1k|    memset(cinfo, 0, sizeof(struct jpeg_decompress_struct));
   56|  18.1k|    cinfo->err = err;
   57|  18.1k|    cinfo->client_data = client_data;
   58|  18.1k|  }
   59|  18.1k|  cinfo->is_decompressor = TRUE;
  ------------------
  |  |  209|  18.1k|#define TRUE    1
  ------------------
   60|       |
   61|       |  /* Initialize a memory manager instance for this object */
   62|  18.1k|  jinit_memory_mgr((j_common_ptr)cinfo);
   63|       |
   64|       |  /* Zero out pointers to permanent structures. */
   65|  18.1k|  cinfo->progress = NULL;
   66|  18.1k|  cinfo->src = NULL;
   67|       |
   68|  90.9k|  for (i = 0; i < NUM_QUANT_TBLS; i++)
  ------------------
  |  |   48|  90.9k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (68:15): [True: 72.7k, False: 18.1k]
  ------------------
   69|  72.7k|    cinfo->quant_tbl_ptrs[i] = NULL;
   70|       |
   71|  90.9k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   49|  90.9k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (71:15): [True: 72.7k, False: 18.1k]
  ------------------
   72|  72.7k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   73|  72.7k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   74|  72.7k|  }
   75|       |
   76|       |  /* Initialize marker processor so application can override methods
   77|       |   * for COM, APPn markers before calling jpeg_read_header.
   78|       |   */
   79|  18.1k|  cinfo->marker_list = NULL;
   80|  18.1k|  jinit_marker_reader(cinfo);
   81|       |
   82|       |  /* And initialize the overall input controller. */
   83|  18.1k|  jinit_input_controller(cinfo);
   84|       |
   85|       |  /* OK, I'm ready */
   86|  18.1k|  cinfo->global_state = DSTATE_START;
  ------------------
  |  |   35|  18.1k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
   87|       |
   88|       |  /* The master struct is used to store extension parameters, so we allocate it
   89|       |   * here.
   90|       |   */
   91|  18.1k|  cinfo->master = (struct jpeg_decomp_master *)
   92|  18.1k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  825|  18.1k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
   93|  18.1k|                                sizeof(my_decomp_master));
   94|  18.1k|  memset(cinfo->master, 0, sizeof(my_decomp_master));
   95|  18.1k|}
jpeg_read_header:
  254|   162k|{
  255|   162k|  int retcode;
  256|       |
  257|   162k|  if (cinfo->global_state != DSTATE_START &&
  ------------------
  |  |   35|   325k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (257:7): [True: 0, False: 162k]
  ------------------
  258|   162k|      cinfo->global_state != DSTATE_INHEADER)
  ------------------
  |  |   36|      0|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (258:7): [True: 0, False: 0]
  ------------------
  259|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  260|       |
  261|   162k|  retcode = jpeg_consume_input(cinfo);
  262|       |
  263|   162k|  switch (retcode) {
  ------------------
  |  Branch (263:11): [True: 94.5k, False: 68.0k]
  ------------------
  264|  57.3k|  case JPEG_REACHED_SOS:
  ------------------
  |  | 1020|  57.3k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (264:3): [True: 57.3k, False: 105k]
  ------------------
  265|  57.3k|    retcode = JPEG_HEADER_OK;
  ------------------
  |  |  988|  57.3k|#define JPEG_HEADER_OK           1 /* Found valid image datastream */
  ------------------
  266|  57.3k|    break;
  267|  10.7k|  case JPEG_REACHED_EOI:
  ------------------
  |  | 1021|  10.7k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (267:3): [True: 10.7k, False: 151k]
  ------------------
  268|  10.7k|    if (require_image)          /* Complain if application wanted an image */
  ------------------
  |  Branch (268:9): [True: 10.7k, False: 1]
  ------------------
  269|  10.7k|      ERREXIT(cinfo, JERR_NO_IMAGE);
  ------------------
  |  |  235|  10.7k|  ((cinfo)->err->msg_code = (code), \
  |  |  236|  10.7k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  270|       |    /* Reset to start state; it would be safer to require the application to
  271|       |     * call jpeg_abort, but we can't change it now for compatibility reasons.
  272|       |     * A side effect is to free any temporary memory (there shouldn't be any).
  273|       |     */
  274|  10.7k|    jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */
  275|  10.7k|    retcode = JPEG_HEADER_TABLES_ONLY;
  ------------------
  |  |  989|  10.7k|#define JPEG_HEADER_TABLES_ONLY  2 /* Found valid table-specs-only datastream */
  ------------------
  276|  10.7k|    break;
  277|      0|  case JPEG_SUSPENDED:
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (277:3): [True: 0, False: 162k]
  ------------------
  278|       |    /* no work */
  279|      0|    break;
  280|   162k|  }
  281|       |
  282|  57.3k|  return retcode;
  283|   162k|}
jpeg_consume_input:
  300|   162k|{
  301|   162k|  int retcode = JPEG_SUSPENDED;
  ------------------
  |  |  987|   162k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  302|       |
  303|       |  /* NB: every possible DSTATE value should be listed in this switch */
  304|   162k|  switch (cinfo->global_state) {
  305|   162k|  case DSTATE_START:
  ------------------
  |  |   35|   162k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (305:3): [True: 162k, False: 0]
  ------------------
  306|       |    /* Start-of-datastream actions: reset appropriate modules */
  307|   162k|    (*cinfo->inputctl->reset_input_controller) (cinfo);
  308|       |    /* Initialize application's data source module */
  309|   162k|    (*cinfo->src->init_source) (cinfo);
  310|   162k|    cinfo->global_state = DSTATE_INHEADER;
  ------------------
  |  |   36|   162k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  311|       |    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   38|   162k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  312|   162k|  case DSTATE_INHEADER:
  ------------------
  |  |   36|   162k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (312:3): [True: 0, False: 162k]
  ------------------
  313|   162k|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  314|   162k|    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
  ------------------
  |  | 1020|   162k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (314:9): [True: 57.3k, False: 105k]
  ------------------
  315|       |      /* Set up default parameters based on header data */
  316|  57.3k|      default_decompress_parms(cinfo);
  317|       |      /* Set global state: ready for start_decompress */
  318|  57.3k|      cinfo->global_state = DSTATE_READY;
  ------------------
  |  |   37|  57.3k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  319|  57.3k|    }
  320|   162k|    break;
  321|      0|  case DSTATE_READY:
  ------------------
  |  |   37|      0|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (321:3): [True: 0, False: 162k]
  ------------------
  322|       |    /* Can't advance past first SOS until start_decompress is called */
  323|      0|    retcode = JPEG_REACHED_SOS;
  ------------------
  |  | 1020|      0|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  324|      0|    break;
  325|      0|  case DSTATE_PRELOAD:
  ------------------
  |  |   38|      0|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (325:3): [True: 0, False: 162k]
  ------------------
  326|      0|  case DSTATE_PRESCAN:
  ------------------
  |  |   39|      0|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (326:3): [True: 0, False: 162k]
  ------------------
  327|      0|  case DSTATE_SCANNING:
  ------------------
  |  |   40|      0|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (327:3): [True: 0, False: 162k]
  ------------------
  328|      0|  case DSTATE_RAW_OK:
  ------------------
  |  |   41|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (328:3): [True: 0, False: 162k]
  ------------------
  329|      0|  case DSTATE_BUFIMAGE:
  ------------------
  |  |   42|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (329:3): [True: 0, False: 162k]
  ------------------
  330|      0|  case DSTATE_BUFPOST:
  ------------------
  |  |   43|      0|#define DSTATE_BUFPOST   208    /* looking for SOS/EOI in jpeg_finish_output */
  ------------------
  |  Branch (330:3): [True: 0, False: 162k]
  ------------------
  331|      0|  case DSTATE_STOPPING:
  ------------------
  |  |   45|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (331:3): [True: 0, False: 162k]
  ------------------
  332|      0|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  333|      0|    break;
  334|      0|  default:
  ------------------
  |  Branch (334:3): [True: 0, False: 162k]
  ------------------
  335|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  336|   162k|  }
  337|  68.0k|  return retcode;
  338|   162k|}
jpeg_has_multiple_scans:
  362|  40.9k|{
  363|       |  /* Only valid after jpeg_read_header completes */
  364|  40.9k|  if (cinfo->global_state < DSTATE_READY ||
  ------------------
  |  |   37|  81.8k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (364:7): [True: 0, False: 40.9k]
  ------------------
  365|  40.9k|      cinfo->global_state > DSTATE_STOPPING)
  ------------------
  |  |   45|  40.9k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (365:7): [True: 0, False: 40.9k]
  ------------------
  366|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  367|  40.9k|  return cinfo->inputctl->has_multiple_scans;
  368|  40.9k|}
jpeg_finish_decompress:
  382|  32.3k|{
  383|  32.3k|  if ((cinfo->global_state == DSTATE_SCANNING ||
  ------------------
  |  |   40|  64.6k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (383:8): [True: 32.3k, False: 0]
  ------------------
  384|  32.3k|       cinfo->global_state == DSTATE_RAW_OK) && !cinfo->buffered_image) {
  ------------------
  |  |   41|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (384:8): [True: 0, False: 0]
  |  Branch (384:49): [True: 32.3k, False: 0]
  ------------------
  385|       |    /* Terminate final pass of non-buffered mode */
  386|  32.3k|    if (cinfo->output_scanline < cinfo->output_height)
  ------------------
  |  Branch (386:9): [True: 0, False: 32.3k]
  ------------------
  387|      0|      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  388|  32.3k|    (*cinfo->master->finish_output_pass) (cinfo);
  389|  32.3k|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   45|  32.3k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  390|  32.3k|  } else if (cinfo->global_state == DSTATE_BUFIMAGE) {
  ------------------
  |  |   42|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (390:14): [True: 0, False: 0]
  ------------------
  391|       |    /* Finishing after a buffered-image operation */
  392|      0|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   45|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  393|      0|  } else if (cinfo->global_state != DSTATE_STOPPING) {
  ------------------
  |  |   45|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (393:14): [True: 0, False: 0]
  ------------------
  394|       |    /* STOPPING = repeat call after a suspension, anything else is error */
  395|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  396|      0|  }
  397|       |  /* Read until EOI */
  398|  49.2k|  while (!cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (398:10): [True: 16.9k, False: 32.3k]
  ------------------
  399|  16.9k|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  |  987|  16.9k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (399:9): [True: 0, False: 16.9k]
  ------------------
  400|      0|      return FALSE;             /* Suspend, come back later */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  401|  16.9k|  }
  402|       |  /* Do final cleanup */
  403|  32.3k|  (*cinfo->src->term_source) (cinfo);
  404|       |  /* We can use jpeg_abort to release memory and reset global_state */
  405|  32.3k|  jpeg_abort((j_common_ptr)cinfo);
  406|  32.3k|  return TRUE;
  ------------------
  |  |  209|  32.3k|#define TRUE    1
  ------------------
  407|  32.3k|}
jdapimin.c:default_decompress_parms:
  127|  57.3k|{
  128|       |  /* Guess the input colorspace, and set output colorspace accordingly. */
  129|       |  /* (Wish JPEG committee had provided a real way to specify this...) */
  130|       |  /* Note application may override our guesses. */
  131|  57.3k|  switch (cinfo->num_components) {
  132|  47.8k|  case 1:
  ------------------
  |  Branch (132:3): [True: 47.8k, False: 9.41k]
  ------------------
  133|  47.8k|    cinfo->jpeg_color_space = JCS_GRAYSCALE;
  134|  47.8k|    cinfo->out_color_space = JCS_GRAYSCALE;
  135|  47.8k|    break;
  136|       |
  137|  8.96k|  case 3:
  ------------------
  |  Branch (137:3): [True: 8.96k, False: 48.3k]
  ------------------
  138|  8.96k|    if (cinfo->saw_JFIF_marker) {
  ------------------
  |  Branch (138:9): [True: 87, False: 8.87k]
  ------------------
  139|     87|      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
  140|  8.87k|    } else if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (140:16): [True: 663, False: 8.21k]
  ------------------
  141|    663|      switch (cinfo->Adobe_transform) {
  142|    218|      case 0:
  ------------------
  |  Branch (142:7): [True: 218, False: 445]
  ------------------
  143|    218|        cinfo->jpeg_color_space = JCS_RGB;
  144|    218|        break;
  145|    229|      case 1:
  ------------------
  |  Branch (145:7): [True: 229, False: 434]
  ------------------
  146|    229|        cinfo->jpeg_color_space = JCS_YCbCr;
  147|    229|        break;
  148|    216|      default:
  ------------------
  |  Branch (148:7): [True: 216, False: 447]
  ------------------
  149|    216|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  281|    216|  ((cinfo)->err->msg_code = (code), \
  |  |  282|    216|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  283|    216|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  150|    216|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  151|    216|        break;
  152|    663|      }
  153|  8.21k|    } else {
  154|       |      /* Saw no special markers, try to guess from the component IDs */
  155|  8.21k|      int cid0 = cinfo->comp_info[0].component_id;
  156|  8.21k|      int cid1 = cinfo->comp_info[1].component_id;
  157|  8.21k|      int cid2 = cinfo->comp_info[2].component_id;
  158|       |
  159|  8.21k|      if (cid0 == 1 && cid1 == 2 && cid2 == 3)
  ------------------
  |  Branch (159:11): [True: 6.29k, False: 1.92k]
  |  Branch (159:24): [True: 4.37k, False: 1.91k]
  |  Branch (159:37): [True: 2.11k, False: 2.26k]
  ------------------
  160|  2.11k|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
  161|  6.10k|      else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
  ------------------
  |  Branch (161:16): [True: 532, False: 5.57k]
  |  Branch (161:30): [True: 312, False: 220]
  |  Branch (161:44): [True: 0, False: 312]
  ------------------
  162|      0|        cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
  163|  6.10k|      else {
  164|  6.10k|        TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
  ------------------
  |  |  304|  6.10k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  274|  6.10k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|  6.10k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  306|  6.10k|           (cinfo)->err->msg_code = (code); \
  |  |  307|  6.10k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  165|  6.10k|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  166|  6.10k|      }
  167|  8.21k|    }
  168|       |    /* Always guess RGB is proper output colorspace. */
  169|  8.96k|    cinfo->out_color_space = JCS_RGB;
  170|  8.96k|    break;
  171|       |
  172|    351|  case 4:
  ------------------
  |  Branch (172:3): [True: 351, False: 56.9k]
  ------------------
  173|    351|    if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (173:9): [True: 234, False: 117]
  ------------------
  174|    234|      switch (cinfo->Adobe_transform) {
  175|     67|      case 0:
  ------------------
  |  Branch (175:7): [True: 67, False: 167]
  ------------------
  176|     67|        cinfo->jpeg_color_space = JCS_CMYK;
  177|     67|        break;
  178|     89|      case 2:
  ------------------
  |  Branch (178:7): [True: 89, False: 145]
  ------------------
  179|     89|        cinfo->jpeg_color_space = JCS_YCCK;
  180|     89|        break;
  181|     78|      default:
  ------------------
  |  Branch (181:7): [True: 78, False: 156]
  ------------------
  182|     78|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  281|     78|  ((cinfo)->err->msg_code = (code), \
  |  |  282|     78|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  283|     78|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  183|     78|        cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
  184|     78|        break;
  185|    234|      }
  186|    234|    } else {
  187|       |      /* No special markers, assume straight CMYK. */
  188|    117|      cinfo->jpeg_color_space = JCS_CMYK;
  189|    117|    }
  190|    351|    cinfo->out_color_space = JCS_CMYK;
  191|    351|    break;
  192|       |
  193|    104|  default:
  ------------------
  |  Branch (193:3): [True: 104, False: 57.1k]
  ------------------
  194|    104|    cinfo->jpeg_color_space = JCS_UNKNOWN;
  195|    104|    cinfo->out_color_space = JCS_UNKNOWN;
  196|    104|    break;
  197|  57.3k|  }
  198|       |
  199|       |  /* Set defaults for other decompression parameters. */
  200|  57.3k|  cinfo->scale_num = 1;         /* 1:1 scaling */
  201|  57.3k|  cinfo->scale_denom = 1;
  202|  57.3k|  cinfo->output_gamma = 1.0;
  203|  57.3k|  cinfo->buffered_image = FALSE;
  ------------------
  |  |  206|  57.3k|#define FALSE   0               /* values of boolean */
  ------------------
  204|  57.3k|  cinfo->raw_data_out = FALSE;
  ------------------
  |  |  206|  57.3k|#define FALSE   0               /* values of boolean */
  ------------------
  205|  57.3k|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  253|  57.3k|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  206|  57.3k|  cinfo->do_fancy_upsampling = TRUE;
  ------------------
  |  |  209|  57.3k|#define TRUE    1
  ------------------
  207|  57.3k|  cinfo->do_block_smoothing = TRUE;
  ------------------
  |  |  209|  57.3k|#define TRUE    1
  ------------------
  208|  57.3k|  cinfo->quantize_colors = FALSE;
  ------------------
  |  |  206|  57.3k|#define FALSE   0               /* values of boolean */
  ------------------
  209|       |  /* We set these in case application only sets quantize_colors. */
  210|  57.3k|  cinfo->dither_mode = JDITHER_FS;
  211|  57.3k|#ifdef QUANT_2PASS_SUPPORTED
  212|  57.3k|  cinfo->two_pass_quantize = TRUE;
  ------------------
  |  |  209|  57.3k|#define TRUE    1
  ------------------
  213|       |#else
  214|       |  cinfo->two_pass_quantize = FALSE;
  215|       |#endif
  216|  57.3k|  cinfo->desired_number_of_colors = 256;
  217|  57.3k|  cinfo->colormap = NULL;
  218|       |  /* Initialize for no mode change in buffered-image mode. */
  219|  57.3k|  cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  206|  57.3k|#define FALSE   0               /* values of boolean */
  ------------------
  220|  57.3k|  cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  206|  57.3k|#define FALSE   0               /* values of boolean */
  ------------------
  221|  57.3k|  cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  206|  57.3k|#define FALSE   0               /* values of boolean */
  ------------------
  222|  57.3k|}

jpeg_start_decompress:
   46|  54.4k|{
   47|  54.4k|  if (cinfo->global_state == DSTATE_READY) {
  ------------------
  |  |   37|  54.4k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (47:7): [True: 54.4k, False: 0]
  ------------------
   48|       |    /* First call: initialize master control, select active modules */
   49|  54.4k|    jinit_master_decompress(cinfo);
   50|  54.4k|    if (cinfo->buffered_image) {
  ------------------
  |  Branch (50:9): [True: 0, False: 54.4k]
  ------------------
   51|       |      /* No more work here; expecting jpeg_start_output next */
   52|      0|      cinfo->global_state = DSTATE_BUFIMAGE;
  ------------------
  |  |   42|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
   53|      0|      return TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
   54|      0|    }
   55|  54.4k|    cinfo->global_state = DSTATE_PRELOAD;
  ------------------
  |  |   38|  54.4k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
   56|  54.4k|  }
   57|  54.4k|  if (cinfo->global_state == DSTATE_PRELOAD) {
  ------------------
  |  |   38|  54.4k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (57:7): [True: 51.5k, False: 2.88k]
  ------------------
   58|       |    /* If file has multiple scans, absorb them all into the coef buffer */
   59|  51.5k|    if (cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (59:9): [True: 20.4k, False: 31.1k]
  ------------------
   60|  20.4k|#ifdef D_MULTISCAN_FILES_SUPPORTED
   61|  7.80M|      for (;;) {
   62|  7.80M|        int retcode;
   63|       |        /* Call progress monitor hook if present */
   64|  7.80M|        if (cinfo->progress != NULL)
  ------------------
  |  Branch (64:13): [True: 7.80M, False: 0]
  ------------------
   65|  7.80M|          (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
   66|       |        /* Absorb some more input */
   67|  7.80M|        retcode = (*cinfo->inputctl->consume_input) (cinfo);
   68|  7.80M|        if (retcode == JPEG_SUSPENDED)
  ------------------
  |  |  987|  7.80M|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (68:13): [True: 0, False: 7.80M]
  ------------------
   69|      0|          return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
   70|  7.80M|        if (retcode == JPEG_REACHED_EOI)
  ------------------
  |  | 1021|  7.80M|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (70:13): [True: 15.5k, False: 7.78M]
  ------------------
   71|  15.5k|          break;
   72|       |        /* Advance progress counter if appropriate */
   73|  7.78M|        if (cinfo->progress != NULL &&
  ------------------
  |  Branch (73:13): [True: 7.78M, False: 4.90k]
  ------------------
   74|  7.78M|            (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1022|  15.5M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
                          (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1020|  36.5k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (74:14): [True: 7.74M, False: 36.5k]
  |  Branch (74:47): [True: 8.06k, False: 28.4k]
  ------------------
   75|  7.75M|          if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
  ------------------
  |  Branch (75:15): [True: 1.09k, False: 7.75M]
  ------------------
   76|       |            /* jdmaster underestimated number of scans; ratchet up one scan */
   77|  1.09k|            cinfo->progress->pass_limit += (long)cinfo->total_iMCU_rows;
   78|  1.09k|          }
   79|  7.75M|        }
   80|  7.78M|      }
   81|       |#else
   82|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
   83|       |#endif /* D_MULTISCAN_FILES_SUPPORTED */
   84|  20.4k|    }
   85|  51.5k|    cinfo->output_scan_number = cinfo->input_scan_number;
   86|  51.5k|  } else if (cinfo->global_state != DSTATE_PRESCAN)
  ------------------
  |  |   39|  2.88k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (86:14): [True: 0, False: 2.88k]
  ------------------
   87|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   88|       |  /* Perform any dummy output passes, and set up for the final pass */
   89|  54.4k|  return output_pass_setup(cinfo);
   90|  54.4k|}
jpeg_read_scanlines:
  279|   251M|{
  280|   251M|  JDIMENSION row_ctr;
  281|       |
  282|   251M|  if (cinfo->global_state != DSTATE_SCANNING)
  ------------------
  |  |   40|   251M|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (282:7): [True: 0, False: 251M]
  ------------------
  283|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  284|   251M|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (284:7): [True: 206M, False: 44.4M]
  ------------------
  285|   206M|    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
  ------------------
  |  |  278|   206M|  ((cinfo)->err->msg_code = (code), \
  |  |  279|   206M|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  286|   206M|    return 0;
  287|   206M|  }
  288|       |
  289|       |  /* Call progress monitor hook if present */
  290|  44.4M|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (290:7): [True: 32.2M, False: 12.1M]
  ------------------
  291|  32.2M|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  292|  32.2M|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  293|  32.2M|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  294|  32.2M|  }
  295|       |
  296|       |  /* Process some data */
  297|  44.4M|  row_ctr = 0;
  298|  44.4M|  (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines);
  299|  44.4M|  cinfo->output_scanline += row_ctr;
  300|  44.4M|  return row_ctr;
  301|   251M|}
jpeg_read_raw_data:
  602|   940k|{
  603|   940k|  JDIMENSION lines_per_iMCU_row;
  604|       |
  605|   940k|  if (cinfo->global_state != DSTATE_RAW_OK)
  ------------------
  |  |   41|   940k|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (605:7): [True: 0, False: 940k]
  ------------------
  606|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  607|   940k|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (607:7): [True: 697k, False: 243k]
  ------------------
  608|   697k|    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
  ------------------
  |  |  278|   697k|  ((cinfo)->err->msg_code = (code), \
  |  |  279|   697k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  609|   697k|    return 0;
  610|   697k|  }
  611|       |
  612|       |  /* Call progress monitor hook if present */
  613|   243k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (613:7): [True: 0, False: 243k]
  ------------------
  614|      0|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  615|      0|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  616|      0|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  617|      0|  }
  618|       |
  619|       |  /* Verify that at least one iMCU row can be returned. */
  620|   243k|  lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|   243k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  621|   243k|  if (max_lines < lines_per_iMCU_row)
  ------------------
  |  Branch (621:7): [True: 0, False: 243k]
  ------------------
  622|      0|    ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  623|       |
  624|       |  /* Decompress directly into user's buffer. */
  625|   243k|  if (!(*cinfo->coef->decompress_data) (cinfo, data))
  ------------------
  |  Branch (625:7): [True: 0, False: 243k]
  ------------------
  626|      0|    return 0;                   /* suspension forced, can do nothing more */
  627|       |
  628|       |  /* OK, we processed one iMCU row. */
  629|   243k|  cinfo->output_scanline += lines_per_iMCU_row;
  630|   243k|  return lines_per_iMCU_row;
  631|   243k|}
jdapistd.c:output_pass_setup:
  103|  46.6k|{
  104|  46.6k|  if (cinfo->global_state != DSTATE_PRESCAN) {
  ------------------
  |  |   39|  46.6k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (104:7): [True: 46.6k, False: 0]
  ------------------
  105|       |    /* First call: do pass setup */
  106|  46.6k|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  107|  46.6k|    cinfo->output_scanline = 0;
  108|  46.6k|    cinfo->global_state = DSTATE_PRESCAN;
  ------------------
  |  |   39|  46.6k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  109|  46.6k|  }
  110|       |  /* Loop over any required dummy passes */
  111|  46.6k|  while (cinfo->master->is_dummy_pass) {
  ------------------
  |  Branch (111:10): [True: 0, False: 46.6k]
  ------------------
  112|      0|#ifdef QUANT_2PASS_SUPPORTED
  113|       |    /* Crank through the dummy pass */
  114|      0|    while (cinfo->output_scanline < cinfo->output_height) {
  ------------------
  |  Branch (114:12): [True: 0, False: 0]
  ------------------
  115|      0|      JDIMENSION last_scanline;
  116|       |      /* Call progress monitor hook if present */
  117|      0|      if (cinfo->progress != NULL) {
  ------------------
  |  Branch (117:11): [True: 0, False: 0]
  ------------------
  118|      0|        cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  119|      0|        cinfo->progress->pass_limit = (long)cinfo->output_height;
  120|      0|        (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  121|      0|      }
  122|       |      /* Process some data */
  123|      0|      last_scanline = cinfo->output_scanline;
  124|      0|      (*cinfo->main->process_data) (cinfo, (JSAMPARRAY)NULL,
  125|      0|                                    &cinfo->output_scanline, (JDIMENSION)0);
  126|      0|      if (cinfo->output_scanline == last_scanline)
  ------------------
  |  Branch (126:11): [True: 0, False: 0]
  ------------------
  127|      0|        return FALSE;           /* No progress made, must suspend */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  128|      0|    }
  129|       |    /* Finish up dummy pass, and set up for another one */
  130|      0|    (*cinfo->master->finish_output_pass) (cinfo);
  131|      0|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  132|      0|    cinfo->output_scanline = 0;
  133|       |#else
  134|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  135|       |#endif /* QUANT_2PASS_SUPPORTED */
  136|      0|  }
  137|       |  /* Ready for application to drive output pass through
  138|       |   * jpeg_read_scanlines or jpeg_read_raw_data.
  139|       |   */
  140|  46.6k|  cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
  ------------------
  |  |   41|    169|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
                cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
  ------------------
  |  |   40|  93.2k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (140:25): [True: 169, False: 46.5k]
  ------------------
  141|  46.6k|  return TRUE;
  ------------------
  |  |  209|  46.6k|#define TRUE    1
  ------------------
  142|  46.6k|}

jinit_arith_decoder:
  751|  20.8k|{
  752|  20.8k|  arith_entropy_ptr entropy;
  753|  20.8k|  int i;
  754|       |
  755|  20.8k|  entropy = (arith_entropy_ptr)
  756|  20.8k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  20.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  757|  20.8k|                                sizeof(arith_entropy_decoder));
  758|  20.8k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  759|  20.8k|  entropy->pub.start_pass = start_pass;
  760|       |
  761|       |  /* Mark tables unallocated */
  762|   354k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   50|   354k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 333k, False: 20.8k]
  ------------------
  763|   333k|    entropy->dc_stats[i] = NULL;
  764|   333k|    entropy->ac_stats[i] = NULL;
  765|   333k|  }
  766|       |
  767|       |  /* Initialize index for fixed probability estimation */
  768|  20.8k|  entropy->fixed_bin[0] = 113;
  769|       |
  770|  20.8k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (770:7): [True: 10.5k, False: 10.3k]
  ------------------
  771|       |    /* Create progression status table */
  772|  10.5k|    int *coef_bit_ptr, ci;
  773|  10.5k|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|  10.5k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  10.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|  10.5k|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   47|  10.5k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|  10.5k|                                  sizeof(int));
  777|  10.5k|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|  24.6k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 14.0k, False: 10.5k]
  ------------------
  779|   916k|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   47|   916k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 902k, False: 14.0k]
  ------------------
  780|   902k|        *coef_bit_ptr++ = -1;
  781|  10.5k|  }
  782|  20.8k|}
jdarith.c:start_pass:
  633|  24.6k|{
  634|  24.6k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|  24.6k|  int ci, tbl;
  636|  24.6k|  jpeg_component_info *compptr;
  637|       |
  638|  24.6k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 13.6k, False: 10.9k]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|  13.6k|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 7.86k, False: 5.78k]
  ------------------
  641|  7.86k|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 245, False: 7.62k]
  ------------------
  642|    245|        goto bad;
  643|  7.86k|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|  5.78k|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   47|  5.56k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 223, False: 5.56k]
  |  Branch (645:36): [True: 251, False: 5.31k]
  ------------------
  646|    474|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|  5.31k|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 292, False: 5.01k]
  ------------------
  649|    292|        goto bad;
  650|  5.31k|    }
  651|  12.6k|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 3.44k, False: 9.19k]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|  3.44k|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 277, False: 3.17k]
  ------------------
  654|    277|        goto bad;
  655|  3.44k|    }
  656|  12.3k|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 275, False: 12.0k]
  ------------------
  657|  1.56k|bad:
  658|  1.56k|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  253|  1.56k|  ((cinfo)->err->msg_code = (code), \
  |  |  254|  1.56k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  255|  1.56k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  256|  1.56k|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  257|  1.56k|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  258|  1.56k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|  1.56k|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|  1.56k|    }
  661|       |    /* Update progression status, and verify that scan order is legal.
  662|       |     * Note that inter-scan inconsistencies are treated as warnings
  663|       |     * not fatal errors ... not clear if this is right way to behave.
  664|       |     */
  665|  27.9k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 14.3k, False: 13.6k]
  ------------------
  666|  14.3k|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|  14.3k|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|  14.3k|      int *prev_coef_bit_ptr =
  669|  14.3k|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|  14.3k|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 4.88k, False: 9.45k]
  |  Branch (670:24): [True: 4.49k, False: 388]
  ------------------
  671|  4.49k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  285|  4.49k|  ((cinfo)->err->msg_code = (code), \
  |  |  286|  4.49k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  287|  4.49k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  288|  4.49k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  672|   230k|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  295|  14.3k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (295:26): [True: 9.45k, False: 4.88k]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  293|   230k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (293:26): [True: 110k, False: 119k]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 216k, False: 14.3k]
  ------------------
  673|   216k|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 37.6k, False: 178k]
  ------------------
  674|  37.6k|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|   178k|        else
  676|   178k|          prev_coef_bit_ptr[coefi] = 0;
  677|   216k|      }
  678|   115k|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 101k, False: 14.3k]
  ------------------
  679|   101k|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 94.1k, False: 7.07k]
  ------------------
  680|   101k|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 35.7k, False: 65.4k]
  ------------------
  681|  35.7k|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  285|  35.7k|  ((cinfo)->err->msg_code = (code), \
  |  |  286|  35.7k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  287|  35.7k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  288|  35.7k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  682|   101k|        coef_bit_ptr[coefi] = cinfo->Al;
  683|   101k|      }
  684|  14.3k|    }
  685|       |    /* Select MCU decoding routine */
  686|  13.6k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 9.15k, False: 4.50k]
  ------------------
  687|  9.15k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 6.07k, False: 3.08k]
  ------------------
  688|  6.07k|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|  3.08k|      else
  690|  3.08k|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|  9.15k|    } else {
  692|  4.50k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 1.13k, False: 3.36k]
  ------------------
  693|  1.13k|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|  3.36k|      else
  695|  3.36k|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|  4.50k|    }
  697|  13.6k|  } else {
  698|       |    /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
  699|       |     * This ought to be an error condition, but we make it a warning.
  700|       |     */
  701|  10.9k|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   47|  3.04k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 7.91k, False: 3.04k]
  |  Branch (701:27): [True: 1.57k, False: 1.46k]
  ------------------
  702|  10.9k|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 485, False: 983]
  |  Branch (702:27): [True: 435, False: 548]
  ------------------
  703|  10.4k|      WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  278|  10.4k|  ((cinfo)->err->msg_code = (code), \
  |  |  279|  10.4k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  704|       |    /* Select MCU decoding routine */
  705|  10.9k|    entropy->pub.decode_mcu = decode_mcu;
  706|  10.9k|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|  51.6k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 26.9k, False: 24.6k]
  ------------------
  710|  26.9k|    compptr = cinfo->cur_comp_info[ci];
  711|  26.9k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 12.6k, False: 14.3k]
  |  Branch (711:38): [True: 9.45k, False: 4.88k]
  |  Branch (711:56): [True: 7.57k, False: 1.87k]
  ------------------
  712|  20.2k|      tbl = compptr->dc_tbl_no;
  713|  20.2k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   50|  20.2k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 20.2k]
  |  Branch (713:22): [True: 0, False: 20.2k]
  ------------------
  714|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  715|  20.2k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 18.2k, False: 2.00k]
  ------------------
  716|  18.2k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|  18.2k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  826|  18.2k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  18.2k|#define DC_STAT_BINS  64
  ------------------
  718|  20.2k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  20.2k|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|  20.2k|      entropy->last_dc_val[ci] = 0;
  721|  20.2k|      entropy->dc_context[ci] = 0;
  722|  20.2k|    }
  723|  26.9k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 12.6k, False: 14.3k]
  |  Branch (723:37): [True: 4.88k, False: 9.45k]
  ------------------
  724|  17.5k|      tbl = compptr->ac_tbl_no;
  725|  17.5k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   50|  17.5k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 17.5k]
  |  Branch (725:22): [True: 0, False: 17.5k]
  ------------------
  726|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  727|  17.5k|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 16.4k, False: 1.10k]
  ------------------
  728|  16.4k|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|  16.4k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  826|  16.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|  16.4k|#define AC_STAT_BINS  256
  ------------------
  730|  17.5k|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  17.5k|#define AC_STAT_BINS  256
  ------------------
  731|  17.5k|    }
  732|  26.9k|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|  24.6k|  entropy->c = 0;
  736|  24.6k|  entropy->a = 0;
  737|  24.6k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|  24.6k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  24.6k|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|  24.6k|  entropy->restarts_to_go = cinfo->restart_interval;
  742|  24.6k|}
jdarith.c:decode_mcu_DC_first:
  251|   188M|{
  252|   188M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  253|   188M|  JBLOCKROW block;
  254|   188M|  unsigned char *st;
  255|   188M|  int blkn, ci, tbl, sign;
  256|   188M|  int v, m;
  257|       |
  258|       |  /* Process restart marker if needed */
  259|   188M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (259:7): [True: 4.36M, False: 184M]
  ------------------
  260|  4.36M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (260:9): [True: 7.20k, False: 4.36M]
  ------------------
  261|  7.20k|      process_restart(cinfo);
  262|  4.36M|    entropy->restarts_to_go--;
  263|  4.36M|  }
  264|       |
  265|   188M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  209|   455k|#define TRUE    1
  ------------------
  |  Branch (265:7): [True: 455k, False: 188M]
  ------------------
  266|       |
  267|       |  /* Outer loop handles each block in the MCU */
  268|       |
  269|   376M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (269:18): [True: 188M, False: 188M]
  ------------------
  270|   188M|    block = MCU_data[blkn];
  271|   188M|    ci = cinfo->MCU_membership[blkn];
  272|   188M|    tbl = cinfo->cur_comp_info[ci]->dc_tbl_no;
  273|       |
  274|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  275|       |
  276|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  277|   188M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  278|       |
  279|       |    /* Figure F.19: Decode_DC_DIFF */
  280|   188M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (280:9): [True: 72.7M, False: 115M]
  ------------------
  281|  72.7M|      entropy->dc_context[ci] = 0;
  282|   115M|    else {
  283|       |      /* Figure F.21: Decoding nonzero value v */
  284|       |      /* Figure F.22: Decoding the sign of v */
  285|   115M|      sign = arith_decode(cinfo, st + 1);
  286|   115M|      st += 2;  st += sign;
  287|       |      /* Figure F.23: Decoding the magnitude category of v */
  288|   115M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (288:11): [True: 69.5M, False: 46.0M]
  ------------------
  289|  69.5M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  290|   125M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (290:16): [True: 55.7M, False: 69.5M]
  ------------------
  291|  55.7M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (291:15): [True: 230, False: 55.7M]
  ------------------
  292|    230|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  278|    230|  ((cinfo)->err->msg_code = (code), \
  |  |  279|    230|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  293|    230|            entropy->ct = -1;                   /* magnitude overflow */
  294|    230|            return TRUE;
  ------------------
  |  |  209|    230|#define TRUE    1
  ------------------
  295|    230|          }
  296|  55.7M|          st += 1;
  297|  55.7M|        }
  298|  69.5M|      }
  299|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  300|   115M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (300:11): [True: 179k, False: 115M]
  ------------------
  301|   179k|        entropy->dc_context[ci] = 0;               /* zero diff category */
  302|   115M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (302:16): [True: 43.1M, False: 72.2M]
  ------------------
  303|  43.1M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  304|  72.2M|      else
  305|  72.2M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  306|   115M|      v = m;
  307|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  308|   115M|      st += 14;
  309|   171M|      while (m >>= 1)
  ------------------
  |  Branch (309:14): [True: 55.7M, False: 115M]
  ------------------
  310|  55.7M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (310:13): [True: 24.9M, False: 30.8M]
  ------------------
  311|   115M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (311:20): [True: 49.2M, False: 66.3M]
  ------------------
  312|   115M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  313|   115M|    }
  314|       |
  315|       |    /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
  316|   188M|    (*block)[0] = (JCOEF)LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
  ------------------
  |  |   69|   188M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  317|   188M|  }
  318|       |
  319|   188M|  return TRUE;
  ------------------
  |  |  209|   188M|#define TRUE    1
  ------------------
  320|   188M|}
jdarith.c:process_restart:
  200|   142k|{
  201|   142k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  202|   142k|  int ci;
  203|   142k|  jpeg_component_info *compptr;
  204|       |
  205|       |  /* Advance past the RSTn marker */
  206|   142k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (206:7): [True: 0, False: 142k]
  ------------------
  207|      0|    ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  208|       |
  209|       |  /* Re-initialize statistics areas */
  210|   290k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (210:16): [True: 147k, False: 142k]
  ------------------
  211|   147k|    compptr = cinfo->cur_comp_info[ci];
  212|   147k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (212:9): [True: 3.69k, False: 144k]
  |  Branch (212:38): [True: 17.9k, False: 126k]
  |  Branch (212:56): [True: 8.30k, False: 9.63k]
  ------------------
  213|  11.9k|      memset(entropy->dc_stats[compptr->dc_tbl_no], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  11.9k|#define DC_STAT_BINS  64
  ------------------
  214|       |      /* Reset DC predictions to 0 */
  215|  11.9k|      entropy->last_dc_val[ci] = 0;
  216|  11.9k|      entropy->dc_context[ci] = 0;
  217|  11.9k|    }
  218|   147k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (218:9): [True: 3.69k, False: 144k]
  |  Branch (218:37): [True: 126k, False: 17.9k]
  ------------------
  219|   129k|      memset(entropy->ac_stats[compptr->ac_tbl_no], 0, AC_STAT_BINS);
  ------------------
  |  |   70|   129k|#define AC_STAT_BINS  256
  ------------------
  220|   129k|    }
  221|   147k|  }
  222|       |
  223|       |  /* Reset arithmetic decoding variables */
  224|   142k|  entropy->c = 0;
  225|   142k|  entropy->a = 0;
  226|   142k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  227|       |
  228|       |  /* Reset restart counter */
  229|   142k|  entropy->restarts_to_go = cinfo->restart_interval;
  230|   142k|}
jdarith.c:arith_decode:
  116|  1.11G|{
  117|  1.11G|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  118|  1.11G|  register unsigned char nl, nm;
  119|  1.11G|  register JLONG qe, temp;
  120|  1.11G|  register int sv, data;
  121|       |
  122|       |  /* Renormalization & data input per section D.2.6 */
  123|  1.26G|  while (e->a < 0x8000L) {
  ------------------
  |  Branch (123:10): [True: 146M, False: 1.11G]
  ------------------
  124|   146M|    if (--e->ct < 0) {
  ------------------
  |  Branch (124:9): [True: 18.6M, False: 127M]
  ------------------
  125|       |      /* Need to fetch next data byte */
  126|  18.6M|      if (cinfo->unread_marker)
  ------------------
  |  Branch (126:11): [True: 18.1M, False: 507k]
  ------------------
  127|  18.1M|        data = 0;               /* stuff zero data */
  128|   507k|      else {
  129|   507k|        data = get_byte(cinfo); /* read next input byte */
  130|   507k|        if (data == 0xFF) {     /* zero stuff or marker code */
  ------------------
  |  Branch (130:13): [True: 21.4k, False: 486k]
  ------------------
  131|  64.3k|          do data = get_byte(cinfo);
  132|  64.3k|          while (data == 0xFF); /* swallow extra 0xFF bytes */
  ------------------
  |  Branch (132:18): [True: 42.8k, False: 21.4k]
  ------------------
  133|  21.4k|          if (data == 0)
  ------------------
  |  Branch (133:15): [True: 3.42k, False: 18.0k]
  ------------------
  134|  3.42k|            data = 0xFF;        /* discard stuffed zero byte */
  135|  18.0k|          else {
  136|       |            /* Note: Different from the Huffman decoder, hitting
  137|       |             * a marker while processing the compressed data
  138|       |             * segment is legal in arithmetic coding.
  139|       |             * The convention is to supply zero data
  140|       |             * then until decoding is complete.
  141|       |             */
  142|  18.0k|            cinfo->unread_marker = data;
  143|  18.0k|            data = 0;
  144|  18.0k|          }
  145|  21.4k|        }
  146|   507k|      }
  147|  18.6M|      e->c = (e->c << 8) | data; /* insert data into C register */
  148|  18.6M|      if ((e->ct += 8) < 0)      /* update bit shift counter */
  ------------------
  |  Branch (148:11): [True: 330k, False: 18.3M]
  ------------------
  149|       |        /* Need more initial bytes */
  150|   330k|        if (++e->ct == 0)
  ------------------
  |  Branch (150:13): [True: 165k, False: 165k]
  ------------------
  151|       |          /* Got 2 initial bytes -> re-init A and exit loop */
  152|   165k|          e->a = 0x8000L; /* => e->a = 0x10000L after loop exit */
  153|  18.6M|    }
  154|   146M|    e->a <<= 1;
  155|   146M|  }
  156|       |
  157|       |  /* Fetch values from our compact representation of Table D.2:
  158|       |   * Qe values and probability estimation state machine
  159|       |   */
  160|  1.11G|  sv = *st;
  161|  1.11G|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  162|  1.11G|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  163|  1.11G|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  164|       |
  165|       |  /* Decode & estimation procedures per sections D.2.4 & D.2.5 */
  166|  1.11G|  temp = e->a - qe;
  167|  1.11G|  e->a = temp;
  168|  1.11G|  temp <<= e->ct;
  169|  1.11G|  if (e->c >= temp) {
  ------------------
  |  Branch (169:7): [True: 23.6M, False: 1.09G]
  ------------------
  170|  23.6M|    e->c -= temp;
  171|       |    /* Conditional LPS (less probable symbol) exchange */
  172|  23.6M|    if (e->a < qe) {
  ------------------
  |  Branch (172:9): [True: 4.84M, False: 18.7M]
  ------------------
  173|  4.84M|      e->a = qe;
  174|  4.84M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  175|  18.7M|    } else {
  176|  18.7M|      e->a = qe;
  177|  18.7M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  178|  18.7M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  179|  18.7M|    }
  180|  1.09G|  } else if (e->a < 0x8000L) {
  ------------------
  |  Branch (180:14): [True: 87.2M, False: 1.00G]
  ------------------
  181|       |    /* Conditional MPS (more probable symbol) exchange */
  182|  87.2M|    if (e->a < qe) {
  ------------------
  |  Branch (182:9): [True: 42.3M, False: 44.9M]
  ------------------
  183|  42.3M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  184|  42.3M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  185|  44.9M|    } else {
  186|  44.9M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  187|  44.9M|    }
  188|  87.2M|  }
  189|       |
  190|  1.11G|  return sv >> 7;
  191|  1.11G|}
jdarith.c:get_byte:
   76|   571k|{
   77|   571k|  struct jpeg_source_mgr *src = cinfo->src;
   78|       |
   79|   571k|  if (src->bytes_in_buffer == 0)
  ------------------
  |  Branch (79:7): [True: 6.40k, False: 565k]
  ------------------
   80|  6.40k|    if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (80:9): [True: 0, False: 6.40k]
  ------------------
   81|      0|      ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   82|   571k|  src->bytes_in_buffer--;
   83|   571k|  return *src->next_input_byte++;
   84|   571k|}
jdarith.c:decode_mcu_AC_first:
  330|  45.6M|{
  331|  45.6M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  332|  45.6M|  JBLOCKROW block;
  333|  45.6M|  unsigned char *st;
  334|  45.6M|  int tbl, sign, k;
  335|  45.6M|  int v, m;
  336|       |
  337|       |  /* Process restart marker if needed */
  338|  45.6M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (338:7): [True: 10.6M, False: 35.0M]
  ------------------
  339|  10.6M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (339:9): [True: 4.66k, False: 10.6M]
  ------------------
  340|  4.66k|      process_restart(cinfo);
  341|  10.6M|    entropy->restarts_to_go--;
  342|  10.6M|  }
  343|       |
  344|  45.6M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  209|  24.2M|#define TRUE    1
  ------------------
  |  Branch (344:7): [True: 24.2M, False: 21.4M]
  ------------------
  345|       |
  346|       |  /* There is always only one block per MCU */
  347|  21.4M|  block = MCU_data[0];
  348|  21.4M|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  349|       |
  350|       |  /* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */
  351|       |
  352|       |  /* Figure F.20: Decode_AC_coefficients */
  353|  35.1M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (353:23): [True: 34.8M, False: 272k]
  ------------------
  354|  34.8M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  355|  34.8M|    if (arith_decode(cinfo, st)) break;         /* EOB flag */
  ------------------
  |  Branch (355:9): [True: 21.1M, False: 13.6M]
  ------------------
  356|  22.2M|    while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (356:12): [True: 8.63M, False: 13.6M]
  ------------------
  357|  8.63M|      st += 3;  k++;
  358|  8.63M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (358:11): [True: 1.29k, False: 8.63M]
  ------------------
  359|  1.29k|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  278|  1.29k|  ((cinfo)->err->msg_code = (code), \
  |  |  279|  1.29k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  360|  1.29k|        entropy->ct = -1;                       /* spectral overflow */
  361|  1.29k|        return TRUE;
  ------------------
  |  |  209|  1.29k|#define TRUE    1
  ------------------
  362|  1.29k|      }
  363|  8.63M|    }
  364|       |    /* Figure F.21: Decoding nonzero value v */
  365|       |    /* Figure F.22: Decoding the sign of v */
  366|  13.6M|    sign = arith_decode(cinfo, entropy->fixed_bin);
  367|  13.6M|    st += 2;
  368|       |    /* Figure F.23: Decoding the magnitude category of v */
  369|  13.6M|    if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (369:9): [True: 9.77M, False: 3.87M]
  ------------------
  370|  9.77M|      if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (370:11): [True: 9.65M, False: 124k]
  ------------------
  371|  9.65M|        m <<= 1;
  372|  9.65M|        st = entropy->ac_stats[tbl] +
  373|  9.65M|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (373:15): [True: 7.51M, False: 2.13M]
  ------------------
  374|  18.8M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (374:16): [True: 9.17M, False: 9.65M]
  ------------------
  375|  9.17M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (375:15): [True: 230, False: 9.17M]
  ------------------
  376|    230|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  278|    230|  ((cinfo)->err->msg_code = (code), \
  |  |  279|    230|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  377|    230|            entropy->ct = -1;                   /* magnitude overflow */
  378|    230|            return TRUE;
  ------------------
  |  |  209|    230|#define TRUE    1
  ------------------
  379|    230|          }
  380|  9.17M|          st += 1;
  381|  9.17M|        }
  382|  9.65M|      }
  383|  9.77M|    }
  384|  13.6M|    v = m;
  385|       |    /* Figure F.24: Decoding the magnitude bit pattern of v */
  386|  13.6M|    st += 14;
  387|  32.4M|    while (m >>= 1)
  ------------------
  |  Branch (387:12): [True: 18.8M, False: 13.6M]
  ------------------
  388|  18.8M|      if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (388:11): [True: 5.68M, False: 13.1M]
  ------------------
  389|  13.6M|    v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (389:18): [True: 6.89M, False: 6.76M]
  ------------------
  390|       |    /* Scale and output coefficient in natural (dezigzagged) order */
  391|  13.6M|    (*block)[jpeg_natural_order[k]] = (JCOEF)((unsigned)v << cinfo->Al);
  392|  13.6M|  }
  393|       |
  394|  21.4M|  return TRUE;
  ------------------
  |  |  209|  21.4M|#define TRUE    1
  ------------------
  395|  21.4M|}
jdarith.c:decode_mcu_DC_refine:
  404|  15.3M|{
  405|  15.3M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  406|  15.3M|  unsigned char *st;
  407|  15.3M|  int p1, blkn;
  408|       |
  409|       |  /* Process restart marker if needed */
  410|  15.3M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (410:7): [True: 785k, False: 14.5M]
  ------------------
  411|   785k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (411:9): [True: 6.16k, False: 779k]
  ------------------
  412|  6.16k|      process_restart(cinfo);
  413|   785k|    entropy->restarts_to_go--;
  414|   785k|  }
  415|       |
  416|  15.3M|  st = entropy->fixed_bin;      /* use fixed probability estimation */
  417|  15.3M|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  418|       |
  419|       |  /* Outer loop handles each block in the MCU */
  420|       |
  421|  32.3M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (421:18): [True: 17.0M, False: 15.3M]
  ------------------
  422|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  423|  17.0M|    if (arith_decode(cinfo, st))
  ------------------
  |  Branch (423:9): [True: 8.55M, False: 8.49M]
  ------------------
  424|  8.55M|      MCU_data[blkn][0][0] |= p1;
  425|  17.0M|  }
  426|       |
  427|  15.3M|  return TRUE;
  ------------------
  |  |  209|  15.3M|#define TRUE    1
  ------------------
  428|  15.3M|}
jdarith.c:decode_mcu_AC_refine:
  437|  62.2M|{
  438|  62.2M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  439|  62.2M|  JBLOCKROW block;
  440|  62.2M|  JCOEFPTR thiscoef;
  441|  62.2M|  unsigned char *st;
  442|  62.2M|  int tbl, k, kex;
  443|  62.2M|  int p1, m1;
  444|       |
  445|       |  /* Process restart marker if needed */
  446|  62.2M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (446:7): [True: 1.25M, False: 60.9M]
  ------------------
  447|  1.25M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (447:9): [True: 121k, False: 1.13M]
  ------------------
  448|   121k|      process_restart(cinfo);
  449|  1.25M|    entropy->restarts_to_go--;
  450|  1.25M|  }
  451|       |
  452|  62.2M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  209|  24.8M|#define TRUE    1
  ------------------
  |  Branch (452:7): [True: 24.8M, False: 37.4M]
  ------------------
  453|       |
  454|       |  /* There is always only one block per MCU */
  455|  37.4M|  block = MCU_data[0];
  456|  37.4M|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  457|       |
  458|  37.4M|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  459|  37.4M|  m1 = (NEG_1) << cinfo->Al;    /* -1 in the bit position being coded */
  ------------------
  |  |   27|  37.4M|#define NEG_1  ((unsigned int)-1)
  ------------------
  460|       |
  461|       |  /* Establish EOBx (previous stage end-of-block) index */
  462|  1.16G|  for (kex = cinfo->Se; kex > 0; kex--)
  ------------------
  |  Branch (462:25): [True: 1.12G, False: 34.6M]
  ------------------
  463|  1.12G|    if ((*block)[jpeg_natural_order[kex]]) break;
  ------------------
  |  Branch (463:9): [True: 2.74M, False: 1.12G]
  ------------------
  464|       |
  465|   106M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (465:23): [True: 106M, False: 1.86k]
  ------------------
  466|   106M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  467|   106M|    if (k > kex)
  ------------------
  |  Branch (467:9): [True: 90.4M, False: 15.9M]
  ------------------
  468|  90.4M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (468:11): [True: 37.4M, False: 53.0M]
  ------------------
  469|   124M|    for (;;) {
  470|   124M|      thiscoef = *block + jpeg_natural_order[k];
  471|   124M|      if (*thiscoef) {                          /* previously nonzero coef */
  ------------------
  |  Branch (471:11): [True: 8.66M, False: 116M]
  ------------------
  472|  8.66M|        if (arith_decode(cinfo, st + 2)) {
  ------------------
  |  Branch (472:13): [True: 5.92M, False: 2.74M]
  ------------------
  473|  5.92M|          if (*thiscoef < 0)
  ------------------
  |  Branch (473:15): [True: 3.13M, False: 2.78M]
  ------------------
  474|  3.13M|            *thiscoef += (JCOEF)m1;
  475|  2.78M|          else
  476|  2.78M|            *thiscoef += (JCOEF)p1;
  477|  5.92M|        }
  478|  8.66M|        break;
  479|  8.66M|      }
  480|   116M|      if (arith_decode(cinfo, st + 1)) {        /* newly nonzero coef */
  ------------------
  |  Branch (480:11): [True: 60.3M, False: 55.6M]
  ------------------
  481|  60.3M|        if (arith_decode(cinfo, entropy->fixed_bin))
  ------------------
  |  Branch (481:13): [True: 28.6M, False: 31.6M]
  ------------------
  482|  28.6M|          *thiscoef = (JCOEF)m1;
  483|  31.6M|        else
  484|  31.6M|          *thiscoef = (JCOEF)p1;
  485|  60.3M|        break;
  486|  60.3M|      }
  487|  55.6M|      st += 3;  k++;
  488|  55.6M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (488:11): [True: 947, False: 55.6M]
  ------------------
  489|    947|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  278|    947|  ((cinfo)->err->msg_code = (code), \
  |  |  279|    947|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  490|    947|        entropy->ct = -1;                       /* spectral overflow */
  491|    947|        return TRUE;
  ------------------
  |  |  209|    947|#define TRUE    1
  ------------------
  492|    947|      }
  493|  55.6M|    }
  494|  69.0M|  }
  495|       |
  496|  37.4M|  return TRUE;
  ------------------
  |  |  209|  37.4M|#define TRUE    1
  ------------------
  497|  37.4M|}
jdarith.c:decode_mcu:
  506|  10.6M|{
  507|  10.6M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  508|  10.6M|  jpeg_component_info *compptr;
  509|  10.6M|  JBLOCKROW block;
  510|  10.6M|  unsigned char *st;
  511|  10.6M|  int blkn, ci, tbl, sign, k;
  512|  10.6M|  int v, m;
  513|       |
  514|       |  /* Process restart marker if needed */
  515|  10.6M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (515:7): [True: 20.0k, False: 10.6M]
  ------------------
  516|  20.0k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (516:9): [True: 2.85k, False: 17.2k]
  ------------------
  517|  2.85k|      process_restart(cinfo);
  518|  20.0k|    entropy->restarts_to_go--;
  519|  20.0k|  }
  520|       |
  521|  10.6M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  209|  1.19M|#define TRUE    1
  ------------------
  |  Branch (521:7): [True: 1.19M, False: 9.42M]
  ------------------
  522|       |
  523|       |  /* Outer loop handles each block in the MCU */
  524|       |
  525|  20.9M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (525:18): [True: 11.4M, False: 9.42M]
  ------------------
  526|  11.4M|    block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (526:13): [True: 11.4M, False: 0]
  ------------------
  527|  11.4M|    ci = cinfo->MCU_membership[blkn];
  528|  11.4M|    compptr = cinfo->cur_comp_info[ci];
  529|       |
  530|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  531|       |
  532|  11.4M|    tbl = compptr->dc_tbl_no;
  533|       |
  534|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  535|  11.4M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  536|       |
  537|       |    /* Figure F.19: Decode_DC_DIFF */
  538|  11.4M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (538:9): [True: 6.25M, False: 5.24M]
  ------------------
  539|  6.25M|      entropy->dc_context[ci] = 0;
  540|  5.24M|    else {
  541|       |      /* Figure F.21: Decoding nonzero value v */
  542|       |      /* Figure F.22: Decoding the sign of v */
  543|  5.24M|      sign = arith_decode(cinfo, st + 1);
  544|  5.24M|      st += 2;  st += sign;
  545|       |      /* Figure F.23: Decoding the magnitude category of v */
  546|  5.24M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (546:11): [True: 3.72M, False: 1.51M]
  ------------------
  547|  3.72M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  548|  11.3M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (548:16): [True: 7.62M, False: 3.72M]
  ------------------
  549|  7.62M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (549:15): [True: 317, False: 7.62M]
  ------------------
  550|    317|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  278|    317|  ((cinfo)->err->msg_code = (code), \
  |  |  279|    317|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  551|    317|            entropy->ct = -1;                   /* magnitude overflow */
  552|    317|            return TRUE;
  ------------------
  |  |  209|    317|#define TRUE    1
  ------------------
  553|    317|          }
  554|  7.62M|          st += 1;
  555|  7.62M|        }
  556|  3.72M|      }
  557|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  558|  5.24M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (558:11): [True: 14.9k, False: 5.23M]
  ------------------
  559|  14.9k|        entropy->dc_context[ci] = 0;               /* zero diff category */
  560|  5.23M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (560:16): [True: 2.48M, False: 2.74M]
  ------------------
  561|  2.48M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  562|  2.74M|      else
  563|  2.74M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  564|  5.24M|      v = m;
  565|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  566|  5.24M|      st += 14;
  567|  12.8M|      while (m >>= 1)
  ------------------
  |  Branch (567:14): [True: 7.61M, False: 5.24M]
  ------------------
  568|  7.61M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (568:13): [True: 1.11M, False: 6.50M]
  ------------------
  569|  5.24M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (569:20): [True: 3.14M, False: 2.09M]
  ------------------
  570|  5.24M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  571|  5.24M|    }
  572|       |
  573|  11.4M|    if (block)
  ------------------
  |  Branch (573:9): [True: 11.4M, False: 0]
  ------------------
  574|  11.4M|      (*block)[0] = (JCOEF)entropy->last_dc_val[ci];
  575|       |
  576|       |    /* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */
  577|       |
  578|  11.4M|    tbl = compptr->ac_tbl_no;
  579|       |
  580|       |    /* Figure F.20: Decode_AC_coefficients */
  581|  17.6M|    for (k = 1; k <= DCTSIZE2 - 1; k++) {
  ------------------
  |  |   47|  17.6M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (581:17): [True: 17.6M, False: 79]
  ------------------
  582|  17.6M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  583|  17.6M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (583:11): [True: 11.4M, False: 6.16M]
  ------------------
  584|  13.7M|      while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (584:14): [True: 7.61M, False: 6.16M]
  ------------------
  585|  7.61M|        st += 3;  k++;
  586|  7.61M|        if (k > DCTSIZE2 - 1) {
  ------------------
  |  |   47|  7.61M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (586:13): [True: 229, False: 7.61M]
  ------------------
  587|    229|          WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  278|    229|  ((cinfo)->err->msg_code = (code), \
  |  |  279|    229|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  588|    229|          entropy->ct = -1;                     /* spectral overflow */
  589|    229|          return TRUE;
  ------------------
  |  |  209|    229|#define TRUE    1
  ------------------
  590|    229|        }
  591|  7.61M|      }
  592|       |      /* Figure F.21: Decoding nonzero value v */
  593|       |      /* Figure F.22: Decoding the sign of v */
  594|  6.16M|      sign = arith_decode(cinfo, entropy->fixed_bin);
  595|  6.16M|      st += 2;
  596|       |      /* Figure F.23: Decoding the magnitude category of v */
  597|  6.16M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (597:11): [True: 2.63M, False: 3.52M]
  ------------------
  598|  2.63M|        if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (598:13): [True: 2.00M, False: 632k]
  ------------------
  599|  2.00M|          m <<= 1;
  600|  2.00M|          st = entropy->ac_stats[tbl] +
  601|  2.00M|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (601:17): [True: 1.33M, False: 675k]
  ------------------
  602|  3.59M|          while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (602:18): [True: 1.59M, False: 2.00M]
  ------------------
  603|  1.59M|            if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (603:17): [True: 491, False: 1.59M]
  ------------------
  604|    491|              WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  278|    491|  ((cinfo)->err->msg_code = (code), \
  |  |  279|    491|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  605|    491|              entropy->ct = -1;                 /* magnitude overflow */
  606|    491|              return TRUE;
  ------------------
  |  |  209|    491|#define TRUE    1
  ------------------
  607|    491|            }
  608|  1.59M|            st += 1;
  609|  1.59M|          }
  610|  2.00M|        }
  611|  2.63M|      }
  612|  6.16M|      v = m;
  613|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  614|  6.16M|      st += 14;
  615|  9.75M|      while (m >>= 1)
  ------------------
  |  Branch (615:14): [True: 3.59M, False: 6.16M]
  ------------------
  616|  3.59M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (616:13): [True: 1.84M, False: 1.75M]
  ------------------
  617|  6.16M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (617:20): [True: 2.74M, False: 3.41M]
  ------------------
  618|  6.16M|      if (block)
  ------------------
  |  Branch (618:11): [True: 6.16M, False: 0]
  ------------------
  619|  6.16M|        (*block)[jpeg_natural_order[k]] = (JCOEF)v;
  620|  6.16M|    }
  621|  11.4M|  }
  622|       |
  623|  9.42M|  return TRUE;
  ------------------
  |  |  209|  9.42M|#define TRUE    1
  ------------------
  624|  9.42M|}

jinit_d_coef_controller:
  814|  54.4k|{
  815|  54.4k|  my_coef_ptr coef;
  816|       |
  817|  54.4k|  coef = (my_coef_ptr)
  818|  54.4k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  54.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  819|  54.4k|                                sizeof(my_coef_controller));
  820|  54.4k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  821|  54.4k|  coef->pub.start_input_pass = start_input_pass;
  822|  54.4k|  coef->pub.start_output_pass = start_output_pass;
  823|  54.4k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  824|  54.4k|  coef->coef_bits_latch = NULL;
  825|  54.4k|#endif
  826|       |
  827|       |  /* Create the coefficient buffer. */
  828|  54.4k|  if (need_full_buffer) {
  ------------------
  |  Branch (828:7): [True: 22.1k, False: 32.3k]
  ------------------
  829|  22.1k|#ifdef D_MULTISCAN_FILES_SUPPORTED
  830|       |    /* Allocate a full-image virtual array for each component, */
  831|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  832|       |    /* Note we ask for a pre-zeroed array. */
  833|  22.1k|    int ci, access_rows;
  834|  22.1k|    jpeg_component_info *compptr;
  835|       |
  836|  58.8k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (836:46): [True: 36.6k, False: 22.1k]
  ------------------
  837|  36.6k|         ci++, compptr++) {
  838|  36.6k|      access_rows = compptr->v_samp_factor;
  839|  36.6k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  840|       |      /* If block smoothing could be used, need a bigger window */
  841|  36.6k|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (841:11): [True: 22.8k, False: 13.8k]
  ------------------
  842|  22.8k|        access_rows *= 5;
  843|  36.6k|#endif
  844|  36.6k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  845|  36.6k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  826|  36.6k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  209|  36.6k|#define TRUE    1
  ------------------
  846|  36.6k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  847|  36.6k|                               (long)compptr->h_samp_factor),
  848|  36.6k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  849|  36.6k|                               (long)compptr->v_samp_factor),
  850|  36.6k|         (JDIMENSION)access_rows);
  851|  36.6k|    }
  852|  22.1k|    coef->pub.consume_data = consume_data;
  853|  22.1k|    coef->pub.decompress_data = decompress_data;
  854|  22.1k|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  855|       |#else
  856|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  857|       |#endif
  858|  32.3k|  } else {
  859|       |    /* We only need a single-MCU buffer. */
  860|  32.3k|    JBLOCKROW buffer;
  861|  32.3k|    int i;
  862|       |
  863|  32.3k|    buffer = (JBLOCKROW)
  864|  32.3k|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  32.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  865|  32.3k|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   62|  32.3k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on blocks per MCU */
  ------------------
  866|   355k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   62|   355k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on blocks per MCU */
  ------------------
  |  Branch (866:17): [True: 323k, False: 32.3k]
  ------------------
  867|   323k|      coef->MCU_buffer[i] = buffer + i;
  868|   323k|    }
  869|  32.3k|    coef->pub.consume_data = dummy_consume_data;
  870|  32.3k|    coef->pub.decompress_data = decompress_onepass;
  871|  32.3k|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  872|  32.3k|  }
  873|       |
  874|       |  /* Allocate the workspace buffer */
  875|  54.4k|  coef->workspace = (JCOEF *)
  876|  54.4k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  54.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|  54.4k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   47|  54.4k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  878|  54.4k|}
jdcoefct.c:start_input_pass:
   46|  59.6k|{
   47|  59.6k|  cinfo->input_iMCU_row = 0;
   48|  59.6k|  start_iMCU_row(cinfo);
   49|  59.6k|}
jdcoefct.c:start_output_pass:
   58|  46.6k|{
   59|  46.6k|#ifdef BLOCK_SMOOTHING_SUPPORTED
   60|  46.6k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   61|       |
   62|       |  /* If multipass, check to see whether to use block smoothing on this pass */
   63|  46.6k|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (63:7): [True: 15.5k, False: 31.1k]
  ------------------
   64|  15.5k|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (64:9): [True: 15.5k, False: 0]
  |  Branch (64:38): [True: 3.47k, False: 12.0k]
  ------------------
   65|  3.47k|      coef->pub.decompress_data = decompress_smooth_data;
   66|  12.0k|    else
   67|  12.0k|      coef->pub.decompress_data = decompress_data;
   68|  15.5k|  }
   69|  46.6k|#endif
   70|  46.6k|  cinfo->output_iMCU_row = 0;
   71|  46.6k|}
jdcoefct.c:smoothing_ok:
  360|  15.5k|{
  361|  15.5k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  362|  15.5k|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  206|  15.5k|#define FALSE   0               /* values of boolean */
  ------------------
  363|  15.5k|  int ci, coefi;
  364|  15.5k|  jpeg_component_info *compptr;
  365|  15.5k|  JQUANT_TBL *qtable;
  366|  15.5k|  int *coef_bits, *prev_coef_bits;
  367|  15.5k|  int *coef_bits_latch, *prev_coef_bits_latch;
  368|       |
  369|  15.5k|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (369:7): [True: 3.77k, False: 11.7k]
  |  Branch (369:35): [True: 0, False: 11.7k]
  ------------------
  370|  3.77k|    return FALSE;
  ------------------
  |  |  206|  3.77k|#define FALSE   0               /* values of boolean */
  ------------------
  371|       |
  372|       |  /* Allocate latch area if not already done */
  373|  11.7k|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (373:7): [True: 11.7k, False: 0]
  ------------------
  374|  11.7k|    coef->coef_bits_latch = (int *)
  375|  11.7k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  11.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  376|  11.7k|                                  cinfo->num_components * 2 *
  377|  11.7k|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   55|  11.7k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  378|  11.7k|  coef_bits_latch = coef->coef_bits_latch;
  379|  11.7k|  prev_coef_bits_latch =
  380|  11.7k|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   55|  11.7k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  381|       |
  382|  16.7k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (382:44): [True: 13.1k, False: 3.63k]
  ------------------
  383|  13.1k|       ci++, compptr++) {
  384|       |    /* All components' quantization values must already be latched. */
  385|  13.1k|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (385:9): [True: 582, False: 12.5k]
  ------------------
  386|    582|      return FALSE;
  ------------------
  |  |  206|    582|#define FALSE   0               /* values of boolean */
  ------------------
  387|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  388|  12.5k|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (388:9): [True: 628, False: 11.9k]
  ------------------
  389|  12.5k|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  340|  11.9k|#define Q01_POS  1
  ------------------
  |  Branch (389:9): [True: 953, False: 10.9k]
  ------------------
  390|  12.5k|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  341|  10.9k|#define Q10_POS  8
  ------------------
  |  Branch (390:9): [True: 943, False: 10.0k]
  ------------------
  391|  12.5k|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  342|  10.0k|#define Q20_POS  16
  ------------------
  |  Branch (391:9): [True: 373, False: 9.65k]
  ------------------
  392|  12.5k|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  343|  9.65k|#define Q11_POS  9
  ------------------
  |  Branch (392:9): [True: 445, False: 9.20k]
  ------------------
  393|  12.5k|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  344|  9.20k|#define Q02_POS  2
  ------------------
  |  Branch (393:9): [True: 745, False: 8.46k]
  ------------------
  394|  12.5k|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  345|  8.46k|#define Q03_POS  3
  ------------------
  |  Branch (394:9): [True: 539, False: 7.92k]
  ------------------
  395|  12.5k|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  346|  7.92k|#define Q12_POS  10
  ------------------
  |  Branch (395:9): [True: 726, False: 7.19k]
  ------------------
  396|  12.5k|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  347|  7.19k|#define Q21_POS  17
  ------------------
  |  Branch (396:9): [True: 898, False: 6.30k]
  ------------------
  397|  12.5k|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  348|  6.30k|#define Q30_POS  24
  ------------------
  |  Branch (397:9): [True: 467, False: 5.83k]
  ------------------
  398|  6.71k|      return FALSE;
  ------------------
  |  |  206|  6.71k|#define FALSE   0               /* values of boolean */
  ------------------
  399|       |    /* DC values must be at least partly known for all components. */
  400|  5.83k|    coef_bits = cinfo->coef_bits[ci];
  401|  5.83k|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  402|  5.83k|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (402:9): [True: 819, False: 5.01k]
  ------------------
  403|    819|      return FALSE;
  ------------------
  |  |  206|    819|#define FALSE   0               /* values of boolean */
  ------------------
  404|  5.01k|    coef_bits_latch[0] = coef_bits[0];
  405|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  406|  50.1k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   55|  50.1k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (406:21): [True: 45.1k, False: 5.01k]
  ------------------
  407|  45.1k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (407:11): [True: 17.8k, False: 27.2k]
  ------------------
  408|  17.8k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  409|  27.2k|      else
  410|  27.2k|        prev_coef_bits_latch[coefi] = -1;
  411|  45.1k|      coef_bits_latch[coefi] = coef_bits[coefi];
  412|  45.1k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (412:11): [True: 38.4k, False: 6.66k]
  ------------------
  413|  38.4k|        smoothing_useful = TRUE;
  ------------------
  |  |  209|  38.4k|#define TRUE    1
  ------------------
  414|  45.1k|    }
  415|  5.01k|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   55|  5.01k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  416|  5.01k|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   55|  5.01k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  417|  5.01k|  }
  418|       |
  419|  3.63k|  return smoothing_useful;
  420|  11.7k|}
jdcoefct.c:decompress_smooth_data:
  429|   583k|{
  430|   583k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  431|   583k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  432|   583k|  JDIMENSION block_num, last_block_column;
  433|   583k|  int ci, block_row, block_rows, access_rows;
  434|   583k|  JBLOCKARRAY buffer;
  435|   583k|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  436|   583k|  JBLOCKROW next_block_row, next_next_block_row;
  437|   583k|  JSAMPARRAY output_ptr;
  438|   583k|  JDIMENSION output_col;
  439|   583k|  jpeg_component_info *compptr;
  440|   583k|  inverse_DCT_method_ptr inverse_DCT;
  441|   583k|  boolean change_dc;
  442|   583k|  JCOEF *workspace;
  443|   583k|  int *coef_bits;
  444|   583k|  JQUANT_TBL *quanttbl;
  445|   583k|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  446|   583k|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  447|   583k|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  448|   583k|      DC25;
  449|   583k|  int Al, pred;
  450|       |
  451|       |  /* Keep a local variable to avoid looking it up more than once */
  452|   583k|  workspace = coef->workspace;
  453|       |
  454|       |  /* Force some input to be done if we are getting ahead of the input. */
  455|   583k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (455:10): [True: 583k, False: 0]
  ------------------
  456|   583k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (456:10): [True: 0, False: 583k]
  ------------------
  457|      0|    if (cinfo->input_scan_number == cinfo->output_scan_number) {
  ------------------
  |  Branch (457:9): [True: 0, False: 0]
  ------------------
  458|       |      /* If input is working on current scan, we ordinarily want it to
  459|       |       * have completed the current row.  But if input scan is DC,
  460|       |       * we want it to keep two rows ahead so that next two block rows' DC
  461|       |       * values are up to date.
  462|       |       */
  463|      0|      JDIMENSION delta = (cinfo->Ss == 0) ? 2 : 0;
  ------------------
  |  Branch (463:26): [True: 0, False: 0]
  ------------------
  464|      0|      if (cinfo->input_iMCU_row > cinfo->output_iMCU_row + delta)
  ------------------
  |  Branch (464:11): [True: 0, False: 0]
  ------------------
  465|      0|        break;
  466|      0|    }
  467|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (467:9): [True: 0, False: 0]
  ------------------
  468|      0|      return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  469|      0|  }
  470|       |
  471|       |  /* OK, output from the virtual arrays. */
  472|  1.22M|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 642k, False: 583k]
  ------------------
  473|   642k|       ci++, compptr++) {
  474|       |    /* Don't bother to IDCT an uninteresting component. */
  475|   642k|    if (!compptr->component_needed)
  ------------------
  |  Branch (475:9): [True: 0, False: 642k]
  ------------------
  476|      0|      continue;
  477|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  478|   642k|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (478:9): [True: 633k, False: 8.78k]
  ------------------
  479|   633k|      block_rows = compptr->v_samp_factor;
  480|   633k|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  481|   633k|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (481:16): [True: 4.34k, False: 4.44k]
  ------------------
  482|  4.34k|      block_rows = compptr->v_samp_factor;
  483|  4.34k|      access_rows = block_rows * 2; /* this and next iMCU row */
  484|  4.44k|    } else {
  485|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  486|  4.44k|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  487|  4.44k|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (487:11): [True: 4.12k, False: 314]
  ------------------
  488|  4.44k|      access_rows = block_rows; /* this iMCU row only */
  489|  4.44k|    }
  490|       |    /* Align the virtual buffer for this component. */
  491|   642k|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (491:9): [True: 633k, False: 8.78k]
  ------------------
  492|   633k|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  493|   633k|      buffer = (*cinfo->mem->access_virt_barray)
  494|   633k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  495|   633k|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  496|   633k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  206|   633k|#define FALSE   0               /* values of boolean */
  ------------------
  497|   633k|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  498|   633k|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (498:16): [True: 4.34k, False: 4.44k]
  ------------------
  499|  4.34k|      buffer = (*cinfo->mem->access_virt_barray)
  500|  4.34k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  501|  4.34k|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  502|  4.34k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  206|  4.34k|#define FALSE   0               /* values of boolean */
  ------------------
  503|  4.34k|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  504|  4.44k|    } else {
  505|  4.44k|      buffer = (*cinfo->mem->access_virt_barray)
  506|  4.44k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  507|  4.44k|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  206|  4.44k|#define FALSE   0               /* values of boolean */
  ------------------
  508|  4.44k|    }
  509|       |    /* Fetch component-dependent info.
  510|       |     * If the current scan is incomplete, then we use the component-dependent
  511|       |     * info from the previous scan.
  512|       |     */
  513|   642k|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (513:9): [True: 308k, False: 334k]
  ------------------
  514|   308k|      coef_bits =
  515|   308k|        coef->coef_bits_latch + ((ci + cinfo->num_components) * SAVED_COEFS);
  ------------------
  |  |   55|   308k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  516|   334k|    else
  517|   334k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   55|   334k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  518|       |
  519|       |    /* We only do DC interpolation if no AC coefficient data is available. */
  520|   642k|    change_dc =
  521|   642k|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (521:7): [True: 462k, False: 180k]
  |  Branch (521:29): [True: 452k, False: 9.74k]
  |  Branch (521:51): [True: 447k, False: 5.51k]
  ------------------
  522|   642k|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (522:7): [True: 444k, False: 3.15k]
  |  Branch (522:29): [True: 429k, False: 15.0k]
  |  Branch (522:51): [True: 425k, False: 3.27k]
  ------------------
  523|   642k|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (523:7): [True: 420k, False: 4.89k]
  |  Branch (523:29): [True: 419k, False: 1.83k]
  |  Branch (523:51): [True: 415k, False: 3.14k]
  ------------------
  524|       |
  525|   642k|    quanttbl = compptr->quant_table;
  526|   642k|    Q00 = quanttbl->quantval[0];
  527|   642k|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  340|   642k|#define Q01_POS  1
  ------------------
  528|   642k|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  341|   642k|#define Q10_POS  8
  ------------------
  529|   642k|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  342|   642k|#define Q20_POS  16
  ------------------
  530|   642k|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  343|   642k|#define Q11_POS  9
  ------------------
  531|   642k|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  344|   642k|#define Q02_POS  2
  ------------------
  532|   642k|    if (change_dc) {
  ------------------
  |  Branch (532:9): [True: 415k, False: 226k]
  ------------------
  533|   415k|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  345|   415k|#define Q03_POS  3
  ------------------
  534|   415k|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  346|   415k|#define Q12_POS  10
  ------------------
  535|   415k|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  347|   415k|#define Q21_POS  17
  ------------------
  536|   415k|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  348|   415k|#define Q30_POS  24
  ------------------
  537|   415k|    }
  538|   642k|    inverse_DCT = cinfo->idct->inverse_DCT[ci];
  539|   642k|    output_ptr = output_buf[ci];
  540|       |    /* Loop over all DCT blocks to be processed. */
  541|  1.32M|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (541:25): [True: 684k, False: 642k]
  ------------------
  542|   684k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  543|       |
  544|   684k|      if (block_row > 0 || cinfo->output_iMCU_row > 0)
  ------------------
  |  Branch (544:11): [True: 41.7k, False: 642k]
  |  Branch (544:28): [True: 638k, False: 4.44k]
  ------------------
  545|   680k|        prev_block_row =
  546|   680k|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  547|  4.44k|      else
  548|  4.44k|        prev_block_row = buffer_ptr;
  549|       |
  550|   684k|      if (block_row > 1 || cinfo->output_iMCU_row > 1)
  ------------------
  |  Branch (550:11): [True: 12.4k, False: 671k]
  |  Branch (550:28): [True: 662k, False: 9.75k]
  ------------------
  551|   674k|        prev_prev_block_row =
  552|   674k|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  553|  9.75k|      else
  554|  9.75k|        prev_prev_block_row = prev_block_row;
  555|       |
  556|   684k|      if (block_row < block_rows - 1 || cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (556:11): [True: 41.7k, False: 642k]
  |  Branch (556:41): [True: 638k, False: 4.44k]
  ------------------
  557|   680k|        next_block_row =
  558|   680k|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  559|  4.44k|      else
  560|  4.44k|        next_block_row = buffer_ptr;
  561|       |
  562|   684k|      if (block_row < block_rows - 2 ||
  ------------------
  |  Branch (562:11): [True: 12.4k, False: 671k]
  ------------------
  563|   684k|          cinfo->output_iMCU_row + 1 < last_iMCU_row)
  ------------------
  |  Branch (563:11): [True: 662k, False: 9.46k]
  ------------------
  564|   674k|        next_next_block_row =
  565|   674k|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  566|  9.46k|      else
  567|  9.46k|        next_next_block_row = next_block_row;
  568|       |
  569|       |      /* We fetch the surrounding DC values using a sliding-register approach.
  570|       |       * Initialize all 25 here so as to do the right thing on narrow pics.
  571|       |       */
  572|   684k|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  573|   684k|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  574|   684k|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  575|   684k|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  576|   684k|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  577|   684k|      output_col = 0;
  578|   684k|      last_block_column = compptr->width_in_blocks - 1;
  579|   684k|      for (block_num = cinfo->master->first_MCU_col[ci];
  580|  51.2M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (580:12): [True: 50.6M, False: 684k]
  ------------------
  581|       |        /* Fetch current DCT block into workspace so we can modify it. */
  582|  50.6M|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  583|       |        /* Update DC values */
  584|  50.6M|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (584:13): [True: 684k, False: 49.9M]
  ------------------
  585|  50.6M|            block_num < last_block_column) {
  ------------------
  |  Branch (585:13): [True: 615k, False: 68.8k]
  ------------------
  586|   615k|          DC04 = (int)prev_prev_block_row[1][0];
  587|   615k|          DC09 = (int)prev_block_row[1][0];
  588|   615k|          DC14 = (int)buffer_ptr[1][0];
  589|   615k|          DC19 = (int)next_block_row[1][0];
  590|   615k|          DC24 = (int)next_next_block_row[1][0];
  591|   615k|        }
  592|  50.6M|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (592:13): [True: 49.3M, False: 1.30M]
  ------------------
  593|  49.3M|          DC05 = (int)prev_prev_block_row[2][0];
  594|  49.3M|          DC10 = (int)prev_block_row[2][0];
  595|  49.3M|          DC15 = (int)buffer_ptr[2][0];
  596|  49.3M|          DC20 = (int)next_block_row[2][0];
  597|  49.3M|          DC25 = (int)next_next_block_row[2][0];
  598|  49.3M|        }
  599|       |        /* If DC interpolation is enabled, compute coefficient estimates using
  600|       |         * a Gaussian-like kernel, keeping the averages of the DC values.
  601|       |         *
  602|       |         * If DC interpolation is disabled, compute coefficient estimates using
  603|       |         * an algorithm similar to the one described in Section K.8 of the JPEG
  604|       |         * standard, except applied to a 5x5 window rather than a 3x3 window.
  605|       |         *
  606|       |         * An estimate is applied only if the coefficient is still zero and is
  607|       |         * not known to be fully accurate.
  608|       |         */
  609|       |        /* AC01 */
  610|  50.6M|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (610:13): [True: 49.3M, False: 1.28M]
  |  Branch (610:41): [True: 42.0M, False: 7.25M]
  ------------------
  611|  42.0M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (611:24): [True: 16.3M, False: 25.7M]
  ------------------
  612|  16.3M|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  613|  16.3M|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  614|  16.3M|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  615|  16.3M|                 DC21 - DC22 + DC24 + DC25) :
  616|  42.0M|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  617|  42.0M|          if (num >= 0) {
  ------------------
  |  Branch (617:15): [True: 36.8M, False: 5.16M]
  ------------------
  618|  36.8M|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  619|  36.8M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (619:17): [True: 17.6M, False: 19.2M]
  |  Branch (619:27): [True: 3.21M, False: 14.4M]
  ------------------
  620|  3.21M|              pred = (1 << Al) - 1;
  621|  36.8M|          } else {
  622|  5.16M|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  623|  5.16M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (623:17): [True: 1.55M, False: 3.60M]
  |  Branch (623:27): [True: 650k, False: 908k]
  ------------------
  624|   650k|              pred = (1 << Al) - 1;
  625|  5.16M|            pred = -pred;
  626|  5.16M|          }
  627|  42.0M|          workspace[1] = (JCOEF)pred;
  628|  42.0M|        }
  629|       |        /* AC10 */
  630|  50.6M|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (630:13): [True: 50.2M, False: 308k]
  |  Branch (630:41): [True: 41.7M, False: 8.57M]
  ------------------
  631|  41.7M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (631:24): [True: 16.3M, False: 25.3M]
  ------------------
  632|  16.3M|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  633|  16.3M|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  634|  16.3M|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  635|  16.3M|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  636|  41.7M|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  637|  41.7M|          if (num >= 0) {
  ------------------
  |  Branch (637:15): [True: 32.5M, False: 9.15M]
  ------------------
  638|  32.5M|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  639|  32.5M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (639:17): [True: 14.9M, False: 17.6M]
  |  Branch (639:27): [True: 9.00M, False: 5.90M]
  ------------------
  640|  9.00M|              pred = (1 << Al) - 1;
  641|  32.5M|          } else {
  642|  9.15M|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  643|  9.15M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (643:17): [True: 4.15M, False: 5.00M]
  |  Branch (643:27): [True: 3.49M, False: 659k]
  ------------------
  644|  3.49M|              pred = (1 << Al) - 1;
  645|  9.15M|            pred = -pred;
  646|  9.15M|          }
  647|  41.7M|          workspace[8] = (JCOEF)pred;
  648|  41.7M|        }
  649|       |        /* AC20 */
  650|  50.6M|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (650:13): [True: 50.3M, False: 243k]
  |  Branch (650:41): [True: 47.3M, False: 2.97M]
  ------------------
  651|  47.3M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (651:24): [True: 16.3M, False: 31.0M]
  ------------------
  652|  16.3M|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  653|  16.3M|                 5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
  654|  47.3M|                (-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
  655|  47.3M|          if (num >= 0) {
  ------------------
  |  Branch (655:15): [True: 30.9M, False: 16.4M]
  ------------------
  656|  30.9M|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  657|  30.9M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (657:17): [True: 15.0M, False: 15.9M]
  |  Branch (657:27): [True: 4.30M, False: 10.6M]
  ------------------
  658|  4.30M|              pred = (1 << Al) - 1;
  659|  30.9M|          } else {
  660|  16.4M|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  661|  16.4M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (661:17): [True: 11.2M, False: 5.23M]
  |  Branch (661:27): [True: 4.26M, False: 6.97M]
  ------------------
  662|  4.26M|              pred = (1 << Al) - 1;
  663|  16.4M|            pred = -pred;
  664|  16.4M|          }
  665|  47.3M|          workspace[16] = (JCOEF)pred;
  666|  47.3M|        }
  667|       |        /* AC11 */
  668|  50.6M|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (668:13): [True: 50.3M, False: 272k]
  |  Branch (668:41): [True: 46.5M, False: 3.79M]
  ------------------
  669|  46.5M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (669:24): [True: 16.3M, False: 30.2M]
  ------------------
  670|  16.3M|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  671|  16.3M|                 9 * DC19 + DC21 - DC25) :
  672|  46.5M|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  673|  30.2M|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  674|  46.5M|          if (num >= 0) {
  ------------------
  |  Branch (674:15): [True: 42.5M, False: 3.97M]
  ------------------
  675|  42.5M|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  676|  42.5M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (676:17): [True: 23.4M, False: 19.0M]
  |  Branch (676:27): [True: 637k, False: 22.8M]
  ------------------
  677|   637k|              pred = (1 << Al) - 1;
  678|  42.5M|          } else {
  679|  3.97M|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  680|  3.97M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (680:17): [True: 1.95M, False: 2.01M]
  |  Branch (680:27): [True: 637k, False: 1.31M]
  ------------------
  681|   637k|              pred = (1 << Al) - 1;
  682|  3.97M|            pred = -pred;
  683|  3.97M|          }
  684|  46.5M|          workspace[9] = (JCOEF)pred;
  685|  46.5M|        }
  686|       |        /* AC02 */
  687|  50.6M|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (687:13): [True: 50.3M, False: 272k]
  |  Branch (687:41): [True: 46.8M, False: 3.53M]
  ------------------
  688|  46.8M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (688:24): [True: 16.3M, False: 30.4M]
  ------------------
  689|  16.3M|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  690|  16.3M|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  691|  46.8M|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  692|  46.8M|          if (num >= 0) {
  ------------------
  |  Branch (692:15): [True: 28.3M, False: 18.4M]
  ------------------
  693|  28.3M|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  694|  28.3M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (694:17): [True: 14.0M, False: 14.3M]
  |  Branch (694:27): [True: 2.00M, False: 12.0M]
  ------------------
  695|  2.00M|              pred = (1 << Al) - 1;
  696|  28.3M|          } else {
  697|  18.4M|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  698|  18.4M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (698:17): [True: 13.2M, False: 5.15M]
  |  Branch (698:27): [True: 1.85M, False: 11.3M]
  ------------------
  699|  1.85M|              pred = (1 << Al) - 1;
  700|  18.4M|            pred = -pred;
  701|  18.4M|          }
  702|  46.8M|          workspace[2] = (JCOEF)pred;
  703|  46.8M|        }
  704|  50.6M|        if (change_dc) {
  ------------------
  |  Branch (704:13): [True: 16.3M, False: 34.2M]
  ------------------
  705|       |          /* AC03 */
  706|  16.3M|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (706:15): [True: 16.3M, False: 0]
  |  Branch (706:43): [True: 16.3M, False: 413]
  ------------------
  707|  16.3M|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  708|  16.3M|            if (num >= 0) {
  ------------------
  |  Branch (708:17): [True: 14.4M, False: 1.89M]
  ------------------
  709|  14.4M|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  710|  14.4M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (710:19): [True: 0, False: 14.4M]
  |  Branch (710:29): [True: 0, False: 0]
  ------------------
  711|      0|                pred = (1 << Al) - 1;
  712|  14.4M|            } else {
  713|  1.89M|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  714|  1.89M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (714:19): [True: 0, False: 1.89M]
  |  Branch (714:29): [True: 0, False: 0]
  ------------------
  715|      0|                pred = (1 << Al) - 1;
  716|  1.89M|              pred = -pred;
  717|  1.89M|            }
  718|  16.3M|            workspace[3] = (JCOEF)pred;
  719|  16.3M|          }
  720|       |          /* AC12 */
  721|  16.3M|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (721:15): [True: 16.3M, False: 0]
  |  Branch (721:43): [True: 16.3M, False: 476]
  ------------------
  722|  16.3M|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  723|  16.3M|            if (num >= 0) {
  ------------------
  |  Branch (723:17): [True: 12.1M, False: 4.20M]
  ------------------
  724|  12.1M|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  725|  12.1M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (725:19): [True: 0, False: 12.1M]
  |  Branch (725:29): [True: 0, False: 0]
  ------------------
  726|      0|                pred = (1 << Al) - 1;
  727|  12.1M|            } else {
  728|  4.20M|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  729|  4.20M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (729:19): [True: 0, False: 4.20M]
  |  Branch (729:29): [True: 0, False: 0]
  ------------------
  730|      0|                pred = (1 << Al) - 1;
  731|  4.20M|              pred = -pred;
  732|  4.20M|            }
  733|  16.3M|            workspace[10] = (JCOEF)pred;
  734|  16.3M|          }
  735|       |          /* AC21 */
  736|  16.3M|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (736:15): [True: 16.3M, False: 0]
  |  Branch (736:43): [True: 16.3M, False: 820]
  ------------------
  737|  16.3M|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  738|  16.3M|            if (num >= 0) {
  ------------------
  |  Branch (738:17): [True: 11.6M, False: 4.73M]
  ------------------
  739|  11.6M|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  740|  11.6M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (740:19): [True: 0, False: 11.6M]
  |  Branch (740:29): [True: 0, False: 0]
  ------------------
  741|      0|                pred = (1 << Al) - 1;
  742|  11.6M|            } else {
  743|  4.73M|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  744|  4.73M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (744:19): [True: 0, False: 4.73M]
  |  Branch (744:29): [True: 0, False: 0]
  ------------------
  745|      0|                pred = (1 << Al) - 1;
  746|  4.73M|              pred = -pred;
  747|  4.73M|            }
  748|  16.3M|            workspace[17] = (JCOEF)pred;
  749|  16.3M|          }
  750|       |          /* AC30 */
  751|  16.3M|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (751:15): [True: 16.3M, False: 0]
  |  Branch (751:43): [True: 16.3M, False: 926]
  ------------------
  752|  16.3M|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  753|  16.3M|            if (num >= 0) {
  ------------------
  |  Branch (753:17): [True: 13.6M, False: 2.68M]
  ------------------
  754|  13.6M|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  755|  13.6M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (755:19): [True: 0, False: 13.6M]
  |  Branch (755:29): [True: 0, False: 0]
  ------------------
  756|      0|                pred = (1 << Al) - 1;
  757|  13.6M|            } else {
  758|  2.68M|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  759|  2.68M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (759:19): [True: 0, False: 2.68M]
  |  Branch (759:29): [True: 0, False: 0]
  ------------------
  760|      0|                pred = (1 << Al) - 1;
  761|  2.68M|              pred = -pred;
  762|  2.68M|            }
  763|  16.3M|            workspace[24] = (JCOEF)pred;
  764|  16.3M|          }
  765|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  766|       |           * be called.
  767|       |           */
  768|  16.3M|          num = Q00 *
  769|  16.3M|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  770|  16.3M|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  771|  16.3M|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  772|  16.3M|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  773|  16.3M|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  774|  16.3M|          if (num >= 0) {
  ------------------
  |  Branch (774:15): [True: 12.9M, False: 3.35M]
  ------------------
  775|  12.9M|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  776|  12.9M|          } else {
  777|  3.35M|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  778|  3.35M|            pred = -pred;
  779|  3.35M|          }
  780|  16.3M|          workspace[0] = (JCOEF)pred;
  781|  16.3M|        }  /* change_dc */
  782|       |
  783|       |        /* OK, do the IDCT */
  784|  50.6M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  785|  50.6M|                        output_col);
  786|       |        /* Advance for next column */
  787|  50.6M|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  788|  50.6M|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  789|  50.6M|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  790|  50.6M|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  791|  50.6M|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  792|  50.6M|        buffer_ptr++, prev_block_row++, next_block_row++,
  793|  50.6M|          prev_prev_block_row++, next_next_block_row++;
  794|  50.6M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  50.6M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  795|  50.6M|      }
  796|   684k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   684k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  797|   684k|    }
  798|   642k|  }
  799|       |
  800|   583k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (800:7): [True: 579k, False: 3.40k]
  ------------------
  801|   579k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1022|   579k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  802|  3.40k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1023|  3.40k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  803|   583k|}
jdcoefct.c:consume_data:
  193|  7.77M|{
  194|  7.77M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  195|  7.77M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  196|  7.77M|  int blkn, ci, xindex, yindex, yoffset;
  197|  7.77M|  JDIMENSION start_col;
  198|  7.77M|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  199|  7.77M|  JBLOCKROW buffer_ptr;
  200|  7.77M|  jpeg_component_info *compptr;
  201|       |
  202|       |  /* Align the virtual buffers for the components used in this scan. */
  203|  16.2M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (203:16): [True: 8.50M, False: 7.77M]
  ------------------
  204|  8.50M|    compptr = cinfo->cur_comp_info[ci];
  205|  8.50M|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  206|  8.50M|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  207|  8.50M|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  208|  8.50M|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  209|  8.50M|#define TRUE    1
  ------------------
  209|       |    /* Note: entropy decoder expects buffer to be zeroed,
  210|       |     * but this is handled automatically by the memory manager
  211|       |     * because we requested a pre-zeroed array.
  212|       |     */
  213|  8.50M|  }
  214|       |
  215|       |  /* Loop to process one whole iMCU row */
  216|  15.8M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (216:41): [True: 8.05M, False: 7.77M]
  ------------------
  217|  8.05M|       yoffset++) {
  218|   367M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (218:39): [True: 359M, False: 8.05M]
  ------------------
  219|   359M|         MCU_col_num++) {
  220|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  221|   359M|      blkn = 0;                 /* index of current DCT block within MCU */
  222|   725M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (222:20): [True: 366M, False: 359M]
  ------------------
  223|   366M|        compptr = cinfo->cur_comp_info[ci];
  224|   366M|        start_col = MCU_col_num * compptr->MCU_width;
  225|   735M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (225:26): [True: 369M, False: 366M]
  ------------------
  226|   369M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  227|   745M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (227:28): [True: 376M, False: 369M]
  ------------------
  228|   376M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  229|   376M|          }
  230|   369M|        }
  231|   366M|      }
  232|   359M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (232:11): [True: 316M, False: 43.1M]
  ------------------
  233|   316M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  234|       |      /* Try to fetch the MCU. */
  235|   359M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (235:11): [True: 0, False: 359M]
  ------------------
  236|       |        /* Suspension forced; update state counters and exit */
  237|      0|        coef->MCU_vert_offset = yoffset;
  238|      0|        coef->MCU_ctr = MCU_col_num;
  239|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  240|      0|      }
  241|   359M|    }
  242|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  243|  8.05M|    coef->MCU_ctr = 0;
  244|  8.05M|  }
  245|       |  /* Completed the iMCU row, advance counters for next one */
  246|  7.77M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (246:7): [True: 7.74M, False: 28.4k]
  ------------------
  247|  7.74M|    start_iMCU_row(cinfo);
  248|  7.74M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1022|  7.74M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  249|  7.74M|  }
  250|       |  /* Completed the scan */
  251|  28.4k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  252|  28.4k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1023|  28.4k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  253|  7.77M|}
jdcoefct.c:decompress_data:
  266|  2.14M|{
  267|  2.14M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  268|  2.14M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  269|  2.14M|  JDIMENSION block_num;
  270|  2.14M|  int ci, block_row, block_rows;
  271|  2.14M|  JBLOCKARRAY buffer;
  272|  2.14M|  JBLOCKROW buffer_ptr;
  273|  2.14M|  JSAMPARRAY output_ptr;
  274|  2.14M|  JDIMENSION output_col;
  275|  2.14M|  jpeg_component_info *compptr;
  276|  2.14M|  inverse_DCT_method_ptr inverse_DCT;
  277|       |
  278|       |  /* Force some input to be done if we are getting ahead of the input. */
  279|  2.14M|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (279:10): [True: 0, False: 2.14M]
  ------------------
  280|  2.14M|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (280:11): [True: 2.14M, False: 0]
  ------------------
  281|  2.14M|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (281:11): [True: 0, False: 2.14M]
  ------------------
  282|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (282:9): [True: 0, False: 0]
  ------------------
  283|      0|      return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  284|      0|  }
  285|       |
  286|       |  /* OK, output from the virtual arrays. */
  287|  5.82M|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (287:44): [True: 3.68M, False: 2.14M]
  ------------------
  288|  3.68M|       ci++, compptr++) {
  289|       |    /* Don't bother to IDCT an uninteresting component. */
  290|  3.68M|    if (!compptr->component_needed)
  ------------------
  |  Branch (290:9): [True: 0, False: 3.68M]
  ------------------
  291|      0|      continue;
  292|       |    /* Align the virtual buffer for this component. */
  293|  3.68M|    buffer = (*cinfo->mem->access_virt_barray)
  294|  3.68M|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  295|  3.68M|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  296|  3.68M|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  206|  3.68M|#define FALSE   0               /* values of boolean */
  ------------------
  297|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  298|  3.68M|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (298:9): [True: 3.65M, False: 21.9k]
  ------------------
  299|  3.65M|      block_rows = compptr->v_samp_factor;
  300|  21.9k|    else {
  301|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  302|  21.9k|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  303|  21.9k|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (303:11): [True: 20.5k, False: 1.44k]
  ------------------
  304|  21.9k|    }
  305|  3.68M|    inverse_DCT = cinfo->idct->inverse_DCT[ci];
  306|  3.68M|    output_ptr = output_buf[ci];
  307|       |    /* Loop over all DCT blocks to be processed. */
  308|  7.52M|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (308:25): [True: 3.84M, False: 3.68M]
  ------------------
  309|  3.84M|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  310|  3.84M|      output_col = 0;
  311|  3.84M|      for (block_num = cinfo->master->first_MCU_col[ci];
  312|  67.3M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (312:12): [True: 63.5M, False: 3.84M]
  ------------------
  313|  63.5M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  314|  63.5M|                        output_col);
  315|  63.5M|        buffer_ptr++;
  316|  63.5M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  63.5M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  317|  63.5M|      }
  318|  3.84M|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  3.84M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  319|  3.84M|    }
  320|  3.68M|  }
  321|       |
  322|  2.14M|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (322:7): [True: 2.13M, False: 11.9k]
  ------------------
  323|  2.13M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1022|  2.13M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  324|  11.9k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1023|  11.9k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  325|  2.14M|}
jdcoefct.c:decompress_onepass:
   86|  2.60M|{
   87|  2.60M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   88|  2.60M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   89|  2.60M|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   90|  2.60M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   91|  2.60M|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   92|  2.60M|  JSAMPARRAY output_ptr;
   93|  2.60M|  JDIMENSION start_col, output_col;
   94|  2.60M|  jpeg_component_info *compptr;
   95|  2.60M|  inverse_DCT_method_ptr inverse_DCT;
   96|       |
   97|       |  /* Loop to process as much as one whole iMCU row */
   98|  5.21M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (98:41): [True: 2.60M, False: 2.60M]
  ------------------
   99|  2.60M|       yoffset++) {
  100|  67.6M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (100:39): [True: 65.0M, False: 2.60M]
  ------------------
  101|  65.0M|         MCU_col_num++) {
  102|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  103|  65.0M|      jzero_far((void *)coef->MCU_buffer[0],
  104|  65.0M|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  105|  65.0M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (105:11): [True: 9.80M, False: 55.2M]
  ------------------
  106|  9.80M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  107|  65.0M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (107:11): [True: 0, False: 65.0M]
  ------------------
  108|       |        /* Suspension forced; update state counters and exit */
  109|      0|        coef->MCU_vert_offset = yoffset;
  110|      0|        coef->MCU_ctr = MCU_col_num;
  111|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  112|      0|      }
  113|       |
  114|       |      /* Only perform the IDCT on blocks that are contained within the desired
  115|       |       * cropping region.
  116|       |       */
  117|  65.0M|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (117:11): [True: 65.0M, False: 14.0k]
  ------------------
  118|  65.0M|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (118:11): [True: 65.0M, False: 0]
  ------------------
  119|       |        /* Determine where data should go in output_buf and do the IDCT thing.
  120|       |         * We skip dummy blocks at the right and bottom edges (but blkn gets
  121|       |         * incremented past them!).  Note the inner loop relies on having
  122|       |         * allocated the MCU_buffer[] blocks sequentially.
  123|       |         */
  124|  65.0M|        blkn = 0;               /* index of current DCT block within MCU */
  125|   133M|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (125:22): [True: 68.9M, False: 65.0M]
  ------------------
  126|  68.9M|          compptr = cinfo->cur_comp_info[ci];
  127|       |          /* Don't bother to IDCT an uninteresting component. */
  128|  68.9M|          if (!compptr->component_needed) {
  ------------------
  |  Branch (128:15): [True: 0, False: 68.9M]
  ------------------
  129|      0|            blkn += compptr->MCU_blocks;
  130|      0|            continue;
  131|      0|          }
  132|  68.9M|          inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
  133|  68.9M|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (133:26): [True: 65.2M, False: 3.64M]
  ------------------
  134|  65.2M|                         compptr->MCU_width : compptr->last_col_width;
  135|  68.9M|          output_ptr = output_buf[compptr->component_index] +
  136|  68.9M|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  68.9M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  137|  68.9M|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  138|  68.9M|                      compptr->MCU_sample_width;
  139|   139M|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (139:28): [True: 70.7M, False: 68.9M]
  ------------------
  140|  70.7M|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (140:17): [True: 69.8M, False: 886k]
  ------------------
  141|  70.7M|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (141:17): [True: 871k, False: 15.3k]
  ------------------
  142|  70.6M|              output_col = start_col;
  143|   143M|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (143:32): [True: 73.2M, False: 70.6M]
  ------------------
  144|  73.2M|                (*inverse_DCT) (cinfo, compptr,
  145|  73.2M|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  146|  73.2M|                                output_ptr, output_col);
  147|  73.2M|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  73.2M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  148|  73.2M|              }
  149|  70.6M|            }
  150|  70.7M|            blkn += compptr->MCU_width;
  151|  70.7M|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  70.7M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  152|  70.7M|          }
  153|  68.9M|        }
  154|  65.0M|      }
  155|  65.0M|    }
  156|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  157|  2.60M|    coef->MCU_ctr = 0;
  158|  2.60M|  }
  159|       |  /* Completed the iMCU row, advance counters for next one */
  160|  2.60M|  cinfo->output_iMCU_row++;
  161|  2.60M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (161:7): [True: 2.56M, False: 41.2k]
  ------------------
  162|  2.56M|    start_iMCU_row(cinfo);
  163|  2.56M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1022|  2.56M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  164|  2.56M|  }
  165|       |  /* Completed the scan */
  166|  41.2k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  167|  41.2k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1023|  41.2k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  168|  2.60M|}

jdcoefct.c:start_iMCU_row:
   65|  10.3M|{
   66|  10.3M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   67|       |
   68|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   69|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   70|       |   * But at the bottom of the image, process only what's left.
   71|       |   */
   72|  10.3M|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (72:7): [True: 891k, False: 9.48M]
  ------------------
   73|   891k|    coef->MCU_rows_per_iMCU_row = 1;
   74|  9.48M|  } else {
   75|  9.48M|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (75:9): [True: 9.43M, False: 52.3k]
  ------------------
   76|  9.43M|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   77|  52.3k|    else
   78|  52.3k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   79|  9.48M|  }
   80|       |
   81|  10.3M|  coef->MCU_ctr = 0;
   82|  10.3M|  coef->MCU_vert_offset = 0;
   83|  10.3M|}

jinit_color_deconverter:
  737|  54.3k|{
  738|  54.3k|  my_cconvert_ptr cconvert;
  739|  54.3k|  int ci;
  740|       |
  741|  54.3k|  cconvert = (my_cconvert_ptr)
  742|  54.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  54.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  743|  54.3k|                                sizeof(my_color_deconverter));
  744|  54.3k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  745|  54.3k|  cconvert->pub.start_pass = start_pass_dcolor;
  746|       |
  747|       |  /* Make sure num_components agrees with jpeg_color_space */
  748|  54.3k|  switch (cinfo->jpeg_color_space) {
  749|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (749:3): [True: 0, False: 54.3k]
  ------------------
  750|      0|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (750:9): [True: 0, False: 0]
  ------------------
  751|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  752|      0|    break;
  753|       |
  754|      0|  case JCS_RGB:
  ------------------
  |  Branch (754:3): [True: 0, False: 54.3k]
  ------------------
  755|  5.13k|  case JCS_YCbCr:
  ------------------
  |  Branch (755:3): [True: 5.13k, False: 49.1k]
  ------------------
  756|  5.13k|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (756:9): [True: 0, False: 5.13k]
  ------------------
  757|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  758|  5.13k|    break;
  759|       |
  760|      0|  case JCS_CMYK:
  ------------------
  |  Branch (760:3): [True: 0, False: 54.3k]
  ------------------
  761|      0|  case JCS_YCCK:
  ------------------
  |  Branch (761:3): [True: 0, False: 54.3k]
  ------------------
  762|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (762:9): [True: 0, False: 0]
  ------------------
  763|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  764|      0|    break;
  765|       |
  766|  49.1k|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (766:3): [True: 49.1k, False: 5.13k]
  ------------------
  767|  49.1k|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (767:9): [True: 0, False: 49.1k]
  ------------------
  768|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  769|  49.1k|    break;
  770|  54.3k|  }
  771|       |
  772|       |  /* Set out_color_components and conversion method based on requested space.
  773|       |   * Also clear the component_needed flags for any unused components,
  774|       |   * so that earlier pipeline stages can avoid useless computation.
  775|       |   */
  776|       |
  777|  54.3k|  switch (cinfo->out_color_space) {
  778|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (778:3): [True: 0, False: 54.3k]
  ------------------
  779|      0|    cinfo->out_color_components = 1;
  780|      0|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (780:9): [True: 0, False: 0]
  ------------------
  781|      0|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (781:9): [True: 0, False: 0]
  ------------------
  782|      0|      cconvert->pub.color_convert = grayscale_convert;
  783|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  784|      0|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (784:20): [True: 0, False: 0]
  ------------------
  785|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  786|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (786:16): [True: 0, False: 0]
  ------------------
  787|      0|      cconvert->pub.color_convert = rgb_gray_convert;
  788|      0|      build_rgb_y_table(cinfo);
  789|      0|    } else
  790|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  791|      0|    break;
  792|       |
  793|  5.13k|  case JCS_RGB:
  ------------------
  |  Branch (793:3): [True: 5.13k, False: 49.1k]
  ------------------
  794|  5.13k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (794:3): [True: 0, False: 54.3k]
  ------------------
  795|  5.13k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (795:3): [True: 0, False: 54.3k]
  ------------------
  796|  5.13k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (796:3): [True: 0, False: 54.3k]
  ------------------
  797|  5.13k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (797:3): [True: 0, False: 54.3k]
  ------------------
  798|  5.13k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (798:3): [True: 0, False: 54.3k]
  ------------------
  799|  5.13k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (799:3): [True: 0, False: 54.3k]
  ------------------
  800|  5.13k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (800:3): [True: 0, False: 54.3k]
  ------------------
  801|  5.13k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (801:3): [True: 0, False: 54.3k]
  ------------------
  802|  5.13k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (802:3): [True: 0, False: 54.3k]
  ------------------
  803|  5.13k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (803:3): [True: 0, False: 54.3k]
  ------------------
  804|  5.13k|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  805|  5.13k|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (805:9): [True: 5.13k, False: 0]
  ------------------
  806|  5.13k|      if (jsimd_can_ycc_rgb())
  ------------------
  |  Branch (806:11): [True: 5.13k, False: 0]
  ------------------
  807|  5.13k|        cconvert->pub.color_convert = jsimd_ycc_rgb_convert;
  808|      0|      else {
  809|      0|        cconvert->pub.color_convert = ycc_rgb_convert;
  810|      0|        build_ycc_rgb_table(cinfo);
  811|      0|      }
  812|  5.13k|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (812:16): [True: 0, False: 0]
  ------------------
  813|      0|      cconvert->pub.color_convert = gray_rgb_convert;
  814|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (814:16): [True: 0, False: 0]
  ------------------
  815|      0|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (815:11): [True: 0, False: 0]
  ------------------
  816|      0|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (816:11): [True: 0, False: 0]
  ------------------
  817|      0|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (817:11): [True: 0, False: 0]
  ------------------
  818|      0|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (818:11): [True: 0, False: 0]
  ------------------
  819|      0|        cconvert->pub.color_convert = null_convert;
  820|      0|      else
  821|      0|        cconvert->pub.color_convert = rgb_rgb_convert;
  822|      0|    } else
  823|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  824|  5.13k|    break;
  825|       |
  826|      0|  case JCS_RGB565:
  ------------------
  |  Branch (826:3): [True: 0, False: 54.3k]
  ------------------
  827|      0|    cinfo->out_color_components = 3;
  828|      0|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (828:9): [True: 0, False: 0]
  ------------------
  829|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (829:11): [True: 0, False: 0]
  ------------------
  830|      0|        if (jsimd_can_ycc_rgb565())
  ------------------
  |  Branch (830:13): [True: 0, False: 0]
  ------------------
  831|      0|          cconvert->pub.color_convert = jsimd_ycc_rgb565_convert;
  832|      0|        else {
  833|      0|          cconvert->pub.color_convert = ycc_rgb565_convert;
  834|      0|          build_ycc_rgb_table(cinfo);
  835|      0|        }
  836|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (836:18): [True: 0, False: 0]
  ------------------
  837|      0|        cconvert->pub.color_convert = gray_rgb565_convert;
  838|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (838:18): [True: 0, False: 0]
  ------------------
  839|      0|        cconvert->pub.color_convert = rgb_rgb565_convert;
  840|      0|      } else
  841|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  842|      0|    } else {
  843|       |      /* only ordered dithering is supported */
  844|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (844:11): [True: 0, False: 0]
  ------------------
  845|      0|        cconvert->pub.color_convert = ycc_rgb565D_convert;
  846|      0|        build_ycc_rgb_table(cinfo);
  847|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (847:18): [True: 0, False: 0]
  ------------------
  848|      0|        cconvert->pub.color_convert = gray_rgb565D_convert;
  849|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (849:18): [True: 0, False: 0]
  ------------------
  850|      0|        cconvert->pub.color_convert = rgb_rgb565D_convert;
  851|      0|      } else
  852|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  853|      0|    }
  854|      0|    break;
  855|       |
  856|      0|  case JCS_CMYK:
  ------------------
  |  Branch (856:3): [True: 0, False: 54.3k]
  ------------------
  857|      0|    cinfo->out_color_components = 4;
  858|      0|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (858:9): [True: 0, False: 0]
  ------------------
  859|      0|      cconvert->pub.color_convert = ycck_cmyk_convert;
  860|      0|      build_ycc_rgb_table(cinfo);
  861|      0|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (861:16): [True: 0, False: 0]
  ------------------
  862|      0|      cconvert->pub.color_convert = null_convert;
  863|      0|    } else
  864|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  865|      0|    break;
  866|       |
  867|  49.1k|  default:
  ------------------
  |  Branch (867:3): [True: 49.1k, False: 5.13k]
  ------------------
  868|       |    /* Permit null conversion to same output space */
  869|  49.1k|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (869:9): [True: 49.1k, False: 0]
  ------------------
  870|  49.1k|      cinfo->out_color_components = cinfo->num_components;
  871|  49.1k|      cconvert->pub.color_convert = null_convert;
  872|  49.1k|    } else                      /* unsupported non-null conversion */
  873|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  874|  49.1k|    break;
  875|  54.3k|  }
  876|       |
  877|  54.3k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (877:7): [True: 0, False: 54.3k]
  ------------------
  878|      0|    cinfo->output_components = 1; /* single colormapped output component */
  879|  54.3k|  else
  880|  54.3k|    cinfo->output_components = cinfo->out_color_components;
  881|  54.3k|}
jdcolor.c:start_pass_dcolor:
  726|  46.5k|{
  727|       |  /* no work needed */
  728|  46.5k|}
jdcolor.c:null_convert:
  362|  34.1M|{
  363|  34.1M|  register JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  364|  34.1M|  register JDIMENSION col;
  365|  34.1M|  register int num_components = cinfo->num_components;
  366|  34.1M|  JDIMENSION num_cols = cinfo->output_width;
  367|  34.1M|  int ci;
  368|       |
  369|  34.1M|  if (num_components == 3) {
  ------------------
  |  Branch (369:7): [True: 2.37M, False: 31.8M]
  ------------------
  370|  4.75M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (370:12): [True: 2.37M, False: 2.37M]
  ------------------
  371|  2.37M|      inptr0 = input_buf[0][input_row];
  372|  2.37M|      inptr1 = input_buf[1][input_row];
  373|  2.37M|      inptr2 = input_buf[2][input_row];
  374|  2.37M|      input_row++;
  375|  2.37M|      outptr = *output_buf++;
  376|   601M|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (376:21): [True: 599M, False: 2.37M]
  ------------------
  377|   599M|        *outptr++ = inptr0[col];
  378|   599M|        *outptr++ = inptr1[col];
  379|   599M|        *outptr++ = inptr2[col];
  380|   599M|      }
  381|  2.37M|    }
  382|  31.8M|  } else if (num_components == 4) {
  ------------------
  |  Branch (382:14): [True: 0, False: 31.8M]
  ------------------
  383|      0|    while (--num_rows >= 0) {
  ------------------
  |  Branch (383:12): [True: 0, False: 0]
  ------------------
  384|      0|      inptr0 = input_buf[0][input_row];
  385|      0|      inptr1 = input_buf[1][input_row];
  386|      0|      inptr2 = input_buf[2][input_row];
  387|      0|      inptr3 = input_buf[3][input_row];
  388|      0|      input_row++;
  389|      0|      outptr = *output_buf++;
  390|      0|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (390:21): [True: 0, False: 0]
  ------------------
  391|      0|        *outptr++ = inptr0[col];
  392|      0|        *outptr++ = inptr1[col];
  393|      0|        *outptr++ = inptr2[col];
  394|      0|        *outptr++ = inptr3[col];
  395|      0|      }
  396|      0|    }
  397|  31.8M|  } else {
  398|  63.6M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (398:12): [True: 31.8M, False: 31.8M]
  ------------------
  399|  63.6M|      for (ci = 0; ci < num_components; ci++) {
  ------------------
  |  Branch (399:20): [True: 31.8M, False: 31.8M]
  ------------------
  400|  31.8M|        inptr = input_buf[ci][input_row];
  401|  31.8M|        outptr = *output_buf;
  402|  9.06G|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (402:23): [True: 9.03G, False: 31.8M]
  ------------------
  403|  9.03G|          outptr[ci] = inptr[col];
  404|  9.03G|          outptr += num_components;
  405|  9.03G|        }
  406|  31.8M|      }
  407|  31.8M|      output_buf++;
  408|  31.8M|      input_row++;
  409|  31.8M|    }
  410|  31.8M|  }
  411|  34.1M|}

jinit_inverse_dct:
  331|  54.4k|{
  332|  54.4k|  my_idct_ptr idct;
  333|  54.4k|  int ci;
  334|  54.4k|  jpeg_component_info *compptr;
  335|       |
  336|  54.4k|  idct = (my_idct_ptr)
  337|  54.4k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  54.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  338|  54.4k|                                sizeof(my_idct_controller));
  339|  54.4k|  cinfo->idct = (struct jpeg_inverse_dct *)idct;
  340|  54.4k|  idct->pub.start_pass = start_pass;
  341|       |
  342|   125k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (342:44): [True: 71.0k, False: 54.4k]
  ------------------
  343|  71.0k|       ci++, compptr++) {
  344|       |    /* Allocate and pre-zero a multiplier table for each component */
  345|  71.0k|    compptr->dct_table =
  346|  71.0k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  71.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  347|  71.0k|                                  sizeof(multiplier_table));
  348|  71.0k|    memset(compptr->dct_table, 0, sizeof(multiplier_table));
  349|       |    /* Mark multiplier table not yet set up for any method */
  350|  71.0k|    idct->cur_method[ci] = -1;
  351|  71.0k|  }
  352|  54.4k|}
jddctmgr.c:start_pass:
   98|  46.6k|{
   99|  46.6k|  my_idct_ptr idct = (my_idct_ptr)cinfo->idct;
  100|  46.6k|  int ci, i;
  101|  46.6k|  jpeg_component_info *compptr;
  102|  46.6k|  int method = 0;
  103|  46.6k|  inverse_DCT_method_ptr method_ptr = NULL;
  104|  46.6k|  JQUANT_TBL *qtbl;
  105|       |
  106|   106k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (106:44): [True: 59.7k, False: 46.6k]
  ------------------
  107|  59.7k|       ci++, compptr++) {
  108|       |    /* Select the proper IDCT routine for this component's scaling */
  109|  59.7k|    switch (compptr->_DCT_scaled_size) {
  ------------------
  |  |   24|  59.7k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  110|      0|#ifdef IDCT_SCALING_SUPPORTED
  111|      0|    case 1:
  ------------------
  |  Branch (111:5): [True: 0, False: 59.7k]
  ------------------
  112|      0|      method_ptr = jpeg_idct_1x1;
  113|      0|      method = JDCT_ISLOW;      /* jidctred uses islow-style table */
  114|      0|      break;
  115|      0|    case 2:
  ------------------
  |  Branch (115:5): [True: 0, False: 59.7k]
  ------------------
  116|      0|      if (jsimd_can_idct_2x2())
  ------------------
  |  Branch (116:11): [True: 0, False: 0]
  ------------------
  117|      0|        method_ptr = jsimd_idct_2x2;
  118|      0|      else
  119|      0|        method_ptr = jpeg_idct_2x2;
  120|      0|      method = JDCT_ISLOW;      /* jidctred uses islow-style table */
  121|      0|      break;
  122|      0|    case 3:
  ------------------
  |  Branch (122:5): [True: 0, False: 59.7k]
  ------------------
  123|      0|      method_ptr = jpeg_idct_3x3;
  124|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  125|      0|      break;
  126|      0|    case 4:
  ------------------
  |  Branch (126:5): [True: 0, False: 59.7k]
  ------------------
  127|      0|      if (jsimd_can_idct_4x4())
  ------------------
  |  Branch (127:11): [True: 0, False: 0]
  ------------------
  128|      0|        method_ptr = jsimd_idct_4x4;
  129|      0|      else
  130|      0|        method_ptr = jpeg_idct_4x4;
  131|      0|      method = JDCT_ISLOW;      /* jidctred uses islow-style table */
  132|      0|      break;
  133|      0|    case 5:
  ------------------
  |  Branch (133:5): [True: 0, False: 59.7k]
  ------------------
  134|      0|      method_ptr = jpeg_idct_5x5;
  135|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  136|      0|      break;
  137|      0|    case 6:
  ------------------
  |  Branch (137:5): [True: 0, False: 59.7k]
  ------------------
  138|       |#if defined(__mips__)
  139|       |      if (jsimd_can_idct_6x6())
  140|       |        method_ptr = jsimd_idct_6x6;
  141|       |      else
  142|       |#endif
  143|      0|      method_ptr = jpeg_idct_6x6;
  144|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  145|      0|      break;
  146|      0|    case 7:
  ------------------
  |  Branch (146:5): [True: 0, False: 59.7k]
  ------------------
  147|      0|      method_ptr = jpeg_idct_7x7;
  148|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  149|      0|      break;
  150|      0|#endif
  151|  59.7k|    case DCTSIZE:
  ------------------
  |  |   46|  59.7k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (151:5): [True: 59.7k, False: 0]
  ------------------
  152|  59.7k|      switch (cinfo->dct_method) {
  153|      0|#ifdef DCT_ISLOW_SUPPORTED
  154|  59.7k|      case JDCT_ISLOW:
  ------------------
  |  Branch (154:7): [True: 59.7k, False: 0]
  ------------------
  155|  59.7k|        if (jsimd_can_idct_islow())
  ------------------
  |  Branch (155:13): [True: 59.7k, False: 0]
  ------------------
  156|  59.7k|          method_ptr = jsimd_idct_islow;
  157|      0|        else
  158|      0|          method_ptr = jpeg_idct_islow;
  159|  59.7k|        method = JDCT_ISLOW;
  160|  59.7k|        break;
  161|      0|#endif
  162|      0|#ifdef DCT_IFAST_SUPPORTED
  163|      0|      case JDCT_IFAST:
  ------------------
  |  Branch (163:7): [True: 0, False: 59.7k]
  ------------------
  164|      0|        if (jsimd_can_idct_ifast())
  ------------------
  |  Branch (164:13): [True: 0, False: 0]
  ------------------
  165|      0|          method_ptr = jsimd_idct_ifast;
  166|      0|        else
  167|      0|          method_ptr = jpeg_idct_ifast;
  168|      0|        method = JDCT_IFAST;
  169|      0|        break;
  170|      0|#endif
  171|      0|#ifdef DCT_FLOAT_SUPPORTED
  172|      0|      case JDCT_FLOAT:
  ------------------
  |  Branch (172:7): [True: 0, False: 59.7k]
  ------------------
  173|      0|        if (jsimd_can_idct_float())
  ------------------
  |  Branch (173:13): [True: 0, False: 0]
  ------------------
  174|      0|          method_ptr = jsimd_idct_float;
  175|      0|        else
  176|      0|          method_ptr = jpeg_idct_float;
  177|      0|        method = JDCT_FLOAT;
  178|      0|        break;
  179|      0|#endif
  180|      0|      default:
  ------------------
  |  Branch (180:7): [True: 0, False: 59.7k]
  ------------------
  181|      0|        ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  182|      0|        break;
  183|  59.7k|      }
  184|  59.7k|      break;
  185|  59.7k|#ifdef IDCT_SCALING_SUPPORTED
  186|  59.7k|    case 9:
  ------------------
  |  Branch (186:5): [True: 0, False: 59.7k]
  ------------------
  187|      0|      method_ptr = jpeg_idct_9x9;
  188|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  189|      0|      break;
  190|      0|    case 10:
  ------------------
  |  Branch (190:5): [True: 0, False: 59.7k]
  ------------------
  191|      0|      method_ptr = jpeg_idct_10x10;
  192|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  193|      0|      break;
  194|      0|    case 11:
  ------------------
  |  Branch (194:5): [True: 0, False: 59.7k]
  ------------------
  195|      0|      method_ptr = jpeg_idct_11x11;
  196|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  197|      0|      break;
  198|      0|    case 12:
  ------------------
  |  Branch (198:5): [True: 0, False: 59.7k]
  ------------------
  199|       |#if defined(__mips__)
  200|       |      if (jsimd_can_idct_12x12())
  201|       |        method_ptr = jsimd_idct_12x12;
  202|       |      else
  203|       |#endif
  204|      0|      method_ptr = jpeg_idct_12x12;
  205|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  206|      0|      break;
  207|      0|    case 13:
  ------------------
  |  Branch (207:5): [True: 0, False: 59.7k]
  ------------------
  208|      0|      method_ptr = jpeg_idct_13x13;
  209|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  210|      0|      break;
  211|      0|    case 14:
  ------------------
  |  Branch (211:5): [True: 0, False: 59.7k]
  ------------------
  212|      0|      method_ptr = jpeg_idct_14x14;
  213|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  214|      0|      break;
  215|      0|    case 15:
  ------------------
  |  Branch (215:5): [True: 0, False: 59.7k]
  ------------------
  216|      0|      method_ptr = jpeg_idct_15x15;
  217|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  218|      0|      break;
  219|      0|    case 16:
  ------------------
  |  Branch (219:5): [True: 0, False: 59.7k]
  ------------------
  220|      0|      method_ptr = jpeg_idct_16x16;
  221|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  222|      0|      break;
  223|      0|#endif
  224|      0|    default:
  ------------------
  |  Branch (224:5): [True: 0, False: 59.7k]
  ------------------
  225|      0|      ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->_DCT_scaled_size);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  226|      0|      break;
  227|  59.7k|    }
  228|  59.7k|    idct->pub.inverse_DCT[ci] = method_ptr;
  229|       |    /* Create multiplier table from quant table.
  230|       |     * However, we can skip this if the component is uninteresting
  231|       |     * or if we already built the table.  Also, if no quant table
  232|       |     * has yet been saved for the component, we leave the
  233|       |     * multiplier table all-zero; we'll be reading zeroes from the
  234|       |     * coefficient controller's buffer anyway.
  235|       |     */
  236|  59.7k|    if (!compptr->component_needed || idct->cur_method[ci] == method)
  ------------------
  |  Branch (236:9): [True: 0, False: 59.7k]
  |  Branch (236:39): [True: 0, False: 59.7k]
  ------------------
  237|      0|      continue;
  238|  59.7k|    qtbl = compptr->quant_table;
  239|  59.7k|    if (qtbl == NULL)           /* happens if no data yet for component */
  ------------------
  |  Branch (239:9): [True: 9.36k, False: 50.3k]
  ------------------
  240|  9.36k|      continue;
  241|  50.3k|    idct->cur_method[ci] = method;
  242|  50.3k|    switch (method) {
  243|      0|#ifdef PROVIDE_ISLOW_TABLES
  244|  50.3k|    case JDCT_ISLOW:
  ------------------
  |  Branch (244:5): [True: 50.3k, False: 0]
  ------------------
  245|  50.3k|      {
  246|       |        /* For LL&M IDCT method, multipliers are equal to raw quantization
  247|       |         * coefficients, but are stored as ints to ensure access efficiency.
  248|       |         */
  249|  50.3k|        ISLOW_MULT_TYPE *ismtbl = (ISLOW_MULT_TYPE *)compptr->dct_table;
  250|  3.27M|        for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   47|  3.27M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (250:21): [True: 3.22M, False: 50.3k]
  ------------------
  251|  3.22M|          ismtbl[i] = (ISLOW_MULT_TYPE)qtbl->quantval[i];
  252|  3.22M|        }
  253|  50.3k|      }
  254|  50.3k|      break;
  255|      0|#endif
  256|      0|#ifdef DCT_IFAST_SUPPORTED
  257|      0|    case JDCT_IFAST:
  ------------------
  |  Branch (257:5): [True: 0, False: 50.3k]
  ------------------
  258|      0|      {
  259|       |        /* For AA&N IDCT method, multipliers are equal to quantization
  260|       |         * coefficients scaled by scalefactor[row]*scalefactor[col], where
  261|       |         *   scalefactor[0] = 1
  262|       |         *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
  263|       |         * For integer operation, the multiplier table is to be scaled by
  264|       |         * IFAST_SCALE_BITS.
  265|       |         */
  266|      0|        IFAST_MULT_TYPE *ifmtbl = (IFAST_MULT_TYPE *)compptr->dct_table;
  267|      0|#define CONST_BITS  14
  268|      0|        static const INT16 aanscales[DCTSIZE2] = {
  269|       |          /* precomputed values scaled up by 14 bits */
  270|      0|          16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
  271|      0|          22725, 31521, 29692, 26722, 22725, 17855, 12299,  6270,
  272|      0|          21407, 29692, 27969, 25172, 21407, 16819, 11585,  5906,
  273|      0|          19266, 26722, 25172, 22654, 19266, 15137, 10426,  5315,
  274|      0|          16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
  275|      0|          12873, 17855, 16819, 15137, 12873, 10114,  6967,  3552,
  276|      0|           8867, 12299, 11585, 10426,  8867,  6967,  4799,  2446,
  277|      0|           4520,  6270,  5906,  5315,  4520,  3552,  2446,  1247
  278|      0|        };
  279|      0|        SHIFT_TEMPS
  280|       |
  281|      0|        for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   47|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (281:21): [True: 0, False: 0]
  ------------------
  282|      0|          ifmtbl[i] = (IFAST_MULT_TYPE)
  283|      0|            DESCALE(MULTIPLY16V16((JLONG)qtbl->quantval[i],
  ------------------
  |  |  178|      0|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  316|      0|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  284|      0|                                  (JLONG)aanscales[i]),
  285|      0|                    CONST_BITS - IFAST_SCALE_BITS);
  286|      0|        }
  287|      0|      }
  288|      0|      break;
  289|      0|#endif
  290|      0|#ifdef DCT_FLOAT_SUPPORTED
  291|      0|    case JDCT_FLOAT:
  ------------------
  |  Branch (291:5): [True: 0, False: 50.3k]
  ------------------
  292|      0|      {
  293|       |        /* For float AA&N IDCT method, multipliers are equal to quantization
  294|       |         * coefficients scaled by scalefactor[row]*scalefactor[col], where
  295|       |         *   scalefactor[0] = 1
  296|       |         *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
  297|       |         */
  298|      0|        FLOAT_MULT_TYPE *fmtbl = (FLOAT_MULT_TYPE *)compptr->dct_table;
  299|      0|        int row, col;
  300|      0|        static const double aanscalefactor[DCTSIZE] = {
  301|      0|          1.0, 1.387039845, 1.306562965, 1.175875602,
  302|      0|          1.0, 0.785694958, 0.541196100, 0.275899379
  303|      0|        };
  304|       |
  305|      0|        i = 0;
  306|      0|        for (row = 0; row < DCTSIZE; row++) {
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (306:23): [True: 0, False: 0]
  ------------------
  307|      0|          for (col = 0; col < DCTSIZE; col++) {
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (307:25): [True: 0, False: 0]
  ------------------
  308|      0|            fmtbl[i] = (FLOAT_MULT_TYPE)
  309|      0|              ((double)qtbl->quantval[i] *
  310|      0|               aanscalefactor[row] * aanscalefactor[col]);
  311|      0|            i++;
  312|      0|          }
  313|      0|        }
  314|      0|      }
  315|      0|      break;
  316|      0|#endif
  317|      0|    default:
  ------------------
  |  Branch (317:5): [True: 0, False: 50.3k]
  ------------------
  318|      0|      ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  319|      0|      break;
  320|  50.3k|    }
  321|  50.3k|  }
  322|  46.6k|}

jpeg_make_d_derived_tbl:
  143|  64.9k|{
  144|  64.9k|  JHUFF_TBL *htbl;
  145|  64.9k|  d_derived_tbl *dtbl;
  146|  64.9k|  int p, i, l, si, numsymbols;
  147|  64.9k|  int lookbits, ctr;
  148|  64.9k|  char huffsize[257];
  149|  64.9k|  unsigned int huffcode[257];
  150|  64.9k|  unsigned int code;
  151|       |
  152|       |  /* Note that huffsize[] and huffcode[] are filled in code-length order,
  153|       |   * paralleling the order of the symbols themselves in htbl->huffval[].
  154|       |   */
  155|       |
  156|       |  /* Find the input Huffman table */
  157|  64.9k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   49|  64.9k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (157:7): [True: 0, False: 64.9k]
  |  Branch (157:20): [True: 494, False: 64.4k]
  ------------------
  158|    494|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  238|    494|  ((cinfo)->err->msg_code = (code), \
  |  |  239|    494|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|    494|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  159|  64.9k|  htbl =
  160|  64.9k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (160:5): [True: 29.6k, False: 35.2k]
  ------------------
  161|  64.9k|  if (htbl == NULL)
  ------------------
  |  Branch (161:7): [True: 489, False: 64.4k]
  ------------------
  162|    489|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  238|    489|  ((cinfo)->err->msg_code = (code), \
  |  |  239|    489|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|    489|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  163|       |
  164|       |  /* Allocate a workspace if we haven't already done so. */
  165|  64.9k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (165:7): [True: 57.6k, False: 7.34k]
  ------------------
  166|  57.6k|    *pdtbl = (d_derived_tbl *)
  167|  57.6k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  57.6k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  168|  57.6k|                                  sizeof(d_derived_tbl));
  169|  64.9k|  dtbl = *pdtbl;
  170|  64.9k|  dtbl->pub = htbl;             /* fill in back link */
  171|       |
  172|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  173|       |
  174|  64.9k|  p = 0;
  175|  1.08M|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (175:15): [True: 1.02M, False: 64.9k]
  ------------------
  176|  1.02M|    i = (int)htbl->bits[l];
  177|  1.02M|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (177:9): [True: 0, False: 1.02M]
  |  Branch (177:18): [True: 0, False: 1.02M]
  ------------------
  178|      0|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  179|  5.83M|    while (i--)
  ------------------
  |  Branch (179:12): [True: 4.80M, False: 1.02M]
  ------------------
  180|  4.80M|      huffsize[p++] = (char)l;
  181|  1.02M|  }
  182|  64.9k|  huffsize[p] = 0;
  183|  64.9k|  numsymbols = p;
  184|       |
  185|       |  /* Figure C.2: generate the codes themselves */
  186|       |  /* We also validate that the counts represent a legal Huffman code tree. */
  187|       |
  188|  64.9k|  code = 0;
  189|  64.9k|  si = huffsize[0];
  190|  64.9k|  p = 0;
  191|   770k|  while (huffsize[p]) {
  ------------------
  |  Branch (191:10): [True: 705k, False: 64.9k]
  ------------------
  192|  5.50M|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (192:12): [True: 4.80M, False: 705k]
  ------------------
  193|  4.80M|      huffcode[p++] = code;
  194|  4.80M|      code++;
  195|  4.80M|    }
  196|       |    /* code is now 1 more than the last code used for codelength si; but
  197|       |     * it must still fit in si bits, since no code is allowed to be all ones.
  198|       |     */
  199|   705k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (199:9): [True: 294, False: 704k]
  ------------------
  200|    294|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  235|    294|  ((cinfo)->err->msg_code = (code), \
  |  |  236|    294|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  201|   705k|    code <<= 1;
  202|   705k|    si++;
  203|   705k|  }
  204|       |
  205|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  206|       |
  207|  64.9k|  p = 0;
  208|  1.08M|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (208:15): [True: 1.01M, False: 64.9k]
  ------------------
  209|  1.01M|    if (htbl->bits[l]) {
  ------------------
  |  Branch (209:9): [True: 538k, False: 480k]
  ------------------
  210|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  211|       |       * minus the minimum code of length l
  212|       |       */
  213|   538k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  214|   538k|      p += htbl->bits[l];
  215|   538k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  216|   538k|    } else {
  217|   480k|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  218|   480k|    }
  219|  1.01M|  }
  220|  64.9k|  dtbl->valoffset[17] = 0;
  221|  64.9k|  dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */
  222|       |
  223|       |  /* Compute lookahead tables to speed up decoding.
  224|       |   * First we set all the table entries to 0, indicating "too long";
  225|       |   * then we iterate through the Huffman codes that are short enough and
  226|       |   * fill in all the entries that correspond to bit sequences starting
  227|       |   * with that code.
  228|       |   */
  229|       |
  230|  16.3M|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   22|  16.3M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (230:15): [True: 16.3M, False: 64.9k]
  ------------------
  231|  16.3M|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   22|  16.3M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   22|  16.3M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  232|       |
  233|  64.9k|  p = 0;
  234|   574k|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   22|   574k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (234:15): [True: 509k, False: 64.9k]
  ------------------
  235|  1.49M|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (235:17): [True: 983k, False: 509k]
  ------------------
  236|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  237|       |      /* Generate left-justified code followed by all possible bit sequences */
  238|   983k|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   22|   983k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  239|  12.6M|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   22|   983k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (239:45): [True: 11.6M, False: 983k]
  ------------------
  240|  11.6M|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   22|  11.6M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|  11.6M|        lookbits++;
  242|  11.6M|      }
  243|   983k|    }
  244|   509k|  }
  245|       |
  246|       |  /* Validate symbols as being reasonable.
  247|       |   * For AC tables, we make no check, but accept all byte values 0..255.
  248|       |   * For DC tables, we require the symbols to be in range 0..15.
  249|       |   * (Tighter bounds could be applied depending on the data depth and mode,
  250|       |   * but this is sufficient to ensure safe decoding.)
  251|       |   */
  252|  64.9k|  if (isDC) {
  ------------------
  |  Branch (252:7): [True: 29.3k, False: 35.6k]
  ------------------
  253|   368k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (253:17): [True: 339k, False: 29.3k]
  ------------------
  254|   339k|      int sym = htbl->huffval[i];
  255|   339k|      if (sym < 0 || sym > 15)
  ------------------
  |  Branch (255:11): [True: 0, False: 339k]
  |  Branch (255:22): [True: 419, False: 338k]
  ------------------
  256|    419|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  235|    419|  ((cinfo)->err->msg_code = (code), \
  |  |  236|    419|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  257|   339k|    }
  258|  29.3k|  }
  259|  64.9k|}
jpeg_fill_bit_buffer:
  289|  1.80M|{
  290|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  291|  1.80M|  register const JOCTET *next_input_byte = state->next_input_byte;
  292|  1.80M|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  293|  1.80M|  j_decompress_ptr cinfo = state->cinfo;
  294|       |
  295|       |  /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */
  296|       |  /* (It is assumed that no request will be for more than that many bits.) */
  297|       |  /* We fail to do so only if we hit a marker or are forced to suspend. */
  298|       |
  299|  1.80M|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (299:7): [True: 1.04M, False: 758k]
  ------------------
  300|  7.94M|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  280|  7.94M|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   80|  7.94M|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (300:12): [True: 6.94M, False: 1.00M]
  ------------------
  301|  6.94M|      register int c;
  302|       |
  303|       |      /* Attempt to read a byte */
  304|  6.94M|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (304:11): [True: 44.2k, False: 6.89M]
  ------------------
  305|  44.2k|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (305:13): [True: 0, False: 44.2k]
  ------------------
  306|      0|          return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  307|  44.2k|        next_input_byte = cinfo->src->next_input_byte;
  308|  44.2k|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  309|  44.2k|      }
  310|  6.94M|      bytes_in_buffer--;
  311|  6.94M|      c = *next_input_byte++;
  312|       |
  313|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  314|  6.94M|      if (c == 0xFF) {
  ------------------
  |  Branch (314:11): [True: 92.8k, False: 6.84M]
  ------------------
  315|       |        /* Loop here to discard any padding FF's on terminating marker,
  316|       |         * so that we can save a valid unread_marker value.  NOTE: we will
  317|       |         * accept multiple FF's followed by a 0 as meaning a single FF data
  318|       |         * byte.  This data pattern is not valid according to the standard.
  319|       |         */
  320|   310k|        do {
  321|   310k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (321:15): [True: 4.39k, False: 305k]
  ------------------
  322|  4.39k|            if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (322:17): [True: 0, False: 4.39k]
  ------------------
  323|      0|              return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  324|  4.39k|            next_input_byte = cinfo->src->next_input_byte;
  325|  4.39k|            bytes_in_buffer = cinfo->src->bytes_in_buffer;
  326|  4.39k|          }
  327|   310k|          bytes_in_buffer--;
  328|   310k|          c = *next_input_byte++;
  329|   310k|        } while (c == 0xFF);
  ------------------
  |  Branch (329:18): [True: 217k, False: 92.8k]
  ------------------
  330|       |
  331|  92.8k|        if (c == 0) {
  ------------------
  |  Branch (331:13): [True: 49.8k, False: 43.0k]
  ------------------
  332|       |          /* Found FF/00, which represents an FF data byte */
  333|  49.8k|          c = 0xFF;
  334|  49.8k|        } else {
  335|       |          /* Oops, it's actually a marker indicating end of compressed data.
  336|       |           * Save the marker code for later use.
  337|       |           * Fine point: it might appear that we should save the marker into
  338|       |           * bitread working state, not straight into permanent state.  But
  339|       |           * once we have hit a marker, we cannot need to suspend within the
  340|       |           * current MCU, because we will read no more bytes from the data
  341|       |           * source.  So it is OK to update permanent state right away.
  342|       |           */
  343|  43.0k|          cinfo->unread_marker = c;
  344|       |          /* See if we need to insert some fake zero bits. */
  345|  43.0k|          goto no_more_bytes;
  346|  43.0k|        }
  347|  92.8k|      }
  348|       |
  349|       |      /* OK, load c into get_buffer */
  350|  6.89M|      get_buffer = (get_buffer << 8) | c;
  351|  6.89M|      bits_left += 8;
  352|  6.89M|    } /* end while */
  353|  1.04M|  } else {
  354|   801k|no_more_bytes:
  355|       |    /* We get here if we've read the marker that terminates the compressed
  356|       |     * data segment.  There should be enough bits in the buffer register
  357|       |     * to satisfy the request; if so, no problem.
  358|       |     */
  359|   801k|    if (nbits > bits_left) {
  ------------------
  |  Branch (359:9): [True: 435k, False: 365k]
  ------------------
  360|       |      /* Uh-oh.  Report corrupted data to user and stuff zeroes into
  361|       |       * the data stream, so that we can produce some kind of image.
  362|       |       * We use a nonvolatile flag to ensure that only one warning message
  363|       |       * appears per data segment.
  364|       |       */
  365|   435k|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (365:11): [True: 44.6k, False: 391k]
  ------------------
  366|  44.6k|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  278|  44.6k|  ((cinfo)->err->msg_code = (code), \
  |  |  279|  44.6k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  367|  44.6k|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  209|  44.6k|#define TRUE    1
  ------------------
  368|  44.6k|      }
  369|       |      /* Fill the buffer with zero bits */
  370|   435k|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  280|   435k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   80|   435k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  371|   435k|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  280|   435k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   80|   435k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  372|   435k|    }
  373|   801k|  }
  374|       |
  375|       |  /* Unload the local registers */
  376|  1.80M|  state->next_input_byte = next_input_byte;
  377|  1.80M|  state->bytes_in_buffer = bytes_in_buffer;
  378|  1.80M|  state->get_buffer = get_buffer;
  379|  1.80M|  state->bits_left = bits_left;
  380|       |
  381|  1.80M|  return TRUE;
  ------------------
  |  |  209|  1.80M|#define TRUE    1
  ------------------
  382|  1.80M|}
jpeg_huff_decode:
  437|  1.07M|{
  438|  1.07M|  register int l = min_bits;
  439|  1.07M|  register JLONG code;
  440|       |
  441|       |  /* HUFF_DECODE has determined that the code is at least min_bits */
  442|       |  /* bits long, so fetch that many bits in one swoop. */
  443|       |
  444|  1.07M|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  157|  1.07M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|  1.07M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 41.4k, False: 1.03M]
  |  |  ------------------
  |  |  159|  41.4k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 41.4k]
  |  |  ------------------
  |  |  160|  41.4k|      { action; } \
  |  |  161|  41.4k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|  41.4k|  } \
  |  |  163|  1.07M|}
  ------------------
  445|  1.07M|  code = GET_BITS(l);
  ------------------
  |  |  166|  1.07M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  446|       |
  447|       |  /* Collect the rest of the Huffman code one bit at a time. */
  448|       |  /* This is per Figure F.16. */
  449|       |
  450|  7.16M|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (450:10): [True: 6.09M, False: 1.07M]
  ------------------
  451|  6.09M|    code <<= 1;
  452|  6.09M|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  157|  6.09M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|  6.09M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 122k, False: 5.97M]
  |  |  ------------------
  |  |  159|   122k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 122k]
  |  |  ------------------
  |  |  160|   122k|      { action; } \
  |  |  161|   122k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|   122k|  } \
  |  |  163|  6.09M|}
  ------------------
  453|  6.09M|    code |= GET_BITS(1);
  ------------------
  |  |  166|  6.09M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  454|  6.09M|    l++;
  455|  6.09M|  }
  456|       |
  457|       |  /* Unload the local registers */
  458|  1.07M|  state->get_buffer = get_buffer;
  459|  1.07M|  state->bits_left = bits_left;
  460|       |
  461|       |  /* With garbage input we may reach the sentinel value l = 17. */
  462|       |
  463|  1.07M|  if (l > 16) {
  ------------------
  |  Branch (463:7): [True: 655k, False: 417k]
  ------------------
  464|   655k|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  278|   655k|  ((cinfo)->err->msg_code = (code), \
  |  |  279|   655k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  465|   655k|    return 0;                   /* fake a zero as the safest result */
  466|   655k|  }
  467|       |
  468|   417k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  469|  1.07M|}
jinit_huff_decoder:
  813|  26.6k|{
  814|  26.6k|  huff_entropy_ptr entropy;
  815|  26.6k|  int i;
  816|       |
  817|       |  /* Motion JPEG frames typically do not include the Huffman tables if they
  818|       |     are the default tables.  Thus, if the tables are not set by the time
  819|       |     the Huffman decoder is initialized (usually within the body of
  820|       |     jpeg_start_decompress()), we set them to default values. */
  821|  26.6k|  std_huff_tables((j_common_ptr)cinfo);
  822|       |
  823|  26.6k|  entropy = (huff_entropy_ptr)
  824|  26.6k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  26.6k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  825|  26.6k|                                sizeof(huff_entropy_decoder));
  826|  26.6k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  827|  26.6k|  entropy->pub.start_pass = start_pass_huff_decoder;
  828|  26.6k|  entropy->pub.decode_mcu = decode_mcu;
  829|       |
  830|       |  /* Mark tables unallocated */
  831|   133k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   49|   133k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (831:15): [True: 106k, False: 26.6k]
  ------------------
  832|   106k|    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  833|   106k|  }
  834|  26.6k|}
jdhuff.c:start_pass_huff_decoder:
   78|  27.6k|{
   79|  27.6k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   80|  27.6k|  int ci, blkn, dctbl, actbl;
   81|  27.6k|  d_derived_tbl **pdtbl;
   82|  27.6k|  jpeg_component_info *compptr;
   83|       |
   84|       |  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
   85|       |   * This ought to be an error condition, but we make it a warning because
   86|       |   * there are some baseline files out there with all zeroes in these bytes.
   87|       |   */
   88|  27.6k|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   47|  18.9k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (88:7): [True: 8.67k, False: 18.9k]
  |  Branch (88:25): [True: 3.48k, False: 15.4k]
  ------------------
   89|  27.6k|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (89:7): [True: 944, False: 14.5k]
  |  Branch (89:25): [True: 300, False: 14.2k]
  ------------------
   90|  13.4k|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  278|  13.4k|  ((cinfo)->err->msg_code = (code), \
  |  |  279|  13.4k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   91|       |
   92|  56.1k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (92:16): [True: 28.5k, False: 27.6k]
  ------------------
   93|  28.5k|    compptr = cinfo->cur_comp_info[ci];
   94|  28.5k|    dctbl = compptr->dc_tbl_no;
   95|  28.5k|    actbl = compptr->ac_tbl_no;
   96|       |    /* Compute derived values for Huffman tables */
   97|       |    /* We may do this more than once for a table, but it's not expensive */
   98|  28.5k|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
   99|  28.5k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  209|  28.5k|#define TRUE    1
  ------------------
  100|  28.5k|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  101|  28.5k|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  206|  28.5k|#define FALSE   0               /* values of boolean */
  ------------------
  102|       |    /* Initialize DC predictions to 0 */
  103|  28.5k|    entropy->saved.last_dc_val[ci] = 0;
  104|  28.5k|  }
  105|       |
  106|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  107|  56.4k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (107:18): [True: 28.7k, False: 27.6k]
  ------------------
  108|  28.7k|    ci = cinfo->MCU_membership[blkn];
  109|  28.7k|    compptr = cinfo->cur_comp_info[ci];
  110|       |    /* Precalculate which table to use for each block */
  111|  28.7k|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  112|  28.7k|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  113|       |    /* Decide whether we really care about the coefficient values */
  114|  28.7k|    if (compptr->component_needed) {
  ------------------
  |  Branch (114:9): [True: 28.7k, False: 0]
  ------------------
  115|  28.7k|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  209|  28.7k|#define TRUE    1
  ------------------
  116|       |      /* we don't need the ACs if producing a 1/8th-size image */
  117|  28.7k|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|  28.7k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  118|  28.7k|    } else {
  119|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  120|      0|    }
  121|  28.7k|  }
  122|       |
  123|       |  /* Initialize bitread state variables */
  124|  27.6k|  entropy->bitstate.bits_left = 0;
  125|  27.6k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  126|  27.6k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  27.6k|#define FALSE   0               /* values of boolean */
  ------------------
  127|       |
  128|       |  /* Initialize restart counter */
  129|  27.6k|  entropy->restarts_to_go = cinfo->restart_interval;
  130|  27.6k|}
jdhuff.c:decode_mcu:
  769|  59.7M|{
  770|  59.7M|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  771|  59.7M|  int usefast = 1;
  772|       |
  773|       |  /* Process restart marker if needed; may have to suspend */
  774|  59.7M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (774:7): [True: 20.6M, False: 39.1M]
  ------------------
  775|  20.6M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (775:9): [True: 95.2k, False: 20.5M]
  ------------------
  776|  95.2k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (776:11): [True: 0, False: 95.2k]
  ------------------
  777|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  778|  20.6M|    usefast = 0;
  779|  20.6M|  }
  780|       |
  781|  59.7M|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  765|  59.7M|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   47|  59.7M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (781:7): [True: 56.2M, False: 3.52M]
  ------------------
  782|  59.7M|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (782:7): [True: 3.23M, False: 290k]
  ------------------
  783|  59.4M|    usefast = 0;
  784|       |
  785|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  786|       |   * This way, we return uniform gray for the remainder of the segment.
  787|       |   */
  788|  59.7M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (788:7): [True: 777k, False: 59.0M]
  ------------------
  789|       |
  790|   777k|    if (usefast) {
  ------------------
  |  Branch (790:9): [True: 265k, False: 512k]
  ------------------
  791|   265k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (791:11): [True: 10.3k, False: 254k]
  ------------------
  792|   512k|    } else {
  793|   522k|use_slow:
  794|   522k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (794:11): [True: 0, False: 522k]
  ------------------
  795|   522k|    }
  796|       |
  797|   777k|  }
  798|       |
  799|       |  /* Account for restart interval (no-op if not using restarts) */
  800|  59.7M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (800:7): [True: 20.6M, False: 39.1M]
  ------------------
  801|  20.6M|    entropy->restarts_to_go--;
  802|       |
  803|  59.7M|  return TRUE;
  ------------------
  |  |  209|  59.7M|#define TRUE    1
  ------------------
  804|  59.7M|}
jdhuff.c:process_restart:
  511|  95.2k|{
  512|  95.2k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  513|  95.2k|  int ci;
  514|       |
  515|       |  /* Throw away any unused bits remaining in bit buffer; */
  516|       |  /* include any full bytes in next_marker's count of discarded bytes */
  517|  95.2k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  518|  95.2k|  entropy->bitstate.bits_left = 0;
  519|       |
  520|       |  /* Advance past the RSTn marker */
  521|  95.2k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (521:7): [True: 0, False: 95.2k]
  ------------------
  522|      0|    return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  523|       |
  524|       |  /* Re-initialize DC predictions to 0 */
  525|   201k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (525:16): [True: 106k, False: 95.2k]
  ------------------
  526|   106k|    entropy->saved.last_dc_val[ci] = 0;
  527|       |
  528|       |  /* Reset restart counter */
  529|  95.2k|  entropy->restarts_to_go = cinfo->restart_interval;
  530|       |
  531|       |  /* Reset out-of-data flag, unless read_restart_marker left us smack up
  532|       |   * against a marker.  In that case we will end up treating the next data
  533|       |   * segment as empty, and we can avoid producing bogus output pixels by
  534|       |   * leaving the flag set.
  535|       |   */
  536|  95.2k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (536:7): [True: 11.9k, False: 83.2k]
  ------------------
  537|  11.9k|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  11.9k|#define FALSE   0               /* values of boolean */
  ------------------
  538|       |
  539|  95.2k|  return TRUE;
  ------------------
  |  |  209|  95.2k|#define TRUE    1
  ------------------
  540|  95.2k|}
jdhuff.c:decode_mcu_fast:
  662|   265k|{
  663|   265k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  664|   265k|  BITREAD_STATE_VARS;
  ------------------
  |  |  122|   265k|  register bit_buf_type get_buffer; \
  |  |  123|   265k|  register int bits_left; \
  |  |  124|   265k|  bitread_working_state br_state
  ------------------
  665|   265k|  JOCTET *buffer;
  666|   265k|  int blkn;
  667|   265k|  savable_state state;
  668|       |  /* Outer loop handles each block in the MCU */
  669|       |
  670|       |  /* Load up working state */
  671|   265k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  127|   265k|  br_state.cinfo = cinfop; \
  |  |  128|   265k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  129|   265k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  130|   265k|  get_buffer = permstate.get_buffer; \
  |  |  131|   265k|  bits_left = permstate.bits_left;
  ------------------
  672|   265k|  buffer = (JOCTET *)br_state.next_input_byte;
  673|   265k|  state = entropy->saved;
  674|       |
  675|   926k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (675:18): [True: 661k, False: 265k]
  ------------------
  676|   661k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (676:23): [True: 661k, False: 0]
  ------------------
  677|   661k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  678|   661k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  679|   661k|    register int s, k, r, l;
  680|       |
  681|   661k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  221|   661k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  413|   661k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (413:7): [True: 40.5k, False: 620k]
  |  |  |  |  ------------------
  |  |  |  |  414|  40.5k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  40.5k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  40.5k|  register int c0, c1; \
  |  |  |  |  |  |  391|  40.5k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  40.5k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  40.5k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  40.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  40.5k|  bits_left += 8; \
  |  |  |  |  |  |  396|  40.5k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 1.93k, False: 38.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  1.93k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  1.93k|    buffer++; \
  |  |  |  |  |  |  399|  1.93k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 1.26k, False: 676]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  1.26k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  1.26k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  1.26k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  1.26k|      buffer -= 2; \
  |  |  |  |  |  |  404|  1.26k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  1.26k|    } \
  |  |  |  |  |  |  406|  1.93k|  } \
  |  |  |  |  |  |  407|  40.5k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  40.5k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  40.5k|  register int c0, c1; \
  |  |  |  |  |  |  391|  40.5k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  40.5k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  40.5k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  40.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  40.5k|  bits_left += 8; \
  |  |  |  |  |  |  396|  40.5k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 2.62k, False: 37.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  2.62k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  2.62k|    buffer++; \
  |  |  |  |  |  |  399|  2.62k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 1.78k, False: 835]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  1.78k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  1.78k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  1.78k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  1.78k|      buffer -= 2; \
  |  |  |  |  |  |  404|  1.78k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  1.78k|    } \
  |  |  |  |  |  |  406|  2.62k|  } \
  |  |  |  |  |  |  407|  40.5k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  40.5k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  40.5k|  register int c0, c1; \
  |  |  |  |  |  |  391|  40.5k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  40.5k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  40.5k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  40.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  40.5k|  bits_left += 8; \
  |  |  |  |  |  |  396|  40.5k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 3.44k, False: 37.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  3.44k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  3.44k|    buffer++; \
  |  |  |  |  |  |  399|  3.44k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 2.66k, False: 783]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  2.66k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  2.66k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  2.66k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  2.66k|      buffer -= 2; \
  |  |  |  |  |  |  404|  2.66k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  2.66k|    } \
  |  |  |  |  |  |  406|  3.44k|  } \
  |  |  |  |  |  |  407|  40.5k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  40.5k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  40.5k|  register int c0, c1; \
  |  |  |  |  |  |  391|  40.5k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  40.5k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  40.5k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  40.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  40.5k|  bits_left += 8; \
  |  |  |  |  |  |  396|  40.5k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 3.73k, False: 36.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  3.73k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  3.73k|    buffer++; \
  |  |  |  |  |  |  399|  3.73k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 3.10k, False: 630]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  3.10k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  3.10k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  3.10k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  3.10k|      buffer -= 2; \
  |  |  |  |  |  |  404|  3.10k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  3.10k|    } \
  |  |  |  |  |  |  406|  3.73k|  } \
  |  |  |  |  |  |  407|  40.5k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  40.5k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  40.5k|  register int c0, c1; \
  |  |  |  |  |  |  391|  40.5k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  40.5k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  40.5k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  40.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  40.5k|  bits_left += 8; \
  |  |  |  |  |  |  396|  40.5k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 5.28k, False: 35.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  5.28k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  5.28k|    buffer++; \
  |  |  |  |  |  |  399|  5.28k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 4.68k, False: 608]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  4.68k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  4.68k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  4.68k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  4.68k|      buffer -= 2; \
  |  |  |  |  |  |  404|  4.68k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  4.68k|    } \
  |  |  |  |  |  |  406|  5.28k|  } \
  |  |  |  |  |  |  407|  40.5k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  40.5k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  40.5k|  register int c0, c1; \
  |  |  |  |  |  |  391|  40.5k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  40.5k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  40.5k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  40.5k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  40.5k|  bits_left += 8; \
  |  |  |  |  |  |  396|  40.5k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 6.02k, False: 34.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  6.02k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  6.02k|    buffer++; \
  |  |  |  |  |  |  399|  6.02k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 5.02k, False: 1.00k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  5.02k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  5.02k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  5.02k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  5.02k|      buffer -= 2; \
  |  |  |  |  |  |  404|  5.02k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  5.02k|    } \
  |  |  |  |  |  |  406|  6.02k|  } \
  |  |  |  |  |  |  407|  40.5k|}
  |  |  |  |  ------------------
  |  |  |  |  415|  40.5k|  }
  |  |  ------------------
  |  |  222|   661k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  169|   661k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  223|   661k|  s = htbl->lookup[s]; \
  |  |  224|   661k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   22|   661k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  225|   661k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  226|   661k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  172|   661k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  227|   661k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   22|   661k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   661k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  1.32M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (228:7): [True: 37.9k, False: 623k]
  |  |  ------------------
  |  |  229|  37.9k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  230|  37.9k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  231|  37.9k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  232|   328k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (232:12): [True: 290k, False: 37.9k]
  |  |  ------------------
  |  |  233|   290k|      s <<= 1; \
  |  |  234|   290k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  166|   290k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  235|   290k|      nb++; \
  |  |  236|   290k|    } \
  |  |  237|  37.9k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (237:9): [True: 34.8k, False: 3.14k]
  |  |  ------------------
  |  |  238|  37.9k|      s = 0; \
  |  |  239|  37.9k|    else \
  |  |  240|  37.9k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  241|  37.9k|  }
  ------------------
  682|   661k|    if (s) {
  ------------------
  |  Branch (682:9): [True: 89.3k, False: 571k]
  ------------------
  683|  89.3k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  413|  89.3k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (413:7): [True: 8.31k, False: 81.0k]
  |  |  ------------------
  |  |  414|  8.31k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  8.31k|#define GET_BYTE { \
  |  |  |  |  390|  8.31k|  register int c0, c1; \
  |  |  |  |  391|  8.31k|  c0 = *buffer++; \
  |  |  |  |  392|  8.31k|  c1 = *buffer; \
  |  |  |  |  393|  8.31k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  8.31k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  8.31k|  bits_left += 8; \
  |  |  |  |  396|  8.31k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 910, False: 7.40k]
  |  |  |  |  ------------------
  |  |  |  |  397|    910|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|    910|    buffer++; \
  |  |  |  |  399|    910|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 347, False: 563]
  |  |  |  |  ------------------
  |  |  |  |  400|    347|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|    347|      cinfo->unread_marker = c1; \
  |  |  |  |  402|    347|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|    347|      buffer -= 2; \
  |  |  |  |  404|    347|      get_buffer &= ~0xFF; \
  |  |  |  |  405|    347|    } \
  |  |  |  |  406|    910|  } \
  |  |  |  |  407|  8.31k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  8.31k|#define GET_BYTE { \
  |  |  |  |  390|  8.31k|  register int c0, c1; \
  |  |  |  |  391|  8.31k|  c0 = *buffer++; \
  |  |  |  |  392|  8.31k|  c1 = *buffer; \
  |  |  |  |  393|  8.31k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  8.31k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  8.31k|  bits_left += 8; \
  |  |  |  |  396|  8.31k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 805, False: 7.50k]
  |  |  |  |  ------------------
  |  |  |  |  397|    805|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|    805|    buffer++; \
  |  |  |  |  399|    805|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 408, False: 397]
  |  |  |  |  ------------------
  |  |  |  |  400|    408|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|    408|      cinfo->unread_marker = c1; \
  |  |  |  |  402|    408|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|    408|      buffer -= 2; \
  |  |  |  |  404|    408|      get_buffer &= ~0xFF; \
  |  |  |  |  405|    408|    } \
  |  |  |  |  406|    805|  } \
  |  |  |  |  407|  8.31k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  8.31k|#define GET_BYTE { \
  |  |  |  |  390|  8.31k|  register int c0, c1; \
  |  |  |  |  391|  8.31k|  c0 = *buffer++; \
  |  |  |  |  392|  8.31k|  c1 = *buffer; \
  |  |  |  |  393|  8.31k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  8.31k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  8.31k|  bits_left += 8; \
  |  |  |  |  396|  8.31k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 825, False: 7.48k]
  |  |  |  |  ------------------
  |  |  |  |  397|    825|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|    825|    buffer++; \
  |  |  |  |  399|    825|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 488, False: 337]
  |  |  |  |  ------------------
  |  |  |  |  400|    488|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|    488|      cinfo->unread_marker = c1; \
  |  |  |  |  402|    488|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|    488|      buffer -= 2; \
  |  |  |  |  404|    488|      get_buffer &= ~0xFF; \
  |  |  |  |  405|    488|    } \
  |  |  |  |  406|    825|  } \
  |  |  |  |  407|  8.31k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  8.31k|#define GET_BYTE { \
  |  |  |  |  390|  8.31k|  register int c0, c1; \
  |  |  |  |  391|  8.31k|  c0 = *buffer++; \
  |  |  |  |  392|  8.31k|  c1 = *buffer; \
  |  |  |  |  393|  8.31k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  8.31k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  8.31k|  bits_left += 8; \
  |  |  |  |  396|  8.31k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 1.00k, False: 7.30k]
  |  |  |  |  ------------------
  |  |  |  |  397|  1.00k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|  1.00k|    buffer++; \
  |  |  |  |  399|  1.00k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 668, False: 341]
  |  |  |  |  ------------------
  |  |  |  |  400|    668|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|    668|      cinfo->unread_marker = c1; \
  |  |  |  |  402|    668|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|    668|      buffer -= 2; \
  |  |  |  |  404|    668|      get_buffer &= ~0xFF; \
  |  |  |  |  405|    668|    } \
  |  |  |  |  406|  1.00k|  } \
  |  |  |  |  407|  8.31k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  8.31k|#define GET_BYTE { \
  |  |  |  |  390|  8.31k|  register int c0, c1; \
  |  |  |  |  391|  8.31k|  c0 = *buffer++; \
  |  |  |  |  392|  8.31k|  c1 = *buffer; \
  |  |  |  |  393|  8.31k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  8.31k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  8.31k|  bits_left += 8; \
  |  |  |  |  396|  8.31k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 1.45k, False: 6.86k]
  |  |  |  |  ------------------
  |  |  |  |  397|  1.45k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|  1.45k|    buffer++; \
  |  |  |  |  399|  1.45k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 828, False: 622]
  |  |  |  |  ------------------
  |  |  |  |  400|    828|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|    828|      cinfo->unread_marker = c1; \
  |  |  |  |  402|    828|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|    828|      buffer -= 2; \
  |  |  |  |  404|    828|      get_buffer &= ~0xFF; \
  |  |  |  |  405|    828|    } \
  |  |  |  |  406|  1.45k|  } \
  |  |  |  |  407|  8.31k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  8.31k|#define GET_BYTE { \
  |  |  |  |  390|  8.31k|  register int c0, c1; \
  |  |  |  |  391|  8.31k|  c0 = *buffer++; \
  |  |  |  |  392|  8.31k|  c1 = *buffer; \
  |  |  |  |  393|  8.31k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  8.31k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  8.31k|  bits_left += 8; \
  |  |  |  |  396|  8.31k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 1.17k, False: 7.13k]
  |  |  |  |  ------------------
  |  |  |  |  397|  1.17k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|  1.17k|    buffer++; \
  |  |  |  |  399|  1.17k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 892, False: 283]
  |  |  |  |  ------------------
  |  |  |  |  400|    892|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|    892|      cinfo->unread_marker = c1; \
  |  |  |  |  402|    892|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|    892|      buffer -= 2; \
  |  |  |  |  404|    892|      get_buffer &= ~0xFF; \
  |  |  |  |  405|    892|    } \
  |  |  |  |  406|  1.17k|  } \
  |  |  |  |  407|  8.31k|}
  |  |  ------------------
  |  |  415|  8.31k|  }
  ------------------
  684|  89.3k|      r = GET_BITS(s);
  ------------------
  |  |  166|  89.3k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  685|  89.3k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  482|  89.3k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  480|  89.3k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  686|  89.3k|    }
  687|       |
  688|   661k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (688:9): [True: 661k, False: 0]
  ------------------
  689|   661k|      int ci = cinfo->MCU_membership[blkn];
  690|       |      /* Refer to the comment in decode_mcu_slow() regarding the supression of
  691|       |       * a UBSan integer overflow error in this line of code.
  692|       |       */
  693|   661k|      s += state.last_dc_val[ci];
  694|   661k|      state.last_dc_val[ci] = s;
  695|   661k|      if (block)
  ------------------
  |  Branch (695:11): [True: 661k, False: 0]
  ------------------
  696|   661k|        (*block)[0] = (JCOEF)s;
  697|   661k|    }
  698|       |
  699|   661k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (699:9): [True: 661k, False: 0]
  |  Branch (699:37): [True: 661k, False: 0]
  ------------------
  700|       |
  701|   840k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   47|   840k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:19): [True: 837k, False: 3.11k]
  ------------------
  702|   837k|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  221|   837k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  413|   837k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (413:7): [True: 62.6k, False: 774k]
  |  |  |  |  ------------------
  |  |  |  |  414|  62.6k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  62.6k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  62.6k|  register int c0, c1; \
  |  |  |  |  |  |  391|  62.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  62.6k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  62.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  62.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  62.6k|  bits_left += 8; \
  |  |  |  |  |  |  396|  62.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 3.08k, False: 59.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  3.08k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  3.08k|    buffer++; \
  |  |  |  |  |  |  399|  3.08k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 1.73k, False: 1.34k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  1.73k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  1.73k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  1.73k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  1.73k|      buffer -= 2; \
  |  |  |  |  |  |  404|  1.73k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  1.73k|    } \
  |  |  |  |  |  |  406|  3.08k|  } \
  |  |  |  |  |  |  407|  62.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  62.6k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  62.6k|  register int c0, c1; \
  |  |  |  |  |  |  391|  62.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  62.6k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  62.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  62.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  62.6k|  bits_left += 8; \
  |  |  |  |  |  |  396|  62.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 3.19k, False: 59.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  3.19k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  3.19k|    buffer++; \
  |  |  |  |  |  |  399|  3.19k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 2.05k, False: 1.14k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  2.05k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  2.05k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  2.05k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  2.05k|      buffer -= 2; \
  |  |  |  |  |  |  404|  2.05k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  2.05k|    } \
  |  |  |  |  |  |  406|  3.19k|  } \
  |  |  |  |  |  |  407|  62.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  62.6k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  62.6k|  register int c0, c1; \
  |  |  |  |  |  |  391|  62.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  62.6k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  62.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  62.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  62.6k|  bits_left += 8; \
  |  |  |  |  |  |  396|  62.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 3.57k, False: 59.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  3.57k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  3.57k|    buffer++; \
  |  |  |  |  |  |  399|  3.57k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 2.36k, False: 1.20k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  2.36k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  2.36k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  2.36k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  2.36k|      buffer -= 2; \
  |  |  |  |  |  |  404|  2.36k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  2.36k|    } \
  |  |  |  |  |  |  406|  3.57k|  } \
  |  |  |  |  |  |  407|  62.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  62.6k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  62.6k|  register int c0, c1; \
  |  |  |  |  |  |  391|  62.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  62.6k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  62.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  62.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  62.6k|  bits_left += 8; \
  |  |  |  |  |  |  396|  62.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 3.54k, False: 59.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  3.54k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  3.54k|    buffer++; \
  |  |  |  |  |  |  399|  3.54k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 2.69k, False: 850]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  2.69k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  2.69k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  2.69k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  2.69k|      buffer -= 2; \
  |  |  |  |  |  |  404|  2.69k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  2.69k|    } \
  |  |  |  |  |  |  406|  3.54k|  } \
  |  |  |  |  |  |  407|  62.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  62.6k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  62.6k|  register int c0, c1; \
  |  |  |  |  |  |  391|  62.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  62.6k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  62.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  62.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  62.6k|  bits_left += 8; \
  |  |  |  |  |  |  396|  62.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 4.52k, False: 58.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  4.52k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  4.52k|    buffer++; \
  |  |  |  |  |  |  399|  4.52k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 3.53k, False: 985]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  3.53k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  3.53k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  3.53k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  3.53k|      buffer -= 2; \
  |  |  |  |  |  |  404|  3.53k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  3.53k|    } \
  |  |  |  |  |  |  406|  4.52k|  } \
  |  |  |  |  |  |  407|  62.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|  62.6k|#define GET_BYTE { \
  |  |  |  |  |  |  390|  62.6k|  register int c0, c1; \
  |  |  |  |  |  |  391|  62.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  392|  62.6k|  c1 = *buffer; \
  |  |  |  |  |  |  393|  62.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|  62.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|  62.6k|  bits_left += 8; \
  |  |  |  |  |  |  396|  62.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 5.69k, False: 56.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|  5.69k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|  5.69k|    buffer++; \
  |  |  |  |  |  |  399|  5.69k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 4.05k, False: 1.64k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|  4.05k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|  4.05k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|  4.05k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|  4.05k|      buffer -= 2; \
  |  |  |  |  |  |  404|  4.05k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|  4.05k|    } \
  |  |  |  |  |  |  406|  5.69k|  } \
  |  |  |  |  |  |  407|  62.6k|}
  |  |  |  |  ------------------
  |  |  |  |  415|  62.6k|  }
  |  |  ------------------
  |  |  222|   837k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  169|   837k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  223|   837k|  s = htbl->lookup[s]; \
  |  |  224|   837k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   22|   837k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  225|   837k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  226|   837k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  172|   837k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  227|   837k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   22|   837k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   837k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  1.67M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (228:7): [True: 67.2k, False: 769k]
  |  |  ------------------
  |  |  229|  67.2k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  230|  67.2k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  231|  67.2k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  232|   470k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (232:12): [True: 403k, False: 67.2k]
  |  |  ------------------
  |  |  233|   403k|      s <<= 1; \
  |  |  234|   403k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  166|   403k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  235|   403k|      nb++; \
  |  |  236|   403k|    } \
  |  |  237|  67.2k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (237:9): [True: 44.8k, False: 22.3k]
  |  |  ------------------
  |  |  238|  67.2k|      s = 0; \
  |  |  239|  67.2k|    else \
  |  |  240|  67.2k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  241|  67.2k|  }
  ------------------
  703|   837k|        r = s >> 4;
  704|   837k|        s &= 15;
  705|       |
  706|   837k|        if (s) {
  ------------------
  |  Branch (706:13): [True: 175k, False: 661k]
  ------------------
  707|   175k|          k += r;
  708|   175k|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  413|   175k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (413:7): [True: 20.2k, False: 155k]
  |  |  ------------------
  |  |  414|  20.2k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  20.2k|#define GET_BYTE { \
  |  |  |  |  390|  20.2k|  register int c0, c1; \
  |  |  |  |  391|  20.2k|  c0 = *buffer++; \
  |  |  |  |  392|  20.2k|  c1 = *buffer; \
  |  |  |  |  393|  20.2k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  20.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  20.2k|  bits_left += 8; \
  |  |  |  |  396|  20.2k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 4.36k, False: 15.8k]
  |  |  |  |  ------------------
  |  |  |  |  397|  4.36k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|  4.36k|    buffer++; \
  |  |  |  |  399|  4.36k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 3.60k, False: 764]
  |  |  |  |  ------------------
  |  |  |  |  400|  3.60k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|  3.60k|      cinfo->unread_marker = c1; \
  |  |  |  |  402|  3.60k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|  3.60k|      buffer -= 2; \
  |  |  |  |  404|  3.60k|      get_buffer &= ~0xFF; \
  |  |  |  |  405|  3.60k|    } \
  |  |  |  |  406|  4.36k|  } \
  |  |  |  |  407|  20.2k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  20.2k|#define GET_BYTE { \
  |  |  |  |  390|  20.2k|  register int c0, c1; \
  |  |  |  |  391|  20.2k|  c0 = *buffer++; \
  |  |  |  |  392|  20.2k|  c1 = *buffer; \
  |  |  |  |  393|  20.2k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  20.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  20.2k|  bits_left += 8; \
  |  |  |  |  396|  20.2k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 4.49k, False: 15.7k]
  |  |  |  |  ------------------
  |  |  |  |  397|  4.49k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|  4.49k|    buffer++; \
  |  |  |  |  399|  4.49k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 3.93k, False: 562]
  |  |  |  |  ------------------
  |  |  |  |  400|  3.93k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|  3.93k|      cinfo->unread_marker = c1; \
  |  |  |  |  402|  3.93k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|  3.93k|      buffer -= 2; \
  |  |  |  |  404|  3.93k|      get_buffer &= ~0xFF; \
  |  |  |  |  405|  3.93k|    } \
  |  |  |  |  406|  4.49k|  } \
  |  |  |  |  407|  20.2k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  20.2k|#define GET_BYTE { \
  |  |  |  |  390|  20.2k|  register int c0, c1; \
  |  |  |  |  391|  20.2k|  c0 = *buffer++; \
  |  |  |  |  392|  20.2k|  c1 = *buffer; \
  |  |  |  |  393|  20.2k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  20.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  20.2k|  bits_left += 8; \
  |  |  |  |  396|  20.2k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 5.14k, False: 15.1k]
  |  |  |  |  ------------------
  |  |  |  |  397|  5.14k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|  5.14k|    buffer++; \
  |  |  |  |  399|  5.14k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 4.07k, False: 1.06k]
  |  |  |  |  ------------------
  |  |  |  |  400|  4.07k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|  4.07k|      cinfo->unread_marker = c1; \
  |  |  |  |  402|  4.07k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|  4.07k|      buffer -= 2; \
  |  |  |  |  404|  4.07k|      get_buffer &= ~0xFF; \
  |  |  |  |  405|  4.07k|    } \
  |  |  |  |  406|  5.14k|  } \
  |  |  |  |  407|  20.2k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  20.2k|#define GET_BYTE { \
  |  |  |  |  390|  20.2k|  register int c0, c1; \
  |  |  |  |  391|  20.2k|  c0 = *buffer++; \
  |  |  |  |  392|  20.2k|  c1 = *buffer; \
  |  |  |  |  393|  20.2k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  20.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  20.2k|  bits_left += 8; \
  |  |  |  |  396|  20.2k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 5.34k, False: 14.9k]
  |  |  |  |  ------------------
  |  |  |  |  397|  5.34k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|  5.34k|    buffer++; \
  |  |  |  |  399|  5.34k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 4.55k, False: 790]
  |  |  |  |  ------------------
  |  |  |  |  400|  4.55k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|  4.55k|      cinfo->unread_marker = c1; \
  |  |  |  |  402|  4.55k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|  4.55k|      buffer -= 2; \
  |  |  |  |  404|  4.55k|      get_buffer &= ~0xFF; \
  |  |  |  |  405|  4.55k|    } \
  |  |  |  |  406|  5.34k|  } \
  |  |  |  |  407|  20.2k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  20.2k|#define GET_BYTE { \
  |  |  |  |  390|  20.2k|  register int c0, c1; \
  |  |  |  |  391|  20.2k|  c0 = *buffer++; \
  |  |  |  |  392|  20.2k|  c1 = *buffer; \
  |  |  |  |  393|  20.2k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  20.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  20.2k|  bits_left += 8; \
  |  |  |  |  396|  20.2k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 5.45k, False: 14.8k]
  |  |  |  |  ------------------
  |  |  |  |  397|  5.45k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|  5.45k|    buffer++; \
  |  |  |  |  399|  5.45k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 4.70k, False: 749]
  |  |  |  |  ------------------
  |  |  |  |  400|  4.70k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|  4.70k|      cinfo->unread_marker = c1; \
  |  |  |  |  402|  4.70k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|  4.70k|      buffer -= 2; \
  |  |  |  |  404|  4.70k|      get_buffer &= ~0xFF; \
  |  |  |  |  405|  4.70k|    } \
  |  |  |  |  406|  5.45k|  } \
  |  |  |  |  407|  20.2k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|  20.2k|#define GET_BYTE { \
  |  |  |  |  390|  20.2k|  register int c0, c1; \
  |  |  |  |  391|  20.2k|  c0 = *buffer++; \
  |  |  |  |  392|  20.2k|  c1 = *buffer; \
  |  |  |  |  393|  20.2k|  /* Pre-execute most common case */ \
  |  |  |  |  394|  20.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|  20.2k|  bits_left += 8; \
  |  |  |  |  396|  20.2k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 5.43k, False: 14.8k]
  |  |  |  |  ------------------
  |  |  |  |  397|  5.43k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|  5.43k|    buffer++; \
  |  |  |  |  399|  5.43k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 4.86k, False: 571]
  |  |  |  |  ------------------
  |  |  |  |  400|  4.86k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|  4.86k|      cinfo->unread_marker = c1; \
  |  |  |  |  402|  4.86k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|  4.86k|      buffer -= 2; \
  |  |  |  |  404|  4.86k|      get_buffer &= ~0xFF; \
  |  |  |  |  405|  4.86k|    } \
  |  |  |  |  406|  5.43k|  } \
  |  |  |  |  407|  20.2k|}
  |  |  ------------------
  |  |  415|  20.2k|  }
  ------------------
  709|   175k|          r = GET_BITS(s);
  ------------------
  |  |  166|   175k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  710|   175k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  482|   175k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  480|   175k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  711|   175k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  712|   661k|        } else {
  713|   661k|          if (r != 15) break;
  ------------------
  |  Branch (713:15): [True: 657k, False: 3.35k]
  ------------------
  714|  3.35k|          k += 15;
  715|  3.35k|        }
  716|   837k|      }
  717|       |
  718|   661k|    } else {
  719|       |
  720|      0|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   47|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (720:19): [True: 0, False: 0]
  ------------------
  721|      0|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  221|      0|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  413|      0|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (413:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  414|      0|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|      0|    } \
  |  |  |  |  |  |  406|      0|  } \
  |  |  |  |  |  |  407|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|      0|    } \
  |  |  |  |  |  |  406|      0|  } \
  |  |  |  |  |  |  407|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|      0|    } \
  |  |  |  |  |  |  406|      0|  } \
  |  |  |  |  |  |  407|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|      0|    } \
  |  |  |  |  |  |  406|      0|  } \
  |  |  |  |  |  |  407|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|      0|    } \
  |  |  |  |  |  |  406|      0|  } \
  |  |  |  |  |  |  407|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  405|      0|    } \
  |  |  |  |  |  |  406|      0|  } \
  |  |  |  |  |  |  407|      0|}
  |  |  |  |  ------------------
  |  |  |  |  415|      0|  }
  |  |  ------------------
  |  |  222|      0|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  169|      0|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  223|      0|  s = htbl->lookup[s]; \
  |  |  224|      0|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   22|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  225|      0|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  226|      0|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  172|      0|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  227|      0|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   22|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|      0|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (228:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  229|      0|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  230|      0|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  231|      0|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  232|      0|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (232:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  233|      0|      s <<= 1; \
  |  |  234|      0|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  166|      0|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  235|      0|      nb++; \
  |  |  236|      0|    } \
  |  |  237|      0|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (237:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  238|      0|      s = 0; \
  |  |  239|      0|    else \
  |  |  240|      0|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  241|      0|  }
  ------------------
  722|      0|        r = s >> 4;
  723|      0|        s &= 15;
  724|       |
  725|      0|        if (s) {
  ------------------
  |  Branch (725:13): [True: 0, False: 0]
  ------------------
  726|      0|          k += r;
  727|      0|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  413|      0|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (413:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  414|      0|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  405|      0|    } \
  |  |  |  |  406|      0|  } \
  |  |  |  |  407|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  405|      0|    } \
  |  |  |  |  406|      0|  } \
  |  |  |  |  407|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  405|      0|    } \
  |  |  |  |  406|      0|  } \
  |  |  |  |  407|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  405|      0|    } \
  |  |  |  |  406|      0|  } \
  |  |  |  |  407|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  405|      0|    } \
  |  |  |  |  406|      0|  } \
  |  |  |  |  407|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  389|      0|#define GET_BYTE { \
  |  |  |  |  390|      0|  register int c0, c1; \
  |  |  |  |  391|      0|  c0 = *buffer++; \
  |  |  |  |  392|      0|  c1 = *buffer; \
  |  |  |  |  393|      0|  /* Pre-execute most common case */ \
  |  |  |  |  394|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  395|      0|  bits_left += 8; \
  |  |  |  |  396|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (396:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  397|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  398|      0|    buffer++; \
  |  |  |  |  399|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (399:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  400|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  401|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  402|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  403|      0|      buffer -= 2; \
  |  |  |  |  404|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  405|      0|    } \
  |  |  |  |  406|      0|  } \
  |  |  |  |  407|      0|}
  |  |  ------------------
  |  |  415|      0|  }
  ------------------
  728|      0|          DROP_BITS(s);
  ------------------
  |  |  172|      0|  (bits_left -= (nbits))
  ------------------
  729|      0|        } else {
  730|      0|          if (r != 15) break;
  ------------------
  |  Branch (730:15): [True: 0, False: 0]
  ------------------
  731|      0|          k += 15;
  732|      0|        }
  733|      0|      }
  734|      0|    }
  735|   661k|  }
  736|       |
  737|   265k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (737:7): [True: 10.3k, False: 254k]
  ------------------
  738|  10.3k|    cinfo->unread_marker = 0;
  739|  10.3k|    return FALSE;
  ------------------
  |  |  206|  10.3k|#define FALSE   0               /* values of boolean */
  ------------------
  740|  10.3k|  }
  741|       |
  742|   254k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  743|   254k|  br_state.next_input_byte = buffer;
  744|   254k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  134|   254k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  135|   254k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  136|   254k|  permstate.get_buffer = get_buffer; \
  |  |  137|   254k|  permstate.bits_left = bits_left
  ------------------
  745|   254k|  entropy->saved = state;
  746|   254k|  return TRUE;
  ------------------
  |  |  209|   254k|#define TRUE    1
  ------------------
  747|   265k|}
jdhuff.c:decode_mcu_slow:
  551|   522k|{
  552|   522k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  553|   522k|  BITREAD_STATE_VARS;
  ------------------
  |  |  122|   522k|  register bit_buf_type get_buffer; \
  |  |  123|   522k|  register int bits_left; \
  |  |  124|   522k|  bitread_working_state br_state
  ------------------
  554|   522k|  int blkn;
  555|   522k|  savable_state state;
  556|       |  /* Outer loop handles each block in the MCU */
  557|       |
  558|       |  /* Load up working state */
  559|   522k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  127|   522k|  br_state.cinfo = cinfop; \
  |  |  128|   522k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  129|   522k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  130|   522k|  get_buffer = permstate.get_buffer; \
  |  |  131|   522k|  bits_left = permstate.bits_left;
  ------------------
  560|   522k|  state = entropy->saved;
  561|       |
  562|  1.38M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (562:18): [True: 869k, False: 516k]
  ------------------
  563|   869k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (563:23): [True: 869k, False: 0]
  ------------------
  564|   869k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  565|   869k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  566|   869k|    register int s, k, r;
  567|       |
  568|       |    /* Decode a single block's worth of coefficients */
  569|       |
  570|       |    /* Section F.2.2.1: decode the DC coefficient difference */
  571|   869k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  197|   869k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  198|   869k|  register int nb, look; \
  |  |  199|   869k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|   869k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (199:7): [True: 126k, False: 743k]
  |  |  ------------------
  |  |  200|   126k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (200:9): [True: 0, False: 126k]
  |  |  ------------------
  |  |  201|   126k|      { failaction; } \
  |  |  202|   126k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  203|   126k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|   126k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 14.5k, False: 111k]
  |  |  ------------------
  |  |  204|  14.5k|      nb = 1;  goto slowlabel; \
  |  |  205|  14.5k|    } \
  |  |  206|   126k|  } \
  |  |  207|   869k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  169|   854k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  208|   854k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|   854k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|   854k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (208:7): [True: 568k, False: 286k]
  |  |  ------------------
  |  |  209|   568k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  172|   568k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  210|   568k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   22|   568k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  211|   568k|  } else { \
  |  |  212|   295k|slowlabel: \
  |  |  213|   295k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (213:9): [True: 0, False: 295k]
  |  |  ------------------
  |  |  214|   295k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  215|   295k|      { failaction; } \
  |  |  216|   295k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  217|   295k|  } \
  |  |  218|   854k|}
  ------------------
  572|   863k|    if (s) {
  ------------------
  |  Branch (572:9): [True: 417k, False: 445k]
  ------------------
  573|   417k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  157|   417k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|   417k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 53.3k, False: 364k]
  |  |  ------------------
  |  |  159|  53.3k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 53.3k]
  |  |  ------------------
  |  |  160|  53.3k|      { action; } \
  |  |  161|  53.3k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|  53.3k|  } \
  |  |  163|   417k|}
  ------------------
  574|   417k|      r = GET_BITS(s);
  ------------------
  |  |  166|   417k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  575|   417k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  482|   417k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  480|   417k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  576|   417k|    }
  577|       |
  578|   863k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (578:9): [True: 863k, False: 0]
  ------------------
  579|       |      /* Convert DC difference to actual value, update last_dc_val */
  580|   863k|      int ci = cinfo->MCU_membership[blkn];
  581|       |      /* Certain malformed JPEG images produce repeated DC coefficient
  582|       |       * differences of 2047 or -2047, which causes state.last_dc_val[ci] to
  583|       |       * grow until it overflows or underflows a 32-bit signed integer.  This
  584|       |       * behavior is, to the best of our understanding, innocuous, and it is
  585|       |       * unclear how to work around it without potentially affecting
  586|       |       * performance.  Thus, we (hopefully temporarily) suppress UBSan integer
  587|       |       * overflow errors for this function and decode_mcu_fast().
  588|       |       */
  589|   863k|      s += state.last_dc_val[ci];
  590|   863k|      state.last_dc_val[ci] = s;
  591|   863k|      if (block) {
  ------------------
  |  Branch (591:11): [True: 863k, False: 0]
  ------------------
  592|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  593|   863k|        (*block)[0] = (JCOEF)s;
  594|   863k|      }
  595|   863k|    }
  596|       |
  597|   863k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (597:9): [True: 863k, False: 0]
  |  Branch (597:37): [True: 863k, False: 0]
  ------------------
  598|       |
  599|       |      /* Section F.2.2.2: decode the AC coefficients */
  600|       |      /* Since zeroes are skipped, output area must be cleared beforehand */
  601|  4.11M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   47|  4.11M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (601:19): [True: 4.07M, False: 41.6k]
  ------------------
  602|  4.07M|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  197|  4.07M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  198|  4.07M|  register int nb, look; \
  |  |  199|  4.07M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  4.07M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (199:7): [True: 515k, False: 3.55M]
  |  |  ------------------
  |  |  200|   515k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (200:9): [True: 0, False: 515k]
  |  |  ------------------
  |  |  201|   515k|      { failaction; } \
  |  |  202|   515k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  203|   515k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|   515k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 297k, False: 218k]
  |  |  ------------------
  |  |  204|   297k|      nb = 1;  goto slowlabel; \
  |  |  205|   297k|    } \
  |  |  206|   515k|  } \
  |  |  207|  4.07M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  169|  3.77M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  208|  3.77M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  3.77M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  3.77M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (208:7): [True: 3.32M, False: 446k]
  |  |  ------------------
  |  |  209|  3.32M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  172|  3.32M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  210|  3.32M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   22|  3.32M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  211|  3.32M|  } else { \
  |  |  212|   743k|slowlabel: \
  |  |  213|   743k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (213:9): [True: 0, False: 743k]
  |  |  ------------------
  |  |  214|   743k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  215|   743k|      { failaction; } \
  |  |  216|   743k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  217|   743k|  } \
  |  |  218|  3.77M|}
  ------------------
  603|       |
  604|  4.07M|        r = s >> 4;
  605|  4.07M|        s &= 15;
  606|       |
  607|  4.07M|        if (s) {
  ------------------
  |  Branch (607:13): [True: 3.24M, False: 830k]
  ------------------
  608|  3.24M|          k += r;
  609|  3.24M|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  157|  3.24M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|  3.24M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 317k, False: 2.92M]
  |  |  ------------------
  |  |  159|   317k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 317k]
  |  |  ------------------
  |  |  160|   317k|      { action; } \
  |  |  161|   317k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|   317k|  } \
  |  |  163|  3.24M|}
  ------------------
  610|  3.24M|          r = GET_BITS(s);
  ------------------
  |  |  166|  3.24M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  611|  3.24M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  482|  3.24M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  480|  3.24M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  612|       |          /* Output coefficient in natural (dezigzagged) order.
  613|       |           * Note: the extra entries in jpeg_natural_order[] will save us
  614|       |           * if k >= DCTSIZE2, which could happen if the data is corrupted.
  615|       |           */
  616|  3.24M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  617|  3.24M|        } else {
  618|   830k|          if (r != 15)
  ------------------
  |  Branch (618:15): [True: 821k, False: 8.83k]
  ------------------
  619|   821k|            break;
  620|  8.83k|          k += 15;
  621|  8.83k|        }
  622|  4.07M|      }
  623|       |
  624|   863k|    } else {
  625|       |
  626|       |      /* Section F.2.2.2: decode the AC coefficients */
  627|       |      /* In this path we just discard the values */
  628|      0|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   47|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (628:19): [True: 0, False: 0]
  ------------------
  629|      0|        HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
  ------------------
  |  |  197|      0|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  198|      0|  register int nb, look; \
  |  |  199|      0|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (199:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  200|      0|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (200:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  201|      0|      { failaction; } \
  |  |  202|      0|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  203|      0|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  204|      0|      nb = 1;  goto slowlabel; \
  |  |  205|      0|    } \
  |  |  206|      0|  } \
  |  |  207|      0|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  169|      0|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  208|      0|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (208:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  209|      0|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  172|      0|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  210|      0|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   22|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  211|      0|  } else { \
  |  |  212|      0|slowlabel: \
  |  |  213|      0|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (213:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  214|      0|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  215|      0|      { failaction; } \
  |  |  216|      0|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  217|      0|  } \
  |  |  218|      0|}
  ------------------
  630|       |
  631|      0|        r = s >> 4;
  632|      0|        s &= 15;
  633|       |
  634|      0|        if (s) {
  ------------------
  |  Branch (634:13): [True: 0, False: 0]
  ------------------
  635|      0|          k += r;
  636|      0|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  157|      0|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|      0|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  159|      0|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  160|      0|      { action; } \
  |  |  161|      0|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|      0|  } \
  |  |  163|      0|}
  ------------------
  637|      0|          DROP_BITS(s);
  ------------------
  |  |  172|      0|  (bits_left -= (nbits))
  ------------------
  638|      0|        } else {
  639|      0|          if (r != 15)
  ------------------
  |  Branch (639:15): [True: 0, False: 0]
  ------------------
  640|      0|            break;
  641|      0|          k += 15;
  642|      0|        }
  643|      0|      }
  644|      0|    }
  645|   863k|  }
  646|       |
  647|       |  /* Completed MCU, so update state */
  648|   516k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  134|   516k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  135|   516k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  136|   516k|  permstate.get_buffer = get_buffer; \
  |  |  137|   516k|  permstate.bits_left = bits_left
  ------------------
  649|   516k|  entropy->saved = state;
  650|   516k|  return TRUE;
  ------------------
  |  |  209|   516k|#define TRUE    1
  ------------------
  651|   522k|}

jinit_input_controller:
  389|  18.1k|{
  390|  18.1k|  my_inputctl_ptr inputctl;
  391|       |
  392|       |  /* Create subobject in permanent pool */
  393|  18.1k|  inputctl = (my_inputctl_ptr)
  394|  18.1k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  825|  18.1k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  395|  18.1k|                                sizeof(my_input_controller));
  396|  18.1k|  cinfo->inputctl = (struct jpeg_input_controller *)inputctl;
  397|       |  /* Initialize method pointers */
  398|  18.1k|  inputctl->pub.consume_input = consume_markers;
  399|  18.1k|  inputctl->pub.reset_input_controller = reset_input_controller;
  400|  18.1k|  inputctl->pub.start_input_pass = start_input_pass;
  401|  18.1k|  inputctl->pub.finish_input_pass = finish_input_pass;
  402|       |  /* Initialize state: can't use reset_input_controller since we don't
  403|       |   * want to try to reset other modules yet.
  404|       |   */
  405|  18.1k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  206|  18.1k|#define FALSE   0               /* values of boolean */
  ------------------
  406|  18.1k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  206|  18.1k|#define FALSE   0               /* values of boolean */
  ------------------
  407|  18.1k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  209|  18.1k|#define TRUE    1
  ------------------
  408|  18.1k|}
jdinput.c:consume_markers:
  316|   208k|{
  317|   208k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  318|   208k|  int val;
  319|       |
  320|   208k|  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
  ------------------
  |  Branch (320:7): [True: 0, False: 208k]
  ------------------
  321|      0|    return JPEG_REACHED_EOI;
  ------------------
  |  | 1021|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  322|       |
  323|   208k|  val = (*cinfo->marker->read_markers) (cinfo);
  324|       |
  325|   208k|  switch (val) {
  ------------------
  |  Branch (325:11): [True: 103k, False: 104k]
  ------------------
  326|  69.4k|  case JPEG_REACHED_SOS:        /* Found SOS */
  ------------------
  |  | 1020|  69.4k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (326:3): [True: 69.4k, False: 138k]
  ------------------
  327|  69.4k|    if (inputctl->inheaders) {  /* 1st SOS */
  ------------------
  |  Branch (327:9): [True: 59.1k, False: 10.3k]
  ------------------
  328|  59.1k|      initial_setup(cinfo);
  329|  59.1k|      inputctl->inheaders = FALSE;
  ------------------
  |  |  206|  59.1k|#define FALSE   0               /* values of boolean */
  ------------------
  330|       |      /* Note: start_input_pass must be called by jdmaster.c
  331|       |       * before any more input can be consumed.  jdapimin.c is
  332|       |       * responsible for enforcing this sequencing.
  333|       |       */
  334|  59.1k|    } else {                    /* 2nd or later SOS marker */
  335|  10.3k|      if (!inputctl->pub.has_multiple_scans)
  ------------------
  |  Branch (335:11): [True: 223, False: 10.0k]
  ------------------
  336|    223|        ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
  ------------------
  |  |  235|    223|  ((cinfo)->err->msg_code = (code), \
  |  |  236|    223|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  337|  10.3k|      start_input_pass(cinfo);
  338|  10.3k|    }
  339|  69.4k|    break;
  340|  35.2k|  case JPEG_REACHED_EOI:        /* Found EOI */
  ------------------
  |  | 1021|  35.2k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (340:3): [True: 35.2k, False: 172k]
  ------------------
  341|  35.2k|    inputctl->pub.eoi_reached = TRUE;
  ------------------
  |  |  209|  35.2k|#define TRUE    1
  ------------------
  342|  35.2k|    if (inputctl->inheaders) {  /* Tables-only datastream, apparently */
  ------------------
  |  Branch (342:9): [True: 12.0k, False: 23.1k]
  ------------------
  343|  12.0k|      if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (343:11): [True: 1.32k, False: 10.7k]
  ------------------
  344|  1.32k|        ERREXIT(cinfo, JERR_SOF_NO_SOS);
  ------------------
  |  |  235|  1.32k|  ((cinfo)->err->msg_code = (code), \
  |  |  236|  1.32k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  345|  23.1k|    } else {
  346|       |      /* Prevent infinite loop in coef ctlr's decompress_data routine
  347|       |       * if user set output_scan_number larger than number of scans.
  348|       |       */
  349|  23.1k|      if (cinfo->output_scan_number > cinfo->input_scan_number)
  ------------------
  |  Branch (349:11): [True: 185, False: 22.9k]
  ------------------
  350|    185|        cinfo->output_scan_number = cinfo->input_scan_number;
  351|  23.1k|    }
  352|  35.2k|    break;
  353|      0|  case JPEG_SUSPENDED:
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (353:3): [True: 0, False: 208k]
  ------------------
  354|      0|    break;
  355|   208k|  }
  356|       |
  357|  99.2k|  return val;
  358|   208k|}
jdinput.c:initial_setup:
   46|  59.1k|{
   47|  59.1k|  int ci;
   48|  59.1k|  jpeg_component_info *compptr;
   49|       |
   50|       |  /* Make sure image isn't bigger than I can handle */
   51|  59.1k|  if ((long)cinfo->image_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  157|   118k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (51:7): [True: 222, False: 58.9k]
  ------------------
   52|  59.1k|      (long)cinfo->image_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  157|  58.9k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (52:7): [True: 292, False: 58.6k]
  ------------------
   53|    514|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
  ------------------
  |  |  238|    514|  ((cinfo)->err->msg_code = (code), \
  |  |  239|    514|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|    514|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   54|       |
   55|       |  /* For now, precision must match compiled-in value... */
   56|  59.1k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   33|  59.1k|#define BITS_IN_JSAMPLE  8      /* use 8 or 12 */
  ------------------
  |  Branch (56:7): [True: 233, False: 58.9k]
  ------------------
   57|    233|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  238|    233|  ((cinfo)->err->msg_code = (code), \
  |  |  239|    233|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|    233|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   58|       |
   59|       |  /* Check that number of components won't exceed internal array sizes */
   60|  59.1k|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   27|  59.1k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (60:7): [True: 74, False: 59.0k]
  ------------------
   61|     74|    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  242|     74|  ((cinfo)->err->msg_code = (code), \
  |  |  243|     74|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  244|     74|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  245|     74|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   62|  59.1k|             MAX_COMPONENTS);
   63|       |
   64|       |  /* Compute maximum sampling factors; check factor validity */
   65|  59.1k|  cinfo->max_h_samp_factor = 1;
   66|  59.1k|  cinfo->max_v_samp_factor = 1;
   67|   136k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (67:44): [True: 77.6k, False: 59.1k]
  ------------------
   68|  77.6k|       ci++, compptr++) {
   69|  77.6k|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (69:9): [True: 249, False: 77.4k]
  ------------------
   70|  77.6k|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   52|   155k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (70:9): [True: 288, False: 77.1k]
  ------------------
   71|  77.6k|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (71:9): [True: 262, False: 76.8k]
  ------------------
   72|  77.6k|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   52|  76.8k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (72:9): [True: 216, False: 76.6k]
  ------------------
   73|  1.01k|      ERREXIT(cinfo, JERR_BAD_SAMPLING);
  ------------------
  |  |  235|  1.01k|  ((cinfo)->err->msg_code = (code), \
  |  |  236|  1.01k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   74|  77.6k|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  293|  77.6k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (293:26): [True: 9.92k, False: 67.7k]
  |  |  ------------------
  ------------------
   75|  77.6k|                                   compptr->h_samp_factor);
   76|  77.6k|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  293|  77.6k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (293:26): [True: 9.62k, False: 68.0k]
  |  |  ------------------
  ------------------
   77|  77.6k|                                   compptr->v_samp_factor);
   78|  77.6k|  }
   79|       |
   80|       |#if JPEG_LIB_VERSION >= 80
   81|       |  cinfo->block_size = DCTSIZE;
   82|       |  cinfo->natural_order = jpeg_natural_order;
   83|       |  cinfo->lim_Se = DCTSIZE2 - 1;
   84|       |#endif
   85|       |
   86|       |  /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
   87|       |   * In the full decompressor, this will be overridden by jdmaster.c;
   88|       |   * but in the transcoder, jdmaster.c is not used, so we must do it here.
   89|       |   */
   90|       |#if JPEG_LIB_VERSION >= 70
   91|       |  cinfo->min_DCT_h_scaled_size = cinfo->min_DCT_v_scaled_size = DCTSIZE;
   92|       |#else
   93|  59.1k|  cinfo->min_DCT_scaled_size = DCTSIZE;
  ------------------
  |  |   46|  59.1k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
   94|  59.1k|#endif
   95|       |
   96|       |  /* Compute dimensions of components */
   97|   135k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (97:44): [True: 76.3k, False: 59.1k]
  ------------------
   98|  76.3k|       ci++, compptr++) {
   99|       |#if JPEG_LIB_VERSION >= 70
  100|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = DCTSIZE;
  101|       |#else
  102|  76.3k|    compptr->DCT_scaled_size = DCTSIZE;
  ------------------
  |  |   46|  76.3k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  103|  76.3k|#endif
  104|       |    /* Size in DCT blocks */
  105|  76.3k|    compptr->width_in_blocks = (JDIMENSION)
  106|  76.3k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  107|  76.3k|                    (long)(cinfo->max_h_samp_factor * DCTSIZE));
  ------------------
  |  |   46|  76.3k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  108|  76.3k|    compptr->height_in_blocks = (JDIMENSION)
  109|  76.3k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  110|  76.3k|                    (long)(cinfo->max_v_samp_factor * DCTSIZE));
  ------------------
  |  |   46|  76.3k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  111|       |    /* Set the first and last MCU columns to decompress from multi-scan images.
  112|       |     * By default, decompress all of the MCU columns.
  113|       |     */
  114|  76.3k|    cinfo->master->first_MCU_col[ci] = 0;
  115|  76.3k|    cinfo->master->last_MCU_col[ci] = compptr->width_in_blocks - 1;
  116|       |    /* downsampled_width and downsampled_height will also be overridden by
  117|       |     * jdmaster.c if we are doing full decompression.  The transcoder library
  118|       |     * doesn't use these values, but the calling application might.
  119|       |     */
  120|       |    /* Size in samples */
  121|  76.3k|    compptr->downsampled_width = (JDIMENSION)
  122|  76.3k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  123|  76.3k|                    (long)cinfo->max_h_samp_factor);
  124|  76.3k|    compptr->downsampled_height = (JDIMENSION)
  125|  76.3k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  126|  76.3k|                    (long)cinfo->max_v_samp_factor);
  127|       |    /* Mark component needed, until color conversion says otherwise */
  128|  76.3k|    compptr->component_needed = TRUE;
  ------------------
  |  |  209|  76.3k|#define TRUE    1
  ------------------
  129|       |    /* Mark no quantization table yet saved for component */
  130|  76.3k|    compptr->quant_table = NULL;
  131|  76.3k|  }
  132|       |
  133|       |  /* Compute number of fully interleaved MCU rows. */
  134|  59.1k|  cinfo->total_iMCU_rows = (JDIMENSION)
  135|  59.1k|    jdiv_round_up((long)cinfo->image_height,
  136|  59.1k|                  (long)(cinfo->max_v_samp_factor * DCTSIZE));
  ------------------
  |  |   46|  59.1k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  137|       |
  138|       |  /* Decide whether file contains multiple scans */
  139|  59.1k|  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
  ------------------
  |  Branch (139:7): [True: 8.31k, False: 50.8k]
  |  Branch (139:55): [True: 17.6k, False: 33.2k]
  ------------------
  140|  24.0k|    cinfo->inputctl->has_multiple_scans = TRUE;
  ------------------
  |  |  209|  24.0k|#define TRUE    1
  ------------------
  141|  35.0k|  else
  142|  35.0k|    cinfo->inputctl->has_multiple_scans = FALSE;
  ------------------
  |  |  206|  35.0k|#define FALSE   0               /* values of boolean */
  ------------------
  143|  59.1k|}
jdinput.c:reset_input_controller:
  367|   162k|{
  368|   162k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  369|       |
  370|   162k|  inputctl->pub.consume_input = consume_markers;
  371|   162k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  206|   162k|#define FALSE   0               /* values of boolean */
  ------------------
  372|   162k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  206|   162k|#define FALSE   0               /* values of boolean */
  ------------------
  373|   162k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  209|   162k|#define TRUE    1
  ------------------
  374|       |  /* Reset other modules */
  375|   162k|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
  376|   162k|  (*cinfo->marker->reset_marker_reader) (cinfo);
  377|       |  /* Reset progression state -- would be cleaner if entropy decoder did this */
  378|   162k|  cinfo->coef_bits = NULL;
  379|   162k|}
jdinput.c:start_input_pass:
  282|  64.5k|{
  283|  64.5k|  per_scan_setup(cinfo);
  284|  64.5k|  latch_quant_tables(cinfo);
  285|  64.5k|  (*cinfo->entropy->start_pass) (cinfo);
  286|  64.5k|  (*cinfo->coef->start_input_pass) (cinfo);
  287|  64.5k|  cinfo->inputctl->consume_input = cinfo->coef->consume_data;
  288|  64.5k|}
jdinput.c:per_scan_setup:
  150|  64.5k|{
  151|  64.5k|  int ci, mcublks, tmp;
  152|  64.5k|  jpeg_component_info *compptr;
  153|       |
  154|  64.5k|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (154:7): [True: 60.6k, False: 3.95k]
  ------------------
  155|       |
  156|       |    /* Noninterleaved (single-component) scan */
  157|  60.6k|    compptr = cinfo->cur_comp_info[0];
  158|       |
  159|       |    /* Overall image size in MCUs */
  160|  60.6k|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  161|  60.6k|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  162|       |
  163|       |    /* For noninterleaved scan, always one block per MCU */
  164|  60.6k|    compptr->MCU_width = 1;
  165|  60.6k|    compptr->MCU_height = 1;
  166|  60.6k|    compptr->MCU_blocks = 1;
  167|  60.6k|    compptr->MCU_sample_width = compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  60.6k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  168|  60.6k|    compptr->last_col_width = 1;
  169|       |    /* For noninterleaved scans, it is convenient to define last_row_height
  170|       |     * as the number of block rows present in the last iMCU row.
  171|       |     */
  172|  60.6k|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  173|  60.6k|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (173:9): [True: 57.9k, False: 2.64k]
  ------------------
  174|  60.6k|    compptr->last_row_height = tmp;
  175|       |
  176|       |    /* Prepare array describing MCU composition */
  177|  60.6k|    cinfo->blocks_in_MCU = 1;
  178|  60.6k|    cinfo->MCU_membership[0] = 0;
  179|       |
  180|  60.6k|  } else {
  181|       |
  182|       |    /* Interleaved (multi-component) scan */
  183|  3.95k|    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   51|  3.95k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (183:9): [True: 0, False: 3.95k]
  |  Branch (183:38): [True: 0, False: 3.95k]
  ------------------
  184|      0|      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
  ------------------
  |  |  242|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  243|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  185|  3.95k|               MAX_COMPS_IN_SCAN);
  186|       |
  187|       |    /* Overall image size in MCUs */
  188|  3.95k|    cinfo->MCUs_per_row = (JDIMENSION)
  189|  3.95k|      jdiv_round_up((long)cinfo->image_width,
  190|  3.95k|                    (long)(cinfo->max_h_samp_factor * DCTSIZE));
  ------------------
  |  |   46|  3.95k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  191|  3.95k|    cinfo->MCU_rows_in_scan = (JDIMENSION)
  192|  3.95k|      jdiv_round_up((long)cinfo->image_height,
  193|  3.95k|                    (long)(cinfo->max_v_samp_factor * DCTSIZE));
  ------------------
  |  |   46|  3.95k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  194|       |
  195|  3.95k|    cinfo->blocks_in_MCU = 0;
  196|       |
  197|  15.8k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (197:18): [True: 11.8k, False: 3.95k]
  ------------------
  198|  11.8k|      compptr = cinfo->cur_comp_info[ci];
  199|       |      /* Sampling factors give # of blocks of component in each MCU */
  200|  11.8k|      compptr->MCU_width = compptr->h_samp_factor;
  201|  11.8k|      compptr->MCU_height = compptr->v_samp_factor;
  202|  11.8k|      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
  203|  11.8k|      compptr->MCU_sample_width = compptr->MCU_width *
  204|  11.8k|                                  compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  11.8k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  205|       |      /* Figure number of non-dummy blocks in last MCU column & row */
  206|  11.8k|      tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
  207|  11.8k|      if (tmp == 0) tmp = compptr->MCU_width;
  ------------------
  |  Branch (207:11): [True: 10.3k, False: 1.45k]
  ------------------
  208|  11.8k|      compptr->last_col_width = tmp;
  209|  11.8k|      tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
  210|  11.8k|      if (tmp == 0) tmp = compptr->MCU_height;
  ------------------
  |  Branch (210:11): [True: 9.73k, False: 2.11k]
  ------------------
  211|  11.8k|      compptr->last_row_height = tmp;
  212|       |      /* Prepare array describing MCU composition */
  213|  11.8k|      mcublks = compptr->MCU_blocks;
  214|  11.8k|      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
  ------------------
  |  |   62|  11.8k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on blocks per MCU */
  ------------------
  |  Branch (214:11): [True: 13, False: 11.8k]
  ------------------
  215|     13|        ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
  ------------------
  |  |  235|     13|  ((cinfo)->err->msg_code = (code), \
  |  |  236|     13|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  216|  33.8k|      while (mcublks-- > 0) {
  ------------------
  |  Branch (216:14): [True: 22.0k, False: 11.8k]
  ------------------
  217|  22.0k|        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
  218|  22.0k|      }
  219|  11.8k|    }
  220|       |
  221|  3.95k|  }
  222|  64.5k|}
jdinput.c:latch_quant_tables:
  248|  64.5k|{
  249|  64.5k|  int ci, qtblno;
  250|  64.5k|  jpeg_component_info *compptr;
  251|  64.5k|  JQUANT_TBL *qtbl;
  252|       |
  253|   136k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (253:16): [True: 72.4k, False: 64.5k]
  ------------------
  254|  72.4k|    compptr = cinfo->cur_comp_info[ci];
  255|       |    /* No work if we already saved Q-table for this component */
  256|  72.4k|    if (compptr->quant_table != NULL)
  ------------------
  |  Branch (256:9): [True: 12.4k, False: 59.9k]
  ------------------
  257|  12.4k|      continue;
  258|       |    /* Make sure specified quantization table is present */
  259|  59.9k|    qtblno = compptr->quant_tbl_no;
  260|  59.9k|    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
  ------------------
  |  |   48|   119k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (260:9): [True: 0, False: 59.9k]
  |  Branch (260:23): [True: 209, False: 59.7k]
  ------------------
  261|  59.9k|        cinfo->quant_tbl_ptrs[qtblno] == NULL)
  ------------------
  |  Branch (261:9): [True: 205, False: 59.5k]
  ------------------
  262|    414|      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
  ------------------
  |  |  238|    414|  ((cinfo)->err->msg_code = (code), \
  |  |  239|    414|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|    414|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  263|       |    /* OK, save away the quantization table */
  264|  59.9k|    qtbl = (JQUANT_TBL *)
  265|  59.9k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  59.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  266|  59.9k|                                  sizeof(JQUANT_TBL));
  267|  59.9k|    memcpy(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL));
  268|  59.9k|    compptr->quant_table = qtbl;
  269|  59.9k|  }
  270|  64.5k|}
jdinput.c:finish_input_pass:
  299|  55.6k|{
  300|  55.6k|  cinfo->inputctl->consume_input = consume_markers;
  301|  55.6k|}

jinit_d_main_controller:
  425|  54.2k|{
  426|  54.2k|  my_main_ptr main_ptr;
  427|  54.2k|  int ci, rgroup, ngroups;
  428|  54.2k|  jpeg_component_info *compptr;
  429|       |
  430|  54.2k|  main_ptr = (my_main_ptr)
  431|  54.2k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  54.2k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  432|  54.2k|                                sizeof(my_main_controller));
  433|  54.2k|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  434|  54.2k|  main_ptr->pub.start_pass = start_pass_main;
  435|       |
  436|  54.2k|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (436:7): [True: 0, False: 54.2k]
  ------------------
  437|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  438|       |
  439|       |  /* Allocate the workspace.
  440|       |   * ngroups is the number of row groups we need.
  441|       |   */
  442|  54.2k|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (442:7): [True: 2.21k, False: 52.0k]
  ------------------
  443|  2.21k|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|  2.21k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (443:9): [True: 0, False: 2.21k]
  ------------------
  444|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  445|  2.21k|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  446|  2.21k|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|  2.21k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  447|  52.0k|  } else {
  448|  52.0k|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  52.0k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  449|  52.0k|  }
  450|       |
  451|   124k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (451:44): [True: 70.5k, False: 54.2k]
  ------------------
  452|  70.5k|       ci++, compptr++) {
  453|  70.5k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  70.5k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  454|  70.5k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  70.5k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  455|  70.5k|    main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray)
  456|  70.5k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  70.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  457|  70.5k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|  70.5k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  458|  70.5k|                         (JDIMENSION)(rgroup * ngroups));
  459|  70.5k|  }
  460|  54.2k|}
jdmainct.c:start_pass_main:
  255|  46.5k|{
  256|  46.5k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  257|       |
  258|  46.5k|  switch (pass_mode) {
  259|  46.5k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (259:3): [True: 46.5k, False: 0]
  ------------------
  260|  46.5k|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (260:9): [True: 1.87k, False: 44.6k]
  ------------------
  261|  1.87k|      main_ptr->pub.process_data = process_data_context_main;
  262|  1.87k|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  263|  1.87k|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  264|  1.87k|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   41|  1.87k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  265|  1.87k|      main_ptr->iMCU_row_ctr = 0;
  266|  44.6k|    } else {
  267|       |      /* Simple case with no context needed */
  268|  44.6k|      main_ptr->pub.process_data = process_data_simple_main;
  269|  44.6k|    }
  270|  46.5k|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  206|  46.5k|#define FALSE   0               /* values of boolean */
  ------------------
  271|  46.5k|    main_ptr->rowgroup_ctr = 0;
  272|  46.5k|    break;
  273|      0|#ifdef QUANT_2PASS_SUPPORTED
  274|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (274:3): [True: 0, False: 46.5k]
  ------------------
  275|       |    /* For last pass of 2-pass quantization, just crank the postprocessor */
  276|      0|    main_ptr->pub.process_data = process_data_crank_post;
  277|      0|    break;
  278|      0|#endif
  279|      0|  default:
  ------------------
  |  Branch (279:3): [True: 0, False: 46.5k]
  ------------------
  280|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  281|      0|    break;
  282|  46.5k|  }
  283|  46.5k|}
jdmainct.c:process_data_context_main:
  333|  5.88M|{
  334|  5.88M|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  335|       |
  336|       |  /* Read input data if we haven't filled the main buffer yet */
  337|  5.88M|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (337:7): [True: 369k, False: 5.51M]
  ------------------
  338|   369k|    if (!(*cinfo->coef->decompress_data) (cinfo,
  ------------------
  |  Branch (338:9): [True: 0, False: 369k]
  ------------------
  339|   369k|                                          main_ptr->xbuffer[main_ptr->whichptr]))
  340|      0|      return;                   /* suspension forced, can do nothing more */
  341|   369k|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  209|   369k|#define TRUE    1
  ------------------
  342|   369k|    main_ptr->iMCU_row_ctr++;   /* count rows received */
  343|   369k|  }
  344|       |
  345|       |  /* Postprocessor typically will not swallow all the input data it is handed
  346|       |   * in one call (due to filling the output buffer first).  Must be prepared
  347|       |   * to exit and restart.  This switch lets us keep track of how far we got.
  348|       |   * Note that each case falls through to the next on successful completion.
  349|       |   */
  350|  5.88M|  switch (main_ptr->context_state) {
  ------------------
  |  Branch (350:11): [True: 0, False: 5.88M]
  ------------------
  351|   734k|  case CTX_POSTPONED_ROW:
  ------------------
  |  |   43|   734k|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  |  Branch (351:3): [True: 734k, False: 5.15M]
  ------------------
  352|       |    /* Call postprocessor using previously set pointers for postponed row */
  353|   734k|    (*cinfo->post->post_process_data) (cinfo,
  354|   734k|                                       main_ptr->xbuffer[main_ptr->whichptr],
  355|   734k|                                       &main_ptr->rowgroup_ctr,
  356|   734k|                                       main_ptr->rowgroups_avail, output_buf,
  357|   734k|                                       out_row_ctr, out_rows_avail);
  358|   734k|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (358:9): [True: 367k, False: 367k]
  ------------------
  359|   367k|      return;                   /* Need to suspend */
  360|   367k|    main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   41|   367k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  361|   367k|    if (*out_row_ctr >= out_rows_avail)
  ------------------
  |  Branch (361:9): [True: 367k, False: 0]
  ------------------
  362|   367k|      return;                   /* Postprocessor exactly filled output buf */
  363|       |    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   38|      0|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  364|   369k|  case CTX_PREPARE_FOR_IMCU:
  ------------------
  |  |   41|   369k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  |  Branch (364:3): [True: 369k, False: 5.51M]
  ------------------
  365|       |    /* Prepare to process first M-1 row groups of this iMCU row */
  366|   369k|    main_ptr->rowgroup_ctr = 0;
  367|   369k|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size - 1);
  ------------------
  |  |   27|   369k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  368|       |    /* Check for bottom of image: if so, tweak pointers to "duplicate"
  369|       |     * the last sample row, and adjust rowgroups_avail to ignore padding rows.
  370|       |     */
  371|   369k|    if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows)
  ------------------
  |  Branch (371:9): [True: 1.87k, False: 367k]
  ------------------
  372|  1.87k|      set_bottom_pointers(cinfo);
  373|   369k|    main_ptr->context_state = CTX_PROCESS_IMCU;
  ------------------
  |  |   42|   369k|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  374|       |    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   38|   369k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  375|  5.15M|  case CTX_PROCESS_IMCU:
  ------------------
  |  |   42|  5.15M|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  |  Branch (375:3): [True: 4.78M, False: 1.10M]
  ------------------
  376|       |    /* Call postprocessor using previously set pointers */
  377|  5.15M|    (*cinfo->post->post_process_data) (cinfo,
  378|  5.15M|                                       main_ptr->xbuffer[main_ptr->whichptr],
  379|  5.15M|                                       &main_ptr->rowgroup_ctr,
  380|  5.15M|                                       main_ptr->rowgroups_avail, output_buf,
  381|  5.15M|                                       out_row_ctr, out_rows_avail);
  382|  5.15M|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (382:9): [True: 4.78M, False: 367k]
  ------------------
  383|  4.78M|      return;                   /* Need to suspend */
  384|       |    /* After the first iMCU, change wraparound pointers to normal state */
  385|   367k|    if (main_ptr->iMCU_row_ctr == 1)
  ------------------
  |  Branch (385:9): [True: 1.83k, False: 365k]
  ------------------
  386|  1.83k|      set_wraparound_pointers(cinfo);
  387|       |    /* Prepare to load new iMCU row using other xbuffer list */
  388|   367k|    main_ptr->whichptr ^= 1;    /* 0=>1 or 1=>0 */
  389|   367k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  206|   367k|#define FALSE   0               /* values of boolean */
  ------------------
  390|       |    /* Still need to process last row group of this iMCU row, */
  391|       |    /* which is saved at index M+1 of the other xbuffer */
  392|   367k|    main_ptr->rowgroup_ctr = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 1);
  ------------------
  |  |   27|   367k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  393|   367k|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 2);
  ------------------
  |  |   27|   367k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  394|   367k|    main_ptr->context_state = CTX_POSTPONED_ROW;
  ------------------
  |  |   43|   367k|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  395|  5.88M|  }
  396|  5.88M|}
jdmainct.c:set_bottom_pointers:
  218|  1.87k|{
  219|  1.87k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  220|  1.87k|  int ci, i, rgroup, iMCUheight, rows_left;
  221|  1.87k|  jpeg_component_info *compptr;
  222|  1.87k|  JSAMPARRAY xbuf;
  223|       |
  224|  7.51k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (224:44): [True: 5.63k, False: 1.87k]
  ------------------
  225|  5.63k|       ci++, compptr++) {
  226|       |    /* Count sample rows in one iMCU row and in one row group */
  227|  5.63k|    iMCUheight = compptr->v_samp_factor * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  5.63k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  228|  5.63k|    rgroup = iMCUheight / cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  5.63k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  229|       |    /* Count nondummy sample rows remaining for this component */
  230|  5.63k|    rows_left = (int)(compptr->downsampled_height % (JDIMENSION)iMCUheight);
  231|  5.63k|    if (rows_left == 0) rows_left = iMCUheight;
  ------------------
  |  Branch (231:9): [True: 1.26k, False: 4.37k]
  ------------------
  232|       |    /* Count nondummy row groups.  Should get same answer for each component,
  233|       |     * so we need only do it once.
  234|       |     */
  235|  5.63k|    if (ci == 0) {
  ------------------
  |  Branch (235:9): [True: 1.87k, False: 3.75k]
  ------------------
  236|  1.87k|      main_ptr->rowgroups_avail = (JDIMENSION)((rows_left - 1) / rgroup + 1);
  237|  1.87k|    }
  238|       |    /* Duplicate the last real sample row rgroup*2 times; this pads out the
  239|       |     * last partial rowgroup and ensures at least one full rowgroup of context.
  240|       |     */
  241|  5.63k|    xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci];
  242|  20.6k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (242:17): [True: 15.0k, False: 5.63k]
  ------------------
  243|  15.0k|      xbuf[rows_left + i] = xbuf[rows_left - 1];
  244|  15.0k|    }
  245|  5.63k|  }
  246|  1.87k|}
jdmainct.c:make_funny_pointers:
  177|  1.87k|{
  178|  1.87k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  179|  1.87k|  int ci, i, rgroup;
  180|  1.87k|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.87k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  181|  1.87k|  jpeg_component_info *compptr;
  182|  1.87k|  JSAMPARRAY buf, xbuf0, xbuf1;
  183|       |
  184|  7.51k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (184:44): [True: 5.63k, False: 1.87k]
  ------------------
  185|  5.63k|       ci++, compptr++) {
  186|  5.63k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  5.63k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  187|  5.63k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  5.63k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  188|  5.63k|    xbuf0 = main_ptr->xbuffer[0][ci];
  189|  5.63k|    xbuf1 = main_ptr->xbuffer[1][ci];
  190|       |    /* First copy the workspace pointers as-is */
  191|  5.63k|    buf = main_ptr->buffer[ci];
  192|  80.7k|    for (i = 0; i < rgroup * (M + 2); i++) {
  ------------------
  |  Branch (192:17): [True: 75.1k, False: 5.63k]
  ------------------
  193|  75.1k|      xbuf0[i] = xbuf1[i] = buf[i];
  194|  75.1k|    }
  195|       |    /* In the second list, put the last four row groups in swapped order */
  196|  20.6k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (196:17): [True: 15.0k, False: 5.63k]
  ------------------
  197|  15.0k|      xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i];
  198|  15.0k|      xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i];
  199|  15.0k|    }
  200|       |    /* The wraparound pointers at top and bottom will be filled later
  201|       |     * (see set_wraparound_pointers, below).  Initially we want the "above"
  202|       |     * pointers to duplicate the first actual data line.  This only needs
  203|       |     * to happen in xbuffer[0].
  204|       |     */
  205|  13.1k|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (205:17): [True: 7.51k, False: 5.63k]
  ------------------
  206|  7.51k|      xbuf0[i - rgroup] = xbuf0[0];
  207|  7.51k|    }
  208|  5.63k|  }
  209|  1.87k|}
jdmainct.c:process_data_simple_main:
  294|  38.5M|{
  295|  38.5M|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  296|  38.5M|  JDIMENSION rowgroups_avail;
  297|       |
  298|       |  /* Read input data if we haven't filled the main buffer yet */
  299|  38.5M|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (299:7): [True: 4.72M, False: 33.8M]
  ------------------
  300|  4.72M|    if (!(*cinfo->coef->decompress_data) (cinfo, main_ptr->buffer))
  ------------------
  |  Branch (300:9): [True: 0, False: 4.72M]
  ------------------
  301|      0|      return;                   /* suspension forced, can do nothing more */
  302|  4.72M|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  209|  4.72M|#define TRUE    1
  ------------------
  303|  4.72M|  }
  304|       |
  305|       |  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
  306|  38.5M|  rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  38.5M|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  307|       |  /* Note: at the bottom of the image, we may pass extra garbage row groups
  308|       |   * to the postprocessor.  The postprocessor has to check for bottom
  309|       |   * of image anyway (at row resolution), so no point in us doing it too.
  310|       |   */
  311|       |
  312|       |  /* Feed the postprocessor */
  313|  38.5M|  (*cinfo->post->post_process_data) (cinfo, main_ptr->buffer,
  314|  38.5M|                                     &main_ptr->rowgroup_ctr, rowgroups_avail,
  315|  38.5M|                                     output_buf, out_row_ctr, out_rows_avail);
  316|       |
  317|       |  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
  318|  38.5M|  if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
  ------------------
  |  Branch (318:7): [True: 4.68M, False: 33.9M]
  ------------------
  319|  4.68M|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  206|  4.68M|#define FALSE   0               /* values of boolean */
  ------------------
  320|  4.68M|    main_ptr->rowgroup_ctr = 0;
  321|  4.68M|  }
  322|  38.5M|}
jdmainct.c:alloc_funny_pointers:
  136|  2.21k|{
  137|  2.21k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  138|  2.21k|  int ci, rgroup;
  139|  2.21k|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  2.21k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  140|  2.21k|  jpeg_component_info *compptr;
  141|  2.21k|  JSAMPARRAY xbuf;
  142|       |
  143|       |  /* Get top-level space for component array pointers.
  144|       |   * We alloc both arrays with one call to save a few cycles.
  145|       |   */
  146|  2.21k|  main_ptr->xbuffer[0] = (JSAMPIMAGE)
  147|  2.21k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  2.21k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  148|  2.21k|                                cinfo->num_components * 2 * sizeof(JSAMPARRAY));
  149|  2.21k|  main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
  150|       |
  151|  8.87k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (151:44): [True: 6.65k, False: 2.21k]
  ------------------
  152|  6.65k|       ci++, compptr++) {
  153|  6.65k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  6.65k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|  6.65k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  6.65k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  155|       |    /* Get space for pointer lists --- M+4 row groups in each list.
  156|       |     * We alloc both pointer lists with one call to save a few cycles.
  157|       |     */
  158|  6.65k|    xbuf = (JSAMPARRAY)
  159|  6.65k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  6.65k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  160|  6.65k|                                  2 * (rgroup * (M + 4)) * sizeof(JSAMPROW));
  161|  6.65k|    xbuf += rgroup;             /* want one row group at negative offsets */
  162|  6.65k|    main_ptr->xbuffer[0][ci] = xbuf;
  163|  6.65k|    xbuf += rgroup * (M + 4);
  164|  6.65k|    main_ptr->xbuffer[1][ci] = xbuf;
  165|  6.65k|  }
  166|  2.21k|}

jdmainct.c:set_wraparound_pointers:
   51|  1.83k|{
   52|  1.83k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
   53|  1.83k|  int ci, i, rgroup;
   54|  1.83k|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.83k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
   55|  1.83k|  jpeg_component_info *compptr;
   56|  1.83k|  JSAMPARRAY xbuf0, xbuf1;
   57|       |
   58|  7.33k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (58:44): [True: 5.49k, False: 1.83k]
  ------------------
   59|  5.49k|       ci++, compptr++) {
   60|  5.49k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  5.49k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
   61|  5.49k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  5.49k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
   62|  5.49k|    xbuf0 = main_ptr->xbuffer[0][ci];
   63|  5.49k|    xbuf1 = main_ptr->xbuffer[1][ci];
   64|  12.8k|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (64:17): [True: 7.33k, False: 5.49k]
  ------------------
   65|  7.33k|      xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i];
   66|  7.33k|      xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i];
   67|  7.33k|      xbuf0[rgroup * (M + 2) + i] = xbuf0[i];
   68|  7.33k|      xbuf1[rgroup * (M + 2) + i] = xbuf1[i];
   69|  7.33k|    }
   70|  5.49k|  }
   71|  1.83k|}

jpeg_resync_to_restart:
 1207|   253k|{
 1208|   253k|  int marker = cinfo->unread_marker;
 1209|   253k|  int action = 1;
 1210|       |
 1211|       |  /* Always put up a warning. */
 1212|   253k|  WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
  ------------------
  |  |  285|   253k|  ((cinfo)->err->msg_code = (code), \
  |  |  286|   253k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  287|   253k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  288|   253k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
 1213|       |
 1214|       |  /* Outer loop handles repeated decision after scanning forward. */
 1215|   260k|  for (;;) {
 1216|   260k|    if (marker < (int)M_SOF0)
  ------------------
  |  Branch (1216:9): [True: 5.28k, False: 254k]
  ------------------
 1217|  5.28k|      action = 2;               /* invalid marker */
 1218|   254k|    else if (marker < (int)M_RST0 || marker > (int)M_RST7)
  ------------------
  |  Branch (1218:14): [True: 5.19k, False: 249k]
  |  Branch (1218:38): [True: 243k, False: 6.52k]
  ------------------
 1219|   248k|      action = 3;               /* valid non-restart marker */
 1220|  6.52k|    else {
 1221|  6.52k|      if (marker == ((int)M_RST0 + ((desired + 1) & 7)) ||
  ------------------
  |  Branch (1221:11): [True: 1.71k, False: 4.81k]
  ------------------
 1222|  6.52k|          marker == ((int)M_RST0 + ((desired + 2) & 7)))
  ------------------
  |  Branch (1222:11): [True: 1.39k, False: 3.42k]
  ------------------
 1223|  3.10k|        action = 3;             /* one of the next two expected restarts */
 1224|  3.42k|      else if (marker == ((int)M_RST0 + ((desired - 1) & 7)) ||
  ------------------
  |  Branch (1224:16): [True: 1.00k, False: 2.41k]
  ------------------
 1225|  3.42k|               marker == ((int)M_RST0 + ((desired - 2) & 7)))
  ------------------
  |  Branch (1225:16): [True: 243, False: 2.17k]
  ------------------
 1226|  1.24k|        action = 2;             /* a prior restart, so advance */
 1227|  2.17k|      else
 1228|  2.17k|        action = 1;             /* desired restart or too far away */
 1229|  6.52k|    }
 1230|   260k|    TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
  ------------------
  |  |  299|   260k|  ((cinfo)->err->msg_code = (code), \
  |  |  300|   260k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  301|   260k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  302|   260k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1231|   260k|    switch (action) {
  ------------------
  |  Branch (1231:13): [True: 0, False: 260k]
  ------------------
 1232|  2.17k|    case 1:
  ------------------
  |  Branch (1232:5): [True: 2.17k, False: 258k]
  ------------------
 1233|       |      /* Discard marker and let entropy decoder resume processing. */
 1234|  2.17k|      cinfo->unread_marker = 0;
 1235|  2.17k|      return TRUE;
  ------------------
  |  |  209|  2.17k|#define TRUE    1
  ------------------
 1236|  6.53k|    case 2:
  ------------------
  |  Branch (1236:5): [True: 6.53k, False: 253k]
  ------------------
 1237|       |      /* Scan to the next marker, and repeat the decision loop. */
 1238|  6.53k|      if (!next_marker(cinfo))
  ------------------
  |  Branch (1238:11): [True: 0, False: 6.53k]
  ------------------
 1239|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1240|  6.53k|      marker = cinfo->unread_marker;
 1241|  6.53k|      break;
 1242|   251k|    case 3:
  ------------------
  |  Branch (1242:5): [True: 251k, False: 8.71k]
  ------------------
 1243|       |      /* Return without advancing past this marker. */
 1244|       |      /* Entropy decoder will be forced to process an empty segment. */
 1245|   251k|      return TRUE;
  ------------------
  |  |  209|   251k|#define TRUE    1
  ------------------
 1246|   260k|    }
 1247|   260k|  } /* end loop */
 1248|   253k|}
jinit_marker_reader:
 1277|  18.1k|{
 1278|  18.1k|  my_marker_ptr marker;
 1279|  18.1k|  int i;
 1280|       |
 1281|       |  /* Create subobject in permanent pool */
 1282|  18.1k|  marker = (my_marker_ptr)
 1283|  18.1k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  825|  18.1k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
 1284|  18.1k|                                sizeof(my_marker_reader));
 1285|  18.1k|  cinfo->marker = (struct jpeg_marker_reader *)marker;
 1286|       |  /* Initialize public method pointers */
 1287|  18.1k|  marker->pub.reset_marker_reader = reset_marker_reader;
 1288|  18.1k|  marker->pub.read_markers = read_markers;
 1289|  18.1k|  marker->pub.read_restart_marker = read_restart_marker;
 1290|       |  /* Initialize COM/APPn processing.
 1291|       |   * By default, we examine and then discard APP0 and APP14,
 1292|       |   * but simply discard COM and all other APPn.
 1293|       |   */
 1294|  18.1k|  marker->process_COM = skip_variable;
 1295|  18.1k|  marker->length_limit_COM = 0;
 1296|   309k|  for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (1296:15): [True: 290k, False: 18.1k]
  ------------------
 1297|   290k|    marker->process_APPn[i] = skip_variable;
 1298|   290k|    marker->length_limit_APPn[i] = 0;
 1299|   290k|  }
 1300|  18.1k|  marker->process_APPn[0] = get_interesting_appn;
 1301|  18.1k|  marker->process_APPn[14] = get_interesting_appn;
 1302|       |  /* Reset marker processing state */
 1303|  18.1k|  reset_marker_reader(cinfo);
 1304|  18.1k|}
jdmarker.c:next_marker:
  889|   395k|{
  890|   395k|  int c;
  891|   395k|  INPUT_VARS(cinfo);
  ------------------
  |  |  123|   395k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  124|   395k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  125|   395k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  892|       |
  893|   453k|  for (;;) {
  894|   453k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  152|   453k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|   796k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 114k]
  |  |  |  |  |  Branch (274:38): [True: 114k, False: 338k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|   453k|            bytes_in_buffer--; \
  |  |  154|   453k|            V = *next_input_byte++; )
  ------------------
  895|       |    /* Skip any non-FF bytes.
  896|       |     * This may look a bit inefficient, but it will not occur in a valid file.
  897|       |     * We sync after each discarded byte so that a suspending data source
  898|       |     * can discard the byte from its buffer.
  899|       |     */
  900|  4.34M|    while (c != 0xFF) {
  ------------------
  |  Branch (900:12): [True: 3.88M, False: 453k]
  ------------------
  901|  3.88M|      cinfo->marker->discarded_bytes++;
  902|  3.88M|      INPUT_SYNC(cinfo);
  ------------------
  |  |  129|  3.88M|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|  3.88M|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  903|  3.88M|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  152|  3.88M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  3.91M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 10.0k]
  |  |  |  |  |  Branch (274:38): [True: 10.0k, False: 3.87M]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  3.88M|            bytes_in_buffer--; \
  |  |  154|  3.88M|            V = *next_input_byte++; )
  ------------------
  904|  3.88M|    }
  905|       |    /* This loop swallows any duplicate FF bytes.  Extra FFs are legal as
  906|       |     * pad bytes, so don't count them in discarded_bytes.  We assume there
  907|       |     * will not be so many consecutive FF bytes as to overflow a suspending
  908|       |     * data source's input buffer.
  909|       |     */
  910|  1.84M|    do {
  911|  1.84M|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  152|  1.84M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  1.85M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 2.49k]
  |  |  |  |  |  Branch (274:38): [True: 2.49k, False: 1.84M]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  1.84M|            bytes_in_buffer--; \
  |  |  154|  1.84M|            V = *next_input_byte++; )
  ------------------
  912|  1.84M|    } while (c == 0xFF);
  ------------------
  |  Branch (912:14): [True: 1.39M, False: 453k]
  ------------------
  913|   453k|    if (c != 0)
  ------------------
  |  Branch (913:9): [True: 395k, False: 58.2k]
  ------------------
  914|   395k|      break;                    /* found a valid marker, exit loop */
  915|       |    /* Reach here if we found a stuffed-zero data sequence (FF/00).
  916|       |     * Discard it and loop back to try again.
  917|       |     */
  918|  58.2k|    cinfo->marker->discarded_bytes += 2;
  919|  58.2k|    INPUT_SYNC(cinfo);
  ------------------
  |  |  129|  58.2k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|  58.2k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  920|  58.2k|  }
  921|       |
  922|   395k|  if (cinfo->marker->discarded_bytes != 0) {
  ------------------
  |  Branch (922:7): [True: 209k, False: 185k]
  ------------------
  923|   209k|    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
  ------------------
  |  |  285|   209k|  ((cinfo)->err->msg_code = (code), \
  |  |  286|   209k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  287|   209k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  288|   209k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  924|   209k|    cinfo->marker->discarded_bytes = 0;
  925|   209k|  }
  926|       |
  927|   395k|  cinfo->unread_marker = c;
  928|       |
  929|   395k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  129|   395k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|   395k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  930|   395k|  return TRUE;
  ------------------
  |  |  209|   395k|#define TRUE    1
  ------------------
  931|   395k|}
jdmarker.c:reset_marker_reader:
 1257|   180k|{
 1258|   180k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1259|       |
 1260|   180k|  cinfo->comp_info = NULL;              /* until allocated by get_sof */
 1261|   180k|  cinfo->input_scan_number = 0;         /* no SOS seen yet */
 1262|   180k|  cinfo->unread_marker = 0;             /* no pending marker */
 1263|   180k|  marker->pub.saw_SOI = FALSE;          /* set internal state too */
  ------------------
  |  |  206|   180k|#define FALSE   0               /* values of boolean */
  ------------------
 1264|   180k|  marker->pub.saw_SOF = FALSE;
  ------------------
  |  |  206|   180k|#define FALSE   0               /* values of boolean */
  ------------------
 1265|   180k|  marker->pub.discarded_bytes = 0;
 1266|   180k|  marker->cur_marker = NULL;
 1267|   180k|}
jdmarker.c:read_markers:
  967|   208k|{
  968|       |  /* Outer loop repeats once for each marker. */
  969|   584k|  for (;;) {
  970|       |    /* Collect the marker proper, unless we already did. */
  971|       |    /* NB: first_marker() enforces the requirement that SOI appear first. */
  972|   584k|    if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (972:9): [True: 545k, False: 39.1k]
  ------------------
  973|   545k|      if (!cinfo->marker->saw_SOI) {
  ------------------
  |  Branch (973:11): [True: 162k, False: 382k]
  ------------------
  974|   162k|        if (!first_marker(cinfo))
  ------------------
  |  Branch (974:13): [True: 0, False: 162k]
  ------------------
  975|      0|          return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  976|   382k|      } else {
  977|   382k|        if (!next_marker(cinfo))
  ------------------
  |  Branch (977:13): [True: 0, False: 382k]
  ------------------
  978|      0|          return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  979|   382k|      }
  980|   545k|    }
  981|       |    /* At this point cinfo->unread_marker contains the marker code and the
  982|       |     * input point is just past the marker proper, but before any parameters.
  983|       |     * A suspension will cause us to return with this state still true.
  984|       |     */
  985|   584k|    switch (cinfo->unread_marker) {
  986|  80.5k|    case M_SOI:
  ------------------
  |  Branch (986:5): [True: 80.5k, False: 503k]
  ------------------
  987|  80.5k|      if (!get_soi(cinfo))
  ------------------
  |  Branch (987:11): [True: 0, False: 80.5k]
  ------------------
  988|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  989|  80.5k|      break;
  990|       |
  991|  80.5k|    case M_SOF0:                /* Baseline */
  ------------------
  |  Branch (991:5): [True: 21.7k, False: 562k]
  ------------------
  992|  31.8k|    case M_SOF1:                /* Extended sequential, Huffman */
  ------------------
  |  Branch (992:5): [True: 10.1k, False: 574k]
  ------------------
  993|  31.8k|      if (!get_sof(cinfo, FALSE, FALSE))
  ------------------
  |  |  206|  31.8k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE))
  ------------------
  |  |  206|  31.8k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (993:11): [True: 0, False: 31.8k]
  ------------------
  994|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  995|  31.8k|      break;
  996|       |
  997|  31.8k|    case M_SOF2:                /* Progressive, Huffman */
  ------------------
  |  Branch (997:5): [True: 10.1k, False: 574k]
  ------------------
  998|  10.1k|      if (!get_sof(cinfo, TRUE, FALSE))
  ------------------
  |  |  209|  10.1k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE))
  ------------------
  |  |  206|  10.1k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (998:11): [True: 0, False: 10.1k]
  ------------------
  999|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1000|  10.1k|      break;
 1001|       |
 1002|  12.6k|    case M_SOF9:                /* Extended sequential, arithmetic */
  ------------------
  |  Branch (1002:5): [True: 12.6k, False: 571k]
  ------------------
 1003|  12.6k|      if (!get_sof(cinfo, FALSE, TRUE))
  ------------------
  |  |  206|  12.6k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE))
  ------------------
  |  |  209|  12.6k|#define TRUE    1
  ------------------
  |  Branch (1003:11): [True: 0, False: 12.6k]
  ------------------
 1004|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1005|  12.6k|      break;
 1006|       |
 1007|  12.6k|    case M_SOF10:               /* Progressive, arithmetic */
  ------------------
  |  Branch (1007:5): [True: 11.8k, False: 572k]
  ------------------
 1008|  11.8k|      if (!get_sof(cinfo, TRUE, TRUE))
  ------------------
  |  |  209|  11.8k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, TRUE))
  ------------------
  |  |  209|  11.8k|#define TRUE    1
  ------------------
  |  Branch (1008:11): [True: 0, False: 11.8k]
  ------------------
 1009|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1010|  11.8k|      break;
 1011|       |
 1012|       |    /* Currently unsupported SOFn types */
 1013|  11.8k|    case M_SOF3:                /* Lossless, Huffman */
  ------------------
  |  Branch (1013:5): [True: 228, False: 584k]
  ------------------
 1014|    472|    case M_SOF5:                /* Differential sequential, Huffman */
  ------------------
  |  Branch (1014:5): [True: 244, False: 584k]
  ------------------
 1015|    684|    case M_SOF6:                /* Differential progressive, Huffman */
  ------------------
  |  Branch (1015:5): [True: 212, False: 584k]
  ------------------
 1016|  1.03k|    case M_SOF7:                /* Differential lossless, Huffman */
  ------------------
  |  Branch (1016:5): [True: 348, False: 584k]
  ------------------
 1017|  1.34k|    case M_JPG:                 /* Reserved for JPEG extensions */
  ------------------
  |  Branch (1017:5): [True: 314, False: 584k]
  ------------------
 1018|  1.54k|    case M_SOF11:               /* Lossless, arithmetic */
  ------------------
  |  Branch (1018:5): [True: 200, False: 584k]
  ------------------
 1019|  1.77k|    case M_SOF13:               /* Differential sequential, arithmetic */
  ------------------
  |  Branch (1019:5): [True: 229, False: 584k]
  ------------------
 1020|  2.07k|    case M_SOF14:               /* Differential progressive, arithmetic */
  ------------------
  |  Branch (1020:5): [True: 298, False: 584k]
  ------------------
 1021|  2.28k|    case M_SOF15:               /* Differential lossless, arithmetic */
  ------------------
  |  Branch (1021:5): [True: 209, False: 584k]
  ------------------
 1022|  2.28k|      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
  ------------------
  |  |  238|  2.28k|  ((cinfo)->err->msg_code = (code), \
  |  |  239|  2.28k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|  2.28k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1023|  2.28k|      break;
 1024|       |
 1025|  73.2k|    case M_SOS:
  ------------------
  |  Branch (1025:5): [True: 73.2k, False: 511k]
  ------------------
 1026|  73.2k|      if (!get_sos(cinfo))
  ------------------
  |  Branch (1026:11): [True: 0, False: 73.2k]
  ------------------
 1027|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1028|  73.2k|      cinfo->unread_marker = 0; /* processed the marker */
 1029|  73.2k|      return JPEG_REACHED_SOS;
  ------------------
  |  | 1020|  73.2k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
 1030|       |
 1031|  35.2k|    case M_EOI:
  ------------------
  |  Branch (1031:5): [True: 35.2k, False: 549k]
  ------------------
 1032|  35.2k|      TRACEMS(cinfo, 1, JTRC_EOI);
  ------------------
  |  |  292|  35.2k|  ((cinfo)->err->msg_code = (code), \
  |  |  293|  35.2k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1033|  35.2k|      cinfo->unread_marker = 0; /* processed the marker */
 1034|  35.2k|      return JPEG_REACHED_EOI;
  ------------------
  |  | 1021|  35.2k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
 1035|       |
 1036|  1.87k|    case M_DAC:
  ------------------
  |  Branch (1036:5): [True: 1.87k, False: 582k]
  ------------------
 1037|  1.87k|      if (!get_dac(cinfo))
  ------------------
  |  Branch (1037:11): [True: 0, False: 1.87k]
  ------------------
 1038|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1039|  1.87k|      break;
 1040|       |
 1041|  63.0k|    case M_DHT:
  ------------------
  |  Branch (1041:5): [True: 63.0k, False: 521k]
  ------------------
 1042|  63.0k|      if (!get_dht(cinfo))
  ------------------
  |  Branch (1042:11): [True: 0, False: 63.0k]
  ------------------
 1043|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1044|  63.0k|      break;
 1045|       |
 1046|  77.3k|    case M_DQT:
  ------------------
  |  Branch (1046:5): [True: 77.3k, False: 506k]
  ------------------
 1047|  77.3k|      if (!get_dqt(cinfo))
  ------------------
  |  Branch (1047:11): [True: 0, False: 77.3k]
  ------------------
 1048|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1049|  77.3k|      break;
 1050|       |
 1051|  77.3k|    case M_DRI:
  ------------------
  |  Branch (1051:5): [True: 7.70k, False: 576k]
  ------------------
 1052|  7.70k|      if (!get_dri(cinfo))
  ------------------
  |  Branch (1052:11): [True: 0, False: 7.70k]
  ------------------
 1053|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1054|  7.70k|      break;
 1055|       |
 1056|  33.5k|    case M_APP0:
  ------------------
  |  Branch (1056:5): [True: 33.5k, False: 550k]
  ------------------
 1057|  37.1k|    case M_APP1:
  ------------------
  |  Branch (1057:5): [True: 3.57k, False: 580k]
  ------------------
 1058|  38.9k|    case M_APP2:
  ------------------
  |  Branch (1058:5): [True: 1.83k, False: 582k]
  ------------------
 1059|  45.7k|    case M_APP3:
  ------------------
  |  Branch (1059:5): [True: 6.75k, False: 577k]
  ------------------
 1060|  47.1k|    case M_APP4:
  ------------------
  |  Branch (1060:5): [True: 1.37k, False: 582k]
  ------------------
 1061|  47.7k|    case M_APP5:
  ------------------
  |  Branch (1061:5): [True: 607, False: 583k]
  ------------------
 1062|  54.9k|    case M_APP6:
  ------------------
  |  Branch (1062:5): [True: 7.25k, False: 577k]
  ------------------
 1063|  55.2k|    case M_APP7:
  ------------------
  |  Branch (1063:5): [True: 247, False: 584k]
  ------------------
 1064|  56.2k|    case M_APP8:
  ------------------
  |  Branch (1064:5): [True: 1.02k, False: 583k]
  ------------------
 1065|  56.8k|    case M_APP9:
  ------------------
  |  Branch (1065:5): [True: 559, False: 583k]
  ------------------
 1066|  57.3k|    case M_APP10:
  ------------------
  |  Branch (1066:5): [True: 501, False: 583k]
  ------------------
 1067|  57.6k|    case M_APP11:
  ------------------
  |  Branch (1067:5): [True: 346, False: 584k]
  ------------------
 1068|  59.9k|    case M_APP12:
  ------------------
  |  Branch (1068:5): [True: 2.30k, False: 582k]
  ------------------
 1069|  60.1k|    case M_APP13:
  ------------------
  |  Branch (1069:5): [True: 239, False: 584k]
  ------------------
 1070|  65.8k|    case M_APP14:
  ------------------
  |  Branch (1070:5): [True: 5.67k, False: 578k]
  ------------------
 1071|  66.9k|    case M_APP15:
  ------------------
  |  Branch (1071:5): [True: 1.05k, False: 583k]
  ------------------
 1072|  66.9k|      if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
  ------------------
  |  Branch (1072:11): [True: 0, False: 66.9k]
  ------------------
 1073|  66.9k|               cinfo->unread_marker - (int)M_APP0]) (cinfo))
 1074|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1075|  66.9k|      break;
 1076|       |
 1077|  66.9k|    case M_COM:
  ------------------
  |  Branch (1077:5): [True: 2.32k, False: 582k]
  ------------------
 1078|  2.32k|      if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
  ------------------
  |  Branch (1078:11): [True: 0, False: 2.32k]
  ------------------
 1079|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1080|  2.32k|      break;
 1081|       |
 1082|  2.64k|    case M_RST0:                /* these are all parameterless */
  ------------------
  |  Branch (1082:5): [True: 2.64k, False: 581k]
  ------------------
 1083|  2.98k|    case M_RST1:
  ------------------
  |  Branch (1083:5): [True: 335, False: 584k]
  ------------------
 1084|  4.86k|    case M_RST2:
  ------------------
  |  Branch (1084:5): [True: 1.88k, False: 582k]
  ------------------
 1085|  5.12k|    case M_RST3:
  ------------------
  |  Branch (1085:5): [True: 258, False: 584k]
  ------------------
 1086|  6.92k|    case M_RST4:
  ------------------
  |  Branch (1086:5): [True: 1.80k, False: 582k]
  ------------------
 1087|  8.30k|    case M_RST5:
  ------------------
  |  Branch (1087:5): [True: 1.38k, False: 582k]
  ------------------
 1088|  8.58k|    case M_RST6:
  ------------------
  |  Branch (1088:5): [True: 282, False: 584k]
  ------------------
 1089|  9.21k|    case M_RST7:
  ------------------
  |  Branch (1089:5): [True: 624, False: 583k]
  ------------------
 1090|  19.3k|    case M_TEM:
  ------------------
  |  Branch (1090:5): [True: 10.1k, False: 574k]
  ------------------
 1091|  19.3k|      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
  ------------------
  |  |  295|  19.3k|  ((cinfo)->err->msg_code = (code), \
  |  |  296|  19.3k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  297|  19.3k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1092|  19.3k|      break;
 1093|       |
 1094|  1.86k|    case M_DNL:                 /* Ignore DNL ... perhaps the wrong thing */
  ------------------
  |  Branch (1094:5): [True: 1.86k, False: 582k]
  ------------------
 1095|  1.86k|      if (!skip_variable(cinfo))
  ------------------
  |  Branch (1095:11): [True: 0, False: 1.86k]
  ------------------
 1096|      0|        return JPEG_SUSPENDED;
  ------------------
  |  |  987|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1097|  1.86k|      break;
 1098|       |
 1099|  3.58k|    default:                    /* must be DHP, EXP, JPGn, or RESn */
  ------------------
  |  Branch (1099:5): [True: 3.58k, False: 580k]
  ------------------
 1100|       |      /* For now, we treat the reserved markers as fatal errors since they are
 1101|       |       * likely to be used to signal incompatible JPEG Part 3 extensions.
 1102|       |       * Once the JPEG 3 version-number marker is well defined, this code
 1103|       |       * ought to change!
 1104|       |       */
 1105|  3.58k|      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  238|  3.58k|  ((cinfo)->err->msg_code = (code), \
  |  |  239|  3.58k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|  3.58k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1106|  3.58k|      break;
 1107|   584k|    }
 1108|       |    /* Successfully processed marker, so reset state variable */
 1109|   376k|    cinfo->unread_marker = 0;
 1110|   376k|  } /* end loop */
 1111|   208k|}
jdmarker.c:first_marker:
  942|   162k|{
  943|   162k|  int c, c2;
  944|   162k|  INPUT_VARS(cinfo);
  ------------------
  |  |  123|   162k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  124|   162k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  125|   162k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  945|       |
  946|   162k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  152|   162k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|   205k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 14.3k]
  |  |  |  |  |  Branch (274:38): [True: 14.3k, False: 148k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|   162k|            bytes_in_buffer--; \
  |  |  154|   162k|            V = *next_input_byte++; )
  ------------------
  947|   162k|  INPUT_BYTE(cinfo, c2, return FALSE);
  ------------------
  |  |  152|   162k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|   198k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 12.0k]
  |  |  |  |  |  Branch (274:38): [True: 12.0k, False: 150k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|   162k|            bytes_in_buffer--; \
  |  |  154|   162k|            V = *next_input_byte++; )
  ------------------
  948|   162k|  if (c != 0xFF || c2 != (int)M_SOI)
  ------------------
  |  Branch (948:7): [True: 76.2k, False: 86.3k]
  |  Branch (948:20): [True: 6.22k, False: 80.1k]
  ------------------
  949|  82.5k|    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
  ------------------
  |  |  242|  82.5k|  ((cinfo)->err->msg_code = (code), \
  |  |  243|  82.5k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  244|  82.5k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  245|  82.5k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  950|       |
  951|   162k|  cinfo->unread_marker = c2;
  952|       |
  953|   162k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  129|   162k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|   162k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  954|   162k|  return TRUE;
  ------------------
  |  |  209|   162k|#define TRUE    1
  ------------------
  955|   162k|}
jdmarker.c:get_soi:
  202|  80.5k|{
  203|  80.5k|  int i;
  204|       |
  205|  80.5k|  TRACEMS(cinfo, 1, JTRC_SOI);
  ------------------
  |  |  292|  80.5k|  ((cinfo)->err->msg_code = (code), \
  |  |  293|  80.5k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  206|       |
  207|  80.5k|  if (cinfo->marker->saw_SOI)
  ------------------
  |  Branch (207:7): [True: 390, False: 80.1k]
  ------------------
  208|    390|    ERREXIT(cinfo, JERR_SOI_DUPLICATE);
  ------------------
  |  |  235|    390|  ((cinfo)->err->msg_code = (code), \
  |  |  236|    390|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  209|       |
  210|       |  /* Reset all parameters that are defined to be reset by SOI */
  211|       |
  212|  1.36M|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   50|  1.36M|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (212:15): [True: 1.28M, False: 80.5k]
  ------------------
  213|  1.28M|    cinfo->arith_dc_L[i] = 0;
  214|  1.28M|    cinfo->arith_dc_U[i] = 1;
  215|  1.28M|    cinfo->arith_ac_K[i] = 5;
  216|  1.28M|  }
  217|  80.5k|  cinfo->restart_interval = 0;
  218|       |
  219|       |  /* Set initial assumptions for colorspace etc */
  220|       |
  221|  80.5k|  cinfo->jpeg_color_space = JCS_UNKNOWN;
  222|  80.5k|  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
  ------------------
  |  |  206|  80.5k|#define FALSE   0               /* values of boolean */
  ------------------
  223|       |
  224|  80.5k|  cinfo->saw_JFIF_marker = FALSE;
  ------------------
  |  |  206|  80.5k|#define FALSE   0               /* values of boolean */
  ------------------
  225|  80.5k|  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
  226|  80.5k|  cinfo->JFIF_minor_version = 1;
  227|  80.5k|  cinfo->density_unit = 0;
  228|  80.5k|  cinfo->X_density = 1;
  229|  80.5k|  cinfo->Y_density = 1;
  230|  80.5k|  cinfo->saw_Adobe_marker = FALSE;
  ------------------
  |  |  206|  80.5k|#define FALSE   0               /* values of boolean */
  ------------------
  231|  80.5k|  cinfo->Adobe_transform = 0;
  232|       |
  233|  80.5k|  cinfo->marker->saw_SOI = TRUE;
  ------------------
  |  |  209|  80.5k|#define TRUE    1
  ------------------
  234|       |
  235|  80.5k|  return TRUE;
  ------------------
  |  |  209|  80.5k|#define TRUE    1
  ------------------
  236|  80.5k|}
jdmarker.c:get_sof:
  242|  66.5k|{
  243|  66.5k|  JLONG length;
  244|  66.5k|  int c, ci;
  245|  66.5k|  jpeg_component_info *compptr;
  246|  66.5k|  INPUT_VARS(cinfo);
  ------------------
  |  |  123|  66.5k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  124|  66.5k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  125|  66.5k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  247|       |
  248|  66.5k|  cinfo->progressive_mode = is_prog;
  249|  66.5k|  cinfo->arith_code = is_arith;
  250|       |
  251|  66.5k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  160|  66.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|   134k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 327]
  |  |  |  |  |  Branch (274:38): [True: 327, False: 66.2k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 289]
  |  |  |  |  |  Branch (274:38): [True: 289, False: 66.2k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  66.5k|            bytes_in_buffer--; \
  |  |  162|  66.5k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  66.5k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  66.5k|            bytes_in_buffer--; \
  |  |  165|  66.5k|            V += *next_input_byte++; )
  ------------------
  252|       |
  253|  66.5k|  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  ------------------
  |  |  152|  66.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  68.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 532]
  |  |  |  |  |  Branch (274:38): [True: 532, False: 66.0k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  66.5k|            bytes_in_buffer--; \
  |  |  154|  66.5k|            V = *next_input_byte++; )
  ------------------
  254|  66.5k|  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  ------------------
  |  |  160|  66.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|   137k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 720]
  |  |  |  |  |  Branch (274:38): [True: 720, False: 65.8k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 596]
  |  |  |  |  |  Branch (274:38): [True: 596, False: 65.9k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  66.5k|            bytes_in_buffer--; \
  |  |  162|  66.5k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  66.5k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  66.5k|            bytes_in_buffer--; \
  |  |  165|  66.5k|            V += *next_input_byte++; )
  ------------------
  255|  66.5k|  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  ------------------
  |  |  160|  66.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|   137k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 775]
  |  |  |  |  |  Branch (274:38): [True: 775, False: 65.7k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 622]
  |  |  |  |  |  Branch (274:38): [True: 622, False: 65.9k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  66.5k|            bytes_in_buffer--; \
  |  |  162|  66.5k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  66.5k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  66.5k|            bytes_in_buffer--; \
  |  |  165|  66.5k|            V += *next_input_byte++; )
  ------------------
  256|  66.5k|  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
  ------------------
  |  |  152|  66.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  69.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 852]
  |  |  |  |  |  Branch (274:38): [True: 852, False: 65.6k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  66.5k|            bytes_in_buffer--; \
  |  |  154|  66.5k|            V = *next_input_byte++; )
  ------------------
  257|       |
  258|  66.5k|  length -= 8;
  259|       |
  260|  66.5k|  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
  ------------------
  |  |  309|  66.5k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  274|  66.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  66.5k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  311|  66.5k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  66.5k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  261|  66.5k|           (int)cinfo->image_width, (int)cinfo->image_height,
  262|  66.5k|           cinfo->num_components);
  263|       |
  264|  66.5k|  if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (264:7): [True: 1.47k, False: 65.0k]
  ------------------
  265|  1.47k|    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
  ------------------
  |  |  235|  1.47k|  ((cinfo)->err->msg_code = (code), \
  |  |  236|  1.47k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  266|       |
  267|       |  /* We don't support files in which the image height is initially specified */
  268|       |  /* as 0 and is later redefined by DNL.  As long as we have to check that,  */
  269|       |  /* might as well have a general sanity check. */
  270|  66.5k|  if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
  ------------------
  |  Branch (270:7): [True: 1.69k, False: 64.8k]
  |  Branch (270:35): [True: 286, False: 64.5k]
  ------------------
  271|  66.5k|      cinfo->num_components <= 0)
  ------------------
  |  Branch (271:7): [True: 288, False: 64.2k]
  ------------------
  272|    800|    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
  ------------------
  |  |  235|    800|  ((cinfo)->err->msg_code = (code), \
  |  |  236|    800|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  273|       |
  274|  66.5k|  if (length != (cinfo->num_components * 3))
  ------------------
  |  Branch (274:7): [True: 696, False: 65.8k]
  ------------------
  275|    696|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  235|    696|  ((cinfo)->err->msg_code = (code), \
  |  |  236|    696|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  276|       |
  277|  66.5k|  if (cinfo->comp_info == NULL) /* do only once, even if suspend */
  ------------------
  |  Branch (277:7): [True: 63.5k, False: 2.96k]
  ------------------
  278|  63.5k|    cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
  279|  63.5k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  63.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  280|  63.5k|                         cinfo->num_components * sizeof(jpeg_component_info));
  281|       |
  282|   160k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (282:44): [True: 94.2k, False: 66.5k]
  ------------------
  283|  94.2k|       ci++, compptr++) {
  284|  94.2k|    compptr->component_index = ci;
  285|  94.2k|    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
  ------------------
  |  |  152|  94.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  95.7k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 495]
  |  |  |  |  |  Branch (274:38): [True: 495, False: 93.8k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  94.2k|            bytes_in_buffer--; \
  |  |  154|  94.2k|            V = *next_input_byte++; )
  ------------------
  286|  94.2k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  152|  94.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  95.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 537]
  |  |  |  |  |  Branch (274:38): [True: 537, False: 93.7k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  94.2k|            bytes_in_buffer--; \
  |  |  154|  94.2k|            V = *next_input_byte++; )
  ------------------
  287|  94.2k|    compptr->h_samp_factor = (c >> 4) & 15;
  288|  94.2k|    compptr->v_samp_factor = (c     ) & 15;
  289|  94.2k|    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
  ------------------
  |  |  152|  94.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  96.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 616]
  |  |  |  |  |  Branch (274:38): [True: 616, False: 93.6k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  94.2k|            bytes_in_buffer--; \
  |  |  154|  94.2k|            V = *next_input_byte++; )
  ------------------
  290|       |
  291|  94.2k|    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
  ------------------
  |  |  309|  94.2k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  274|  94.2k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  94.2k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  311|  94.2k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  94.2k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  292|  94.2k|             compptr->component_id, compptr->h_samp_factor,
  293|  94.2k|             compptr->v_samp_factor, compptr->quant_tbl_no);
  294|  94.2k|  }
  295|       |
  296|  66.5k|  cinfo->marker->saw_SOF = TRUE;
  ------------------
  |  |  209|  66.5k|#define TRUE    1
  ------------------
  297|       |
  298|  66.5k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  129|  66.5k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|  66.5k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  299|  66.5k|  return TRUE;
  ------------------
  |  |  209|  66.5k|#define TRUE    1
  ------------------
  300|  66.5k|}
jdmarker.c:get_sos:
  306|  73.2k|{
  307|  73.2k|  JLONG length;
  308|  73.2k|  int i, ci, n, c, cc, pi;
  309|  73.2k|  jpeg_component_info *compptr;
  310|  73.2k|  INPUT_VARS(cinfo);
  ------------------
  |  |  123|  73.2k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  124|  73.2k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  125|  73.2k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  311|       |
  312|  73.2k|  if (!cinfo->marker->saw_SOF)
  ------------------
  |  Branch (312:7): [True: 517, False: 72.7k]
  ------------------
  313|    517|    ERREXIT(cinfo, JERR_SOS_NO_SOF);
  ------------------
  |  |  235|    517|  ((cinfo)->err->msg_code = (code), \
  |  |  236|    517|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  314|       |
  315|  73.2k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  160|  73.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|   148k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 372]
  |  |  |  |  |  Branch (274:38): [True: 372, False: 72.8k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 414]
  |  |  |  |  |  Branch (274:38): [True: 414, False: 72.8k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  73.2k|            bytes_in_buffer--; \
  |  |  162|  73.2k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  73.2k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  73.2k|            bytes_in_buffer--; \
  |  |  165|  73.2k|            V += *next_input_byte++; )
  ------------------
  316|       |
  317|  73.2k|  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
  ------------------
  |  |  152|  73.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  74.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 472]
  |  |  |  |  |  Branch (274:38): [True: 472, False: 72.7k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  73.2k|            bytes_in_buffer--; \
  |  |  154|  73.2k|            V = *next_input_byte++; )
  ------------------
  318|       |
  319|  73.2k|  TRACEMS1(cinfo, 1, JTRC_SOS, n);
  ------------------
  |  |  295|  73.2k|  ((cinfo)->err->msg_code = (code), \
  |  |  296|  73.2k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  297|  73.2k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  320|       |
  321|  73.2k|  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   51|  71.2k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (321:7): [True: 1.74k, False: 71.4k]
  |  Branch (321:32): [True: 198, False: 71.2k]
  |  Branch (321:41): [True: 221, False: 71.0k]
  ------------------
  322|  1.64k|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  235|  1.64k|  ((cinfo)->err->msg_code = (code), \
  |  |  236|  1.64k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  323|       |
  324|  73.2k|  cinfo->comps_in_scan = n;
  325|       |
  326|       |  /* Collect the component-spec parameters */
  327|       |
  328|   357k|  for (i = 0; i < MAX_COMPS_IN_SCAN; i++)
  ------------------
  |  |   51|   357k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (328:15): [True: 284k, False: 73.2k]
  ------------------
  329|   284k|    cinfo->cur_comp_info[i] = NULL;
  330|       |
  331|   151k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (331:15): [True: 80.1k, False: 71.8k]
  ------------------
  332|  80.1k|    INPUT_BYTE(cinfo, cc, return FALSE);
  ------------------
  |  |  152|  80.1k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  81.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 598]
  |  |  |  |  |  Branch (274:38): [True: 598, False: 79.5k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  80.1k|            bytes_in_buffer--; \
  |  |  154|  80.1k|            V = *next_input_byte++; )
  ------------------
  333|  80.1k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  152|  80.1k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  81.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 603]
  |  |  |  |  |  Branch (274:38): [True: 603, False: 79.5k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  80.1k|            bytes_in_buffer--; \
  |  |  154|  80.1k|            V = *next_input_byte++; )
  ------------------
  334|       |
  335|  80.1k|    for (ci = 0, compptr = cinfo->comp_info;
  336|   101k|         ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN;
  ------------------
  |  |   51|   100k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (336:10): [True: 100k, False: 1.39k]
  |  Branch (336:40): [True: 100k, False: 9]
  ------------------
  337|   100k|         ci++, compptr++) {
  338|   100k|      if (cc == compptr->component_id && !cinfo->cur_comp_info[ci])
  ------------------
  |  Branch (338:11): [True: 82.2k, False: 18.3k]
  |  Branch (338:42): [True: 78.7k, False: 3.44k]
  ------------------
  339|  78.7k|        goto id_found;
  340|   100k|    }
  341|       |
  342|  1.40k|    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  238|  1.40k|  ((cinfo)->err->msg_code = (code), \
  |  |  239|  1.40k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|  1.40k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  343|       |
  344|  78.7k|id_found:
  345|       |
  346|  78.7k|    cinfo->cur_comp_info[i] = compptr;
  347|  78.7k|    compptr->dc_tbl_no = (c >> 4) & 15;
  348|  78.7k|    compptr->ac_tbl_no = (c     ) & 15;
  349|       |
  350|  78.7k|    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
  ------------------
  |  |  304|  78.7k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  274|  78.7k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|  78.7k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  306|  78.7k|           (cinfo)->err->msg_code = (code); \
  |  |  307|  78.7k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  351|  78.7k|             compptr->dc_tbl_no, compptr->ac_tbl_no);
  352|       |
  353|       |    /* This CSi (cc) should differ from the previous CSi */
  354|  91.5k|    for (pi = 0; pi < i; pi++) {
  ------------------
  |  Branch (354:18): [True: 12.8k, False: 78.7k]
  ------------------
  355|  12.8k|      if (cinfo->cur_comp_info[pi] == compptr) {
  ------------------
  |  Branch (355:11): [True: 223, False: 12.5k]
  ------------------
  356|    223|        ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  238|    223|  ((cinfo)->err->msg_code = (code), \
  |  |  239|    223|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|    223|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  357|    223|      }
  358|  12.8k|    }
  359|  78.7k|  }
  360|       |
  361|       |  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  362|  71.8k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  152|  71.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  75.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 1.26k]
  |  |  |  |  |  Branch (274:38): [True: 1.26k, False: 70.5k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  71.8k|            bytes_in_buffer--; \
  |  |  154|  71.8k|            V = *next_input_byte++; )
  ------------------
  363|  71.8k|  cinfo->Ss = c;
  364|  71.8k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  152|  71.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  76.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 1.54k]
  |  |  |  |  |  Branch (274:38): [True: 1.54k, False: 70.2k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  71.8k|            bytes_in_buffer--; \
  |  |  154|  71.8k|            V = *next_input_byte++; )
  ------------------
  365|  71.8k|  cinfo->Se = c;
  366|  71.8k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  152|  71.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  77.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 1.79k]
  |  |  |  |  |  Branch (274:38): [True: 1.79k, False: 70.0k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  71.8k|            bytes_in_buffer--; \
  |  |  154|  71.8k|            V = *next_input_byte++; )
  ------------------
  367|  71.8k|  cinfo->Ah = (c >> 4) & 15;
  368|  71.8k|  cinfo->Al = (c     ) & 15;
  369|       |
  370|  71.8k|  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
  ------------------
  |  |  309|  71.8k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  274|  71.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  71.8k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  311|  71.8k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  71.8k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  371|  71.8k|           cinfo->Ah, cinfo->Al);
  372|       |
  373|       |  /* Prepare to scan data & restart markers */
  374|  71.8k|  cinfo->marker->next_restart_num = 0;
  375|       |
  376|       |  /* Count another SOS marker */
  377|  71.8k|  cinfo->input_scan_number++;
  378|       |
  379|  71.8k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  129|  71.8k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|  71.8k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  380|  71.8k|  return TRUE;
  ------------------
  |  |  209|  71.8k|#define TRUE    1
  ------------------
  381|  71.8k|}
jdmarker.c:get_dac:
  389|  1.87k|{
  390|  1.87k|  JLONG length;
  391|  1.87k|  int index, val;
  392|  1.87k|  INPUT_VARS(cinfo);
  ------------------
  |  |  123|  1.87k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  124|  1.87k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  125|  1.87k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  393|       |
  394|  1.87k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  160|  1.87k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  5.07k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 223]
  |  |  |  |  |  Branch (274:38): [True: 223, False: 1.64k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 222]
  |  |  |  |  |  Branch (274:38): [True: 222, False: 1.64k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  1.87k|            bytes_in_buffer--; \
  |  |  162|  1.87k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  1.87k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  1.87k|            bytes_in_buffer--; \
  |  |  165|  1.87k|            V += *next_input_byte++; )
  ------------------
  395|  1.87k|  length -= 2;
  396|       |
  397|  4.92k|  while (length > 0) {
  ------------------
  |  Branch (397:10): [True: 3.05k, False: 1.87k]
  ------------------
  398|  3.05k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  152|  3.05k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  4.43k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 459]
  |  |  |  |  |  Branch (274:38): [True: 459, False: 2.59k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  3.05k|            bytes_in_buffer--; \
  |  |  154|  3.05k|            V = *next_input_byte++; )
  ------------------
  399|  3.05k|    INPUT_BYTE(cinfo, val, return FALSE);
  ------------------
  |  |  152|  3.05k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  4.08k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 345]
  |  |  |  |  |  Branch (274:38): [True: 345, False: 2.70k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  3.05k|            bytes_in_buffer--; \
  |  |  154|  3.05k|            V = *next_input_byte++; )
  ------------------
  400|       |
  401|  3.05k|    length -= 2;
  402|       |
  403|  3.05k|    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
  ------------------
  |  |  299|  3.05k|  ((cinfo)->err->msg_code = (code), \
  |  |  300|  3.05k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  301|  3.05k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  302|  3.05k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  404|       |
  405|  3.05k|    if (index < 0 || index >= (2 * NUM_ARITH_TBLS))
  ------------------
  |  |   50|  3.05k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (405:9): [True: 0, False: 3.05k]
  |  Branch (405:22): [True: 877, False: 2.17k]
  ------------------
  406|    877|      ERREXIT1(cinfo, JERR_DAC_INDEX, index);
  ------------------
  |  |  238|    877|  ((cinfo)->err->msg_code = (code), \
  |  |  239|    877|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|    877|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  407|       |
  408|  3.05k|    if (index >= NUM_ARITH_TBLS) { /* define AC table */
  ------------------
  |  |   50|  3.05k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (408:9): [True: 586, False: 2.46k]
  ------------------
  409|    586|      cinfo->arith_ac_K[index - NUM_ARITH_TBLS] = (UINT8)val;
  ------------------
  |  |   50|    586|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  410|  2.46k|    } else {                    /* define DC table */
  411|  2.46k|      cinfo->arith_dc_L[index] = (UINT8)(val & 0x0F);
  412|  2.46k|      cinfo->arith_dc_U[index] = (UINT8)(val >> 4);
  413|  2.46k|      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
  ------------------
  |  Branch (413:11): [True: 366, False: 2.10k]
  ------------------
  414|    366|        ERREXIT1(cinfo, JERR_DAC_VALUE, val);
  ------------------
  |  |  238|    366|  ((cinfo)->err->msg_code = (code), \
  |  |  239|    366|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|    366|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  415|  2.46k|    }
  416|  3.05k|  }
  417|       |
  418|  1.87k|  if (length != 0)
  ------------------
  |  Branch (418:7): [True: 249, False: 1.62k]
  ------------------
  419|    249|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  235|    249|  ((cinfo)->err->msg_code = (code), \
  |  |  236|    249|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  420|       |
  421|  1.87k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  129|  1.87k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|  1.87k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  422|  1.87k|  return TRUE;
  ------------------
  |  |  209|  1.87k|#define TRUE    1
  ------------------
  423|  1.87k|}
jdmarker.c:get_dht:
  435|  63.0k|{
  436|  63.0k|  JLONG length;
  437|  63.0k|  UINT8 bits[17];
  438|  63.0k|  UINT8 huffval[256];
  439|  63.0k|  int i, index, count;
  440|  63.0k|  JHUFF_TBL **htblptr;
  441|  63.0k|  INPUT_VARS(cinfo);
  ------------------
  |  |  123|  63.0k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  124|  63.0k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  125|  63.0k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  442|       |
  443|  63.0k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  160|  63.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|   127k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 260]
  |  |  |  |  |  Branch (274:38): [True: 260, False: 62.7k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 219]
  |  |  |  |  |  Branch (274:38): [True: 219, False: 62.8k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  63.0k|            bytes_in_buffer--; \
  |  |  162|  63.0k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  63.0k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  63.0k|            bytes_in_buffer--; \
  |  |  165|  63.0k|            V += *next_input_byte++; )
  ------------------
  444|  63.0k|  length -= 2;
  445|       |
  446|   127k|  while (length > 16) {
  ------------------
  |  Branch (446:10): [True: 64.2k, False: 63.0k]
  ------------------
  447|  64.2k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  152|  64.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  67.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 1.11k]
  |  |  |  |  |  Branch (274:38): [True: 1.11k, False: 63.1k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  64.2k|            bytes_in_buffer--; \
  |  |  154|  64.2k|            V = *next_input_byte++; )
  ------------------
  448|       |
  449|  64.2k|    TRACEMS1(cinfo, 1, JTRC_DHT, index);
  ------------------
  |  |  295|  64.2k|  ((cinfo)->err->msg_code = (code), \
  |  |  296|  64.2k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  297|  64.2k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  450|       |
  451|  64.2k|    bits[0] = 0;
  452|  64.2k|    count = 0;
  453|  1.09M|    for (i = 1; i <= 16; i++) {
  ------------------
  |  Branch (453:17): [True: 1.02M, False: 64.2k]
  ------------------
  454|  1.02M|      INPUT_BYTE(cinfo, bits[i], return FALSE);
  ------------------
  |  |  152|  1.02M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  1.07M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 14.7k]
  |  |  |  |  |  Branch (274:38): [True: 14.7k, False: 1.01M]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  1.02M|            bytes_in_buffer--; \
  |  |  154|  1.02M|            V = *next_input_byte++; )
  ------------------
  455|  1.02M|      count += bits[i];
  456|  1.02M|    }
  457|       |
  458|  64.2k|    length -= 1 + 16;
  459|       |
  460|  64.2k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  320|  64.2k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  274|  64.2k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  321|  64.2k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  322|  64.2k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  323|  64.2k|           (cinfo)->err->msg_code = (code); \
  |  |  324|  64.2k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  461|  64.2k|             bits[1], bits[2], bits[3], bits[4],
  462|  64.2k|             bits[5], bits[6], bits[7], bits[8]);
  463|  64.2k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  320|  64.2k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  274|  64.2k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  321|  64.2k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  322|  64.2k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  323|  64.2k|           (cinfo)->err->msg_code = (code); \
  |  |  324|  64.2k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  464|  64.2k|             bits[9], bits[10], bits[11], bits[12],
  465|  64.2k|             bits[13], bits[14], bits[15], bits[16]);
  466|       |
  467|       |    /* Here we just do minimal validation of the counts to avoid walking
  468|       |     * off the end of our table space.  jdhuff.c will check more carefully.
  469|       |     */
  470|  64.2k|    if (count > 256 || ((JLONG)count) > length)
  ------------------
  |  Branch (470:9): [True: 2.36k, False: 61.8k]
  |  Branch (470:24): [True: 210, False: 61.6k]
  ------------------
  471|  2.57k|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  235|  2.57k|  ((cinfo)->err->msg_code = (code), \
  |  |  236|  2.57k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  472|       |
  473|  4.61M|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (473:17): [True: 4.55M, False: 64.2k]
  ------------------
  474|  4.55M|      INPUT_BYTE(cinfo, huffval[i], return FALSE);
  ------------------
  |  |  152|  4.55M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  4.83M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 94.1k]
  |  |  |  |  |  Branch (274:38): [True: 94.1k, False: 4.45M]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  64.2k|            bytes_in_buffer--; \
  |  |  154|  64.2k|            V = *next_input_byte++; )
  ------------------
  475|       |
  476|  64.2k|    memset(&huffval[count], 0, (256 - count) * sizeof(UINT8));
  477|       |
  478|  64.2k|    length -= count;
  479|       |
  480|  64.2k|    if (index & 0x10) {         /* AC table definition */
  ------------------
  |  Branch (480:9): [True: 35.9k, False: 28.3k]
  ------------------
  481|  35.9k|      index -= 0x10;
  482|  35.9k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   49|  35.9k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (482:11): [True: 0, False: 35.9k]
  |  Branch (482:24): [True: 222, False: 35.7k]
  ------------------
  483|    222|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  238|    222|  ((cinfo)->err->msg_code = (code), \
  |  |  239|    222|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|    222|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  484|  35.9k|      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
  485|  35.9k|    } else {                    /* DC table definition */
  486|  28.3k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   49|  25.7k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (486:11): [True: 2.57k, False: 25.7k]
  |  Branch (486:24): [True: 217, False: 25.5k]
  ------------------
  487|    217|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  238|    217|  ((cinfo)->err->msg_code = (code), \
  |  |  239|    217|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|    217|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  488|  28.3k|      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
  489|  28.3k|    }
  490|       |
  491|  64.2k|    if (*htblptr == NULL)
  ------------------
  |  Branch (491:9): [True: 58.3k, False: 5.89k]
  ------------------
  492|  58.3k|      *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  493|       |
  494|  64.2k|    memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
  495|  64.2k|    memcpy((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
  496|  64.2k|  }
  497|       |
  498|  63.0k|  if (length != 0)
  ------------------
  |  Branch (498:7): [True: 217, False: 62.8k]
  ------------------
  499|    217|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  235|    217|  ((cinfo)->err->msg_code = (code), \
  |  |  236|    217|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  500|       |
  501|  63.0k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  129|  63.0k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|  63.0k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  502|  63.0k|  return TRUE;
  ------------------
  |  |  209|  63.0k|#define TRUE    1
  ------------------
  503|  63.0k|}
jdmarker.c:get_dqt:
  509|  77.3k|{
  510|  77.3k|  JLONG length;
  511|  77.3k|  int n, i, prec;
  512|  77.3k|  unsigned int tmp;
  513|  77.3k|  JQUANT_TBL *quant_ptr;
  514|  77.3k|  INPUT_VARS(cinfo);
  ------------------
  |  |  123|  77.3k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  124|  77.3k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  125|  77.3k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  515|       |
  516|  77.3k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  160|  77.3k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|   157k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 504]
  |  |  |  |  |  Branch (274:38): [True: 504, False: 76.8k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 487]
  |  |  |  |  |  Branch (274:38): [True: 487, False: 76.9k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  77.3k|            bytes_in_buffer--; \
  |  |  162|  77.3k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  77.3k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  77.3k|            bytes_in_buffer--; \
  |  |  165|  77.3k|            V += *next_input_byte++; )
  ------------------
  517|  77.3k|  length -= 2;
  518|       |
  519|   155k|  while (length > 0) {
  ------------------
  |  Branch (519:10): [True: 77.9k, False: 77.3k]
  ------------------
  520|  77.9k|    INPUT_BYTE(cinfo, n, return FALSE);
  ------------------
  |  |  152|  77.9k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  80.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 709]
  |  |  |  |  |  Branch (274:38): [True: 709, False: 77.2k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  77.9k|            bytes_in_buffer--; \
  |  |  154|  77.9k|            V = *next_input_byte++; )
  ------------------
  521|  77.9k|    prec = n >> 4;
  522|  77.9k|    n &= 0x0F;
  523|       |
  524|  77.9k|    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
  ------------------
  |  |  299|  77.9k|  ((cinfo)->err->msg_code = (code), \
  |  |  300|  77.9k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  301|  77.9k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  302|  77.9k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  525|       |
  526|  77.9k|    if (n >= NUM_QUANT_TBLS)
  ------------------
  |  |   48|  77.9k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (526:9): [True: 1.81k, False: 76.1k]
  ------------------
  527|  1.81k|      ERREXIT1(cinfo, JERR_DQT_INDEX, n);
  ------------------
  |  |  238|  1.81k|  ((cinfo)->err->msg_code = (code), \
  |  |  239|  1.81k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|  1.81k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  528|       |
  529|  77.9k|    if (cinfo->quant_tbl_ptrs[n] == NULL)
  ------------------
  |  Branch (529:9): [True: 25.3k, False: 52.5k]
  ------------------
  530|  25.3k|      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  531|  77.9k|    quant_ptr = cinfo->quant_tbl_ptrs[n];
  532|       |
  533|  4.94M|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   47|  4.94M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (533:17): [True: 4.87M, False: 77.9k]
  ------------------
  534|  4.87M|      if (prec)
  ------------------
  |  Branch (534:11): [True: 51.2k, False: 4.82M]
  ------------------
  535|  4.87M|        INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  160|  51.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|   135k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 8.69k]
  |  |  |  |  |  Branch (274:38): [True: 8.69k, False: 42.5k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 2.21k]
  |  |  |  |  |  Branch (274:38): [True: 2.21k, False: 48.9k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  4.87M|            bytes_in_buffer--; \
  |  |  162|  4.87M|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  4.87M|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  4.87M|            bytes_in_buffer--; \
  |  |  165|  4.87M|            V += *next_input_byte++; )
  ------------------
  536|  4.82M|      else
  537|  4.87M|        INPUT_BYTE(cinfo, tmp, return FALSE);
  ------------------
  |  |  152|  4.82M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  5.06M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 81.4k]
  |  |  |  |  |  Branch (274:38): [True: 81.4k, False: 4.73M]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  4.87M|            bytes_in_buffer--; \
  |  |  154|  4.87M|            V = *next_input_byte++; )
  ------------------
  538|       |      /* We convert the zigzag-order table to natural array order. */
  539|  4.87M|      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
  540|  4.87M|    }
  541|       |
  542|  77.9k|    if (cinfo->err->trace_level >= 2) {
  ------------------
  |  Branch (542:9): [True: 0, False: 77.9k]
  ------------------
  543|      0|      for (i = 0; i < DCTSIZE2; i += 8) {
  ------------------
  |  |   47|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (543:19): [True: 0, False: 0]
  ------------------
  544|      0|        TRACEMS8(cinfo, 2, JTRC_QUANTVALS,
  ------------------
  |  |  320|      0|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  274|      0|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  321|      0|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  322|      0|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  323|      0|           (cinfo)->err->msg_code = (code); \
  |  |  324|      0|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  545|      0|                 quant_ptr->quantval[i],     quant_ptr->quantval[i + 1],
  546|      0|                 quant_ptr->quantval[i + 2], quant_ptr->quantval[i + 3],
  547|      0|                 quant_ptr->quantval[i + 4], quant_ptr->quantval[i + 5],
  548|      0|                 quant_ptr->quantval[i + 6], quant_ptr->quantval[i + 7]);
  549|      0|      }
  550|      0|    }
  551|       |
  552|  77.9k|    length -= DCTSIZE2 + 1;
  ------------------
  |  |   47|  77.9k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  553|  77.9k|    if (prec) length -= DCTSIZE2;
  ------------------
  |  |   47|    800|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (553:9): [True: 800, False: 77.1k]
  ------------------
  554|  77.9k|  }
  555|       |
  556|  77.3k|  if (length != 0)
  ------------------
  |  Branch (556:7): [True: 529, False: 76.8k]
  ------------------
  557|    529|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  235|    529|  ((cinfo)->err->msg_code = (code), \
  |  |  236|    529|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|       |
  559|  77.3k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  129|  77.3k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|  77.3k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  560|  77.3k|  return TRUE;
  ------------------
  |  |  209|  77.3k|#define TRUE    1
  ------------------
  561|  77.3k|}
jdmarker.c:get_dri:
  567|  7.70k|{
  568|  7.70k|  JLONG length;
  569|  7.70k|  unsigned int tmp;
  570|  7.70k|  INPUT_VARS(cinfo);
  ------------------
  |  |  123|  7.70k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  124|  7.70k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  125|  7.70k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  571|       |
  572|  7.70k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  160|  7.70k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  17.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 268]
  |  |  |  |  |  Branch (274:38): [True: 268, False: 7.43k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 267]
  |  |  |  |  |  Branch (274:38): [True: 267, False: 7.43k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  7.70k|            bytes_in_buffer--; \
  |  |  162|  7.70k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  7.70k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  7.70k|            bytes_in_buffer--; \
  |  |  165|  7.70k|            V += *next_input_byte++; )
  ------------------
  573|       |
  574|  7.70k|  if (length != 4)
  ------------------
  |  Branch (574:7): [True: 788, False: 6.91k]
  ------------------
  575|    788|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  235|    788|  ((cinfo)->err->msg_code = (code), \
  |  |  236|    788|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  576|       |
  577|  7.70k|  INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  160|  7.70k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  16.7k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 213]
  |  |  |  |  |  Branch (274:38): [True: 213, False: 7.49k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 241]
  |  |  |  |  |  Branch (274:38): [True: 241, False: 7.46k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  7.70k|            bytes_in_buffer--; \
  |  |  162|  7.70k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  7.70k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  7.70k|            bytes_in_buffer--; \
  |  |  165|  7.70k|            V += *next_input_byte++; )
  ------------------
  578|       |
  579|  7.70k|  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
  ------------------
  |  |  295|  7.70k|  ((cinfo)->err->msg_code = (code), \
  |  |  296|  7.70k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  297|  7.70k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  580|       |
  581|  7.70k|  cinfo->restart_interval = tmp;
  582|       |
  583|  7.70k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  129|  7.70k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|  7.70k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  584|  7.70k|  return TRUE;
  ------------------
  |  |  209|  7.70k|#define TRUE    1
  ------------------
  585|  7.70k|}
jdmarker.c:read_restart_marker:
 1128|   274k|{
 1129|       |  /* Obtain a marker unless we already did. */
 1130|       |  /* Note that next_marker will complain if it skips any data. */
 1131|   274k|  if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (1131:7): [True: 6.08k, False: 268k]
  ------------------
 1132|  6.08k|    if (!next_marker(cinfo))
  ------------------
  |  Branch (1132:9): [True: 0, False: 6.08k]
  ------------------
 1133|      0|      return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1134|  6.08k|  }
 1135|       |
 1136|   274k|  if (cinfo->unread_marker ==
  ------------------
  |  Branch (1136:7): [True: 13.5k, False: 261k]
  ------------------
 1137|   274k|      ((int)M_RST0 + cinfo->marker->next_restart_num)) {
 1138|       |    /* Normal case --- swallow the marker and let entropy decoder continue */
 1139|  13.5k|    TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
  ------------------
  |  |  295|  13.5k|  ((cinfo)->err->msg_code = (code), \
  |  |  296|  13.5k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  297|  13.5k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1140|  13.5k|    cinfo->unread_marker = 0;
 1141|   261k|  } else {
 1142|       |    /* Uh-oh, the restart markers have been messed up. */
 1143|       |    /* Let the data source manager determine how to resync. */
 1144|   261k|    if (!(*cinfo->src->resync_to_restart) (cinfo,
  ------------------
  |  Branch (1144:9): [True: 0, False: 261k]
  ------------------
 1145|   261k|                                           cinfo->marker->next_restart_num))
 1146|      0|      return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1147|   261k|  }
 1148|       |
 1149|       |  /* Update next-restart state */
 1150|   274k|  cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
 1151|       |
 1152|   274k|  return TRUE;
  ------------------
  |  |  209|   274k|#define TRUE    1
  ------------------
 1153|   274k|}
jdmarker.c:skip_variable:
  861|  31.8k|{
  862|  31.8k|  JLONG length;
  863|  31.8k|  INPUT_VARS(cinfo);
  ------------------
  |  |  123|  31.8k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  124|  31.8k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  125|  31.8k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  864|       |
  865|  31.8k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  160|  31.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  67.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 710]
  |  |  |  |  |  Branch (274:38): [True: 710, False: 31.1k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 559]
  |  |  |  |  |  Branch (274:38): [True: 559, False: 31.3k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  31.8k|            bytes_in_buffer--; \
  |  |  162|  31.8k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  31.8k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  31.8k|            bytes_in_buffer--; \
  |  |  165|  31.8k|            V += *next_input_byte++; )
  ------------------
  866|  31.8k|  length -= 2;
  867|       |
  868|  31.8k|  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
  ------------------
  |  |  299|  31.8k|  ((cinfo)->err->msg_code = (code), \
  |  |  300|  31.8k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  301|  31.8k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  302|  31.8k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  869|       |
  870|  31.8k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  129|  31.8k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|  31.8k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  871|  31.8k|  if (length > 0)
  ------------------
  |  Branch (871:7): [True: 17.0k, False: 14.8k]
  ------------------
  872|  17.0k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  873|       |
  874|  31.8k|  return TRUE;
  ------------------
  |  |  209|  31.8k|#define TRUE    1
  ------------------
  875|  31.8k|}
jdmarker.c:get_interesting_appn:
  707|  39.2k|{
  708|  39.2k|  JLONG length;
  709|  39.2k|  JOCTET b[APPN_DATA_LEN];
  710|  39.2k|  unsigned int i, numtoread;
  711|  39.2k|  INPUT_VARS(cinfo);
  ------------------
  |  |  123|  39.2k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  124|  39.2k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  125|  39.2k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  712|       |
  713|  39.2k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  160|  39.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|  79.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 292]
  |  |  |  |  |  Branch (274:38): [True: 292, False: 38.9k]
  |  |  |  |  |  Branch (274:38): [True: 0, False: 156]
  |  |  |  |  |  Branch (274:38): [True: 156, False: 39.0k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  39.2k|            bytes_in_buffer--; \
  |  |  162|  39.2k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  163|  39.2k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  164|  39.2k|            bytes_in_buffer--; \
  |  |  165|  39.2k|            V += *next_input_byte++; )
  ------------------
  714|  39.2k|  length -= 2;
  715|       |
  716|       |  /* get the interesting part of the marker data */
  717|  39.2k|  if (length >= APPN_DATA_LEN)
  ------------------
  |  |  597|  39.2k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  |  Branch (717:7): [True: 34.1k, False: 5.05k]
  ------------------
  718|  34.1k|    numtoread = APPN_DATA_LEN;
  ------------------
  |  |  597|  34.1k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  719|  5.05k|  else if (length > 0)
  ------------------
  |  Branch (719:12): [True: 1.71k, False: 3.34k]
  ------------------
  720|  1.71k|    numtoread = (unsigned int)length;
  721|  3.34k|  else
  722|  3.34k|    numtoread = 0;
  723|   534k|  for (i = 0; i < numtoread; i++)
  ------------------
  |  Branch (723:15): [True: 495k, False: 39.2k]
  ------------------
  724|   495k|    INPUT_BYTE(cinfo, b[i], return FALSE);
  ------------------
  |  |  152|   495k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  274|   534k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:38): [True: 0, False: 5.92k]
  |  |  |  |  |  Branch (274:38): [True: 5.92k, False: 489k]
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  39.2k|            bytes_in_buffer--; \
  |  |  154|  39.2k|            V = *next_input_byte++; )
  ------------------
  725|  39.2k|  length -= numtoread;
  726|       |
  727|       |  /* process it */
  728|  39.2k|  switch (cinfo->unread_marker) {
  729|  33.5k|  case M_APP0:
  ------------------
  |  Branch (729:3): [True: 33.5k, False: 5.67k]
  ------------------
  730|  33.5k|    examine_app0(cinfo, (JOCTET *)b, numtoread, length);
  731|  33.5k|    break;
  732|  5.67k|  case M_APP14:
  ------------------
  |  Branch (732:3): [True: 5.67k, False: 33.5k]
  ------------------
  733|  5.67k|    examine_app14(cinfo, (JOCTET *)b, numtoread, length);
  734|  5.67k|    break;
  735|      0|  default:
  ------------------
  |  Branch (735:3): [True: 0, False: 39.2k]
  ------------------
  736|       |    /* can't get here unless jpeg_save_markers chooses wrong processor */
  737|      0|    ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  738|      0|    break;
  739|  39.2k|  }
  740|       |
  741|       |  /* skip any remaining data -- could be lots */
  742|  39.2k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  129|  39.2k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  130|  39.2k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  743|  39.2k|  if (length > 0)
  ------------------
  |  Branch (743:7): [True: 33.7k, False: 5.51k]
  ------------------
  744|  33.7k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  745|       |
  746|  39.2k|  return TRUE;
  ------------------
  |  |  209|  39.2k|#define TRUE    1
  ------------------
  747|  39.2k|}
jdmarker.c:examine_app0:
  607|  33.5k|{
  608|  33.5k|  JLONG totallen = (JLONG)datalen + remaining;
  609|       |
  610|  33.5k|  if (datalen >= APP0_DATA_LEN &&
  ------------------
  |  |  595|  67.1k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (610:7): [True: 31.2k, False: 2.35k]
  ------------------
  611|  33.5k|      data[0] == 0x4A &&
  ------------------
  |  Branch (611:7): [True: 29.1k, False: 2.01k]
  ------------------
  612|  33.5k|      data[1] == 0x46 &&
  ------------------
  |  Branch (612:7): [True: 16.4k, False: 12.7k]
  ------------------
  613|  33.5k|      data[2] == 0x49 &&
  ------------------
  |  Branch (613:7): [True: 1.55k, False: 14.8k]
  ------------------
  614|  33.5k|      data[3] == 0x46 &&
  ------------------
  |  Branch (614:7): [True: 1.24k, False: 303]
  ------------------
  615|  33.5k|      data[4] == 0) {
  ------------------
  |  Branch (615:7): [True: 984, False: 265]
  ------------------
  616|       |    /* Found JFIF APP0 marker: save info */
  617|    984|    cinfo->saw_JFIF_marker = TRUE;
  ------------------
  |  |  209|    984|#define TRUE    1
  ------------------
  618|    984|    cinfo->JFIF_major_version = data[5];
  619|    984|    cinfo->JFIF_minor_version = data[6];
  620|    984|    cinfo->density_unit = data[7];
  621|    984|    cinfo->X_density = (data[8] << 8) + data[9];
  622|    984|    cinfo->Y_density = (data[10] << 8) + data[11];
  623|       |    /* Check version.
  624|       |     * Major version must be 1, anything else signals an incompatible change.
  625|       |     * (We used to treat this as an error, but now it's a nonfatal warning,
  626|       |     * because some bozo at Hijaak couldn't read the spec.)
  627|       |     * Minor version should be 0..2, but process anyway if newer.
  628|       |     */
  629|    984|    if (cinfo->JFIF_major_version != 1)
  ------------------
  |  Branch (629:9): [True: 525, False: 459]
  ------------------
  630|    525|      WARNMS2(cinfo, JWRN_JFIF_MAJOR,
  ------------------
  |  |  285|    525|  ((cinfo)->err->msg_code = (code), \
  |  |  286|    525|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  287|    525|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  288|    525|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  631|    984|              cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
  632|       |    /* Generate trace messages */
  633|    984|    TRACEMS5(cinfo, 1, JTRC_JFIF,
  ------------------
  |  |  314|    984|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  274|    984|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    984|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    984|           _mp[4] = (p5); \
  |  |  317|    984|           (cinfo)->err->msg_code = (code); \
  |  |  318|    984|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  634|    984|             cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
  635|    984|             cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
  636|       |    /* Validate thumbnail dimensions and issue appropriate messages */
  637|    984|    if (data[12] | data[13])
  ------------------
  |  Branch (637:9): [True: 450, False: 534]
  ------------------
  638|    450|      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
  ------------------
  |  |  299|    450|  ((cinfo)->err->msg_code = (code), \
  |  |  300|    450|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  301|    450|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  302|    450|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  639|    984|    totallen -= APP0_DATA_LEN;
  ------------------
  |  |  595|    984|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  640|    984|    if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
  ------------------
  |  Branch (640:9): [True: 746, False: 238]
  ------------------
  641|    746|      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
  ------------------
  |  |  295|    746|  ((cinfo)->err->msg_code = (code), \
  |  |  296|    746|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  297|    746|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  642|  32.5k|  } else if (datalen >= 6 &&
  ------------------
  |  Branch (642:14): [True: 31.4k, False: 1.14k]
  ------------------
  643|  32.5k|             data[0] == 0x4A &&
  ------------------
  |  Branch (643:14): [True: 28.2k, False: 3.21k]
  ------------------
  644|  32.5k|             data[1] == 0x46 &&
  ------------------
  |  Branch (644:14): [True: 15.4k, False: 12.7k]
  ------------------
  645|  32.5k|             data[2] == 0x58 &&
  ------------------
  |  Branch (645:14): [True: 2.01k, False: 13.4k]
  ------------------
  646|  32.5k|             data[3] == 0x58 &&
  ------------------
  |  Branch (646:14): [True: 1.72k, False: 281]
  ------------------
  647|  32.5k|             data[4] == 0) {
  ------------------
  |  Branch (647:14): [True: 1.40k, False: 323]
  ------------------
  648|       |    /* Found JFIF "JFXX" extension APP0 marker */
  649|       |    /* The library doesn't actually do anything with these,
  650|       |     * but we try to produce a helpful trace message.
  651|       |     */
  652|  1.40k|    switch (data[5]) {
  653|    280|    case 0x10:
  ------------------
  |  Branch (653:5): [True: 280, False: 1.12k]
  ------------------
  654|    280|      TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int)totallen);
  ------------------
  |  |  295|    280|  ((cinfo)->err->msg_code = (code), \
  |  |  296|    280|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  297|    280|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  655|    280|      break;
  656|    451|    case 0x11:
  ------------------
  |  Branch (656:5): [True: 451, False: 955]
  ------------------
  657|    451|      TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int)totallen);
  ------------------
  |  |  295|    451|  ((cinfo)->err->msg_code = (code), \
  |  |  296|    451|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  297|    451|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  658|    451|      break;
  659|    388|    case 0x13:
  ------------------
  |  Branch (659:5): [True: 388, False: 1.01k]
  ------------------
  660|    388|      TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int)totallen);
  ------------------
  |  |  295|    388|  ((cinfo)->err->msg_code = (code), \
  |  |  296|    388|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  297|    388|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  661|    388|      break;
  662|    287|    default:
  ------------------
  |  Branch (662:5): [True: 287, False: 1.11k]
  ------------------
  663|    287|      TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, data[5], (int)totallen);
  ------------------
  |  |  299|    287|  ((cinfo)->err->msg_code = (code), \
  |  |  300|    287|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  301|    287|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  302|    287|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  664|    287|      break;
  665|  1.40k|    }
  666|  31.1k|  } else {
  667|       |    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
  668|  31.1k|    TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
  ------------------
  |  |  295|  31.1k|  ((cinfo)->err->msg_code = (code), \
  |  |  296|  31.1k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  297|  31.1k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  669|  31.1k|  }
  670|  33.5k|}
jdmarker.c:examine_app14:
  680|  5.67k|{
  681|  5.67k|  unsigned int version, flags0, flags1, transform;
  682|       |
  683|  5.67k|  if (datalen >= APP14_DATA_LEN &&
  ------------------
  |  |  596|  11.3k|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (683:7): [True: 2.97k, False: 2.69k]
  ------------------
  684|  5.67k|      data[0] == 0x41 &&
  ------------------
  |  Branch (684:7): [True: 2.60k, False: 368]
  ------------------
  685|  5.67k|      data[1] == 0x64 &&
  ------------------
  |  Branch (685:7): [True: 2.29k, False: 307]
  ------------------
  686|  5.67k|      data[2] == 0x6F &&
  ------------------
  |  Branch (686:7): [True: 1.92k, False: 370]
  ------------------
  687|  5.67k|      data[3] == 0x62 &&
  ------------------
  |  Branch (687:7): [True: 1.53k, False: 391]
  ------------------
  688|  5.67k|      data[4] == 0x65) {
  ------------------
  |  Branch (688:7): [True: 1.22k, False: 311]
  ------------------
  689|       |    /* Found Adobe APP14 marker */
  690|  1.22k|    version = (data[5] << 8) + data[6];
  691|  1.22k|    flags0 = (data[7] << 8) + data[8];
  692|  1.22k|    flags1 = (data[9] << 8) + data[10];
  693|  1.22k|    transform = data[11];
  694|  1.22k|    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
  ------------------
  |  |  309|  1.22k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  274|  1.22k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (274:53): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  1.22k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  311|  1.22k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  1.22k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  695|  1.22k|    cinfo->saw_Adobe_marker = TRUE;
  ------------------
  |  |  209|  1.22k|#define TRUE    1
  ------------------
  696|  1.22k|    cinfo->Adobe_transform = (UINT8)transform;
  697|  4.44k|  } else {
  698|       |    /* Start of APP14 does not match "Adobe", or too short */
  699|  4.44k|    TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
  ------------------
  |  |  295|  4.44k|  ((cinfo)->err->msg_code = (code), \
  |  |  296|  4.44k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  297|  4.44k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  700|  4.44k|  }
  701|  5.67k|}

jpeg_calc_output_dimensions:
  261|  54.4k|{
  262|  54.4k|#ifdef IDCT_SCALING_SUPPORTED
  263|  54.4k|  int ci;
  264|  54.4k|  jpeg_component_info *compptr;
  265|  54.4k|#endif
  266|       |
  267|       |  /* Prevent application from calling me at wrong times */
  268|  54.4k|  if (cinfo->global_state != DSTATE_READY)
  ------------------
  |  |   37|  54.4k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (268:7): [True: 0, False: 54.4k]
  ------------------
  269|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  270|       |
  271|       |  /* Compute core output image dimensions and DCT scaling choices. */
  272|  54.4k|  jpeg_core_output_dimensions(cinfo);
  273|       |
  274|  54.4k|#ifdef IDCT_SCALING_SUPPORTED
  275|       |
  276|       |  /* In selecting the actual DCT scaling for each component, we try to
  277|       |   * scale up the chroma components via IDCT scaling rather than upsampling.
  278|       |   * This saves time if the upsampler gets to use 1:1 scaling.
  279|       |   * Note this code adapts subsampling ratios which are powers of 2.
  280|       |   */
  281|   125k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (281:44): [True: 71.0k, False: 54.4k]
  ------------------
  282|  71.0k|       ci++, compptr++) {
  283|  71.0k|    int ssize = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  71.0k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  284|  71.0k|    while (ssize < DCTSIZE &&
  ------------------
  |  |   46|   142k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (284:12): [True: 0, False: 71.0k]
  ------------------
  285|  71.0k|           ((cinfo->max_h_samp_factor * cinfo->_min_DCT_scaled_size) %
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (285:12): [True: 0, False: 0]
  ------------------
  286|      0|            (compptr->h_samp_factor * ssize * 2) == 0) &&
  287|  71.0k|           ((cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size) %
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (287:12): [True: 0, False: 0]
  ------------------
  288|      0|            (compptr->v_samp_factor * ssize * 2) == 0)) {
  289|      0|      ssize = ssize * 2;
  290|      0|    }
  291|       |#if JPEG_LIB_VERSION >= 70
  292|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = ssize;
  293|       |#else
  294|  71.0k|    compptr->DCT_scaled_size = ssize;
  295|  71.0k|#endif
  296|  71.0k|  }
  297|       |
  298|       |  /* Recompute downsampled dimensions of components;
  299|       |   * application needs to know these if using raw downsampled data.
  300|       |   */
  301|   125k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (301:44): [True: 71.0k, False: 54.4k]
  ------------------
  302|  71.0k|       ci++, compptr++) {
  303|       |    /* Size in samples, after IDCT scaling */
  304|  71.0k|    compptr->downsampled_width = (JDIMENSION)
  305|  71.0k|      jdiv_round_up((long)cinfo->image_width *
  306|  71.0k|                    (long)(compptr->h_samp_factor * compptr->_DCT_scaled_size),
  ------------------
  |  |   24|  71.0k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  307|  71.0k|                    (long)(cinfo->max_h_samp_factor * DCTSIZE));
  ------------------
  |  |   46|  71.0k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  308|  71.0k|    compptr->downsampled_height = (JDIMENSION)
  309|  71.0k|      jdiv_round_up((long)cinfo->image_height *
  310|  71.0k|                    (long)(compptr->v_samp_factor * compptr->_DCT_scaled_size),
  ------------------
  |  |   24|  71.0k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  311|  71.0k|                    (long)(cinfo->max_v_samp_factor * DCTSIZE));
  ------------------
  |  |   46|  71.0k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  312|  71.0k|  }
  313|       |
  314|       |#else /* !IDCT_SCALING_SUPPORTED */
  315|       |
  316|       |  /* Hardwire it to "no scaling" */
  317|       |  cinfo->output_width = cinfo->image_width;
  318|       |  cinfo->output_height = cinfo->image_height;
  319|       |  /* jdinput.c has already initialized DCT_scaled_size to DCTSIZE,
  320|       |   * and has computed unscaled downsampled_width and downsampled_height.
  321|       |   */
  322|       |
  323|       |#endif /* IDCT_SCALING_SUPPORTED */
  324|       |
  325|       |  /* Report number of components in selected colorspace. */
  326|       |  /* Probably this should be in the color conversion module... */
  327|  54.4k|  switch (cinfo->out_color_space) {
  328|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (328:3): [True: 0, False: 54.4k]
  ------------------
  329|      0|    cinfo->out_color_components = 1;
  330|      0|    break;
  331|  5.31k|  case JCS_RGB:
  ------------------
  |  Branch (331:3): [True: 5.31k, False: 49.1k]
  ------------------
  332|  5.31k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (332:3): [True: 0, False: 54.4k]
  ------------------
  333|  5.31k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (333:3): [True: 0, False: 54.4k]
  ------------------
  334|  5.31k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (334:3): [True: 0, False: 54.4k]
  ------------------
  335|  5.31k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (335:3): [True: 0, False: 54.4k]
  ------------------
  336|  5.31k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (336:3): [True: 0, False: 54.4k]
  ------------------
  337|  5.31k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (337:3): [True: 0, False: 54.4k]
  ------------------
  338|  5.31k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (338:3): [True: 0, False: 54.4k]
  ------------------
  339|  5.31k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (339:3): [True: 0, False: 54.4k]
  ------------------
  340|  5.31k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (340:3): [True: 0, False: 54.4k]
  ------------------
  341|  5.31k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (341:3): [True: 0, False: 54.4k]
  ------------------
  342|  5.31k|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  343|  5.31k|    break;
  344|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (344:3): [True: 0, False: 54.4k]
  ------------------
  345|      0|  case JCS_RGB565:
  ------------------
  |  Branch (345:3): [True: 0, False: 54.4k]
  ------------------
  346|      0|    cinfo->out_color_components = 3;
  347|      0|    break;
  348|      0|  case JCS_CMYK:
  ------------------
  |  Branch (348:3): [True: 0, False: 54.4k]
  ------------------
  349|      0|  case JCS_YCCK:
  ------------------
  |  Branch (349:3): [True: 0, False: 54.4k]
  ------------------
  350|      0|    cinfo->out_color_components = 4;
  351|      0|    break;
  352|  49.1k|  default:                      /* else must be same colorspace as in file */
  ------------------
  |  Branch (352:3): [True: 49.1k, False: 5.31k]
  ------------------
  353|  49.1k|    cinfo->out_color_components = cinfo->num_components;
  354|  49.1k|    break;
  355|  54.4k|  }
  356|  54.4k|  cinfo->output_components = (cinfo->quantize_colors ? 1 :
  ------------------
  |  Branch (356:31): [True: 0, False: 54.4k]
  ------------------
  357|  54.4k|                              cinfo->out_color_components);
  358|       |
  359|       |  /* See if upsampler will want to emit more than one row at a time */
  360|  54.4k|  if (use_merged_upsample(cinfo))
  ------------------
  |  Branch (360:7): [True: 0, False: 54.4k]
  ------------------
  361|      0|    cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
  362|  54.4k|  else
  363|  54.4k|    cinfo->rec_outbuf_height = 1;
  364|  54.4k|}
jinit_master_decompress:
  716|  54.4k|{
  717|  54.4k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  718|       |
  719|  54.4k|  master->pub.prepare_for_output_pass = prepare_for_output_pass;
  720|  54.4k|  master->pub.finish_output_pass = finish_output_pass;
  721|       |
  722|  54.4k|  master->pub.is_dummy_pass = FALSE;
  ------------------
  |  |  206|  54.4k|#define FALSE   0               /* values of boolean */
  ------------------
  723|  54.4k|  master->pub.jinit_upsampler_no_alloc = FALSE;
  ------------------
  |  |  206|  54.4k|#define FALSE   0               /* values of boolean */
  ------------------
  724|       |
  725|  54.4k|  master_selection(cinfo);
  726|  54.4k|}
jdmaster.c:jpeg_core_output_dimensions:
   95|  54.4k|{
   96|  54.4k|#ifdef IDCT_SCALING_SUPPORTED
   97|  54.4k|  int ci;
   98|  54.4k|  jpeg_component_info *compptr;
   99|       |
  100|       |  /* Compute actual output image dimensions and DCT scaling choices. */
  101|  54.4k|  if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom) {
  ------------------
  |  |   46|  54.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (101:7): [True: 0, False: 54.4k]
  ------------------
  102|       |    /* Provide 1/block_size scaling */
  103|      0|    cinfo->output_width = (JDIMENSION)
  104|      0|      jdiv_round_up((long)cinfo->image_width, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  105|      0|    cinfo->output_height = (JDIMENSION)
  106|      0|      jdiv_round_up((long)cinfo->image_height, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  107|      0|    cinfo->_min_DCT_h_scaled_size = 1;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  108|      0|    cinfo->_min_DCT_v_scaled_size = 1;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  109|  54.4k|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 2) {
  ------------------
  |  |   46|  54.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (109:14): [True: 0, False: 54.4k]
  ------------------
  110|       |    /* Provide 2/block_size scaling */
  111|      0|    cinfo->output_width = (JDIMENSION)
  112|      0|      jdiv_round_up((long)cinfo->image_width * 2L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  113|      0|    cinfo->output_height = (JDIMENSION)
  114|      0|      jdiv_round_up((long)cinfo->image_height * 2L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  115|      0|    cinfo->_min_DCT_h_scaled_size = 2;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  116|      0|    cinfo->_min_DCT_v_scaled_size = 2;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  117|  54.4k|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 3) {
  ------------------
  |  |   46|  54.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (117:14): [True: 0, False: 54.4k]
  ------------------
  118|       |    /* Provide 3/block_size scaling */
  119|      0|    cinfo->output_width = (JDIMENSION)
  120|      0|      jdiv_round_up((long)cinfo->image_width * 3L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  121|      0|    cinfo->output_height = (JDIMENSION)
  122|      0|      jdiv_round_up((long)cinfo->image_height * 3L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  123|      0|    cinfo->_min_DCT_h_scaled_size = 3;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  124|      0|    cinfo->_min_DCT_v_scaled_size = 3;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  125|  54.4k|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 4) {
  ------------------
  |  |   46|  54.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (125:14): [True: 0, False: 54.4k]
  ------------------
  126|       |    /* Provide 4/block_size scaling */
  127|      0|    cinfo->output_width = (JDIMENSION)
  128|      0|      jdiv_round_up((long)cinfo->image_width * 4L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  129|      0|    cinfo->output_height = (JDIMENSION)
  130|      0|      jdiv_round_up((long)cinfo->image_height * 4L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  131|      0|    cinfo->_min_DCT_h_scaled_size = 4;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  132|      0|    cinfo->_min_DCT_v_scaled_size = 4;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  133|  54.4k|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 5) {
  ------------------
  |  |   46|  54.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (133:14): [True: 0, False: 54.4k]
  ------------------
  134|       |    /* Provide 5/block_size scaling */
  135|      0|    cinfo->output_width = (JDIMENSION)
  136|      0|      jdiv_round_up((long)cinfo->image_width * 5L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  137|      0|    cinfo->output_height = (JDIMENSION)
  138|      0|      jdiv_round_up((long)cinfo->image_height * 5L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  139|      0|    cinfo->_min_DCT_h_scaled_size = 5;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  140|      0|    cinfo->_min_DCT_v_scaled_size = 5;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  141|  54.4k|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 6) {
  ------------------
  |  |   46|  54.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (141:14): [True: 0, False: 54.4k]
  ------------------
  142|       |    /* Provide 6/block_size scaling */
  143|      0|    cinfo->output_width = (JDIMENSION)
  144|      0|      jdiv_round_up((long)cinfo->image_width * 6L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  145|      0|    cinfo->output_height = (JDIMENSION)
  146|      0|      jdiv_round_up((long)cinfo->image_height * 6L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  147|      0|    cinfo->_min_DCT_h_scaled_size = 6;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  148|      0|    cinfo->_min_DCT_v_scaled_size = 6;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  149|  54.4k|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 7) {
  ------------------
  |  |   46|  54.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (149:14): [True: 0, False: 54.4k]
  ------------------
  150|       |    /* Provide 7/block_size scaling */
  151|      0|    cinfo->output_width = (JDIMENSION)
  152|      0|      jdiv_round_up((long)cinfo->image_width * 7L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  153|      0|    cinfo->output_height = (JDIMENSION)
  154|      0|      jdiv_round_up((long)cinfo->image_height * 7L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  155|      0|    cinfo->_min_DCT_h_scaled_size = 7;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  156|      0|    cinfo->_min_DCT_v_scaled_size = 7;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  157|  54.4k|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 8) {
  ------------------
  |  |   46|  54.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (157:14): [True: 54.4k, False: 0]
  ------------------
  158|       |    /* Provide 8/block_size scaling */
  159|  54.4k|    cinfo->output_width = (JDIMENSION)
  160|  54.4k|      jdiv_round_up((long)cinfo->image_width * 8L, (long)DCTSIZE);
  ------------------
  |  |   46|  54.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  161|  54.4k|    cinfo->output_height = (JDIMENSION)
  162|  54.4k|      jdiv_round_up((long)cinfo->image_height * 8L, (long)DCTSIZE);
  ------------------
  |  |   46|  54.4k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  163|  54.4k|    cinfo->_min_DCT_h_scaled_size = 8;
  ------------------
  |  |   28|  54.4k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  164|  54.4k|    cinfo->_min_DCT_v_scaled_size = 8;
  ------------------
  |  |   29|  54.4k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  165|  54.4k|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 9) {
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (165:14): [True: 0, False: 0]
  ------------------
  166|       |    /* Provide 9/block_size scaling */
  167|      0|    cinfo->output_width = (JDIMENSION)
  168|      0|      jdiv_round_up((long)cinfo->image_width * 9L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  169|      0|    cinfo->output_height = (JDIMENSION)
  170|      0|      jdiv_round_up((long)cinfo->image_height * 9L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  171|      0|    cinfo->_min_DCT_h_scaled_size = 9;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  172|      0|    cinfo->_min_DCT_v_scaled_size = 9;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  173|      0|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 10) {
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (173:14): [True: 0, False: 0]
  ------------------
  174|       |    /* Provide 10/block_size scaling */
  175|      0|    cinfo->output_width = (JDIMENSION)
  176|      0|      jdiv_round_up((long)cinfo->image_width * 10L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  177|      0|    cinfo->output_height = (JDIMENSION)
  178|      0|      jdiv_round_up((long)cinfo->image_height * 10L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  179|      0|    cinfo->_min_DCT_h_scaled_size = 10;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  180|      0|    cinfo->_min_DCT_v_scaled_size = 10;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  181|      0|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 11) {
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (181:14): [True: 0, False: 0]
  ------------------
  182|       |    /* Provide 11/block_size scaling */
  183|      0|    cinfo->output_width = (JDIMENSION)
  184|      0|      jdiv_round_up((long)cinfo->image_width * 11L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  185|      0|    cinfo->output_height = (JDIMENSION)
  186|      0|      jdiv_round_up((long)cinfo->image_height * 11L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  187|      0|    cinfo->_min_DCT_h_scaled_size = 11;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  188|      0|    cinfo->_min_DCT_v_scaled_size = 11;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  189|      0|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 12) {
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (189:14): [True: 0, False: 0]
  ------------------
  190|       |    /* Provide 12/block_size scaling */
  191|      0|    cinfo->output_width = (JDIMENSION)
  192|      0|      jdiv_round_up((long)cinfo->image_width * 12L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  193|      0|    cinfo->output_height = (JDIMENSION)
  194|      0|      jdiv_round_up((long)cinfo->image_height * 12L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  195|      0|    cinfo->_min_DCT_h_scaled_size = 12;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  196|      0|    cinfo->_min_DCT_v_scaled_size = 12;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  197|      0|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 13) {
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (197:14): [True: 0, False: 0]
  ------------------
  198|       |    /* Provide 13/block_size scaling */
  199|      0|    cinfo->output_width = (JDIMENSION)
  200|      0|      jdiv_round_up((long)cinfo->image_width * 13L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  201|      0|    cinfo->output_height = (JDIMENSION)
  202|      0|      jdiv_round_up((long)cinfo->image_height * 13L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  203|      0|    cinfo->_min_DCT_h_scaled_size = 13;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  204|      0|    cinfo->_min_DCT_v_scaled_size = 13;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  205|      0|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 14) {
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (205:14): [True: 0, False: 0]
  ------------------
  206|       |    /* Provide 14/block_size scaling */
  207|      0|    cinfo->output_width = (JDIMENSION)
  208|      0|      jdiv_round_up((long)cinfo->image_width * 14L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  209|      0|    cinfo->output_height = (JDIMENSION)
  210|      0|      jdiv_round_up((long)cinfo->image_height * 14L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  211|      0|    cinfo->_min_DCT_h_scaled_size = 14;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  212|      0|    cinfo->_min_DCT_v_scaled_size = 14;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  213|      0|  } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 15) {
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (213:14): [True: 0, False: 0]
  ------------------
  214|       |    /* Provide 15/block_size scaling */
  215|      0|    cinfo->output_width = (JDIMENSION)
  216|      0|      jdiv_round_up((long)cinfo->image_width * 15L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  217|      0|    cinfo->output_height = (JDIMENSION)
  218|      0|      jdiv_round_up((long)cinfo->image_height * 15L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  219|      0|    cinfo->_min_DCT_h_scaled_size = 15;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  220|      0|    cinfo->_min_DCT_v_scaled_size = 15;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  221|      0|  } else {
  222|       |    /* Provide 16/block_size scaling */
  223|      0|    cinfo->output_width = (JDIMENSION)
  224|      0|      jdiv_round_up((long)cinfo->image_width * 16L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  225|      0|    cinfo->output_height = (JDIMENSION)
  226|      0|      jdiv_round_up((long)cinfo->image_height * 16L, (long)DCTSIZE);
  ------------------
  |  |   46|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  227|      0|    cinfo->_min_DCT_h_scaled_size = 16;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  228|      0|    cinfo->_min_DCT_v_scaled_size = 16;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  229|      0|  }
  230|       |
  231|       |  /* Recompute dimensions of components */
  232|   125k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (232:44): [True: 71.0k, False: 54.4k]
  ------------------
  233|  71.0k|       ci++, compptr++) {
  234|  71.0k|    compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   25|  71.0k|#define _DCT_h_scaled_size  DCT_scaled_size
  ------------------
                  compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   28|  71.0k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  235|  71.0k|    compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   26|  71.0k|#define _DCT_v_scaled_size  DCT_scaled_size
  ------------------
                  compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   29|  71.0k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  236|  71.0k|  }
  237|       |
  238|       |#else /* !IDCT_SCALING_SUPPORTED */
  239|       |
  240|       |  /* Hardwire it to "no scaling" */
  241|       |  cinfo->output_width = cinfo->image_width;
  242|       |  cinfo->output_height = cinfo->image_height;
  243|       |  /* jdinput.c has already initialized DCT_scaled_size,
  244|       |   * and has computed unscaled downsampled_width and downsampled_height.
  245|       |   */
  246|       |
  247|       |#endif /* IDCT_SCALING_SUPPORTED */
  248|  54.4k|}
jdmaster.c:use_merged_upsample:
   34|   108k|{
   35|   108k|#ifdef UPSAMPLE_MERGING_SUPPORTED
   36|       |  /* Merging is the equivalent of plain box-filter upsampling */
   37|   108k|  if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)
  ------------------
  |  Branch (37:7): [True: 108k, False: 0]
  |  Branch (37:37): [True: 0, False: 0]
  ------------------
   38|   108k|    return FALSE;
  ------------------
  |  |  206|   108k|#define FALSE   0               /* values of boolean */
  ------------------
   39|       |  /* jdmerge.c only supports YCC=>RGB and YCC=>RGB565 color conversion */
   40|      0|  if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 ||
  ------------------
  |  Branch (40:7): [True: 0, False: 0]
  |  Branch (40:47): [True: 0, False: 0]
  ------------------
   41|      0|      (cinfo->out_color_space != JCS_RGB &&
  ------------------
  |  Branch (41:8): [True: 0, False: 0]
  ------------------
   42|      0|       cinfo->out_color_space != JCS_RGB565 &&
  ------------------
  |  Branch (42:8): [True: 0, False: 0]
  ------------------
   43|      0|       cinfo->out_color_space != JCS_EXT_RGB &&
  ------------------
  |  Branch (43:8): [True: 0, False: 0]
  ------------------
   44|      0|       cinfo->out_color_space != JCS_EXT_RGBX &&
  ------------------
  |  Branch (44:8): [True: 0, False: 0]
  ------------------
   45|      0|       cinfo->out_color_space != JCS_EXT_BGR &&
  ------------------
  |  Branch (45:8): [True: 0, False: 0]
  ------------------
   46|      0|       cinfo->out_color_space != JCS_EXT_BGRX &&
  ------------------
  |  Branch (46:8): [True: 0, False: 0]
  ------------------
   47|      0|       cinfo->out_color_space != JCS_EXT_XBGR &&
  ------------------
  |  Branch (47:8): [True: 0, False: 0]
  ------------------
   48|      0|       cinfo->out_color_space != JCS_EXT_XRGB &&
  ------------------
  |  Branch (48:8): [True: 0, False: 0]
  ------------------
   49|      0|       cinfo->out_color_space != JCS_EXT_RGBA &&
  ------------------
  |  Branch (49:8): [True: 0, False: 0]
  ------------------
   50|      0|       cinfo->out_color_space != JCS_EXT_BGRA &&
  ------------------
  |  Branch (50:8): [True: 0, False: 0]
  ------------------
   51|      0|       cinfo->out_color_space != JCS_EXT_ABGR &&
  ------------------
  |  Branch (51:8): [True: 0, False: 0]
  ------------------
   52|      0|       cinfo->out_color_space != JCS_EXT_ARGB))
  ------------------
  |  Branch (52:8): [True: 0, False: 0]
  ------------------
   53|      0|    return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
   54|      0|  if ((cinfo->out_color_space == JCS_RGB565 &&
  ------------------
  |  Branch (54:8): [True: 0, False: 0]
  ------------------
   55|      0|       cinfo->out_color_components != 3) ||
  ------------------
  |  Branch (55:8): [True: 0, False: 0]
  ------------------
   56|      0|      (cinfo->out_color_space != JCS_RGB565 &&
  ------------------
  |  Branch (56:8): [True: 0, False: 0]
  ------------------
   57|      0|       cinfo->out_color_components != rgb_pixelsize[cinfo->out_color_space]))
  ------------------
  |  Branch (57:8): [True: 0, False: 0]
  ------------------
   58|      0|    return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
   59|       |  /* and it only handles 2h1v or 2h2v sampling ratios */
   60|      0|  if (cinfo->comp_info[0].h_samp_factor != 2 ||
  ------------------
  |  Branch (60:7): [True: 0, False: 0]
  ------------------
   61|      0|      cinfo->comp_info[1].h_samp_factor != 1 ||
  ------------------
  |  Branch (61:7): [True: 0, False: 0]
  ------------------
   62|      0|      cinfo->comp_info[2].h_samp_factor != 1 ||
  ------------------
  |  Branch (62:7): [True: 0, False: 0]
  ------------------
   63|      0|      cinfo->comp_info[0].v_samp_factor >  2 ||
  ------------------
  |  Branch (63:7): [True: 0, False: 0]
  ------------------
   64|      0|      cinfo->comp_info[1].v_samp_factor != 1 ||
  ------------------
  |  Branch (64:7): [True: 0, False: 0]
  ------------------
   65|      0|      cinfo->comp_info[2].v_samp_factor != 1)
  ------------------
  |  Branch (65:7): [True: 0, False: 0]
  ------------------
   66|      0|    return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
   67|       |  /* furthermore, it doesn't work if we've scaled the IDCTs differently */
   68|      0|  if (cinfo->comp_info[0]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   24|      0|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
                if (cinfo->comp_info[0]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (68:7): [True: 0, False: 0]
  ------------------
   69|      0|      cinfo->comp_info[1]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   24|      0|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
                    cinfo->comp_info[1]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (69:7): [True: 0, False: 0]
  ------------------
   70|      0|      cinfo->comp_info[2]._DCT_scaled_size != cinfo->_min_DCT_scaled_size)
  ------------------
  |  |   24|      0|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
                    cinfo->comp_info[2]._DCT_scaled_size != cinfo->_min_DCT_scaled_size)
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (70:7): [True: 0, False: 0]
  ------------------
   71|      0|    return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
   72|       |  /* ??? also need to test for upsample-time rescaling, when & if supported */
   73|      0|  return TRUE;                  /* by golly, it'll work... */
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
   74|       |#else
   75|       |  return FALSE;
   76|       |#endif
   77|      0|}
jdmaster.c:prepare_for_output_pass:
  611|  46.6k|{
  612|  46.6k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  613|       |
  614|  46.6k|  if (master->pub.is_dummy_pass) {
  ------------------
  |  Branch (614:7): [True: 0, False: 46.6k]
  ------------------
  615|      0|#ifdef QUANT_2PASS_SUPPORTED
  616|       |    /* Final pass of 2-pass quantization */
  617|      0|    master->pub.is_dummy_pass = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  618|      0|    (*cinfo->cquantize->start_pass) (cinfo, FALSE);
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  619|      0|    (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST);
  620|      0|    (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST);
  621|       |#else
  622|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  623|       |#endif /* QUANT_2PASS_SUPPORTED */
  624|  46.6k|  } else {
  625|  46.6k|    if (cinfo->quantize_colors && cinfo->colormap == NULL) {
  ------------------
  |  Branch (625:9): [True: 0, False: 46.6k]
  |  Branch (625:35): [True: 0, False: 0]
  ------------------
  626|       |      /* Select new quantization method */
  627|      0|      if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) {
  ------------------
  |  Branch (627:11): [True: 0, False: 0]
  |  Branch (627:39): [True: 0, False: 0]
  ------------------
  628|      0|        cinfo->cquantize = master->quantizer_2pass;
  629|      0|        master->pub.is_dummy_pass = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  630|      0|      } else if (cinfo->enable_1pass_quant) {
  ------------------
  |  Branch (630:18): [True: 0, False: 0]
  ------------------
  631|      0|        cinfo->cquantize = master->quantizer_1pass;
  632|      0|      } else {
  633|      0|        ERREXIT(cinfo, JERR_MODE_CHANGE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  634|      0|      }
  635|      0|    }
  636|  46.6k|    (*cinfo->idct->start_pass) (cinfo);
  637|  46.6k|    (*cinfo->coef->start_output_pass) (cinfo);
  638|  46.6k|    if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (638:9): [True: 46.5k, False: 169]
  ------------------
  639|  46.5k|      if (!master->using_merged_upsample)
  ------------------
  |  Branch (639:11): [True: 46.5k, False: 0]
  ------------------
  640|  46.5k|        (*cinfo->cconvert->start_pass) (cinfo);
  641|  46.5k|      (*cinfo->upsample->start_pass) (cinfo);
  642|  46.5k|      if (cinfo->quantize_colors)
  ------------------
  |  Branch (642:11): [True: 0, False: 46.5k]
  ------------------
  643|      0|        (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass);
  644|  46.5k|      (*cinfo->post->start_pass) (cinfo,
  645|  46.5k|            (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
  ------------------
  |  Branch (645:14): [True: 0, False: 46.5k]
  ------------------
  646|  46.5k|      (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
  647|  46.5k|    }
  648|  46.6k|  }
  649|       |
  650|       |  /* Set up progress monitor's pass info if present */
  651|  46.6k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (651:7): [True: 32.4k, False: 14.2k]
  ------------------
  652|  32.4k|    cinfo->progress->completed_passes = master->pass_number;
  653|  32.4k|    cinfo->progress->total_passes = master->pass_number +
  654|  32.4k|                                    (master->pub.is_dummy_pass ? 2 : 1);
  ------------------
  |  Branch (654:38): [True: 0, False: 32.4k]
  ------------------
  655|       |    /* In buffered-image mode, we assume one more output pass if EOI not
  656|       |     * yet reached, but no more passes if EOI has been reached.
  657|       |     */
  658|  32.4k|    if (cinfo->buffered_image && !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (658:9): [True: 0, False: 32.4k]
  |  Branch (658:34): [True: 0, False: 0]
  ------------------
  659|      0|      cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1);
  ------------------
  |  Branch (659:41): [True: 0, False: 0]
  ------------------
  660|      0|    }
  661|  32.4k|  }
  662|  46.6k|}
jdmaster.c:finish_output_pass:
  671|  32.3k|{
  672|  32.3k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  673|       |
  674|  32.3k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (674:7): [True: 0, False: 32.3k]
  ------------------
  675|      0|    (*cinfo->cquantize->finish_pass) (cinfo);
  676|  32.3k|  master->pass_number++;
  677|  32.3k|}
jdmaster.c:master_selection:
  449|  54.4k|{
  450|  54.4k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  451|  54.4k|  boolean use_c_buffer;
  452|  54.4k|  long samplesperrow;
  453|  54.4k|  JDIMENSION jd_samplesperrow;
  454|       |
  455|       |  /* Initialize dimensions and other stuff */
  456|  54.4k|  jpeg_calc_output_dimensions(cinfo);
  457|  54.4k|  prepare_range_limit_table(cinfo);
  458|       |
  459|       |  /* Width of an output scanline must be representable as JDIMENSION. */
  460|  54.4k|  samplesperrow = (long)cinfo->output_width *
  461|  54.4k|                  (long)cinfo->out_color_components;
  462|  54.4k|  jd_samplesperrow = (JDIMENSION)samplesperrow;
  463|  54.4k|  if ((long)jd_samplesperrow != samplesperrow)
  ------------------
  |  Branch (463:7): [True: 0, False: 54.4k]
  ------------------
  464|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  465|       |
  466|       |  /* Initialize my private state */
  467|  54.4k|  master->pass_number = 0;
  468|  54.4k|  master->using_merged_upsample = use_merged_upsample(cinfo);
  469|       |
  470|       |  /* Color quantizer selection */
  471|  54.4k|  master->quantizer_1pass = NULL;
  472|  54.4k|  master->quantizer_2pass = NULL;
  473|       |  /* No mode changes if not using buffered-image mode. */
  474|  54.4k|  if (!cinfo->quantize_colors || !cinfo->buffered_image) {
  ------------------
  |  Branch (474:7): [True: 54.4k, False: 0]
  |  Branch (474:34): [True: 0, False: 0]
  ------------------
  475|  54.4k|    cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  206|  54.4k|#define FALSE   0               /* values of boolean */
  ------------------
  476|  54.4k|    cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  206|  54.4k|#define FALSE   0               /* values of boolean */
  ------------------
  477|  54.4k|    cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  206|  54.4k|#define FALSE   0               /* values of boolean */
  ------------------
  478|  54.4k|  }
  479|  54.4k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (479:7): [True: 0, False: 54.4k]
  ------------------
  480|      0|    if (cinfo->raw_data_out)
  ------------------
  |  Branch (480:9): [True: 0, False: 0]
  ------------------
  481|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  482|       |    /* 2-pass quantizer only works in 3-component color space. */
  483|      0|    if (cinfo->out_color_components != 3) {
  ------------------
  |  Branch (483:9): [True: 0, False: 0]
  ------------------
  484|      0|      cinfo->enable_1pass_quant = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  485|      0|      cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  486|      0|      cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  487|      0|      cinfo->colormap = NULL;
  488|      0|    } else if (cinfo->colormap != NULL) {
  ------------------
  |  Branch (488:16): [True: 0, False: 0]
  ------------------
  489|      0|      cinfo->enable_external_quant = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  490|      0|    } else if (cinfo->two_pass_quantize) {
  ------------------
  |  Branch (490:16): [True: 0, False: 0]
  ------------------
  491|      0|      cinfo->enable_2pass_quant = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  492|      0|    } else {
  493|      0|      cinfo->enable_1pass_quant = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  494|      0|    }
  495|       |
  496|      0|    if (cinfo->enable_1pass_quant) {
  ------------------
  |  Branch (496:9): [True: 0, False: 0]
  ------------------
  497|      0|#ifdef QUANT_1PASS_SUPPORTED
  498|      0|      jinit_1pass_quantizer(cinfo);
  499|      0|      master->quantizer_1pass = cinfo->cquantize;
  500|       |#else
  501|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  502|       |#endif
  503|      0|    }
  504|       |
  505|       |    /* We use the 2-pass code to map to external colormaps. */
  506|      0|    if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) {
  ------------------
  |  Branch (506:9): [True: 0, False: 0]
  |  Branch (506:38): [True: 0, False: 0]
  ------------------
  507|      0|#ifdef QUANT_2PASS_SUPPORTED
  508|      0|      jinit_2pass_quantizer(cinfo);
  509|      0|      master->quantizer_2pass = cinfo->cquantize;
  510|       |#else
  511|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  512|       |#endif
  513|      0|    }
  514|       |    /* If both quantizers are initialized, the 2-pass one is left active;
  515|       |     * this is necessary for starting with quantization to an external map.
  516|       |     */
  517|      0|  }
  518|       |
  519|       |  /* Post-processing: in particular, color conversion first */
  520|  54.4k|  if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (520:7): [True: 54.3k, False: 178]
  ------------------
  521|  54.3k|    if (master->using_merged_upsample) {
  ------------------
  |  Branch (521:9): [True: 0, False: 54.3k]
  ------------------
  522|      0|#ifdef UPSAMPLE_MERGING_SUPPORTED
  523|      0|      jinit_merged_upsampler(cinfo); /* does color conversion too */
  524|       |#else
  525|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  526|       |#endif
  527|  54.3k|    } else {
  528|  54.3k|      jinit_color_deconverter(cinfo);
  529|  54.3k|      jinit_upsampler(cinfo);
  530|  54.3k|    }
  531|  54.3k|    jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  532|  54.3k|  }
  533|       |  /* Inverse DCT */
  534|  54.4k|  jinit_inverse_dct(cinfo);
  535|       |  /* Entropy decoding: either Huffman or arithmetic coding. */
  536|  54.4k|  if (cinfo->arith_code) {
  ------------------
  |  Branch (536:7): [True: 20.8k, False: 33.6k]
  ------------------
  537|  20.8k|#ifdef D_ARITH_CODING_SUPPORTED
  538|  20.8k|    jinit_arith_decoder(cinfo);
  539|       |#else
  540|       |    ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  541|       |#endif
  542|  33.6k|  } else {
  543|  33.6k|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (543:9): [True: 6.99k, False: 26.6k]
  ------------------
  544|  6.99k|#ifdef D_PROGRESSIVE_SUPPORTED
  545|  6.99k|      jinit_phuff_decoder(cinfo);
  546|       |#else
  547|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  548|       |#endif
  549|  6.99k|    } else
  550|  26.6k|      jinit_huff_decoder(cinfo);
  551|  33.6k|  }
  552|       |
  553|       |  /* Initialize principal buffer controllers. */
  554|  54.4k|  use_c_buffer = cinfo->inputctl->has_multiple_scans || cinfo->buffered_image;
  ------------------
  |  Branch (554:18): [True: 22.1k, False: 32.3k]
  |  Branch (554:57): [True: 0, False: 32.3k]
  ------------------
  555|  54.4k|  jinit_d_coef_controller(cinfo, use_c_buffer);
  556|       |
  557|  54.4k|  if (!cinfo->raw_data_out)
  ------------------
  |  Branch (557:7): [True: 54.2k, False: 181]
  ------------------
  558|  54.2k|    jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  206|  54.2k|#define FALSE   0               /* values of boolean */
  ------------------
  559|       |
  560|       |  /* We can now tell the memory manager to allocate virtual arrays. */
  561|  54.4k|  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
  562|       |
  563|       |  /* Initialize input side of decompressor to consume first scan. */
  564|  54.4k|  (*cinfo->inputctl->start_input_pass) (cinfo);
  565|       |
  566|       |  /* Set the first and last iMCU columns to decompress from single-scan images.
  567|       |   * By default, decompress all of the iMCU columns.
  568|       |   */
  569|  54.4k|  cinfo->master->first_iMCU_col = 0;
  570|  54.4k|  cinfo->master->last_iMCU_col = cinfo->MCUs_per_row - 1;
  571|  54.4k|  cinfo->master->last_good_iMCU_row = 0;
  572|       |
  573|  54.4k|#ifdef D_MULTISCAN_FILES_SUPPORTED
  574|       |  /* If jpeg_start_decompress will read the whole file, initialize
  575|       |   * progress monitoring appropriately.  The input step is counted
  576|       |   * as one pass.
  577|       |   */
  578|  54.4k|  if (cinfo->progress != NULL && !cinfo->buffered_image &&
  ------------------
  |  Branch (578:7): [True: 37.3k, False: 17.1k]
  |  Branch (578:34): [True: 37.3k, False: 0]
  ------------------
  579|  54.4k|      cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (579:7): [True: 20.4k, False: 16.9k]
  ------------------
  580|  20.4k|    int nscans;
  581|       |    /* Estimate number of scans to set pass_limit. */
  582|  20.4k|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (582:9): [True: 15.8k, False: 4.58k]
  ------------------
  583|       |      /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
  584|  15.8k|      nscans = 2 + 3 * cinfo->num_components;
  585|  15.8k|    } else {
  586|       |      /* For a nonprogressive multiscan file, estimate 1 scan per component. */
  587|  4.58k|      nscans = cinfo->num_components;
  588|  4.58k|    }
  589|  20.4k|    cinfo->progress->pass_counter = 0L;
  590|  20.4k|    cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows * nscans;
  591|  20.4k|    cinfo->progress->completed_passes = 0;
  592|  20.4k|    cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);
  ------------------
  |  Branch (592:38): [True: 0, False: 20.4k]
  ------------------
  593|       |    /* Count the input pass as done */
  594|  20.4k|    master->pass_number++;
  595|  20.4k|  }
  596|  54.4k|#endif /* D_MULTISCAN_FILES_SUPPORTED */
  597|  54.4k|}
jdmaster.c:prepare_range_limit_table:
  410|  54.4k|{
  411|  54.4k|  JSAMPLE *table;
  412|  54.4k|  int i;
  413|       |
  414|  54.4k|  table = (JSAMPLE *)
  415|  54.4k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  54.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  416|  54.4k|                (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   51|  54.4k|#define MAXJSAMPLE      255
  ------------------
                              (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  54.4k|#define CENTERJSAMPLE   128
  ------------------
  417|  54.4k|  table += (MAXJSAMPLE + 1);    /* allow negative subscripts of simple table */
  ------------------
  |  |   51|  54.4k|#define MAXJSAMPLE      255
  ------------------
  418|  54.4k|  cinfo->sample_range_limit = table;
  419|       |  /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  420|  54.4k|  memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   51|  54.4k|#define MAXJSAMPLE      255
  ------------------
                memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   51|  54.4k|#define MAXJSAMPLE      255
  ------------------
  421|       |  /* Main part of "simple" table: limit[x] = x */
  422|  14.0M|  for (i = 0; i <= MAXJSAMPLE; i++)
  ------------------
  |  |   51|  14.0M|#define MAXJSAMPLE      255
  ------------------
  |  Branch (422:15): [True: 13.9M, False: 54.4k]
  ------------------
  423|  13.9M|    table[i] = (JSAMPLE)i;
  424|  54.4k|  table += CENTERJSAMPLE;       /* Point to where post-IDCT table starts */
  ------------------
  |  |   52|  54.4k|#define CENTERJSAMPLE   128
  ------------------
  425|       |  /* End of simple table, rest of first half of post-IDCT table */
  426|  20.9M|  for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   52|  54.4k|#define CENTERJSAMPLE   128
  ------------------
                for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   51|  20.9M|#define MAXJSAMPLE      255
  ------------------
  |  Branch (426:27): [True: 20.9M, False: 54.4k]
  ------------------
  427|  20.9M|    table[i] = MAXJSAMPLE;
  ------------------
  |  |   51|  20.9M|#define MAXJSAMPLE      255
  ------------------
  428|       |  /* Second half of post-IDCT table */
  429|  54.4k|  memset(table + (2 * (MAXJSAMPLE + 1)), 0,
  ------------------
  |  |   51|  54.4k|#define MAXJSAMPLE      255
  ------------------
  430|  54.4k|         (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   51|  54.4k|#define MAXJSAMPLE      255
  ------------------
                       (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  54.4k|#define CENTERJSAMPLE   128
  ------------------
  431|  54.4k|  memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   51|  54.4k|#define MAXJSAMPLE      255
  ------------------
                memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   52|  54.4k|#define CENTERJSAMPLE   128
  ------------------
  432|  54.4k|         cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE));
  ------------------
  |  |   52|  54.4k|#define CENTERJSAMPLE   128
  ------------------
  433|  54.4k|}

jinit_phuff_decoder:
  652|  6.99k|{
  653|  6.99k|  phuff_entropy_ptr entropy;
  654|  6.99k|  int *coef_bit_ptr;
  655|  6.99k|  int ci, i;
  656|       |
  657|  6.99k|  entropy = (phuff_entropy_ptr)
  658|  6.99k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  6.99k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  659|  6.99k|                                sizeof(phuff_entropy_decoder));
  660|  6.99k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  661|  6.99k|  entropy->pub.start_pass = start_pass_phuff_decoder;
  662|       |
  663|       |  /* Mark derived tables unallocated */
  664|  34.9k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   49|  34.9k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (664:15): [True: 27.9k, False: 6.99k]
  ------------------
  665|  27.9k|    entropy->derived_tbls[i] = NULL;
  666|  27.9k|  }
  667|       |
  668|       |  /* Create progression status table */
  669|  6.99k|  cinfo->coef_bits = (int (*)[DCTSIZE2])
  670|  6.99k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  6.99k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  671|  6.99k|                                cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   47|  6.99k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  672|  6.99k|                                sizeof(int));
  673|  6.99k|  coef_bit_ptr = &cinfo->coef_bits[0][0];
  674|  15.7k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (674:16): [True: 8.72k, False: 6.99k]
  ------------------
  675|   567k|    for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   47|   567k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (675:17): [True: 558k, False: 8.72k]
  ------------------
  676|   558k|      *coef_bit_ptr++ = -1;
  677|  6.99k|}
jdphuff.c:start_pass_phuff_decoder:
   81|  11.8k|{
   82|  11.8k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
   83|  11.8k|  boolean is_DC_band, bad;
   84|  11.8k|  int ci, coefi, tbl;
   85|  11.8k|  d_derived_tbl **pdtbl;
   86|  11.8k|  int *coef_bit_ptr, *prev_coef_bit_ptr;
   87|  11.8k|  jpeg_component_info *compptr;
   88|       |
   89|  11.8k|  is_DC_band = (cinfo->Ss == 0);
   90|       |
   91|       |  /* Validate scan parameters */
   92|  11.8k|  bad = FALSE;
  ------------------
  |  |  206|  11.8k|#define FALSE   0               /* values of boolean */
  ------------------
   93|  11.8k|  if (is_DC_band) {
  ------------------
  |  Branch (93:7): [True: 3.45k, False: 8.41k]
  ------------------
   94|  3.45k|    if (cinfo->Se != 0)
  ------------------
  |  Branch (94:9): [True: 245, False: 3.21k]
  ------------------
   95|    245|      bad = TRUE;
  ------------------
  |  |  209|    245|#define TRUE    1
  ------------------
   96|  8.41k|  } else {
   97|       |    /* need not check Ss/Se < 0 since they came from unsigned bytes */
   98|  8.41k|    if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
  ------------------
  |  |   47|  8.14k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (98:9): [True: 271, False: 8.14k]
  |  Branch (98:34): [True: 555, False: 7.59k]
  ------------------
   99|    826|      bad = TRUE;
  ------------------
  |  |  209|    826|#define TRUE    1
  ------------------
  100|       |    /* AC scans may have only one component */
  101|  8.41k|    if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (101:9): [True: 93, False: 8.32k]
  ------------------
  102|     93|      bad = TRUE;
  ------------------
  |  |  209|     93|#define TRUE    1
  ------------------
  103|  8.41k|  }
  104|  11.8k|  if (cinfo->Ah != 0) {
  ------------------
  |  Branch (104:7): [True: 6.14k, False: 5.72k]
  ------------------
  105|       |    /* Successive approximation refinement scan: must have Al = Ah-1. */
  106|  6.14k|    if (cinfo->Al != cinfo->Ah - 1)
  ------------------
  |  Branch (106:9): [True: 661, False: 5.48k]
  ------------------
  107|    661|      bad = TRUE;
  ------------------
  |  |  209|    661|#define TRUE    1
  ------------------
  108|  6.14k|  }
  109|  11.8k|  if (cinfo->Al > 13)           /* need not check for < 0 */
  ------------------
  |  Branch (109:7): [True: 636, False: 11.2k]
  ------------------
  110|    636|    bad = TRUE;
  ------------------
  |  |  209|    636|#define TRUE    1
  ------------------
  111|       |  /* Arguably the maximum Al value should be less than 13 for 8-bit precision,
  112|       |   * but the spec doesn't say so, and we try to be liberal about what we
  113|       |   * accept.  Note: large Al values could result in out-of-range DC
  114|       |   * coefficients during early scans, leading to bizarre displays due to
  115|       |   * overflows in the IDCT math.  But we won't crash.
  116|       |   */
  117|  11.8k|  if (bad)
  ------------------
  |  Branch (117:7): [True: 1.21k, False: 10.6k]
  ------------------
  118|  1.21k|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  253|  1.21k|  ((cinfo)->err->msg_code = (code), \
  |  |  254|  1.21k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  255|  1.21k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  256|  1.21k|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  257|  1.21k|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  258|  1.21k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  119|  11.8k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  120|       |  /* Update progression status, and verify that scan order is legal.
  121|       |   * Note that inter-scan inconsistencies are treated as warnings
  122|       |   * not fatal errors ... not clear if this is right way to behave.
  123|       |   */
  124|  24.5k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (124:16): [True: 12.6k, False: 11.8k]
  ------------------
  125|  12.6k|    int cindex = cinfo->cur_comp_info[ci]->component_index;
  126|  12.6k|    coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  127|  12.6k|    prev_coef_bit_ptr = &cinfo->coef_bits[cindex + cinfo->num_components][0];
  128|  12.6k|    if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (128:9): [True: 7.45k, False: 5.18k]
  |  Branch (128:24): [True: 6.57k, False: 881]
  ------------------
  129|  6.57k|      WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  285|  6.57k|  ((cinfo)->err->msg_code = (code), \
  |  |  286|  6.57k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  287|  6.57k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  288|  6.57k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  130|   380k|    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  295|  12.6k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (295:26): [True: 5.18k, False: 7.45k]
  |  |  ------------------
  ------------------
                  for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  293|   380k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (293:26): [True: 314k, False: 66.6k]
  |  |  ------------------
  ------------------
  |  Branch (130:37): [True: 368k, False: 12.6k]
  ------------------
  131|   368k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (131:11): [True: 174k, False: 193k]
  ------------------
  132|   174k|        prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  133|   193k|      else
  134|   193k|        prev_coef_bit_ptr[coefi] = 0;
  135|   368k|    }
  136|   252k|    for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (136:29): [True: 239k, False: 12.6k]
  ------------------
  137|   239k|      int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (137:22): [True: 153k, False: 86.3k]
  ------------------
  138|   239k|      if (cinfo->Ah != expected)
  ------------------
  |  Branch (138:11): [True: 131k, False: 108k]
  ------------------
  139|   131k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  285|   131k|  ((cinfo)->err->msg_code = (code), \
  |  |  286|   131k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  287|   131k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  288|   131k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  140|   239k|      coef_bit_ptr[coefi] = cinfo->Al;
  141|   239k|    }
  142|  12.6k|  }
  143|       |
  144|       |  /* Select MCU decoding routine */
  145|  11.8k|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (145:7): [True: 5.38k, False: 6.49k]
  ------------------
  146|  5.38k|    if (is_DC_band)
  ------------------
  |  Branch (146:9): [True: 1.38k, False: 3.99k]
  ------------------
  147|  1.38k|      entropy->pub.decode_mcu = decode_mcu_DC_first;
  148|  3.99k|    else
  149|  3.99k|      entropy->pub.decode_mcu = decode_mcu_AC_first;
  150|  6.49k|  } else {
  151|  6.49k|    if (is_DC_band)
  ------------------
  |  Branch (151:9): [True: 1.82k, False: 4.66k]
  ------------------
  152|  1.82k|      entropy->pub.decode_mcu = decode_mcu_DC_refine;
  153|  4.66k|    else
  154|  4.66k|      entropy->pub.decode_mcu = decode_mcu_AC_refine;
  155|  6.49k|  }
  156|       |
  157|  24.5k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (157:16): [True: 12.6k, False: 11.8k]
  ------------------
  158|  12.6k|    compptr = cinfo->cur_comp_info[ci];
  159|       |    /* Make sure requested tables are present, and compute derived tables.
  160|       |     * We may build same derived table more than once, but it's not expensive.
  161|       |     */
  162|  12.6k|    if (is_DC_band) {
  ------------------
  |  Branch (162:9): [True: 5.17k, False: 7.45k]
  ------------------
  163|  5.17k|      if (cinfo->Ah == 0) {     /* DC refinement needs no table */
  ------------------
  |  Branch (163:11): [True: 1.38k, False: 3.79k]
  ------------------
  164|  1.38k|        tbl = compptr->dc_tbl_no;
  165|  1.38k|        pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  166|  1.38k|        jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, pdtbl);
  ------------------
  |  |  209|  1.38k|#define TRUE    1
  ------------------
  167|  1.38k|      }
  168|  7.45k|    } else {
  169|  7.45k|      tbl = compptr->ac_tbl_no;
  170|  7.45k|      pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  171|  7.45k|      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, pdtbl);
  ------------------
  |  |  206|  7.45k|#define FALSE   0               /* values of boolean */
  ------------------
  172|       |      /* remember the single active table */
  173|  7.45k|      entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
  174|  7.45k|    }
  175|       |    /* Initialize DC predictions to 0 */
  176|  12.6k|    entropy->saved.last_dc_val[ci] = 0;
  177|  12.6k|  }
  178|       |
  179|       |  /* Initialize bitread state variables */
  180|  11.8k|  entropy->bitstate.bits_left = 0;
  181|  11.8k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  182|  11.8k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  11.8k|#define FALSE   0               /* values of boolean */
  ------------------
  183|       |
  184|       |  /* Initialize private state variables */
  185|  11.8k|  entropy->saved.EOBRUN = 0;
  186|       |
  187|       |  /* Initialize restart counter */
  188|  11.8k|  entropy->restarts_to_go = cinfo->restart_interval;
  189|  11.8k|}
jdphuff.c:decode_mcu_DC_first:
  289|  9.63M|{
  290|  9.63M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  291|  9.63M|  int Al = cinfo->Al;
  292|  9.63M|  register int s, r;
  293|  9.63M|  int blkn, ci;
  294|  9.63M|  JBLOCKROW block;
  295|  9.63M|  BITREAD_STATE_VARS;
  ------------------
  |  |  122|  9.63M|  register bit_buf_type get_buffer; \
  |  |  123|  9.63M|  register int bits_left; \
  |  |  124|  9.63M|  bitread_working_state br_state
  ------------------
  296|  9.63M|  savable_state state;
  297|  9.63M|  d_derived_tbl *tbl;
  298|  9.63M|  jpeg_component_info *compptr;
  299|       |
  300|       |  /* Process restart marker if needed; may have to suspend */
  301|  9.63M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (301:7): [True: 25.9k, False: 9.61M]
  ------------------
  302|  25.9k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (302:9): [True: 14.7k, False: 11.1k]
  ------------------
  303|  14.7k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (303:11): [True: 0, False: 14.7k]
  ------------------
  304|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  305|  25.9k|  }
  306|       |
  307|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  308|       |   * This way, we return uniform gray for the remainder of the segment.
  309|       |   */
  310|  9.63M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (310:7): [True: 1.48M, False: 8.15M]
  ------------------
  311|       |
  312|       |    /* Load up working state */
  313|  1.48M|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  127|  1.48M|  br_state.cinfo = cinfop; \
  |  |  128|  1.48M|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  129|  1.48M|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  130|  1.48M|  get_buffer = permstate.get_buffer; \
  |  |  131|  1.48M|  bits_left = permstate.bits_left;
  ------------------
  314|  1.48M|    state = entropy->saved;
  315|       |
  316|       |    /* Outer loop handles each block in the MCU */
  317|       |
  318|  2.96M|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (318:20): [True: 1.48M, False: 1.48M]
  ------------------
  319|  1.48M|      block = MCU_data[blkn];
  320|  1.48M|      ci = cinfo->MCU_membership[blkn];
  321|  1.48M|      compptr = cinfo->cur_comp_info[ci];
  322|  1.48M|      tbl = entropy->derived_tbls[compptr->dc_tbl_no];
  323|       |
  324|       |      /* Decode a single block's worth of coefficients */
  325|       |
  326|       |      /* Section F.2.2.1: decode the DC coefficient difference */
  327|  1.48M|      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
  ------------------
  |  |  197|  1.48M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  198|  1.48M|  register int nb, look; \
  |  |  199|  1.48M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  1.48M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (199:7): [True: 71.3k, False: 1.41M]
  |  |  ------------------
  |  |  200|  71.3k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (200:9): [True: 0, False: 71.3k]
  |  |  ------------------
  |  |  201|  71.3k|      { failaction; } \
  |  |  202|  71.3k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  203|  71.3k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  71.3k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 1.81k, False: 69.5k]
  |  |  ------------------
  |  |  204|  1.81k|      nb = 1;  goto slowlabel; \
  |  |  205|  1.81k|    } \
  |  |  206|  71.3k|  } \
  |  |  207|  1.48M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  169|  1.48M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  208|  1.48M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  1.48M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  1.48M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (208:7): [True: 1.47M, False: 1.61k]
  |  |  ------------------
  |  |  209|  1.47M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  172|  1.47M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  210|  1.47M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   22|  1.47M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  211|  1.47M|  } else { \
  |  |  212|  3.43k|slowlabel: \
  |  |  213|  3.43k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (213:9): [True: 0, False: 3.43k]
  |  |  ------------------
  |  |  214|  3.43k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  215|  3.43k|      { failaction; } \
  |  |  216|  3.43k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  217|  3.43k|  } \
  |  |  218|  1.48M|}
  ------------------
  328|  1.48M|      if (s) {
  ------------------
  |  Branch (328:11): [True: 1.46M, False: 13.5k]
  ------------------
  329|  1.46M|        CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  157|  1.46M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|  1.46M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 398k, False: 1.07M]
  |  |  ------------------
  |  |  159|   398k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 398k]
  |  |  ------------------
  |  |  160|   398k|      { action; } \
  |  |  161|   398k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|   398k|  } \
  |  |  163|  1.46M|}
  ------------------
  330|  1.46M|        r = GET_BITS(s);
  ------------------
  |  |  166|  1.46M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  331|  1.46M|        s = HUFF_EXTEND(r, s);
  ------------------
  |  |  202|  1.46M|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  200|  1.37M|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (202:4): [True: 1.37M, False: 98.1k]
  |  |  ------------------
  ------------------
  332|  1.46M|      }
  333|       |
  334|       |      /* Convert DC difference to actual value, update last_dc_val */
  335|  1.48M|      if ((state.last_dc_val[ci] >= 0 &&
  ------------------
  |  Branch (335:12): [True: 98.7k, False: 1.38M]
  ------------------
  336|  1.48M|           s > INT_MAX - state.last_dc_val[ci]) ||
  ------------------
  |  Branch (336:12): [True: 1, False: 98.7k]
  ------------------
  337|  1.48M|          (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
  ------------------
  |  Branch (337:12): [True: 1.38M, False: 98.7k]
  |  Branch (337:41): [True: 13, False: 1.38M]
  ------------------
  338|     14|        ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  235|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  236|     14|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  339|  1.48M|      s += state.last_dc_val[ci];
  340|  1.48M|      state.last_dc_val[ci] = s;
  341|       |      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
  342|  1.48M|      (*block)[0] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   69|  1.48M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  343|  1.48M|    }
  344|       |
  345|       |    /* Completed MCU, so update state */
  346|  1.48M|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  134|  1.48M|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  135|  1.48M|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  136|  1.48M|  permstate.get_buffer = get_buffer; \
  |  |  137|  1.48M|  permstate.bits_left = bits_left
  ------------------
  347|  1.48M|    entropy->saved = state;
  348|  1.48M|  }
  349|       |
  350|       |  /* Account for restart interval (no-op if not using restarts) */
  351|  9.63M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (351:7): [True: 25.9k, False: 9.61M]
  ------------------
  352|  25.9k|    entropy->restarts_to_go--;
  353|       |
  354|  9.63M|  return TRUE;
  ------------------
  |  |  209|  9.63M|#define TRUE    1
  ------------------
  355|  9.63M|}
jdphuff.c:process_restart:
  231|  37.1k|{
  232|  37.1k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  233|  37.1k|  int ci;
  234|       |
  235|       |  /* Throw away any unused bits remaining in bit buffer; */
  236|       |  /* include any full bytes in next_marker's count of discarded bytes */
  237|  37.1k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  238|  37.1k|  entropy->bitstate.bits_left = 0;
  239|       |
  240|       |  /* Advance past the RSTn marker */
  241|  37.1k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (241:7): [True: 0, False: 37.1k]
  ------------------
  242|      0|    return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  243|       |
  244|       |  /* Re-initialize DC predictions to 0 */
  245|  74.6k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (245:16): [True: 37.4k, False: 37.1k]
  ------------------
  246|  37.4k|    entropy->saved.last_dc_val[ci] = 0;
  247|       |  /* Re-init EOB run count, too */
  248|  37.1k|  entropy->saved.EOBRUN = 0;
  249|       |
  250|       |  /* Reset restart counter */
  251|  37.1k|  entropy->restarts_to_go = cinfo->restart_interval;
  252|       |
  253|       |  /* Reset out-of-data flag, unless read_restart_marker left us smack up
  254|       |   * against a marker.  In that case we will end up treating the next data
  255|       |   * segment as empty, and we can avoid producing bogus output pixels by
  256|       |   * leaving the flag set.
  257|       |   */
  258|  37.1k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (258:7): [True: 3.48k, False: 33.7k]
  ------------------
  259|  3.48k|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  206|  3.48k|#define FALSE   0               /* values of boolean */
  ------------------
  260|       |
  261|  37.1k|  return TRUE;
  ------------------
  |  |  209|  37.1k|#define TRUE    1
  ------------------
  262|  37.1k|}
jdphuff.c:decode_mcu_AC_first:
  365|  7.27M|{
  366|  7.27M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  367|  7.27M|  int Se = cinfo->Se;
  368|  7.27M|  int Al = cinfo->Al;
  369|  7.27M|  register int s, k, r;
  370|  7.27M|  unsigned int EOBRUN;
  371|  7.27M|  JBLOCKROW block;
  372|  7.27M|  BITREAD_STATE_VARS;
  ------------------
  |  |  122|  7.27M|  register bit_buf_type get_buffer; \
  |  |  123|  7.27M|  register int bits_left; \
  |  |  124|  7.27M|  bitread_working_state br_state
  ------------------
  373|  7.27M|  d_derived_tbl *tbl;
  374|       |
  375|       |  /* Process restart marker if needed; may have to suspend */
  376|  7.27M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (376:7): [True: 429k, False: 6.84M]
  ------------------
  377|   429k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (377:9): [True: 14.3k, False: 415k]
  ------------------
  378|  14.3k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (378:11): [True: 0, False: 14.3k]
  ------------------
  379|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  380|   429k|  }
  381|       |
  382|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  383|       |   * This way, we return uniform gray for the remainder of the segment.
  384|       |   */
  385|  7.27M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (385:7): [True: 77.2k, False: 7.19M]
  ------------------
  386|       |
  387|       |    /* Load up working state.
  388|       |     * We can avoid loading/saving bitread state if in an EOB run.
  389|       |     */
  390|  77.2k|    EOBRUN = entropy->saved.EOBRUN;     /* only part of saved state we need */
  391|       |
  392|       |    /* There is always only one block per MCU */
  393|       |
  394|  77.2k|    if (EOBRUN > 0)             /* if it's a band of zeroes... */
  ------------------
  |  Branch (394:9): [True: 57.9k, False: 19.3k]
  ------------------
  395|  57.9k|      EOBRUN--;                 /* ...process it now (we do nothing) */
  396|  19.3k|    else {
  397|  19.3k|      BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  127|  19.3k|  br_state.cinfo = cinfop; \
  |  |  128|  19.3k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  129|  19.3k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  130|  19.3k|  get_buffer = permstate.get_buffer; \
  |  |  131|  19.3k|  bits_left = permstate.bits_left;
  ------------------
  398|  19.3k|      block = MCU_data[0];
  399|  19.3k|      tbl = entropy->ac_derived_tbl;
  400|       |
  401|   163k|      for (k = cinfo->Ss; k <= Se; k++) {
  ------------------
  |  Branch (401:27): [True: 151k, False: 12.7k]
  ------------------
  402|   151k|        HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
  ------------------
  |  |  197|   151k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  198|   151k|  register int nb, look; \
  |  |  199|   151k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|   151k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (199:7): [True: 22.5k, False: 128k]
  |  |  ------------------
  |  |  200|  22.5k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (200:9): [True: 0, False: 22.5k]
  |  |  ------------------
  |  |  201|  22.5k|      { failaction; } \
  |  |  202|  22.5k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  203|  22.5k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  22.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 13.4k, False: 9.09k]
  |  |  ------------------
  |  |  204|  13.4k|      nb = 1;  goto slowlabel; \
  |  |  205|  13.4k|    } \
  |  |  206|  22.5k|  } \
  |  |  207|   151k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  169|   137k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  208|   137k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|   137k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|   137k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (208:7): [True: 131k, False: 5.72k]
  |  |  ------------------
  |  |  209|   131k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  172|   131k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  210|   131k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   22|   131k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  211|   131k|  } else { \
  |  |  212|  19.1k|slowlabel: \
  |  |  213|  19.1k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (213:9): [True: 0, False: 19.1k]
  |  |  ------------------
  |  |  214|  19.1k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  215|  19.1k|      { failaction; } \
  |  |  216|  19.1k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  217|  19.1k|  } \
  |  |  218|   137k|}
  ------------------
  403|   151k|        r = s >> 4;
  404|   151k|        s &= 15;
  405|   151k|        if (s) {
  ------------------
  |  Branch (405:13): [True: 144k, False: 6.76k]
  ------------------
  406|   144k|          k += r;
  407|   144k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  157|   144k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|   144k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 3.67k, False: 140k]
  |  |  ------------------
  |  |  159|  3.67k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 3.67k]
  |  |  ------------------
  |  |  160|  3.67k|      { action; } \
  |  |  161|  3.67k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|  3.67k|  } \
  |  |  163|   144k|}
  ------------------
  408|   144k|          r = GET_BITS(s);
  ------------------
  |  |  166|   144k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  409|   144k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  202|   144k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  200|   128k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (202:4): [True: 128k, False: 15.6k]
  |  |  ------------------
  ------------------
  410|       |          /* Scale and output coefficient in natural (dezigzagged) order */
  411|   144k|          (*block)[jpeg_natural_order[k]] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   69|   144k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  412|   144k|        } else {
  413|  6.76k|          if (r == 15) {        /* ZRL */
  ------------------
  |  Branch (413:15): [True: 246, False: 6.51k]
  ------------------
  414|    246|            k += 15;            /* skip 15 zeroes in band */
  415|  6.51k|          } else {              /* EOBr, run length is 2^r + appended bits */
  416|  6.51k|            EOBRUN = 1 << r;
  417|  6.51k|            if (r) {            /* EOBr, r > 0 */
  ------------------
  |  Branch (417:17): [True: 1.76k, False: 4.75k]
  ------------------
  418|  1.76k|              CHECK_BIT_BUFFER(br_state, r, return FALSE);
  ------------------
  |  |  157|  1.76k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|  1.76k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 322, False: 1.44k]
  |  |  ------------------
  |  |  159|    322|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 322]
  |  |  ------------------
  |  |  160|    322|      { action; } \
  |  |  161|    322|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|    322|  } \
  |  |  163|  1.76k|}
  ------------------
  419|  1.76k|              r = GET_BITS(r);
  ------------------
  |  |  166|  1.76k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  420|  1.76k|              EOBRUN += r;
  421|  1.76k|            }
  422|  6.51k|            EOBRUN--;           /* this band is processed at this moment */
  423|  6.51k|            break;              /* force end-of-band */
  424|  6.51k|          }
  425|  6.76k|        }
  426|   151k|      }
  427|       |
  428|  19.3k|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  134|  19.3k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  135|  19.3k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  136|  19.3k|  permstate.get_buffer = get_buffer; \
  |  |  137|  19.3k|  permstate.bits_left = bits_left
  ------------------
  429|  19.3k|    }
  430|       |
  431|       |    /* Completed MCU, so update state */
  432|  77.2k|    entropy->saved.EOBRUN = EOBRUN;     /* only part of saved state we need */
  433|  77.2k|  }
  434|       |
  435|       |  /* Account for restart interval (no-op if not using restarts) */
  436|  7.27M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (436:7): [True: 429k, False: 6.84M]
  ------------------
  437|   429k|    entropy->restarts_to_go--;
  438|       |
  439|  7.27M|  return TRUE;
  ------------------
  |  |  209|  7.27M|#define TRUE    1
  ------------------
  440|  7.27M|}
jdphuff.c:decode_mcu_DC_refine:
  451|  2.99M|{
  452|  2.99M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  453|  2.99M|  int p1 = 1 << cinfo->Al;      /* 1 in the bit position being coded */
  454|  2.99M|  int blkn;
  455|  2.99M|  JBLOCKROW block;
  456|  2.99M|  BITREAD_STATE_VARS;
  ------------------
  |  |  122|  2.99M|  register bit_buf_type get_buffer; \
  |  |  123|  2.99M|  register int bits_left; \
  |  |  124|  2.99M|  bitread_working_state br_state
  ------------------
  457|       |
  458|       |  /* Process restart marker if needed; may have to suspend */
  459|  2.99M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (459:7): [True: 8.69k, False: 2.98M]
  ------------------
  460|  8.69k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (460:9): [True: 3.13k, False: 5.55k]
  ------------------
  461|  3.13k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (461:11): [True: 0, False: 3.13k]
  ------------------
  462|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  463|  8.69k|  }
  464|       |
  465|       |  /* Not worth the cycles to check insufficient_data here,
  466|       |   * since we will not change the data anyway if we read zeroes.
  467|       |   */
  468|       |
  469|       |  /* Load up working state */
  470|  2.99M|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  127|  2.99M|  br_state.cinfo = cinfop; \
  |  |  128|  2.99M|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  129|  2.99M|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  130|  2.99M|  get_buffer = permstate.get_buffer; \
  |  |  131|  2.99M|  bits_left = permstate.bits_left;
  ------------------
  471|       |
  472|       |  /* Outer loop handles each block in the MCU */
  473|       |
  474|  9.41M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (474:18): [True: 6.42M, False: 2.99M]
  ------------------
  475|  6.42M|    block = MCU_data[blkn];
  476|       |
  477|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  478|  6.42M|    CHECK_BIT_BUFFER(br_state, 1, return FALSE);
  ------------------
  |  |  157|  6.42M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|  6.42M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 117k, False: 6.30M]
  |  |  ------------------
  |  |  159|   117k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 117k]
  |  |  ------------------
  |  |  160|   117k|      { action; } \
  |  |  161|   117k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|   117k|  } \
  |  |  163|  6.42M|}
  ------------------
  479|  6.42M|    if (GET_BITS(1))
  ------------------
  |  |  166|  6.42M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (166:3): [True: 43.0k, False: 6.38M]
  |  |  ------------------
  ------------------
  480|  43.0k|      (*block)[0] |= p1;
  481|       |    /* Note: since we use |=, repeating the assignment later is safe */
  482|  6.42M|  }
  483|       |
  484|       |  /* Completed MCU, so update state */
  485|  2.99M|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  134|  2.99M|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  135|  2.99M|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  136|  2.99M|  permstate.get_buffer = get_buffer; \
  |  |  137|  2.99M|  permstate.bits_left = bits_left
  ------------------
  486|       |
  487|       |  /* Account for restart interval (no-op if not using restarts) */
  488|  2.99M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (488:7): [True: 8.69k, False: 2.98M]
  ------------------
  489|  8.69k|    entropy->restarts_to_go--;
  490|       |
  491|  2.99M|  return TRUE;
  ------------------
  |  |  209|  2.99M|#define TRUE    1
  ------------------
  492|  2.99M|}
jdphuff.c:decode_mcu_AC_refine:
  501|  21.9M|{
  502|  21.9M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  503|  21.9M|  int Se = cinfo->Se;
  504|  21.9M|  int p1 = 1 << cinfo->Al;        /* 1 in the bit position being coded */
  505|  21.9M|  int m1 = (NEG_1) << cinfo->Al;  /* -1 in the bit position being coded */
  ------------------
  |  |  200|  21.9M|#define NEG_1  ((unsigned)-1)
  ------------------
  506|  21.9M|  register int s, k, r;
  507|  21.9M|  unsigned int EOBRUN;
  508|  21.9M|  JBLOCKROW block;
  509|  21.9M|  JCOEFPTR thiscoef;
  510|  21.9M|  BITREAD_STATE_VARS;
  ------------------
  |  |  122|  21.9M|  register bit_buf_type get_buffer; \
  |  |  123|  21.9M|  register int bits_left; \
  |  |  124|  21.9M|  bitread_working_state br_state
  ------------------
  511|  21.9M|  d_derived_tbl *tbl;
  512|  21.9M|  int num_newnz;
  513|  21.9M|  int newnz_pos[DCTSIZE2];
  514|       |
  515|       |  /* Process restart marker if needed; may have to suspend */
  516|  21.9M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (516:7): [True: 149k, False: 21.8M]
  ------------------
  517|   149k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (517:9): [True: 4.95k, False: 144k]
  ------------------
  518|  4.95k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (518:11): [True: 0, False: 4.95k]
  ------------------
  519|      0|        return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  520|   149k|  }
  521|       |
  522|       |  /* If we've run out of data, don't modify the MCU.
  523|       |   */
  524|  21.9M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (524:7): [True: 838k, False: 21.1M]
  ------------------
  525|       |
  526|       |    /* Load up working state */
  527|   838k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  127|   838k|  br_state.cinfo = cinfop; \
  |  |  128|   838k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  129|   838k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  130|   838k|  get_buffer = permstate.get_buffer; \
  |  |  131|   838k|  bits_left = permstate.bits_left;
  ------------------
  528|   838k|    EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
  529|       |
  530|       |    /* There is always only one block per MCU */
  531|   838k|    block = MCU_data[0];
  532|   838k|    tbl = entropy->ac_derived_tbl;
  533|       |
  534|       |    /* If we are forced to suspend, we must undo the assignments to any newly
  535|       |     * nonzero coefficients in the block, because otherwise we'd get confused
  536|       |     * next time about which coefficients were already nonzero.
  537|       |     * But we need not undo addition of bits to already-nonzero coefficients;
  538|       |     * instead, we can test the current bit to see if we already did it.
  539|       |     */
  540|   838k|    num_newnz = 0;
  541|       |
  542|       |    /* initialize coefficient loop counter to start of band */
  543|   838k|    k = cinfo->Ss;
  544|       |
  545|   838k|    if (EOBRUN == 0) {
  ------------------
  |  Branch (545:9): [True: 18.2k, False: 820k]
  ------------------
  546|   108k|      for (; k <= Se; k++) {
  ------------------
  |  Branch (546:14): [True: 100k, False: 7.88k]
  ------------------
  547|   100k|        HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
  ------------------
  |  |  197|   100k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  198|   100k|  register int nb, look; \
  |  |  199|   100k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|   100k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (199:7): [True: 13.4k, False: 87.0k]
  |  |  ------------------
  |  |  200|  13.4k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (200:9): [True: 0, False: 13.4k]
  |  |  ------------------
  |  |  201|  13.4k|      { failaction; } \
  |  |  202|  13.4k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  203|  13.4k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  13.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 5.17k, False: 8.32k]
  |  |  ------------------
  |  |  204|  5.17k|      nb = 1;  goto slowlabel; \
  |  |  205|  5.17k|    } \
  |  |  206|  13.4k|  } \
  |  |  207|   100k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  169|  95.4k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  208|  95.4k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  95.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   22|  95.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (208:7): [True: 89.7k, False: 5.64k]
  |  |  ------------------
  |  |  209|  89.7k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  172|  89.7k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  210|  89.7k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   22|  89.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  211|  89.7k|  } else { \
  |  |  212|  10.8k|slowlabel: \
  |  |  213|  10.8k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (213:9): [True: 0, False: 10.8k]
  |  |  ------------------
  |  |  214|  10.8k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  215|  10.8k|      { failaction; } \
  |  |  216|  10.8k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  217|  10.8k|  } \
  |  |  218|  95.4k|}
  ------------------
  548|   100k|        r = s >> 4;
  549|   100k|        s &= 15;
  550|   100k|        if (s) {
  ------------------
  |  Branch (550:13): [True: 89.6k, False: 10.8k]
  ------------------
  551|  89.6k|          if (s != 1)           /* size of new coef should always be 1 */
  ------------------
  |  Branch (551:15): [True: 35.7k, False: 53.8k]
  ------------------
  552|  35.7k|            WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  278|  35.7k|  ((cinfo)->err->msg_code = (code), \
  |  |  279|  35.7k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  553|  89.6k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  157|  89.6k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|  89.6k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 696, False: 88.9k]
  |  |  ------------------
  |  |  159|    696|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 696]
  |  |  ------------------
  |  |  160|    696|      { action; } \
  |  |  161|    696|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|    696|  } \
  |  |  163|  89.6k|}
  ------------------
  554|  89.6k|          if (GET_BITS(1))
  ------------------
  |  |  166|  89.6k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (166:3): [True: 20.1k, False: 69.5k]
  |  |  ------------------
  ------------------
  555|  20.1k|            s = p1;             /* newly nonzero coef is positive */
  556|  69.5k|          else
  557|  69.5k|            s = m1;             /* newly nonzero coef is negative */
  558|  89.6k|        } else {
  559|  10.8k|          if (r != 15) {
  ------------------
  |  Branch (559:15): [True: 10.3k, False: 539]
  ------------------
  560|  10.3k|            EOBRUN = 1 << r;    /* EOBr, run length is 2^r + appended bits */
  561|  10.3k|            if (r) {
  ------------------
  |  Branch (561:17): [True: 2.01k, False: 8.33k]
  ------------------
  562|  2.01k|              CHECK_BIT_BUFFER(br_state, r, goto undoit);
  ------------------
  |  |  157|  2.01k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|  2.01k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 309, False: 1.71k]
  |  |  ------------------
  |  |  159|    309|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 309]
  |  |  ------------------
  |  |  160|    309|      { action; } \
  |  |  161|    309|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|    309|  } \
  |  |  163|  2.01k|}
  ------------------
  563|  2.01k|              r = GET_BITS(r);
  ------------------
  |  |  166|  2.01k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  564|  2.01k|              EOBRUN += r;
  565|  2.01k|            }
  566|  10.3k|            break;              /* rest of block is handled by EOB logic */
  567|  10.3k|          }
  568|       |          /* note s = 0 for processing ZRL */
  569|  10.8k|        }
  570|       |        /* Advance over already-nonzero coefs and r still-zero coefs,
  571|       |         * appending correction bits to the nonzeroes.  A correction bit is 1
  572|       |         * if the absolute value of the coefficient must be increased.
  573|       |         */
  574|   246k|        do {
  575|   246k|          thiscoef = *block + jpeg_natural_order[k];
  576|   246k|          if (*thiscoef != 0) {
  ------------------
  |  Branch (576:15): [True: 68.1k, False: 177k]
  ------------------
  577|  68.1k|            CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  157|  68.1k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|  68.1k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 1.32k, False: 66.8k]
  |  |  ------------------
  |  |  159|  1.32k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 1.32k]
  |  |  ------------------
  |  |  160|  1.32k|      { action; } \
  |  |  161|  1.32k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|  1.32k|  } \
  |  |  163|  68.1k|}
  ------------------
  578|  68.1k|            if (GET_BITS(1)) {
  ------------------
  |  |  166|  68.1k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (166:3): [True: 21.0k, False: 47.1k]
  |  |  ------------------
  ------------------
  579|  21.0k|              if ((*thiscoef & p1) == 0) { /* do nothing if already set it */
  ------------------
  |  Branch (579:19): [True: 4.01k, False: 17.0k]
  ------------------
  580|  4.01k|                if (*thiscoef >= 0)
  ------------------
  |  Branch (580:21): [True: 2.25k, False: 1.76k]
  ------------------
  581|  2.25k|                  *thiscoef += (JCOEF)p1;
  582|  1.76k|                else
  583|  1.76k|                  *thiscoef += (JCOEF)m1;
  584|  4.01k|              }
  585|  21.0k|            }
  586|   177k|          } else {
  587|   177k|            if (--r < 0)
  ------------------
  |  Branch (587:17): [True: 85.6k, False: 92.2k]
  ------------------
  588|  85.6k|              break;            /* reached target zero coefficient */
  589|   177k|          }
  590|   160k|          k++;
  591|   160k|        } while (k <= Se);
  ------------------
  |  Branch (591:18): [True: 155k, False: 4.56k]
  ------------------
  592|  90.2k|        if (s) {
  ------------------
  |  Branch (592:13): [True: 89.6k, False: 539]
  ------------------
  593|  89.6k|          int pos = jpeg_natural_order[k];
  594|       |          /* Output newly nonzero coefficient */
  595|  89.6k|          (*block)[pos] = (JCOEF)s;
  596|       |          /* Remember its position in case we have to suspend */
  597|  89.6k|          newnz_pos[num_newnz++] = pos;
  598|  89.6k|        }
  599|  90.2k|      }
  600|  18.2k|    }
  601|       |
  602|   838k|    if (EOBRUN > 0) {
  ------------------
  |  Branch (602:9): [True: 830k, False: 7.88k]
  ------------------
  603|       |      /* Scan any remaining coefficient positions after the end-of-band
  604|       |       * (the last newly nonzero coefficient, if any).  Append a correction
  605|       |       * bit to each already-nonzero coefficient.  A correction bit is 1
  606|       |       * if the absolute value of the coefficient must be increased.
  607|       |       */
  608|  51.6M|      for (; k <= Se; k++) {
  ------------------
  |  Branch (608:14): [True: 50.8M, False: 830k]
  ------------------
  609|  50.8M|        thiscoef = *block + jpeg_natural_order[k];
  610|  50.8M|        if (*thiscoef != 0) {
  ------------------
  |  Branch (610:13): [True: 46.1k, False: 50.8M]
  ------------------
  611|  46.1k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  157|  46.1k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  158|  46.1k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (158:7): [True: 1.18k, False: 44.9k]
  |  |  ------------------
  |  |  159|  1.18k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (159:9): [True: 0, False: 1.18k]
  |  |  ------------------
  |  |  160|  1.18k|      { action; } \
  |  |  161|  1.18k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  162|  1.18k|  } \
  |  |  163|  46.1k|}
  ------------------
  612|  46.1k|          if (GET_BITS(1)) {
  ------------------
  |  |  166|  46.1k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (166:3): [True: 14.5k, False: 31.5k]
  |  |  ------------------
  ------------------
  613|  14.5k|            if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */
  ------------------
  |  Branch (613:17): [True: 2.61k, False: 11.9k]
  ------------------
  614|  2.61k|              if (*thiscoef >= 0)
  ------------------
  |  Branch (614:19): [True: 413, False: 2.20k]
  ------------------
  615|    413|                *thiscoef += (JCOEF)p1;
  616|  2.20k|              else
  617|  2.20k|                *thiscoef += (JCOEF)m1;
  618|  2.61k|            }
  619|  14.5k|          }
  620|  46.1k|        }
  621|  50.8M|      }
  622|       |      /* Count one block completed in EOB run */
  623|   830k|      EOBRUN--;
  624|   830k|    }
  625|       |
  626|       |    /* Completed MCU, so update state */
  627|   838k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  134|   838k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  135|   838k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  136|   838k|  permstate.get_buffer = get_buffer; \
  |  |  137|   838k|  permstate.bits_left = bits_left
  ------------------
  628|   838k|    entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
  629|   838k|  }
  630|       |
  631|       |  /* Account for restart interval (no-op if not using restarts) */
  632|  21.9M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (632:7): [True: 149k, False: 21.8M]
  ------------------
  633|   149k|    entropy->restarts_to_go--;
  634|       |
  635|  21.9M|  return TRUE;
  ------------------
  |  |  209|  21.9M|#define TRUE    1
  ------------------
  636|       |
  637|      0|undoit:
  638|       |  /* Re-zero any output coefficients that we made newly nonzero */
  639|      0|  while (num_newnz > 0)
  ------------------
  |  Branch (639:10): [True: 0, False: 0]
  ------------------
  640|      0|    (*block)[newnz_pos[--num_newnz]] = 0;
  641|       |
  642|      0|  return FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  643|  21.9M|}

jinit_d_post_controller:
  255|  54.2k|{
  256|  54.2k|  my_post_ptr post;
  257|       |
  258|  54.2k|  post = (my_post_ptr)
  259|  54.2k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  54.2k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  260|  54.2k|                                sizeof(my_post_controller));
  261|  54.2k|  cinfo->post = (struct jpeg_d_post_controller *)post;
  262|  54.2k|  post->pub.start_pass = start_pass_dpost;
  263|  54.2k|  post->whole_image = NULL;     /* flag for no virtual arrays */
  264|  54.2k|  post->buffer = NULL;          /* flag for no strip buffer */
  265|       |
  266|       |  /* Create the quantization buffer, if needed */
  267|  54.2k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (267:7): [True: 0, False: 54.2k]
  ------------------
  268|       |    /* The buffer strip height is max_v_samp_factor, which is typically
  269|       |     * an efficient number of rows for upsampling to return.
  270|       |     * (In the presence of output rescaling, we might want to be smarter?)
  271|       |     */
  272|      0|    post->strip_height = (JDIMENSION)cinfo->max_v_samp_factor;
  273|      0|    if (need_full_buffer) {
  ------------------
  |  Branch (273:9): [True: 0, False: 0]
  ------------------
  274|       |      /* Two-pass color quantization: need full-image storage. */
  275|       |      /* We round up the number of rows to a multiple of the strip height. */
  276|      0|#ifdef QUANT_2PASS_SUPPORTED
  277|      0|      post->whole_image = (*cinfo->mem->request_virt_sarray)
  278|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  826|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  279|      0|         cinfo->output_width * cinfo->out_color_components,
  280|      0|         (JDIMENSION)jround_up((long)cinfo->output_height,
  281|      0|                               (long)post->strip_height),
  282|      0|         post->strip_height);
  283|       |#else
  284|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  285|       |#endif /* QUANT_2PASS_SUPPORTED */
  286|      0|    } else {
  287|       |      /* One-pass color quantization: just make a strip buffer. */
  288|      0|      post->buffer = (*cinfo->mem->alloc_sarray)
  289|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  290|      0|         cinfo->output_width * cinfo->out_color_components,
  291|      0|         post->strip_height);
  292|      0|    }
  293|      0|  }
  294|  54.2k|}
jdpostct.c:start_pass_dpost:
   80|  46.5k|{
   81|  46.5k|  my_post_ptr post = (my_post_ptr)cinfo->post;
   82|       |
   83|  46.5k|  switch (pass_mode) {
   84|  46.5k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (84:3): [True: 46.5k, False: 0]
  ------------------
   85|  46.5k|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (85:9): [True: 0, False: 46.5k]
  ------------------
   86|       |      /* Single-pass processing with color quantization. */
   87|      0|      post->pub.post_process_data = post_process_1pass;
   88|       |      /* We could be doing buffered-image output before starting a 2-pass
   89|       |       * color quantization; in that case, jinit_d_post_controller did not
   90|       |       * allocate a strip buffer.  Use the virtual-array buffer as workspace.
   91|       |       */
   92|      0|      if (post->buffer == NULL) {
  ------------------
  |  Branch (92:11): [True: 0, False: 0]
  ------------------
   93|      0|        post->buffer = (*cinfo->mem->access_virt_sarray)
   94|      0|          ((j_common_ptr)cinfo, post->whole_image,
   95|      0|           (JDIMENSION)0, post->strip_height, TRUE);
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
   96|      0|      }
   97|  46.5k|    } else {
   98|       |      /* For single-pass processing without color quantization,
   99|       |       * I have no work to do; just call the upsampler directly.
  100|       |       */
  101|  46.5k|      post->pub.post_process_data = cinfo->upsample->upsample;
  102|  46.5k|    }
  103|  46.5k|    break;
  104|      0|#ifdef QUANT_2PASS_SUPPORTED
  105|      0|  case JBUF_SAVE_AND_PASS:
  ------------------
  |  Branch (105:3): [True: 0, False: 46.5k]
  ------------------
  106|       |    /* First pass of 2-pass quantization */
  107|      0|    if (post->whole_image == NULL)
  ------------------
  |  Branch (107:9): [True: 0, False: 0]
  ------------------
  108|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|      0|    post->pub.post_process_data = post_process_prepass;
  110|      0|    break;
  111|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (111:3): [True: 0, False: 46.5k]
  ------------------
  112|       |    /* Second pass of 2-pass quantization */
  113|      0|    if (post->whole_image == NULL)
  ------------------
  |  Branch (113:9): [True: 0, False: 0]
  ------------------
  114|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  115|      0|    post->pub.post_process_data = post_process_2pass;
  116|      0|    break;
  117|      0|#endif /* QUANT_2PASS_SUPPORTED */
  118|      0|  default:
  ------------------
  |  Branch (118:3): [True: 0, False: 46.5k]
  ------------------
  119|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  120|      0|    break;
  121|  46.5k|  }
  122|  46.5k|  post->starting_row = post->next_row = 0;
  123|  46.5k|}

jinit_upsampler:
  414|  54.3k|{
  415|  54.3k|  my_upsample_ptr upsample;
  416|  54.3k|  int ci;
  417|  54.3k|  jpeg_component_info *compptr;
  418|  54.3k|  boolean need_buffer, do_fancy;
  419|  54.3k|  int h_in_group, v_in_group, h_out_group, v_out_group;
  420|       |
  421|  54.3k|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (421:7): [True: 54.3k, False: 0]
  ------------------
  422|  54.3k|    upsample = (my_upsample_ptr)
  423|  54.3k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  54.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  424|  54.3k|                                  sizeof(my_upsampler));
  425|  54.3k|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  426|  54.3k|    upsample->pub.start_pass = start_pass_upsample;
  427|  54.3k|    upsample->pub.upsample = sep_upsample;
  428|  54.3k|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  206|  54.3k|#define FALSE   0               /* values of boolean */
  ------------------
  429|  54.3k|  } else
  430|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  431|       |
  432|  54.3k|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (432:7): [True: 0, False: 54.3k]
  ------------------
  433|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  434|       |
  435|       |  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
  436|       |   * so don't ask for it.
  437|       |   */
  438|  54.3k|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|  54.3k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (438:14): [True: 54.3k, False: 0]
  |  Branch (438:44): [True: 54.3k, False: 0]
  ------------------
  439|       |
  440|       |  /* Verify we can handle the sampling factors, select per-component methods,
  441|       |   * and create storage as needed.
  442|       |   */
  443|   124k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (443:44): [True: 70.5k, False: 54.3k]
  ------------------
  444|  70.5k|       ci++, compptr++) {
  445|       |    /* Compute size of an "input group" after IDCT scaling.  This many samples
  446|       |     * are to be converted to max_h_samp_factor * max_v_samp_factor pixels.
  447|       |     */
  448|  70.5k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  70.5k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  449|  70.5k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  70.5k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  450|  70.5k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  70.5k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  451|  70.5k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  70.5k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  452|  70.5k|    h_out_group = cinfo->max_h_samp_factor;
  453|  70.5k|    v_out_group = cinfo->max_v_samp_factor;
  454|  70.5k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  455|  70.5k|    need_buffer = TRUE;
  ------------------
  |  |  209|  70.5k|#define TRUE    1
  ------------------
  456|  70.5k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (456:9): [True: 0, False: 70.5k]
  ------------------
  457|       |      /* Don't bother to upsample an uninteresting component. */
  458|      0|      upsample->methods[ci] = noop_upsample;
  459|      0|      need_buffer = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  460|  70.5k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (460:16): [True: 61.2k, False: 9.32k]
  |  Branch (460:45): [True: 60.2k, False: 991]
  ------------------
  461|       |      /* Fullsize components can be processed without any work. */
  462|  60.2k|      upsample->methods[ci] = fullsize_upsample;
  463|  60.2k|      need_buffer = FALSE;
  ------------------
  |  |  206|  60.2k|#define FALSE   0               /* values of boolean */
  ------------------
  464|  60.2k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (464:16): [True: 7.92k, False: 2.38k]
  |  Branch (464:49): [True: 2.30k, False: 5.62k]
  ------------------
  465|       |      /* Special cases for 2h1v upsampling */
  466|  2.30k|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (466:11): [True: 2.30k, False: 0]
  |  Branch (466:23): [True: 547, False: 1.75k]
  ------------------
  467|    547|        if (jsimd_can_h2v1_fancy_upsample())
  ------------------
  |  Branch (467:13): [True: 547, False: 0]
  ------------------
  468|    547|          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  469|      0|        else
  470|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  471|  1.75k|      } else {
  472|  1.75k|        if (jsimd_can_h2v1_upsample())
  ------------------
  |  Branch (472:13): [True: 1.75k, False: 0]
  ------------------
  473|  1.75k|          upsample->methods[ci] = jsimd_h2v1_upsample;
  474|      0|        else
  475|      0|          upsample->methods[ci] = h2v1_upsample;
  476|  1.75k|      }
  477|  8.01k|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (477:16): [True: 991, False: 7.01k]
  ------------------
  478|  8.01k|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (478:16): [True: 741, False: 250]
  |  Branch (478:49): [True: 741, False: 0]
  ------------------
  479|       |      /* Non-fancy upsampling is handled by the generic method */
  480|       |#if defined(__arm__) || defined(__aarch64__) || \
  481|       |    defined(_M_ARM) || defined(_M_ARM64)
  482|       |      if (jsimd_can_h1v2_fancy_upsample())
  483|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  484|       |      else
  485|       |#endif
  486|    741|        upsample->methods[ci] = h1v2_fancy_upsample;
  487|    741|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  209|    741|#define TRUE    1
  ------------------
  488|  7.26k|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (488:16): [True: 5.62k, False: 1.64k]
  ------------------
  489|  7.26k|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (489:16): [True: 5.08k, False: 539]
  ------------------
  490|       |      /* Special cases for 2h2v upsampling */
  491|  5.08k|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (491:11): [True: 5.08k, False: 0]
  |  Branch (491:23): [True: 3.69k, False: 1.39k]
  ------------------
  492|  3.69k|        if (jsimd_can_h2v2_fancy_upsample())
  ------------------
  |  Branch (492:13): [True: 3.69k, False: 0]
  ------------------
  493|  3.69k|          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  494|      0|        else
  495|      0|          upsample->methods[ci] = h2v2_fancy_upsample;
  496|  3.69k|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  209|  3.69k|#define TRUE    1
  ------------------
  497|  3.69k|      } else {
  498|  1.39k|        if (jsimd_can_h2v2_upsample())
  ------------------
  |  Branch (498:13): [True: 1.39k, False: 0]
  ------------------
  499|  1.39k|          upsample->methods[ci] = jsimd_h2v2_upsample;
  500|      0|        else
  501|      0|          upsample->methods[ci] = h2v2_upsample;
  502|  1.39k|      }
  503|  5.08k|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (503:16): [True: 2.18k, False: 2]
  ------------------
  504|  2.18k|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (504:16): [True: 2.18k, False: 1]
  ------------------
  505|       |      /* Generic integral-factors upsampling method */
  506|       |#if defined(__mips__)
  507|       |      if (jsimd_can_int_upsample())
  508|       |        upsample->methods[ci] = jsimd_int_upsample;
  509|       |      else
  510|       |#endif
  511|  2.18k|        upsample->methods[ci] = int_upsample;
  512|  2.18k|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  513|  2.18k|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  514|  2.18k|    } else
  515|      3|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  235|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  516|  70.5k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (516:9): [True: 10.3k, False: 60.2k]
  |  Branch (516:24): [True: 10.3k, False: 0]
  ------------------
  517|  10.3k|      upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray)
  518|  10.3k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  10.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  519|  10.3k|         (JDIMENSION)jround_up((long)cinfo->output_width,
  520|  10.3k|                               (long)cinfo->max_h_samp_factor),
  521|  10.3k|         (JDIMENSION)cinfo->max_v_samp_factor);
  522|  10.3k|    }
  523|  70.5k|  }
  524|  54.3k|}
jdsample.c:start_pass_upsample:
   41|  46.5k|{
   42|  46.5k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   43|       |
   44|       |  /* Mark the conversion buffer empty */
   45|  46.5k|  upsample->next_row_out = cinfo->max_v_samp_factor;
   46|       |  /* Initialize total-height counter for detecting bottom of image */
   47|  46.5k|  upsample->rows_to_go = cinfo->output_height;
   48|  46.5k|}
jdsample.c:sep_upsample:
   64|  44.4M|{
   65|  44.4M|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   66|  44.4M|  int ci;
   67|  44.4M|  jpeg_component_info *compptr;
   68|  44.4M|  JDIMENSION num_rows;
   69|       |
   70|       |  /* Fill the conversion buffer, if it's empty */
   71|  44.4M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (71:7): [True: 40.5M, False: 3.94M]
  ------------------
   72|  98.4M|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (72:46): [True: 57.9M, False: 40.5M]
  ------------------
   73|  57.9M|         ci++, compptr++) {
   74|       |      /* Invoke per-component upsample method.  Notice we pass a POINTER
   75|       |       * to color_buf[ci], so that fullsize_upsample can change it.
   76|       |       */
   77|  57.9M|      (*upsample->methods[ci]) (cinfo, compptr,
   78|  57.9M|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   79|  57.9M|        upsample->color_buf + ci);
   80|  57.9M|    }
   81|  40.5M|    upsample->next_row_out = 0;
   82|  40.5M|  }
   83|       |
   84|       |  /* Color-convert and emit rows */
   85|       |
   86|       |  /* How many we have in the buffer: */
   87|  44.4M|  num_rows = (JDIMENSION)(cinfo->max_v_samp_factor - upsample->next_row_out);
   88|       |  /* Not more than the distance to the end of the image.  Need this test
   89|       |   * in case the image height is not a multiple of max_v_samp_factor:
   90|       |   */
   91|  44.4M|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (91:7): [True: 2.98k, False: 44.4M]
  ------------------
   92|  2.98k|    num_rows = upsample->rows_to_go;
   93|       |  /* And not more than what the client can accept: */
   94|  44.4M|  out_rows_avail -= *out_row_ctr;
   95|  44.4M|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (95:7): [True: 3.94M, False: 40.5M]
  ------------------
   96|  3.94M|    num_rows = out_rows_avail;
   97|       |
   98|  44.4M|  (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf,
   99|  44.4M|                                     (JDIMENSION)upsample->next_row_out,
  100|  44.4M|                                     output_buf + *out_row_ctr, (int)num_rows);
  101|       |
  102|       |  /* Adjust counts */
  103|  44.4M|  *out_row_ctr += num_rows;
  104|  44.4M|  upsample->rows_to_go -= num_rows;
  105|  44.4M|  upsample->next_row_out += num_rows;
  106|       |  /* When the buffer is emptied, declare this input row group consumed */
  107|  44.4M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (107:7): [True: 40.5M, False: 3.95M]
  ------------------
  108|  40.5M|    (*in_row_group_ctr)++;
  109|  44.4M|}
jdsample.c:fullsize_upsample:
  128|  45.2M|{
  129|  45.2M|  *output_data_ptr = input_data;
  130|  45.2M|}
jdsample.c:h1v2_fancy_upsample:
  315|   515k|{
  316|   515k|  JSAMPARRAY output_data = *output_data_ptr;
  317|   515k|  JSAMPROW inptr0, inptr1, outptr;
  318|   515k|#if BITS_IN_JSAMPLE == 8
  319|   515k|  int thiscolsum, bias;
  320|       |#else
  321|       |  JLONG thiscolsum, bias;
  322|       |#endif
  323|   515k|  JDIMENSION colctr;
  324|   515k|  int inrow, outrow, v;
  325|       |
  326|   515k|  inrow = outrow = 0;
  327|  1.03M|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (327:10): [True: 515k, False: 515k]
  ------------------
  328|  1.54M|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (328:17): [True: 1.03M, False: 515k]
  ------------------
  329|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  330|  1.03M|      inptr0 = input_data[inrow];
  331|  1.03M|      if (v == 0) {             /* next nearest is row above */
  ------------------
  |  Branch (331:11): [True: 515k, False: 515k]
  ------------------
  332|   515k|        inptr1 = input_data[inrow - 1];
  333|   515k|        bias = 1;
  334|   515k|      } else {                  /* next nearest is row below */
  335|   515k|        inptr1 = input_data[inrow + 1];
  336|   515k|        bias = 2;
  337|   515k|      }
  338|  1.03M|      outptr = output_data[outrow++];
  339|       |
  340|  27.1M|      for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
  ------------------
  |  Branch (340:24): [True: 26.0M, False: 1.03M]
  ------------------
  341|  26.0M|        thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  342|  26.0M|        *outptr++ = (JSAMPLE)((thiscolsum + bias) >> 2);
  343|  26.0M|      }
  344|  1.03M|    }
  345|   515k|    inrow++;
  346|   515k|  }
  347|   515k|}
jdsample.c:int_upsample:
  160|   382k|{
  161|   382k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
  162|   382k|  JSAMPARRAY output_data = *output_data_ptr;
  163|   382k|  register JSAMPROW inptr, outptr;
  164|   382k|  register JSAMPLE invalue;
  165|   382k|  register int h;
  166|   382k|  JSAMPROW outend;
  167|   382k|  int h_expand, v_expand;
  168|   382k|  int inrow, outrow;
  169|       |
  170|   382k|  h_expand = upsample->h_expand[compptr->component_index];
  171|   382k|  v_expand = upsample->v_expand[compptr->component_index];
  172|       |
  173|   382k|  inrow = outrow = 0;
  174|   764k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (174:10): [True: 382k, False: 382k]
  ------------------
  175|       |    /* Generate one output row with proper horizontal expansion */
  176|   382k|    inptr = input_data[inrow];
  177|   382k|    outptr = output_data[outrow];
  178|   382k|    outend = outptr + cinfo->output_width;
  179|  11.3M|    while (outptr < outend) {
  ------------------
  |  Branch (179:12): [True: 10.9M, False: 382k]
  ------------------
  180|  10.9M|      invalue = *inptr++;
  181|  41.6M|      for (h = h_expand; h > 0; h--) {
  ------------------
  |  Branch (181:26): [True: 30.7M, False: 10.9M]
  ------------------
  182|  30.7M|        *outptr++ = invalue;
  183|  30.7M|      }
  184|  10.9M|    }
  185|       |    /* Generate any additional output rows by duplicating the first one */
  186|   382k|    if (v_expand > 1) {
  ------------------
  |  Branch (186:9): [True: 300k, False: 81.9k]
  ------------------
  187|   300k|      jcopy_sample_rows(output_data, outrow, output_data, outrow + 1,
  188|   300k|                        v_expand - 1, cinfo->output_width);
  189|   300k|    }
  190|   382k|    inrow++;
  191|   382k|    outrow += v_expand;
  192|   382k|  }
  193|   382k|}

jpeg_std_error:
  231|  18.1k|{
  232|  18.1k|  err->error_exit = error_exit;
  233|  18.1k|  err->emit_message = emit_message;
  234|  18.1k|  err->output_message = output_message;
  235|  18.1k|  err->format_message = format_message;
  236|  18.1k|  err->reset_error_mgr = reset_error_mgr;
  237|       |
  238|  18.1k|  err->trace_level = 0;         /* default = no tracing */
  239|  18.1k|  err->num_warnings = 0;        /* no warnings emitted yet */
  240|  18.1k|  err->msg_code = 0;            /* may be useful as a flag for "no error" */
  241|       |
  242|       |  /* Initialize message table pointers */
  243|  18.1k|  err->jpeg_message_table = jpeg_std_message_table;
  244|  18.1k|  err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1;
  245|       |
  246|  18.1k|  err->addon_message_table = NULL;
  247|  18.1k|  err->first_addon_message = 0; /* for safety */
  248|  18.1k|  err->last_addon_message = 0;
  249|       |
  250|  18.1k|  return err;
  251|  18.1k|}
jerror.c:emit_message:
  128|   210M|{
  129|   210M|  struct jpeg_error_mgr *err = cinfo->err;
  130|       |
  131|   210M|  if (msg_level < 0) {
  ------------------
  |  Branch (131:7): [True: 209M, False: 1.14M]
  ------------------
  132|       |    /* It's a warning message.  Since corrupt files may generate many warnings,
  133|       |     * the policy implemented here is to show only the first warning,
  134|       |     * unless trace_level >= 3.
  135|       |     */
  136|   209M|    if (err->num_warnings == 0 || err->trace_level >= 3)
  ------------------
  |  Branch (136:9): [True: 88.9k, False: 209M]
  |  Branch (136:35): [True: 0, False: 209M]
  ------------------
  137|  88.9k|      (*err->output_message) (cinfo);
  138|       |    /* Always count warnings in num_warnings. */
  139|   209M|    err->num_warnings++;
  140|   209M|  } else {
  141|       |    /* It's a trace message.  Show it if trace_level >= msg_level. */
  142|  1.14M|    if (err->trace_level >= msg_level)
  ------------------
  |  Branch (142:9): [True: 0, False: 1.14M]
  ------------------
  143|      0|      (*err->output_message) (cinfo);
  144|  1.14M|  }
  145|   210M|}
jerror.c:format_message:
  157|   211k|{
  158|   211k|  struct jpeg_error_mgr *err = cinfo->err;
  159|   211k|  int msg_code = err->msg_code;
  160|   211k|  const char *msgtext = NULL;
  161|   211k|  const char *msgptr;
  162|   211k|  char ch;
  163|   211k|  boolean isstring;
  164|       |
  165|       |  /* Look up message string in proper table */
  166|   211k|  if (msg_code > 0 && msg_code <= err->last_jpeg_message) {
  ------------------
  |  Branch (166:7): [True: 211k, False: 0]
  |  Branch (166:23): [True: 211k, False: 0]
  ------------------
  167|   211k|    msgtext = err->jpeg_message_table[msg_code];
  168|   211k|  } else if (err->addon_message_table != NULL &&
  ------------------
  |  Branch (168:14): [True: 0, False: 0]
  ------------------
  169|      0|             msg_code >= err->first_addon_message &&
  ------------------
  |  Branch (169:14): [True: 0, False: 0]
  ------------------
  170|      0|             msg_code <= err->last_addon_message) {
  ------------------
  |  Branch (170:14): [True: 0, False: 0]
  ------------------
  171|      0|    msgtext = err->addon_message_table[msg_code - err->first_addon_message];
  172|      0|  }
  173|       |
  174|       |  /* Defend against bogus message number */
  175|   211k|  if (msgtext == NULL) {
  ------------------
  |  Branch (175:7): [True: 0, False: 211k]
  ------------------
  176|      0|    err->msg_parm.i[0] = msg_code;
  177|      0|    msgtext = err->jpeg_message_table[0];
  178|      0|  }
  179|       |
  180|       |  /* Check for string parameter, as indicated by %s in the message text */
  181|   211k|  isstring = FALSE;
  ------------------
  |  |  206|   211k|#define FALSE   0               /* values of boolean */
  ------------------
  182|   211k|  msgptr = msgtext;
  183|  5.99M|  while ((ch = *msgptr++) != '\0') {
  ------------------
  |  Branch (183:10): [True: 5.94M, False: 56.3k]
  ------------------
  184|  5.94M|    if (ch == '%') {
  ------------------
  |  Branch (184:9): [True: 155k, False: 5.78M]
  ------------------
  185|   155k|      if (*msgptr == 's') isstring = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  |  Branch (185:11): [True: 0, False: 155k]
  ------------------
  186|   155k|      break;
  187|   155k|    }
  188|  5.94M|  }
  189|       |
  190|       |  /* Format the message into the passed buffer */
  191|   211k|  if (isstring)
  ------------------
  |  Branch (191:7): [True: 0, False: 211k]
  ------------------
  192|      0|    SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
  ------------------
  |  |   55|      0|#define SNPRINTF  snprintf
  ------------------
                  SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
  ------------------
  |  |  729|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  193|   211k|  else
  194|   211k|    SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |   55|   211k|#define SNPRINTF  snprintf
  ------------------
                  SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |  729|   211k|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  195|   211k|             err->msg_parm.i[0], err->msg_parm.i[1],
  196|   211k|             err->msg_parm.i[2], err->msg_parm.i[3],
  197|   211k|             err->msg_parm.i[4], err->msg_parm.i[5],
  198|   211k|             err->msg_parm.i[6], err->msg_parm.i[7]);
  199|   211k|}
jerror.c:reset_error_mgr:
  212|   162k|{
  213|   162k|  cinfo->err->num_warnings = 0;
  214|       |  /* trace_level is not reset since it is an application-supplied parameter */
  215|   162k|  cinfo->err->msg_code = 0;     /* may be useful as a flag for "no error" */
  216|   162k|}

jmemmgr.c:GETENV_S:
   80|  18.1k|{
   81|  18.1k|  char *env;
   82|       |
   83|  18.1k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 18.1k]
  ------------------
   84|      0|    if (buffer_size == 0)
  ------------------
  |  Branch (84:9): [True: 0, False: 0]
  ------------------
   85|      0|      return 0;
   86|      0|    else
   87|      0|      return (errno = EINVAL);
   88|      0|  }
   89|  18.1k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 18.1k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|  18.1k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 18.1k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|  18.1k|  env = getenv(name);
   97|  18.1k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 18.1k, False: 0]
  ------------------
   98|  18.1k|  {
   99|  18.1k|    *buffer = 0;
  100|  18.1k|    return 0;
  101|  18.1k|  }
  102|       |
  103|      0|  if (strlen(env) + 1 > buffer_size) {
  ------------------
  |  Branch (103:7): [True: 0, False: 0]
  ------------------
  104|      0|    *buffer = 0;
  105|      0|    return ERANGE;
  106|      0|  }
  107|       |
  108|      0|  strncpy(buffer, env, buffer_size);
  109|       |
  110|      0|  return 0;
  111|      0|}
jsimd.c:GETENV_S:
   80|      4|{
   81|      4|  char *env;
   82|       |
   83|      4|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 4]
  ------------------
   84|      0|    if (buffer_size == 0)
  ------------------
  |  Branch (84:9): [True: 0, False: 0]
  ------------------
   85|      0|      return 0;
   86|      0|    else
   87|      0|      return (errno = EINVAL);
   88|      0|  }
   89|      4|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 4]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|      4|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 4]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|      4|  env = getenv(name);
   97|      4|  if (!env)
  ------------------
  |  Branch (97:7): [True: 4, False: 0]
  ------------------
   98|      4|  {
   99|      4|    *buffer = 0;
  100|      4|    return 0;
  101|      4|  }
  102|       |
  103|      0|  if (strlen(env) + 1 > buffer_size) {
  ------------------
  |  Branch (103:7): [True: 0, False: 0]
  ------------------
  104|      0|    *buffer = 0;
  105|      0|    return ERANGE;
  106|      0|  }
  107|       |
  108|      0|  strncpy(buffer, env, buffer_size);
  109|       |
  110|      0|  return 0;
  111|      0|}

jinit_memory_mgr:
 1086|  18.1k|{
 1087|  18.1k|  my_mem_ptr mem;
 1088|  18.1k|  long max_to_use;
 1089|  18.1k|  int pool;
 1090|  18.1k|  size_t test_mac;
 1091|       |
 1092|  18.1k|  cinfo->mem = NULL;            /* for safety if init fails */
 1093|       |
 1094|       |  /* Check for configuration errors.
 1095|       |   * sizeof(ALIGN_TYPE) should be a power of 2; otherwise, it probably
 1096|       |   * doesn't reflect any real hardware alignment requirement.
 1097|       |   * The test is a little tricky: for X>0, X and X-1 have no one-bits
 1098|       |   * in common if and only if X is a power of 2, ie has only one one-bit.
 1099|       |   * Some compilers may give an "unreachable code" warning here; ignore it.
 1100|       |   */
 1101|  18.1k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  18.1k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  18.1k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1101:7): [Folded - Ignored]
  ------------------
 1102|      0|    ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1103|       |  /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be
 1104|       |   * a multiple of ALIGN_SIZE.
 1105|       |   * Again, an "unreachable code" warning may be ignored here.
 1106|       |   * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK.
 1107|       |   */
 1108|  18.1k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  18.1k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1109|  18.1k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|  36.3k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1109:7): [True: 0, False: 18.1k]
  ------------------
 1110|  18.1k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  18.1k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  18.1k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1110:7): [Folded - Ignored]
  ------------------
 1111|      0|    ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1112|       |
 1113|  18.1k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1114|       |
 1115|       |  /* Attempt to allocate memory manager's control block */
 1116|  18.1k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1117|       |
 1118|  18.1k|  if (mem == NULL) {
  ------------------
  |  Branch (1118:7): [True: 0, False: 18.1k]
  ------------------
 1119|      0|    jpeg_mem_term(cinfo);       /* system-dependent cleanup */
 1120|      0|    ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0);
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1121|      0|  }
 1122|       |
 1123|       |  /* OK, fill in the method pointers */
 1124|  18.1k|  mem->pub.alloc_small = alloc_small;
 1125|  18.1k|  mem->pub.alloc_large = alloc_large;
 1126|  18.1k|  mem->pub.alloc_sarray = alloc_sarray;
 1127|  18.1k|  mem->pub.alloc_barray = alloc_barray;
 1128|  18.1k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1129|  18.1k|  mem->pub.request_virt_barray = request_virt_barray;
 1130|  18.1k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1131|  18.1k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1132|  18.1k|  mem->pub.access_virt_barray = access_virt_barray;
 1133|  18.1k|  mem->pub.free_pool = free_pool;
 1134|  18.1k|  mem->pub.self_destruct = self_destruct;
 1135|       |
 1136|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1137|  18.1k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  18.1k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1138|       |
 1139|       |  /* Initialize working state */
 1140|  18.1k|  mem->pub.max_memory_to_use = max_to_use;
 1141|       |
 1142|  54.5k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  827|  18.1k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  825|  54.5k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1142:35): [True: 36.3k, False: 18.1k]
  ------------------
 1143|  36.3k|    mem->small_list[pool] = NULL;
 1144|  36.3k|    mem->large_list[pool] = NULL;
 1145|  36.3k|  }
 1146|  18.1k|  mem->virt_sarray_list = NULL;
 1147|  18.1k|  mem->virt_barray_list = NULL;
 1148|       |
 1149|  18.1k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1150|       |
 1151|       |  /* Declare ourselves open for business */
 1152|  18.1k|  cinfo->mem = &mem->pub;
 1153|       |
 1154|       |  /* Check for an environment variable JPEGMEM; if found, override the
 1155|       |   * default max_memory setting from jpeg_mem_init.  Note that the
 1156|       |   * surrounding application may again override this value.
 1157|       |   * If your system doesn't support getenv(), define NO_GETENV to disable
 1158|       |   * this feature.
 1159|       |   */
 1160|  18.1k|#ifndef NO_GETENV
 1161|  18.1k|  {
 1162|  18.1k|    char memenv[30] = { 0 };
 1163|       |
 1164|  18.1k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1164:9): [True: 18.1k, False: 0]
  |  Branch (1164:45): [True: 0, False: 18.1k]
  ------------------
 1165|      0|      char ch = 'x';
 1166|       |
 1167|       |#ifdef _MSC_VER
 1168|       |      if (sscanf_s(memenv, "%ld%c", &max_to_use, &ch, 1) > 0) {
 1169|       |#else
 1170|      0|      if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {
  ------------------
  |  Branch (1170:11): [True: 0, False: 0]
  ------------------
 1171|      0|#endif
 1172|      0|        if (ch == 'm' || ch == 'M')
  ------------------
  |  Branch (1172:13): [True: 0, False: 0]
  |  Branch (1172:26): [True: 0, False: 0]
  ------------------
 1173|      0|          max_to_use *= 1000L;
 1174|      0|        mem->pub.max_memory_to_use = max_to_use * 1000L;
 1175|      0|      }
 1176|      0|    }
 1177|  18.1k|  }
 1178|  18.1k|#endif
 1179|       |
 1180|  18.1k|}
jmemmgr.c:alloc_small:
  266|  1.12M|{
  267|  1.12M|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  268|  1.12M|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  269|  1.12M|  char *data_ptr;
  270|  1.12M|  size_t min_request, slop;
  271|       |
  272|       |  /*
  273|       |   * Round up the requested size to a multiple of ALIGN_SIZE in order
  274|       |   * to assure alignment for the next object allocated in the same pool
  275|       |   * and so that algorithms can straddle outside the proper area up
  276|       |   * to the next alignment.
  277|       |   */
  278|  1.12M|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  1.12M|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (278:7): [True: 0, False: 1.12M]
  ------------------
  279|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  280|       |       is close to SIZE_MAX. */
  281|      0|    out_of_memory(cinfo, 7);
  282|      0|  }
  283|  1.12M|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  1.12M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  284|       |
  285|       |  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  286|  1.12M|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  1.12M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (286:7): [True: 0, False: 1.12M]
  ------------------
  287|  1.12M|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  1.12M|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  288|      0|    out_of_memory(cinfo, 1);    /* request exceeds malloc's ability */
  289|       |
  290|       |  /* See if space is available in any existing pool */
  291|  1.12M|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  827|  1.12M|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (291:7): [True: 0, False: 1.12M]
  |  Branch (291:22): [True: 0, False: 1.12M]
  ------------------
  292|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  293|  1.12M|  prev_hdr_ptr = NULL;
  294|  1.12M|  hdr_ptr = mem->small_list[pool_id];
  295|  1.15M|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (295:10): [True: 1.05M, False: 100k]
  ------------------
  296|  1.05M|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (296:9): [True: 1.02M, False: 30.1k]
  ------------------
  297|  1.02M|      break;                    /* found pool with enough space */
  298|  30.1k|    prev_hdr_ptr = hdr_ptr;
  299|  30.1k|    hdr_ptr = hdr_ptr->next;
  300|  30.1k|  }
  301|       |
  302|       |  /* Time to make a new pool? */
  303|  1.12M|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (303:7): [True: 100k, False: 1.02M]
  ------------------
  304|       |    /* min_request is what we need now, slop is what will be leftover */
  305|   100k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   100k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  306|   100k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (306:9): [True: 81.7k, False: 18.8k]
  ------------------
  307|  81.7k|      slop = first_pool_slop[pool_id];
  308|  18.8k|    else
  309|  18.8k|      slop = extra_pool_slop[pool_id];
  310|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  311|   100k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|   100k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (311:9): [True: 0, False: 100k]
  ------------------
  312|      0|      slop = (size_t)(MAX_ALLOC_CHUNK - min_request);
  ------------------
  |  |   62|      0|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  313|       |    /* Try to get space, if fail reduce slop and try again */
  314|   100k|    for (;;) {
  315|   100k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  316|   100k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (316:11): [True: 100k, False: 0]
  ------------------
  317|   100k|        break;
  318|      0|      slop /= 2;
  319|      0|      if (slop < MIN_SLOP)      /* give up when it gets real small */
  ------------------
  |  |  260|      0|#define MIN_SLOP  50            /* greater than 0 to avoid futile looping */
  ------------------
  |  Branch (319:11): [True: 0, False: 0]
  ------------------
  320|      0|        out_of_memory(cinfo, 2); /* jpeg_get_small failed */
  321|      0|    }
  322|   100k|    mem->total_space_allocated += min_request + slop;
  323|       |    /* Success, initialize the new pool header and add to end of list */
  324|   100k|    hdr_ptr->next = NULL;
  325|   100k|    hdr_ptr->bytes_used = 0;
  326|   100k|    hdr_ptr->bytes_left = sizeofobject + slop;
  327|   100k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (327:9): [True: 81.7k, False: 18.8k]
  ------------------
  328|  81.7k|      mem->small_list[pool_id] = hdr_ptr;
  329|  18.8k|    else
  330|  18.8k|      prev_hdr_ptr->next = hdr_ptr;
  331|   100k|  }
  332|       |
  333|       |  /* OK, allocate the object from the current pool */
  334|  1.12M|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  335|  1.12M|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  336|  1.12M|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  1.12M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (336:7): [True: 1.12M, False: 0]
  ------------------
  337|  1.12M|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  1.12M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  1.12M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  338|  1.12M|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  339|  1.12M|  hdr_ptr->bytes_used += sizeofobject;
  340|  1.12M|  hdr_ptr->bytes_left -= sizeofobject;
  341|       |
  342|  1.12M|  return (void *)data_ptr;
  343|  1.12M|}
jmemmgr.c:round_up_pow2:
   45|  1.35M|{
   46|  1.35M|  return ((a + b - 1) & (~(b - 1)));
   47|  1.35M|}
jmemmgr.c:alloc_large:
  362|   149k|{
  363|   149k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  364|   149k|  large_pool_ptr hdr_ptr;
  365|   149k|  char *data_ptr;
  366|       |
  367|       |  /*
  368|       |   * Round up the requested size to a multiple of ALIGN_SIZE so that
  369|       |   * algorithms can straddle outside the proper area up to the next
  370|       |   * alignment.
  371|       |   */
  372|   149k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   149k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (372:7): [True: 0, False: 149k]
  ------------------
  373|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  374|       |       is close to SIZE_MAX. */
  375|      0|    out_of_memory(cinfo, 8);
  376|      0|  }
  377|   149k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|   149k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  378|       |
  379|       |  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  380|   149k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|   149k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (380:7): [True: 0, False: 149k]
  ------------------
  381|   149k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|   149k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  382|      0|    out_of_memory(cinfo, 3);    /* request exceeds malloc's ability */
  383|       |
  384|       |  /* Always make a new pool */
  385|   149k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  827|   149k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (385:7): [True: 0, False: 149k]
  |  Branch (385:22): [True: 0, False: 149k]
  ------------------
  386|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  387|       |
  388|   149k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  389|   149k|                                           sizeof(large_pool_hdr) +
  390|   149k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|   149k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  391|   149k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (391:7): [True: 0, False: 149k]
  ------------------
  392|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  393|   149k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  394|   149k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|   149k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  395|       |
  396|       |  /* Success, initialize the new pool header and add to list */
  397|   149k|  hdr_ptr->next = mem->large_list[pool_id];
  398|       |  /* We maintain space counts in each pool header for statistical purposes,
  399|       |   * even though they are not needed for allocation.
  400|       |   */
  401|   149k|  hdr_ptr->bytes_used = sizeofobject;
  402|   149k|  hdr_ptr->bytes_left = 0;
  403|   149k|  mem->large_list[pool_id] = hdr_ptr;
  404|       |
  405|   149k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  406|   149k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  407|   149k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|   149k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (407:7): [True: 149k, False: 0]
  ------------------
  408|   149k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   149k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   149k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  409|       |
  410|   149k|  return (void *)data_ptr;
  411|   149k|}
jmemmgr.c:alloc_sarray:
  434|  80.8k|{
  435|  80.8k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  436|  80.8k|  JSAMPARRAY result;
  437|  80.8k|  JSAMPROW workspace;
  438|  80.8k|  JDIMENSION rowsperchunk, currow, i;
  439|  80.8k|  long ltemp;
  440|       |
  441|       |  /* Make sure each row is properly aligned */
  442|  80.8k|  if ((ALIGN_SIZE % sizeof(JSAMPLE)) != 0)
  ------------------
  |  |   89|  80.8k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (442:7): [Folded - Ignored]
  ------------------
  443|      0|    out_of_memory(cinfo, 5);    /* safety check */
  444|       |
  445|  80.8k|  if (samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  80.8k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (445:7): [True: 0, False: 80.8k]
  ------------------
  446|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  447|       |       is close to SIZE_MAX. */
  448|      0|    out_of_memory(cinfo, 9);
  449|      0|  }
  450|  80.8k|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|  80.8k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  451|  80.8k|                                                           sizeof(JSAMPLE));
  452|       |
  453|       |  /* Calculate max # of rows allowed in one allocation chunk */
  454|  80.8k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  80.8k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  455|  80.8k|          ((long)samplesperrow * sizeof(JSAMPLE));
  456|  80.8k|  if (ltemp <= 0)
  ------------------
  |  Branch (456:7): [True: 0, False: 80.8k]
  ------------------
  457|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  458|  80.8k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (458:7): [True: 0, False: 80.8k]
  ------------------
  459|      0|    rowsperchunk = (JDIMENSION)ltemp;
  460|  80.8k|  else
  461|  80.8k|    rowsperchunk = numrows;
  462|  80.8k|  mem->last_rowsperchunk = rowsperchunk;
  463|       |
  464|       |  /* Get space for row pointers (small object) */
  465|  80.8k|  result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  466|  80.8k|                                   (size_t)(numrows * sizeof(JSAMPROW)));
  467|       |
  468|       |  /* Get the rows themselves (large objects) */
  469|  80.8k|  currow = 0;
  470|   161k|  while (currow < numrows) {
  ------------------
  |  Branch (470:10): [True: 80.8k, False: 80.8k]
  ------------------
  471|  80.8k|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  295|  80.8k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (295:26): [True: 0, False: 80.8k]
  |  |  ------------------
  ------------------
  472|  80.8k|    workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  473|  80.8k|      (size_t)((size_t)rowsperchunk * (size_t)samplesperrow *
  474|  80.8k|               sizeof(JSAMPLE)));
  475|   721k|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (475:28): [True: 640k, False: 80.8k]
  ------------------
  476|   640k|      result[currow++] = workspace;
  477|   640k|      workspace += samplesperrow;
  478|   640k|    }
  479|  80.8k|  }
  480|       |
  481|  80.8k|  return result;
  482|  80.8k|}
jmemmgr.c:alloc_barray:
  494|  36.6k|{
  495|  36.6k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  496|  36.6k|  JBLOCKARRAY result;
  497|  36.6k|  JBLOCKROW workspace;
  498|  36.6k|  JDIMENSION rowsperchunk, currow, i;
  499|  36.6k|  long ltemp;
  500|       |
  501|       |  /* Make sure each row is properly aligned */
  502|  36.6k|  if ((sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  36.6k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (502:7): [Folded - Ignored]
  ------------------
  503|      0|    out_of_memory(cinfo, 6);    /* safety check */
  504|       |
  505|       |  /* Calculate max # of rows allowed in one allocation chunk */
  506|  36.6k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  36.6k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  507|  36.6k|          ((long)blocksperrow * sizeof(JBLOCK));
  508|  36.6k|  if (ltemp <= 0)
  ------------------
  |  Branch (508:7): [True: 0, False: 36.6k]
  ------------------
  509|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  510|  36.6k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (510:7): [True: 0, False: 36.6k]
  ------------------
  511|      0|    rowsperchunk = (JDIMENSION)ltemp;
  512|  36.6k|  else
  513|  36.6k|    rowsperchunk = numrows;
  514|  36.6k|  mem->last_rowsperchunk = rowsperchunk;
  515|       |
  516|       |  /* Get space for row pointers (small object) */
  517|  36.6k|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  518|  36.6k|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  519|       |
  520|       |  /* Get the rows themselves (large objects) */
  521|  36.6k|  currow = 0;
  522|  73.2k|  while (currow < numrows) {
  ------------------
  |  Branch (522:10): [True: 36.6k, False: 36.6k]
  ------------------
  523|  36.6k|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  295|  36.6k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (295:26): [True: 0, False: 36.6k]
  |  |  ------------------
  ------------------
  524|  36.6k|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  525|  36.6k|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  526|  36.6k|                  sizeof(JBLOCK)));
  527|  7.66M|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (527:28): [True: 7.62M, False: 36.6k]
  ------------------
  528|  7.62M|      result[currow++] = workspace;
  529|  7.62M|      workspace += blocksperrow;
  530|  7.62M|    }
  531|  36.6k|  }
  532|       |
  533|  36.6k|  return result;
  534|  36.6k|}
jmemmgr.c:request_virt_barray:
  609|  36.6k|{
  610|  36.6k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  611|  36.6k|  jvirt_barray_ptr result;
  612|       |
  613|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  614|  36.6k|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  826|  36.6k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (614:7): [True: 0, False: 36.6k]
  ------------------
  615|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  616|       |
  617|       |  /* get control block */
  618|  36.6k|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  619|  36.6k|                                         sizeof(struct jvirt_barray_control));
  620|       |
  621|  36.6k|  result->mem_buffer = NULL;    /* marks array not yet realized */
  622|  36.6k|  result->rows_in_array = numrows;
  623|  36.6k|  result->blocksperrow = blocksperrow;
  624|  36.6k|  result->maxaccess = maxaccess;
  625|  36.6k|  result->pre_zero = pre_zero;
  626|  36.6k|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  206|  36.6k|#define FALSE   0               /* values of boolean */
  ------------------
  627|  36.6k|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  628|  36.6k|  mem->virt_barray_list = result;
  629|       |
  630|  36.6k|  return result;
  631|  36.6k|}
jmemmgr.c:realize_virt_arrays:
  637|  54.4k|{
  638|  54.4k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  639|  54.4k|  size_t space_per_minheight, maximum_space, avail_mem;
  640|  54.4k|  size_t minheights, max_minheights;
  641|  54.4k|  jvirt_sarray_ptr sptr;
  642|  54.4k|  jvirt_barray_ptr bptr;
  643|       |
  644|       |  /* Compute the minimum space needed (maxaccess rows in each buffer)
  645|       |   * and the maximum space needed (full image height in each buffer).
  646|       |   * These may be of use to the system-dependent jpeg_mem_available routine.
  647|       |   */
  648|  54.4k|  space_per_minheight = 0;
  649|  54.4k|  maximum_space = 0;
  650|  54.4k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (650:38): [True: 0, False: 54.4k]
  ------------------
  651|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (651:9): [True: 0, False: 0]
  ------------------
  652|      0|      size_t new_space = (long)sptr->rows_in_array *
  653|      0|                         (long)sptr->samplesperrow * sizeof(JSAMPLE);
  654|       |
  655|      0|      space_per_minheight += (long)sptr->maxaccess *
  656|      0|                             (long)sptr->samplesperrow * sizeof(JSAMPLE);
  657|      0|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (657:11): [True: 0, False: 0]
  ------------------
  658|      0|        out_of_memory(cinfo, 10);
  659|      0|      maximum_space += new_space;
  660|      0|    }
  661|      0|  }
  662|  91.1k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (662:38): [True: 36.6k, False: 54.4k]
  ------------------
  663|  36.6k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (663:9): [True: 36.6k, False: 0]
  ------------------
  664|  36.6k|      size_t new_space = (long)bptr->rows_in_array *
  665|  36.6k|                         (long)bptr->blocksperrow * sizeof(JBLOCK);
  666|       |
  667|  36.6k|      space_per_minheight += (long)bptr->maxaccess *
  668|  36.6k|                             (long)bptr->blocksperrow * sizeof(JBLOCK);
  669|  36.6k|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (669:11): [True: 0, False: 36.6k]
  ------------------
  670|      0|        out_of_memory(cinfo, 11);
  671|  36.6k|      maximum_space += new_space;
  672|  36.6k|    }
  673|  36.6k|  }
  674|       |
  675|  54.4k|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (675:7): [True: 32.3k, False: 22.1k]
  ------------------
  676|  32.3k|    return;                     /* no unrealized arrays, no work */
  677|       |
  678|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  679|  22.1k|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  680|  22.1k|                                 mem->total_space_allocated);
  681|       |
  682|       |  /* If the maximum space needed is available, make all the buffers full
  683|       |   * height; otherwise parcel it out with the same number of minheights
  684|       |   * in each buffer.
  685|       |   */
  686|  22.1k|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (686:7): [True: 22.1k, False: 0]
  ------------------
  687|  22.1k|    max_minheights = 1000000000L;
  688|      0|  else {
  689|      0|    max_minheights = avail_mem / space_per_minheight;
  690|       |    /* If there doesn't seem to be enough space, try to get the minimum
  691|       |     * anyway.  This allows a "stub" implementation of jpeg_mem_available().
  692|       |     */
  693|      0|    if (max_minheights <= 0)
  ------------------
  |  Branch (693:9): [True: 0, False: 0]
  ------------------
  694|      0|      max_minheights = 1;
  695|      0|  }
  696|       |
  697|       |  /* Allocate the in-memory buffers and initialize backing store as needed. */
  698|       |
  699|  22.1k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (699:38): [True: 0, False: 22.1k]
  ------------------
  700|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (700:9): [True: 0, False: 0]
  ------------------
  701|      0|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  702|      0|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (702:11): [True: 0, False: 0]
  ------------------
  703|       |        /* This buffer fits in memory */
  704|      0|        sptr->rows_in_mem = sptr->rows_in_array;
  705|      0|      } else {
  706|       |        /* It doesn't fit in memory, create backing store. */
  707|      0|        sptr->rows_in_mem = (JDIMENSION)(max_minheights * sptr->maxaccess);
  708|      0|        jpeg_open_backing_store(cinfo, &sptr->b_s_info,
  709|      0|                                (long)sptr->rows_in_array *
  710|      0|                                (long)sptr->samplesperrow *
  711|      0|                                (long)sizeof(JSAMPLE));
  712|      0|        sptr->b_s_open = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  713|      0|      }
  714|      0|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  715|      0|                                      sptr->samplesperrow, sptr->rows_in_mem);
  716|      0|      sptr->rowsperchunk = mem->last_rowsperchunk;
  717|      0|      sptr->cur_start_row = 0;
  718|      0|      sptr->first_undef_row = 0;
  719|      0|      sptr->dirty = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  720|      0|    }
  721|      0|  }
  722|       |
  723|  58.8k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (723:38): [True: 36.6k, False: 22.1k]
  ------------------
  724|  36.6k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (724:9): [True: 36.6k, False: 0]
  ------------------
  725|  36.6k|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  726|  36.6k|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (726:11): [True: 36.6k, False: 0]
  ------------------
  727|       |        /* This buffer fits in memory */
  728|  36.6k|        bptr->rows_in_mem = bptr->rows_in_array;
  729|  36.6k|      } else {
  730|       |        /* It doesn't fit in memory, create backing store. */
  731|      0|        bptr->rows_in_mem = (JDIMENSION)(max_minheights * bptr->maxaccess);
  732|      0|        jpeg_open_backing_store(cinfo, &bptr->b_s_info,
  733|      0|                                (long)bptr->rows_in_array *
  734|      0|                                (long)bptr->blocksperrow *
  735|      0|                                (long)sizeof(JBLOCK));
  736|      0|        bptr->b_s_open = TRUE;
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  737|      0|      }
  738|  36.6k|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  826|  36.6k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  739|  36.6k|                                      bptr->blocksperrow, bptr->rows_in_mem);
  740|  36.6k|      bptr->rowsperchunk = mem->last_rowsperchunk;
  741|  36.6k|      bptr->cur_start_row = 0;
  742|  36.6k|      bptr->first_undef_row = 0;
  743|  36.6k|      bptr->dirty = FALSE;
  ------------------
  |  |  206|  36.6k|#define FALSE   0               /* values of boolean */
  ------------------
  744|  36.6k|    }
  745|  36.6k|  }
  746|  22.1k|}
jmemmgr.c:access_virt_barray:
  905|  12.8M|{
  906|  12.8M|  JDIMENSION end_row = start_row + num_rows;
  907|  12.8M|  JDIMENSION undef_row;
  908|       |
  909|       |  /* debugging check */
  910|  12.8M|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (910:7): [True: 0, False: 12.8M]
  |  Branch (910:39): [True: 0, False: 12.8M]
  ------------------
  911|  12.8M|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (911:7): [True: 0, False: 12.8M]
  ------------------
  912|      0|    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  913|       |
  914|       |  /* Make the desired part of the virtual array accessible */
  915|  12.8M|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (915:7): [True: 0, False: 12.8M]
  ------------------
  916|  12.8M|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (916:7): [True: 0, False: 12.8M]
  ------------------
  917|      0|    if (!ptr->b_s_open)
  ------------------
  |  Branch (917:9): [True: 0, False: 0]
  ------------------
  918|      0|      ERREXIT(cinfo, JERR_VIRTUAL_BUG);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  919|       |    /* Flush old buffer contents if necessary */
  920|      0|    if (ptr->dirty) {
  ------------------
  |  Branch (920:9): [True: 0, False: 0]
  ------------------
  921|      0|      do_barray_io(cinfo, ptr, TRUE);
  ------------------
  |  |  209|      0|#define TRUE    1
  ------------------
  922|      0|      ptr->dirty = FALSE;
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  923|      0|    }
  924|       |    /* Decide what part of virtual array to access.
  925|       |     * Algorithm: if target address > current window, assume forward scan,
  926|       |     * load starting at target address.  If target address < current window,
  927|       |     * assume backward scan, load so that target area is top of window.
  928|       |     * Note that when switching from forward write to forward read, will have
  929|       |     * start_row = 0, so the limiting case applies and we load from 0 anyway.
  930|       |     */
  931|      0|    if (start_row > ptr->cur_start_row) {
  ------------------
  |  Branch (931:9): [True: 0, False: 0]
  ------------------
  932|      0|      ptr->cur_start_row = start_row;
  933|      0|    } else {
  934|       |      /* use long arithmetic here to avoid overflow & unsigned problems */
  935|      0|      long ltemp;
  936|       |
  937|      0|      ltemp = (long)end_row - (long)ptr->rows_in_mem;
  938|      0|      if (ltemp < 0)
  ------------------
  |  Branch (938:11): [True: 0, False: 0]
  ------------------
  939|      0|        ltemp = 0;              /* don't fall off front end of file */
  940|      0|      ptr->cur_start_row = (JDIMENSION)ltemp;
  941|      0|    }
  942|       |    /* Read in the selected part of the array.
  943|       |     * During the initial write pass, we will do no actual read
  944|       |     * because the selected part is all undefined.
  945|       |     */
  946|      0|    do_barray_io(cinfo, ptr, FALSE);
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
  947|      0|  }
  948|       |  /* Ensure the accessed part of the array is defined; prezero if needed.
  949|       |   * To improve locality of access, we only prezero the part of the array
  950|       |   * that the caller is about to access, not the entire in-memory array.
  951|       |   */
  952|  12.8M|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (952:7): [True: 7.12M, False: 5.70M]
  ------------------
  953|  7.12M|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (953:9): [True: 1.50M, False: 5.62M]
  ------------------
  954|  1.50M|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (954:11): [True: 0, False: 1.50M]
  ------------------
  955|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  956|  1.50M|      undef_row = start_row;    /* but reader is allowed to read ahead */
  957|  5.62M|    } else {
  958|  5.62M|      undef_row = ptr->first_undef_row;
  959|  5.62M|    }
  960|  7.12M|    if (writable)
  ------------------
  |  Branch (960:9): [True: 5.61M, False: 1.51M]
  ------------------
  961|  5.61M|      ptr->first_undef_row = end_row;
  962|  7.12M|    if (ptr->pre_zero) {
  ------------------
  |  Branch (962:9): [True: 7.12M, False: 0]
  ------------------
  963|  7.12M|      size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
  964|  7.12M|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
  965|  7.12M|      end_row -= ptr->cur_start_row;
  966|  14.4M|      while (undef_row < end_row) {
  ------------------
  |  Branch (966:14): [True: 7.35M, False: 7.12M]
  ------------------
  967|  7.35M|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
  968|  7.35M|        undef_row++;
  969|  7.35M|      }
  970|  7.12M|    } else {
  971|      0|      if (!writable)            /* reader looking at undefined data */
  ------------------
  |  Branch (971:11): [True: 0, False: 0]
  ------------------
  972|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  973|      0|    }
  974|  7.12M|  }
  975|       |  /* Flag the buffer dirty if caller will write in it */
  976|  12.8M|  if (writable)
  ------------------
  |  Branch (976:7): [True: 8.50M, False: 4.32M]
  ------------------
  977|  8.50M|    ptr->dirty = TRUE;
  ------------------
  |  |  209|  8.50M|#define TRUE    1
  ------------------
  978|       |  /* Return address of proper part of the buffer */
  979|  12.8M|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
  980|  12.8M|}
jmemmgr.c:free_pool:
  989|   329k|{
  990|   329k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  991|   329k|  small_pool_ptr shdr_ptr;
  992|   329k|  large_pool_ptr lhdr_ptr;
  993|   329k|  size_t space_freed;
  994|       |
  995|   329k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  827|   329k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (995:7): [True: 0, False: 329k]
  |  Branch (995:22): [True: 0, False: 329k]
  ------------------
  996|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  238|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  239|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  240|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  997|       |
  998|       |#ifdef MEM_STATS
  999|       |  if (cinfo->err->trace_level > 1)
 1000|       |    print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */
 1001|       |#endif
 1002|       |
 1003|       |  /* If freeing IMAGE pool, close any virtual arrays first */
 1004|   329k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  826|   329k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1004:7): [True: 311k, False: 18.1k]
  ------------------
 1005|   311k|    jvirt_sarray_ptr sptr;
 1006|   311k|    jvirt_barray_ptr bptr;
 1007|       |
 1008|   311k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1008:40): [True: 0, False: 311k]
  ------------------
 1009|      0|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1009:11): [True: 0, False: 0]
  ------------------
 1010|      0|        sptr->b_s_open = FALSE; /* prevent recursive close if error */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1011|      0|        (*sptr->b_s_info.close_backing_store) (cinfo, &sptr->b_s_info);
 1012|      0|      }
 1013|      0|    }
 1014|   311k|    mem->virt_sarray_list = NULL;
 1015|   348k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1015:40): [True: 36.6k, False: 311k]
  ------------------
 1016|  36.6k|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1016:11): [True: 0, False: 36.6k]
  ------------------
 1017|      0|        bptr->b_s_open = FALSE; /* prevent recursive close if error */
  ------------------
  |  |  206|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1018|      0|        (*bptr->b_s_info.close_backing_store) (cinfo, &bptr->b_s_info);
 1019|      0|      }
 1020|  36.6k|    }
 1021|   311k|    mem->virt_barray_list = NULL;
 1022|   311k|  }
 1023|       |
 1024|       |  /* Release large objects */
 1025|   329k|  lhdr_ptr = mem->large_list[pool_id];
 1026|   329k|  mem->large_list[pool_id] = NULL;
 1027|       |
 1028|   479k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1028:10): [True: 149k, False: 329k]
  ------------------
 1029|   149k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1030|   149k|    space_freed = lhdr_ptr->bytes_used +
 1031|   149k|                  lhdr_ptr->bytes_left +
 1032|   149k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   149k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1033|   149k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1034|   149k|    mem->total_space_allocated -= space_freed;
 1035|   149k|    lhdr_ptr = next_lhdr_ptr;
 1036|   149k|  }
 1037|       |
 1038|       |  /* Release small objects */
 1039|   329k|  shdr_ptr = mem->small_list[pool_id];
 1040|   329k|  mem->small_list[pool_id] = NULL;
 1041|       |
 1042|   430k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1042:10): [True: 100k, False: 329k]
  ------------------
 1043|   100k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1044|   100k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1045|   100k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   100k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1046|   100k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1047|   100k|    mem->total_space_allocated -= space_freed;
 1048|   100k|    shdr_ptr = next_shdr_ptr;
 1049|   100k|  }
 1050|   329k|}
jmemmgr.c:self_destruct:
 1060|  18.1k|{
 1061|  18.1k|  int pool;
 1062|       |
 1063|       |  /* Close all backing store, release all memory.
 1064|       |   * Releasing pools in reverse order might help avoid fragmentation
 1065|       |   * with some (brain-damaged) malloc libraries.
 1066|       |   */
 1067|  54.5k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  827|  18.1k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  825|  54.5k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1067:35): [True: 36.3k, False: 18.1k]
  ------------------
 1068|  36.3k|    free_pool(cinfo, pool);
 1069|  36.3k|  }
 1070|       |
 1071|       |  /* Release the memory manager control block too. */
 1072|  18.1k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1073|  18.1k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1074|       |
 1075|  18.1k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1076|  18.1k|}

jpeg_get_small:
   33|   118k|{
   34|   118k|  return (void *)malloc(sizeofobject);
   35|   118k|}
jpeg_free_small:
   39|   118k|{
   40|   118k|  free(object);
   41|   118k|}
jpeg_get_large:
   50|   149k|{
   51|   149k|  return (void *)malloc(sizeofobject);
   52|   149k|}
jpeg_free_large:
   56|   149k|{
   57|   149k|  free(object);
   58|   149k|}
jpeg_mem_available:
   68|  22.1k|{
   69|  22.1k|  if (cinfo->mem->max_memory_to_use) {
  ------------------
  |  Branch (69:7): [True: 0, False: 22.1k]
  ------------------
   70|      0|    if ((size_t)cinfo->mem->max_memory_to_use > already_allocated)
  ------------------
  |  Branch (70:9): [True: 0, False: 0]
  ------------------
   71|      0|      return cinfo->mem->max_memory_to_use - already_allocated;
   72|      0|    else
   73|      0|      return 0;
   74|  22.1k|  } else {
   75|       |    /* Here we always say, "we got all you want bud!" */
   76|  22.1k|    return max_bytes_needed;
   77|  22.1k|  }
   78|  22.1k|}
jpeg_mem_init:
  102|  18.1k|{
  103|  18.1k|  return 0;                     /* just set max_memory_to_use to 0 */
  104|  18.1k|}
jpeg_mem_term:
  108|  18.1k|{
  109|       |  /* no work */
  110|  18.1k|}

jdhuff.c:std_huff_tables:
   57|  26.6k|{
   58|  26.6k|  JHUFF_TBL **dc_huff_tbl_ptrs, **ac_huff_tbl_ptrs;
   59|       |
   60|  26.6k|  static const UINT8 bits_dc_luminance[17] = {
   61|  26.6k|    /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
   62|  26.6k|  };
   63|  26.6k|  static const UINT8 val_dc_luminance[] = {
   64|  26.6k|    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
   65|  26.6k|  };
   66|       |
   67|  26.6k|  static const UINT8 bits_dc_chrominance[17] = {
   68|  26.6k|    /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
   69|  26.6k|  };
   70|  26.6k|  static const UINT8 val_dc_chrominance[] = {
   71|  26.6k|    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
   72|  26.6k|  };
   73|       |
   74|  26.6k|  static const UINT8 bits_ac_luminance[17] = {
   75|  26.6k|    /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d
   76|  26.6k|  };
   77|  26.6k|  static const UINT8 val_ac_luminance[] = {
   78|  26.6k|    0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
   79|  26.6k|    0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
   80|  26.6k|    0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
   81|  26.6k|    0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
   82|  26.6k|    0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
   83|  26.6k|    0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
   84|  26.6k|    0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
   85|  26.6k|    0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
   86|  26.6k|    0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
   87|  26.6k|    0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
   88|  26.6k|    0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
   89|  26.6k|    0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
   90|  26.6k|    0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
   91|  26.6k|    0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
   92|  26.6k|    0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
   93|  26.6k|    0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
   94|  26.6k|    0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
   95|  26.6k|    0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
   96|  26.6k|    0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
   97|  26.6k|    0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
   98|  26.6k|    0xf9, 0xfa
   99|  26.6k|  };
  100|       |
  101|  26.6k|  static const UINT8 bits_ac_chrominance[17] = {
  102|  26.6k|    /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77
  103|  26.6k|  };
  104|  26.6k|  static const UINT8 val_ac_chrominance[] = {
  105|  26.6k|    0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
  106|  26.6k|    0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
  107|  26.6k|    0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
  108|  26.6k|    0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
  109|  26.6k|    0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
  110|  26.6k|    0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
  111|  26.6k|    0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
  112|  26.6k|    0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
  113|  26.6k|    0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
  114|  26.6k|    0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
  115|  26.6k|    0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
  116|  26.6k|    0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
  117|  26.6k|    0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
  118|  26.6k|    0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
  119|  26.6k|    0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
  120|  26.6k|    0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
  121|  26.6k|    0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
  122|  26.6k|    0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
  123|  26.6k|    0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
  124|  26.6k|    0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
  125|  26.6k|    0xf9, 0xfa
  126|  26.6k|  };
  127|       |
  128|  26.6k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (128:7): [True: 26.6k, False: 0]
  ------------------
  129|  26.6k|    dc_huff_tbl_ptrs = ((j_decompress_ptr)cinfo)->dc_huff_tbl_ptrs;
  130|  26.6k|    ac_huff_tbl_ptrs = ((j_decompress_ptr)cinfo)->ac_huff_tbl_ptrs;
  131|  26.6k|  } else {
  132|      0|    dc_huff_tbl_ptrs = ((j_compress_ptr)cinfo)->dc_huff_tbl_ptrs;
  133|      0|    ac_huff_tbl_ptrs = ((j_compress_ptr)cinfo)->ac_huff_tbl_ptrs;
  134|      0|  }
  135|       |
  136|  26.6k|  add_huff_table(cinfo, &dc_huff_tbl_ptrs[0], bits_dc_luminance,
  137|  26.6k|                 val_dc_luminance);
  138|  26.6k|  add_huff_table(cinfo, &ac_huff_tbl_ptrs[0], bits_ac_luminance,
  139|  26.6k|                 val_ac_luminance);
  140|  26.6k|  add_huff_table(cinfo, &dc_huff_tbl_ptrs[1], bits_dc_chrominance,
  141|  26.6k|                 val_dc_chrominance);
  142|  26.6k|  add_huff_table(cinfo, &ac_huff_tbl_ptrs[1], bits_ac_chrominance,
  143|  26.6k|                 val_ac_chrominance);
  144|  26.6k|}
jdhuff.c:add_huff_table:
   23|   106k|{
   24|   106k|  int nsymbols, len;
   25|       |
   26|   106k|  if (*htblptr == NULL)
  ------------------
  |  Branch (26:7): [True: 15.7k, False: 90.6k]
  ------------------
   27|  15.7k|    *htblptr = jpeg_alloc_huff_table(cinfo);
   28|  90.6k|  else
   29|  90.6k|    return;
   30|       |
   31|       |  /* Copy the number-of-symbols-of-each-code-length counts */
   32|  15.7k|  memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
   33|       |
   34|       |  /* Validate the counts.  We do this here mainly so we can copy the right
   35|       |   * number of symbols from the val[] array, without risking marching off
   36|       |   * the end of memory.  jchuff.c will do a more thorough test later.
   37|       |   */
   38|  15.7k|  nsymbols = 0;
   39|   268k|  for (len = 1; len <= 16; len++)
  ------------------
  |  Branch (39:17): [True: 252k, False: 15.7k]
  ------------------
   40|   252k|    nsymbols += bits[len];
   41|  15.7k|  if (nsymbols < 1 || nsymbols > 256)
  ------------------
  |  Branch (41:7): [True: 0, False: 15.7k]
  |  Branch (41:23): [True: 0, False: 15.7k]
  ------------------
   42|      0|    ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  235|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  236|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   43|       |
   44|  15.7k|  memcpy((*htblptr)->huffval, val, nsymbols * sizeof(UINT8));
   45|  15.7k|  memset(&((*htblptr)->huffval[nsymbols]), 0,
   46|  15.7k|         (256 - nsymbols) * sizeof(UINT8));
   47|       |
   48|       |  /* Initialize sent_table FALSE so table will be written to JPEG file. */
   49|  15.7k|  (*htblptr)->sent_table = FALSE;
  ------------------
  |  |  206|  15.7k|#define FALSE   0               /* values of boolean */
  ------------------
   50|  15.7k|}

jdiv_round_up:
   78|   621k|{
   79|   621k|  return (a + b - 1L) / b;
   80|   621k|}
jround_up:
   87|  83.6k|{
   88|  83.6k|  a += b - 1L;
   89|  83.6k|  return a - (a % b);
   90|  83.6k|}
jcopy_sample_rows:
  102|   300k|{
  103|   300k|  register JSAMPROW inptr, outptr;
  104|   300k|  register size_t count = (size_t)(num_cols * sizeof(JSAMPLE));
  105|   300k|  register int row;
  106|       |
  107|   300k|  input_array += source_row;
  108|   300k|  output_array += dest_row;
  109|       |
  110|  1.11M|  for (row = num_rows; row > 0; row--) {
  ------------------
  |  Branch (110:24): [True: 812k, False: 300k]
  ------------------
  111|   812k|    inptr = *input_array++;
  112|   812k|    outptr = *output_array++;
  113|   812k|    memcpy(outptr, inptr, count);
  114|   812k|  }
  115|   300k|}
jcopy_block_row:
  122|  50.6M|{
  123|  50.6M|  memcpy(output_row, input_row, num_blocks * (DCTSIZE2 * sizeof(JCOEF)));
  ------------------
  |  |   47|  50.6M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  124|  50.6M|}
jzero_far:
  131|  72.3M|{
  132|  72.3M|  memset(target, 0, bytestozero);
  133|  72.3M|}

jsimd_can_ycc_rgb:
  113|  5.13k|{
  114|  5.13k|  init_simd();
  115|       |
  116|       |  /* The code is optimised for these values only */
  117|  5.13k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   33|  5.13k|#define BITS_IN_JSAMPLE  8      /* use 8 or 12 */
  ------------------
  |  Branch (117:7): [Folded - Ignored]
  ------------------
  118|      0|    return 0;
  119|  5.13k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (119:7): [Folded - Ignored]
  ------------------
  120|      0|    return 0;
  121|  5.13k|  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  295|  5.13k|#define RGB_PIXELSIZE   3       /* JSAMPLEs per RGB scanline element */
  ------------------
                if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  295|      0|#define RGB_PIXELSIZE   3       /* JSAMPLEs per RGB scanline element */
  ------------------
  |  Branch (121:7): [Folded - Ignored]
  |  Branch (121:31): [Folded - Ignored]
  ------------------
  122|      0|    return 0;
  123|       |
  124|  5.13k|  if ((simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   28|  5.13k|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (124:7): [True: 5.13k, False: 0]
  ------------------
  125|  5.13k|      IS_ALIGNED_AVX(jconst_ycc_rgb_convert_avx2))
  ------------------
  |  |   32|  5.13k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   29|  5.13k|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (32:30): [True: 5.13k, False: 0]
  |  |  ------------------
  ------------------
  126|  5.13k|    return 1;
  127|      0|  if ((simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   24|      0|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (127:7): [True: 0, False: 0]
  ------------------
  128|      0|      IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2))
  ------------------
  |  |   31|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   29|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (31:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  129|      0|    return 1;
  130|       |
  131|      0|  return 0;
  132|      0|}
jsimd_ycc_rgb_convert:
  242|  10.2M|{
  243|  10.2M|  void (*avx2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
  244|  10.2M|  void (*sse2fct) (JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
  245|       |
  246|  10.2M|  switch (cinfo->out_color_space) {
  247|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (247:3): [True: 0, False: 10.2M]
  ------------------
  248|      0|    avx2fct = jsimd_ycc_extrgb_convert_avx2;
  249|      0|    sse2fct = jsimd_ycc_extrgb_convert_sse2;
  250|      0|    break;
  251|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (251:3): [True: 0, False: 10.2M]
  ------------------
  252|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (252:3): [True: 0, False: 10.2M]
  ------------------
  253|      0|    avx2fct = jsimd_ycc_extrgbx_convert_avx2;
  254|      0|    sse2fct = jsimd_ycc_extrgbx_convert_sse2;
  255|      0|    break;
  256|      0|  case JCS_EXT_BGR:
  ------------------
  |  Branch (256:3): [True: 0, False: 10.2M]
  ------------------
  257|      0|    avx2fct = jsimd_ycc_extbgr_convert_avx2;
  258|      0|    sse2fct = jsimd_ycc_extbgr_convert_sse2;
  259|      0|    break;
  260|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (260:3): [True: 0, False: 10.2M]
  ------------------
  261|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (261:3): [True: 0, False: 10.2M]
  ------------------
  262|      0|    avx2fct = jsimd_ycc_extbgrx_convert_avx2;
  263|      0|    sse2fct = jsimd_ycc_extbgrx_convert_sse2;
  264|      0|    break;
  265|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (265:3): [True: 0, False: 10.2M]
  ------------------
  266|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (266:3): [True: 0, False: 10.2M]
  ------------------
  267|      0|    avx2fct = jsimd_ycc_extxbgr_convert_avx2;
  268|      0|    sse2fct = jsimd_ycc_extxbgr_convert_sse2;
  269|      0|    break;
  270|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (270:3): [True: 0, False: 10.2M]
  ------------------
  271|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (271:3): [True: 0, False: 10.2M]
  ------------------
  272|      0|    avx2fct = jsimd_ycc_extxrgb_convert_avx2;
  273|      0|    sse2fct = jsimd_ycc_extxrgb_convert_sse2;
  274|      0|    break;
  275|  10.2M|  default:
  ------------------
  |  Branch (275:3): [True: 10.2M, False: 0]
  ------------------
  276|  10.2M|    avx2fct = jsimd_ycc_rgb_convert_avx2;
  277|  10.2M|    sse2fct = jsimd_ycc_rgb_convert_sse2;
  278|  10.2M|    break;
  279|  10.2M|  }
  280|       |
  281|  10.2M|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   28|  10.2M|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (281:7): [True: 10.2M, False: 0]
  ------------------
  282|  10.2M|    avx2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
  283|      0|  else
  284|      0|    sse2fct(cinfo->output_width, input_buf, input_row, output_buf, num_rows);
  285|  10.2M|}
jsimd_can_h2v2_upsample:
  366|  1.39k|{
  367|  1.39k|  init_simd();
  368|       |
  369|       |  /* The code is optimised for these values only */
  370|  1.39k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   33|  1.39k|#define BITS_IN_JSAMPLE  8      /* use 8 or 12 */
  ------------------
  |  Branch (370:7): [Folded - Ignored]
  ------------------
  371|      0|    return 0;
  372|  1.39k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (372:7): [Folded - Ignored]
  ------------------
  373|      0|    return 0;
  374|       |
  375|  1.39k|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   28|  1.39k|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (375:7): [True: 1.39k, False: 0]
  ------------------
  376|  1.39k|    return 1;
  377|      0|  if (simd_support & JSIMD_SSE2)
  ------------------
  |  |   24|      0|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (377:7): [True: 0, False: 0]
  ------------------
  378|      0|    return 1;
  379|       |
  380|      0|  return 0;
  381|      0|}
jsimd_can_h2v1_upsample:
  385|  1.75k|{
  386|  1.75k|  init_simd();
  387|       |
  388|       |  /* The code is optimised for these values only */
  389|  1.75k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   33|  1.75k|#define BITS_IN_JSAMPLE  8      /* use 8 or 12 */
  ------------------
  |  Branch (389:7): [Folded - Ignored]
  ------------------
  390|      0|    return 0;
  391|  1.75k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (391:7): [Folded - Ignored]
  ------------------
  392|      0|    return 0;
  393|       |
  394|  1.75k|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   28|  1.75k|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (394:7): [True: 1.75k, False: 0]
  ------------------
  395|  1.75k|    return 1;
  396|      0|  if (simd_support & JSIMD_SSE2)
  ------------------
  |  |   24|      0|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (396:7): [True: 0, False: 0]
  ------------------
  397|      0|    return 1;
  398|       |
  399|      0|  return 0;
  400|      0|}
jsimd_h2v2_upsample:
  405|  1.20M|{
  406|  1.20M|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   28|  1.20M|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (406:7): [True: 1.20M, False: 0]
  ------------------
  407|  1.20M|    jsimd_h2v2_upsample_avx2(cinfo->max_v_samp_factor, cinfo->output_width,
  408|  1.20M|                             input_data, output_data_ptr);
  409|      0|  else
  410|      0|    jsimd_h2v2_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width,
  411|      0|                             input_data, output_data_ptr);
  412|  1.20M|}
jsimd_h2v1_upsample:
  417|  5.01M|{
  418|  5.01M|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   28|  5.01M|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (418:7): [True: 5.01M, False: 0]
  ------------------
  419|  5.01M|    jsimd_h2v1_upsample_avx2(cinfo->max_v_samp_factor, cinfo->output_width,
  420|  5.01M|                             input_data, output_data_ptr);
  421|      0|  else
  422|      0|    jsimd_h2v1_upsample_sse2(cinfo->max_v_samp_factor, cinfo->output_width,
  423|      0|                             input_data, output_data_ptr);
  424|  5.01M|}
jsimd_can_h2v2_fancy_upsample:
  428|  3.69k|{
  429|  3.69k|  init_simd();
  430|       |
  431|       |  /* The code is optimised for these values only */
  432|  3.69k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   33|  3.69k|#define BITS_IN_JSAMPLE  8      /* use 8 or 12 */
  ------------------
  |  Branch (432:7): [Folded - Ignored]
  ------------------
  433|      0|    return 0;
  434|  3.69k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (434:7): [Folded - Ignored]
  ------------------
  435|      0|    return 0;
  436|       |
  437|  3.69k|  if ((simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   28|  3.69k|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (437:7): [True: 3.69k, False: 0]
  ------------------
  438|  3.69k|      IS_ALIGNED_AVX(jconst_fancy_upsample_avx2))
  ------------------
  |  |   32|  3.69k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   29|  3.69k|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (32:30): [True: 3.69k, False: 0]
  |  |  ------------------
  ------------------
  439|  3.69k|    return 1;
  440|      0|  if ((simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   24|      0|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (440:7): [True: 0, False: 0]
  ------------------
  441|      0|      IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
  ------------------
  |  |   31|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   29|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (31:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  442|      0|    return 1;
  443|       |
  444|      0|  return 0;
  445|      0|}
jsimd_can_h2v1_fancy_upsample:
  449|    547|{
  450|    547|  init_simd();
  451|       |
  452|       |  /* The code is optimised for these values only */
  453|    547|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   33|    547|#define BITS_IN_JSAMPLE  8      /* use 8 or 12 */
  ------------------
  |  Branch (453:7): [Folded - Ignored]
  ------------------
  454|      0|    return 0;
  455|    547|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (455:7): [Folded - Ignored]
  ------------------
  456|      0|    return 0;
  457|       |
  458|    547|  if ((simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   28|    547|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (458:7): [True: 547, False: 0]
  ------------------
  459|    547|      IS_ALIGNED_AVX(jconst_fancy_upsample_avx2))
  ------------------
  |  |   32|    547|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   29|    547|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (32:30): [True: 547, False: 0]
  |  |  ------------------
  ------------------
  460|    547|    return 1;
  461|      0|  if ((simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   24|      0|#define JSIMD_SSE2     0x08
  ------------------
  |  Branch (461:7): [True: 0, False: 0]
  ------------------
  462|      0|      IS_ALIGNED_SSE(jconst_fancy_upsample_sse2))
  ------------------
  |  |   31|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   29|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (31:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  463|      0|    return 1;
  464|       |
  465|      0|  return 0;
  466|      0|}
jsimd_h2v2_fancy_upsample:
  471|  5.37M|{
  472|  5.37M|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   28|  5.37M|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (472:7): [True: 5.37M, False: 0]
  ------------------
  473|  5.37M|    jsimd_h2v2_fancy_upsample_avx2(cinfo->max_v_samp_factor,
  474|  5.37M|                                   compptr->downsampled_width, input_data,
  475|  5.37M|                                   output_data_ptr);
  476|      0|  else
  477|      0|    jsimd_h2v2_fancy_upsample_sse2(cinfo->max_v_samp_factor,
  478|      0|                                   compptr->downsampled_width, input_data,
  479|      0|                                   output_data_ptr);
  480|  5.37M|}
jsimd_h2v1_fancy_upsample:
  485|   168k|{
  486|   168k|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   28|   168k|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (486:7): [True: 168k, False: 0]
  ------------------
  487|   168k|    jsimd_h2v1_fancy_upsample_avx2(cinfo->max_v_samp_factor,
  488|   168k|                                   compptr->downsampled_width, input_data,
  489|   168k|                                   output_data_ptr);
  490|      0|  else
  491|      0|    jsimd_h2v1_fancy_upsample_sse2(cinfo->max_v_samp_factor,
  492|      0|                                   compptr->downsampled_width, input_data,
  493|      0|                                   output_data_ptr);
  494|   168k|}
jsimd_can_idct_islow:
  889|  59.7k|{
  890|  59.7k|  init_simd();
  891|       |
  892|       |  /* The code is optimised for these values only */
  893|  59.7k|  if (DCTSIZE != 8)
  ------------------
  |  |   46|  59.7k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (893:7): [Folded - Ignored]
  ------------------
  894|      0|    return 0;
  895|  59.7k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (895:7): [Folded - Ignored]
  ------------------
  896|      0|    return 0;
  897|  59.7k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   33|  59.7k|#define BITS_IN_JSAMPLE  8      /* use 8 or 12 */
  ------------------
  |  Branch (897:7): [Folded - Ignored]
  ------------------
  898|      0|    return 0;
  899|  59.7k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (899:7): [Folded - Ignored]
  ------------------
  900|      0|    return 0;
  901|  59.7k|  if (sizeof(ISLOW_MULT_TYPE) != 2)
  ------------------
  |  Branch (901:7): [Folded - Ignored]
  ------------------
  902|      0|    return 0;
  903|       |
  904|  59.7k|  if ((simd_support & JSIMD_AVX2) && IS_ALIGNED_AVX(jconst_idct_islow_avx2))
  ------------------
  |  |   28|  59.7k|#define JSIMD_AVX2     0x80
  ------------------
                if ((simd_support & JSIMD_AVX2) && IS_ALIGNED_AVX(jconst_idct_islow_avx2))
  ------------------
  |  |   32|  59.7k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   29|  59.7k|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (32:30): [True: 59.7k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (904:7): [True: 59.7k, False: 0]
  ------------------
  905|  59.7k|    return 1;
  906|      0|  if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
  ------------------
  |  |   24|      0|#define JSIMD_SSE2     0x08
  ------------------
                if ((simd_support & JSIMD_SSE2) && IS_ALIGNED_SSE(jconst_idct_islow_sse2))
  ------------------
  |  |   31|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   29|      0|#define IS_ALIGNED(ptr, order)  (((size_t)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (31:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (906:7): [True: 0, False: 0]
  ------------------
  907|      0|    return 1;
  908|       |
  909|      0|  return 0;
  910|      0|}
jsimd_idct_islow:
  965|   187M|{
  966|   187M|  if (simd_support & JSIMD_AVX2)
  ------------------
  |  |   28|   187M|#define JSIMD_AVX2     0x80
  ------------------
  |  Branch (966:7): [True: 187M, False: 0]
  ------------------
  967|   187M|    jsimd_idct_islow_avx2(compptr->dct_table, coef_block, output_buf,
  968|   187M|                          output_col);
  969|      0|  else
  970|      0|    jsimd_idct_islow_sse2(compptr->dct_table, coef_block, output_buf,
  971|      0|                          output_col);
  972|   187M|}
jsimd.c:init_simd:
   42|  72.2k|{
   43|  72.2k|#ifndef NO_GETENV
   44|  72.2k|  char env[2] = { 0 };
   45|  72.2k|#endif
   46|       |
   47|  72.2k|  if (simd_support != ~0U)
  ------------------
  |  Branch (47:7): [True: 72.2k, False: 1]
  ------------------
   48|  72.2k|    return;
   49|       |
   50|      1|  simd_support = jpeg_simd_cpu_support();
   51|       |
   52|      1|#ifndef NO_GETENV
   53|       |  /* Force different settings through environment variables */
   54|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1"))
  ------------------
  |  Branch (54:7): [True: 1, False: 0]
  |  Branch (54:47): [True: 0, False: 1]
  ------------------
   55|      0|    simd_support &= JSIMD_SSE2;
  ------------------
  |  |   24|      0|#define JSIMD_SSE2     0x08
  ------------------
   56|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCEAVX2") && !strcmp(env, "1"))
  ------------------
  |  Branch (56:7): [True: 1, False: 0]
  |  Branch (56:47): [True: 0, False: 1]
  ------------------
   57|      0|    simd_support &= JSIMD_AVX2;
  ------------------
  |  |   28|      0|#define JSIMD_AVX2     0x80
  ------------------
   58|      1|  if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
  ------------------
  |  Branch (58:7): [True: 1, False: 0]
  |  Branch (58:47): [True: 0, False: 1]
  ------------------
   59|      0|    simd_support = 0;
   60|      1|  if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
  ------------------
  |  Branch (60:7): [True: 1, False: 0]
  |  Branch (60:47): [True: 0, False: 1]
  ------------------
   61|      0|    simd_huffman = 0;
   62|      1|#endif
   63|      1|}

handle_error:
   38|   177M|extern "C" void handle_error(const char *unused, const char *unused2, va_list unused3) {
   39|   177M|    return;
   40|   177M|}
LLVMFuzzerTestOneInput:
   42|  23.5k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   43|  23.5k|#ifndef STANDALONE
   44|  23.5k|  TIFFSetErrorHandler(handle_error);
   45|  23.5k|  TIFFSetWarningHandler(handle_error);
   46|  23.5k|#endif
   47|  23.5k|#if defined(__has_feature)
   48|       |#  if __has_feature(memory_sanitizer)
   49|       |  // libjpeg-turbo has issues with MSAN and SIMD code
   50|       |  // See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7547
   51|       |  // and https://github.com/libjpeg-turbo/libjpeg-turbo/pull/365
   52|       |  setenv("JSIMD_FORCENONE" ,"1", 1);
   53|       |#  endif
   54|  23.5k|#endif
   55|  23.5k|  std::istringstream s(std::string(Data,Data+Size));
   56|  23.5k|  TIFF* tif = TIFFStreamOpen("MemTIFF", &s);
   57|  23.5k|  if (!tif) {
  ------------------
  |  Branch (57:7): [True: 10.3k, False: 13.2k]
  ------------------
   58|  10.3k|      return 0;
   59|  10.3k|  }
   60|  13.2k|  uint32_t w, h;
   61|  13.2k|  uint32_t* raster;
   62|       |
   63|  13.2k|  TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
  ------------------
  |  |  172|  13.2k|#define	TIFFTAG_IMAGEWIDTH		256	/* image width in pixels */
  ------------------
   64|  13.2k|  TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
  ------------------
  |  |  173|  13.2k|#define	TIFFTAG_IMAGELENGTH		257	/* image height in pixels */
  ------------------
   65|       |  /* don't continue if file size is ludicrous */
   66|  13.2k|  if (TIFFTileSize64(tif) > MAX_SIZE) {
  ------------------
  |  Branch (66:7): [True: 766, False: 12.4k]
  ------------------
   67|    766|      TIFFClose(tif);
   68|    766|      return 0;
   69|    766|  }
   70|  12.4k|  uint64_t bufsize = TIFFTileSize64(tif);
   71|       |  /* don't continue if the buffer size greater than the max allowed by the fuzzer */
   72|  12.4k|  if (bufsize > MAX_SIZE || bufsize == 0) {
  ------------------
  |  Branch (72:7): [True: 0, False: 12.4k]
  |  Branch (72:29): [True: 96, False: 12.3k]
  ------------------
   73|     96|      TIFFClose(tif);
   74|     96|      return 0;
   75|     96|  }
   76|       |  /* another hack to work around an OOM in tif_fax3.c */
   77|  12.3k|  uint32_t tilewidth = 0;
   78|  12.3k|  uint32_t imagewidth = 0;
   79|  12.3k|  TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tilewidth);
  ------------------
  |  |  305|  12.3k|#define	TIFFTAG_TILEWIDTH		322	/* !tile width in pixels */
  ------------------
   80|  12.3k|  TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &imagewidth);
  ------------------
  |  |  172|  12.3k|#define	TIFFTAG_IMAGEWIDTH		256	/* image width in pixels */
  ------------------
   81|  12.3k|  tilewidth = __TIFFSafeMultiply(uint32_t, tilewidth, 2);
  ------------------
  |  |   34|  12.3k|#define __TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
  |  |  ------------------
  |  |  |  Branch (34:37): [Folded - Ignored]
  |  |  |  Branch (34:57): [True: 12.3k, False: 2]
  |  |  ------------------
  ------------------
   82|  12.3k|  imagewidth = __TIFFSafeMultiply(uint32_t, imagewidth, 2);
  ------------------
  |  |   34|  12.3k|#define __TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
  |  |  ------------------
  |  |  |  Branch (34:37): [Folded - Ignored]
  |  |  |  Branch (34:57): [True: 12.3k, False: 13]
  |  |  ------------------
  ------------------
   83|  12.3k|  if (tilewidth * 2 > MAX_SIZE || imagewidth * 2 > MAX_SIZE || tilewidth == 0 || imagewidth == 0) {
  ------------------
  |  Branch (83:7): [True: 1, False: 12.3k]
  |  Branch (83:35): [True: 21, False: 12.3k]
  |  Branch (83:64): [True: 249, False: 12.1k]
  |  Branch (83:82): [True: 1, False: 12.1k]
  ------------------
   84|    272|      TIFFClose(tif);
   85|    272|      return 0;
   86|    272|  }
   87|  12.1k|  uint32_t size = __TIFFSafeMultiply(uint32_t, w, h);
  ------------------
  |  |   34|  12.1k|#define __TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
  |  |  ------------------
  |  |  |  Branch (34:37): [True: 12.1k, False: 0]
  |  |  |  Branch (34:57): [True: 12.1k, False: 5]
  |  |  ------------------
  ------------------
   88|  12.1k|  if (size > MAX_SIZE || size == 0) {
  ------------------
  |  Branch (88:7): [True: 14, False: 12.1k]
  |  Branch (88:26): [True: 5, False: 12.0k]
  ------------------
   89|     19|      TIFFClose(tif);
   90|     19|      return 0;
   91|     19|  }
   92|  12.0k|  raster = (uint32_t*) _TIFFmalloc(size * sizeof (uint32_t));
   93|  12.0k|  if (raster != NULL) {
  ------------------
  |  Branch (93:7): [True: 12.0k, False: 0]
  ------------------
   94|  12.0k|      TIFFReadRGBAImage(tif, w, h, raster, 0);
   95|  12.0k|      _TIFFfree(raster);
   96|  12.0k|  }
   97|  12.0k|  TIFFClose(tif);
   98|       |
   99|  12.0k|  return 0;
  100|  12.1k|}

_TIFFMultiply32:
   37|  26.1k|{
   38|  26.1k|	if (second && first > UINT32_MAX / second) {
  ------------------
  |  Branch (38:6): [True: 26.0k, False: 49]
  |  Branch (38:16): [True: 4, False: 26.0k]
  ------------------
   39|      4|		TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
   40|      4|		return 0;
   41|      4|	}
   42|       |
   43|  26.1k|	return first * second;
   44|  26.1k|}
_TIFFMultiply64:
   48|  2.77M|{
   49|  2.77M|	if (second && first > UINT64_MAX / second) {
  ------------------
  |  Branch (49:6): [True: 2.77M, False: 1.67k]
  |  Branch (49:16): [True: 9, False: 2.77M]
  ------------------
   50|      9|		TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
   51|      9|		return 0;
   52|      9|	}
   53|       |
   54|  2.77M|	return first * second;
   55|  2.77M|}
_TIFFMultiplySSize:
   59|   334k|{
   60|   334k|    if( first <= 0 || second <= 0 )
  ------------------
  |  Branch (60:9): [True: 1, False: 334k]
  |  Branch (60:23): [True: 0, False: 334k]
  ------------------
   61|      1|    {
   62|      1|        if( tif != NULL && where != NULL )
  ------------------
  |  Branch (62:13): [True: 1, False: 0]
  |  Branch (62:28): [True: 0, False: 1]
  ------------------
   63|      0|        {
   64|      0|            TIFFErrorExtR(tif, where,
   65|      0|                        "Invalid argument to _TIFFMultiplySSize() in %s", where);
   66|      0|        }
   67|      1|        return 0;
   68|      1|    }
   69|       |
   70|   334k|    if( first > TIFF_TMSIZE_T_MAX / second )
  ------------------
  |  |   66|   334k|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (70:9): [True: 0, False: 334k]
  ------------------
   71|      0|    {
   72|      0|        if( tif != NULL && where != NULL )
  ------------------
  |  Branch (72:13): [True: 0, False: 0]
  |  Branch (72:28): [True: 0, False: 0]
  ------------------
   73|      0|        {
   74|      0|            TIFFErrorExtR(tif, where,
   75|      0|                        "Integer overflow in %s", where);
   76|      0|        }
   77|      0|        return 0;
   78|      0|    }
   79|   334k|    return first * second;
   80|   334k|}
_TIFFCastUInt64ToSSize:
   83|  1.40M|{
   84|  1.40M|    if( val > (uint64_t)TIFF_TMSIZE_T_MAX )
  ------------------
  |  |   66|  1.40M|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (84:9): [True: 25, False: 1.40M]
  ------------------
   85|     25|    {
   86|     25|        if( tif != NULL && module != NULL )
  ------------------
  |  Branch (86:13): [True: 25, False: 0]
  |  Branch (86:28): [True: 25, False: 0]
  ------------------
   87|     25|        {
   88|     25|            TIFFErrorExtR(tif,module,"Integer overflow");
   89|     25|        }
   90|     25|        return 0;
   91|     25|    }
   92|  1.40M|    return (tmsize_t)val;
   93|  1.40M|}
_TIFFCheckRealloc:
   98|   324k|{
   99|   324k|	void* cp = NULL;
  100|   324k|        tmsize_t count = _TIFFMultiplySSize(tif, nmemb, elem_size, NULL);
  101|       |	/*
  102|       |	 * Check for integer overflow.
  103|       |	 */
  104|   324k|	if (count != 0)
  ------------------
  |  Branch (104:6): [True: 324k, False: 1]
  ------------------
  105|   324k|	{
  106|   324k|		cp = _TIFFrealloc(buffer, count);
  107|   324k|	}
  108|       |
  109|   324k|	if (cp == NULL) {
  ------------------
  |  Branch (109:6): [True: 1, False: 324k]
  ------------------
  110|      1|		TIFFErrorExtR(tif, tif->tif_name,
  111|      1|			     "Failed to allocate memory for %s "
  112|      1|			     "(%"TIFF_SSIZE_FORMAT" elements of %"TIFF_SSIZE_FORMAT" bytes each)",
  113|      1|			     what, nmemb, elem_size);
  114|      1|	}
  115|       |
  116|   324k|	return cp;
  117|   324k|}
_TIFFCheckMalloc:
  121|   105k|{
  122|   105k|	return _TIFFCheckRealloc(tif, NULL, nmemb, elem_size, what);  
  123|   105k|}
TIFFVGetFieldDefaulted:
  209|   102k|{
  210|   102k|	TIFFDirectory *td = &tif->tif_dir;
  211|       |
  212|   102k|	if (TIFFVGetField(tif, tag, ap))
  ------------------
  |  Branch (212:6): [True: 52.4k, False: 49.8k]
  ------------------
  213|  52.4k|		return (1);
  214|  49.8k|	switch (tag) {
  ------------------
  |  Branch (214:10): [True: 0, False: 49.8k]
  ------------------
  215|      0|	case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  164|      0|#define	TIFFTAG_SUBFILETYPE		254	/* subfile data descriptor */
  ------------------
  |  Branch (215:2): [True: 0, False: 49.8k]
  ------------------
  216|      0|		*va_arg(ap, uint32_t *) = td->td_subfiletype;
  217|      0|		return (1);
  218|  4.76k|	case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  174|  4.76k|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
  |  Branch (218:2): [True: 4.76k, False: 45.1k]
  ------------------
  219|  4.76k|		*va_arg(ap, uint16_t *) = td->td_bitspersample;
  220|  4.76k|		return (1);
  221|      0|	case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  228|      0|#define	TIFFTAG_THRESHHOLDING		263	/* +thresholding used on data */
  ------------------
  |  Branch (221:2): [True: 0, False: 49.8k]
  ------------------
  222|      0|		*va_arg(ap, uint16_t *) = td->td_threshholding;
  223|      0|		return (1);
  224|      0|	case TIFFTAG_FILLORDER:
  ------------------
  |  |  234|      0|#define	TIFFTAG_FILLORDER		266	/* data order within a byte */
  ------------------
  |  Branch (224:2): [True: 0, False: 49.8k]
  ------------------
  225|      0|		*va_arg(ap, uint16_t *) = td->td_fillorder;
  226|      0|		return (1);
  227|  11.7k|	case TIFFTAG_ORIENTATION:
  ------------------
  |  |  242|  11.7k|#define	TIFFTAG_ORIENTATION		274	/* +image orientation */
  ------------------
  |  Branch (227:2): [True: 11.7k, False: 38.1k]
  ------------------
  228|  11.7k|		*va_arg(ap, uint16_t *) = td->td_orientation;
  229|  11.7k|		return (1);
  230|  6.99k|	case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  251|  6.99k|#define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
  ------------------
  |  Branch (230:2): [True: 6.99k, False: 42.8k]
  ------------------
  231|  6.99k|		*va_arg(ap, uint16_t *) = td->td_samplesperpixel;
  232|  6.99k|		return (1);
  233|      0|	case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  252|      0|#define	TIFFTAG_ROWSPERSTRIP		278	/* rows per strip of data */
  ------------------
  |  Branch (233:2): [True: 0, False: 49.8k]
  ------------------
  234|      0|		*va_arg(ap, uint32_t *) = td->td_rowsperstrip;
  235|      0|		return (1);
  236|      0|	case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  254|      0|#define	TIFFTAG_MINSAMPLEVALUE		280	/* +minimum sample value */
  ------------------
  |  Branch (236:2): [True: 0, False: 49.8k]
  ------------------
  237|      0|		*va_arg(ap, uint16_t *) = td->td_minsamplevalue;
  238|      0|		return (1);
  239|      0|	case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  255|      0|#define	TIFFTAG_MAXSAMPLEVALUE		281	/* +maximum sample value */
  ------------------
  |  Branch (239:2): [True: 0, False: 49.8k]
  ------------------
  240|      0|	{
  241|      0|		uint16_t maxsamplevalue;
  242|       |		/* td_bitspersample=1 is always set in TIFFDefaultDirectory().
  243|       |		 * Therefore, td_maxsamplevalue has to be re-calculated in TIFFGetFieldDefaulted(). */
  244|      0|		if (td->td_bitspersample > 0) {
  ------------------
  |  Branch (244:7): [True: 0, False: 0]
  ------------------
  245|       |			/* This shift operation into a uint16_t limits the value to 65535 even if td_bitspersamle is > 16 */
  246|      0|			if (td->td_bitspersample <= 16) {
  ------------------
  |  Branch (246:8): [True: 0, False: 0]
  ------------------
  247|      0|				maxsamplevalue = (1 << td->td_bitspersample) - 1;  /* 2**(BitsPerSample) - 1 */
  248|      0|			} else {
  249|      0|				maxsamplevalue = 65535;
  250|      0|			}
  251|      0|		} else {
  252|      0|			maxsamplevalue = 0;
  253|      0|		}
  254|      0|		*va_arg(ap, uint16_t *) = maxsamplevalue;
  255|      0|		return (1);
  256|      0|	}
  257|      0|	case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  258|      0|#define	TIFFTAG_PLANARCONFIG		284	/* storage organization */
  ------------------
  |  Branch (257:2): [True: 0, False: 49.8k]
  ------------------
  258|      0|		*va_arg(ap, uint16_t *) = td->td_planarconfig;
  259|      0|		return (1);
  260|      0|	case TIFFTAG_RESOLUTIONUNIT:
  ------------------
  |  |  281|      0|#define	TIFFTAG_RESOLUTIONUNIT		296	/* units of resolutions */
  ------------------
  |  Branch (260:2): [True: 0, False: 49.8k]
  ------------------
  261|      0|		*va_arg(ap, uint16_t *) = td->td_resolutionunit;
  262|      0|		return (1);
  263|      0|	case TIFFTAG_PREDICTOR:
  ------------------
  |  |  297|      0|#define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
  ------------------
  |  Branch (263:2): [True: 0, False: 49.8k]
  ------------------
  264|      0|    {
  265|      0|        TIFFPredictorState* sp = (TIFFPredictorState*) tif->tif_data;
  266|      0|        if( sp == NULL )
  ------------------
  |  Branch (266:13): [True: 0, False: 0]
  ------------------
  267|      0|        {
  268|      0|            TIFFErrorExtR(tif, tif->tif_name,
  269|      0|                         "Cannot get \"Predictor\" tag as plugin is not configured");
  270|      0|            *va_arg(ap, uint16_t*) = 0;
  271|      0|            return 0;
  272|      0|        }
  273|      0|        *va_arg(ap, uint16_t*) = (uint16_t) sp->predictor;
  274|      0|        return 1;
  275|      0|    }
  276|      0|	case TIFFTAG_DOTRANGE:
  ------------------
  |  |  321|      0|#define	TIFFTAG_DOTRANGE		336	/* !0% and 100% dot codes */
  ------------------
  |  Branch (276:2): [True: 0, False: 49.8k]
  ------------------
  277|      0|		*va_arg(ap, uint16_t *) = 0;
  278|      0|		*va_arg(ap, uint16_t *) = (1 << td->td_bitspersample) - 1;
  279|      0|		return (1);
  280|    255|	case TIFFTAG_INKSET:
  ------------------
  |  |  316|    255|#define	TIFFTAG_INKSET			332	/* !inks in separated image */
  ------------------
  |  Branch (280:2): [True: 255, False: 49.6k]
  ------------------
  281|    255|		*va_arg(ap, uint16_t *) = INKSET_CMYK;
  ------------------
  |  |  317|    255|#define	    INKSET_CMYK			1	/* !cyan-magenta-yellow-black color */
  ------------------
  282|    255|		return 1;
  283|      0|	case TIFFTAG_NUMBEROFINKS:
  ------------------
  |  |  320|      0|#define	TIFFTAG_NUMBEROFINKS		334	/* !number of inks */
  ------------------
  |  Branch (283:2): [True: 0, False: 49.8k]
  ------------------
  284|      0|		*va_arg(ap, uint16_t *) = 4;
  285|      0|		return (1);
  286|  11.8k|	case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  323|  11.8k|#define	TIFFTAG_EXTRASAMPLES		338	/* !info about extra samples */
  ------------------
  |  Branch (286:2): [True: 11.8k, False: 38.0k]
  ------------------
  287|  11.8k|		*va_arg(ap, uint16_t *) = td->td_extrasamples;
  288|  11.8k|		*va_arg(ap, const uint16_t **) = td->td_sampleinfo;
  289|  11.8k|		return (1);
  290|      0|	case TIFFTAG_MATTEING:
  ------------------
  |  |  404|      0|#define	TIFFTAG_MATTEING		32995	/* $use ExtraSamples */
  ------------------
  |  Branch (290:2): [True: 0, False: 49.8k]
  ------------------
  291|      0|		*va_arg(ap, uint16_t *) =
  292|      0|		    (td->td_extrasamples == 1 &&
  ------------------
  |  Branch (292:8): [True: 0, False: 0]
  ------------------
  293|      0|		     td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
  ------------------
  |  |  325|      0|#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
  ------------------
  |  Branch (293:8): [True: 0, False: 0]
  ------------------
  294|      0|		return (1);
  295|      0|	case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  407|      0|#define	TIFFTAG_TILEDEPTH		32998	/* z depth/data tile */
  ------------------
  |  Branch (295:2): [True: 0, False: 49.8k]
  ------------------
  296|      0|		*va_arg(ap, uint32_t *) = td->td_tiledepth;
  297|      0|		return (1);
  298|      0|	case TIFFTAG_DATATYPE:
  ------------------
  |  |  405|      0|#define	TIFFTAG_DATATYPE		32996	/* $use SampleFormat */
  ------------------
  |  Branch (298:2): [True: 0, False: 49.8k]
  ------------------
  299|      0|		*va_arg(ap, uint16_t *) = td->td_sampleformat - 1;
  300|      0|		return (1);
  301|      0|	case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  327|      0|#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
  ------------------
  |  Branch (301:2): [True: 0, False: 49.8k]
  ------------------
  302|      0|		*va_arg(ap, uint16_t *) = td->td_sampleformat;
  303|      0|                return(1);
  304|      0|	case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  406|      0|#define	TIFFTAG_IMAGEDEPTH		32997	/* z depth of image */
  ------------------
  |  Branch (304:2): [True: 0, False: 49.8k]
  ------------------
  305|      0|		*va_arg(ap, uint32_t *) = td->td_imagedepth;
  306|      0|		return (1);
  307|  2.10k|	case TIFFTAG_YCBCRCOEFFICIENTS:
  ------------------
  |  |  385|  2.10k|#define	TIFFTAG_YCBCRCOEFFICIENTS	529	/* !RGB -> YCbCr transform */
  ------------------
  |  Branch (307:2): [True: 2.10k, False: 47.7k]
  ------------------
  308|  2.10k|		{
  309|       |			/* defaults are from CCIR Recommendation 601-1 */
  310|  2.10k|			static const float ycbcrcoeffs[] = { 0.299f, 0.587f, 0.114f };
  311|  2.10k|			*va_arg(ap, const float **) = ycbcrcoeffs;
  312|  2.10k|			return 1;
  313|      0|		}
  314|  9.94k|	case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  386|  9.94k|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
  |  Branch (314:2): [True: 9.94k, False: 39.9k]
  ------------------
  315|  9.94k|		*va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[0];
  316|  9.94k|		*va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[1];
  317|  9.94k|		return (1);
  318|      0|	case TIFFTAG_YCBCRPOSITIONING:
  ------------------
  |  |  387|      0|#define	TIFFTAG_YCBCRPOSITIONING	531	/* !subsample positioning */
  ------------------
  |  Branch (318:2): [True: 0, False: 49.8k]
  ------------------
  319|      0|		*va_arg(ap, uint16_t *) = td->td_ycbcrpositioning;
  320|      0|		return (1);
  321|    134|	case TIFFTAG_WHITEPOINT:
  ------------------
  |  |  301|    134|#define	TIFFTAG_WHITEPOINT		318	/* image white point */
  ------------------
  |  Branch (321:2): [True: 134, False: 49.7k]
  ------------------
  322|    134|		{
  323|       |			/* TIFF 6.0 specification tells that it is no default
  324|       |			   value for the WhitePoint, but AdobePhotoshop TIFF
  325|       |			   Technical Note tells that it should be CIE D50. */
  326|    134|			static const float whitepoint[] = {
  327|    134|						D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  132|    134|#define D50_X0 (96.4250F)
  ------------------
              						D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  132|    134|#define D50_X0 (96.4250F)
  ------------------
              						D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  133|    134|#define D50_Y0 (100.0F)
  ------------------
              						D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  134|    134|#define D50_Z0 (82.4680F)
  ------------------
  328|    134|						D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)
  ------------------
  |  |  133|    134|#define D50_Y0 (100.0F)
  ------------------
              						D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)
  ------------------
  |  |  132|    134|#define D50_X0 (96.4250F)
  ------------------
              						D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)
  ------------------
  |  |  133|    134|#define D50_Y0 (100.0F)
  ------------------
              						D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)
  ------------------
  |  |  134|    134|#define D50_Z0 (82.4680F)
  ------------------
  329|    134|			};
  330|    134|			*va_arg(ap, const float **) = whitepoint;
  331|    134|			return 1;
  332|      0|		}
  333|      0|	case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  292|      0|#define	TIFFTAG_TRANSFERFUNCTION	301	/* !colorimetry info */
  ------------------
  |  Branch (333:2): [True: 0, False: 49.8k]
  ------------------
  334|      0|		if (!td->td_transferfunction[0] &&
  ------------------
  |  Branch (334:7): [True: 0, False: 0]
  ------------------
  335|      0|		    !TIFFDefaultTransferFunction(td)) {
  ------------------
  |  Branch (335:7): [True: 0, False: 0]
  ------------------
  336|      0|			TIFFErrorExtR(tif, tif->tif_name, "No space for \"TransferFunction\" tag");
  337|      0|			return (0);
  338|      0|		}
  339|      0|		*va_arg(ap, const uint16_t **) = td->td_transferfunction[0];
  340|      0|		if (td->td_samplesperpixel - td->td_extrasamples > 1) {
  ------------------
  |  Branch (340:7): [True: 0, False: 0]
  ------------------
  341|      0|			*va_arg(ap, const uint16_t **) = td->td_transferfunction[1];
  342|      0|			*va_arg(ap, const uint16_t **) = td->td_transferfunction[2];
  343|      0|		}
  344|      0|		return (1);
  345|  2.05k|	case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  390|  2.05k|#define	TIFFTAG_REFERENCEBLACKWHITE	532	/* !colorimetry info */
  ------------------
  |  Branch (345:2): [True: 2.05k, False: 47.8k]
  ------------------
  346|  2.05k|		if (!td->td_refblackwhite && !TIFFDefaultRefBlackWhite(td))
  ------------------
  |  Branch (346:7): [True: 2.05k, False: 0]
  |  Branch (346:32): [True: 0, False: 2.05k]
  ------------------
  347|      0|			return (0);
  348|  2.05k|		*va_arg(ap, const float **) = td->td_refblackwhite;
  349|  2.05k|		return (1);
  350|  49.8k|	}
  351|      0|	return 0;
  352|  49.8k|}
TIFFGetFieldDefaulted:
  360|   102k|{
  361|   102k|	int ok;
  362|   102k|	va_list ap;
  363|       |
  364|   102k|	va_start(ap, tag);
  365|   102k|	ok =  TIFFVGetFieldDefaulted(tif, tag, ap);
  366|   102k|	va_end(ap);
  367|   102k|	return (ok);
  368|   102k|}
_TIFFClampDoubleToFloat:
  412|  1.00k|{
  413|  1.00k|    if( val > FLT_MAX )
  ------------------
  |  Branch (413:9): [True: 4, False: 999]
  ------------------
  414|      4|        return FLT_MAX;
  415|    999|    if( val < -FLT_MAX )
  ------------------
  |  Branch (415:9): [True: 3, False: 996]
  ------------------
  416|      3|        return -FLT_MAX;
  417|    996|    return (float)val;
  418|    999|}
_TIFFSeekOK:
  430|   489k|{
  431|       |    /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */
  432|       |    /* See http://bugzilla.maptools.org/show_bug.cgi?id=2726 */
  433|   489k|    return off <= (~(uint64_t)0) / 2 && TIFFSeekFile(tif, off, SEEK_SET) == off;
  ------------------
  |  |  216|   489k|	((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))
  ------------------
  |  Branch (433:12): [True: 489k, False: 176]
  |  Branch (433:41): [True: 386k, False: 103k]
  ------------------
  434|   489k|}
tif_aux.c:TIFFDefaultRefBlackWhite:
  171|  2.05k|{
  172|  2.05k|	int i;
  173|       |
  174|  2.05k|        td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float));
  175|  2.05k|	if (td->td_refblackwhite == NULL)
  ------------------
  |  Branch (175:6): [True: 0, False: 2.05k]
  ------------------
  176|      0|		return 0;
  177|  2.05k|        if (td->td_photometric == PHOTOMETRIC_YCBCR) {
  ------------------
  |  |  221|  2.05k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (177:13): [True: 2.05k, False: 0]
  ------------------
  178|       |		/*
  179|       |		 * YCbCr (Class Y) images must have the ReferenceBlackWhite
  180|       |		 * tag set. Fix the broken images, which lacks that tag.
  181|       |		 */
  182|  2.05k|		td->td_refblackwhite[0] = 0.0F;
  183|  2.05k|		td->td_refblackwhite[1] = td->td_refblackwhite[3] =
  184|  2.05k|			td->td_refblackwhite[5] = 255.0F;
  185|  2.05k|		td->td_refblackwhite[2] = td->td_refblackwhite[4] = 128.0F;
  186|  2.05k|	} else {
  187|       |		/*
  188|       |		 * Assume RGB (Class R)
  189|       |		 */
  190|      0|		for (i = 0; i < 3; i++) {
  ------------------
  |  Branch (190:15): [True: 0, False: 0]
  ------------------
  191|      0|		    td->td_refblackwhite[2*i+0] = 0;
  192|      0|		    td->td_refblackwhite[2*i+1] =
  193|      0|			    (float)((1L<<td->td_bitspersample)-1L);
  194|      0|		}
  195|      0|	}
  196|  2.05k|	return 1;
  197|  2.05k|}

TIFFCleanup:
   46|  23.5k|{
   47|       |	/*
   48|       |         * Flush buffered data and directory (if dirty).
   49|       |         */
   50|  23.5k|	if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (50:6): [True: 0, False: 23.5k]
  ------------------
   51|      0|		TIFFFlush(tif);
   52|  23.5k|	(*tif->tif_cleanup)(tif);
   53|  23.5k|	TIFFFreeDirectory(tif);
   54|       |
   55|  23.5k|	if (tif->tif_dirlistoff)
  ------------------
  |  Branch (55:6): [True: 23.4k, False: 125]
  ------------------
   56|  23.4k|		_TIFFfree(tif->tif_dirlistoff);
   57|  23.5k|	if (tif->tif_dirlistdirn)
  ------------------
  |  Branch (57:6): [True: 23.4k, False: 125]
  ------------------
   58|  23.4k|		_TIFFfree(tif->tif_dirlistdirn);
   59|       |
   60|       |	/*
   61|       |         * Clean up client info links.
   62|       |         */
   63|  23.5k|	while( tif->tif_clientinfo )
  ------------------
  |  Branch (63:9): [True: 0, False: 23.5k]
  ------------------
   64|      0|	{
   65|      0|		TIFFClientInfoLink *psLink = tif->tif_clientinfo;
   66|       |
   67|      0|		tif->tif_clientinfo = psLink->next;
   68|      0|		_TIFFfree( psLink->name );
   69|      0|		_TIFFfree( psLink );
   70|      0|	}
   71|       |
   72|  23.5k|	if (tif->tif_rawdata && (tif->tif_flags&TIFF_MYBUFFER))
  ------------------
  |  |  100|  9.07k|	#define TIFF_MYBUFFER    0x00200U /* my raw data buffer; free on close */
  ------------------
  |  Branch (72:6): [True: 9.07k, False: 14.4k]
  |  Branch (72:26): [True: 9.07k, False: 0]
  ------------------
   73|  9.07k|		_TIFFfree(tif->tif_rawdata);
   74|  23.5k|	if (isMapped(tif))
  ------------------
  |  |  208|  23.5k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  102|  23.5k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (208:23): [True: 0, False: 23.5k]
  |  |  ------------------
  ------------------
   75|      0|		TIFFUnmapFileContents(tif, tif->tif_base, (toff_t)tif->tif_size);
  ------------------
  |  |  224|      0|	((*(tif)->tif_unmapproc)((tif)->tif_clientdata,(addr),(size)))
  ------------------
   76|       |
   77|       |	/*
   78|       |         * Clean up custom fields.
   79|       |         */
   80|  23.5k|	if (tif->tif_fields && tif->tif_nfields > 0) {
  ------------------
  |  Branch (80:6): [True: 23.1k, False: 417]
  |  Branch (80:25): [True: 23.1k, False: 0]
  ------------------
   81|  23.1k|		uint32_t i;
   82|       |
   83|  3.78M|		for (i = 0; i < tif->tif_nfields; i++) {
  ------------------
  |  Branch (83:15): [True: 3.76M, False: 23.1k]
  ------------------
   84|  3.76M|			TIFFField *fld = tif->tif_fields[i];
   85|  3.76M|			if (fld->field_name != NULL) {
  ------------------
  |  Branch (85:8): [True: 3.76M, False: 0]
  ------------------
   86|  3.76M|				if (fld->field_bit == FIELD_CUSTOM &&
  ------------------
  |  |  317|  7.52M|#define FIELD_CUSTOM    65
  ------------------
  |  Branch (86:9): [True: 2.53M, False: 1.22M]
  ------------------
   87|       |					/* caution: tif_fields[i] must not be the beginning of a fields-array.
   88|       |					 *          Otherwise the following tags are also freed with the first free().
   89|       |					 */
   90|  3.76M|					TIFFFieldIsAnonymous(fld)) {
  ------------------
  |  Branch (90:6): [True: 154k, False: 2.38M]
  ------------------
   91|   154k|					_TIFFfree(fld->field_name);
   92|   154k|					_TIFFfree(fld);
   93|   154k|				}
   94|  3.76M|			}
   95|  3.76M|		}
   96|       |
   97|  23.1k|		_TIFFfree(tif->tif_fields);
   98|  23.1k|	}
   99|       |
  100|  23.5k|        if (tif->tif_nfieldscompat > 0) {
  ------------------
  |  Branch (100:13): [True: 0, False: 23.5k]
  ------------------
  101|      0|                uint32_t i;
  102|       |
  103|      0|                for (i = 0; i < tif->tif_nfieldscompat; i++) {
  ------------------
  |  Branch (103:29): [True: 0, False: 0]
  ------------------
  104|      0|                        if (tif->tif_fieldscompat[i].allocated_size)
  ------------------
  |  Branch (104:29): [True: 0, False: 0]
  ------------------
  105|      0|                                _TIFFfree(tif->tif_fieldscompat[i].fields);
  106|      0|                }
  107|      0|                _TIFFfree(tif->tif_fieldscompat);
  108|      0|        }
  109|       |
  110|  23.5k|	_TIFFfree(tif);
  111|  23.5k|}
TIFFClose:
  129|  13.2k|{
  130|  13.2k|	TIFFCloseProc closeproc = tif->tif_closeproc;
  131|  13.2k|	thandle_t fd = tif->tif_clientdata;
  132|       |
  133|  13.2k|	TIFFCleanup(tif);
  134|  13.2k|	(void) (*closeproc)(fd);
  135|  13.2k|}

TIFFIsCODECConfigured:
  151|  8.85k|{
  152|  8.85k|	const TIFFCodec* codec = TIFFFindCODEC(scheme);
  153|       |
  154|  8.85k|	if(codec == NULL) {
  ------------------
  |  Branch (154:5): [True: 143, False: 8.71k]
  ------------------
  155|    143|		return 0;
  156|    143|	}
  157|  8.71k|	if(codec->init == NULL) {
  ------------------
  |  Branch (157:5): [True: 0, False: 8.71k]
  ------------------
  158|      0|		return 0;
  159|      0|	}
  160|  8.71k|	if(codec->init != NotConfigured){
  ------------------
  |  Branch (160:5): [True: 8.70k, False: 10]
  ------------------
  161|  8.70k|		return 1;
  162|  8.70k|	}
  163|     10|	return 0;
  164|  8.71k|}
tif_codec.c:NotConfigured:
  127|      6|{
  128|      6|	(void) scheme;
  129|       |
  130|      6|	tif->tif_fixuptags = _notConfigured;
  131|      6|	tif->tif_decodestatus = FALSE;
  ------------------
  |  |   62|      6|#define	FALSE	0
  ------------------
  132|      6|	tif->tif_setupdecode = _notConfigured;
  133|      6|	tif->tif_encodestatus = FALSE;
  ------------------
  |  |   62|      6|#define	FALSE	0
  ------------------
  134|      6|	tif->tif_setupencode = _notConfigured;
  135|      6|	return (1);
  136|      6|}
tif_codec.c:_notConfigured:
  113|      2|{
  114|      2|	const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
  115|      2|        char compression_code[20];
  116|       |        
  117|      2|        snprintf(compression_code, sizeof(compression_code), "%"PRIu16,
  118|      2|                 tif->tif_dir.td_compression );
  119|      2|	TIFFErrorExtR(tif, tif->tif_name,
  120|      2|                     "%s compression support is not configured", 
  121|      2|                     c ? c->name : compression_code );
  ------------------
  |  Branch (121:22): [True: 2, False: 0]
  ------------------
  122|      2|	return (0);
  123|      2|}

TIFFCIELabToXYZ:
   46|  24.7M|{
   47|  24.7M|	TIFFCIELab16ToXYZ(cielab, l * 257, a * 256, b * 256, X, Y, Z);
   48|  24.7M|}
TIFFCIELab16ToXYZ:
   59|  32.7M|{
   60|  32.7M|	float L = (float)l * 100.0F / 65535.0F;
   61|  32.7M|	float cby, tmp;
   62|       |
   63|  32.7M|	if( L < 8.856F ) {
  ------------------
  |  Branch (63:6): [True: 31.9M, False: 775k]
  ------------------
   64|  31.9M|		*Y = (L * cielab->Y0) / 903.292F;
   65|  31.9M|		cby = 7.787F * (*Y / cielab->Y0) + 16.0F / 116.0F;
   66|  31.9M|	} else {
   67|   775k|		cby = (L + 16.0F) / 116.0F;
   68|   775k|		*Y = cielab->Y0 * cby * cby * cby;
   69|   775k|	}
   70|       |
   71|  32.7M|	tmp = (float)a / 256.0F / 500.0F + cby;
   72|  32.7M|	if( tmp < 0.2069F )
  ------------------
  |  Branch (72:6): [True: 31.9M, False: 800k]
  ------------------
   73|  31.9M|		*X = cielab->X0 * (tmp - 0.13793F) / 7.787F;
   74|   800k|	else
   75|   800k|		*X = cielab->X0 * tmp * tmp * tmp;
   76|       |
   77|  32.7M|	tmp = cby - (float)b / 256.0F / 200.0F;
   78|  32.7M|	if( tmp < 0.2069F )
  ------------------
  |  Branch (78:6): [True: 31.9M, False: 743k]
  ------------------
   79|  31.9M|		*Z = cielab->Z0 * (tmp - 0.13793F) / 7.787F;
   80|   743k|	else
   81|   743k|		*Z = cielab->Z0 * tmp * tmp * tmp;
   82|  32.7M|}
TIFFXYZToRGB:
   91|  32.7M|{
   92|  32.7M|	int i;
   93|  32.7M|	float Yr, Yg, Yb;
   94|  32.7M|	float *matrix = &cielab->display.d_mat[0][0];
   95|       |
   96|       |	/* Multiply through the matrix to get luminosity values. */
   97|  32.7M|	Yr =  matrix[0] * X + matrix[1] * Y + matrix[2] * Z;
   98|  32.7M|	Yg =  matrix[3] * X + matrix[4] * Y + matrix[5] * Z;
   99|  32.7M|	Yb =  matrix[6] * X + matrix[7] * Y + matrix[8] * Z;
  100|       |
  101|       |	/* Clip input */
  102|  32.7M|	Yr = TIFFmax(Yr, cielab->display.d_Y0R);
  ------------------
  |  |  258|  32.7M|#define TIFFmax(A,B) ((A)>(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (258:23): [True: 631k, False: 32.1M]
  |  |  ------------------
  ------------------
  103|  32.7M|	Yg = TIFFmax(Yg, cielab->display.d_Y0G);
  ------------------
  |  |  258|  32.7M|#define TIFFmax(A,B) ((A)>(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (258:23): [True: 732k, False: 32.0M]
  |  |  ------------------
  ------------------
  104|  32.7M|	Yb = TIFFmax(Yb, cielab->display.d_Y0B);
  ------------------
  |  |  258|  32.7M|#define TIFFmax(A,B) ((A)>(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (258:23): [True: 710k, False: 32.0M]
  |  |  ------------------
  ------------------
  105|       |
  106|       |	/* Avoid overflow in case of wrong input values */
  107|  32.7M|	Yr = TIFFmin(Yr, cielab->display.d_YCR);
  ------------------
  |  |  259|  32.7M|#define TIFFmin(A,B) ((A)<(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (259:23): [True: 32.4M, False: 299k]
  |  |  ------------------
  ------------------
  108|  32.7M|	Yg = TIFFmin(Yg, cielab->display.d_YCG);
  ------------------
  |  |  259|  32.7M|#define TIFFmin(A,B) ((A)<(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (259:23): [True: 32.6M, False: 99.3k]
  |  |  ------------------
  ------------------
  109|  32.7M|	Yb = TIFFmin(Yb, cielab->display.d_YCB);
  ------------------
  |  |  259|  32.7M|#define TIFFmin(A,B) ((A)<(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (259:23): [True: 32.6M, False: 125k]
  |  |  ------------------
  ------------------
  110|       |
  111|       |	/* Turn luminosity to colour value. */
  112|  32.7M|	i = (int)((Yr - cielab->display.d_Y0R) / cielab->rstep);
  113|  32.7M|	i = TIFFmin(cielab->range, i);
  ------------------
  |  |  259|  32.7M|#define TIFFmin(A,B) ((A)<(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (259:23): [True: 0, False: 32.7M]
  |  |  ------------------
  ------------------
  114|  32.7M|	*r = RINT(cielab->Yr2r[i]);
  ------------------
  |  |   84|  32.7M|#define RINT(R) ((uint32_t)((R)>0?((R)+0.5):((R)-0.5)))
  |  |  ------------------
  |  |  |  Branch (84:29): [True: 631k, False: 32.1M]
  |  |  ------------------
  ------------------
  115|       |
  116|  32.7M|	i = (int)((Yg - cielab->display.d_Y0G) / cielab->gstep);
  117|  32.7M|	i = TIFFmin(cielab->range, i);
  ------------------
  |  |  259|  32.7M|#define TIFFmin(A,B) ((A)<(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (259:23): [True: 0, False: 32.7M]
  |  |  ------------------
  ------------------
  118|  32.7M|	*g = RINT(cielab->Yg2g[i]);
  ------------------
  |  |   84|  32.7M|#define RINT(R) ((uint32_t)((R)>0?((R)+0.5):((R)-0.5)))
  |  |  ------------------
  |  |  |  Branch (84:29): [True: 732k, False: 32.0M]
  |  |  ------------------
  ------------------
  119|       |
  120|  32.7M|	i = (int)((Yb - cielab->display.d_Y0B) / cielab->bstep);
  121|  32.7M|	i = TIFFmin(cielab->range, i);
  ------------------
  |  |  259|  32.7M|#define TIFFmin(A,B) ((A)<(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (259:23): [True: 0, False: 32.7M]
  |  |  ------------------
  ------------------
  122|  32.7M|	*b = RINT(cielab->Yb2b[i]);
  ------------------
  |  |   84|  32.7M|#define RINT(R) ((uint32_t)((R)>0?((R)+0.5):((R)-0.5)))
  |  |  ------------------
  |  |  |  Branch (84:29): [True: 710k, False: 32.0M]
  |  |  ------------------
  ------------------
  123|       |
  124|       |	/* Clip output. */
  125|  32.7M|	*r = TIFFmin(*r, cielab->display.d_Vrwr);
  ------------------
  |  |  259|  32.7M|#define TIFFmin(A,B) ((A)<(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (259:23): [True: 32.4M, False: 310k]
  |  |  ------------------
  ------------------
  126|  32.7M|	*g = TIFFmin(*g, cielab->display.d_Vrwg);
  ------------------
  |  |  259|  32.7M|#define TIFFmin(A,B) ((A)<(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (259:23): [True: 32.6M, False: 99.4k]
  |  |  ------------------
  ------------------
  127|  32.7M|	*b = TIFFmin(*b, cielab->display.d_Vrwb);
  ------------------
  |  |  259|  32.7M|#define TIFFmin(A,B) ((A)<(B)?(A):(B))
  |  |  ------------------
  |  |  |  Branch (259:23): [True: 32.6M, False: 125k]
  |  |  ------------------
  ------------------
  128|  32.7M|}
TIFFCIELabToRGBInit:
  138|    134|{
  139|    134|	int i;
  140|    134|	double dfGamma;
  141|       |
  142|    134|	cielab->range = CIELABTORGB_TABLE_RANGE;
  ------------------
  |  |  167|    134|#define CIELABTORGB_TABLE_RANGE 1500
  ------------------
  143|       |
  144|    134|	_TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay));
  145|       |
  146|       |	/* Red */
  147|    134|	dfGamma = 1.0 / cielab->display.d_gammaR ;
  148|    134|	cielab->rstep =
  149|    134|		(cielab->display.d_YCR - cielab->display.d_Y0R)	/ cielab->range;
  150|   201k|	for(i = 0; i <= cielab->range; i++) {
  ------------------
  |  Branch (150:13): [True: 201k, False: 134]
  ------------------
  151|   201k|		cielab->Yr2r[i] = cielab->display.d_Vrwr
  152|   201k|		    * ((float)pow((double)i / cielab->range, dfGamma));
  153|   201k|	}
  154|       |
  155|       |	/* Green */
  156|    134|	dfGamma = 1.0 / cielab->display.d_gammaG ;
  157|    134|	cielab->gstep =
  158|    134|	    (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
  159|   201k|	for(i = 0; i <= cielab->range; i++) {
  ------------------
  |  Branch (159:13): [True: 201k, False: 134]
  ------------------
  160|   201k|		cielab->Yg2g[i] = cielab->display.d_Vrwg
  161|   201k|		    * ((float)pow((double)i / cielab->range, dfGamma));
  162|   201k|	}
  163|       |
  164|       |	/* Blue */
  165|    134|	dfGamma = 1.0 / cielab->display.d_gammaB ;
  166|    134|	cielab->bstep =
  167|    134|	    (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
  168|   201k|	for(i = 0; i <= cielab->range; i++) {
  ------------------
  |  Branch (168:13): [True: 201k, False: 134]
  ------------------
  169|   201k|		cielab->Yb2b[i] = cielab->display.d_Vrwb
  170|   201k|		    * ((float)pow((double)i / cielab->range, dfGamma));
  171|   201k|	}
  172|       |
  173|       |	/* Init reference white point */
  174|    134|	cielab->X0 = refWhite[0];
  175|    134|	cielab->Y0 = refWhite[1];
  176|    134|	cielab->Z0 = refWhite[2];
  177|       |
  178|    134|	return 0;
  179|    134|}
TIFFYCbCrtoRGB:
  197|   734M|{
  198|   734M|	int32_t i;
  199|       |
  200|       |	/* XXX: Only 8-bit YCbCr input supported for now */
  201|   734M|	Y = HICLAMP(Y, 255);
  ------------------
  |  |  192|   734M|#define HICLAMP(f,max)		((f)>(max)?(max):(f))
  |  |  ------------------
  |  |  |  Branch (192:26): [True: 0, False: 734M]
  |  |  ------------------
  ------------------
  202|   734M|	Cb = CLAMP(Cb, 0, 255);
  ------------------
  |  |  191|   734M|#define	CLAMP(f,min,max)	((!((f)>=(min)))?(min):(f)>(max)?(max):(f))
  |  |  ------------------
  |  |  |  Branch (191:27): [True: 0, False: 734M]
  |  |  |  Branch (191:49): [True: 0, False: 734M]
  |  |  ------------------
  ------------------
  203|   734M|	Cr = CLAMP(Cr, 0, 255);
  ------------------
  |  |  191|   734M|#define	CLAMP(f,min,max)	((!((f)>=(min)))?(min):(f)>(max)?(max):(f))
  |  |  ------------------
  |  |  |  Branch (191:27): [True: 0, False: 734M]
  |  |  |  Branch (191:49): [True: 0, False: 734M]
  |  |  ------------------
  ------------------
  204|       |
  205|   734M|	i = ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr];
  206|   734M|	*r = CLAMP(i, 0, 255);
  ------------------
  |  |  191|   734M|#define	CLAMP(f,min,max)	((!((f)>=(min)))?(min):(f)>(max)?(max):(f))
  |  |  ------------------
  |  |  |  Branch (191:27): [True: 537M, False: 196M]
  |  |  |  Branch (191:49): [True: 90.7M, False: 105M]
  |  |  ------------------
  ------------------
  207|   734M|	i = ycbcr->Y_tab[Y]
  208|   734M|	    + (int)((ycbcr->Cb_g_tab[Cb] + ycbcr->Cr_g_tab[Cr]) >> SHIFT);
  ------------------
  |  |  186|   734M|#define	SHIFT			16
  ------------------
  209|   734M|	*g = CLAMP(i, 0, 255);
  ------------------
  |  |  191|   734M|#define	CLAMP(f,min,max)	((!((f)>=(min)))?(min):(f)>(max)?(max):(f))
  |  |  ------------------
  |  |  |  Branch (191:27): [True: 8.00M, False: 726M]
  |  |  |  Branch (191:49): [True: 15.1M, False: 710M]
  |  |  ------------------
  ------------------
  210|   734M|	i = ycbcr->Y_tab[Y] + ycbcr->Cb_b_tab[Cb];
  211|   734M|	*b = CLAMP(i, 0, 255);
  ------------------
  |  |  191|   734M|#define	CLAMP(f,min,max)	((!((f)>=(min)))?(min):(f)>(max)?(max):(f))
  |  |  ------------------
  |  |  |  Branch (191:27): [True: 516M, False: 218M]
  |  |  |  Branch (191:49): [True: 93.0M, False: 124M]
  |  |  ------------------
  ------------------
  212|   734M|}
TIFFYCbCrToRGBInit:
  249|  2.11k|{
  250|  2.11k|    TIFFRGBValue* clamptab;
  251|  2.11k|    int i;
  252|       |
  253|  2.11k|#define LumaRed	    luma[0]
  254|  2.11k|#define LumaGreen   luma[1]
  255|  2.11k|#define LumaBlue    luma[2]
  256|       |
  257|  2.11k|    clamptab = (TIFFRGBValue*)(
  258|  2.11k|            (uint8_t*) ycbcr + TIFFroundup_32(sizeof (TIFFYCbCrToRGB), sizeof (long)));
  ------------------
  |  |  250|  2.11k|#define TIFFroundup_32(x, y) (TIFFhowmany_32(x,y)*(y))
  |  |  ------------------
  |  |  |  |  242|  2.11k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (242:31): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  243|  2.11k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  |  |  244|  2.11k|			   0U)
  |  |  ------------------
  ------------------
  259|  2.11k|    _TIFFmemset(clamptab, 0, 256);		/* v < 0 => 0 */
  260|  2.11k|    ycbcr->clamptab = (clamptab += 256);
  261|   544k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (261:17): [True: 542k, False: 2.11k]
  ------------------
  262|   542k|	clamptab[i] = (TIFFRGBValue) i;
  263|  2.11k|    _TIFFmemset(clamptab+256, 255, 2*256);	/* v > 255 => 255 */
  264|  2.11k|    ycbcr->Cr_r_tab = (int*) (clamptab + 3*256);
  265|  2.11k|    ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;
  266|  2.11k|    ycbcr->Cr_g_tab = (int32_t*) (ycbcr->Cb_b_tab + 256);
  267|  2.11k|    ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;
  268|  2.11k|    ycbcr->Y_tab = ycbcr->Cb_g_tab + 256;
  269|       |
  270|  2.11k|    { float f1 = 2-2*LumaRed;		int32_t D1 = FIX(CLAMP(f1, 0.0F, 2.0F));
  ------------------
  |  |  253|  2.11k|#define LumaRed	    luma[0]
  ------------------
                  { float f1 = 2-2*LumaRed;		int32_t D1 = FIX(CLAMP(f1, 0.0F, 2.0F));
  ------------------
  |  |  187|  8.46k|#define	FIX(x)			((int32_t)((x) * (1L<<SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  186|  2.11k|#define	SHIFT			16
  |  |  ------------------
  |  |  |  Branch (187:30): [True: 1, False: 2.11k]
  |  |  |  Branch (187:30): [True: 5, False: 2.11k]
  |  |  ------------------
  ------------------
  271|  2.11k|      float f2 = LumaRed*f1/LumaGreen;	int32_t D2 = -FIX(CLAMP(f2, 0.0F, 2.0F));
  ------------------
  |  |  253|  2.11k|#define LumaRed	    luma[0]
  ------------------
                    float f2 = LumaRed*f1/LumaGreen;	int32_t D2 = -FIX(CLAMP(f2, 0.0F, 2.0F));
  ------------------
  |  |  254|  2.11k|#define LumaGreen   luma[1]
  ------------------
                    float f2 = LumaRed*f1/LumaGreen;	int32_t D2 = -FIX(CLAMP(f2, 0.0F, 2.0F));
  ------------------
  |  |  187|  8.46k|#define	FIX(x)			((int32_t)((x) * (1L<<SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  186|  2.11k|#define	SHIFT			16
  |  |  ------------------
  |  |  |  Branch (187:30): [True: 1, False: 2.11k]
  |  |  |  Branch (187:30): [True: 5, False: 2.11k]
  |  |  ------------------
  ------------------
  272|  2.11k|      float f3 = 2-2*LumaBlue;		int32_t D3 = FIX(CLAMP(f3, 0.0F, 2.0F));
  ------------------
  |  |  255|  2.11k|#define LumaBlue    luma[2]
  ------------------
                    float f3 = 2-2*LumaBlue;		int32_t D3 = FIX(CLAMP(f3, 0.0F, 2.0F));
  ------------------
  |  |  187|  8.47k|#define	FIX(x)			((int32_t)((x) * (1L<<SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  186|  2.11k|#define	SHIFT			16
  |  |  ------------------
  |  |  |  Branch (187:30): [True: 2, False: 2.11k]
  |  |  |  Branch (187:30): [True: 3, False: 2.11k]
  |  |  ------------------
  ------------------
  273|  2.11k|      float f4 = LumaBlue*f3/LumaGreen;	int32_t D4 = -FIX(CLAMP(f4, 0.0F, 2.0F));
  ------------------
  |  |  255|  2.11k|#define LumaBlue    luma[2]
  ------------------
                    float f4 = LumaBlue*f3/LumaGreen;	int32_t D4 = -FIX(CLAMP(f4, 0.0F, 2.0F));
  ------------------
  |  |  254|  2.11k|#define LumaGreen   luma[1]
  ------------------
                    float f4 = LumaBlue*f3/LumaGreen;	int32_t D4 = -FIX(CLAMP(f4, 0.0F, 2.0F));
  ------------------
  |  |  187|  8.46k|#define	FIX(x)			((int32_t)((x) * (1L<<SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  186|  2.11k|#define	SHIFT			16
  |  |  ------------------
  |  |  |  Branch (187:30): [True: 1, False: 2.11k]
  |  |  |  Branch (187:30): [True: 4, False: 2.11k]
  |  |  ------------------
  ------------------
  274|  2.11k|      int x;
  275|       |
  276|  2.11k|#undef LumaBlue
  277|  2.11k|#undef LumaGreen
  278|  2.11k|#undef LumaRed
  279|       |
  280|       |      /*
  281|       |       * i is the actual input pixel value in the range 0..255
  282|       |       * Cb and Cr values are in the range -128..127 (actually
  283|       |       * they are in a range defined by the ReferenceBlackWhite
  284|       |       * tag) so there is some range shifting to do here when
  285|       |       * constructing tables indexed by the raw pixel data.
  286|       |       */
  287|   544k|      for (i = 0, x = -128; i < 256; i++, x++) {
  ------------------
  |  Branch (287:29): [True: 542k, False: 2.11k]
  ------------------
  288|   542k|	    int32_t Cr = (int32_t)CLAMPw(Code2V(x, refBlackWhite[4] - 128.0F,
  ------------------
  |  |  189|   542k|#define	Code2V(c, RB, RW, CR)	((((c)-(int32_t)(RB))*(float)(CR))/(float)(((RW)-(RB)!=0) ? ((RW)-(RB)) : 1))
  |  |  ------------------
  |  |  |  Branch (189:74): [True: 539k, False: 2.81k]
  |  |  ------------------
  ------------------
  289|   542k|			    refBlackWhite[5] - 128.0F, 127),
  290|   542k|                            -128.0F * 32, 128.0F * 32);
  291|   542k|	    int32_t Cb = (int32_t)CLAMPw(Code2V(x, refBlackWhite[2] - 128.0F,
  ------------------
  |  |  189|   542k|#define	Code2V(c, RB, RW, CR)	((((c)-(int32_t)(RB))*(float)(CR))/(float)(((RW)-(RB)!=0) ? ((RW)-(RB)) : 1))
  |  |  ------------------
  |  |  |  Branch (189:74): [True: 539k, False: 2.56k]
  |  |  ------------------
  ------------------
  292|   542k|			    refBlackWhite[3] - 128.0F, 127),
  293|   542k|                            -128.0F * 32, 128.0F * 32);
  294|       |
  295|   542k|	    ycbcr->Cr_r_tab[i] = (int32_t)((D1 * Cr + ONE_HALF) >> SHIFT);
  ------------------
  |  |  188|   542k|#define	ONE_HALF		((int32_t)(1<<(SHIFT-1)))
  |  |  ------------------
  |  |  |  |  186|   542k|#define	SHIFT			16
  |  |  ------------------
  ------------------
              	    ycbcr->Cr_r_tab[i] = (int32_t)((D1 * Cr + ONE_HALF) >> SHIFT);
  ------------------
  |  |  186|   542k|#define	SHIFT			16
  ------------------
  296|   542k|	    ycbcr->Cb_b_tab[i] = (int32_t)((D3 * Cb + ONE_HALF) >> SHIFT);
  ------------------
  |  |  188|   542k|#define	ONE_HALF		((int32_t)(1<<(SHIFT-1)))
  |  |  ------------------
  |  |  |  |  186|   542k|#define	SHIFT			16
  |  |  ------------------
  ------------------
              	    ycbcr->Cb_b_tab[i] = (int32_t)((D3 * Cb + ONE_HALF) >> SHIFT);
  ------------------
  |  |  186|   542k|#define	SHIFT			16
  ------------------
  297|   542k|	    ycbcr->Cr_g_tab[i] = D2*Cr;
  298|   542k|	    ycbcr->Cb_g_tab[i] = D4*Cb + ONE_HALF;
  ------------------
  |  |  188|   542k|#define	ONE_HALF		((int32_t)(1<<(SHIFT-1)))
  |  |  ------------------
  |  |  |  |  186|   542k|#define	SHIFT			16
  |  |  ------------------
  ------------------
  299|   542k|	    ycbcr->Y_tab[i] =
  300|   542k|		    (int32_t)CLAMPw(Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255),
  ------------------
  |  |  189|   542k|#define	Code2V(c, RB, RW, CR)	((((c)-(int32_t)(RB))*(float)(CR))/(float)(((RW)-(RB)!=0) ? ((RW)-(RB)) : 1))
  |  |  ------------------
  |  |  |  Branch (189:74): [True: 540k, False: 2.30k]
  |  |  ------------------
  ------------------
  301|   542k|                                  -128.0F * 32, 128.0F * 32);
  302|   542k|      }
  303|  2.11k|    }
  304|       |
  305|  2.11k|    return 0;
  306|  2.11k|}
tif_color.c:CLAMPw:
  217|  1.62M|{
  218|  1.62M|    if( v < vmin )
  ------------------
  |  Branch (218:9): [True: 10.3k, False: 1.61M]
  ------------------
  219|  10.3k|    {
  220|       |        /* printf("%f clamped to %f\n", v, vmin); */
  221|  10.3k|        return vmin;
  222|  10.3k|    }
  223|  1.61M|    if( v > vmax )
  ------------------
  |  Branch (223:9): [True: 16.3k, False: 1.60M]
  ------------------
  224|  16.3k|    {
  225|       |        /* printf("%f clamped to %f\n", v, vmax); */
  226|  16.3k|        return vmax;
  227|  16.3k|    }
  228|  1.60M|    return v;
  229|  1.61M|}

_TIFFNoTileDecode:
  109|  2.92k|{
  110|  2.92k|	(void) pp; (void) cc; (void) s;
  111|  2.92k|	return (TIFFNoDecode(tif, "tile"));
  112|  2.92k|}
_TIFFNoPreCode:
  125|  11.4k|{
  126|  11.4k|	(void) tif; (void) s;
  127|  11.4k|	return (1);
  128|  11.4k|}
_TIFFSetDefaultCompressionState:
  135|  75.0k|{
  136|  75.0k|	tif->tif_fixuptags = _TIFFNoFixupTags; 
  137|  75.0k|	tif->tif_decodestatus = TRUE;
  ------------------
  |  |   61|  75.0k|#define	TRUE	1
  ------------------
  138|  75.0k|	tif->tif_setupdecode = _TIFFtrue;
  139|  75.0k|	tif->tif_predecode = _TIFFNoPreCode;
  140|  75.0k|	tif->tif_decoderow = _TIFFNoRowDecode;  
  141|  75.0k|	tif->tif_decodestrip = _TIFFNoStripDecode;
  142|  75.0k|	tif->tif_decodetile = _TIFFNoTileDecode;  
  143|  75.0k|	tif->tif_encodestatus = TRUE;
  ------------------
  |  |   61|  75.0k|#define	TRUE	1
  ------------------
  144|  75.0k|	tif->tif_setupencode = _TIFFtrue;
  145|  75.0k|	tif->tif_preencode = _TIFFNoPreCode;
  146|  75.0k|	tif->tif_postencode = _TIFFtrue;
  147|  75.0k|	tif->tif_encoderow = _TIFFNoRowEncode;
  148|  75.0k|	tif->tif_encodestrip = _TIFFNoStripEncode;  
  149|  75.0k|	tif->tif_encodetile = _TIFFNoTileEncode;  
  150|  75.0k|	tif->tif_close = _TIFFvoid;
  151|  75.0k|	tif->tif_seek = _TIFFNoSeek;
  152|  75.0k|	tif->tif_cleanup = _TIFFvoid;
  153|  75.0k|	tif->tif_defstripsize = _TIFFDefaultStripSize;
  154|  75.0k|	tif->tif_deftilesize = _TIFFDefaultTileSize;
  155|  75.0k|	tif->tif_flags &= ~(TIFF_NOBITREV|TIFF_NOREADRAW);
  ------------------
  |  |   99|  75.0k|	#define TIFF_NOBITREV    0x00100U /* inhibit bit reversal logic */
  ------------------
              	tif->tif_flags &= ~(TIFF_NOBITREV|TIFF_NOREADRAW);
  ------------------
  |  |  108|  75.0k|	#define TIFF_NOREADRAW   0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  156|  75.0k|}
TIFFSetCompressionScheme:
  160|  37.8k|{
  161|  37.8k|	const TIFFCodec *c = TIFFFindCODEC((uint16_t) scheme);
  162|       |
  163|  37.8k|	_TIFFSetDefaultCompressionState(tif);
  164|       |	/*
  165|       |	 * Don't treat an unknown compression scheme as an error.
  166|       |	 * This permits applications to open files with data that
  167|       |	 * the library does not have builtin support for, but which
  168|       |	 * may still be meaningful.
  169|       |	 */
  170|  37.8k|	return (c ? (*c->init)(tif, scheme) : 1);
  ------------------
  |  Branch (170:10): [True: 37.1k, False: 787]
  ------------------
  171|  37.8k|}
TIFFFindCODEC:
  186|  49.6k|{
  187|  49.6k|	const TIFFCodec* c;
  188|  49.6k|	codec_t* cd;
  189|       |
  190|  49.6k|	for (cd = registeredCODECS; cd; cd = cd->next)
  ------------------
  |  Branch (190:30): [True: 0, False: 49.6k]
  ------------------
  191|      0|		if (cd->info->scheme == scheme)
  ------------------
  |  Branch (191:7): [True: 0, False: 0]
  ------------------
  192|      0|			return ((const TIFFCodec*) cd->info);
  193|   278k|	for (c = _TIFFBuiltinCODECS; c->name; c++)
  ------------------
  |  Branch (193:31): [True: 275k, False: 3.33k]
  ------------------
  194|   275k|		if (c->scheme == scheme)
  ------------------
  |  Branch (194:7): [True: 46.3k, False: 228k]
  ------------------
  195|  46.3k|			return (c);
  196|  3.33k|	return ((const TIFFCodec*) 0);
  197|  49.6k|}
tif_compress.c:TIFFNoDecode:
   72|  2.92k|{
   73|  2.92k|	const TIFFCodec* c = TIFFFindCODEC(tif->tif_dir.td_compression);
   74|       |
   75|  2.92k|	if (c)
  ------------------
  |  Branch (75:6): [True: 522, False: 2.40k]
  ------------------
   76|    522|		TIFFErrorExtR(tif, tif->tif_name,
   77|    522|			     "%s %s decoding is not implemented",
   78|    522|			     c->name, method);
   79|  2.40k|	else
   80|  2.40k|		TIFFErrorExtR(tif, tif->tif_name,
   81|  2.40k|			     "Compression scheme %"PRIu16" %s decoding is not implemented",
   82|  2.40k|			     tif->tif_dir.td_compression, method);
   83|  2.92k|	return (0);
   84|  2.92k|}
tif_compress.c:_TIFFNoFixupTags:
   88|    900|{
   89|    900|	(void) tif;
   90|    900|	return (1);
   91|    900|}
tif_compress.c:_TIFFtrue:
  130|    814|static int _TIFFtrue(TIFF* tif) { (void) tif; return (1); }
tif_compress.c:_TIFFvoid:
  131|  47.8k|static void _TIFFvoid(TIFF* tif) { (void) tif; }

_TIFFsetByteArray:
   58|      3|    { setByteArray(vpp, vp, n, 1); }
_TIFFsetShortArray:
   62|  1.39k|    { setByteArray((void**) wpp, wp, n, sizeof (uint16_t)); }
_TIFFsetFloatArray:
   68|     80|    { setByteArray((void**) fpp, fp, n, sizeof (float)); }
_TIFFsetDoubleArray:
   70|    254|    { setByteArray((void**) dpp, dp, n, sizeof (double)); }
TIFFSetField:
  962|   191k|{
  963|   191k|	va_list ap;
  964|   191k|	int status;
  965|       |
  966|   191k|	va_start(ap, tag);
  967|   191k|	status = TIFFVSetField(tif, tag, ap);
  968|   191k|	va_end(ap);
  969|   191k|	return (status);
  970|   191k|}
TIFFVSetField:
 1021|   191k|{
 1022|   191k|	return OkToChangeTag(tif, tag) ?
  ------------------
  |  Branch (1022:9): [True: 191k, False: 0]
  ------------------
 1023|   191k|	    (*tif->tif_tagmethods.vsetfield)(tif, tag, ap) : 0;
 1024|   191k|}
TIFFGetField:
 1383|   153k|{
 1384|   153k|	int status;
 1385|   153k|	va_list ap;
 1386|       |
 1387|   153k|	va_start(ap, tag);
 1388|   153k|	status = TIFFVGetField(tif, tag, ap);
 1389|   153k|	va_end(ap);
 1390|   153k|	return (status);
 1391|   153k|}
TIFFVGetField:
 1401|   255k|{
 1402|   255k|	const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  312|   255k|#define TIFF_ANY       TIFF_NOTYPE     /* for field descriptor searching */
  ------------------
 1403|   255k|	return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit)) ?
  ------------------
  |  |  205|   511k|#define isPseudoTag(t) (t > 0xffff)            /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (205:24): [True: 0, False: 255k]
  |  |  ------------------
  ------------------
              	return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit)) ?
  ------------------
  |  |  198|   255k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|   255k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|   255k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  |  |  |  Branch (198:34): [True: 176k, False: 79.2k]
  |  |  ------------------
  ------------------
  |  Branch (1403:10): [True: 255k, False: 0]
  ------------------
 1404|   176k|	    (*tif->tif_tagmethods.vgetfield)(tif, tag, ap) : 0);
 1405|   255k|}
TIFFFreeDirectory:
 1419|  46.7k|{
 1420|  46.7k|	TIFFDirectory *td = &tif->tif_dir;
 1421|  46.7k|	int            i;
 1422|       |
 1423|  46.7k|	_TIFFmemset(td->td_fieldsset, 0, FIELD_SETLONGS);
  ------------------
  |  |   68|  46.7k|#define FIELD_SETLONGS 4
  ------------------
 1424|  46.7k|	CleanupField(td_sminsamplevalue);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 139, False: 46.5k]
  |  |  ------------------
  |  | 1409|    139|	_TIFFfree(td->member);		\
  |  | 1410|    139|	td->member = 0;			\
  |  | 1411|    139|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1425|  46.7k|	CleanupField(td_smaxsamplevalue);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 112, False: 46.6k]
  |  |  ------------------
  |  | 1409|    112|	_TIFFfree(td->member);		\
  |  | 1410|    112|	td->member = 0;			\
  |  | 1411|    112|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1426|  46.7k|	CleanupField(td_colormap[0]);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 63, False: 46.6k]
  |  |  ------------------
  |  | 1409|     63|	_TIFFfree(td->member);		\
  |  | 1410|     63|	td->member = 0;			\
  |  | 1411|     63|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1427|  46.7k|	CleanupField(td_colormap[1]);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 63, False: 46.6k]
  |  |  ------------------
  |  | 1409|     63|	_TIFFfree(td->member);		\
  |  | 1410|     63|	td->member = 0;			\
  |  | 1411|     63|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1428|  46.7k|	CleanupField(td_colormap[2]);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 63, False: 46.6k]
  |  |  ------------------
  |  | 1409|     63|	_TIFFfree(td->member);		\
  |  | 1410|     63|	td->member = 0;			\
  |  | 1411|     63|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1429|  46.7k|	CleanupField(td_sampleinfo);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 1.09k, False: 45.6k]
  |  |  ------------------
  |  | 1409|  1.09k|	_TIFFfree(td->member);		\
  |  | 1410|  1.09k|	td->member = 0;			\
  |  | 1411|  1.09k|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1430|  46.7k|	CleanupField(td_subifd);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 11, False: 46.7k]
  |  |  ------------------
  |  | 1409|     11|	_TIFFfree(td->member);		\
  |  | 1410|     11|	td->member = 0;			\
  |  | 1411|     11|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1431|  46.7k|	CleanupField(td_inknames);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 53, False: 46.6k]
  |  |  ------------------
  |  | 1409|     53|	_TIFFfree(td->member);		\
  |  | 1410|     53|	td->member = 0;			\
  |  | 1411|     53|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1432|  46.7k|	CleanupField(td_refblackwhite);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 2.13k, False: 44.5k]
  |  |  ------------------
  |  | 1409|  2.13k|	_TIFFfree(td->member);		\
  |  | 1410|  2.13k|	td->member = 0;			\
  |  | 1411|  2.13k|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1433|  46.7k|	CleanupField(td_transferfunction[0]);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 5, False: 46.7k]
  |  |  ------------------
  |  | 1409|      5|	_TIFFfree(td->member);		\
  |  | 1410|      5|	td->member = 0;			\
  |  | 1411|      5|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1434|  46.7k|	CleanupField(td_transferfunction[1]);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 1, False: 46.7k]
  |  |  ------------------
  |  | 1409|      1|	_TIFFfree(td->member);		\
  |  | 1410|      1|	td->member = 0;			\
  |  | 1411|      1|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1435|  46.7k|	CleanupField(td_transferfunction[2]);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 1, False: 46.7k]
  |  |  ------------------
  |  | 1409|      1|	_TIFFfree(td->member);		\
  |  | 1410|      1|	td->member = 0;			\
  |  | 1411|      1|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1436|  46.7k|	CleanupField(td_stripoffset_p);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 15.1k, False: 31.5k]
  |  |  ------------------
  |  | 1409|  15.1k|	_TIFFfree(td->member);		\
  |  | 1410|  15.1k|	td->member = 0;			\
  |  | 1411|  15.1k|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1437|  46.7k|	CleanupField(td_stripbytecount_p);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 14.8k, False: 31.8k]
  |  |  ------------------
  |  | 1409|  14.8k|	_TIFFfree(td->member);		\
  |  | 1410|  14.8k|	td->member = 0;			\
  |  | 1411|  14.8k|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1438|  46.7k|        td->td_stripoffsetbyteallocsize = 0;
 1439|  46.7k|	TIFFClrFieldBit(tif, FIELD_YCBCRSUBSAMPLING);
  ------------------
  |  |  200|  46.7k|#define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  197|  46.7k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  196|  46.7k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
 1440|  46.7k|	TIFFClrFieldBit(tif, FIELD_YCBCRPOSITIONING);
  ------------------
  |  |  200|  46.7k|#define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  197|  46.7k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  196|  46.7k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
 1441|       |
 1442|       |	/* Cleanup custom tag values */
 1443|  60.4k|	for( i = 0; i < td->td_customValueCount; i++ ) {
  ------------------
  |  Branch (1443:14): [True: 13.7k, False: 46.7k]
  ------------------
 1444|  13.7k|		if (td->td_customValues[i].value)
  ------------------
  |  Branch (1444:7): [True: 12.0k, False: 1.68k]
  ------------------
 1445|  12.0k|			_TIFFfree(td->td_customValues[i].value);
 1446|  13.7k|	}
 1447|       |
 1448|  46.7k|	td->td_customValueCount = 0;
 1449|  46.7k|	CleanupField(td_customValues);
  ------------------
  |  | 1407|  46.7k|#define	CleanupField(member) {		\
  |  | 1408|  46.7k|    if (td->member) {			\
  |  |  ------------------
  |  |  |  Branch (1408:9): [True: 5.18k, False: 41.5k]
  |  |  ------------------
  |  | 1409|  5.18k|	_TIFFfree(td->member);		\
  |  | 1410|  5.18k|	td->member = 0;			\
  |  | 1411|  5.18k|    }					\
  |  | 1412|  46.7k|}
  ------------------
 1450|       |
 1451|  46.7k|        _TIFFmemset( &(td->td_stripoffset_entry), 0, sizeof(TIFFDirEntry));
 1452|  46.7k|        _TIFFmemset( &(td->td_stripbytecount_entry), 0, sizeof(TIFFDirEntry));
 1453|  46.7k|}
TIFFDefaultDirectory:
 1534|  23.1k|{
 1535|  23.1k|	register TIFFDirectory* td = &tif->tif_dir;
 1536|  23.1k|	const TIFFFieldArray* tiffFieldArray;
 1537|       |
 1538|  23.1k|	tiffFieldArray = _TIFFGetFields();
 1539|  23.1k|	_TIFFSetupFields(tif, tiffFieldArray);   
 1540|       |
 1541|  23.1k|	_TIFFmemset(td, 0, sizeof (*td));
 1542|  23.1k|	td->td_fillorder = FILLORDER_MSB2LSB;
  ------------------
  |  |  235|  23.1k|#define	    FILLORDER_MSB2LSB		1	/* most significant -> least */
  ------------------
 1543|  23.1k|	td->td_bitspersample = 1;
 1544|  23.1k|	td->td_threshholding = THRESHHOLD_BILEVEL;
  ------------------
  |  |  229|  23.1k|#define	    THRESHHOLD_BILEVEL		1	/* b&w art scan */
  ------------------
 1545|  23.1k|	td->td_orientation = ORIENTATION_TOPLEFT;
  ------------------
  |  |  243|  23.1k|#define	    ORIENTATION_TOPLEFT		1	/* row 0 top, col 0 lhs */
  ------------------
 1546|  23.1k|	td->td_samplesperpixel = 1;
 1547|  23.1k|	td->td_rowsperstrip = (uint32_t) -1;
 1548|  23.1k|	td->td_tilewidth = 0;
 1549|  23.1k|	td->td_tilelength = 0;
 1550|  23.1k|	td->td_tiledepth = 1;
 1551|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 1552|       |	td->td_stripbytecountsorted = 1; /* Our own arrays always sorted. */  
 1553|       |#endif
 1554|  23.1k|	td->td_resolutionunit = RESUNIT_INCH;
  ------------------
  |  |  283|  23.1k|#define	    RESUNIT_INCH		2	/* english */
  ------------------
 1555|  23.1k|	td->td_sampleformat = SAMPLEFORMAT_UINT;
  ------------------
  |  |  328|  23.1k|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
 1556|  23.1k|	td->td_imagedepth = 1;
 1557|  23.1k|	td->td_ycbcrsubsampling[0] = 2;
 1558|  23.1k|	td->td_ycbcrsubsampling[1] = 2;
 1559|  23.1k|	td->td_ycbcrpositioning = YCBCRPOSITION_CENTERED;
  ------------------
  |  |  388|  23.1k|#define	    YCBCRPOSITION_CENTERED	1	/* !as in PostScript Level 2 */
  ------------------
 1560|  23.1k|	tif->tif_postdecode = _TIFFNoPostDecode;  
 1561|  23.1k|	tif->tif_foundfield = NULL;
 1562|  23.1k|	tif->tif_tagmethods.vsetfield = _TIFFVSetField;  
 1563|  23.1k|	tif->tif_tagmethods.vgetfield = _TIFFVGetField;
 1564|  23.1k|	tif->tif_tagmethods.printdir = NULL;
 1565|       |	/* additional default values */
 1566|  23.1k|	td->td_planarconfig = PLANARCONFIG_CONTIG;
  ------------------
  |  |  259|  23.1k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
 1567|  23.1k|	td->td_compression = COMPRESSION_NONE;
  ------------------
  |  |  176|  23.1k|#define	    COMPRESSION_NONE		1	/* dump mode */
  ------------------
 1568|  23.1k|	td->td_subfiletype = 0;
 1569|  23.1k|	td->td_minsamplevalue = 0;
 1570|       |	/* td_bitspersample=1 is always set in TIFFDefaultDirectory(). 
 1571|       |	 * Therefore, td_maxsamplevalue has to be re-calculated in TIFFGetFieldDefaulted(). */
 1572|  23.1k|	td->td_maxsamplevalue = 1;  /* Default for td_bitspersample=1 */
 1573|  23.1k|	td->td_extrasamples = 0;
 1574|  23.1k|	td->td_sampleinfo = NULL;
 1575|       |
 1576|       |	/*
 1577|       |	 *  Give client code a chance to install their own
 1578|       |	 *  tag extensions & methods, prior to compression overloads,
 1579|       |	 *  but do some prior cleanup first. (http://trac.osgeo.org/gdal/ticket/5054)
 1580|       |	 */
 1581|  23.1k|	if (tif->tif_nfieldscompat > 0) {
  ------------------
  |  Branch (1581:6): [True: 0, False: 23.1k]
  ------------------
 1582|      0|		uint32_t i;
 1583|       |
 1584|      0|		for (i = 0; i < tif->tif_nfieldscompat; i++) {
  ------------------
  |  Branch (1584:15): [True: 0, False: 0]
  ------------------
 1585|      0|				if (tif->tif_fieldscompat[i].allocated_size)
  ------------------
  |  Branch (1585:9): [True: 0, False: 0]
  ------------------
 1586|      0|						_TIFFfree(tif->tif_fieldscompat[i].fields);
 1587|      0|		}
 1588|      0|		_TIFFfree(tif->tif_fieldscompat);
 1589|      0|		tif->tif_nfieldscompat = 0;
 1590|      0|		tif->tif_fieldscompat = NULL;
 1591|      0|	}
 1592|  23.1k|	if (_TIFFextender)
  ------------------
  |  Branch (1592:6): [True: 0, False: 23.1k]
  ------------------
 1593|      0|		(*_TIFFextender)(tif);
 1594|  23.1k|	(void) TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
  ------------------
  |  |  175|  23.1k|#define	TIFFTAG_COMPRESSION		259	/* data compression technique */
  ------------------
              	(void) TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
  ------------------
  |  |  176|  23.1k|#define	    COMPRESSION_NONE		1	/* dump mode */
  ------------------
 1595|       |	/*
 1596|       |	 * NB: The directory is marked dirty as a result of setting
 1597|       |	 * up the default compression scheme.  However, this really
 1598|       |	 * isn't correct -- we want TIFF_DIRTYDIRECT to be set only
 1599|       |	 * if the user does something.  We could just do the setup
 1600|       |	 * by hand, but it seems better to use the normal mechanism
 1601|       |	 * (i.e. TIFFSetField).
 1602|       |	 */
 1603|  23.1k|	tif->tif_flags &= ~TIFF_DIRTYDIRECT;
  ------------------
  |  |   94|  23.1k|	#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1604|       |
 1605|       |	/*
 1606|       |	 * As per http://bugzilla.remotesensing.org/show_bug.cgi?id=19
 1607|       |	 * we clear the ISTILED flag when setting up a new directory.
 1608|       |	 * Should we also be clearing stuff like INSUBIFD?
 1609|       |	 */
 1610|  23.1k|	tif->tif_flags &= ~TIFF_ISTILED;
  ------------------
  |  |  101|  23.1k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  ------------------
 1611|       |
 1612|  23.1k|	return (1);
 1613|  23.1k|}
tif_dir.c:setByteArray:
   44|  7.20k|{
   45|  7.20k|	if (*vpp) {
  ------------------
  |  Branch (45:6): [True: 93, False: 7.11k]
  ------------------
   46|     93|		_TIFFfree(*vpp);
   47|     93|		*vpp = 0;
   48|     93|	}
   49|  7.20k|	if (vp) {
  ------------------
  |  Branch (49:6): [True: 7.04k, False: 166]
  ------------------
   50|  7.04k|		tmsize_t bytes = _TIFFMultiplySSize(NULL, nmemb, elem_size, NULL);
   51|  7.04k|		if (bytes)
  ------------------
  |  Branch (51:7): [True: 7.04k, False: 0]
  ------------------
   52|  7.04k|			*vpp = (void*) _TIFFmalloc(bytes);
   53|  7.04k|		if (*vpp)
  ------------------
  |  Branch (53:7): [True: 7.04k, False: 0]
  ------------------
   54|  7.04k|			_TIFFmemcpy(*vpp, vp, bytes);
   55|  7.04k|	}
   56|  7.20k|}
tif_dir.c:OkToChangeTag:
  930|   191k|{
  931|   191k|	const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  312|   191k|#define TIFF_ANY       TIFF_NOTYPE     /* for field descriptor searching */
  ------------------
  932|   191k|	if (!fip) {			/* unknown tag */
  ------------------
  |  Branch (932:6): [True: 0, False: 191k]
  ------------------
  933|      0|		TIFFErrorExtR(tif, "TIFFSetField", "%s: Unknown %stag %"PRIu32,
  934|      0|		    tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "", tag);
  ------------------
  |  |  205|      0|#define isPseudoTag(t) (t > 0xffff)            /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (205:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  935|      0|		return (0);
  936|      0|	}
  937|   191k|	if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) &&
  ------------------
  |  |  173|   382k|#define	TIFFTAG_IMAGELENGTH		257	/* image height in pixels */
  ------------------
              	if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) &&
  ------------------
  |  |   97|   174k|	#define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
  ------------------
  |  Branch (937:6): [True: 174k, False: 17.0k]
  |  Branch (937:36): [True: 0, False: 174k]
  ------------------
  938|   191k|	    !fip->field_oktochange) {
  ------------------
  |  Branch (938:6): [True: 0, False: 0]
  ------------------
  939|       |		/*
  940|       |		 * Consult info table to see if tag can be changed
  941|       |		 * after we've started writing.  We only allow changes
  942|       |		 * to those tags that don't/shouldn't affect the
  943|       |		 * compression and/or format of the data.
  944|       |		 */
  945|      0|		TIFFErrorExtR(tif, "TIFFSetField",
  946|      0|		    "%s: Cannot modify tag \"%s\" while writing",
  947|      0|		    tif->tif_name, fip->field_name);
  948|      0|		return (0);
  949|      0|	}
  950|   191k|	return (1);
  951|   191k|}
tif_dir.c:_TIFFVSetField:
  168|   178k|{
  169|   178k|	static const char module[] = "_TIFFVSetField";
  170|       |
  171|   178k|	TIFFDirectory* td = &tif->tif_dir;
  172|   178k|	int status = 1;
  173|   178k|	uint32_t v32, v;
  174|   178k|    double dblval;
  175|   178k|	char* s;
  176|   178k|	const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  312|   178k|#define TIFF_ANY       TIFF_NOTYPE     /* for field descriptor searching */
  ------------------
  177|   178k|	uint32_t standard_tag = tag;
  178|   178k|	if( fip == NULL ) /* cannot happen since OkToChangeTag() already checks it */
  ------------------
  |  Branch (178:6): [True: 0, False: 178k]
  ------------------
  179|      0|	    return 0;
  180|       |	/*
  181|       |	 * We want to force the custom code to be used for custom
  182|       |	 * fields even if the tag happens to match a well known 
  183|       |	 * one - important for reinterpreted handling of standard
  184|       |	 * tag values in custom directories (i.e. EXIF) 
  185|       |	 */
  186|   178k|	if (fip->field_bit == FIELD_CUSTOM) {
  ------------------
  |  |  317|   178k|#define FIELD_CUSTOM    65
  ------------------
  |  Branch (186:6): [True: 14.3k, False: 164k]
  ------------------
  187|  14.3k|		standard_tag = 0;
  188|  14.3k|	}
  189|       |
  190|   178k|	switch (standard_tag) {
  191|    191|	case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  164|    191|#define	TIFFTAG_SUBFILETYPE		254	/* subfile data descriptor */
  ------------------
  |  Branch (191:2): [True: 191, False: 178k]
  ------------------
  192|    191|		td->td_subfiletype = (uint32_t) va_arg(ap, uint32_t);
  193|    191|		break;
  194|  18.4k|	case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  172|  18.4k|#define	TIFFTAG_IMAGEWIDTH		256	/* image width in pixels */
  ------------------
  |  Branch (194:2): [True: 18.4k, False: 160k]
  ------------------
  195|  18.4k|		td->td_imagewidth = (uint32_t) va_arg(ap, uint32_t);
  196|  18.4k|		break;
  197|  17.0k|	case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  173|  17.0k|#define	TIFFTAG_IMAGELENGTH		257	/* image height in pixels */
  ------------------
  |  Branch (197:2): [True: 17.0k, False: 161k]
  ------------------
  198|  17.0k|		td->td_imagelength = (uint32_t) va_arg(ap, uint32_t);
  199|  17.0k|		break;
  200|  9.67k|	case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  174|  9.67k|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
  |  Branch (200:2): [True: 9.67k, False: 168k]
  ------------------
  201|  9.67k|		td->td_bitspersample = (uint16_t) va_arg(ap, uint16_vap);
  202|       |		/*
  203|       |		 * If the data require post-decoding processing to byte-swap
  204|       |		 * samples, set it up here.  Note that since tags are required
  205|       |		 * to be ordered, compression code can override this behavior
  206|       |		 * in the setup method if it wants to roll the post decoding
  207|       |		 * work in with its normal work.
  208|       |		 */
  209|  9.67k|		if (tif->tif_flags & TIFF_SWAB) {
  ------------------
  |  |   98|  9.67k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (209:7): [True: 149, False: 9.52k]
  ------------------
  210|    149|			if (td->td_bitspersample == 8)
  ------------------
  |  Branch (210:8): [True: 57, False: 92]
  ------------------
  211|     57|				tif->tif_postdecode = _TIFFNoPostDecode;
  212|     92|			else if (td->td_bitspersample == 16)
  ------------------
  |  Branch (212:13): [True: 10, False: 82]
  ------------------
  213|     10|				tif->tif_postdecode = _TIFFSwab16BitData;
  214|     82|			else if (td->td_bitspersample == 24)
  ------------------
  |  Branch (214:13): [True: 1, False: 81]
  ------------------
  215|      1|				tif->tif_postdecode = _TIFFSwab24BitData;
  216|     81|			else if (td->td_bitspersample == 32)
  ------------------
  |  Branch (216:13): [True: 2, False: 79]
  ------------------
  217|      2|				tif->tif_postdecode = _TIFFSwab32BitData;
  218|     79|			else if (td->td_bitspersample == 64)
  ------------------
  |  Branch (218:13): [True: 1, False: 78]
  ------------------
  219|      1|				tif->tif_postdecode = _TIFFSwab64BitData;
  220|     78|			else if (td->td_bitspersample == 128) /* two 64's */
  ------------------
  |  Branch (220:13): [True: 2, False: 76]
  ------------------
  221|      2|				tif->tif_postdecode = _TIFFSwab64BitData;
  222|    149|		}
  223|  9.67k|		break;
  224|  45.7k|	case TIFFTAG_COMPRESSION:
  ------------------
  |  |  175|  45.7k|#define	TIFFTAG_COMPRESSION		259	/* data compression technique */
  ------------------
  |  Branch (224:2): [True: 45.7k, False: 132k]
  ------------------
  225|  45.7k|		v = (uint16_t) va_arg(ap, uint16_vap);
  226|       |		/*
  227|       |		 * If we're changing the compression scheme, notify the
  228|       |		 * previous module so that it can cleanup any state it's
  229|       |		 * setup.
  230|       |		 */
  231|  45.7k|		if (TIFFFieldSet(tif, FIELD_COMPRESSION)) {
  ------------------
  |  |  198|  45.7k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  45.7k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  45.7k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  |  |  |  Branch (198:34): [True: 22.6k, False: 23.1k]
  |  |  ------------------
  ------------------
  232|  22.6k|			if ((uint32_t)td->td_compression == v)
  ------------------
  |  Branch (232:8): [True: 7.89k, False: 14.7k]
  ------------------
  233|  7.89k|				break;
  234|  14.7k|			(*tif->tif_cleanup)(tif);
  235|  14.7k|			tif->tif_flags &= ~TIFF_CODERSETUP;
  ------------------
  |  |   96|  14.7k|	#define TIFF_CODERSETUP  0x00020U /* encoder/decoder setup done */
  ------------------
  236|  14.7k|		}
  237|       |		/*
  238|       |		 * Setup new compression routine state.
  239|       |		 */
  240|  37.8k|		if( (status = TIFFSetCompressionScheme(tif, v)) != 0 )
  ------------------
  |  Branch (240:7): [True: 37.8k, False: 0]
  ------------------
  241|  37.8k|		    td->td_compression = (uint16_t) v;
  242|      0|		else
  243|      0|		    status = 0;
  244|  37.8k|		break;
  245|  6.81k|	case TIFFTAG_PHOTOMETRIC:
  ------------------
  |  |  214|  6.81k|#define	TIFFTAG_PHOTOMETRIC		262	/* photometric interpretation */
  ------------------
  |  Branch (245:2): [True: 6.81k, False: 171k]
  ------------------
  246|  6.81k|		td->td_photometric = (uint16_t) va_arg(ap, uint16_vap);
  247|  6.81k|		break;
  248|     13|	case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  228|     13|#define	TIFFTAG_THRESHHOLDING		263	/* +thresholding used on data */
  ------------------
  |  Branch (248:2): [True: 13, False: 178k]
  ------------------
  249|     13|		td->td_threshholding = (uint16_t) va_arg(ap, uint16_vap);
  250|     13|		break;
  251|    322|	case TIFFTAG_FILLORDER:
  ------------------
  |  |  234|    322|#define	TIFFTAG_FILLORDER		266	/* data order within a byte */
  ------------------
  |  Branch (251:2): [True: 322, False: 178k]
  ------------------
  252|    322|		v = (uint16_t) va_arg(ap, uint16_vap);
  253|    322|		if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)
  ------------------
  |  |  236|    644|#define	    FILLORDER_LSB2MSB		2	/* least significant -> most */
  ------------------
              		if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)
  ------------------
  |  |  235|    226|#define	    FILLORDER_MSB2LSB		1	/* most significant -> least */
  ------------------
  |  Branch (253:7): [True: 226, False: 96]
  |  Branch (253:33): [True: 41, False: 185]
  ------------------
  254|     41|			goto badvalue;
  255|    281|		td->td_fillorder = (uint16_t) v;
  256|    281|		break;
  257|    401|	case TIFFTAG_ORIENTATION:
  ------------------
  |  |  242|    401|#define	TIFFTAG_ORIENTATION		274	/* +image orientation */
  ------------------
  |  Branch (257:2): [True: 401, False: 178k]
  ------------------
  258|    401|		v = (uint16_t) va_arg(ap, uint16_vap);
  259|    401|		if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v)
  ------------------
  |  |  243|    802|#define	    ORIENTATION_TOPLEFT		1	/* row 0 top, col 0 lhs */
  ------------------
              		if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v)
  ------------------
  |  |  250|    393|#define	    ORIENTATION_LEFTBOT		8	/* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (259:7): [True: 8, False: 393]
  |  Branch (259:34): [True: 46, False: 347]
  ------------------
  260|     54|			goto badvalue;
  261|    347|		else
  262|    347|			td->td_orientation = (uint16_t) v;
  263|    347|		break;
  264|  7.45k|	case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  251|  7.45k|#define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
  ------------------
  |  Branch (264:2): [True: 7.45k, False: 171k]
  ------------------
  265|  7.45k|		v = (uint16_t) va_arg(ap, uint16_vap);
  266|  7.45k|		if (v == 0)
  ------------------
  |  Branch (266:7): [True: 1, False: 7.45k]
  ------------------
  267|      1|			goto badvalue;
  268|  7.45k|        if( v != td->td_samplesperpixel )
  ------------------
  |  Branch (268:13): [True: 7.30k, False: 146]
  ------------------
  269|  7.30k|        {
  270|       |            /* See http://bugzilla.maptools.org/show_bug.cgi?id=2500 */
  271|  7.30k|            if( td->td_sminsamplevalue != NULL )
  ------------------
  |  Branch (271:17): [True: 1, False: 7.30k]
  ------------------
  272|      1|            {
  273|      1|                TIFFWarningExtR(tif,module,
  274|      1|                    "SamplesPerPixel tag value is changing, "
  275|      1|                    "but SMinSampleValue tag was read with a different value. Canceling it");
  276|      1|                TIFFClrFieldBit(tif,FIELD_SMINSAMPLEVALUE);
  ------------------
  |  |  200|      1|#define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  197|      1|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  196|      1|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  277|      1|                _TIFFfree(td->td_sminsamplevalue);
  278|      1|                td->td_sminsamplevalue = NULL;
  279|      1|            }
  280|  7.30k|            if( td->td_smaxsamplevalue != NULL )
  ------------------
  |  Branch (280:17): [True: 2, False: 7.30k]
  ------------------
  281|      2|            {
  282|      2|                TIFFWarningExtR(tif,module,
  283|      2|                    "SamplesPerPixel tag value is changing, "
  284|      2|                    "but SMaxSampleValue tag was read with a different value. Canceling it");
  285|      2|                TIFFClrFieldBit(tif,FIELD_SMAXSAMPLEVALUE);
  ------------------
  |  |  200|      2|#define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  197|      2|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  196|      2|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  286|      2|                _TIFFfree(td->td_smaxsamplevalue);
  287|      2|                td->td_smaxsamplevalue = NULL;
  288|      2|            }
  289|       |            /* Test if 3 transfer functions instead of just one are now needed
  290|       |               See http://bugzilla.maptools.org/show_bug.cgi?id=2820 */
  291|  7.30k|            if( td->td_transferfunction[0] != NULL && (v - td->td_extrasamples > 1) &&
  ------------------
  |  Branch (291:17): [True: 1, False: 7.30k]
  |  Branch (291:55): [True: 1, False: 0]
  ------------------
  292|  7.30k|                !(td->td_samplesperpixel - td->td_extrasamples > 1))
  ------------------
  |  Branch (292:17): [True: 1, False: 0]
  ------------------
  293|      1|            {
  294|      1|                    TIFFWarningExtR(tif,module,
  295|      1|                        "SamplesPerPixel tag value is changing, "
  296|      1|                        "but TransferFunction was read with a different value. Canceling it");
  297|      1|                    TIFFClrFieldBit(tif,FIELD_TRANSFERFUNCTION);
  ------------------
  |  |  200|      1|#define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  197|      1|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  196|      1|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  298|      1|                    _TIFFfree(td->td_transferfunction[0]);
  299|      1|                    td->td_transferfunction[0] = NULL;
  300|      1|            }
  301|  7.30k|        }
  302|  7.45k|		td->td_samplesperpixel = (uint16_t) v;
  303|  7.45k|		break;
  304|  7.60k|	case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  252|  7.60k|#define	TIFFTAG_ROWSPERSTRIP		278	/* rows per strip of data */
  ------------------
  |  Branch (304:2): [True: 7.60k, False: 170k]
  ------------------
  305|  7.60k|		v32 = (uint32_t) va_arg(ap, uint32_t);
  306|  7.60k|		if (v32 == 0)
  ------------------
  |  Branch (306:7): [True: 3, False: 7.60k]
  ------------------
  307|      3|			goto badvalue32;
  308|  7.60k|		td->td_rowsperstrip = v32;
  309|  7.60k|		if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) {
  ------------------
  |  |  198|  7.60k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  7.60k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  7.60k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  |  Branch (309:7): [True: 7.52k, False: 85]
  ------------------
  310|  7.52k|			td->td_tilelength = v32;
  311|  7.52k|			td->td_tilewidth = td->td_imagewidth;
  312|  7.52k|		}
  313|  7.60k|		break;
  314|    114|	case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  254|    114|#define	TIFFTAG_MINSAMPLEVALUE		280	/* +minimum sample value */
  ------------------
  |  Branch (314:2): [True: 114, False: 178k]
  ------------------
  315|    114|		td->td_minsamplevalue = (uint16_t) va_arg(ap, uint16_vap);
  316|    114|		break;
  317|     25|	case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  255|     25|#define	TIFFTAG_MAXSAMPLEVALUE		281	/* +maximum sample value */
  ------------------
  |  Branch (317:2): [True: 25, False: 178k]
  ------------------
  318|     25|		td->td_maxsamplevalue = (uint16_t) va_arg(ap, uint16_vap);
  319|     25|		break;
  320|    140|	case TIFFTAG_SMINSAMPLEVALUE:
  ------------------
  |  |  334|    140|#define	TIFFTAG_SMINSAMPLEVALUE		340	/* !variable MinSampleValue */
  ------------------
  |  Branch (320:2): [True: 140, False: 178k]
  ------------------
  321|    140|		if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  113|    140|        #define TIFF_PERSAMPLE  0x400000U /* get/set per sample tags as arrays */
  ------------------
  |  Branch (321:7): [True: 140, False: 0]
  ------------------
  322|    140|			_TIFFsetDoubleArray(&td->td_sminsamplevalue, va_arg(ap, double*), td->td_samplesperpixel);
  323|      0|		else
  324|      0|			setDoubleArrayOneValue(&td->td_sminsamplevalue, va_arg(ap, double), td->td_samplesperpixel);
  325|    140|		break;
  326|    114|	case TIFFTAG_SMAXSAMPLEVALUE:
  ------------------
  |  |  335|    114|#define	TIFFTAG_SMAXSAMPLEVALUE		341	/* !variable MaxSampleValue */
  ------------------
  |  Branch (326:2): [True: 114, False: 178k]
  ------------------
  327|    114|		if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  113|    114|        #define TIFF_PERSAMPLE  0x400000U /* get/set per sample tags as arrays */
  ------------------
  |  Branch (327:7): [True: 114, False: 0]
  ------------------
  328|    114|			_TIFFsetDoubleArray(&td->td_smaxsamplevalue, va_arg(ap, double*), td->td_samplesperpixel);
  329|      0|		else
  330|      0|			setDoubleArrayOneValue(&td->td_smaxsamplevalue, va_arg(ap, double), td->td_samplesperpixel);
  331|    114|		break;
  332|    479|	case TIFFTAG_XRESOLUTION:
  ------------------
  |  |  256|    479|#define	TIFFTAG_XRESOLUTION		282	/* pixels/resolution in x */
  ------------------
  |  Branch (332:2): [True: 479, False: 178k]
  ------------------
  333|    479|        dblval = va_arg(ap, double);
  334|    479|        if( dblval != dblval || dblval < 0 )
  ------------------
  |  Branch (334:13): [True: 4, False: 475]
  |  Branch (334:33): [True: 21, False: 454]
  ------------------
  335|     25|            goto badvaluedouble;
  336|    454|		td->td_xresolution = _TIFFClampDoubleToFloat( dblval );
  337|    454|		break;
  338|    317|	case TIFFTAG_YRESOLUTION:
  ------------------
  |  |  257|    317|#define	TIFFTAG_YRESOLUTION		283	/* pixels/resolution in y */
  ------------------
  |  Branch (338:2): [True: 317, False: 178k]
  ------------------
  339|    317|        dblval = va_arg(ap, double);
  340|    317|        if( dblval != dblval || dblval < 0 )
  ------------------
  |  Branch (340:13): [True: 3, False: 314]
  |  Branch (340:33): [True: 30, False: 284]
  ------------------
  341|     33|            goto badvaluedouble;
  342|    284|		td->td_yresolution = _TIFFClampDoubleToFloat( dblval );
  343|    284|		break;
  344|  24.6k|	case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  258|  24.6k|#define	TIFFTAG_PLANARCONFIG		284	/* storage organization */
  ------------------
  |  Branch (344:2): [True: 24.6k, False: 153k]
  ------------------
  345|  24.6k|		v = (uint16_t) va_arg(ap, uint16_vap);
  346|  24.6k|		if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  259|  49.2k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
              		if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  260|  1.09k|#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  ------------------
  |  Branch (346:7): [True: 1.09k, False: 23.5k]
  |  Branch (346:35): [True: 17, False: 1.08k]
  ------------------
  347|     17|			goto badvalue;
  348|  24.6k|		td->td_planarconfig = (uint16_t) v;
  349|  24.6k|		break;
  350|    134|	case TIFFTAG_XPOSITION:
  ------------------
  |  |  262|    134|#define	TIFFTAG_XPOSITION		286	/* x page offset of image lhs */
  ------------------
  |  Branch (350:2): [True: 134, False: 178k]
  ------------------
  351|    134|		td->td_xposition = _TIFFClampDoubleToFloat( va_arg(ap, double) );
  352|    134|		break;
  353|    118|	case TIFFTAG_YPOSITION:
  ------------------
  |  |  263|    118|#define	TIFFTAG_YPOSITION		287	/* y page offset of image lhs */
  ------------------
  |  Branch (353:2): [True: 118, False: 178k]
  ------------------
  354|    118|		td->td_yposition = _TIFFClampDoubleToFloat( va_arg(ap, double) );
  355|    118|		break;
  356|    157|	case TIFFTAG_RESOLUTIONUNIT:
  ------------------
  |  |  281|    157|#define	TIFFTAG_RESOLUTIONUNIT		296	/* units of resolutions */
  ------------------
  |  Branch (356:2): [True: 157, False: 178k]
  ------------------
  357|    157|		v = (uint16_t) va_arg(ap, uint16_vap);
  358|    157|		if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)
  ------------------
  |  |  282|    314|#define	    RESUNIT_NONE		1	/* no meaningful units */
  ------------------
              		if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)
  ------------------
  |  |  284|    155|#define	    RESUNIT_CENTIMETER		3	/* metric */
  ------------------
  |  Branch (358:7): [True: 2, False: 155]
  |  Branch (358:27): [True: 37, False: 118]
  ------------------
  359|     39|			goto badvalue;
  360|    118|		td->td_resolutionunit = (uint16_t) v;
  361|    118|		break;
  362|    198|	case TIFFTAG_PAGENUMBER:
  ------------------
  |  |  285|    198|#define	TIFFTAG_PAGENUMBER		297	/* page numbers of multi-page */
  ------------------
  |  Branch (362:2): [True: 198, False: 178k]
  ------------------
  363|    198|		td->td_pagenumber[0] = (uint16_t) va_arg(ap, uint16_vap);
  364|    198|		td->td_pagenumber[1] = (uint16_t) va_arg(ap, uint16_vap);
  365|    198|		break;
  366|      8|	case TIFFTAG_HALFTONEHINTS:
  ------------------
  |  |  304|      8|#define	TIFFTAG_HALFTONEHINTS		321	/* !highlight+shadow info */
  ------------------
  |  Branch (366:2): [True: 8, False: 178k]
  ------------------
  367|      8|		td->td_halftonehints[0] = (uint16_t) va_arg(ap, uint16_vap);
  368|      8|		td->td_halftonehints[1] = (uint16_t) va_arg(ap, uint16_vap);
  369|      8|		break;
  370|     63|	case TIFFTAG_COLORMAP:
  ------------------
  |  |  303|     63|#define	TIFFTAG_COLORMAP		320	/* RGB map for palette image */
  ------------------
  |  Branch (370:2): [True: 63, False: 178k]
  ------------------
  371|     63|		v32 = (uint32_t)(1L << td->td_bitspersample);
  372|     63|		_TIFFsetShortArray(&td->td_colormap[0], va_arg(ap, uint16_t*), v32);
  373|     63|		_TIFFsetShortArray(&td->td_colormap[1], va_arg(ap, uint16_t*), v32);
  374|     63|		_TIFFsetShortArray(&td->td_colormap[2], va_arg(ap, uint16_t*), v32);
  375|     63|		break;
  376|    265|	case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  323|    265|#define	TIFFTAG_EXTRASAMPLES		338	/* !info about extra samples */
  ------------------
  |  Branch (376:2): [True: 265, False: 178k]
  ------------------
  377|    265|		if (!setExtraSamples(tif, ap, &v))
  ------------------
  |  Branch (377:7): [True: 56, False: 209]
  ------------------
  378|     56|			goto badvalue;
  379|    209|		break;
  380|    209|	case TIFFTAG_MATTEING:
  ------------------
  |  |  404|     16|#define	TIFFTAG_MATTEING		32995	/* $use ExtraSamples */
  ------------------
  |  Branch (380:2): [True: 16, False: 178k]
  ------------------
  381|     16|		td->td_extrasamples =  (((uint16_t) va_arg(ap, uint16_vap)) != 0);
  382|     16|		if (td->td_extrasamples) {
  ------------------
  |  Branch (382:7): [True: 15, False: 1]
  ------------------
  383|     15|			uint16_t sv = EXTRASAMPLE_ASSOCALPHA;
  ------------------
  |  |  325|     15|#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
  ------------------
  384|     15|			_TIFFsetShortArray(&td->td_sampleinfo, &sv, 1);
  385|     15|		}
  386|     16|		break;
  387|  11.8k|	case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  305|  11.8k|#define	TIFFTAG_TILEWIDTH		322	/* !tile width in pixels */
  ------------------
  |  Branch (387:2): [True: 11.8k, False: 166k]
  ------------------
  388|  11.8k|		v32 = (uint32_t) va_arg(ap, uint32_t);
  389|  11.8k|		if (v32 % 16) {
  ------------------
  |  Branch (389:7): [True: 9.69k, False: 2.18k]
  ------------------
  390|  9.69k|			if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (390:8): [True: 0, False: 9.69k]
  ------------------
  391|      0|				goto badvalue32;
  392|  9.69k|			TIFFWarningExtR(tif, tif->tif_name,
  393|  9.69k|				"Nonstandard tile width %"PRIu32", convert file", v32);
  394|  9.69k|		}
  395|  11.8k|		td->td_tilewidth = v32;
  396|  11.8k|		tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  101|  11.8k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  ------------------
  397|  11.8k|		break;
  398|  7.35k|	case TIFFTAG_TILELENGTH:
  ------------------
  |  |  306|  7.35k|#define	TIFFTAG_TILELENGTH		323	/* !tile height in pixels */
  ------------------
  |  Branch (398:2): [True: 7.35k, False: 171k]
  ------------------
  399|  7.35k|		v32 = (uint32_t) va_arg(ap, uint32_t);
  400|  7.35k|		if (v32 % 16) {
  ------------------
  |  Branch (400:7): [True: 4.12k, False: 3.23k]
  ------------------
  401|  4.12k|			if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (401:8): [True: 0, False: 4.12k]
  ------------------
  402|      0|				goto badvalue32;
  403|  4.12k|			TIFFWarningExtR(tif, tif->tif_name,
  404|  4.12k|			    "Nonstandard tile length %"PRIu32", convert file", v32);
  405|  4.12k|		}
  406|  7.35k|		td->td_tilelength = v32;
  407|  7.35k|		tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  101|  7.35k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  ------------------
  408|  7.35k|		break;
  409|    123|	case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  407|    123|#define	TIFFTAG_TILEDEPTH		32998	/* z depth/data tile */
  ------------------
  |  Branch (409:2): [True: 123, False: 178k]
  ------------------
  410|    123|		v32 = (uint32_t) va_arg(ap, uint32_t);
  411|    123|		if (v32 == 0)
  ------------------
  |  Branch (411:7): [True: 1, False: 122]
  ------------------
  412|      1|			goto badvalue32;
  413|    122|		td->td_tiledepth = v32;
  414|    122|		break;
  415|     17|	case TIFFTAG_DATATYPE:
  ------------------
  |  |  405|     17|#define	TIFFTAG_DATATYPE		32996	/* $use SampleFormat */
  ------------------
  |  Branch (415:2): [True: 17, False: 178k]
  ------------------
  416|     17|		v = (uint16_t) va_arg(ap, uint16_vap);
  417|     17|		switch (v) {
  418|      1|		case DATATYPE_VOID:	v = SAMPLEFORMAT_VOID;	break;
  ------------------
  |  |   37|      1|#define DATATYPE_VOID		0       /* !untyped data */
  ------------------
              		case DATATYPE_VOID:	v = SAMPLEFORMAT_VOID;	break;
  ------------------
  |  |  331|      1|#define	    SAMPLEFORMAT_VOID		4	/* !untyped data */
  ------------------
  |  Branch (418:3): [True: 1, False: 16]
  ------------------
  419|      7|		case DATATYPE_INT:	v = SAMPLEFORMAT_INT;	break;
  ------------------
  |  |   38|      7|#define DATATYPE_INT		1       /* !signed integer data */
  ------------------
              		case DATATYPE_INT:	v = SAMPLEFORMAT_INT;	break;
  ------------------
  |  |  329|      7|#define	    SAMPLEFORMAT_INT		2	/* !signed integer data */
  ------------------
  |  Branch (419:3): [True: 7, False: 10]
  ------------------
  420|      2|		case DATATYPE_UINT:	v = SAMPLEFORMAT_UINT;	break;
  ------------------
  |  |   39|      2|#define DATATYPE_UINT		2       /* !unsigned integer data */
  ------------------
              		case DATATYPE_UINT:	v = SAMPLEFORMAT_UINT;	break;
  ------------------
  |  |  328|      2|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
  |  Branch (420:3): [True: 2, False: 15]
  ------------------
  421|      3|		case DATATYPE_IEEEFP:	v = SAMPLEFORMAT_IEEEFP;break;
  ------------------
  |  |   40|      3|#define DATATYPE_IEEEFP		3       /* !IEEE floating point data */
  ------------------
              		case DATATYPE_IEEEFP:	v = SAMPLEFORMAT_IEEEFP;break;
  ------------------
  |  |  330|      3|#define	    SAMPLEFORMAT_IEEEFP		3	/* !IEEE floating point data */
  ------------------
  |  Branch (421:3): [True: 3, False: 14]
  ------------------
  422|      4|		default:		goto badvalue;
  ------------------
  |  Branch (422:3): [True: 4, False: 13]
  ------------------
  423|     17|		}
  424|     13|		td->td_sampleformat = (uint16_t) v;
  425|     13|		break;
  426|    400|	case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  327|    400|#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
  ------------------
  |  Branch (426:2): [True: 400, False: 178k]
  ------------------
  427|    400|		v = (uint16_t) va_arg(ap, uint16_vap);
  428|    400|		if (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v)
  ------------------
  |  |  328|    800|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
              		if (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v)
  ------------------
  |  |  333|    398|#define	    SAMPLEFORMAT_COMPLEXIEEEFP	6	/* !complex ieee floating */
  ------------------
  |  Branch (428:7): [True: 2, False: 398]
  |  Branch (428:32): [True: 7, False: 391]
  ------------------
  429|      9|			goto badvalue;
  430|    391|		td->td_sampleformat = (uint16_t) v;
  431|       |
  432|       |		/*  Try to fix up the SWAB function for complex data. */
  433|    391|		if( td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT
  ------------------
  |  |  332|    782|#define	    SAMPLEFORMAT_COMPLEXINT	5	/* !complex signed int */
  ------------------
  |  Branch (433:7): [True: 9, False: 382]
  ------------------
  434|    391|		    && td->td_bitspersample == 32
  ------------------
  |  Branch (434:10): [True: 1, False: 8]
  ------------------
  435|    391|		    && tif->tif_postdecode == _TIFFSwab32BitData )
  ------------------
  |  Branch (435:10): [True: 0, False: 1]
  ------------------
  436|      0|		    tif->tif_postdecode = _TIFFSwab16BitData;
  437|    391|		else if( (td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT
  ------------------
  |  |  332|    782|#define	    SAMPLEFORMAT_COMPLEXINT	5	/* !complex signed int */
  ------------------
  |  Branch (437:13): [True: 9, False: 382]
  ------------------
  438|    391|			  || td->td_sampleformat == SAMPLEFORMAT_COMPLEXIEEEFP)
  ------------------
  |  |  333|    382|#define	    SAMPLEFORMAT_COMPLEXIEEEFP	6	/* !complex ieee floating */
  ------------------
  |  Branch (438:9): [True: 5, False: 377]
  ------------------
  439|    391|			 && td->td_bitspersample == 64
  ------------------
  |  Branch (439:8): [True: 1, False: 13]
  ------------------
  440|    391|			 && tif->tif_postdecode == _TIFFSwab64BitData )
  ------------------
  |  Branch (440:8): [True: 0, False: 1]
  ------------------
  441|      0|		    tif->tif_postdecode = _TIFFSwab32BitData;
  442|    391|		break;
  443|     31|	case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  406|     31|#define	TIFFTAG_IMAGEDEPTH		32997	/* z depth of image */
  ------------------
  |  Branch (443:2): [True: 31, False: 178k]
  ------------------
  444|     31|		td->td_imagedepth = (uint32_t) va_arg(ap, uint32_t);
  445|     31|		break;
  446|     24|	case TIFFTAG_SUBIFD:
  ------------------
  |  |  315|     24|#define	TIFFTAG_SUBIFD			330	/* subimage descriptors */
  ------------------
  |  Branch (446:2): [True: 24, False: 178k]
  ------------------
  447|     24|		if ((tif->tif_flags & TIFF_INSUBIFD) == 0) {
  ------------------
  |  |  104|     24|	#define TIFF_INSUBIFD    0x02000U /* currently writing a subifd */
  ------------------
  |  Branch (447:7): [True: 24, False: 0]
  ------------------
  448|     24|			td->td_nsubifd = (uint16_t) va_arg(ap, uint16_vap);
  449|     24|			_TIFFsetLong8Array(&td->td_subifd, (uint64_t*) va_arg(ap, uint64_t*),
  450|     24|			    (uint32_t) td->td_nsubifd);
  451|     24|		} else {
  452|      0|			TIFFErrorExtR(tif, module,
  453|      0|				     "%s: Sorry, cannot nest SubIFDs",
  454|      0|				     tif->tif_name);
  455|      0|			status = 0;
  456|      0|		}
  457|     24|		break;
  458|      1|	case TIFFTAG_YCBCRPOSITIONING:
  ------------------
  |  |  387|      1|#define	TIFFTAG_YCBCRPOSITIONING	531	/* !subsample positioning */
  ------------------
  |  Branch (458:2): [True: 1, False: 178k]
  ------------------
  459|      1|		td->td_ycbcrpositioning = (uint16_t) va_arg(ap, uint16_vap);
  460|      1|		break;
  461|  3.65k|	case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  386|  3.65k|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
  |  Branch (461:2): [True: 3.65k, False: 174k]
  ------------------
  462|  3.65k|		td->td_ycbcrsubsampling[0] = (uint16_t) va_arg(ap, uint16_vap);
  463|  3.65k|		td->td_ycbcrsubsampling[1] = (uint16_t) va_arg(ap, uint16_vap);
  464|  3.65k|		break;
  465|      6|	case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  292|      6|#define	TIFFTAG_TRANSFERFUNCTION	301	/* !colorimetry info */
  ------------------
  |  Branch (465:2): [True: 6, False: 178k]
  ------------------
  466|      6|	{
  467|      6|		uint32_t i;
  468|      6|		v = (td->td_samplesperpixel - td->td_extrasamples) > 1 ? 3 : 1;
  ------------------
  |  Branch (468:7): [True: 1, False: 5]
  ------------------
  469|     14|		for (i = 0; i < v; i++)
  ------------------
  |  Branch (469:15): [True: 8, False: 6]
  ------------------
  470|      8|			_TIFFsetShortArray(&td->td_transferfunction[i],
  471|      8|                               va_arg(ap, uint16_t*), 1U << td->td_bitspersample);
  472|      6|		break;
  473|    400|	}
  474|     80|	case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  390|     80|#define	TIFFTAG_REFERENCEBLACKWHITE	532	/* !colorimetry info */
  ------------------
  |  Branch (474:2): [True: 80, False: 178k]
  ------------------
  475|       |		/* XXX should check for null range */
  476|     80|		_TIFFsetFloatArray(&td->td_refblackwhite, va_arg(ap, float*), 6);
  477|     80|		break;
  478|     73|	case TIFFTAG_INKNAMES:
  ------------------
  |  |  319|     73|#define	TIFFTAG_INKNAMES		333	/* !ascii names of inks */
  ------------------
  |  Branch (478:2): [True: 73, False: 178k]
  ------------------
  479|     73|		{
  480|     73|			v = (uint16_t) va_arg(ap, uint16_vap);
  481|     73|			s = va_arg(ap, char*);
  482|     73|			uint16_t ninksinstring;
  483|     73|			ninksinstring = countInkNamesString(tif, v, s);
  484|     73|			status = ninksinstring > 0;
  485|     73|			if(ninksinstring > 0 ) {
  ------------------
  |  Branch (485:7): [True: 53, False: 20]
  ------------------
  486|     53|				_TIFFsetNString(&td->td_inknames, s, v);
  487|     53|				td->td_inknameslen = v;
  488|       |				/* Set NumberOfInks to the value ninksinstring */
  489|     53|				if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS))
  ------------------
  |  |  198|     53|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|     53|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|     53|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  |  |  |  Branch (198:34): [True: 2, False: 51]
  |  |  ------------------
  ------------------
  490|      2|				{
  491|      2|					if (td->td_numberofinks != ninksinstring) {
  ------------------
  |  Branch (491:10): [True: 1, False: 1]
  ------------------
  492|      1|						TIFFErrorExtR(tif, module,
  493|      1|							"Warning %s; Tag %s:\n  Value %"PRIu16" of NumberOfInks is different from the number of inks %"PRIu16".\n  -> NumberOfInks value adapted to %"PRIu16"",
  494|      1|							tif->tif_name, fip->field_name, td->td_numberofinks, ninksinstring, ninksinstring);
  495|      1|						td->td_numberofinks = ninksinstring;
  496|      1|					}
  497|     51|				} else {
  498|     51|					td->td_numberofinks = ninksinstring;
  499|     51|					TIFFSetFieldBit(tif, FIELD_NUMBEROFINKS);
  ------------------
  |  |  199|     51|#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  197|     51|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  196|     51|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  500|     51|				}
  501|     53|				if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  198|     53|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|     53|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|     53|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  |  |  |  Branch (198:34): [True: 14, False: 39]
  |  |  ------------------
  ------------------
  502|     14|				{
  503|     14|					if (td->td_numberofinks != td->td_samplesperpixel) {
  ------------------
  |  Branch (503:10): [True: 13, False: 1]
  ------------------
  504|     13|						TIFFErrorExtR(tif, module,
  505|     13|							"Warning %s; Tag %s:\n  Value %"PRIu16" of NumberOfInks is different from the SamplesPerPixel value %"PRIu16"",
  506|     13|							tif->tif_name, fip->field_name, td->td_numberofinks, td->td_samplesperpixel);
  507|     13|					}
  508|     14|				}
  509|     53|			}
  510|     73|		}
  511|     73|		break;
  512|     14|	case TIFFTAG_NUMBEROFINKS:
  ------------------
  |  |  320|     14|#define	TIFFTAG_NUMBEROFINKS		334	/* !number of inks */
  ------------------
  |  Branch (512:2): [True: 14, False: 178k]
  ------------------
  513|     14|		v = (uint16_t)va_arg(ap, uint16_vap);
  514|       |		/* If InkNames already set also NumberOfInks is set accordingly and should be equal */
  515|     14|		if (TIFFFieldSet(tif, FIELD_INKNAMES))
  ------------------
  |  |  198|     14|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|     14|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|     14|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  |  |  |  Branch (198:34): [True: 3, False: 11]
  |  |  ------------------
  ------------------
  516|      3|		{
  517|      3|			if (v != td->td_numberofinks) {
  ------------------
  |  Branch (517:8): [True: 2, False: 1]
  ------------------
  518|      2|				TIFFErrorExtR(tif, module,
  519|      2|					"Error %s; Tag %s:\n  It is not possible to set the value %"PRIu32" for NumberOfInks\n  which is different from the number of inks in the InkNames tag (%"PRIu16")",
  520|      2|					tif->tif_name, fip->field_name, v, td->td_numberofinks);
  521|       |				/* Do not set / overwrite number of inks already set by InkNames case accordingly. */
  522|      2|				status = 0;
  523|      2|			}
  524|     11|		} else {
  525|     11|			td->td_numberofinks = (uint16_t)v;
  526|     11|			if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  198|     11|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|     11|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|     11|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  |  |  |  Branch (198:34): [True: 7, False: 4]
  |  |  ------------------
  ------------------
  527|      7|			{
  528|      7|				if (td->td_numberofinks != td->td_samplesperpixel) {
  ------------------
  |  Branch (528:9): [True: 6, False: 1]
  ------------------
  529|      6|					TIFFErrorExtR(tif, module,
  530|      6|						"Warning %s; Tag %s:\n  Value %"PRIu32" of NumberOfInks is different from the SamplesPerPixel value %"PRIu16"",
  531|      6|						tif->tif_name, fip->field_name, v, td->td_samplesperpixel);
  532|      6|				}
  533|      7|			}
  534|     11|		}
  535|     14|		break;
  536|      0|	case TIFFTAG_PERSAMPLE:
  ------------------
  |  |  662|      0|#define TIFFTAG_PERSAMPLE       65563	/* interface for per sample tags */
  ------------------
  |  Branch (536:2): [True: 0, False: 178k]
  ------------------
  537|      0|		v = (uint16_t) va_arg(ap, uint16_vap);
  538|      0|		if( v == PERSAMPLE_MULTI )
  ------------------
  |  |  664|      0|#define     PERSAMPLE_MULTI         1	/* present as multiple values */
  ------------------
  |  Branch (538:7): [True: 0, False: 0]
  ------------------
  539|      0|			tif->tif_flags |= TIFF_PERSAMPLE;
  ------------------
  |  |  113|      0|        #define TIFF_PERSAMPLE  0x400000U /* get/set per sample tags as arrays */
  ------------------
  540|      0|		else
  541|      0|			tif->tif_flags &= ~TIFF_PERSAMPLE;
  ------------------
  |  |  113|      0|        #define TIFF_PERSAMPLE  0x400000U /* get/set per sample tags as arrays */
  ------------------
  542|      0|		break;
  543|  14.3k|	default: {
  ------------------
  |  Branch (543:2): [True: 14.3k, False: 164k]
  ------------------
  544|  14.3k|		TIFFTagValue *tv;
  545|  14.3k|		int tv_size, iCustom;
  546|       |
  547|       |		/*
  548|       |		 * This can happen if multiple images are open with different
  549|       |		 * codecs which have private tags.  The global tag information
  550|       |		 * table may then have tags that are valid for one file but not
  551|       |		 * the other. If the client tries to set a tag that is not valid
  552|       |		 * for the image's codec then we'll arrive here.  This
  553|       |		 * happens, for example, when tiffcp is used to convert between
  554|       |		 * compression schemes and codec-specific tags are blindly copied.
  555|       |		 * 
  556|       |		 * This also happens when a FIELD_IGNORE tag is written.
  557|       |		 */
  558|  14.3k|		if (fip->field_bit == FIELD_IGNORE) {
  ------------------
  |  |  139|  14.3k|#define FIELD_IGNORE                   0
  ------------------
  |  Branch (558:7): [True: 0, False: 14.3k]
  ------------------
  559|      0|			TIFFErrorExtR(tif, module,
  560|      0|				"%s: Ignored %stag \"%s\" (not supported by libtiff)",
  561|      0|				tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
  ------------------
  |  |  205|      0|#define isPseudoTag(t) (t > 0xffff)            /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (205:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  562|      0|				fip->field_name);
  563|      0|			status = 0;
  564|      0|			break;
  565|      0|		}
  566|  14.3k|		if(fip->field_bit != FIELD_CUSTOM) {
  ------------------
  |  |  317|  14.3k|#define FIELD_CUSTOM    65
  ------------------
  |  Branch (566:6): [True: 0, False: 14.3k]
  ------------------
  567|      0|			TIFFErrorExtR(tif, module,
  568|      0|			    "%s: Invalid %stag \"%s\" (not supported by codec)",
  569|      0|			    tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
  ------------------
  |  |  205|      0|#define isPseudoTag(t) (t > 0xffff)            /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (205:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  570|      0|			    fip->field_name);
  571|      0|			status = 0;
  572|      0|			break;
  573|      0|		}
  574|       |
  575|       |		/*
  576|       |		 * Find the existing entry for this custom value.
  577|       |		 */
  578|  14.3k|		tv = NULL;
  579|   397k|		for (iCustom = 0; iCustom < td->td_customValueCount; iCustom++) {
  ------------------
  |  Branch (579:21): [True: 383k, False: 14.3k]
  ------------------
  580|   383k|			if (td->td_customValues[iCustom].info->field_tag == tag) {
  ------------------
  |  Branch (580:8): [True: 0, False: 383k]
  ------------------
  581|      0|				tv = td->td_customValues + iCustom;
  582|      0|				if (tv->value != NULL) {
  ------------------
  |  Branch (582:9): [True: 0, False: 0]
  ------------------
  583|      0|					_TIFFfree(tv->value);
  584|      0|					tv->value = NULL;
  585|      0|				}
  586|      0|				break;
  587|      0|			}
  588|   383k|		}
  589|       |
  590|       |		/*
  591|       |		 * Grow the custom list if the entry was not found.
  592|       |		 */
  593|  14.3k|		if(tv == NULL) {
  ------------------
  |  Branch (593:6): [True: 14.3k, False: 0]
  ------------------
  594|  14.3k|			TIFFTagValue *new_customValues;
  595|       |
  596|  14.3k|			td->td_customValueCount++;
  597|  14.3k|			new_customValues = (TIFFTagValue *)
  598|  14.3k|			    _TIFFrealloc(td->td_customValues,
  599|  14.3k|			    sizeof(TIFFTagValue) * td->td_customValueCount);
  600|  14.3k|			if (!new_customValues) {
  ------------------
  |  Branch (600:8): [True: 0, False: 14.3k]
  ------------------
  601|      0|				TIFFErrorExtR(tif, module,
  602|      0|				    "%s: Failed to allocate space for list of custom values",
  603|      0|				    tif->tif_name);
  604|      0|				status = 0;
  605|      0|				goto end;
  606|      0|			}
  607|       |
  608|  14.3k|			td->td_customValues = new_customValues;
  609|       |
  610|  14.3k|			tv = td->td_customValues + (td->td_customValueCount - 1);
  611|  14.3k|			tv->info = fip;
  612|  14.3k|			tv->value = NULL;
  613|  14.3k|			tv->count = 0;
  614|  14.3k|		}
  615|       |
  616|       |		/*
  617|       |		 * Set custom value ... save a copy of the custom tag value.
  618|       |		 */
  619|       |		/*--: Rational2Double: For Rationals evaluate "set_field_type" to determine internal storage size. */
  620|  14.3k|		tv_size = TIFFFieldSetGetSize(fip);
  621|  14.3k|		if (tv_size == 0) {
  ------------------
  |  Branch (621:7): [True: 0, False: 14.3k]
  ------------------
  622|      0|			status = 0;
  623|      0|			TIFFErrorExtR(tif, module,
  624|      0|			    "%s: Bad field type %d for \"%s\"",
  625|      0|			    tif->tif_name, fip->field_type,
  626|      0|			    fip->field_name);
  627|      0|			goto end;
  628|      0|		}
  629|       |
  630|  14.3k|		if (fip->field_type == TIFF_ASCII)
  ------------------
  |  Branch (630:7): [True: 5.40k, False: 8.92k]
  ------------------
  631|  5.40k|		{
  632|  5.40k|			uint32_t ma;
  633|  5.40k|			const char* mb;
  634|  5.40k|			if (fip->field_passcount)
  ------------------
  |  Branch (634:8): [True: 4.58k, False: 814]
  ------------------
  635|  4.58k|			{
  636|  4.58k|				assert(fip->field_writecount==TIFF_VARIABLE2);
  637|  4.58k|				ma=(uint32_t)va_arg(ap, uint32_t);
  638|  4.58k|				mb=(const char*)va_arg(ap,const char*);
  639|  4.58k|			}
  640|    814|			else
  641|    814|			{
  642|    814|				mb=(const char*)va_arg(ap,const char*);
  643|    814|				size_t len = strlen(mb) + 1;
  644|    814|				if( len >= 0x80000000U )
  ------------------
  |  Branch (644:9): [True: 0, False: 814]
  ------------------
  645|      0|				{
  646|      0|					status = 0;
  647|      0|					TIFFErrorExtR(tif, module,
  648|      0|					    "%s: Too long string value for \"%s\". "
  649|      0|					    "Maximum supported is 2147483647 bytes",
  650|      0|					    tif->tif_name,
  651|      0|					    fip->field_name);
  652|      0|					goto end;
  653|      0|				}
  654|    814|				ma=(uint32_t)len;
  655|    814|			}
  656|  5.40k|			tv->count=ma;
  657|  5.40k|			setByteArray(&tv->value,mb,ma,1);
  658|  5.40k|		}
  659|  8.92k|		else
  660|  8.92k|		{
  661|  8.92k|			if (fip->field_passcount) {
  ------------------
  |  Branch (661:8): [True: 8.33k, False: 590]
  ------------------
  662|  8.33k|				if (fip->field_writecount == TIFF_VARIABLE2)
  ------------------
  |  |  315|  8.33k|#define TIFF_VARIABLE2 -3              /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (662:9): [True: 7.81k, False: 519]
  ------------------
  663|  7.81k|					tv->count = (uint32_t) va_arg(ap, uint32_t);
  664|    519|				else
  665|    519|					tv->count = (int) va_arg(ap, int);
  666|  8.33k|			} else if (fip->field_writecount == TIFF_VARIABLE
  ------------------
  |  |  313|  1.18k|#define TIFF_VARIABLE  -1              /* marker for variable length tags */
  ------------------
  |  Branch (666:15): [True: 0, False: 590]
  ------------------
  667|    590|			   || fip->field_writecount == TIFF_VARIABLE2)
  ------------------
  |  |  315|    590|#define TIFF_VARIABLE2 -3              /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (667:10): [True: 0, False: 590]
  ------------------
  668|      0|				tv->count = 1;
  669|    590|			else if (fip->field_writecount == TIFF_SPP)
  ------------------
  |  |  314|    590|#define TIFF_SPP       -2              /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (669:13): [True: 0, False: 590]
  ------------------
  670|      0|				tv->count = td->td_samplesperpixel;
  671|    590|			else
  672|    590|				tv->count = fip->field_writecount;
  673|       |
  674|  8.92k|			if (tv->count == 0) {
  ------------------
  |  Branch (674:8): [True: 1.53k, False: 7.39k]
  ------------------
  675|  1.53k|				status = 0;
  676|  1.53k|				TIFFErrorExtR(tif, module,
  677|  1.53k|					     "%s: Null count for \"%s\" (type "
  678|  1.53k|					     "%d, writecount %d, passcount %d)",
  679|  1.53k|					     tif->tif_name,
  680|  1.53k|					     fip->field_name,
  681|  1.53k|					     fip->field_type,
  682|  1.53k|					     fip->field_writecount,
  683|  1.53k|					     fip->field_passcount);
  684|  1.53k|				goto end;
  685|  1.53k|			}
  686|       |
  687|  7.39k|			tv->value = _TIFFCheckMalloc(tif, tv->count, tv_size,
  688|  7.39k|			    "custom tag binary object");
  689|  7.39k|			if (!tv->value) {
  ------------------
  |  Branch (689:8): [True: 0, False: 7.39k]
  ------------------
  690|      0|				status = 0;
  691|      0|				goto end;
  692|      0|			}
  693|       |
  694|  7.39k|			if (fip->field_tag == TIFFTAG_DOTRANGE 
  ------------------
  |  |  321|  14.7k|#define	TIFFTAG_DOTRANGE		336	/* !0% and 100% dot codes */
  ------------------
  |  Branch (694:8): [True: 9, False: 7.38k]
  ------------------
  695|  7.39k|			    && strcmp(fip->field_name,"DotRange") == 0) {
  ------------------
  |  Branch (695:11): [True: 9, False: 0]
  ------------------
  696|       |				/* TODO: This is an evil exception and should not have been
  697|       |				   handled this way ... likely best if we move it into
  698|       |				   the directory structure with an explicit field in 
  699|       |				   libtiff 4.1 and assign it a FIELD_ value */
  700|      9|				uint16_t v2[2];
  701|      9|				v2[0] = (uint16_t)va_arg(ap, int);
  702|      9|				v2[1] = (uint16_t)va_arg(ap, int);
  703|      9|				_TIFFmemcpy(tv->value, &v2, 4);
  704|      9|			}
  705|       |
  706|  7.38k|			else if (fip->field_passcount
  ------------------
  |  Branch (706:13): [True: 6.80k, False: 581]
  ------------------
  707|  7.38k|				  || fip->field_writecount == TIFF_VARIABLE
  ------------------
  |  |  313|  7.96k|#define TIFF_VARIABLE  -1              /* marker for variable length tags */
  ------------------
  |  Branch (707:10): [True: 0, False: 581]
  ------------------
  708|  7.38k|				  || fip->field_writecount == TIFF_VARIABLE2
  ------------------
  |  |  315|  7.96k|#define TIFF_VARIABLE2 -3              /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (708:10): [True: 0, False: 581]
  ------------------
  709|  7.38k|				  || fip->field_writecount == TIFF_SPP
  ------------------
  |  |  314|  7.96k|#define TIFF_SPP       -2              /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (709:10): [True: 0, False: 581]
  ------------------
  710|  7.38k|				  || tv->count > 1) {
  ------------------
  |  Branch (710:10): [True: 95, False: 486]
  ------------------
  711|       |			  /*--: Rational2Double: For Rationals tv_size is set above to 4 or 8 according to fip->set_field_type! */
  712|  6.89k|				_TIFFmemcpy(tv->value, va_arg(ap, void *),
  713|  6.89k|				    tv->count * tv_size);
  714|       |				/* Test here for too big values for LONG8, SLONG8 in ClassicTIFF and delete custom field from custom list */
  715|  6.89k|				if (!(tif->tif_flags & TIFF_BIGTIFF)) {
  ------------------
  |  |  110|  6.89k|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (715:9): [True: 6.85k, False: 43]
  ------------------
  716|  6.85k|					if (tv->info->field_type == TIFF_LONG8) {
  ------------------
  |  Branch (716:10): [True: 243, False: 6.60k]
  ------------------
  717|    243|						uint64_t *pui64 = (uint64_t *)tv->value;
  718|    606|						for (int i = 0; i < tv->count; i++) {
  ------------------
  |  Branch (718:23): [True: 563, False: 43]
  ------------------
  719|    563|							if (pui64[i] > 0xffffffffu) {
  ------------------
  |  Branch (719:12): [True: 200, False: 363]
  ------------------
  720|    200|								TIFFErrorExtR(tif, module,
  721|    200|									"%s: Bad LONG8 value %"PRIu64" at %d. array position for \"%s\" tag %d in ClassicTIFF. Tag won't be written to file",
  722|    200|									tif->tif_name, pui64[i], i, fip->field_name, tag);
  723|    200|								goto badvalueifd8long8;
  724|    200|							}
  725|    563|						}
  726|  6.60k|					} else if (tv->info->field_type == TIFF_SLONG8) {
  ------------------
  |  Branch (726:17): [True: 322, False: 6.28k]
  ------------------
  727|    322|						int64_t *pi64 = (int64_t *)tv->value;
  728|    663|						for (int i = 0; i < tv->count; i++) {
  ------------------
  |  Branch (728:23): [True: 604, False: 59]
  ------------------
  729|    604|							if (pi64[i] > 2147483647 || pi64[i] < (-2147483647 - 1)) {
  ------------------
  |  Branch (729:12): [True: 116, False: 488]
  |  Branch (729:36): [True: 147, False: 341]
  ------------------
  730|    263|								TIFFErrorExtR(tif, module,
  731|    263|									"%s: Bad SLONG8 value %"PRIi64" at %d. array position for \"%s\" tag %d in ClassicTIFF. Tag won't be written to file",
  732|    263|									tif->tif_name, pi64[i], i, fip->field_name, tag);
  733|    263|								goto badvalueifd8long8;
  734|    263|							}
  735|    604|						}
  736|    322|					}
  737|  6.85k|				}
  738|  6.89k|			} else {
  739|    486|				char *val = (char *)tv->value;
  740|    486|				assert( tv->count == 1 );
  741|       |
  742|    486|				switch (fip->field_type) {
  743|     63|				case TIFF_BYTE:
  ------------------
  |  Branch (743:5): [True: 63, False: 423]
  ------------------
  744|     63|				case TIFF_UNDEFINED:
  ------------------
  |  Branch (744:5): [True: 0, False: 486]
  ------------------
  745|     63|					{
  746|     63|						uint8_t v2 = (uint8_t)va_arg(ap, int);
  747|     63|						_TIFFmemcpy(val, &v2, tv_size);
  748|     63|					}
  749|     63|					break;
  750|      0|				case TIFF_SBYTE:
  ------------------
  |  Branch (750:5): [True: 0, False: 486]
  ------------------
  751|      0|					{
  752|      0|						int8_t v2 = (int8_t)va_arg(ap, int);
  753|      0|						_TIFFmemcpy(val, &v2, tv_size);
  754|      0|					}
  755|      0|					break;
  756|     64|				case TIFF_SHORT:
  ------------------
  |  Branch (756:5): [True: 64, False: 422]
  ------------------
  757|     64|					{
  758|     64|						uint16_t v2 = (uint16_t)va_arg(ap, int);
  759|     64|						_TIFFmemcpy(val, &v2, tv_size);
  760|     64|					}
  761|     64|					break;
  762|      0|				case TIFF_SSHORT:
  ------------------
  |  Branch (762:5): [True: 0, False: 486]
  ------------------
  763|      0|					{
  764|      0|						int16_t v2 = (int16_t)va_arg(ap, int);
  765|      0|						_TIFFmemcpy(val, &v2, tv_size);
  766|      0|					}
  767|      0|					break;
  768|     48|				case TIFF_LONG:
  ------------------
  |  Branch (768:5): [True: 48, False: 438]
  ------------------
  769|     48|				case TIFF_IFD:
  ------------------
  |  Branch (769:5): [True: 0, False: 486]
  ------------------
  770|     48|					{
  771|     48|						uint32_t v2 = va_arg(ap, uint32_t);
  772|     48|						_TIFFmemcpy(val, &v2, tv_size);
  773|     48|					}
  774|     48|					break;
  775|      0|				case TIFF_SLONG:
  ------------------
  |  Branch (775:5): [True: 0, False: 486]
  ------------------
  776|      0|					{
  777|      0|						int32_t v2 = va_arg(ap, int32_t);
  778|      0|						_TIFFmemcpy(val, &v2, tv_size);
  779|      0|					}
  780|      0|					break;
  781|      0|				case TIFF_LONG8:
  ------------------
  |  Branch (781:5): [True: 0, False: 486]
  ------------------
  782|    159|				case TIFF_IFD8:
  ------------------
  |  Branch (782:5): [True: 159, False: 327]
  ------------------
  783|    159|					{
  784|    159|						uint64_t v2 = va_arg(ap, uint64_t);
  785|    159|						_TIFFmemcpy(val, &v2, tv_size);
  786|       |						/* Test here for too big values for ClassicTIFF and delete custom field from custom list */
  787|    159|						if (!(tif->tif_flags & TIFF_BIGTIFF) && (v2 > 0xffffffffu)) {
  ------------------
  |  |  110|    159|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (787:11): [True: 158, False: 1]
  |  Branch (787:47): [True: 92, False: 66]
  ------------------
  788|     92|							TIFFErrorExtR(tif, module,
  789|     92|								"%s: Bad LONG8 or IFD8 value %"PRIu64" for \"%s\" tag %d in ClassicTIFF. Tag won't be written to file",
  790|     92|								tif->tif_name, v2, fip->field_name, tag);
  791|     92|							goto badvalueifd8long8;
  792|     92|						}
  793|    159|					}
  794|     67|					break;
  795|     67|				case TIFF_SLONG8:
  ------------------
  |  Branch (795:5): [True: 0, False: 486]
  ------------------
  796|      0|					{
  797|      0|						int64_t v2 = va_arg(ap, int64_t);
  798|      0|						_TIFFmemcpy(val, &v2, tv_size);
  799|       |						/* Test here for too big values for ClassicTIFF and delete custom field from custom list */
  800|      0|						if (!(tif->tif_flags & TIFF_BIGTIFF) && ((v2 > 2147483647) || (v2 < (-2147483647 - 1)))) {
  ------------------
  |  |  110|      0|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (800:11): [True: 0, False: 0]
  |  Branch (800:48): [True: 0, False: 0]
  |  Branch (800:69): [True: 0, False: 0]
  ------------------
  801|      0|							TIFFErrorExtR(tif, module,
  802|      0|								"%s: Bad SLONG8 value %"PRIi64" for \"%s\" tag %d in ClassicTIFF. Tag won't be written to file",
  803|      0|								tif->tif_name, v2, fip->field_name, tag);
  804|      0|								goto badvalueifd8long8;
  805|      0|						}
  806|      0|					}
  807|      0|					break;
  808|     99|				case TIFF_RATIONAL:
  ------------------
  |  Branch (808:5): [True: 99, False: 387]
  ------------------
  809|    110|				case TIFF_SRATIONAL:
  ------------------
  |  Branch (809:5): [True: 11, False: 475]
  ------------------
  810|       |					/*-- Rational2Double: For Rationals tv_size is set above to 4 or 8 according to fip->set_field_type! */
  811|    110|					{
  812|    110|						if (tv_size == 8) {
  ------------------
  |  Branch (812:11): [True: 0, False: 110]
  ------------------
  813|      0|							double v2 = va_arg(ap, double);
  814|      0|							_TIFFmemcpy(val, &v2, tv_size);
  815|    110|						} else {
  816|       |							/*-- default should be tv_size == 4 */
  817|    110|							float v3 = (float)va_arg(ap, double);
  818|    110|							_TIFFmemcpy(val, &v3, tv_size);
  819|       |							/*-- ToDo: After Testing, this should be removed and tv_size==4 should be set as default. */
  820|    110|							if (tv_size != 4) {
  ------------------
  |  Branch (820:12): [True: 0, False: 110]
  ------------------
  821|      0|								TIFFErrorExtR(tif, module, "Rational2Double: .set_field_type in not 4 but %d", tv_size); 
  822|      0|							}
  823|    110|						}
  824|    110|					}
  825|    110|					break;
  826|     13|				case TIFF_FLOAT:
  ------------------
  |  Branch (826:5): [True: 13, False: 473]
  ------------------
  827|     13|					{
  828|     13|						float v2 = _TIFFClampDoubleToFloat(va_arg(ap, double));
  829|     13|						_TIFFmemcpy(val, &v2, tv_size);
  830|     13|					}
  831|     13|					break;
  832|     29|				case TIFF_DOUBLE:
  ------------------
  |  Branch (832:5): [True: 29, False: 457]
  ------------------
  833|     29|					{
  834|     29|						double v2 = va_arg(ap, double);
  835|     29|						_TIFFmemcpy(val, &v2, tv_size);
  836|     29|					}
  837|     29|					break;
  838|      0|				default:
  ------------------
  |  Branch (838:5): [True: 0, False: 486]
  ------------------
  839|      0|					_TIFFmemset(val, 0, tv_size);
  840|      0|					status = 0;
  841|      0|					break;
  842|    486|				}
  843|    486|			}
  844|  7.39k|		}
  845|  14.3k|	}
  846|   178k|	}
  847|   176k|	if (status) {
  ------------------
  |  Branch (847:6): [True: 176k, False: 22]
  ------------------
  848|   176k|		const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
  849|   176k|		if (fip2)                
  ------------------
  |  Branch (849:7): [True: 176k, False: 0]
  ------------------
  850|   176k|			TIFFSetFieldBit(tif, fip2->field_bit);
  ------------------
  |  |  199|   176k|#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  197|   176k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  196|   176k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  851|   176k|		tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |   94|   176k|	#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
  852|   176k|	}
  853|       |
  854|   177k|end:
  855|   177k|	va_end(ap);
  856|   177k|	return (status);
  857|    221|badvalue:
  858|    221|        {
  859|    221|		const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
  860|    221|		TIFFErrorExtR(tif, module,
  861|    221|		     "%s: Bad value %"PRIu32" for \"%s\" tag",
  862|    221|		     tif->tif_name, v,
  863|    221|		     fip2 ? fip2->field_name : "Unknown");
  ------------------
  |  Branch (863:8): [True: 221, False: 0]
  ------------------
  864|    221|		va_end(ap);
  865|    221|        }
  866|    221|	return (0);
  867|      4|badvalue32:
  868|      4|        {
  869|      4|		const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
  870|      4|		TIFFErrorExtR(tif, module,
  871|      4|		     "%s: Bad value %"PRIu32" for \"%s\" tag",
  872|      4|		     tif->tif_name, v32,
  873|      4|		     fip2 ? fip2->field_name : "Unknown");
  ------------------
  |  Branch (873:8): [True: 4, False: 0]
  ------------------
  874|      4|		va_end(ap);
  875|      4|        }
  876|      4|	return (0);
  877|     58|badvaluedouble:
  878|     58|        {
  879|     58|        const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
  880|     58|        TIFFErrorExtR(tif, module,
  881|     58|             "%s: Bad value %f for \"%s\" tag",
  882|     58|             tif->tif_name, dblval,
  883|     58|             fip2 ? fip2->field_name : "Unknown");
  ------------------
  |  Branch (883:14): [True: 58, False: 0]
  ------------------
  884|     58|        va_end(ap);
  885|     58|        }
  886|     58|    return (0);
  887|    555|badvalueifd8long8:
  888|    555|		{
  889|       |			/* Error message issued already above. */
  890|    555|			TIFFTagValue *tv2 = NULL;
  891|    555|			int iCustom2, iC2;
  892|       |			/* Find the existing entry for this custom value. */
  893|  1.55k|			for (iCustom2 = 0; iCustom2 < td->td_customValueCount; iCustom2++) {
  ------------------
  |  Branch (893:23): [True: 1.55k, False: 0]
  ------------------
  894|  1.55k|				if (td->td_customValues[iCustom2].info->field_tag == tag) {
  ------------------
  |  Branch (894:9): [True: 555, False: 996]
  ------------------
  895|    555|					tv2 = td->td_customValues + (iCustom2);
  896|    555|					break;
  897|    555|				}
  898|  1.55k|			}
  899|    555|			if (tv2 != NULL) {
  ------------------
  |  Branch (899:8): [True: 555, False: 0]
  ------------------
  900|       |				/* Remove custom field from custom list */
  901|    555|				if (tv2->value != NULL) {
  ------------------
  |  Branch (901:9): [True: 555, False: 0]
  ------------------
  902|    555|					_TIFFfree(tv2->value);
  903|    555|					tv2->value = NULL;
  904|    555|				}
  905|       |				/* Shorten list and close gap in customValues list.
  906|       |				 * Re-allocation of td_customValues not necessary here. */
  907|    555|				td->td_customValueCount--;
  908|    555|				for (iC2 = iCustom2; iC2 < td->td_customValueCount; iC2++) {
  ------------------
  |  Branch (908:26): [True: 0, False: 555]
  ------------------
  909|      0|					td->td_customValues[iC2] = td->td_customValues[iC2+1];
  910|      0|				}
  911|    555|			} else {
  912|      0|				assert(0);
  913|      0|			}
  914|    555|			va_end(ap);
  915|    555|		}
  916|      0|	return (0);
  917|    555|} /*-- _TIFFVSetField() --*/
tif_dir.c:setExtraSamples:
   90|    265|{
   91|       |/* XXX: Unassociated alpha data == 999 is a known Corel Draw bug, see below */
   92|    265|#define EXTRASAMPLE_COREL_UNASSALPHA 999 
   93|       |
   94|    265|	uint16_t* va;
   95|    265|	uint32_t i;
   96|    265|        TIFFDirectory* td = &tif->tif_dir;
   97|    265|        static const char module[] = "setExtraSamples";
   98|       |
   99|    265|	*v = (uint16_t) va_arg(ap, uint16_vap);
  100|    265|	if ((uint16_t) *v > td->td_samplesperpixel)
  ------------------
  |  Branch (100:6): [True: 24, False: 241]
  ------------------
  101|     24|		return 0;
  102|    241|	va = va_arg(ap, uint16_t*);
  103|    241|	if (*v > 0 && va == NULL)		/* typically missing param */
  ------------------
  |  Branch (103:6): [True: 233, False: 8]
  |  Branch (103:16): [True: 0, False: 233]
  ------------------
  104|      0|		return 0;
  105|    532|	for (i = 0; i < *v; i++) {
  ------------------
  |  Branch (105:14): [True: 323, False: 209]
  ------------------
  106|    323|		if (va[i] > EXTRASAMPLE_UNASSALPHA) {
  ------------------
  |  |  326|    323|#define	    EXTRASAMPLE_UNASSALPHA	2	/* !unassociated alpha data */
  ------------------
  |  Branch (106:7): [True: 33, False: 290]
  ------------------
  107|       |			/*
  108|       |			 * XXX: Corel Draw is known to produce incorrect
  109|       |			 * ExtraSamples tags which must be patched here if we
  110|       |			 * want to be able to open some of the damaged TIFF
  111|       |			 * files: 
  112|       |			 */
  113|     33|			if (va[i] == EXTRASAMPLE_COREL_UNASSALPHA)
  ------------------
  |  |   92|     33|#define EXTRASAMPLE_COREL_UNASSALPHA 999 
  ------------------
  |  Branch (113:8): [True: 1, False: 32]
  ------------------
  114|      1|				va[i] = EXTRASAMPLE_UNASSALPHA;
  ------------------
  |  |  326|      1|#define	    EXTRASAMPLE_UNASSALPHA	2	/* !unassociated alpha data */
  ------------------
  115|     32|			else
  116|     32|				return 0;
  117|     33|		}
  118|    323|	}
  119|       |
  120|    209|        if ( td->td_transferfunction[0] != NULL && (td->td_samplesperpixel - *v > 1) &&
  ------------------
  |  Branch (120:14): [True: 0, False: 209]
  |  Branch (120:52): [True: 0, False: 0]
  ------------------
  121|    209|                !(td->td_samplesperpixel - td->td_extrasamples > 1))
  ------------------
  |  Branch (121:17): [True: 0, False: 0]
  ------------------
  122|      0|        {
  123|      0|                TIFFWarningExtR(tif,module,
  124|      0|                    "ExtraSamples tag value is changing, "
  125|      0|                    "but TransferFunction was read with a different value. Canceling it");
  126|      0|                TIFFClrFieldBit(tif,FIELD_TRANSFERFUNCTION);
  ------------------
  |  |  200|      0|#define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  197|      0|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  196|      0|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  127|      0|                _TIFFfree(td->td_transferfunction[0]);
  128|      0|                td->td_transferfunction[0] = NULL;
  129|      0|        }
  130|       |
  131|    209|	td->td_extrasamples = (uint16_t) *v;
  132|    209|	_TIFFsetShortArray(&td->td_sampleinfo, va, td->td_extrasamples);
  133|    209|	return 1;
  134|       |
  135|    241|#undef EXTRASAMPLE_COREL_UNASSALPHA
  136|    241|}
tif_dir.c:_TIFFsetLong8Array:
   66|     24|    { setByteArray((void**) lpp, lp, n, sizeof (uint64_t)); }
tif_dir.c:countInkNamesString:
  144|     73|{
  145|     73|	uint16_t i = 0;
  146|     73|	const char *ep = s + slen;
  147|     73|	const char *cp = s;
  148|       |
  149|     73|	if (slen > 0) {
  ------------------
  |  Branch (149:6): [True: 53, False: 20]
  ------------------
  150|    999|		do {
  151|  2.31k|			for (; cp < ep && *cp != '\0'; cp++) {}
  ------------------
  |  Branch (151:11): [True: 2.31k, False: 0]
  |  Branch (151:22): [True: 1.32k, False: 999]
  ------------------
  152|    999|			if (cp >= ep)
  ------------------
  |  Branch (152:8): [True: 0, False: 999]
  ------------------
  153|      0|				goto bad;
  154|    999|			cp++;				/* skip \0 */
  155|    999|			i++;
  156|    999|		} while (cp < ep);
  ------------------
  |  Branch (156:12): [True: 946, False: 53]
  ------------------
  157|     53|		return (i);
  158|     53|	}
  159|     20|bad:
  160|     20|	TIFFErrorExtR(tif, "TIFFSetField",
  161|     20|		"%s: Invalid InkNames value; no NUL at given buffer end location %"PRIu32", after %"PRIu16" ink",
  162|     20|		tif->tif_name, slen, i);
  163|     20|	return (0);
  164|     73|}
tif_dir.c:_TIFFsetNString:
   60|     53|    { setByteArray((void**) cpp, cp, n, 1); }
tif_dir.c:_TIFFVGetField:
 1028|   166k|{
 1029|   166k|	TIFFDirectory* td = &tif->tif_dir;
 1030|   166k|	int ret_val = 1;
 1031|   166k|	uint32_t standard_tag = tag;
 1032|   166k|	const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  312|   166k|#define TIFF_ANY       TIFF_NOTYPE     /* for field descriptor searching */
  ------------------
 1033|   166k|	if( fip == NULL ) /* cannot happen since TIFFGetField() already checks it */
  ------------------
  |  Branch (1033:6): [True: 0, False: 166k]
  ------------------
 1034|      0|	    return 0;
 1035|       |
 1036|       |	/*
 1037|       |	 * We want to force the custom code to be used for custom
 1038|       |	 * fields even if the tag happens to match a well known 
 1039|       |	 * one - important for reinterpreted handling of standard
 1040|       |	 * tag values in custom directories (i.e. EXIF) 
 1041|       |	 */
 1042|   166k|	if (fip->field_bit == FIELD_CUSTOM) {
  ------------------
  |  |  317|   166k|#define FIELD_CUSTOM    65
  ------------------
  |  Branch (1042:6): [True: 737, False: 165k]
  ------------------
 1043|    737|		standard_tag = 0;
 1044|    737|	}
 1045|       |
 1046|   166k|	switch (standard_tag) {
 1047|      0|		case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  164|      0|#define	TIFFTAG_SUBFILETYPE		254	/* subfile data descriptor */
  ------------------
  |  Branch (1047:3): [True: 0, False: 166k]
  ------------------
 1048|      0|			*va_arg(ap, uint32_t*) = td->td_subfiletype;
 1049|      0|			break;
 1050|  37.6k|		case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  172|  37.6k|#define	TIFFTAG_IMAGEWIDTH		256	/* image width in pixels */
  ------------------
  |  Branch (1050:3): [True: 37.6k, False: 128k]
  ------------------
 1051|  37.6k|			*va_arg(ap, uint32_t*) = td->td_imagewidth;
 1052|  37.6k|			break;
 1053|  25.2k|		case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  173|  25.2k|#define	TIFFTAG_IMAGELENGTH		257	/* image height in pixels */
  ------------------
  |  Branch (1053:3): [True: 25.2k, False: 141k]
  ------------------
 1054|  25.2k|			*va_arg(ap, uint32_t*) = td->td_imagelength;
 1055|  25.2k|			break;
 1056|  7.25k|		case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  174|  7.25k|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
  |  Branch (1056:3): [True: 7.25k, False: 159k]
  ------------------
 1057|  7.25k|			*va_arg(ap, uint16_t*) = td->td_bitspersample;
 1058|  7.25k|			break;
 1059|  19.4k|		case TIFFTAG_COMPRESSION:
  ------------------
  |  |  175|  19.4k|#define	TIFFTAG_COMPRESSION		259	/* data compression technique */
  ------------------
  |  Branch (1059:3): [True: 19.4k, False: 146k]
  ------------------
 1060|  19.4k|			*va_arg(ap, uint16_t*) = td->td_compression;
 1061|  19.4k|			break;
 1062|  18.3k|		case TIFFTAG_PHOTOMETRIC:
  ------------------
  |  |  214|  18.3k|#define	TIFFTAG_PHOTOMETRIC		262	/* photometric interpretation */
  ------------------
  |  Branch (1062:3): [True: 18.3k, False: 147k]
  ------------------
 1063|  18.3k|			*va_arg(ap, uint16_t*) = td->td_photometric;
 1064|  18.3k|			break;
 1065|      0|		case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  228|      0|#define	TIFFTAG_THRESHHOLDING		263	/* +thresholding used on data */
  ------------------
  |  Branch (1065:3): [True: 0, False: 166k]
  ------------------
 1066|      0|			*va_arg(ap, uint16_t*) = td->td_threshholding;
 1067|      0|			break;
 1068|      0|		case TIFFTAG_FILLORDER:
  ------------------
  |  |  234|      0|#define	TIFFTAG_FILLORDER		266	/* data order within a byte */
  ------------------
  |  Branch (1068:3): [True: 0, False: 166k]
  ------------------
 1069|      0|			*va_arg(ap, uint16_t*) = td->td_fillorder;
 1070|      0|			break;
 1071|    258|		case TIFFTAG_ORIENTATION:
  ------------------
  |  |  242|    258|#define	TIFFTAG_ORIENTATION		274	/* +image orientation */
  ------------------
  |  Branch (1071:3): [True: 258, False: 166k]
  ------------------
 1072|    258|			*va_arg(ap, uint16_t*) = td->td_orientation;
 1073|    258|			break;
 1074|  5.01k|		case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  251|  5.01k|#define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
  ------------------
  |  Branch (1074:3): [True: 5.01k, False: 161k]
  ------------------
 1075|  5.01k|			*va_arg(ap, uint16_t*) = td->td_samplesperpixel;
 1076|  5.01k|			break;
 1077|      0|		case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  252|      0|#define	TIFFTAG_ROWSPERSTRIP		278	/* rows per strip of data */
  ------------------
  |  Branch (1077:3): [True: 0, False: 166k]
  ------------------
 1078|      0|			*va_arg(ap, uint32_t*) = td->td_rowsperstrip;
 1079|      0|			break;
 1080|      0|		case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  254|      0|#define	TIFFTAG_MINSAMPLEVALUE		280	/* +minimum sample value */
  ------------------
  |  Branch (1080:3): [True: 0, False: 166k]
  ------------------
 1081|      0|			*va_arg(ap, uint16_t*) = td->td_minsamplevalue;
 1082|      0|			break;
 1083|      0|		case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  255|      0|#define	TIFFTAG_MAXSAMPLEVALUE		281	/* +maximum sample value */
  ------------------
  |  Branch (1083:3): [True: 0, False: 166k]
  ------------------
 1084|      0|			*va_arg(ap, uint16_t*) = td->td_maxsamplevalue;
 1085|      0|			break;
 1086|      0|		case TIFFTAG_SMINSAMPLEVALUE:
  ------------------
  |  |  334|      0|#define	TIFFTAG_SMINSAMPLEVALUE		340	/* !variable MinSampleValue */
  ------------------
  |  Branch (1086:3): [True: 0, False: 166k]
  ------------------
 1087|      0|			if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  113|      0|        #define TIFF_PERSAMPLE  0x400000U /* get/set per sample tags as arrays */
  ------------------
  |  Branch (1087:8): [True: 0, False: 0]
  ------------------
 1088|      0|				*va_arg(ap, double**) = td->td_sminsamplevalue;
 1089|      0|			else
 1090|      0|			{
 1091|       |				/* libtiff historically treats this as a single value. */
 1092|      0|				uint16_t i;
 1093|      0|				double v = td->td_sminsamplevalue[0];
 1094|      0|				for (i=1; i < td->td_samplesperpixel; ++i)
  ------------------
  |  Branch (1094:15): [True: 0, False: 0]
  ------------------
 1095|      0|					if( td->td_sminsamplevalue[i] < v )
  ------------------
  |  Branch (1095:10): [True: 0, False: 0]
  ------------------
 1096|      0|						v = td->td_sminsamplevalue[i];
 1097|      0|				*va_arg(ap, double*) = v;
 1098|      0|			}
 1099|      0|			break;
 1100|      0|		case TIFFTAG_SMAXSAMPLEVALUE:
  ------------------
  |  |  335|      0|#define	TIFFTAG_SMAXSAMPLEVALUE		341	/* !variable MaxSampleValue */
  ------------------
  |  Branch (1100:3): [True: 0, False: 166k]
  ------------------
 1101|      0|			if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  113|      0|        #define TIFF_PERSAMPLE  0x400000U /* get/set per sample tags as arrays */
  ------------------
  |  Branch (1101:8): [True: 0, False: 0]
  ------------------
 1102|      0|				*va_arg(ap, double**) = td->td_smaxsamplevalue;
 1103|      0|			else
 1104|      0|			{
 1105|       |				/* libtiff historically treats this as a single value. */
 1106|      0|				uint16_t i;
 1107|      0|				double v = td->td_smaxsamplevalue[0];
 1108|      0|				for (i=1; i < td->td_samplesperpixel; ++i)
  ------------------
  |  Branch (1108:15): [True: 0, False: 0]
  ------------------
 1109|      0|					if( td->td_smaxsamplevalue[i] > v )
  ------------------
  |  Branch (1109:10): [True: 0, False: 0]
  ------------------
 1110|      0|						v = td->td_smaxsamplevalue[i];
 1111|      0|				*va_arg(ap, double*) = v;
 1112|      0|			}
 1113|      0|			break;
 1114|      0|		case TIFFTAG_XRESOLUTION:
  ------------------
  |  |  256|      0|#define	TIFFTAG_XRESOLUTION		282	/* pixels/resolution in x */
  ------------------
  |  Branch (1114:3): [True: 0, False: 166k]
  ------------------
 1115|      0|			*va_arg(ap, float*) = td->td_xresolution;
 1116|      0|			break;
 1117|      0|		case TIFFTAG_YRESOLUTION:
  ------------------
  |  |  257|      0|#define	TIFFTAG_YRESOLUTION		283	/* pixels/resolution in y */
  ------------------
  |  Branch (1117:3): [True: 0, False: 166k]
  ------------------
 1118|      0|			*va_arg(ap, float*) = td->td_yresolution;
 1119|      0|			break;
 1120|  12.0k|		case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  258|  12.0k|#define	TIFFTAG_PLANARCONFIG		284	/* storage organization */
  ------------------
  |  Branch (1120:3): [True: 12.0k, False: 154k]
  ------------------
 1121|  12.0k|			*va_arg(ap, uint16_t*) = td->td_planarconfig;
 1122|  12.0k|			break;
 1123|      0|		case TIFFTAG_XPOSITION:
  ------------------
  |  |  262|      0|#define	TIFFTAG_XPOSITION		286	/* x page offset of image lhs */
  ------------------
  |  Branch (1123:3): [True: 0, False: 166k]
  ------------------
 1124|      0|			*va_arg(ap, float*) = td->td_xposition;
 1125|      0|			break;
 1126|      0|		case TIFFTAG_YPOSITION:
  ------------------
  |  |  263|      0|#define	TIFFTAG_YPOSITION		287	/* y page offset of image lhs */
  ------------------
  |  Branch (1126:3): [True: 0, False: 166k]
  ------------------
 1127|      0|			*va_arg(ap, float*) = td->td_yposition;
 1128|      0|			break;
 1129|      0|		case TIFFTAG_RESOLUTIONUNIT:
  ------------------
  |  |  281|      0|#define	TIFFTAG_RESOLUTIONUNIT		296	/* units of resolutions */
  ------------------
  |  Branch (1129:3): [True: 0, False: 166k]
  ------------------
 1130|      0|			*va_arg(ap, uint16_t*) = td->td_resolutionunit;
 1131|      0|			break;
 1132|      0|		case TIFFTAG_PAGENUMBER:
  ------------------
  |  |  285|      0|#define	TIFFTAG_PAGENUMBER		297	/* page numbers of multi-page */
  ------------------
  |  Branch (1132:3): [True: 0, False: 166k]
  ------------------
 1133|      0|			*va_arg(ap, uint16_t*) = td->td_pagenumber[0];
 1134|      0|			*va_arg(ap, uint16_t*) = td->td_pagenumber[1];
 1135|      0|			break;
 1136|      0|		case TIFFTAG_HALFTONEHINTS:
  ------------------
  |  |  304|      0|#define	TIFFTAG_HALFTONEHINTS		321	/* !highlight+shadow info */
  ------------------
  |  Branch (1136:3): [True: 0, False: 166k]
  ------------------
 1137|      0|			*va_arg(ap, uint16_t*) = td->td_halftonehints[0];
 1138|      0|			*va_arg(ap, uint16_t*) = td->td_halftonehints[1];
 1139|      0|			break;
 1140|     54|		case TIFFTAG_COLORMAP:
  ------------------
  |  |  303|     54|#define	TIFFTAG_COLORMAP		320	/* RGB map for palette image */
  ------------------
  |  Branch (1140:3): [True: 54, False: 166k]
  ------------------
 1141|     54|			*va_arg(ap, const uint16_t**) = td->td_colormap[0];
 1142|     54|			*va_arg(ap, const uint16_t**) = td->td_colormap[1];
 1143|     54|			*va_arg(ap, const uint16_t**) = td->td_colormap[2];
 1144|     54|			break;
 1145|      0|		case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  241|      0|#define	TIFFTAG_STRIPOFFSETS		273	/* offsets to data strips */
  ------------------
  |  Branch (1145:3): [True: 0, False: 166k]
  ------------------
 1146|      0|		case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  307|      0|#define TIFFTAG_TILEOFFSETS		324	/* !offsets to data tiles */
  ------------------
  |  Branch (1146:3): [True: 0, False: 166k]
  ------------------
 1147|      0|			_TIFFFillStriles( tif );
 1148|      0|			*va_arg(ap, const uint64_t**) = td->td_stripoffset_p;
 1149|      0|			if( td->td_stripoffset_p == NULL )
  ------------------
  |  Branch (1149:8): [True: 0, False: 0]
  ------------------
 1150|      0|				ret_val = 0;
 1151|      0|			break;
 1152|      0|		case TIFFTAG_STRIPBYTECOUNTS:
  ------------------
  |  |  253|      0|#define	TIFFTAG_STRIPBYTECOUNTS		279	/* bytes counts for strips */
  ------------------
  |  Branch (1152:3): [True: 0, False: 166k]
  ------------------
 1153|      0|		case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  308|      0|#define TIFFTAG_TILEBYTECOUNTS		325	/* !byte counts for tiles */
  ------------------
  |  Branch (1153:3): [True: 0, False: 166k]
  ------------------
 1154|      0|			_TIFFFillStriles( tif );
 1155|      0|			*va_arg(ap, const uint64_t**) = td->td_stripbytecount_p;
 1156|      0|			if( td->td_stripbytecount_p == NULL )
  ------------------
  |  Branch (1156:8): [True: 0, False: 0]
  ------------------
 1157|      0|				ret_val = 0;
 1158|      0|			break;
 1159|      0|		case TIFFTAG_MATTEING:
  ------------------
  |  |  404|      0|#define	TIFFTAG_MATTEING		32995	/* $use ExtraSamples */
  ------------------
  |  Branch (1159:3): [True: 0, False: 166k]
  ------------------
 1160|      0|			*va_arg(ap, uint16_t*) =
 1161|      0|			    (td->td_extrasamples == 1 &&
  ------------------
  |  Branch (1161:9): [True: 0, False: 0]
  ------------------
 1162|      0|			    td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
  ------------------
  |  |  325|      0|#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
  ------------------
  |  Branch (1162:8): [True: 0, False: 0]
  ------------------
 1163|      0|			break;
 1164|    170|		case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  323|    170|#define	TIFFTAG_EXTRASAMPLES		338	/* !info about extra samples */
  ------------------
  |  Branch (1164:3): [True: 170, False: 166k]
  ------------------
 1165|    170|			*va_arg(ap, uint16_t*) = td->td_extrasamples;
 1166|    170|			*va_arg(ap, const uint16_t**) = td->td_sampleinfo;
 1167|    170|			break;
 1168|  23.2k|		case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  305|  23.2k|#define	TIFFTAG_TILEWIDTH		322	/* !tile width in pixels */
  ------------------
  |  Branch (1168:3): [True: 23.2k, False: 143k]
  ------------------
 1169|  23.2k|			*va_arg(ap, uint32_t*) = td->td_tilewidth;
 1170|  23.2k|			break;
 1171|  11.1k|		case TIFFTAG_TILELENGTH:
  ------------------
  |  |  306|  11.1k|#define	TIFFTAG_TILELENGTH		323	/* !tile height in pixels */
  ------------------
  |  Branch (1171:3): [True: 11.1k, False: 155k]
  ------------------
 1172|  11.1k|			*va_arg(ap, uint32_t*) = td->td_tilelength;
 1173|  11.1k|			break;
 1174|      0|		case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  407|      0|#define	TIFFTAG_TILEDEPTH		32998	/* z depth/data tile */
  ------------------
  |  Branch (1174:3): [True: 0, False: 166k]
  ------------------
 1175|      0|			*va_arg(ap, uint32_t*) = td->td_tiledepth;
 1176|      0|			break;
 1177|      0|		case TIFFTAG_DATATYPE:
  ------------------
  |  |  405|      0|#define	TIFFTAG_DATATYPE		32996	/* $use SampleFormat */
  ------------------
  |  Branch (1177:3): [True: 0, False: 166k]
  ------------------
 1178|      0|			switch (td->td_sampleformat) {
  ------------------
  |  Branch (1178:12): [True: 0, False: 0]
  ------------------
 1179|      0|				case SAMPLEFORMAT_UINT:
  ------------------
  |  |  328|      0|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
  |  Branch (1179:5): [True: 0, False: 0]
  ------------------
 1180|      0|					*va_arg(ap, uint16_t*) = DATATYPE_UINT;
  ------------------
  |  |   39|      0|#define DATATYPE_UINT		2       /* !unsigned integer data */
  ------------------
 1181|      0|					break;
 1182|      0|				case SAMPLEFORMAT_INT:
  ------------------
  |  |  329|      0|#define	    SAMPLEFORMAT_INT		2	/* !signed integer data */
  ------------------
  |  Branch (1182:5): [True: 0, False: 0]
  ------------------
 1183|      0|					*va_arg(ap, uint16_t*) = DATATYPE_INT;
  ------------------
  |  |   38|      0|#define DATATYPE_INT		1       /* !signed integer data */
  ------------------
 1184|      0|					break;
 1185|      0|				case SAMPLEFORMAT_IEEEFP:
  ------------------
  |  |  330|      0|#define	    SAMPLEFORMAT_IEEEFP		3	/* !IEEE floating point data */
  ------------------
  |  Branch (1185:5): [True: 0, False: 0]
  ------------------
 1186|      0|					*va_arg(ap, uint16_t*) = DATATYPE_IEEEFP;
  ------------------
  |  |   40|      0|#define DATATYPE_IEEEFP		3       /* !IEEE floating point data */
  ------------------
 1187|      0|					break;
 1188|      0|				case SAMPLEFORMAT_VOID:
  ------------------
  |  |  331|      0|#define	    SAMPLEFORMAT_VOID		4	/* !untyped data */
  ------------------
  |  Branch (1188:5): [True: 0, False: 0]
  ------------------
 1189|      0|					*va_arg(ap, uint16_t*) = DATATYPE_VOID;
  ------------------
  |  |   37|      0|#define DATATYPE_VOID		0       /* !untyped data */
  ------------------
 1190|      0|					break;
 1191|      0|			}
 1192|      0|			break;
 1193|      0|		case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  327|      0|#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
  ------------------
  |  Branch (1193:3): [True: 0, False: 166k]
  ------------------
 1194|      0|			*va_arg(ap, uint16_t*) = td->td_sampleformat;
 1195|      0|			break;
 1196|      0|		case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  406|      0|#define	TIFFTAG_IMAGEDEPTH		32997	/* z depth of image */
  ------------------
  |  Branch (1196:3): [True: 0, False: 166k]
  ------------------
 1197|      0|			*va_arg(ap, uint32_t*) = td->td_imagedepth;
 1198|      0|			break;
 1199|      0|		case TIFFTAG_SUBIFD:
  ------------------
  |  |  315|      0|#define	TIFFTAG_SUBIFD			330	/* subimage descriptors */
  ------------------
  |  Branch (1199:3): [True: 0, False: 166k]
  ------------------
 1200|      0|			*va_arg(ap, uint16_t*) = td->td_nsubifd;
 1201|      0|			*va_arg(ap, const uint64_t**) = td->td_subifd;
 1202|      0|			break;
 1203|      0|		case TIFFTAG_YCBCRPOSITIONING:
  ------------------
  |  |  387|      0|#define	TIFFTAG_YCBCRPOSITIONING	531	/* !subsample positioning */
  ------------------
  |  Branch (1203:3): [True: 0, False: 166k]
  ------------------
 1204|      0|			*va_arg(ap, uint16_t*) = td->td_ycbcrpositioning;
 1205|      0|			break;
 1206|  5.58k|		case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  386|  5.58k|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
  |  Branch (1206:3): [True: 5.58k, False: 160k]
  ------------------
 1207|  5.58k|			*va_arg(ap, uint16_t*) = td->td_ycbcrsubsampling[0];
 1208|  5.58k|			*va_arg(ap, uint16_t*) = td->td_ycbcrsubsampling[1];
 1209|  5.58k|			break;
 1210|      0|		case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  292|      0|#define	TIFFTAG_TRANSFERFUNCTION	301	/* !colorimetry info */
  ------------------
  |  Branch (1210:3): [True: 0, False: 166k]
  ------------------
 1211|      0|			*va_arg(ap, const uint16_t**) = td->td_transferfunction[0];
 1212|      0|			if (td->td_samplesperpixel - td->td_extrasamples > 1) {
  ------------------
  |  Branch (1212:8): [True: 0, False: 0]
  ------------------
 1213|      0|				*va_arg(ap, const uint16_t**) = td->td_transferfunction[1];
 1214|      0|				*va_arg(ap, const uint16_t**) = td->td_transferfunction[2];
 1215|      0|			} else {
 1216|      0|				*va_arg(ap, const uint16_t**) = NULL;
 1217|      0|				*va_arg(ap, const uint16_t**) = NULL;
 1218|      0|			}
 1219|      0|			break;
 1220|     72|		case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  390|     72|#define	TIFFTAG_REFERENCEBLACKWHITE	532	/* !colorimetry info */
  ------------------
  |  Branch (1220:3): [True: 72, False: 166k]
  ------------------
 1221|     72|			*va_arg(ap, const float**) = td->td_refblackwhite;
 1222|     72|			break;
 1223|      0|		case TIFFTAG_INKNAMES:
  ------------------
  |  |  319|      0|#define	TIFFTAG_INKNAMES		333	/* !ascii names of inks */
  ------------------
  |  Branch (1223:3): [True: 0, False: 166k]
  ------------------
 1224|      0|			*va_arg(ap, const char**) = td->td_inknames;
 1225|      0|			break;
 1226|      0|		case TIFFTAG_NUMBEROFINKS:
  ------------------
  |  |  320|      0|#define	TIFFTAG_NUMBEROFINKS		334	/* !number of inks */
  ------------------
  |  Branch (1226:3): [True: 0, False: 166k]
  ------------------
 1227|      0|			*va_arg(ap, uint16_t *) = td->td_numberofinks;
 1228|      0|			break;
 1229|    737|		default:
  ------------------
  |  Branch (1229:3): [True: 737, False: 165k]
  ------------------
 1230|    737|			{
 1231|    737|				int i;
 1232|       |
 1233|       |				/*
 1234|       |				 * This can happen if multiple images are open
 1235|       |				 * with different codecs which have private
 1236|       |				 * tags.  The global tag information table may
 1237|       |				 * then have tags that are valid for one file
 1238|       |				 * but not the other. If the client tries to
 1239|       |				 * get a tag that is not valid for the image's
 1240|       |				 * codec then we'll arrive here.
 1241|       |				 */
 1242|    737|				if( fip->field_bit != FIELD_CUSTOM )
  ------------------
  |  |  317|    737|#define FIELD_CUSTOM    65
  ------------------
  |  Branch (1242:9): [True: 0, False: 737]
  ------------------
 1243|      0|				{
 1244|      0|					TIFFErrorExtR(tif, "_TIFFVGetField",
 1245|      0|					    "%s: Invalid %stag \"%s\" "
 1246|      0|					    "(not supported by codec)",
 1247|      0|					    tif->tif_name,
 1248|      0|					    isPseudoTag(tag) ? "pseudo-" : "",
  ------------------
  |  |  205|      0|#define isPseudoTag(t) (t > 0xffff)            /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (205:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1249|      0|					    fip->field_name);
 1250|      0|					ret_val = 0;
 1251|      0|					break;
 1252|      0|				}
 1253|       |
 1254|       |				/*
 1255|       |				 * Do we have a custom value?
 1256|       |				 */
 1257|    737|				ret_val = 0;
 1258|  2.23k|				for (i = 0; i < td->td_customValueCount; i++) {
  ------------------
  |  Branch (1258:17): [True: 1.52k, False: 709]
  ------------------
 1259|  1.52k|					TIFFTagValue *tv = td->td_customValues + i;
 1260|       |
 1261|  1.52k|					if (tv->info->field_tag != tag)
  ------------------
  |  Branch (1261:10): [True: 1.49k, False: 28]
  ------------------
 1262|  1.49k|						continue;
 1263|       |
 1264|     28|					if (fip->field_passcount) {
  ------------------
  |  Branch (1264:10): [True: 0, False: 28]
  ------------------
 1265|      0|						if (fip->field_readcount == TIFF_VARIABLE2)
  ------------------
  |  |  315|      0|#define TIFF_VARIABLE2 -3              /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (1265:11): [True: 0, False: 0]
  ------------------
 1266|      0|							*va_arg(ap, uint32_t*) = (uint32_t)tv->count;
 1267|      0|						else  /* Assume TIFF_VARIABLE */
 1268|      0|							*va_arg(ap, uint16_t*) = (uint16_t)tv->count;
 1269|      0|						*va_arg(ap, const void **) = tv->value;
 1270|      0|						ret_val = 1;
 1271|     28|					} else if (fip->field_tag == TIFFTAG_DOTRANGE
  ------------------
  |  |  321|     56|#define	TIFFTAG_DOTRANGE		336	/* !0% and 100% dot codes */
  ------------------
  |  Branch (1271:17): [True: 0, False: 28]
  ------------------
 1272|     28|						   && strcmp(fip->field_name,"DotRange") == 0) {
  ------------------
  |  Branch (1272:13): [True: 0, False: 0]
  ------------------
 1273|       |						/* TODO: This is an evil exception and should not have been
 1274|       |						   handled this way ... likely best if we move it into
 1275|       |						   the directory structure with an explicit field in 
 1276|       |						   libtiff 4.1 and assign it a FIELD_ value */
 1277|      0|						*va_arg(ap, uint16_t*) = ((uint16_t *)tv->value)[0];
 1278|      0|						*va_arg(ap, uint16_t*) = ((uint16_t *)tv->value)[1];
 1279|      0|						ret_val = 1;
 1280|     28|					} else {
 1281|     28|						if (fip->field_type == TIFF_ASCII
  ------------------
  |  Branch (1281:11): [True: 0, False: 28]
  ------------------
 1282|     28|						    || fip->field_readcount == TIFF_VARIABLE
  ------------------
  |  |  313|     56|#define TIFF_VARIABLE  -1              /* marker for variable length tags */
  ------------------
  |  Branch (1282:14): [True: 0, False: 28]
  ------------------
 1283|     28|						    || fip->field_readcount == TIFF_VARIABLE2
  ------------------
  |  |  315|     56|#define TIFF_VARIABLE2 -3              /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (1283:14): [True: 0, False: 28]
  ------------------
 1284|     28|						    || fip->field_readcount == TIFF_SPP
  ------------------
  |  |  314|     56|#define TIFF_SPP       -2              /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (1284:14): [True: 0, False: 28]
  ------------------
 1285|     28|						    || tv->count > 1) {
  ------------------
  |  Branch (1285:14): [True: 24, False: 4]
  ------------------
 1286|     24|							*va_arg(ap, void **) = tv->value;
 1287|     24|							ret_val = 1;
 1288|     24|						} else {
 1289|      4|							char *val = (char *)tv->value;
 1290|      4|							assert( tv->count == 1 );
 1291|      4|							switch (fip->field_type) {
 1292|      0|							case TIFF_BYTE:
  ------------------
  |  Branch (1292:8): [True: 0, False: 4]
  ------------------
 1293|      0|							case TIFF_UNDEFINED:
  ------------------
  |  Branch (1293:8): [True: 0, False: 4]
  ------------------
 1294|      0|								*va_arg(ap, uint8_t*) =
 1295|      0|									*(uint8_t *)val;
 1296|      0|								ret_val = 1;
 1297|      0|								break;
 1298|      0|							case TIFF_SBYTE:
  ------------------
  |  Branch (1298:8): [True: 0, False: 4]
  ------------------
 1299|      0|								*va_arg(ap, int8_t*) =
 1300|      0|									*(int8_t *)val;
 1301|      0|								ret_val = 1;
 1302|      0|								break;
 1303|      4|							case TIFF_SHORT:
  ------------------
  |  Branch (1303:8): [True: 4, False: 0]
  ------------------
 1304|      4|								*va_arg(ap, uint16_t*) =
 1305|      4|									*(uint16_t *)val;
 1306|      4|								ret_val = 1;
 1307|      4|								break;
 1308|      0|							case TIFF_SSHORT:
  ------------------
  |  Branch (1308:8): [True: 0, False: 4]
  ------------------
 1309|      0|								*va_arg(ap, int16_t*) =
 1310|      0|									*(int16_t *)val;
 1311|      0|								ret_val = 1;
 1312|      0|								break;
 1313|      0|							case TIFF_LONG:
  ------------------
  |  Branch (1313:8): [True: 0, False: 4]
  ------------------
 1314|      0|							case TIFF_IFD:
  ------------------
  |  Branch (1314:8): [True: 0, False: 4]
  ------------------
 1315|      0|								*va_arg(ap, uint32_t*) =
 1316|      0|									*(uint32_t *)val;
 1317|      0|								ret_val = 1;
 1318|      0|								break;
 1319|      0|							case TIFF_SLONG:
  ------------------
  |  Branch (1319:8): [True: 0, False: 4]
  ------------------
 1320|      0|								*va_arg(ap, int32_t*) =
 1321|      0|									*(int32_t *)val;
 1322|      0|								ret_val = 1;
 1323|      0|								break;
 1324|      0|							case TIFF_LONG8:
  ------------------
  |  Branch (1324:8): [True: 0, False: 4]
  ------------------
 1325|      0|							case TIFF_IFD8:
  ------------------
  |  Branch (1325:8): [True: 0, False: 4]
  ------------------
 1326|      0|								*va_arg(ap, uint64_t*) =
 1327|      0|									*(uint64_t *)val;
 1328|      0|								ret_val = 1;
 1329|      0|								break;
 1330|      0|							case TIFF_SLONG8:
  ------------------
  |  Branch (1330:8): [True: 0, False: 4]
  ------------------
 1331|      0|								*va_arg(ap, int64_t*) =
 1332|      0|									*(int64_t *)val;
 1333|      0|								ret_val = 1;
 1334|      0|								break;
 1335|      0|							case TIFF_RATIONAL:
  ------------------
  |  Branch (1335:8): [True: 0, False: 4]
  ------------------
 1336|      0|							case TIFF_SRATIONAL:
  ------------------
  |  Branch (1336:8): [True: 0, False: 4]
  ------------------
 1337|      0|								{
 1338|       |									/*-- Rational2Double: For Rationals evaluate "set_field_type" to determine internal storage size and return value size. */
 1339|      0|									int tv_size = TIFFFieldSetGetSize(fip);
 1340|      0|									if (tv_size == 8) {
  ------------------
  |  Branch (1340:14): [True: 0, False: 0]
  ------------------
 1341|      0|										*va_arg(ap, double*) = *(double *)val;
 1342|      0|										ret_val = 1;
 1343|      0|									} else {
 1344|       |										/*-- default should be tv_size == 4  */
 1345|      0|										*va_arg(ap, float*) = *(float *)val;
 1346|      0|										ret_val = 1;
 1347|       |										/*-- ToDo: After Testing, this should be removed and tv_size==4 should be set as default. */
 1348|      0|										if (tv_size != 4) {
  ------------------
  |  Branch (1348:15): [True: 0, False: 0]
  ------------------
 1349|      0|											TIFFErrorExtR(tif, "_TIFFVGetField", "Rational2Double: .set_field_type in not 4 but %d", tv_size); 
 1350|      0|										}
 1351|      0|									}
 1352|      0|								}
 1353|      0|								break;
 1354|      0|							case TIFF_FLOAT:
  ------------------
  |  Branch (1354:8): [True: 0, False: 4]
  ------------------
 1355|      0|								*va_arg(ap, float*) =
 1356|      0|									*(float *)val;
 1357|      0|								ret_val = 1;
 1358|      0|								break;
 1359|      0|							case TIFF_DOUBLE:
  ------------------
  |  Branch (1359:8): [True: 0, False: 4]
  ------------------
 1360|      0|								*va_arg(ap, double*) =
 1361|      0|									*(double *)val;
 1362|      0|								ret_val = 1;
 1363|      0|								break;
 1364|      0|							default:
  ------------------
  |  Branch (1364:8): [True: 0, False: 4]
  ------------------
 1365|      0|								ret_val = 0;
 1366|      0|								break;
 1367|      4|							}
 1368|      4|						}
 1369|     28|					}
 1370|     28|					break;
 1371|     28|				}
 1372|    737|			}
 1373|   166k|	}
 1374|   166k|	return(ret_val);
 1375|   166k|}

_TIFFGetFields:
  398|  23.1k|{
  399|  23.1k|	return(&tiffFieldArray);
  400|  23.1k|}
_TIFFSetupFields:
  416|  23.1k|{
  417|  23.1k|	if (tif->tif_fields && tif->tif_nfields > 0) {
  ------------------
  |  Branch (417:6): [True: 0, False: 23.1k]
  |  Branch (417:25): [True: 0, False: 0]
  ------------------
  418|      0|		uint32_t i;
  419|       |
  420|      0|		for (i = 0; i < tif->tif_nfields; i++) {
  ------------------
  |  Branch (420:15): [True: 0, False: 0]
  ------------------
  421|      0|			TIFFField *fld = tif->tif_fields[i];
  422|      0|			if (fld->field_name != NULL) {
  ------------------
  |  Branch (422:8): [True: 0, False: 0]
  ------------------
  423|      0|				if (fld->field_bit == FIELD_CUSTOM &&
  ------------------
  |  |  317|      0|#define FIELD_CUSTOM    65
  ------------------
  |  Branch (423:9): [True: 0, False: 0]
  ------------------
  424|      0|					TIFFFieldIsAnonymous(fld)) {
  ------------------
  |  Branch (424:6): [True: 0, False: 0]
  ------------------
  425|      0|					_TIFFfree(fld->field_name);
  426|       |					/* caution: tif_fields[i] must not be the beginning of a fields-array. 
  427|       |					 *          Otherwise the following tags are also freed with the first free().
  428|       |					 */
  429|      0|					_TIFFfree(fld);
  430|      0|				}
  431|      0|			}
  432|      0|		}
  433|       |
  434|      0|		_TIFFfree(tif->tif_fields);
  435|      0|		tif->tif_fields = NULL;
  436|      0|		tif->tif_nfields = 0;
  437|      0|	}
  438|  23.1k|	if (!_TIFFMergeFields(tif, fieldarray->fields, fieldarray->count)) {
  ------------------
  |  Branch (438:6): [True: 0, False: 23.1k]
  ------------------
  439|      0|		TIFFErrorExtR(tif, "_TIFFSetupFields",
  440|      0|			     "Setting up field info failed");
  441|      0|	}
  442|  23.1k|}
_TIFFMergeFields:
  473|   194k|{
  474|   194k|	static const char module[] = "_TIFFMergeFields";
  475|   194k|	static const char reason[] = "for fields array";
  476|       |	/* TIFFField** tp; */
  477|   194k|	uint32_t i;
  478|       |
  479|   194k|        tif->tif_foundfield = NULL;
  480|       |
  481|   194k|	if (tif->tif_fields && tif->tif_nfields > 0) {
  ------------------
  |  Branch (481:6): [True: 171k, False: 23.1k]
  |  Branch (481:25): [True: 171k, False: 0]
  ------------------
  482|   171k|		tif->tif_fields = (TIFFField**)
  483|   171k|			_TIFFCheckRealloc(tif, tif->tif_fields,
  484|   171k|					  (tif->tif_nfields + n),
  485|   171k|					  sizeof(TIFFField *), reason);
  486|   171k|	} else {
  487|  23.1k|		tif->tif_fields = (TIFFField **)
  488|  23.1k|			_TIFFCheckMalloc(tif, n, sizeof(TIFFField *),
  489|  23.1k|					 reason);
  490|  23.1k|	}
  491|   194k|	if (!tif->tif_fields) {
  ------------------
  |  Branch (491:6): [True: 0, False: 194k]
  ------------------
  492|      0|		TIFFErrorExtR(tif, module,
  493|      0|			     "Failed to allocate fields array");
  494|      0|		return 0;
  495|      0|	}
  496|       |
  497|       |	/* tp = tif->tif_fields + tif->tif_nfields; */
  498|  3.95M|	for (i = 0; i < n; i++) {
  ------------------
  |  Branch (498:14): [True: 3.76M, False: 194k]
  ------------------
  499|  3.76M|		const TIFFField *fip =
  500|  3.76M|			TIFFFindField(tif, info[i].field_tag, TIFF_ANY);
  ------------------
  |  |  312|  3.76M|#define TIFF_ANY       TIFF_NOTYPE     /* for field descriptor searching */
  ------------------
  501|       |
  502|       |                /* only add definitions that aren't already present */
  503|  3.76M|		if (!fip) {
  ------------------
  |  Branch (503:7): [True: 3.76M, False: 0]
  ------------------
  504|  3.76M|                        tif->tif_fields[tif->tif_nfields] = (TIFFField *) (info+i);
  505|  3.76M|                        tif->tif_nfields++;
  506|  3.76M|                }
  507|  3.76M|	}
  508|       |
  509|       |        /* Sort the field info by tag number */
  510|   194k|	qsort(tif->tif_fields, tif->tif_nfields,
  511|   194k|	      sizeof(TIFFField *), tagCompare);
  512|       |
  513|   194k|	return n;
  514|   194k|}
TIFFDataWidth:
  542|  95.4k|{
  543|  95.4k|	switch(type)
  544|  95.4k|	{
  545|  2.54k|		case 0:  /* nothing */
  ------------------
  |  Branch (545:3): [True: 2.54k, False: 92.8k]
  ------------------
  546|  28.8k|		case TIFF_BYTE:
  ------------------
  |  Branch (546:3): [True: 26.3k, False: 69.0k]
  ------------------
  547|  37.7k|		case TIFF_ASCII:
  ------------------
  |  Branch (547:3): [True: 8.86k, False: 86.5k]
  ------------------
  548|  44.6k|		case TIFF_SBYTE:
  ------------------
  |  Branch (548:3): [True: 6.85k, False: 88.5k]
  ------------------
  549|  44.9k|		case TIFF_UNDEFINED:
  ------------------
  |  Branch (549:3): [True: 372, False: 95.0k]
  ------------------
  550|  44.9k|			return 1;
  551|  28.2k|		case TIFF_SHORT:
  ------------------
  |  Branch (551:3): [True: 28.2k, False: 67.1k]
  ------------------
  552|  31.2k|		case TIFF_SSHORT:
  ------------------
  |  Branch (552:3): [True: 2.99k, False: 92.4k]
  ------------------
  553|  31.2k|			return 2;
  554|  8.13k|		case TIFF_LONG:
  ------------------
  |  Branch (554:3): [True: 8.13k, False: 87.3k]
  ------------------
  555|  9.84k|		case TIFF_SLONG:
  ------------------
  |  Branch (555:3): [True: 1.71k, False: 93.7k]
  ------------------
  556|  10.1k|		case TIFF_FLOAT:
  ------------------
  |  Branch (556:3): [True: 352, False: 95.0k]
  ------------------
  557|  10.3k|		case TIFF_IFD:
  ------------------
  |  Branch (557:3): [True: 169, False: 95.2k]
  ------------------
  558|  10.3k|			return 4;
  559|    642|		case TIFF_RATIONAL:
  ------------------
  |  Branch (559:3): [True: 642, False: 94.7k]
  ------------------
  560|  1.09k|		case TIFF_SRATIONAL:
  ------------------
  |  Branch (560:3): [True: 449, False: 94.9k]
  ------------------
  561|  1.51k|		case TIFF_DOUBLE:
  ------------------
  |  Branch (561:3): [True: 427, False: 95.0k]
  ------------------
  562|  6.40k|		case TIFF_LONG8:
  ------------------
  |  Branch (562:3): [True: 4.88k, False: 90.5k]
  ------------------
  563|  8.29k|		case TIFF_SLONG8:
  ------------------
  |  Branch (563:3): [True: 1.89k, False: 93.5k]
  ------------------
  564|  8.74k|		case TIFF_IFD8:
  ------------------
  |  Branch (564:3): [True: 452, False: 94.9k]
  ------------------
  565|  8.74k|			return 8;
  566|     52|		default:
  ------------------
  |  Branch (566:3): [True: 52, False: 95.3k]
  ------------------
  567|     52|			return 0; /* will return 0 for unknown types */
  568|  95.4k|	}
  569|  95.4k|}
TIFFFieldSetGetSize:
  580|  14.3k|{
  581|       |/*
  582|       | * TIFFSetField() and TIFFGetField() must provide the parameter accordingly to
  583|       | * the definition of "set_field_type" of the tag definition in dir_info.c.
  584|       | * This function returns the data size for that purpose.
  585|       | * 
  586|       | * Furthermore, this data size is also used for the internal storage,
  587|       | * even for TIFF_RATIONAL values for FIELD_CUSTOM, which are stored internally as 4-byte float,
  588|       | * but some of them should be stored internally as 8-byte double,
  589|       | * depending on the "set_field_type" _FLOAT_ or _DOUBLE_.
  590|       |*/
  591|  14.3k|	if (fip == NULL) return 0;
  ------------------
  |  Branch (591:6): [True: 0, False: 14.3k]
  ------------------
  592|       |
  593|  14.3k|	switch (fip->set_field_type)
  594|  14.3k|	{
  595|      0|		case TIFF_SETGET_UNDEFINED:
  ------------------
  |  Branch (595:3): [True: 0, False: 14.3k]
  ------------------
  596|    814|		case TIFF_SETGET_ASCII:
  ------------------
  |  Branch (596:3): [True: 814, False: 13.5k]
  ------------------
  597|    814|		case TIFF_SETGET_C0_ASCII:
  ------------------
  |  Branch (597:3): [True: 0, False: 14.3k]
  ------------------
  598|    814|		case TIFF_SETGET_C16_ASCII:
  ------------------
  |  Branch (598:3): [True: 0, False: 14.3k]
  ------------------
  599|  5.40k|		case TIFF_SETGET_C32_ASCII:
  ------------------
  |  Branch (599:3): [True: 4.58k, False: 9.74k]
  ------------------
  600|  5.40k|		case TIFF_SETGET_OTHER:
  ------------------
  |  Branch (600:3): [True: 0, False: 14.3k]
  ------------------
  601|  5.40k|		    return 1;
  602|     63|		case TIFF_SETGET_UINT8:
  ------------------
  |  Branch (602:3): [True: 63, False: 14.2k]
  ------------------
  603|     63|		case TIFF_SETGET_SINT8:
  ------------------
  |  Branch (603:3): [True: 0, False: 14.3k]
  ------------------
  604|     75|		case TIFF_SETGET_C0_UINT8:
  ------------------
  |  Branch (604:3): [True: 12, False: 14.3k]
  ------------------
  605|     75|		case TIFF_SETGET_C0_SINT8:
  ------------------
  |  Branch (605:3): [True: 0, False: 14.3k]
  ------------------
  606|    122|		case TIFF_SETGET_C16_UINT8:
  ------------------
  |  Branch (606:3): [True: 47, False: 14.2k]
  ------------------
  607|    122|		case TIFF_SETGET_C16_SINT8:
  ------------------
  |  Branch (607:3): [True: 0, False: 14.3k]
  ------------------
  608|  1.96k|		case TIFF_SETGET_C32_UINT8:
  ------------------
  |  Branch (608:3): [True: 1.84k, False: 12.4k]
  ------------------
  609|  2.28k|		case TIFF_SETGET_C32_SINT8:
  ------------------
  |  Branch (609:3): [True: 325, False: 14.0k]
  ------------------
  610|  2.28k|		    return 1;
  611|     64|		case TIFF_SETGET_UINT16:
  ------------------
  |  Branch (611:3): [True: 64, False: 14.2k]
  ------------------
  612|     64|		case TIFF_SETGET_SINT16:
  ------------------
  |  Branch (612:3): [True: 0, False: 14.3k]
  ------------------
  613|     69|		case TIFF_SETGET_C0_UINT16:
  ------------------
  |  Branch (613:3): [True: 5, False: 14.3k]
  ------------------
  614|     69|		case TIFF_SETGET_C0_SINT16:
  ------------------
  |  Branch (614:3): [True: 0, False: 14.3k]
  ------------------
  615|     91|		case TIFF_SETGET_C16_UINT16:
  ------------------
  |  Branch (615:3): [True: 22, False: 14.3k]
  ------------------
  616|     91|		case TIFF_SETGET_C16_SINT16:
  ------------------
  |  Branch (616:3): [True: 0, False: 14.3k]
  ------------------
  617|  2.84k|		case TIFF_SETGET_C32_UINT16:
  ------------------
  |  Branch (617:3): [True: 2.75k, False: 11.5k]
  ------------------
  618|  3.12k|		case TIFF_SETGET_C32_SINT16:
  ------------------
  |  Branch (618:3): [True: 279, False: 14.0k]
  ------------------
  619|  3.12k|		    return 2;
  620|      0|		case TIFF_SETGET_INT:
  ------------------
  |  Branch (620:3): [True: 0, False: 14.3k]
  ------------------
  621|     48|		case TIFF_SETGET_UINT32:
  ------------------
  |  Branch (621:3): [True: 48, False: 14.2k]
  ------------------
  622|     48|		case TIFF_SETGET_SINT32:
  ------------------
  |  Branch (622:3): [True: 0, False: 14.3k]
  ------------------
  623|    171|		case TIFF_SETGET_FLOAT:
  ------------------
  |  Branch (623:3): [True: 123, False: 14.2k]
  ------------------
  624|    180|		case TIFF_SETGET_UINT16_PAIR:
  ------------------
  |  Branch (624:3): [True: 9, False: 14.3k]
  ------------------
  625|    194|		case TIFF_SETGET_C0_UINT32:
  ------------------
  |  Branch (625:3): [True: 14, False: 14.3k]
  ------------------
  626|    194|		case TIFF_SETGET_C0_SINT32:
  ------------------
  |  Branch (626:3): [True: 0, False: 14.3k]
  ------------------
  627|    258|		case TIFF_SETGET_C0_FLOAT:
  ------------------
  |  Branch (627:3): [True: 64, False: 14.2k]
  ------------------
  628|    408|		case TIFF_SETGET_C16_UINT32:
  ------------------
  |  Branch (628:3): [True: 150, False: 14.1k]
  ------------------
  629|    408|		case TIFF_SETGET_C16_SINT32:
  ------------------
  |  Branch (629:3): [True: 0, False: 14.3k]
  ------------------
  630|    708|		case TIFF_SETGET_C16_FLOAT:
  ------------------
  |  Branch (630:3): [True: 300, False: 14.0k]
  ------------------
  631|  1.39k|		case TIFF_SETGET_C32_UINT32:
  ------------------
  |  Branch (631:3): [True: 689, False: 13.6k]
  ------------------
  632|  1.56k|		case TIFF_SETGET_C32_SINT32:
  ------------------
  |  Branch (632:3): [True: 164, False: 14.1k]
  ------------------
  633|  2.16k|		case TIFF_SETGET_C32_FLOAT:
  ------------------
  |  Branch (633:3): [True: 608, False: 13.7k]
  ------------------
  634|  2.16k|		    return 4;
  635|      0|		case TIFF_SETGET_UINT64:
  ------------------
  |  Branch (635:3): [True: 0, False: 14.3k]
  ------------------
  636|      0|		case TIFF_SETGET_SINT64:
  ------------------
  |  Branch (636:3): [True: 0, False: 14.3k]
  ------------------
  637|     29|		case TIFF_SETGET_DOUBLE:
  ------------------
  |  Branch (637:3): [True: 29, False: 14.2k]
  ------------------
  638|    188|		case TIFF_SETGET_IFD8:
  ------------------
  |  Branch (638:3): [True: 159, False: 14.1k]
  ------------------
  639|    188|		case TIFF_SETGET_C0_UINT64:
  ------------------
  |  Branch (639:3): [True: 0, False: 14.3k]
  ------------------
  640|    188|		case TIFF_SETGET_C0_SINT64:
  ------------------
  |  Branch (640:3): [True: 0, False: 14.3k]
  ------------------
  641|    188|		case TIFF_SETGET_C0_DOUBLE:
  ------------------
  |  Branch (641:3): [True: 0, False: 14.3k]
  ------------------
  642|    188|		case TIFF_SETGET_C0_IFD8:
  ------------------
  |  Branch (642:3): [True: 0, False: 14.3k]
  ------------------
  643|    188|		case TIFF_SETGET_C16_UINT64:
  ------------------
  |  Branch (643:3): [True: 0, False: 14.3k]
  ------------------
  644|    188|		case TIFF_SETGET_C16_SINT64:
  ------------------
  |  Branch (644:3): [True: 0, False: 14.3k]
  ------------------
  645|    188|		case TIFF_SETGET_C16_DOUBLE:
  ------------------
  |  Branch (645:3): [True: 0, False: 14.3k]
  ------------------
  646|    188|		case TIFF_SETGET_C16_IFD8:
  ------------------
  |  Branch (646:3): [True: 0, False: 14.3k]
  ------------------
  647|    543|		case TIFF_SETGET_C32_UINT64:
  ------------------
  |  Branch (647:3): [True: 355, False: 13.9k]
  ------------------
  648|    970|		case TIFF_SETGET_C32_SINT64:
  ------------------
  |  Branch (648:3): [True: 427, False: 13.9k]
  ------------------
  649|  1.14k|		case TIFF_SETGET_C32_DOUBLE:
  ------------------
  |  Branch (649:3): [True: 174, False: 14.1k]
  ------------------
  650|  1.34k|		case TIFF_SETGET_C32_IFD8:
  ------------------
  |  Branch (650:3): [True: 203, False: 14.1k]
  ------------------
  651|  1.34k|		    return 8;
  652|      0|		default:
  ------------------
  |  Branch (652:3): [True: 0, False: 14.3k]
  ------------------
  653|      0|		    return 0;
  654|  14.3k|	}
  655|  14.3k|} /*-- TIFFFieldSetGetSize() --- */
TIFFFindField:
  701|  4.75M|{
  702|  4.75M|	TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL};
  703|  4.75M|	TIFFField* pkey = &key;
  704|  4.75M|	const TIFFField **ret;
  705|  4.75M|	if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag &&
  ------------------
  |  Branch (705:6): [True: 932k, False: 3.82M]
  |  Branch (705:29): [True: 542k, False: 390k]
  ------------------
  706|  4.75M|	    (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
  ------------------
  |  |  312|  1.08M|#define TIFF_ANY       TIFF_NOTYPE     /* for field descriptor searching */
  ------------------
  |  Branch (706:7): [True: 542k, False: 0]
  |  Branch (706:25): [True: 0, False: 0]
  ------------------
  707|   542k|		return tif->tif_foundfield;
  708|       |
  709|       |	/* If we are invoked with no field information, then just return. */
  710|  4.21M|	if (!tif->tif_fields)
  ------------------
  |  Branch (710:6): [True: 0, False: 4.21M]
  ------------------
  711|      0|		return NULL;
  712|       |
  713|       |	/* NB: use sorted search (e.g. binary search) */
  714|       |
  715|  4.21M|	key.field_tag = tag;
  716|  4.21M|	key.field_type = dt;
  717|       |
  718|  4.21M|	ret = (const TIFFField **) bsearch(&pkey, tif->tif_fields,
  719|  4.21M|					   tif->tif_nfields,
  720|  4.21M|					   sizeof(TIFFField *), tagCompare);
  721|  4.21M|	return tif->tif_foundfield = (ret ? *ret : NULL);
  ------------------
  |  Branch (721:32): [True: 455k, False: 3.76M]
  ------------------
  722|  4.21M|}
TIFFFieldWithTag:
  753|   206k|{
  754|   206k|	const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  312|   206k|#define TIFF_ANY       TIFF_NOTYPE     /* for field descriptor searching */
  ------------------
  755|   206k|	if (!fip) {
  ------------------
  |  Branch (755:6): [True: 0, False: 206k]
  ------------------
  756|      0|		TIFFErrorExtR(tif, "TIFFFieldWithTag",
  757|      0|			     "Internal error, unknown tag 0x%x",
  758|      0|			     (unsigned int) tag);
  759|      0|	}
  760|   206k|	return (fip);
  761|   206k|}
TIFFFieldIsAnonymous:
  813|  2.53M|{
  814|  2.53M|	return fip->field_anonymous;
  815|  2.53M|}
_TIFFCreateAnonField:
  835|   154k|{
  836|   154k|	TIFFField *fld;
  837|   154k|	(void) tif;
  838|       |
  839|   154k|	fld = (TIFFField *) _TIFFmalloc(sizeof (TIFFField));
  840|   154k|	if (fld == NULL)
  ------------------
  |  Branch (840:6): [True: 0, False: 154k]
  ------------------
  841|      0|	    return NULL;
  842|   154k|	_TIFFmemset(fld, 0, sizeof(TIFFField));
  843|       |
  844|   154k|	fld->field_tag = tag;
  845|   154k|	fld->field_readcount = TIFF_VARIABLE2;
  ------------------
  |  |  315|   154k|#define TIFF_VARIABLE2 -3              /* marker for uint32_t var-length tags */
  ------------------
  846|   154k|	fld->field_writecount = TIFF_VARIABLE2;
  ------------------
  |  |  315|   154k|#define TIFF_VARIABLE2 -3              /* marker for uint32_t var-length tags */
  ------------------
  847|   154k|	fld->field_type = field_type;
  848|   154k|	fld->field_anonymous = 1;    /* indicate that this is an anonymous / unknown tag */
  849|   154k|	switch (field_type)
  850|   154k|	{
  851|  4.23k|		case TIFF_BYTE:
  ------------------
  |  Branch (851:3): [True: 4.23k, False: 150k]
  ------------------
  852|  4.61k|		case TIFF_UNDEFINED:
  ------------------
  |  Branch (852:3): [True: 381, False: 154k]
  ------------------
  853|  4.61k|			fld->set_field_type = TIFF_SETGET_C32_UINT8;
  854|  4.61k|			fld->get_field_type = TIFF_SETGET_C32_UINT8;
  855|  4.61k|			break;
  856|  8.30k|		case TIFF_ASCII:
  ------------------
  |  Branch (856:3): [True: 8.30k, False: 146k]
  ------------------
  857|  8.30k|			fld->set_field_type = TIFF_SETGET_C32_ASCII;
  858|  8.30k|			fld->get_field_type = TIFF_SETGET_C32_ASCII;
  859|  8.30k|			break;
  860|  4.95k|		case TIFF_SHORT:
  ------------------
  |  Branch (860:3): [True: 4.95k, False: 149k]
  ------------------
  861|  4.95k|			fld->set_field_type = TIFF_SETGET_C32_UINT16;
  862|  4.95k|			fld->get_field_type = TIFF_SETGET_C32_UINT16;
  863|  4.95k|			break;
  864|  1.67k|		case TIFF_LONG:
  ------------------
  |  Branch (864:3): [True: 1.67k, False: 152k]
  ------------------
  865|  1.67k|			fld->set_field_type = TIFF_SETGET_C32_UINT32;
  866|  1.67k|			fld->get_field_type = TIFF_SETGET_C32_UINT32;
  867|  1.67k|			break;
  868|    407|		case TIFF_RATIONAL:
  ------------------
  |  Branch (868:3): [True: 407, False: 154k]
  ------------------
  869|    792|		case TIFF_SRATIONAL:
  ------------------
  |  Branch (869:3): [True: 385, False: 154k]
  ------------------
  870|  1.07k|		case TIFF_FLOAT:
  ------------------
  |  Branch (870:3): [True: 287, False: 154k]
  ------------------
  871|  1.07k|			fld->set_field_type = TIFF_SETGET_C32_FLOAT;
  872|  1.07k|			fld->get_field_type = TIFF_SETGET_C32_FLOAT;
  873|  1.07k|			break;
  874|    691|		case TIFF_SBYTE:
  ------------------
  |  Branch (874:3): [True: 691, False: 153k]
  ------------------
  875|    691|			fld->set_field_type = TIFF_SETGET_C32_SINT8;
  876|    691|			fld->get_field_type = TIFF_SETGET_C32_SINT8;
  877|    691|			break;
  878|    757|		case TIFF_SSHORT:
  ------------------
  |  Branch (878:3): [True: 757, False: 153k]
  ------------------
  879|    757|			fld->set_field_type = TIFF_SETGET_C32_SINT16;
  880|    757|			fld->get_field_type = TIFF_SETGET_C32_SINT16;
  881|    757|			break;
  882|    729|		case TIFF_SLONG:
  ------------------
  |  Branch (882:3): [True: 729, False: 153k]
  ------------------
  883|    729|			fld->set_field_type = TIFF_SETGET_C32_SINT32;
  884|    729|			fld->get_field_type = TIFF_SETGET_C32_SINT32;
  885|    729|			break;
  886|    369|		case TIFF_DOUBLE:
  ------------------
  |  Branch (886:3): [True: 369, False: 154k]
  ------------------
  887|    369|			fld->set_field_type = TIFF_SETGET_C32_DOUBLE;
  888|    369|			fld->get_field_type = TIFF_SETGET_C32_DOUBLE;
  889|    369|			break;
  890|    172|		case TIFF_IFD:
  ------------------
  |  Branch (890:3): [True: 172, False: 154k]
  ------------------
  891|    625|		case TIFF_IFD8:
  ------------------
  |  Branch (891:3): [True: 453, False: 154k]
  ------------------
  892|    625|			fld->set_field_type = TIFF_SETGET_C32_IFD8;
  893|    625|			fld->get_field_type = TIFF_SETGET_C32_IFD8;
  894|    625|			break;
  895|    561|		case TIFF_LONG8:
  ------------------
  |  Branch (895:3): [True: 561, False: 153k]
  ------------------
  896|    561|			fld->set_field_type = TIFF_SETGET_C32_UINT64;
  897|    561|			fld->get_field_type = TIFF_SETGET_C32_UINT64;
  898|    561|			break;
  899|    850|		case TIFF_SLONG8:
  ------------------
  |  Branch (899:3): [True: 850, False: 153k]
  ------------------
  900|    850|			fld->set_field_type = TIFF_SETGET_C32_SINT64;
  901|    850|			fld->get_field_type = TIFF_SETGET_C32_SINT64;
  902|    850|			break;
  903|   129k|		default:
  ------------------
  |  Branch (903:3): [True: 129k, False: 25.2k]
  ------------------
  904|   129k|			fld->set_field_type = TIFF_SETGET_UNDEFINED;
  905|   129k|			fld->get_field_type = TIFF_SETGET_UNDEFINED;
  906|   129k|			break;
  907|   154k|	}
  908|   154k|	fld->field_bit = FIELD_CUSTOM;
  ------------------
  |  |  317|   154k|#define FIELD_CUSTOM    65
  ------------------
  909|   154k|	fld->field_oktochange = TRUE;
  ------------------
  |  |   61|   154k|#define	TRUE	1
  ------------------
  910|   154k|	fld->field_passcount = TRUE;
  ------------------
  |  |   61|   154k|#define	TRUE	1
  ------------------
  911|   154k|	fld->field_name = (char *) _TIFFmalloc(32);
  912|   154k|	if (fld->field_name == NULL) {
  ------------------
  |  Branch (912:6): [True: 0, False: 154k]
  ------------------
  913|      0|	    _TIFFfree(fld);
  914|      0|	    return NULL;
  915|      0|	}
  916|   154k|	fld->field_subfields = NULL;
  917|       |
  918|       |	/* 
  919|       |	 * note that this name is a special sign to TIFFClose() and
  920|       |	 * _TIFFSetupFields() to free the field
  921|       |	 * Update:
  922|       |	 *   This special sign is replaced by fld->field_anonymous  flag.
  923|       |	 */
  924|   154k|	(void) snprintf(fld->field_name, 32, "Tag %d", (int) tag);
  925|       |
  926|   154k|	return fld;    
  927|   154k|}
_TIFFCheckFieldIsValidForCodec:
 1166|   188k|{
 1167|       |	/* Filter out non-codec specific tags */
 1168|   188k|	switch (tag) {
 1169|       |	    /* Shared tags */
 1170|    573|	    case TIFFTAG_PREDICTOR:
  ------------------
  |  |  297|    573|#define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
  ------------------
  |  Branch (1170:6): [True: 573, False: 187k]
  ------------------
 1171|       |	    /* JPEG tags */
 1172|    622|	    case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  344|    622|#define	TIFFTAG_JPEGTABLES		347	/* %JPEG table stream */
  ------------------
  |  Branch (1172:6): [True: 49, False: 188k]
  ------------------
 1173|       |	    /* OJPEG tags */
 1174|  1.55k|	    case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  377|  1.55k|#define	TIFFTAG_JPEGIFOFFSET		513	/* !pointer to SOI marker */
  ------------------
  |  Branch (1174:6): [True: 936, False: 187k]
  ------------------
 1175|  2.00k|	    case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  378|  2.00k|#define	TIFFTAG_JPEGIFBYTECOUNT		514	/* !JFIF stream length */
  ------------------
  |  Branch (1175:6): [True: 445, False: 187k]
  ------------------
 1176|  3.57k|	    case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  382|  3.57k|#define	TIFFTAG_JPEGQTABLES		519	/* !Q matrix offsets */
  ------------------
  |  Branch (1176:6): [True: 1.57k, False: 186k]
  ------------------
 1177|  4.92k|	    case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  383|  4.92k|#define	TIFFTAG_JPEGDCTABLES		520	/* !DCT table offsets */
  ------------------
  |  Branch (1177:6): [True: 1.35k, False: 187k]
  ------------------
 1178|  6.04k|	    case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  384|  6.04k|#define	TIFFTAG_JPEGACTABLES		521	/* !AC coefficient offsets */
  ------------------
  |  Branch (1178:6): [True: 1.11k, False: 187k]
  ------------------
 1179|  7.32k|	    case TIFFTAG_JPEGPROC:
  ------------------
  |  |  374|  7.32k|#define	TIFFTAG_JPEGPROC		512	/* !JPEG processing algorithm */
  ------------------
  |  Branch (1179:6): [True: 1.28k, False: 187k]
  ------------------
 1180|  7.38k|	    case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  379|  7.38k|#define	TIFFTAG_JPEGRESTARTINTERVAL	515	/* !restart interval length */
  ------------------
  |  Branch (1180:6): [True: 53, False: 188k]
  ------------------
 1181|       |	    /* CCITT* */
 1182|  7.43k|	    case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  309|  7.43k|#define	TIFFTAG_BADFAXLINES		326	/* lines w/ wrong pixel count */
  ------------------
  |  Branch (1182:6): [True: 56, False: 188k]
  ------------------
 1183|  7.47k|	    case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  310|  7.47k|#define	TIFFTAG_CLEANFAXDATA		327	/* regenerated line info */
  ------------------
  |  Branch (1183:6): [True: 38, False: 188k]
  ------------------
 1184|  7.53k|	    case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  314|  7.53k|#define	TIFFTAG_CONSECUTIVEBADFAXLINES	328	/* max consecutive bad lines */
  ------------------
  |  Branch (1184:6): [True: 54, False: 188k]
  ------------------
 1185|  8.71k|	    case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  273|  8.71k|#define	TIFFTAG_GROUP3OPTIONS		292	/* 32 flag bits */
  ------------------
  |  Branch (1185:6): [True: 1.18k, False: 187k]
  ------------------
 1186|  8.84k|	    case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  278|  8.84k|#define	TIFFTAG_GROUP4OPTIONS		293	/* 32 flag bits */
  ------------------
  |  Branch (1186:6): [True: 135, False: 188k]
  ------------------
 1187|       |	    /* LERC */
 1188|  8.85k|	    case TIFFTAG_LERC_PARAMETERS:
  ------------------
  |  |  500|  8.85k|#define TIFFTAG_LERC_PARAMETERS         50674   /* Stores LERC version and additional compression method */
  ------------------
  |  Branch (1188:6): [True: 7, False: 188k]
  ------------------
 1189|  8.85k|		break;
 1190|   179k|	    default:
  ------------------
  |  Branch (1190:6): [True: 179k, False: 8.85k]
  ------------------
 1191|   179k|		return 1;
 1192|   188k|	}
 1193|  8.85k|	if( !TIFFIsCODECConfigured(tif->tif_dir.td_compression) ) {
  ------------------
  |  Branch (1193:6): [True: 153, False: 8.70k]
  ------------------
 1194|    153|		return 0;
 1195|    153|	}
 1196|       |	/* Check if codec specific tags are allowed for the current
 1197|       |	 * compression scheme (codec) */
 1198|  8.70k|	switch (tif->tif_dir.td_compression) {
  ------------------
  |  Branch (1198:10): [True: 339, False: 8.36k]
  ------------------
 1199|     88|	    case COMPRESSION_LZW:
  ------------------
  |  |  182|     88|#define	    COMPRESSION_LZW		5       /* Lempel-Ziv  & Welch */
  ------------------
  |  Branch (1199:6): [True: 88, False: 8.61k]
  ------------------
 1200|     88|		if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  297|     88|#define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
  ------------------
  |  Branch (1200:7): [True: 51, False: 37]
  ------------------
 1201|     51|		    return 1;
 1202|     37|		break;
 1203|     37|	    case COMPRESSION_PACKBITS:
  ------------------
  |  |  189|      4|#define	    COMPRESSION_PACKBITS	32773	/* Macintosh RLE */
  ------------------
  |  Branch (1203:6): [True: 4, False: 8.69k]
  ------------------
 1204|       |		/* No codec-specific tags */
 1205|      4|		break;
 1206|      1|	    case COMPRESSION_THUNDERSCAN:
  ------------------
  |  |  190|      1|#define	    COMPRESSION_THUNDERSCAN	32809	/* ThunderScan RLE */
  ------------------
  |  Branch (1206:6): [True: 1, False: 8.70k]
  ------------------
 1207|       |		/* No codec-specific tags */
 1208|      1|		break;
 1209|      2|	    case COMPRESSION_NEXT:
  ------------------
  |  |  187|      2|#define	    COMPRESSION_NEXT		32766	/* NeXT 2-bit RLE */
  ------------------
  |  Branch (1209:6): [True: 2, False: 8.70k]
  ------------------
 1210|       |		/* No codec-specific tags */
 1211|      2|		break;
 1212|  1.01k|	    case COMPRESSION_JPEG:
  ------------------
  |  |  184|  1.01k|#define	    COMPRESSION_JPEG		7	/* %JPEG DCT compression */
  ------------------
  |  Branch (1212:6): [True: 1.01k, False: 7.68k]
  ------------------
 1213|  1.01k|		if (tag == TIFFTAG_JPEGTABLES)
  ------------------
  |  |  344|  1.01k|#define	TIFFTAG_JPEGTABLES		347	/* %JPEG table stream */
  ------------------
  |  Branch (1213:7): [True: 7, False: 1.01k]
  ------------------
 1214|      7|		    return 1;
 1215|  1.01k|		break;
 1216|  5.24k|	    case COMPRESSION_OJPEG:
  ------------------
  |  |  183|  5.24k|#define	    COMPRESSION_OJPEG		6	/* !6.0 JPEG */
  ------------------
  |  Branch (1216:6): [True: 5.24k, False: 3.45k]
  ------------------
 1217|  5.24k|		switch (tag) {
  ------------------
  |  Branch (1217:11): [True: 57, False: 5.19k]
  ------------------
 1218|    773|		    case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  377|    773|#define	TIFFTAG_JPEGIFOFFSET		513	/* !pointer to SOI marker */
  ------------------
  |  Branch (1218:7): [True: 773, False: 4.47k]
  ------------------
 1219|  1.11k|		    case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  378|  1.11k|#define	TIFFTAG_JPEGIFBYTECOUNT		514	/* !JFIF stream length */
  ------------------
  |  Branch (1219:7): [True: 338, False: 4.91k]
  ------------------
 1220|  2.62k|		    case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  382|  2.62k|#define	TIFFTAG_JPEGQTABLES		519	/* !Q matrix offsets */
  ------------------
  |  Branch (1220:7): [True: 1.51k, False: 3.73k]
  ------------------
 1221|  3.90k|		    case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  383|  3.90k|#define	TIFFTAG_JPEGDCTABLES		520	/* !DCT table offsets */
  ------------------
  |  Branch (1221:7): [True: 1.28k, False: 3.96k]
  ------------------
 1222|  4.97k|		    case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  384|  4.97k|#define	TIFFTAG_JPEGACTABLES		521	/* !AC coefficient offsets */
  ------------------
  |  Branch (1222:7): [True: 1.06k, False: 4.18k]
  ------------------
 1223|  5.18k|		    case TIFFTAG_JPEGPROC:
  ------------------
  |  |  374|  5.18k|#define	TIFFTAG_JPEGPROC		512	/* !JPEG processing algorithm */
  ------------------
  |  Branch (1223:7): [True: 212, False: 5.03k]
  ------------------
 1224|  5.19k|		    case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  379|  5.19k|#define	TIFFTAG_JPEGRESTARTINTERVAL	515	/* !restart interval length */
  ------------------
  |  Branch (1224:7): [True: 9, False: 5.23k]
  ------------------
 1225|  5.19k|			return 1;
 1226|  5.24k|		}
 1227|     57|		break;
 1228|     57|	    case COMPRESSION_CCITTRLE:
  ------------------
  |  |  177|     55|#define	    COMPRESSION_CCITTRLE	2	/* CCITT modified Huffman RLE */
  ------------------
  |  Branch (1228:6): [True: 55, False: 8.64k]
  ------------------
 1229|     94|	    case COMPRESSION_CCITTRLEW:
  ------------------
  |  |  188|     94|#define	    COMPRESSION_CCITTRLEW	32771	/* #1 w/ word alignment */
  ------------------
  |  Branch (1229:6): [True: 39, False: 8.66k]
  ------------------
 1230|  1.15k|	    case COMPRESSION_CCITTFAX3:
  ------------------
  |  |  178|  1.15k|#define	    COMPRESSION_CCITTFAX3	3	/* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1230:6): [True: 1.06k, False: 7.63k]
  ------------------
 1231|  1.22k|	    case COMPRESSION_CCITTFAX4:
  ------------------
  |  |  180|  1.22k|#define	    COMPRESSION_CCITTFAX4	4	/* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (1231:6): [True: 63, False: 8.64k]
  ------------------
 1232|  1.22k|		switch (tag) {
  ------------------
  |  Branch (1232:11): [True: 177, False: 1.04k]
  ------------------
 1233|      6|		    case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  309|      6|#define	TIFFTAG_BADFAXLINES		326	/* lines w/ wrong pixel count */
  ------------------
  |  Branch (1233:7): [True: 6, False: 1.21k]
  ------------------
 1234|     18|		    case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  310|     18|#define	TIFFTAG_CLEANFAXDATA		327	/* regenerated line info */
  ------------------
  |  Branch (1234:7): [True: 12, False: 1.21k]
  ------------------
 1235|     31|		    case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  314|     31|#define	TIFFTAG_CONSECUTIVEBADFAXLINES	328	/* max consecutive bad lines */
  ------------------
  |  Branch (1235:7): [True: 13, False: 1.20k]
  ------------------
 1236|     31|			return 1;
 1237|    981|		    case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  273|    981|#define	TIFFTAG_GROUP3OPTIONS		292	/* 32 flag bits */
  ------------------
  |  Branch (1237:7): [True: 981, False: 241]
  ------------------
 1238|    981|			if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
  ------------------
  |  |  178|    981|#define	    COMPRESSION_CCITTFAX3	3	/* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1238:8): [True: 947, False: 34]
  ------------------
 1239|    947|			    return 1;
 1240|     34|			break;
 1241|     34|		    case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  278|     33|#define	TIFFTAG_GROUP4OPTIONS		293	/* 32 flag bits */
  ------------------
  |  Branch (1241:7): [True: 33, False: 1.18k]
  ------------------
 1242|     33|			if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)
  ------------------
  |  |  180|     33|#define	    COMPRESSION_CCITTFAX4	4	/* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (1242:8): [True: 7, False: 26]
  ------------------
 1243|      7|			    return 1;
 1244|     26|			break;
 1245|  1.22k|		}
 1246|    237|		break;
 1247|    237|	    case COMPRESSION_JBIG:
  ------------------
  |  |  204|      1|#define	    COMPRESSION_JBIG		34661	/* ISO JBIG */
  ------------------
  |  Branch (1247:6): [True: 1, False: 8.70k]
  ------------------
 1248|       |		/* No codec-specific tags */
 1249|      1|		break;
 1250|     22|	    case COMPRESSION_DEFLATE:
  ------------------
  |  |  199|     22|#define	    COMPRESSION_DEFLATE		32946	/* Deflate compression, legacy tag */
  ------------------
  |  Branch (1250:6): [True: 22, False: 8.68k]
  ------------------
 1251|    199|	    case COMPRESSION_ADOBE_DEFLATE:
  ------------------
  |  |  200|    199|#define     COMPRESSION_ADOBE_DEFLATE   8       /* Deflate compression,
  ------------------
  |  Branch (1251:6): [True: 177, False: 8.52k]
  ------------------
 1252|    199|		if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  297|    199|#define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
  ------------------
  |  Branch (1252:7): [True: 91, False: 108]
  ------------------
 1253|     91|		    return 1;
 1254|    108|		break;
 1255|    370|	   case COMPRESSION_PIXARLOG:
  ------------------
  |  |  198|    370|#define	    COMPRESSION_PIXARLOG	32909   /* Pixar companded 11bit ZIP */
  ------------------
  |  Branch (1255:5): [True: 370, False: 8.33k]
  ------------------
 1256|    370|		if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  297|    370|#define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
  ------------------
  |  Branch (1256:7): [True: 231, False: 139]
  ------------------
 1257|    231|		    return 1;
 1258|    139|		break;
 1259|    139|	    case COMPRESSION_SGILOG:
  ------------------
  |  |  205|     36|#define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
  ------------------
  |  Branch (1259:6): [True: 36, False: 8.66k]
  ------------------
 1260|     47|	    case COMPRESSION_SGILOG24:
  ------------------
  |  |  206|     47|#define     COMPRESSION_SGILOG24	34677	/* SGI Log 24-bit packed */
  ------------------
  |  Branch (1260:6): [True: 11, False: 8.69k]
  ------------------
 1261|       |		/* No codec-specific tags */
 1262|     47|		break;
 1263|    163|	    case COMPRESSION_LZMA:
  ------------------
  |  |  210|    163|#define	    COMPRESSION_LZMA		34925	/* LZMA2 */
  ------------------
  |  Branch (1263:6): [True: 163, False: 8.54k]
  ------------------
 1264|    163|		if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  297|    163|#define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
  ------------------
  |  Branch (1264:7): [True: 27, False: 136]
  ------------------
 1265|     27|		    return 1;
 1266|    136|		break;
 1267|    136|	    case COMPRESSION_ZSTD:
  ------------------
  |  |  211|      0|#define	    COMPRESSION_ZSTD		50000	/* ZSTD: WARNING not registered in Adobe-maintained registry */
  ------------------
  |  Branch (1267:6): [True: 0, False: 8.70k]
  ------------------
 1268|      0|		if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  297|      0|#define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
  ------------------
  |  Branch (1268:7): [True: 0, False: 0]
  ------------------
 1269|      0|		    return 1;
 1270|      0|		break;
 1271|      0|	    case COMPRESSION_LERC:
  ------------------
  |  |  208|      0|#define     COMPRESSION_LERC            34887   /* ESRI Lerc codec: https://github.com/Esri/lerc */
  ------------------
  |  Branch (1271:6): [True: 0, False: 8.70k]
  ------------------
 1272|      0|		if (tag == TIFFTAG_LERC_PARAMETERS)
  ------------------
  |  |  500|      0|#define TIFFTAG_LERC_PARAMETERS         50674   /* Stores LERC version and additional compression method */
  ------------------
  |  Branch (1272:7): [True: 0, False: 0]
  ------------------
 1273|      0|		    return 1;
 1274|      0|		break;
 1275|  8.70k|	}
 1276|  2.12k|	return 0;
 1277|  8.70k|}
tif_dirinfo.c:tagCompare:
  446|   373M|{
  447|   373M|	const TIFFField* ta = *(const TIFFField**) a;
  448|   373M|	const TIFFField* tb = *(const TIFFField**) b;
  449|       |	/* NB: be careful of return values for 16-bit platforms */
  450|   373M|	if (ta->field_tag != tb->field_tag)
  ------------------
  |  Branch (450:6): [True: 372M, False: 455k]
  ------------------
  451|   372M|		return (int)ta->field_tag - (int)tb->field_tag;
  452|   455k|	else
  453|   455k|		return (ta->field_type == TIFF_ANY) ?
  ------------------
  |  |  312|   455k|#define TIFF_ANY       TIFF_NOTYPE     /* for field descriptor searching */
  ------------------
  |  Branch (453:10): [True: 455k, False: 0]
  ------------------
  454|   455k|			0 : ((int)tb->field_type - (int)ta->field_type);
  455|   373M|}

TIFFReadDirectory:
 3879|  23.4k|{
 3880|  23.4k|	static const char module[] = "TIFFReadDirectory";
 3881|  23.4k|	TIFFDirEntry* dir;
 3882|  23.4k|	uint16_t dircount;
 3883|  23.4k|	TIFFDirEntry* dp;
 3884|  23.4k|	uint16_t di;
 3885|  23.4k|	const TIFFField* fip;
 3886|  23.4k|	uint32_t fii=FAILED_FII;
  ------------------
  |  |   43|  23.4k|#define FAILED_FII    ((uint32_t) -1)
  ------------------
 3887|  23.4k|        toff_t nextdiroff;
 3888|  23.4k|    int bitspersample_read = FALSE;
  ------------------
  |  |   62|  23.4k|#define	FALSE	0
  ------------------
 3889|  23.4k|        int color_channels;
 3890|       |
 3891|  23.4k|	if (tif->tif_nextdiroff == 0) {
  ------------------
  |  Branch (3891:6): [True: 1, False: 23.4k]
  ------------------
 3892|       |		/* In this special case, tif_diroff needs also to be set to 0. */
 3893|      1|		tif->tif_diroff = tif->tif_nextdiroff;
 3894|      1|		return 0;           /* last offset, thus no checking necessary */
 3895|      1|	}
 3896|       |
 3897|  23.4k|	nextdiroff = tif->tif_nextdiroff;
 3898|       |	/* tif_curdir++ and tif_nextdiroff should only be updated after SUCCESSFUL reading of the directory. Otherwise, invalid IFD offsets could corrupt the IFD list. */
 3899|  23.4k|	if (!_TIFFCheckDirNumberAndOffset(tif, tif->tif_curdir + 1, nextdiroff)) {
  ------------------
  |  Branch (3899:6): [True: 0, False: 23.4k]
  ------------------
 3900|      0|		TIFFWarningExtR(tif, module,
 3901|      0|			"Didn't read next directory due to IFD looping at offset 0x%"PRIx64" (%"PRIu64") to offset 0x%"PRIx64" (%"PRIu64")", tif->tif_diroff, tif->tif_diroff, nextdiroff, nextdiroff);
 3902|      0|		return 0;           /* bad offset (IFD looping) */
 3903|      0|	}
 3904|  23.4k|	dircount=TIFFFetchDirectory(tif,nextdiroff,&dir,&tif->tif_nextdiroff);
 3905|  23.4k|	if (!dircount)
  ------------------
  |  Branch (3905:6): [True: 292, False: 23.1k]
  ------------------
 3906|    292|	{
 3907|    292|		TIFFErrorExtR(tif,module,
 3908|    292|		    "Failed to read directory at offset %" PRIu64, nextdiroff);
 3909|    292|		return 0;
 3910|    292|	}
 3911|       |	/* Set global values after a valid directory has been fetched.
 3912|       |	 * tif_diroff is already set to nextdiroff in TIFFFetchDirectory() in the beginning. */
 3913|  23.1k|	tif->tif_curdir++;
 3914|  23.1k|	(*tif->tif_cleanup)(tif);   /* cleanup any previous compression state */
 3915|       |
 3916|  23.1k|	TIFFReadDirectoryCheckOrder(tif,dir,dircount);
 3917|       |
 3918|       |        /*
 3919|       |         * Mark duplicates of any tag to be ignored (bugzilla 1994)
 3920|       |         * to avoid certain pathological problems.
 3921|       |         */
 3922|  23.1k|	{
 3923|  23.1k|		TIFFDirEntry* ma;
 3924|  23.1k|		uint16_t mb;
 3925|   511k|		for (ma=dir, mb=0; mb<dircount; ma++, mb++)
  ------------------
  |  Branch (3925:22): [True: 488k, False: 23.1k]
  ------------------
 3926|   488k|		{
 3927|   488k|			TIFFDirEntry* na;
 3928|   488k|			uint16_t nb;
 3929|   336M|			for (na=ma+1, nb=mb+1; nb<dircount; na++, nb++)
  ------------------
  |  Branch (3929:27): [True: 336M, False: 488k]
  ------------------
 3930|   336M|			{
 3931|   336M|				if (ma->tdir_tag == na->tdir_tag) {
  ------------------
  |  Branch (3931:9): [True: 54.2M, False: 282M]
  ------------------
 3932|  54.2M|					na->tdir_ignore = TRUE;
  ------------------
  |  |   61|  54.2M|#define	TRUE	1
  ------------------
 3933|  54.2M|				}
 3934|   336M|			}
 3935|   488k|		}
 3936|  23.1k|	}
 3937|       |        
 3938|  23.1k|	tif->tif_flags &= ~TIFF_BEENWRITING;    /* reset before new dir */
  ------------------
  |  |   97|  23.1k|	#define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
  ------------------
 3939|  23.1k|	tif->tif_flags &= ~TIFF_BUF4WRITE;      /* reset before new dir */
  ------------------
  |  |  111|  23.1k|        #define TIFF_BUF4WRITE  0x100000U /* rawcc bytes are for writing */
  ------------------
 3940|  23.1k|	tif->tif_flags &= ~TIFF_CHOPPEDUPARRAYS;
  ------------------
  |  |  117|  23.1k|        #define TIFF_CHOPPEDUPARRAYS 0x4000000U /* set when allocChoppedUpStripArrays() has modified strip array */
  ------------------
 3941|       |
 3942|       |	/* free any old stuff and reinit */
 3943|  23.1k|	TIFFFreeDirectory(tif);
 3944|  23.1k|	TIFFDefaultDirectory(tif);
 3945|       |	/*
 3946|       |	 * Electronic Arts writes gray-scale TIFF files
 3947|       |	 * without a PlanarConfiguration directory entry.
 3948|       |	 * Thus we setup a default value here, even though
 3949|       |	 * the TIFF spec says there is no default value.
 3950|       |	 * After PlanarConfiguration is preset in TIFFDefaultDirectory()
 3951|       |	 * the following setting is not needed, but does not harm either.
 3952|       |	 */
 3953|  23.1k|	TIFFSetField(tif,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);
  ------------------
  |  |  258|  23.1k|#define	TIFFTAG_PLANARCONFIG		284	/* storage organization */
  ------------------
              	TIFFSetField(tif,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);
  ------------------
  |  |  259|  23.1k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
 3954|       |	/*
 3955|       |	 * Setup default value and then make a pass over
 3956|       |	 * the fields to check type and tag information,
 3957|       |	 * and to extract info required to size data
 3958|       |	 * structures.  A second pass is made afterwards
 3959|       |	 * to read in everything not taken in the first pass.
 3960|       |	 * But we must process the Compression tag first
 3961|       |	 * in order to merge in codec-private tag definitions (otherwise
 3962|       |	 * we may get complaints about unknown tags).  However, the
 3963|       |	 * Compression tag may be dependent on the SamplesPerPixel
 3964|       |	 * tag value because older TIFF specs permitted Compression
 3965|       |	 * to be written as a SamplesPerPixel-count tag entry.
 3966|       |	 * Thus if we don't first figure out the correct SamplesPerPixel
 3967|       |	 * tag value then we may end up ignoring the Compression tag
 3968|       |	 * value because it has an incorrect count value (if the
 3969|       |	 * true value of SamplesPerPixel is not 1).
 3970|       |	 */
 3971|  23.1k|	dp=TIFFReadDirectoryFindEntry(tif,dir,dircount,TIFFTAG_SAMPLESPERPIXEL);
  ------------------
  |  |  251|  23.1k|#define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
  ------------------
 3972|  23.1k|	if (dp)
  ------------------
  |  Branch (3972:6): [True: 4.40k, False: 18.7k]
  ------------------
 3973|  4.40k|	{
 3974|  4.40k|		if (!TIFFFetchNormalTag(tif,dp,0))
  ------------------
  |  Branch (3974:7): [True: 32, False: 4.37k]
  ------------------
 3975|     32|			goto bad;
 3976|  4.37k|		dp->tdir_ignore = TRUE;
  ------------------
  |  |   61|  4.37k|#define	TRUE	1
  ------------------
 3977|  4.37k|	}
 3978|  23.1k|	dp=TIFFReadDirectoryFindEntry(tif,dir,dircount,TIFFTAG_COMPRESSION);
  ------------------
  |  |  175|  23.1k|#define	TIFFTAG_COMPRESSION		259	/* data compression technique */
  ------------------
 3979|  23.1k|	if (dp)
  ------------------
  |  Branch (3979:6): [True: 15.2k, False: 7.86k]
  ------------------
 3980|  15.2k|	{
 3981|       |		/*
 3982|       |		 * The 5.0 spec says the Compression tag has one value, while
 3983|       |		 * earlier specs say it has one value per sample.  Because of
 3984|       |		 * this, we accept the tag if one value is supplied with either
 3985|       |		 * count.
 3986|       |		 */
 3987|  15.2k|		uint16_t value;
 3988|  15.2k|		enum TIFFReadDirEntryErr err;
 3989|  15.2k|		err=TIFFReadDirEntryShort(tif,dp,&value);
 3990|  15.2k|		if (err==TIFFReadDirEntryErrCount)
  ------------------
  |  Branch (3990:7): [True: 1.37k, False: 13.8k]
  ------------------
 3991|  1.37k|			err=TIFFReadDirEntryPersampleShort(tif,dp,&value);
 3992|  15.2k|		if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3992:7): [True: 477, False: 14.7k]
  ------------------
 3993|    477|		{
 3994|    477|			TIFFReadDirEntryOutputErr(tif,err,module,"Compression",0);
 3995|    477|			goto bad;
 3996|    477|		}
 3997|  14.7k|		if (!TIFFSetField(tif,TIFFTAG_COMPRESSION,value))
  ------------------
  |  |  175|  14.7k|#define	TIFFTAG_COMPRESSION		259	/* data compression technique */
  ------------------
  |  Branch (3997:7): [True: 0, False: 14.7k]
  ------------------
 3998|      0|			goto bad;
 3999|  14.7k|		dp->tdir_ignore = TRUE;
  ------------------
  |  |   61|  14.7k|#define	TRUE	1
  ------------------
 4000|  14.7k|	}
 4001|  7.86k|	else
 4002|  7.86k|	{
 4003|  7.86k|		if (!TIFFSetField(tif,TIFFTAG_COMPRESSION,COMPRESSION_NONE))
  ------------------
  |  |  175|  7.86k|#define	TIFFTAG_COMPRESSION		259	/* data compression technique */
  ------------------
              		if (!TIFFSetField(tif,TIFFTAG_COMPRESSION,COMPRESSION_NONE))
  ------------------
  |  |  176|  7.86k|#define	    COMPRESSION_NONE		1	/* dump mode */
  ------------------
  |  Branch (4003:7): [True: 0, False: 7.86k]
  ------------------
 4004|      0|			goto bad;
 4005|  7.86k|	}
 4006|       |	/*
 4007|       |	 * First real pass over the directory.
 4008|       |	 */
 4009|   507k|	for (di=0, dp=dir; di<dircount; di++, dp++)
  ------------------
  |  Branch (4009:21): [True: 485k, False: 21.8k]
  ------------------
 4010|   485k|	{
 4011|   485k|		if (!dp->tdir_ignore)
  ------------------
  |  Branch (4011:7): [True: 281k, False: 203k]
  ------------------
 4012|   281k|		{
 4013|   281k|			TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii);
 4014|   281k|			if (fii == FAILED_FII)
  ------------------
  |  |   43|   281k|#define FAILED_FII    ((uint32_t) -1)
  ------------------
  |  Branch (4014:8): [True: 154k, False: 127k]
  ------------------
 4015|   154k|			{
 4016|   154k|				TIFFWarningExtR(tif, module,
 4017|   154k|				    "Unknown field with tag %"PRIu16" (0x%"PRIx16") encountered",
 4018|   154k|				    dp->tdir_tag,dp->tdir_tag);
 4019|       |				/* the following knowingly leaks the 
 4020|       |				   anonymous field structure */
 4021|   154k|				if (!_TIFFMergeFields(tif,
  ------------------
  |  Branch (4021:9): [True: 0, False: 154k]
  ------------------
 4022|   154k|					_TIFFCreateAnonField(tif,
 4023|   154k|						dp->tdir_tag,
 4024|   154k|						(TIFFDataType) dp->tdir_type),
 4025|   154k|					1)) {
 4026|      0|					TIFFWarningExtR(tif,
 4027|      0|					    module,
 4028|      0|					    "Registering anonymous field with tag %"PRIu16" (0x%"PRIx16") failed",
 4029|      0|					    dp->tdir_tag,
 4030|      0|					    dp->tdir_tag);
 4031|      0|					dp->tdir_ignore = TRUE;
  ------------------
  |  |   61|      0|#define	TRUE	1
  ------------------
 4032|   154k|				} else {
 4033|   154k|					TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii);
 4034|   154k|					assert(fii != FAILED_FII);
 4035|   154k|				}
 4036|   154k|			}
 4037|   281k|		}
 4038|   485k|		if (!dp->tdir_ignore)
  ------------------
  |  Branch (4038:7): [True: 281k, False: 203k]
  ------------------
 4039|   281k|		{
 4040|   281k|			fip=tif->tif_fields[fii];
 4041|   281k|			if (fip->field_bit==FIELD_IGNORE)
  ------------------
  |  |  139|   281k|#define FIELD_IGNORE                   0
  ------------------
  |  Branch (4041:8): [True: 1.96k, False: 279k]
  ------------------
 4042|  1.96k|				dp->tdir_ignore = TRUE;
  ------------------
  |  |   61|  1.96k|#define	TRUE	1
  ------------------
 4043|   279k|			else
 4044|   279k|			{
 4045|   279k|				switch (dp->tdir_tag)
 4046|   279k|				{
 4047|  9.13k|					case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  241|  9.13k|#define	TIFFTAG_STRIPOFFSETS		273	/* offsets to data strips */
  ------------------
  |  Branch (4047:6): [True: 9.13k, False: 270k]
  ------------------
 4048|  15.9k|					case TIFFTAG_STRIPBYTECOUNTS:
  ------------------
  |  |  253|  15.9k|#define	TIFFTAG_STRIPBYTECOUNTS		279	/* bytes counts for strips */
  ------------------
  |  Branch (4048:6): [True: 6.79k, False: 273k]
  ------------------
 4049|  23.0k|					case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  307|  23.0k|#define TIFFTAG_TILEOFFSETS		324	/* !offsets to data tiles */
  ------------------
  |  Branch (4049:6): [True: 7.16k, False: 272k]
  ------------------
 4050|  26.7k|					case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  308|  26.7k|#define TIFFTAG_TILEBYTECOUNTS		325	/* !byte counts for tiles */
  ------------------
  |  Branch (4050:6): [True: 3.66k, False: 276k]
  ------------------
 4051|  26.7k|						TIFFSetFieldBit(tif,fip->field_bit);
  ------------------
  |  |  199|  26.7k|#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  197|  26.7k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  196|  26.7k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
 4052|  26.7k|						break;
 4053|  18.5k|					case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  172|  18.5k|#define	TIFFTAG_IMAGEWIDTH		256	/* image width in pixels */
  ------------------
  |  Branch (4053:6): [True: 18.5k, False: 261k]
  ------------------
 4054|  35.7k|					case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  173|  35.7k|#define	TIFFTAG_IMAGELENGTH		257	/* image height in pixels */
  ------------------
  |  Branch (4054:6): [True: 17.1k, False: 262k]
  ------------------
 4055|  35.7k|					case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  406|  35.7k|#define	TIFFTAG_IMAGEDEPTH		32997	/* z depth of image */
  ------------------
  |  Branch (4055:6): [True: 31, False: 279k]
  ------------------
 4056|  43.1k|					case TIFFTAG_TILELENGTH:
  ------------------
  |  |  306|  43.1k|#define	TIFFTAG_TILELENGTH		323	/* !tile height in pixels */
  ------------------
  |  Branch (4056:6): [True: 7.38k, False: 272k]
  ------------------
 4057|  55.0k|					case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  305|  55.0k|#define	TIFFTAG_TILEWIDTH		322	/* !tile width in pixels */
  ------------------
  |  Branch (4057:6): [True: 11.9k, False: 267k]
  ------------------
 4058|  55.1k|					case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  407|  55.1k|#define	TIFFTAG_TILEDEPTH		32998	/* z depth/data tile */
  ------------------
  |  Branch (4058:6): [True: 141, False: 279k]
  ------------------
 4059|  56.7k|					case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  258|  56.7k|#define	TIFFTAG_PLANARCONFIG		284	/* storage organization */
  ------------------
  |  Branch (4059:6): [True: 1.56k, False: 278k]
  ------------------
 4060|  63.9k|					case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  252|  63.9k|#define	TIFFTAG_ROWSPERSTRIP		278	/* rows per strip of data */
  ------------------
  |  Branch (4060:6): [True: 7.22k, False: 272k]
  ------------------
 4061|  64.5k|					case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  323|  64.5k|#define	TIFFTAG_EXTRASAMPLES		338	/* !info about extra samples */
  ------------------
  |  Branch (4061:6): [True: 619, False: 279k]
  ------------------
 4062|  64.5k|						if (!TIFFFetchNormalTag(tif,dp,0))
  ------------------
  |  Branch (4062:11): [True: 832, False: 63.7k]
  ------------------
 4063|    832|							goto bad;
 4064|  63.7k|						dp->tdir_ignore = TRUE;
  ------------------
  |  |   61|  63.7k|#define	TRUE	1
  ------------------
 4065|  63.7k|						break;
 4066|   188k|					default:
  ------------------
  |  Branch (4066:6): [True: 188k, False: 91.3k]
  ------------------
 4067|   188k|						if( !_TIFFCheckFieldIsValidForCodec(tif, dp->tdir_tag) )
  ------------------
  |  Branch (4067:11): [True: 2.27k, False: 186k]
  ------------------
 4068|  2.27k|							dp->tdir_ignore = TRUE;
  ------------------
  |  |   61|  2.27k|#define	TRUE	1
  ------------------
 4069|   188k|						break;
 4070|   279k|				}
 4071|   279k|			}
 4072|   281k|		}
 4073|   485k|	}
 4074|       |	/*
 4075|       |	 * XXX: OJPEG hack.
 4076|       |	 * If a) compression is OJPEG, b) planarconfig tag says it's separate,
 4077|       |	 * c) strip offsets/bytecounts tag are both present and
 4078|       |	 * d) both contain exactly one value, then we consistently find
 4079|       |	 * that the buggy implementation of the buggy compression scheme
 4080|       |	 * matches contig planarconfig best. So we 'fix-up' the tag here
 4081|       |	 */
 4082|  21.8k|	if ((tif->tif_dir.td_compression==COMPRESSION_OJPEG)&&
  ------------------
  |  |  183|  21.8k|#define	    COMPRESSION_OJPEG		6	/* !6.0 JPEG */
  ------------------
  |  Branch (4082:6): [True: 3.32k, False: 18.4k]
  ------------------
 4083|  21.8k|	    (tif->tif_dir.td_planarconfig==PLANARCONFIG_SEPARATE))
  ------------------
  |  |  260|  3.32k|#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  ------------------
  |  Branch (4083:6): [True: 665, False: 2.66k]
  ------------------
 4084|    665|	{
 4085|    665|		if (!_TIFFFillStriles(tif))
  ------------------
  |  Branch (4085:7): [True: 0, False: 665]
  ------------------
 4086|      0|		    goto bad;
 4087|    665|		dp=TIFFReadDirectoryFindEntry(tif,dir,dircount,TIFFTAG_STRIPOFFSETS);
  ------------------
  |  |  241|    665|#define	TIFFTAG_STRIPOFFSETS		273	/* offsets to data strips */
  ------------------
 4088|    665|		if ((dp!=0)&&(dp->tdir_count==1))
  ------------------
  |  Branch (4088:7): [True: 652, False: 13]
  |  Branch (4088:16): [True: 25, False: 627]
  ------------------
 4089|     25|		{
 4090|     25|			dp=TIFFReadDirectoryFindEntry(tif,dir,dircount,
 4091|     25|			    TIFFTAG_STRIPBYTECOUNTS);
  ------------------
  |  |  253|     25|#define	TIFFTAG_STRIPBYTECOUNTS		279	/* bytes counts for strips */
  ------------------
 4092|     25|			if ((dp!=0)&&(dp->tdir_count==1))
  ------------------
  |  Branch (4092:8): [True: 19, False: 6]
  |  Branch (4092:17): [True: 10, False: 9]
  ------------------
 4093|     10|			{
 4094|     10|				tif->tif_dir.td_planarconfig=PLANARCONFIG_CONTIG;
  ------------------
  |  |  259|     10|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
 4095|     10|				TIFFWarningExtR(tif,module,
 4096|     10|				    "Planarconfig tag value assumed incorrect, "
 4097|     10|				    "assuming data is contig instead of chunky");
 4098|     10|			}
 4099|     25|		}
 4100|    665|	}
 4101|       |	/*
 4102|       |	 * Allocate directory structure and setup defaults.
 4103|       |	 */
 4104|  21.8k|	if (!TIFFFieldSet(tif,FIELD_IMAGEDIMENSIONS))
  ------------------
  |  |  198|  21.8k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  21.8k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  21.8k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4104:6): [True: 376, False: 21.4k]
  ------------------
 4105|    376|	{
 4106|    376|		MissingRequired(tif,"ImageLength");
 4107|    376|		goto bad;
 4108|    376|	}
 4109|       |
 4110|       |	/*
 4111|       |	 * Second pass: extract other information.
 4112|       |	 */
 4113|   488k|	for (di=0, dp=dir; di<dircount; di++, dp++)
  ------------------
  |  Branch (4113:21): [True: 467k, False: 21.0k]
  ------------------
 4114|   467k|	{
 4115|   467k|		if (!dp->tdir_ignore) {
  ------------------
  |  Branch (4115:7): [True: 203k, False: 264k]
  ------------------
 4116|   203k|			switch (dp->tdir_tag) 
 4117|   203k|			{
 4118|    136|				case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  254|    136|#define	TIFFTAG_MINSAMPLEVALUE		280	/* +minimum sample value */
  ------------------
  |  Branch (4118:5): [True: 136, False: 202k]
  ------------------
 4119|    189|				case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  255|    189|#define	TIFFTAG_MAXSAMPLEVALUE		281	/* +maximum sample value */
  ------------------
  |  Branch (4119:5): [True: 53, False: 203k]
  ------------------
 4120|  6.54k|				case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  174|  6.54k|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
  |  Branch (4120:5): [True: 6.35k, False: 196k]
  ------------------
 4121|  6.58k|				case TIFFTAG_DATATYPE:
  ------------------
  |  |  405|  6.58k|#define	TIFFTAG_DATATYPE		32996	/* $use SampleFormat */
  ------------------
  |  Branch (4121:5): [True: 43, False: 203k]
  ------------------
 4122|  6.72k|				case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  327|  6.72k|#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
  ------------------
  |  Branch (4122:5): [True: 136, False: 202k]
  ------------------
 4123|       |					/*
 4124|       |					 * The MinSampleValue, MaxSampleValue, BitsPerSample
 4125|       |					 * DataType and SampleFormat tags are supposed to be
 4126|       |					 * written as one value/sample, but some vendors
 4127|       |					 * incorrectly write one value only -- so we accept
 4128|       |					 * that as well (yuck). Other vendors write correct
 4129|       |					 * value for NumberOfSamples, but incorrect one for
 4130|       |					 * BitsPerSample and friends, and we will read this
 4131|       |					 * too.
 4132|       |					 */
 4133|  6.72k|					{
 4134|  6.72k|						uint16_t value;
 4135|  6.72k|						enum TIFFReadDirEntryErr err;
 4136|  6.72k|						err=TIFFReadDirEntryShort(tif,dp,&value);
 4137|  6.72k|						if (err==TIFFReadDirEntryErrCount)
  ------------------
  |  Branch (4137:11): [True: 616, False: 6.10k]
  ------------------
 4138|    616|							err=TIFFReadDirEntryPersampleShort(tif,dp,&value);
 4139|  6.72k|						if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4139:11): [True: 237, False: 6.48k]
  ------------------
 4140|    237|						{
 4141|    237|							fip = TIFFFieldWithTag(tif,dp->tdir_tag);
 4142|    237|							TIFFReadDirEntryOutputErr(tif,err,module,fip ? fip->field_name : "unknown tagname",0);
  ------------------
  |  Branch (4142:49): [True: 237, False: 0]
  ------------------
 4143|    237|							goto bad;
 4144|    237|						}
 4145|  6.48k|						if (!TIFFSetField(tif,dp->tdir_tag,value))
  ------------------
  |  Branch (4145:11): [True: 13, False: 6.47k]
  ------------------
 4146|     13|							goto bad;
 4147|  6.47k|						if( dp->tdir_tag == TIFFTAG_BITSPERSAMPLE )
  ------------------
  |  |  174|  6.47k|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
  |  Branch (4147:11): [True: 6.21k, False: 256]
  ------------------
 4148|  6.21k|						    bitspersample_read = TRUE;
  ------------------
  |  |   61|  6.21k|#define	TRUE	1
  ------------------
 4149|  6.47k|					}
 4150|      0|					break;
 4151|    232|				case TIFFTAG_SMINSAMPLEVALUE:
  ------------------
  |  |  334|    232|#define	TIFFTAG_SMINSAMPLEVALUE		340	/* !variable MinSampleValue */
  ------------------
  |  Branch (4151:5): [True: 232, False: 202k]
  ------------------
 4152|    382|				case TIFFTAG_SMAXSAMPLEVALUE:
  ------------------
  |  |  335|    382|#define	TIFFTAG_SMAXSAMPLEVALUE		341	/* !variable MaxSampleValue */
  ------------------
  |  Branch (4152:5): [True: 150, False: 202k]
  ------------------
 4153|    382|					{
 4154|       |
 4155|    382|						double *data = NULL;
 4156|    382|						enum TIFFReadDirEntryErr err;
 4157|    382|						uint32_t saved_flags;
 4158|    382|						int m;
 4159|    382|						if (dp->tdir_count != (uint64_t)tif->tif_dir.td_samplesperpixel)
  ------------------
  |  Branch (4159:11): [True: 114, False: 268]
  ------------------
 4160|    114|							err = TIFFReadDirEntryErrCount;
 4161|    268|						else
 4162|    268|							err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
 4163|    382|						if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4163:11): [True: 128, False: 254]
  ------------------
 4164|    128|						{
 4165|    128|							fip = TIFFFieldWithTag(tif,dp->tdir_tag);
 4166|    128|							TIFFReadDirEntryOutputErr(tif,err,module,fip ? fip->field_name : "unknown tagname",0);
  ------------------
  |  Branch (4166:49): [True: 128, False: 0]
  ------------------
 4167|    128|							goto bad;
 4168|    128|						}
 4169|    254|						saved_flags = tif->tif_flags;
 4170|    254|						tif->tif_flags |= TIFF_PERSAMPLE;
  ------------------
  |  |  113|    254|        #define TIFF_PERSAMPLE  0x400000U /* get/set per sample tags as arrays */
  ------------------
 4171|    254|						m = TIFFSetField(tif,dp->tdir_tag,data);
 4172|    254|						tif->tif_flags = saved_flags;
 4173|    254|						_TIFFfree(data);
 4174|    254|						if (!m)
  ------------------
  |  Branch (4174:11): [True: 0, False: 254]
  ------------------
 4175|      0|							goto bad;
 4176|    254|					}
 4177|    254|					break;
 4178|  9.08k|				case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  241|  9.08k|#define	TIFFTAG_STRIPOFFSETS		273	/* offsets to data strips */
  ------------------
  |  Branch (4178:5): [True: 9.08k, False: 193k]
  ------------------
 4179|  16.2k|				case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  307|  16.2k|#define TIFFTAG_TILEOFFSETS		324	/* !offsets to data tiles */
  ------------------
  |  Branch (4179:5): [True: 7.16k, False: 195k]
  ------------------
 4180|  16.2k|					switch( dp->tdir_type )
 4181|  16.2k|					{
 4182|    301|					    case TIFF_SHORT:
  ------------------
  |  Branch (4182:10): [True: 301, False: 15.9k]
  ------------------
 4183|  3.17k|					    case TIFF_LONG:
  ------------------
  |  Branch (4183:10): [True: 2.87k, False: 13.3k]
  ------------------
 4184|  4.31k|					    case TIFF_LONG8:
  ------------------
  |  Branch (4184:10): [True: 1.13k, False: 15.1k]
  ------------------
 4185|  4.31k|					        break;
 4186|  11.9k|					    default:
  ------------------
  |  Branch (4186:10): [True: 11.9k, False: 4.31k]
  ------------------
 4187|       |                                                /* Warn except if directory typically created with TIFFDeferStrileArrayWriting() */
 4188|  11.9k|                                                if( !(tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (4188:55): [True: 0, False: 11.9k]
  ------------------
 4189|  11.9k|                                                      dp->tdir_count == 0 &&
  ------------------
  |  Branch (4189:55): [True: 0, False: 0]
  ------------------
 4190|  11.9k|                                                      dp->tdir_type == 0 &&
  ------------------
  |  Branch (4190:55): [True: 0, False: 0]
  ------------------
 4191|  11.9k|                                                      dp->tdir_offset.toff_long8 == 0) )
  ------------------
  |  Branch (4191:55): [True: 0, False: 0]
  ------------------
 4192|  11.9k|                                                {
 4193|  11.9k|                                                    fip = TIFFFieldWithTag(tif,dp->tdir_tag);
 4194|  11.9k|                                                    TIFFWarningExtR(tif,module,
 4195|  11.9k|                                                                   "Invalid data type for tag %s",
 4196|  11.9k|                                                                   fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4196:68): [True: 11.9k, False: 0]
  ------------------
 4197|  11.9k|                                                }
 4198|  11.9k|                                                break;
 4199|  16.2k|                                        }
 4200|  16.2k|					_TIFFmemcpy( &(tif->tif_dir.td_stripoffset_entry),
 4201|  16.2k|					   dp, sizeof(TIFFDirEntry) );
 4202|  16.2k|					break;
 4203|  6.77k|				case TIFFTAG_STRIPBYTECOUNTS:
  ------------------
  |  |  253|  6.77k|#define	TIFFTAG_STRIPBYTECOUNTS		279	/* bytes counts for strips */
  ------------------
  |  Branch (4203:5): [True: 6.77k, False: 196k]
  ------------------
 4204|  10.4k|				case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  308|  10.4k|#define TIFFTAG_TILEBYTECOUNTS		325	/* !byte counts for tiles */
  ------------------
  |  Branch (4204:5): [True: 3.66k, False: 199k]
  ------------------
 4205|  10.4k|					switch( dp->tdir_type )
 4206|  10.4k|					{
 4207|    726|					    case TIFF_SHORT:
  ------------------
  |  Branch (4207:10): [True: 726, False: 9.71k]
  ------------------
 4208|  1.78k|					    case TIFF_LONG:
  ------------------
  |  Branch (4208:10): [True: 1.05k, False: 9.38k]
  ------------------
 4209|  3.80k|					    case TIFF_LONG8:
  ------------------
  |  Branch (4209:10): [True: 2.02k, False: 8.41k]
  ------------------
 4210|  3.80k|					        break;
 4211|  6.63k|					    default:
  ------------------
  |  Branch (4211:10): [True: 6.63k, False: 3.80k]
  ------------------
 4212|       |						/* Warn except if directory typically created with TIFFDeferStrileArrayWriting() */
 4213|  6.63k|                                                if( !(tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (4213:55): [True: 0, False: 6.63k]
  ------------------
 4214|  6.63k|                                                      dp->tdir_count == 0 &&
  ------------------
  |  Branch (4214:55): [True: 0, False: 0]
  ------------------
 4215|  6.63k|                                                      dp->tdir_type == 0 &&
  ------------------
  |  Branch (4215:55): [True: 0, False: 0]
  ------------------
 4216|  6.63k|                                                      dp->tdir_offset.toff_long8 == 0) )
  ------------------
  |  Branch (4216:55): [True: 0, False: 0]
  ------------------
 4217|  6.63k|                                                {
 4218|  6.63k|                                                    fip = TIFFFieldWithTag(tif,dp->tdir_tag);
 4219|  6.63k|                                                    TIFFWarningExtR(tif,module,
 4220|  6.63k|                                                                   "Invalid data type for tag %s",
 4221|  6.63k|                                                                   fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4221:68): [True: 6.63k, False: 0]
  ------------------
 4222|  6.63k|                                                }
 4223|  6.63k|                                                break;
 4224|  10.4k|                                        }
 4225|  10.4k|					_TIFFmemcpy( &(tif->tif_dir.td_stripbytecount_entry),
 4226|  10.4k|					   dp, sizeof(TIFFDirEntry) );
 4227|  10.4k|					break;
 4228|    361|				case TIFFTAG_COLORMAP:
  ------------------
  |  |  303|    361|#define	TIFFTAG_COLORMAP		320	/* RGB map for palette image */
  ------------------
  |  Branch (4228:5): [True: 361, False: 202k]
  ------------------
 4229|    562|				case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  292|    562|#define	TIFFTAG_TRANSFERFUNCTION	301	/* !colorimetry info */
  ------------------
  |  Branch (4229:5): [True: 201, False: 202k]
  ------------------
 4230|    562|					{
 4231|    562|						enum TIFFReadDirEntryErr err;
 4232|    562|						uint32_t countpersample;
 4233|    562|						uint32_t countrequired;
 4234|    562|						uint32_t incrementpersample;
 4235|    562|						uint16_t* value=NULL;
 4236|       |						/* It would be dangerous to instantiate those tag values */
 4237|       |						/* since if td_bitspersample has not yet been read (due to */
 4238|       |						/* unordered tags), it could be read afterwards with a */
 4239|       |						/* values greater than the default one (1), which may cause */
 4240|       |						/* crashes in user code */
 4241|    562|						if( !bitspersample_read )
  ------------------
  |  Branch (4241:11): [True: 160, False: 402]
  ------------------
 4242|    160|						{
 4243|    160|							fip = TIFFFieldWithTag(tif,dp->tdir_tag);
 4244|    160|							TIFFWarningExtR(tif,module,
 4245|    160|								"Ignoring %s since BitsPerSample tag not found",
 4246|    160|								fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4246:9): [True: 160, False: 0]
  ------------------
 4247|    160|							continue;
 4248|    160|						}
 4249|       |						/* ColorMap or TransferFunction for high bit */
 4250|       |						/* depths do not make much sense and could be */
 4251|       |						/* used as a denial of service vector */
 4252|    402|						if (tif->tif_dir.td_bitspersample > 24)
  ------------------
  |  Branch (4252:11): [True: 13, False: 389]
  ------------------
 4253|     13|						{
 4254|     13|							fip = TIFFFieldWithTag(tif,dp->tdir_tag);
 4255|     13|							TIFFWarningExtR(tif,module,
 4256|     13|								"Ignoring %s because BitsPerSample=%"PRIu16">24",
 4257|     13|								fip ? fip->field_name : "unknown tagname",
  ------------------
  |  Branch (4257:9): [True: 13, False: 0]
  ------------------
 4258|     13|								tif->tif_dir.td_bitspersample);
 4259|     13|							continue;
 4260|     13|						}
 4261|    389|						countpersample=(1U<<tif->tif_dir.td_bitspersample);
 4262|    389|						if ((dp->tdir_tag==TIFFTAG_TRANSFERFUNCTION)&&(dp->tdir_count==(uint64_t)countpersample))
  ------------------
  |  |  292|    389|#define	TIFFTAG_TRANSFERFUNCTION	301	/* !colorimetry info */
  ------------------
  |  Branch (4262:11): [True: 145, False: 244]
  |  Branch (4262:53): [True: 4, False: 141]
  ------------------
 4263|      4|						{
 4264|      4|							countrequired=countpersample;
 4265|      4|							incrementpersample=0;
 4266|      4|						}
 4267|    385|						else
 4268|    385|						{
 4269|    385|							countrequired=3*countpersample;
 4270|    385|							incrementpersample=countpersample;
 4271|    385|						}
 4272|    389|						if (dp->tdir_count!=(uint64_t)countrequired)
  ------------------
  |  Branch (4272:11): [True: 313, False: 76]
  ------------------
 4273|    313|							err=TIFFReadDirEntryErrCount;
 4274|     76|						else
 4275|     76|							err=TIFFReadDirEntryShortArray(tif,dp,&value);
 4276|    389|						if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4276:11): [True: 320, False: 69]
  ------------------
 4277|    320|						{
 4278|    320|							fip = TIFFFieldWithTag(tif,dp->tdir_tag);
 4279|    320|							TIFFReadDirEntryOutputErr(tif,err,module,fip ? fip->field_name : "unknown tagname",1);
  ------------------
  |  Branch (4279:49): [True: 320, False: 0]
  ------------------
 4280|    320|						}
 4281|     69|						else
 4282|     69|						{
 4283|     69|							TIFFSetField(tif,dp->tdir_tag,value,value+incrementpersample,value+2*incrementpersample);
 4284|     69|							_TIFFfree(value);
 4285|     69|						}
 4286|    389|					}
 4287|      0|					break;
 4288|       |/* BEGIN REV 4.0 COMPATIBILITY */
 4289|      0|				case TIFFTAG_OSUBFILETYPE:
  ------------------
  |  |  168|      0|#define	TIFFTAG_OSUBFILETYPE		255	/* +kind of data in subfile */
  ------------------
  |  Branch (4289:5): [True: 0, False: 203k]
  ------------------
 4290|      0|					{
 4291|      0|						uint16_t valueo;
 4292|      0|						uint32_t value;
 4293|      0|						if (TIFFReadDirEntryShort(tif,dp,&valueo)==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4293:11): [True: 0, False: 0]
  ------------------
 4294|      0|						{
 4295|      0|							switch (valueo)
 4296|      0|							{
 4297|      0|								case OFILETYPE_REDUCEDIMAGE: value=FILETYPE_REDUCEDIMAGE; break;
  ------------------
  |  |  170|      0|#define	    OFILETYPE_REDUCEDIMAGE	2	/* reduced size image data */
  ------------------
              								case OFILETYPE_REDUCEDIMAGE: value=FILETYPE_REDUCEDIMAGE; break;
  ------------------
  |  |  165|      0|#define	    FILETYPE_REDUCEDIMAGE	0x1	/* reduced resolution version */
  ------------------
  |  Branch (4297:9): [True: 0, False: 0]
  ------------------
 4298|      0|								case OFILETYPE_PAGE: value=FILETYPE_PAGE; break;
  ------------------
  |  |  171|      0|#define	    OFILETYPE_PAGE		3	/* one page of many */
  ------------------
              								case OFILETYPE_PAGE: value=FILETYPE_PAGE; break;
  ------------------
  |  |  166|      0|#define	    FILETYPE_PAGE		0x2	/* one page of many */
  ------------------
  |  Branch (4298:9): [True: 0, False: 0]
  ------------------
 4299|      0|								default: value=0; break;
  ------------------
  |  Branch (4299:9): [True: 0, False: 0]
  ------------------
 4300|      0|							}
 4301|      0|							if (value!=0)
  ------------------
  |  Branch (4301:12): [True: 0, False: 0]
  ------------------
 4302|      0|								TIFFSetField(tif,TIFFTAG_SUBFILETYPE,value);
  ------------------
  |  |  164|      0|#define	TIFFTAG_SUBFILETYPE		254	/* subfile data descriptor */
  ------------------
 4303|      0|						}
 4304|      0|					}
 4305|      0|					break;
 4306|       |/* END REV 4.0 COMPATIBILITY */
 4307|   168k|				default:
  ------------------
  |  Branch (4307:5): [True: 168k, False: 34.3k]
  ------------------
 4308|   168k|					(void) TIFFFetchNormalTag(tif, dp, TRUE);
  ------------------
  |  |   61|   168k|#define	TRUE	1
  ------------------
 4309|   168k|					break;
 4310|   203k|				}
 4311|   203k|			} /* -- if (!dp->tdir_ignore) */
 4312|   467k|		} /* -- for-loop -- */
 4313|       |
 4314|       |	/*
 4315|       |	 * OJPEG hack:
 4316|       |	 * - If a) compression is OJPEG, and b) photometric tag is missing,
 4317|       |	 * then we consistently find that photometric should be YCbCr
 4318|       |	 * - If a) compression is OJPEG, and b) photometric tag says it's RGB,
 4319|       |	 * then we consistently find that the buggy implementation of the
 4320|       |	 * buggy compression scheme matches photometric YCbCr instead.
 4321|       |	 * - If a) compression is OJPEG, and b) bitspersample tag is missing,
 4322|       |	 * then we consistently find bitspersample should be 8.
 4323|       |	 * - If a) compression is OJPEG, b) samplesperpixel tag is missing,
 4324|       |	 * and c) photometric is RGB or YCbCr, then we consistently find
 4325|       |	 * samplesperpixel should be 3
 4326|       |	 * - If a) compression is OJPEG, b) samplesperpixel tag is missing,
 4327|       |	 * and c) photometric is MINISWHITE or MINISBLACK, then we consistently
 4328|       |	 * find samplesperpixel should be 3
 4329|       |	 */
 4330|  21.0k|	if (tif->tif_dir.td_compression==COMPRESSION_OJPEG)
  ------------------
  |  |  183|  21.0k|#define	    COMPRESSION_OJPEG		6	/* !6.0 JPEG */
  ------------------
  |  Branch (4330:6): [True: 3.28k, False: 17.7k]
  ------------------
 4331|  3.28k|	{
 4332|  3.28k|		if (!TIFFFieldSet(tif,FIELD_PHOTOMETRIC))
  ------------------
  |  |  198|  3.28k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  3.28k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  3.28k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4332:7): [True: 3.18k, False: 100]
  ------------------
 4333|  3.18k|		{
 4334|  3.18k|			TIFFWarningExtR(tif, module,
 4335|  3.18k|			    "Photometric tag is missing, assuming data is YCbCr");
 4336|  3.18k|			if (!TIFFSetField(tif,TIFFTAG_PHOTOMETRIC,PHOTOMETRIC_YCBCR))
  ------------------
  |  |  214|  3.18k|#define	TIFFTAG_PHOTOMETRIC		262	/* photometric interpretation */
  ------------------
              			if (!TIFFSetField(tif,TIFFTAG_PHOTOMETRIC,PHOTOMETRIC_YCBCR))
  ------------------
  |  |  221|  3.18k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (4336:8): [True: 0, False: 3.18k]
  ------------------
 4337|      0|				goto bad;
 4338|  3.18k|		}
 4339|    100|		else if (tif->tif_dir.td_photometric==PHOTOMETRIC_RGB)
  ------------------
  |  |  217|    100|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  |  Branch (4339:12): [True: 2, False: 98]
  ------------------
 4340|      2|		{
 4341|      2|			tif->tif_dir.td_photometric=PHOTOMETRIC_YCBCR;
  ------------------
  |  |  221|      2|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
 4342|      2|			TIFFWarningExtR(tif, module,
 4343|      2|			    "Photometric tag value assumed incorrect, "
 4344|      2|			    "assuming data is YCbCr instead of RGB");
 4345|      2|		}
 4346|  3.28k|		if (!TIFFFieldSet(tif,FIELD_BITSPERSAMPLE))
  ------------------
  |  |  198|  3.28k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  3.28k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  3.28k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4346:7): [True: 3.17k, False: 113]
  ------------------
 4347|  3.17k|		{
 4348|  3.17k|			TIFFWarningExtR(tif,module,
 4349|  3.17k|			    "BitsPerSample tag is missing, assuming 8 bits per sample");
 4350|  3.17k|			if (!TIFFSetField(tif,TIFFTAG_BITSPERSAMPLE,8))
  ------------------
  |  |  174|  3.17k|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
  |  Branch (4350:8): [True: 0, False: 3.17k]
  ------------------
 4351|      0|				goto bad;
 4352|  3.17k|		}
 4353|  3.28k|		if (!TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  198|  3.28k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  3.28k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  3.28k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4353:7): [True: 3.10k, False: 186]
  ------------------
 4354|  3.10k|		{
 4355|  3.10k|			if (tif->tif_dir.td_photometric==PHOTOMETRIC_RGB)
  ------------------
  |  |  217|  3.10k|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  |  Branch (4355:8): [True: 0, False: 3.10k]
  ------------------
 4356|      0|			{
 4357|      0|				TIFFWarningExtR(tif,module,
 4358|      0|				    "SamplesPerPixel tag is missing, "
 4359|      0|				    "assuming correct SamplesPerPixel value is 3");
 4360|      0|				if (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,3))
  ------------------
  |  |  251|      0|#define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
  ------------------
  |  Branch (4360:9): [True: 0, False: 0]
  ------------------
 4361|      0|					goto bad;
 4362|      0|			}
 4363|  3.10k|			if (tif->tif_dir.td_photometric==PHOTOMETRIC_YCBCR)
  ------------------
  |  |  221|  3.10k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (4363:8): [True: 3.04k, False: 56]
  ------------------
 4364|  3.04k|			{
 4365|  3.04k|				TIFFWarningExtR(tif,module,
 4366|  3.04k|				    "SamplesPerPixel tag is missing, "
 4367|  3.04k|				    "applying correct SamplesPerPixel value of 3");
 4368|  3.04k|				if (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,3))
  ------------------
  |  |  251|  3.04k|#define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
  ------------------
  |  Branch (4368:9): [True: 0, False: 3.04k]
  ------------------
 4369|      0|					goto bad;
 4370|  3.04k|			}
 4371|     56|			else if ((tif->tif_dir.td_photometric==PHOTOMETRIC_MINISWHITE)
  ------------------
  |  |  215|     56|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  |  Branch (4371:13): [True: 5, False: 51]
  ------------------
 4372|     56|				 || (tif->tif_dir.td_photometric==PHOTOMETRIC_MINISBLACK))
  ------------------
  |  |  216|     51|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  |  Branch (4372:9): [True: 31, False: 20]
  ------------------
 4373|     36|			{
 4374|       |				/*
 4375|       |				 * SamplesPerPixel tag is missing, but is not required
 4376|       |				 * by spec.  Assume correct SamplesPerPixel value of 1.
 4377|       |				 */
 4378|     36|				if (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,1))
  ------------------
  |  |  251|     36|#define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
  ------------------
  |  Branch (4378:9): [True: 0, False: 36]
  ------------------
 4379|      0|					goto bad;
 4380|     36|			}
 4381|  3.10k|		}
 4382|  3.28k|	}
 4383|       |
 4384|       |	/*
 4385|       |	 * Setup appropriate structures (by strip or by tile)
 4386|       |	 * We do that only after the above OJPEG hack which alters SamplesPerPixel
 4387|       |	 * and thus influences the number of strips in the separate planarconfig.
 4388|       |	 */
 4389|  21.0k|	if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) {
  ------------------
  |  |  198|  21.0k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  21.0k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  21.0k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4389:6): [True: 8.39k, False: 12.6k]
  ------------------
 4390|  8.39k|		tif->tif_dir.td_nstrips = TIFFNumberOfStrips(tif);  
 4391|  8.39k|		tif->tif_dir.td_tilewidth = tif->tif_dir.td_imagewidth;
 4392|  8.39k|		tif->tif_dir.td_tilelength = tif->tif_dir.td_rowsperstrip;
 4393|  8.39k|		tif->tif_dir.td_tiledepth = tif->tif_dir.td_imagedepth;
 4394|  8.39k|		tif->tif_flags &= ~TIFF_ISTILED;
  ------------------
  |  |  101|  8.39k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  ------------------
 4395|  12.6k|	} else {
 4396|  12.6k|		tif->tif_dir.td_nstrips = TIFFNumberOfTiles(tif);
 4397|  12.6k|		tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  101|  12.6k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  ------------------
 4398|  12.6k|	}
 4399|  21.0k|	if (!tif->tif_dir.td_nstrips) {
  ------------------
  |  Branch (4399:6): [True: 313, False: 20.7k]
  ------------------
 4400|    313|		TIFFErrorExtR(tif, module,
 4401|    313|		    "Cannot handle zero number of %s",
 4402|    313|		    isTiled(tif) ? "tiles" : "strips");
  ------------------
  |  |  207|    313|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|    313|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 234, False: 79]
  |  |  ------------------
  ------------------
 4403|    313|		goto bad;
 4404|    313|	}
 4405|  20.7k|	tif->tif_dir.td_stripsperimage = tif->tif_dir.td_nstrips;
 4406|  20.7k|	if (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  260|  20.7k|#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  ------------------
  |  Branch (4406:6): [True: 1.05k, False: 19.6k]
  ------------------
 4407|  1.05k|		tif->tif_dir.td_stripsperimage /= tif->tif_dir.td_samplesperpixel;
 4408|  20.7k|	if (!TIFFFieldSet(tif, FIELD_STRIPOFFSETS)) {
  ------------------
  |  |  198|  20.7k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  20.7k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  20.7k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4408:6): [True: 4.79k, False: 15.9k]
  ------------------
 4409|  4.79k|#ifdef OJPEG_SUPPORT
 4410|  4.79k|		if ((tif->tif_dir.td_compression==COMPRESSION_OJPEG) &&
  ------------------
  |  |  183|  4.79k|#define	    COMPRESSION_OJPEG		6	/* !6.0 JPEG */
  ------------------
  |  Branch (4410:7): [True: 938, False: 3.85k]
  ------------------
 4411|  4.79k|		    (isTiled(tif)==0) &&
  ------------------
  |  |  207|    938|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|    938|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (4411:7): [True: 936, False: 2]
  ------------------
 4412|  4.79k|		    (tif->tif_dir.td_nstrips==1)) {
  ------------------
  |  Branch (4412:7): [True: 905, False: 31]
  ------------------
 4413|       |			/*
 4414|       |			 * XXX: OJPEG hack.
 4415|       |			 * If a) compression is OJPEG, b) it's not a tiled TIFF,
 4416|       |			 * and c) the number of strips is 1,
 4417|       |			 * then we tolerate the absence of stripoffsets tag,
 4418|       |			 * because, presumably, all required data is in the
 4419|       |			 * JpegInterchangeFormat stream.
 4420|       |			 */
 4421|    905|			TIFFSetFieldBit(tif, FIELD_STRIPOFFSETS);
  ------------------
  |  |  199|    905|#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  197|    905|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  196|    905|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
 4422|    905|		} else
 4423|  3.89k|#endif
 4424|  3.89k|        {
 4425|  3.89k|			MissingRequired(tif,
 4426|  3.89k|				isTiled(tif) ? "TileOffsets" : "StripOffsets");
  ------------------
  |  |  207|  3.89k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  3.89k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 31, False: 3.86k]
  |  |  ------------------
  ------------------
 4427|  3.89k|			goto bad;
 4428|  3.89k|		}
 4429|  4.79k|	}
 4430|       |
 4431|  16.8k|        if( tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (4431:13): [True: 0, False: 16.8k]
  ------------------
 4432|  16.8k|            tif->tif_dir.td_stripoffset_entry.tdir_tag != 0 &&
  ------------------
  |  Branch (4432:13): [True: 0, False: 0]
  ------------------
 4433|  16.8k|            tif->tif_dir.td_stripoffset_entry.tdir_count == 0 &&
  ------------------
  |  Branch (4433:13): [True: 0, False: 0]
  ------------------
 4434|  16.8k|            tif->tif_dir.td_stripoffset_entry.tdir_type == 0 &&
  ------------------
  |  Branch (4434:13): [True: 0, False: 0]
  ------------------
 4435|  16.8k|            tif->tif_dir.td_stripoffset_entry.tdir_offset.toff_long8 == 0 &&
  ------------------
  |  Branch (4435:13): [True: 0, False: 0]
  ------------------
 4436|  16.8k|            tif->tif_dir.td_stripbytecount_entry.tdir_tag != 0 &&
  ------------------
  |  Branch (4436:13): [True: 0, False: 0]
  ------------------
 4437|  16.8k|            tif->tif_dir.td_stripbytecount_entry.tdir_count == 0 &&
  ------------------
  |  Branch (4437:13): [True: 0, False: 0]
  ------------------
 4438|  16.8k|            tif->tif_dir.td_stripbytecount_entry.tdir_type == 0 &&
  ------------------
  |  Branch (4438:13): [True: 0, False: 0]
  ------------------
 4439|  16.8k|            tif->tif_dir.td_stripbytecount_entry.tdir_offset.toff_long8 == 0 )
  ------------------
  |  Branch (4439:13): [True: 0, False: 0]
  ------------------
 4440|      0|        {
 4441|       |            /* Directory typically created with TIFFDeferStrileArrayWriting() */
 4442|      0|            TIFFSetupStrips(tif);
 4443|      0|        }
 4444|  16.8k|        else if( !(tif->tif_flags&TIFF_DEFERSTRILELOAD) )
  ------------------
  |  |  115|  16.8k|        #define TIFF_DEFERSTRILELOAD 0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (4444:18): [True: 16.8k, False: 0]
  ------------------
 4445|  16.8k|        {
 4446|  16.8k|            if( tif->tif_dir.td_stripoffset_entry.tdir_tag != 0 )
  ------------------
  |  Branch (4446:17): [True: 15.9k, False: 905]
  ------------------
 4447|  15.9k|            {
 4448|  15.9k|                if (!TIFFFetchStripThing(tif,&(tif->tif_dir.td_stripoffset_entry),
  ------------------
  |  Branch (4448:21): [True: 775, False: 15.1k]
  ------------------
 4449|  15.9k|                                         tif->tif_dir.td_nstrips,
 4450|  15.9k|                                         &tif->tif_dir.td_stripoffset_p))
 4451|    775|                {
 4452|    775|                    goto bad;
 4453|    775|                }
 4454|  15.9k|            }
 4455|  16.0k|            if( tif->tif_dir.td_stripbytecount_entry.tdir_tag != 0 )
  ------------------
  |  Branch (4455:17): [True: 10.0k, False: 6.06k]
  ------------------
 4456|  10.0k|            {
 4457|  10.0k|                if (!TIFFFetchStripThing(tif,&(tif->tif_dir.td_stripbytecount_entry),
  ------------------
  |  Branch (4457:21): [True: 80, False: 9.93k]
  ------------------
 4458|  10.0k|                                         tif->tif_dir.td_nstrips,
 4459|  10.0k|                                         &tif->tif_dir.td_stripbytecount_p))
 4460|     80|                {
 4461|     80|                    goto bad;
 4462|     80|                }
 4463|  10.0k|            }
 4464|  16.0k|        }
 4465|       |
 4466|       |	/*
 4467|       |	 * Make sure all non-color channels are extrasamples.
 4468|       |	 * If it's not the case, define them as such.
 4469|       |	 */
 4470|  15.9k|        color_channels = _TIFFGetMaxColorChannels(tif->tif_dir.td_photometric);
 4471|  15.9k|        if (color_channels && tif->tif_dir.td_samplesperpixel - tif->tif_dir.td_extrasamples > color_channels) {
  ------------------
  |  Branch (4471:13): [True: 15.8k, False: 172]
  |  Branch (4471:31): [True: 970, False: 14.8k]
  ------------------
 4472|    970|                uint16_t old_extrasamples;
 4473|    970|                uint16_t *new_sampleinfo;
 4474|       |
 4475|    970|                TIFFWarningExtR(tif,module, "Sum of Photometric type-related "
 4476|    970|                    "color channels and ExtraSamples doesn't match SamplesPerPixel. "
 4477|    970|                    "Defining non-color channels as ExtraSamples.");
 4478|       |
 4479|    970|                old_extrasamples = tif->tif_dir.td_extrasamples;
 4480|    970|                tif->tif_dir.td_extrasamples = (uint16_t) (tif->tif_dir.td_samplesperpixel - color_channels);
 4481|       |
 4482|       |                // sampleinfo should contain information relative to these new extra samples
 4483|    970|                new_sampleinfo = (uint16_t*) _TIFFcalloc(tif->tif_dir.td_extrasamples, sizeof(uint16_t));
 4484|    970|                if (!new_sampleinfo) {
  ------------------
  |  Branch (4484:21): [True: 0, False: 970]
  ------------------
 4485|      0|                    TIFFErrorExtR(tif, module, "Failed to allocate memory for "
 4486|      0|                                                              "temporary new sampleinfo array "
 4487|      0|                                                              "(%"PRIu16" 16 bit elements)",
 4488|      0|                                tif->tif_dir.td_extrasamples);
 4489|      0|                    goto bad;
 4490|      0|                }
 4491|       |
 4492|    970|                if (old_extrasamples > 0)
  ------------------
  |  Branch (4492:21): [True: 92, False: 878]
  ------------------
 4493|     92|                    memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo, old_extrasamples * sizeof(uint16_t));
 4494|    970|                _TIFFsetShortArray(&tif->tif_dir.td_sampleinfo, new_sampleinfo, tif->tif_dir.td_extrasamples);
 4495|    970|                _TIFFfree(new_sampleinfo);
 4496|    970|        }
 4497|       |
 4498|       |	/*
 4499|       |	 * Verify Palette image has a Colormap.
 4500|       |	 */
 4501|  15.9k|	if (tif->tif_dir.td_photometric == PHOTOMETRIC_PALETTE &&
  ------------------
  |  |  218|  31.9k|#define	    PHOTOMETRIC_PALETTE		3	/* color map indexed */
  ------------------
  |  Branch (4501:6): [True: 121, False: 15.8k]
  ------------------
 4502|  15.9k|	    !TIFFFieldSet(tif, FIELD_COLORMAP)) {
  ------------------
  |  |  198|    121|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|    121|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|    121|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4502:6): [True: 60, False: 61]
  ------------------
 4503|     60|		if ( tif->tif_dir.td_bitspersample>=8 && tif->tif_dir.td_samplesperpixel==3)
  ------------------
  |  Branch (4503:8): [True: 43, False: 17]
  |  Branch (4503:44): [True: 1, False: 42]
  ------------------
 4504|      1|			tif->tif_dir.td_photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  217|      1|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
 4505|     59|		else if (tif->tif_dir.td_bitspersample>=8)
  ------------------
  |  Branch (4505:12): [True: 42, False: 17]
  ------------------
 4506|     42|			tif->tif_dir.td_photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  216|     42|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
 4507|     17|		else {
 4508|     17|			MissingRequired(tif, "Colormap");
 4509|     17|			goto bad;
 4510|     17|		}
 4511|     60|	}
 4512|       |	/*
 4513|       |	 * OJPEG hack:
 4514|       |	 * We do no further messing with strip/tile offsets/bytecounts in OJPEG
 4515|       |	 * TIFFs
 4516|       |	 */
 4517|  15.9k|	if (tif->tif_dir.td_compression!=COMPRESSION_OJPEG)
  ------------------
  |  |  183|  15.9k|#define	    COMPRESSION_OJPEG		6	/* !6.0 JPEG */
  ------------------
  |  Branch (4517:6): [True: 12.7k, False: 3.18k]
  ------------------
 4518|  12.7k|	{
 4519|       |		/*
 4520|       |		 * Attempt to deal with a missing StripByteCounts tag.
 4521|       |		 */
 4522|  12.7k|		if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS)) {
  ------------------
  |  |  198|  12.7k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  12.7k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  12.7k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4522:7): [True: 4.96k, False: 7.83k]
  ------------------
 4523|       |			/*
 4524|       |			 * Some manufacturers violate the spec by not giving
 4525|       |			 * the size of the strips.  In this case, assume there
 4526|       |			 * is one uncompressed strip of data.
 4527|       |			 */
 4528|  4.96k|			if ((tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  259|  9.92k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (4528:9): [True: 4.88k, False: 78]
  ------------------
 4529|  4.96k|			    tif->tif_dir.td_nstrips > 1) ||
  ------------------
  |  Branch (4529:8): [True: 36, False: 4.85k]
  ------------------
 4530|  4.96k|			    (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE &&
  ------------------
  |  |  260|  9.85k|#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  ------------------
  |  Branch (4530:9): [True: 78, False: 4.85k]
  ------------------
 4531|  4.92k|			     tif->tif_dir.td_nstrips != (uint32_t)tif->tif_dir.td_samplesperpixel)) {
  ------------------
  |  Branch (4531:9): [True: 18, False: 60]
  ------------------
 4532|     54|			    MissingRequired(tif, "StripByteCounts");
 4533|     54|			    goto bad;
 4534|     54|			}
 4535|  4.91k|			TIFFWarningExtR(tif, module,
 4536|  4.91k|				"TIFF directory is missing required "
 4537|  4.91k|				"\"StripByteCounts\" field, calculating from imagelength");
 4538|  4.91k|			if (EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (4538:8): [True: 79, False: 4.83k]
  ------------------
 4539|     79|			    goto bad;
 4540|       |
 4541|  7.83k|		} else if (tif->tif_dir.td_nstrips == 1
  ------------------
  |  Branch (4541:14): [True: 1.11k, False: 6.71k]
  ------------------
 4542|  7.83k|                           && !(tif->tif_flags&TIFF_ISTILED)
  ------------------
  |  |  101|  1.11k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  ------------------
  |  Branch (4542:31): [True: 780, False: 338]
  ------------------
 4543|  7.83k|			   && ByteCountLooksBad(tif)) {
  ------------------
  |  Branch (4543:10): [True: 70, False: 710]
  ------------------
 4544|       |			/*
 4545|       |			 * XXX: Plexus (and others) sometimes give a value of
 4546|       |			 * zero for a tag when they don't know what the
 4547|       |			 * correct value is!  Try and handle the simple case
 4548|       |			 * of estimating the size of a one strip image.
 4549|       |			 */
 4550|     70|			TIFFWarningExtR(tif, module,
 4551|     70|			    "Bogus \"StripByteCounts\" field, ignoring and calculating from imagelength");
 4552|     70|			if(EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (4552:7): [True: 3, False: 67]
  ------------------
 4553|      3|			    goto bad;
 4554|       |
 4555|  7.76k|		} else if (!(tif->tif_flags&TIFF_DEFERSTRILELOAD)
  ------------------
  |  |  115|  7.76k|        #define TIFF_DEFERSTRILELOAD 0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (4555:14): [True: 7.76k, False: 0]
  ------------------
 4556|  7.76k|			   && tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG
  ------------------
  |  |  259|  15.5k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (4556:10): [True: 7.44k, False: 316]
  ------------------
 4557|  7.76k|			   && tif->tif_dir.td_nstrips > 2
  ------------------
  |  Branch (4557:10): [True: 6.23k, False: 1.20k]
  ------------------
 4558|  7.76k|			   && tif->tif_dir.td_compression == COMPRESSION_NONE
  ------------------
  |  |  176|  13.9k|#define	    COMPRESSION_NONE		1	/* dump mode */
  ------------------
  |  Branch (4558:10): [True: 549, False: 5.69k]
  ------------------
 4559|  7.76k|			   && TIFFGetStrileByteCount(tif, 0) != TIFFGetStrileByteCount(tif, 1)
  ------------------
  |  Branch (4559:10): [True: 452, False: 97]
  ------------------
 4560|  7.76k|			   && TIFFGetStrileByteCount(tif, 0) != 0
  ------------------
  |  Branch (4560:10): [True: 445, False: 7]
  ------------------
 4561|  7.76k|			   && TIFFGetStrileByteCount(tif, 1) != 0 ) {
  ------------------
  |  Branch (4561:10): [True: 307, False: 138]
  ------------------
 4562|       |			/*
 4563|       |			 * XXX: Some vendors fill StripByteCount array with
 4564|       |			 * absolutely wrong values (it can be equal to
 4565|       |			 * StripOffset array, for example). Catch this case
 4566|       |			 * here.
 4567|       |                         *
 4568|       |                         * We avoid this check if deferring strile loading
 4569|       |                         * as it would always force us to load the strip/tile
 4570|       |                         * information.
 4571|       |			 */
 4572|    307|			TIFFWarningExtR(tif, module,
 4573|    307|			    "Wrong \"StripByteCounts\" field, ignoring and calculating from imagelength");
 4574|    307|			if (EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (4574:8): [True: 0, False: 307]
  ------------------
 4575|      0|			    goto bad;
 4576|    307|		}
 4577|  12.7k|	}
 4578|  15.8k|	if (dir)
  ------------------
  |  Branch (4578:6): [True: 15.8k, False: 0]
  ------------------
 4579|  15.8k|	{
 4580|  15.8k|		_TIFFfree(dir);
 4581|  15.8k|		dir=NULL;
 4582|  15.8k|	}
 4583|  15.8k|	if (!TIFFFieldSet(tif, FIELD_MAXSAMPLEVALUE))
  ------------------
  |  |  198|  15.8k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  15.8k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  15.8k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4583:6): [True: 15.8k, False: 12]
  ------------------
 4584|  15.8k|	{
 4585|  15.8k|		if (tif->tif_dir.td_bitspersample>=16)
  ------------------
  |  Branch (4585:7): [True: 602, False: 15.2k]
  ------------------
 4586|    602|			tif->tif_dir.td_maxsamplevalue=0xFFFF;
 4587|  15.2k|		else
 4588|  15.2k|			tif->tif_dir.td_maxsamplevalue = (uint16_t)((1L << tif->tif_dir.td_bitspersample) - 1);
 4589|  15.8k|	}
 4590|       |
 4591|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 4592|       |	/*
 4593|       |	 * XXX: We can optimize checking for the strip bounds using the sorted
 4594|       |	 * bytecounts array. See also comments for TIFFAppendToStrip()
 4595|       |	 * function in tif_write.c.
 4596|       |	 */
 4597|       |	if (!(tif->tif_flags&TIFF_DEFERSTRILELOAD) && tif->tif_dir.td_nstrips > 1) {
 4598|       |		uint32_t strip;
 4599|       |
 4600|       |		tif->tif_dir.td_stripbytecountsorted = 1;
 4601|       |		for (strip = 1; strip < tif->tif_dir.td_nstrips; strip++) {
 4602|       |			if (TIFFGetStrileOffset(tif, strip - 1) >
 4603|       |			    TIFFGetStrileOffset(tif, strip)) {
 4604|       |				tif->tif_dir.td_stripbytecountsorted = 0;
 4605|       |				break;
 4606|       |			}
 4607|       |		}
 4608|       |	}
 4609|       |#endif
 4610|       |
 4611|       |	/*
 4612|       |	 * An opportunity for compression mode dependent tag fixup
 4613|       |	 */
 4614|  15.8k|	(*tif->tif_fixuptags)(tif);
 4615|       |
 4616|       |	/*
 4617|       |	 * Some manufacturers make life difficult by writing
 4618|       |	 * large amounts of uncompressed data as a single strip.
 4619|       |	 * This is contrary to the recommendations of the spec.
 4620|       |	 * The following makes an attempt at breaking such images
 4621|       |	 * into strips closer to the recommended 8k bytes.  A
 4622|       |	 * side effect, however, is that the RowsPerStrip tag
 4623|       |	 * value may be changed.
 4624|       |	 */
 4625|  15.8k|	if ((tif->tif_dir.td_planarconfig==PLANARCONFIG_CONTIG)&&
  ------------------
  |  |  259|  15.8k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (4625:6): [True: 14.8k, False: 1.01k]
  ------------------
 4626|  15.8k|	    (tif->tif_dir.td_nstrips==1)&&
  ------------------
  |  Branch (4626:6): [True: 7.14k, False: 7.68k]
  ------------------
 4627|  15.8k|	    (tif->tif_dir.td_compression==COMPRESSION_NONE)&&  
  ------------------
  |  |  176|  7.14k|#define	    COMPRESSION_NONE		1	/* dump mode */
  ------------------
  |  Branch (4627:6): [True: 1.46k, False: 5.68k]
  ------------------
 4628|  15.8k|	    ((tif->tif_flags&(TIFF_STRIPCHOP|TIFF_ISTILED))==TIFF_STRIPCHOP))
  ------------------
  |  |  106|  1.46k|	#define TIFF_STRIPCHOP   0x08000U /* enable strip chopping support */
  ------------------
              	    ((tif->tif_flags&(TIFF_STRIPCHOP|TIFF_ISTILED))==TIFF_STRIPCHOP))
  ------------------
  |  |  101|  1.46k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  ------------------
              	    ((tif->tif_flags&(TIFF_STRIPCHOP|TIFF_ISTILED))==TIFF_STRIPCHOP))
  ------------------
  |  |  106|  1.46k|	#define TIFF_STRIPCHOP   0x08000U /* enable strip chopping support */
  ------------------
  |  Branch (4628:6): [True: 1.22k, False: 239]
  ------------------
 4629|  1.22k|        {
 4630|  1.22k|            ChopUpSingleUncompressedStrip(tif);
 4631|  1.22k|        }
 4632|       |
 4633|       |        /* There are also uncompressed striped files with strips larger than */
 4634|       |        /* 2 GB, which make them unfriendly with a lot of code. If possible, */
 4635|       |        /* try to expose smaller "virtual" strips. */
 4636|  15.8k|        if( tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  259|  31.6k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (4636:13): [True: 14.8k, False: 1.01k]
  ------------------
 4637|  15.8k|            tif->tif_dir.td_compression == COMPRESSION_NONE &&
  ------------------
  |  |  176|  30.6k|#define	    COMPRESSION_NONE		1	/* dump mode */
  ------------------
  |  Branch (4637:13): [True: 2.04k, False: 12.7k]
  ------------------
 4638|  15.8k|            (tif->tif_flags&(TIFF_STRIPCHOP|TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  106|  2.04k|	#define TIFF_STRIPCHOP   0x08000U /* enable strip chopping support */
  ------------------
                          (tif->tif_flags&(TIFF_STRIPCHOP|TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  101|  2.04k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  ------------------
                          (tif->tif_flags&(TIFF_STRIPCHOP|TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  106|  17.8k|	#define TIFF_STRIPCHOP   0x08000U /* enable strip chopping support */
  ------------------
  |  Branch (4638:13): [True: 1.55k, False: 490]
  ------------------
 4639|  15.8k|            TIFFStripSize64(tif) > 0x7FFFFFFFUL )
  ------------------
  |  Branch (4639:13): [True: 660, False: 893]
  ------------------
 4640|    660|        {
 4641|    660|            TryChopUpUncompressedBigTiff(tif);
 4642|    660|        }
 4643|       |
 4644|       |        /*
 4645|       |         * Clear the dirty directory flag. 
 4646|       |         */
 4647|  15.8k|	tif->tif_flags &= ~TIFF_DIRTYDIRECT;
  ------------------
  |  |   94|  15.8k|	#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 4648|  15.8k|	tif->tif_flags &= ~TIFF_DIRTYSTRIP;
  ------------------
  |  |  112|  15.8k|        #define TIFF_DIRTYSTRIP 0x200000U /* stripoffsets/stripbytecount dirty*/
  ------------------
 4649|       |
 4650|       |	/*
 4651|       |	 * Reinitialize i/o since we are starting on a new directory.
 4652|       |	 */
 4653|  15.8k|	tif->tif_row = (uint32_t) -1;
 4654|  15.8k|	tif->tif_curstrip = (uint32_t) -1;
 4655|  15.8k|	tif->tif_col = (uint32_t) -1;
 4656|  15.8k|	tif->tif_curtile = (uint32_t) -1;
 4657|  15.8k|	tif->tif_tilesize = (tmsize_t) -1;
 4658|       |
 4659|  15.8k|	tif->tif_scanlinesize = TIFFScanlineSize(tif);
 4660|  15.8k|	if (!tif->tif_scanlinesize) {
  ------------------
  |  Branch (4660:6): [True: 1.17k, False: 14.6k]
  ------------------
 4661|  1.17k|		TIFFErrorExtR(tif, module,
 4662|  1.17k|		    "Cannot handle zero scanline size");
 4663|  1.17k|		return (0);
 4664|  1.17k|	}
 4665|       |
 4666|  14.6k|	if (isTiled(tif)) {
  ------------------
  |  |  207|  14.6k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  14.6k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 12.1k, False: 2.47k]
  |  |  ------------------
  ------------------
 4667|  12.1k|		tif->tif_tilesize = TIFFTileSize(tif);
 4668|  12.1k|		if (!tif->tif_tilesize) {
  ------------------
  |  Branch (4668:7): [True: 6, False: 12.1k]
  ------------------
 4669|      6|			TIFFErrorExtR(tif, module,
 4670|      6|			     "Cannot handle zero tile size");
 4671|      6|			return (0);
 4672|      6|		}
 4673|  12.1k|	} else {
 4674|  2.47k|		if (!TIFFStripSize(tif)) {
  ------------------
  |  Branch (4674:7): [True: 1.40k, False: 1.07k]
  ------------------
 4675|  1.40k|			TIFFErrorExtR(tif, module,
 4676|  1.40k|			    "Cannot handle zero strip size");
 4677|  1.40k|			return (0);
 4678|  1.40k|		}
 4679|  2.47k|	}
 4680|  13.2k|	return (1);
 4681|  7.30k|bad:
 4682|  7.30k|	if (dir)
  ------------------
  |  Branch (4682:6): [True: 7.30k, False: 0]
  ------------------
 4683|  7.30k|		_TIFFfree(dir);
 4684|  7.30k|	return (0);
 4685|  14.6k|}
_TIFFCheckDirNumberAndOffset:
 5020|  23.4k|{
 5021|  23.4k|	uint16_t n;
 5022|       |
 5023|  23.4k|	if (diroff == 0)			/* no more directories */
  ------------------
  |  Branch (5023:6): [True: 0, False: 23.4k]
  ------------------
 5024|      0|		return 0;
 5025|  23.4k|	if (tif->tif_dirnumber == 65535) {
  ------------------
  |  Branch (5025:6): [True: 0, False: 23.4k]
  ------------------
 5026|      0|		TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5027|      0|			"Cannot handle more than 65535 TIFF directories");
 5028|      0|		return 0;
 5029|      0|	}
 5030|       |
 5031|       |	/* Check if offset is already in the list:
 5032|       |	 * - yes: check, if offset is at the same IFD number - if not, it is an IFD loop
 5033|       |	 * -  no: add to list or update offset at that IFD number
 5034|       |	 */
 5035|  23.4k|	for (n = 0; n < tif->tif_dirnumber && tif->tif_dirlistdirn && tif->tif_dirlistoff; n++) {
  ------------------
  |  Branch (5035:14): [True: 0, False: 23.4k]
  |  Branch (5035:40): [True: 0, False: 0]
  |  Branch (5035:64): [True: 0, False: 0]
  ------------------
 5036|      0|		if (tif->tif_dirlistoff[n] == diroff) {
  ------------------
  |  Branch (5036:7): [True: 0, False: 0]
  ------------------
 5037|      0|			if (tif->tif_dirlistdirn[n] == dirn) {
  ------------------
  |  Branch (5037:8): [True: 0, False: 0]
  ------------------
 5038|      0|				return 1;
 5039|      0|			} else {
 5040|      0|				TIFFWarningExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5041|      0|					"TIFF directory %d has IFD looping to directory %"PRIu16" at offset 0x%"PRIx64" (%"PRIu64")",
 5042|      0|					(int)dirn-1, tif->tif_dirlistdirn[n], diroff, diroff);
 5043|      0|				return 0;
 5044|      0|			}
 5045|      0|		}
 5046|      0|	}
 5047|       |	/* Check if offset of an IFD has been changed and update offset of that IFD number. */
 5048|  23.4k|	if (dirn < tif->tif_dirnumber && tif->tif_dirlistdirn && tif->tif_dirlistoff) {
  ------------------
  |  Branch (5048:6): [True: 0, False: 23.4k]
  |  Branch (5048:35): [True: 0, False: 0]
  |  Branch (5048:59): [True: 0, False: 0]
  ------------------
 5049|       |		/* tif_dirlistdirn can have IFD numbers dirn in random order */
 5050|      0|		for (n = 0; n < tif->tif_dirnumber; n++) {
  ------------------
  |  Branch (5050:15): [True: 0, False: 0]
  ------------------
 5051|      0|			if (tif->tif_dirlistdirn[n] == dirn) {
  ------------------
  |  Branch (5051:8): [True: 0, False: 0]
  ------------------
 5052|      0|				tif->tif_dirlistoff[n] = diroff;
 5053|      0|				return 1;
 5054|      0|			}
 5055|      0|		}
 5056|      0|	}
 5057|       |
 5058|       |	/* Add IFD offset and dirn to IFD directory list */
 5059|  23.4k|	tif->tif_dirnumber++;
 5060|       |
 5061|  23.4k|	if (tif->tif_dirlistoff == NULL || tif->tif_dirlistdirn == NULL || tif->tif_dirnumber > tif->tif_dirlistsize) {
  ------------------
  |  Branch (5061:6): [True: 23.4k, False: 0]
  |  Branch (5061:37): [True: 0, False: 0]
  |  Branch (5061:69): [True: 0, False: 0]
  ------------------
 5062|  23.4k|		uint64_t *new_dirlist;
 5063|       |		/*
 5064|       |		 * XXX: Reduce memory allocation granularity of the dirlist
 5065|       |		 * array.
 5066|       |		 */
 5067|  23.4k|		if (tif->tif_dirnumber >= 32768)
  ------------------
  |  Branch (5067:7): [True: 0, False: 23.4k]
  ------------------
 5068|      0|			tif->tif_dirlistsize = 65535;
 5069|  23.4k|		else
 5070|  23.4k|			tif->tif_dirlistsize = 2 * tif->tif_dirnumber;
 5071|       |
 5072|  23.4k|		new_dirlist = (uint64_t *)_TIFFCheckRealloc(tif, tif->tif_dirlistoff,
 5073|  23.4k|			tif->tif_dirlistsize, sizeof(uint64_t), "for IFD offset list");
 5074|  23.4k|		if (!new_dirlist)
  ------------------
  |  Branch (5074:7): [True: 0, False: 23.4k]
  ------------------
 5075|      0|			return 0;
 5076|  23.4k|		tif->tif_dirlistoff = new_dirlist;
 5077|  23.4k|		new_dirlist = (uint64_t *)_TIFFCheckRealloc(tif, tif->tif_dirlistdirn,
 5078|  23.4k|			tif->tif_dirlistsize, sizeof(uint16_t), "for IFD dirnumber list");
 5079|  23.4k|		if (!new_dirlist)
  ------------------
  |  Branch (5079:7): [True: 0, False: 23.4k]
  ------------------
 5080|      0|			return 0;
 5081|  23.4k|		tif->tif_dirlistdirn = (uint16_t *)new_dirlist;
 5082|  23.4k|	}
 5083|       |
 5084|  23.4k|	tif->tif_dirlistoff[tif->tif_dirnumber - 1] = diroff;
 5085|  23.4k|	tif->tif_dirlistdirn[tif->tif_dirnumber - 1] = dirn;
 5086|       |
 5087|  23.4k|	return 1;
 5088|  23.4k|}	/* --- _TIFFCheckDirNumberAndOffset() ---*/
TIFFGetStrileOffset:
 7116|   427k|{
 7117|   427k|    return TIFFGetStrileOffsetWithErr(tif, strile, NULL);
 7118|   427k|}
TIFFGetStrileOffsetWithErr:
 7122|  1.91M|{
 7123|  1.91M|    TIFFDirectory *td = &tif->tif_dir;
 7124|  1.91M|    return _TIFFGetStrileOffsetOrByteCountValue(tif, strile,
 7125|  1.91M|                               &(td->td_stripoffset_entry),
 7126|  1.91M|                               &(td->td_stripoffset_p), pbErr);
 7127|  1.91M|}
TIFFGetStrileByteCount:
 7131|  1.43M|{
 7132|  1.43M|    return TIFFGetStrileByteCountWithErr(tif, strile, NULL);
 7133|  1.43M|}
TIFFGetStrileByteCountWithErr:
 7137|  1.91M|{
 7138|  1.91M|    TIFFDirectory *td = &tif->tif_dir;
 7139|  1.91M|    return _TIFFGetStrileOffsetOrByteCountValue(tif, strile,
 7140|  1.91M|                               &(td->td_stripbytecount_entry),
 7141|  1.91M|                               &(td->td_stripbytecount_p), pbErr);
 7142|  1.91M|}
_TIFFFillStriles:
 7146|    665|{
 7147|    665|    return _TIFFFillStrilesInternal( tif, 1 );
 7148|    665|}
tif_dirread.c:TIFFReadDirEntryShort:
  382|  35.6k|{
  383|  35.6k|	enum TIFFReadDirEntryErr err;
  384|  35.6k|	if (direntry->tdir_count!=1)
  ------------------
  |  Branch (384:6): [True: 4.34k, False: 31.2k]
  ------------------
  385|  4.34k|		return(TIFFReadDirEntryErrCount);
  386|  31.2k|	switch (direntry->tdir_type)
  387|  31.2k|	{
  388|  2.17k|		case TIFF_BYTE:
  ------------------
  |  Branch (388:3): [True: 2.17k, False: 29.0k]
  ------------------
  389|  2.17k|			{
  390|  2.17k|				uint8_t m;
  391|  2.17k|				TIFFReadDirEntryCheckedByte(tif,direntry,&m);
  392|  2.17k|				*value=(uint16_t)m;
  393|  2.17k|				return(TIFFReadDirEntryErrOk);
  394|      0|			}
  395|  3.04k|		case TIFF_SBYTE:
  ------------------
  |  Branch (395:3): [True: 3.04k, False: 28.2k]
  ------------------
  396|  3.04k|			{
  397|  3.04k|				int8_t m;
  398|  3.04k|				TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
  399|  3.04k|				err=TIFFReadDirEntryCheckRangeShortSbyte(m);
  400|  3.04k|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (400:9): [True: 30, False: 3.01k]
  ------------------
  401|     30|					return(err);
  402|  3.01k|				*value=(uint16_t)m;
  403|  3.01k|				return(TIFFReadDirEntryErrOk);
  404|  3.04k|			}
  405|  22.7k|		case TIFF_SHORT:
  ------------------
  |  Branch (405:3): [True: 22.7k, False: 8.55k]
  ------------------
  406|  22.7k|			TIFFReadDirEntryCheckedShort(tif,direntry,value);
  407|  22.7k|			return(TIFFReadDirEntryErrOk);
  408|  1.32k|		case TIFF_SSHORT:
  ------------------
  |  Branch (408:3): [True: 1.32k, False: 29.9k]
  ------------------
  409|  1.32k|			{
  410|  1.32k|				int16_t m;
  411|  1.32k|				TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
  412|  1.32k|				err=TIFFReadDirEntryCheckRangeShortSshort(m);
  413|  1.32k|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (413:9): [True: 12, False: 1.31k]
  ------------------
  414|     12|					return(err);
  415|  1.31k|				*value=(uint16_t)m;
  416|  1.31k|				return(TIFFReadDirEntryErrOk);
  417|  1.32k|			}
  418|  1.44k|		case TIFF_LONG:
  ------------------
  |  Branch (418:3): [True: 1.44k, False: 29.8k]
  ------------------
  419|  1.44k|			{
  420|  1.44k|				uint32_t m;
  421|  1.44k|				TIFFReadDirEntryCheckedLong(tif,direntry,&m);
  422|  1.44k|				err=TIFFReadDirEntryCheckRangeShortLong(m);
  423|  1.44k|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (423:9): [True: 155, False: 1.28k]
  ------------------
  424|    155|					return(err);
  425|  1.28k|				*value=(uint16_t)m;
  426|  1.28k|				return(TIFFReadDirEntryErrOk);
  427|  1.44k|			}
  428|    146|		case TIFF_SLONG:
  ------------------
  |  Branch (428:3): [True: 146, False: 31.1k]
  ------------------
  429|    146|			{
  430|    146|				int32_t m;
  431|    146|				TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
  432|    146|				err=TIFFReadDirEntryCheckRangeShortSlong(m);
  433|    146|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (433:9): [True: 80, False: 66]
  ------------------
  434|     80|					return(err);
  435|     66|				*value=(uint16_t)m;
  436|     66|				return(TIFFReadDirEntryErrOk);
  437|    146|			}
  438|    138|		case TIFF_LONG8:
  ------------------
  |  Branch (438:3): [True: 138, False: 31.1k]
  ------------------
  439|    138|			{
  440|    138|				uint64_t m;
  441|    138|				err=TIFFReadDirEntryCheckedLong8(tif,direntry,&m);
  442|    138|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (442:9): [True: 23, False: 115]
  ------------------
  443|     23|					return(err);
  444|    115|				err=TIFFReadDirEntryCheckRangeShortLong8(m);
  445|    115|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (445:9): [True: 88, False: 27]
  ------------------
  446|     88|					return(err);
  447|     27|				*value=(uint16_t)m;
  448|     27|				return(TIFFReadDirEntryErrOk);
  449|    115|			}
  450|    204|		case TIFF_SLONG8:
  ------------------
  |  Branch (450:3): [True: 204, False: 31.0k]
  ------------------
  451|    204|			{
  452|    204|				int64_t m;
  453|    204|				err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
  454|    204|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (454:9): [True: 22, False: 182]
  ------------------
  455|     22|					return(err);
  456|    182|				err=TIFFReadDirEntryCheckRangeShortSlong8(m);
  457|    182|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (457:9): [True: 153, False: 29]
  ------------------
  458|    153|					return(err);
  459|     29|				*value=(uint16_t)m;
  460|     29|				return(TIFFReadDirEntryErrOk);
  461|    182|			}
  462|     73|		default:
  ------------------
  |  Branch (462:3): [True: 73, False: 31.1k]
  ------------------
  463|     73|			return(TIFFReadDirEntryErrType);
  464|  31.2k|	}
  465|  31.2k|}  /*-- TIFFReadDirEntryShort() --*/
tif_dirread.c:TIFFReadDirEntryCheckedByte:
 3191|  10.7k|{
 3192|  10.7k|	(void) tif;
 3193|  10.7k|	*value=*(uint8_t*)(&direntry->tdir_offset);
 3194|  10.7k|}
tif_dirread.c:TIFFReadDirEntryCheckedSbyte:
 3197|  8.42k|{
 3198|  8.42k|	(void) tif;
 3199|  8.42k|	*value=*(int8_t*)(&direntry->tdir_offset);
 3200|  8.42k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSbyte:
 3486|  4.21k|{
 3487|  4.21k|	if (value<0)
  ------------------
  |  Branch (3487:6): [True: 38, False: 4.17k]
  ------------------
 3488|     38|		return(TIFFReadDirEntryErrRange);
 3489|  4.17k|	else
 3490|  4.17k|		return(TIFFReadDirEntryErrOk);
 3491|  4.21k|}
tif_dirread.c:TIFFReadDirEntryCheckedShort:
 3203|  63.8k|{
 3204|  63.8k|	*value = direntry->tdir_offset.toff_short;
 3205|       |	/* *value=*(uint16_t*)(&direntry->tdir_offset); */
 3206|  63.8k|	if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  63.8k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3206:6): [True: 717, False: 63.0k]
  ------------------
 3207|    717|		TIFFSwabShort(value);
 3208|  63.8k|}
tif_dirread.c:TIFFReadDirEntryCheckedSshort:
 3211|  2.89k|{
 3212|  2.89k|	*value=*(int16_t*)(&direntry->tdir_offset);
 3213|  2.89k|	if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  2.89k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3213:6): [True: 125, False: 2.77k]
  ------------------
 3214|    125|		TIFFSwabShort((uint16_t*)value);
 3215|  2.89k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSshort:
 3494|  4.06k|{
 3495|  4.06k|	if (value<0)
  ------------------
  |  Branch (3495:6): [True: 22, False: 4.04k]
  ------------------
 3496|     22|		return(TIFFReadDirEntryErrRange);
 3497|  4.04k|	else
 3498|  4.04k|		return(TIFFReadDirEntryErrOk);
 3499|  4.06k|}
tif_dirread.c:TIFFReadDirEntryCheckedLong:
 3218|  7.07k|{
 3219|  7.07k|	*value=*(uint32_t*)(&direntry->tdir_offset);
 3220|  7.07k|	if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  7.07k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3220:6): [True: 467, False: 6.61k]
  ------------------
 3221|    467|		TIFFSwabLong(value);
 3222|  7.07k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortLong:
 3502|  2.00k|{
 3503|  2.00k|	if (value>0xFFFF)
  ------------------
  |  Branch (3503:6): [True: 210, False: 1.79k]
  ------------------
 3504|    210|		return(TIFFReadDirEntryErrRange);
 3505|  1.79k|	else
 3506|  1.79k|		return(TIFFReadDirEntryErrOk);
 3507|  2.00k|}
tif_dirread.c:TIFFReadDirEntryCheckedSlong:
 3225|  2.15k|{
 3226|  2.15k|	*value=*(int32_t*)(&direntry->tdir_offset);
 3227|  2.15k|	if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  2.15k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3227:6): [True: 437, False: 1.72k]
  ------------------
 3228|    437|		TIFFSwabLong((uint32_t*)value);
 3229|  2.15k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSlong:
 3510|  15.1k|{
 3511|  15.1k|	if ((value<0)||(value>0xFFFF))
  ------------------
  |  Branch (3511:6): [True: 89, False: 15.0k]
  |  Branch (3511:17): [True: 77, False: 14.9k]
  ------------------
 3512|    166|		return(TIFFReadDirEntryErrRange);
 3513|  14.9k|	else
 3514|  14.9k|		return(TIFFReadDirEntryErrOk);
 3515|  15.1k|}
tif_dirread.c:TIFFReadDirEntryCheckedLong8:
 3232|    842|{
 3233|    842|	if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|    842|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (3233:6): [True: 823, False: 19]
  ------------------
 3234|    823|	{
 3235|    823|		enum TIFFReadDirEntryErr err;
 3236|    823|		uint32_t offset = direntry->tdir_offset.toff_long;
 3237|    823|		if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    823|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3237:7): [True: 35, False: 788]
  ------------------
 3238|     35|			TIFFSwabLong(&offset);
 3239|    823|		err=TIFFReadDirEntryData(tif,offset,8,value);
 3240|    823|		if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3240:7): [True: 67, False: 756]
  ------------------
 3241|     67|			return(err);
 3242|    823|	}
 3243|     19|	else
 3244|     19|		*value = direntry->tdir_offset.toff_long8;
 3245|    775|	if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    775|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3245:6): [True: 19, False: 756]
  ------------------
 3246|     19|		TIFFSwabLong8(value);
 3247|    775|	return(TIFFReadDirEntryErrOk);
 3248|    842|}
tif_dirread.c:TIFFReadDirEntryData:
 3691|  2.34k|{
 3692|  2.34k|	assert(size>0);
 3693|  2.34k|	if (!isMapped(tif)) {
  ------------------
  |  |  208|  2.34k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  102|  2.34k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (3693:6): [True: 2.34k, False: 0]
  ------------------
 3694|  2.34k|		if (!SeekOK(tif,offset))
  ------------------
  |  |  234|  2.34k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (3694:7): [True: 289, False: 2.05k]
  ------------------
 3695|    289|			return(TIFFReadDirEntryErrIo);
 3696|  2.05k|		if (!ReadOK(tif,dest,size))
  ------------------
  |  |  231|  2.05k|	(TIFFReadFile((tif),(buf),(size))==(size))
  |  |  ------------------
  |  |  |  |  212|  2.05k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  |  |  ------------------
  ------------------
  |  Branch (3696:7): [True: 24, False: 2.03k]
  ------------------
 3697|     24|			return(TIFFReadDirEntryErrIo);
 3698|  2.05k|	} else {
 3699|      0|		size_t ma,mb;
 3700|      0|		ma=(size_t)offset;
 3701|      0|                if((uint64_t)ma != offset ||
  ------------------
  |  Branch (3701:20): [True: 0, False: 0]
  ------------------
 3702|      0|                    ma > (~(size_t)0) - (size_t)size )
  ------------------
  |  Branch (3702:21): [True: 0, False: 0]
  ------------------
 3703|      0|                {
 3704|      0|                    return TIFFReadDirEntryErrIo;
 3705|      0|                }
 3706|      0|		mb=ma+size;
 3707|      0|		if (mb > (uint64_t)tif->tif_size)
  ------------------
  |  Branch (3707:7): [True: 0, False: 0]
  ------------------
 3708|      0|			return(TIFFReadDirEntryErrIo);
 3709|      0|		_TIFFmemcpy(dest,tif->tif_base+ma,size);
 3710|      0|	}
 3711|  2.03k|	return(TIFFReadDirEntryErrOk);
 3712|  2.34k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortLong8:
 3518|    633|{
 3519|    633|	if (value>0xFFFF)
  ------------------
  |  Branch (3519:6): [True: 168, False: 465]
  ------------------
 3520|    168|		return(TIFFReadDirEntryErrRange);
 3521|    465|	else
 3522|    465|		return(TIFFReadDirEntryErrOk);
 3523|    633|}
tif_dirread.c:TIFFReadDirEntryCheckedSlong8:
 3251|    623|{
 3252|    623|	if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|    623|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (3252:6): [True: 606, False: 17]
  ------------------
 3253|    606|	{
 3254|    606|		enum TIFFReadDirEntryErr err;
 3255|    606|		uint32_t offset = direntry->tdir_offset.toff_long;
 3256|    606|		if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    606|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3256:7): [True: 33, False: 573]
  ------------------
 3257|     33|			TIFFSwabLong(&offset);
 3258|    606|		err=TIFFReadDirEntryData(tif,offset,8,value);
 3259|    606|		if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3259:7): [True: 72, False: 534]
  ------------------
 3260|     72|			return(err);
 3261|    606|	}
 3262|     17|	else
 3263|     17|		*value=*(int64_t*)(&direntry->tdir_offset);
 3264|    551|	if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    551|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3264:6): [True: 22, False: 529]
  ------------------
 3265|     22|		TIFFSwabLong8((uint64_t*)value);
 3266|    551|	return(TIFFReadDirEntryErrOk);
 3267|    623|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSlong8:
 3526|  1.72k|{
 3527|  1.72k|	if ((value<0)||(value>0xFFFF))
  ------------------
  |  Branch (3527:6): [True: 163, False: 1.55k]
  |  Branch (3527:17): [True: 148, False: 1.40k]
  ------------------
 3528|    311|		return(TIFFReadDirEntryErrRange);
 3529|  1.40k|	else
 3530|  1.40k|		return(TIFFReadDirEntryErrOk);
 3531|  1.72k|}
tif_dirread.c:TIFFReadDirEntryPersampleShort:
 3163|  1.98k|{
 3164|  1.98k|	enum TIFFReadDirEntryErr err;
 3165|  1.98k|	uint16_t* m;
 3166|  1.98k|	uint16_t* na;
 3167|  1.98k|	uint16_t nb;
 3168|  1.98k|	if (direntry->tdir_count<(uint64_t)tif->tif_dir.td_samplesperpixel)
  ------------------
  |  Branch (3168:6): [True: 4, False: 1.98k]
  ------------------
 3169|      4|		return(TIFFReadDirEntryErrCount);
 3170|  1.98k|	err=TIFFReadDirEntryShortArray(tif,direntry,&m);
 3171|  1.98k|	if (err!=TIFFReadDirEntryErrOk || m == NULL)
  ------------------
  |  Branch (3171:6): [True: 509, False: 1.47k]
  |  Branch (3171:36): [True: 0, False: 1.47k]
  ------------------
 3172|    509|		return(err);
 3173|  1.47k|	na=m;
 3174|  1.47k|	nb=tif->tif_dir.td_samplesperpixel;
 3175|  1.47k|	*value=*na++;
 3176|  1.47k|	nb--;
 3177|  2.43k|	while (nb>0)
  ------------------
  |  Branch (3177:9): [True: 968, False: 1.46k]
  ------------------
 3178|    968|	{
 3179|    968|		if (*na++!=*value)
  ------------------
  |  Branch (3179:7): [True: 12, False: 956]
  ------------------
 3180|     12|		{
 3181|     12|			err=TIFFReadDirEntryErrPsdif;
 3182|     12|			break;
 3183|     12|		}
 3184|    956|		nb--;
 3185|    956|	}
 3186|  1.47k|	_TIFFfree(m);
 3187|  1.47k|	return(err);
 3188|  1.98k|}
tif_dirread.c:TIFFReadDirEntryOutputErr:
 3715|  28.1k|{
 3716|  28.1k|	if (!recover) {
  ------------------
  |  Branch (3716:6): [True: 2.48k, False: 25.6k]
  ------------------
 3717|  2.48k|		switch (err) {
 3718|    350|			case TIFFReadDirEntryErrCount:
  ------------------
  |  Branch (3718:4): [True: 350, False: 2.13k]
  ------------------
 3719|    350|				TIFFErrorExtR(tif, module,
 3720|    350|					     "Incorrect count for \"%s\"",
 3721|    350|					     tagname);
 3722|    350|				break;
 3723|    350|			case TIFFReadDirEntryErrType:
  ------------------
  |  Branch (3723:4): [True: 350, False: 2.13k]
  ------------------
 3724|    350|				TIFFErrorExtR(tif, module,
 3725|    350|					     "Incompatible type for \"%s\"",
 3726|    350|					     tagname);
 3727|    350|				break;
 3728|    688|			case TIFFReadDirEntryErrIo:
  ------------------
  |  Branch (3728:4): [True: 688, False: 1.79k]
  ------------------
 3729|    688|				TIFFErrorExtR(tif, module,
 3730|    688|					     "IO error during reading of \"%s\"",
 3731|    688|					     tagname);
 3732|    688|				break;
 3733|    888|			case TIFFReadDirEntryErrRange:
  ------------------
  |  Branch (3733:4): [True: 888, False: 1.59k]
  ------------------
 3734|    888|				TIFFErrorExtR(tif, module,
 3735|    888|					     "Incorrect value for \"%s\"",
 3736|    888|					     tagname);
 3737|    888|				break;
 3738|     12|			case TIFFReadDirEntryErrPsdif:
  ------------------
  |  Branch (3738:4): [True: 12, False: 2.47k]
  ------------------
 3739|     12|				TIFFErrorExtR(tif, module,
 3740|     12|			"Cannot handle different values per sample for \"%s\"",
 3741|     12|					     tagname);
 3742|     12|				break;
 3743|    195|			case TIFFReadDirEntryErrSizesan:
  ------------------
  |  Branch (3743:4): [True: 195, False: 2.28k]
  ------------------
 3744|    195|				TIFFErrorExtR(tif, module,
 3745|    195|				"Sanity check on size of \"%s\" value failed",
 3746|    195|					     tagname);
 3747|    195|				break;
 3748|      0|			case TIFFReadDirEntryErrAlloc:
  ------------------
  |  Branch (3748:4): [True: 0, False: 2.48k]
  ------------------
 3749|      0|				TIFFErrorExtR(tif, module,
 3750|      0|					     "Out of memory reading of \"%s\"",
 3751|      0|					     tagname);
 3752|      0|				break;
 3753|      0|			default:
  ------------------
  |  Branch (3753:4): [True: 0, False: 2.48k]
  ------------------
 3754|      0|				assert(0);   /* we should never get here */
 3755|      0|				break;
 3756|  2.48k|		}
 3757|  25.6k|	} else {
 3758|  25.6k|		switch (err) {
 3759|  9.70k|			case TIFFReadDirEntryErrCount:
  ------------------
  |  Branch (3759:4): [True: 9.70k, False: 15.9k]
  ------------------
 3760|  9.70k|				TIFFWarningExtR(tif, module,
 3761|  9.70k|				"Incorrect count for \"%s\"; tag ignored",
 3762|  9.70k|					     tagname);
 3763|  9.70k|				break;
 3764|  1.45k|			case TIFFReadDirEntryErrType:
  ------------------
  |  Branch (3764:4): [True: 1.45k, False: 24.2k]
  ------------------
 3765|  1.45k|				TIFFWarningExtR(tif, module,
 3766|  1.45k|				"Incompatible type for \"%s\"; tag ignored",
 3767|  1.45k|					       tagname);
 3768|  1.45k|				break;
 3769|  8.25k|			case TIFFReadDirEntryErrIo:
  ------------------
  |  Branch (3769:4): [True: 8.25k, False: 17.4k]
  ------------------
 3770|  8.25k|				TIFFWarningExtR(tif, module,
 3771|  8.25k|			"IO error during reading of \"%s\"; tag ignored",
 3772|  8.25k|					       tagname);
 3773|  8.25k|				break;
 3774|  1.72k|			case TIFFReadDirEntryErrRange:
  ------------------
  |  Branch (3774:4): [True: 1.72k, False: 23.9k]
  ------------------
 3775|  1.72k|				TIFFWarningExtR(tif, module,
 3776|  1.72k|				"Incorrect value for \"%s\"; tag ignored",
 3777|  1.72k|					       tagname);
 3778|  1.72k|				break;
 3779|      0|			case TIFFReadDirEntryErrPsdif:
  ------------------
  |  Branch (3779:4): [True: 0, False: 25.6k]
  ------------------
 3780|      0|				TIFFWarningExtR(tif, module,
 3781|      0|	"Cannot handle different values per sample for \"%s\"; tag ignored",
 3782|      0|					       tagname);
 3783|      0|				break;
 3784|  4.51k|			case TIFFReadDirEntryErrSizesan:
  ------------------
  |  Branch (3784:4): [True: 4.51k, False: 21.1k]
  ------------------
 3785|  4.51k|				TIFFWarningExtR(tif, module,
 3786|  4.51k|		"Sanity check on size of \"%s\" value failed; tag ignored",
 3787|  4.51k|					       tagname);
 3788|  4.51k|				break;
 3789|      0|			case TIFFReadDirEntryErrAlloc:
  ------------------
  |  Branch (3789:4): [True: 0, False: 25.6k]
  ------------------
 3790|      0|				TIFFWarningExtR(tif, module,
 3791|      0|				"Out of memory reading of \"%s\"; tag ignored",
 3792|      0|					       tagname);
 3793|      0|				break;
 3794|      0|			default:
  ------------------
  |  Branch (3794:4): [True: 0, False: 25.6k]
  ------------------
 3795|      0|				assert(0);   /* we should never get here */
 3796|      0|				break;
 3797|  25.6k|		}
 3798|  25.6k|	}
 3799|  28.1k|}
tif_dirread.c:TIFFReadDirEntryDoubleArray:
 2865|    625|{
 2866|    625|	enum TIFFReadDirEntryErr err;
 2867|    625|	uint32_t count;
 2868|    625|	void* origdata;
 2869|    625|	double* data;
 2870|    625|	switch (direntry->tdir_type)
 2871|    625|	{
 2872|     15|		case TIFF_BYTE:
  ------------------
  |  Branch (2872:3): [True: 15, False: 610]
  ------------------
 2873|     26|		case TIFF_SBYTE:
  ------------------
  |  Branch (2873:3): [True: 11, False: 614]
  ------------------
 2874|     46|		case TIFF_SHORT:
  ------------------
  |  Branch (2874:3): [True: 20, False: 605]
  ------------------
 2875|     64|		case TIFF_SSHORT:
  ------------------
  |  Branch (2875:3): [True: 18, False: 607]
  ------------------
 2876|     94|		case TIFF_LONG:
  ------------------
  |  Branch (2876:3): [True: 30, False: 595]
  ------------------
 2877|    114|		case TIFF_SLONG:
  ------------------
  |  Branch (2877:3): [True: 20, False: 605]
  ------------------
 2878|    132|		case TIFF_LONG8:
  ------------------
  |  Branch (2878:3): [True: 18, False: 607]
  ------------------
 2879|    151|		case TIFF_SLONG8:
  ------------------
  |  Branch (2879:3): [True: 19, False: 606]
  ------------------
 2880|    209|		case TIFF_RATIONAL:
  ------------------
  |  Branch (2880:3): [True: 58, False: 567]
  ------------------
 2881|    249|		case TIFF_SRATIONAL:
  ------------------
  |  Branch (2881:3): [True: 40, False: 585]
  ------------------
 2882|    266|		case TIFF_FLOAT:
  ------------------
  |  Branch (2882:3): [True: 17, False: 608]
  ------------------
 2883|    623|		case TIFF_DOUBLE:
  ------------------
  |  Branch (2883:3): [True: 357, False: 268]
  ------------------
 2884|    623|			break;
 2885|      2|		default:
  ------------------
  |  Branch (2885:3): [True: 2, False: 623]
  ------------------
 2886|      2|			return(TIFFReadDirEntryErrType);
 2887|    625|	}
 2888|    623|	err=TIFFReadDirEntryArray(tif,direntry,&count,8,&origdata);
 2889|    623|	if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (2889:6): [True: 195, False: 428]
  |  Branch (2889:36): [True: 79, False: 349]
  ------------------
 2890|    274|	{
 2891|    274|		*value=0;
 2892|    274|		return(err);
 2893|    274|	}
 2894|    349|	switch (direntry->tdir_type)
  ------------------
  |  Branch (2894:10): [True: 254, False: 95]
  ------------------
 2895|    349|	{
 2896|     95|		case TIFF_DOUBLE:
  ------------------
  |  Branch (2896:3): [True: 95, False: 254]
  ------------------
 2897|     95|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|     95|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2897:8): [True: 14, False: 81]
  ------------------
 2898|     14|				TIFFSwabArrayOfLong8((uint64_t*)origdata, count);
 2899|     95|			TIFFCvtIEEEDoubleToNative(tif,count,(double*)origdata);
 2900|     95|			*value=(double*)origdata;
 2901|     95|			return(TIFFReadDirEntryErrOk);
 2902|    349|	}
 2903|    254|	data=(double*)_TIFFmalloc(count*sizeof(double));
 2904|    254|	if (data==0)
  ------------------
  |  Branch (2904:6): [True: 0, False: 254]
  ------------------
 2905|      0|	{
 2906|      0|		_TIFFfree(origdata);
 2907|      0|		return(TIFFReadDirEntryErrAlloc);
 2908|      0|	}
 2909|    254|	switch (direntry->tdir_type)
  ------------------
  |  Branch (2909:10): [True: 0, False: 254]
  ------------------
 2910|    254|	{
 2911|     15|		case TIFF_BYTE:
  ------------------
  |  Branch (2911:3): [True: 15, False: 239]
  ------------------
 2912|     15|			{
 2913|     15|				uint8_t* ma;
 2914|     15|				double* mb;
 2915|     15|				uint32_t n;
 2916|     15|				ma=(uint8_t*)origdata;
 2917|     15|				mb=data;
 2918|    491|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2918:15): [True: 476, False: 15]
  ------------------
 2919|    476|					*mb++=(double)(*ma++);
 2920|     15|			}
 2921|     15|			break;
 2922|     10|		case TIFF_SBYTE:
  ------------------
  |  Branch (2922:3): [True: 10, False: 244]
  ------------------
 2923|     10|			{
 2924|     10|				int8_t* ma;
 2925|     10|				double* mb;
 2926|     10|				uint32_t n;
 2927|     10|				ma=(int8_t*)origdata;
 2928|     10|				mb=data;
 2929|    353|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2929:15): [True: 343, False: 10]
  ------------------
 2930|    343|					*mb++=(double)(*ma++);
 2931|     10|			}
 2932|     10|			break;
 2933|     20|		case TIFF_SHORT:
  ------------------
  |  Branch (2933:3): [True: 20, False: 234]
  ------------------
 2934|     20|			{
 2935|     20|				uint16_t* ma;
 2936|     20|				double* mb;
 2937|     20|				uint32_t n;
 2938|     20|				ma=(uint16_t*)origdata;
 2939|     20|				mb=data;
 2940|    422|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2940:15): [True: 402, False: 20]
  ------------------
 2941|    402|				{
 2942|    402|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    402|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2942:10): [True: 294, False: 108]
  ------------------
 2943|    294|						TIFFSwabShort(ma);
 2944|    402|					*mb++=(double)(*ma++);
 2945|    402|				}
 2946|     20|			}
 2947|     20|			break;
 2948|     18|		case TIFF_SSHORT:
  ------------------
  |  Branch (2948:3): [True: 18, False: 236]
  ------------------
 2949|     18|			{
 2950|     18|				int16_t* ma;
 2951|     18|				double* mb;
 2952|     18|				uint32_t n;
 2953|     18|				ma=(int16_t*)origdata;
 2954|     18|				mb=data;
 2955|    466|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2955:15): [True: 448, False: 18]
  ------------------
 2956|    448|				{
 2957|    448|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    448|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2957:10): [True: 290, False: 158]
  ------------------
 2958|    290|						TIFFSwabShort((uint16_t*)ma);
 2959|    448|					*mb++=(double)(*ma++);
 2960|    448|				}
 2961|     18|			}
 2962|     18|			break;
 2963|     30|		case TIFF_LONG:
  ------------------
  |  Branch (2963:3): [True: 30, False: 224]
  ------------------
 2964|     30|			{
 2965|     30|				uint32_t* ma;
 2966|     30|				double* mb;
 2967|     30|				uint32_t n;
 2968|     30|				ma=(uint32_t*)origdata;
 2969|     30|				mb=data;
 2970|    691|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2970:15): [True: 661, False: 30]
  ------------------
 2971|    661|				{
 2972|    661|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    661|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2972:10): [True: 550, False: 111]
  ------------------
 2973|    550|						TIFFSwabLong(ma);
 2974|    661|					*mb++=(double)(*ma++);
 2975|    661|				}
 2976|     30|			}
 2977|     30|			break;
 2978|     19|		case TIFF_SLONG:
  ------------------
  |  Branch (2978:3): [True: 19, False: 235]
  ------------------
 2979|     19|			{
 2980|     19|				int32_t* ma;
 2981|     19|				double* mb;
 2982|     19|				uint32_t n;
 2983|     19|				ma=(int32_t*)origdata;
 2984|     19|				mb=data;
 2985|    678|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2985:15): [True: 659, False: 19]
  ------------------
 2986|    659|				{
 2987|    659|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    659|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2987:10): [True: 546, False: 113]
  ------------------
 2988|    546|						TIFFSwabLong((uint32_t*)ma);
 2989|    659|					*mb++=(double)(*ma++);
 2990|    659|				}
 2991|     19|			}
 2992|     19|			break;
 2993|     16|		case TIFF_LONG8:
  ------------------
  |  Branch (2993:3): [True: 16, False: 238]
  ------------------
 2994|     16|			{
 2995|     16|				uint64_t* ma;
 2996|     16|				double* mb;
 2997|     16|				uint32_t n;
 2998|     16|				ma=(uint64_t*)origdata;
 2999|     16|				mb=data;
 3000|    400|				for (n=0; n<count; n++)
  ------------------
  |  Branch (3000:15): [True: 384, False: 16]
  ------------------
 3001|    384|				{
 3002|    384|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    384|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3002:10): [True: 290, False: 94]
  ------------------
 3003|    290|						TIFFSwabLong8(ma);
 3004|       |#if defined(__WIN32__) && (_MSC_VER < 1500)
 3005|       |					/*
 3006|       |					 * XXX: MSVC 6.0 does not support
 3007|       |					 * conversion of 64-bit integers into
 3008|       |					 * floating point values.
 3009|       |					 */
 3010|       |					*mb++ = _TIFFUInt64ToDouble(*ma++);
 3011|       |#else
 3012|    384|					*mb++ = (double)(*ma++);
 3013|    384|#endif
 3014|    384|				}
 3015|     16|			}
 3016|     16|			break;
 3017|     16|		case TIFF_SLONG8:
  ------------------
  |  Branch (3017:3): [True: 16, False: 238]
  ------------------
 3018|     16|			{
 3019|     16|				int64_t* ma;
 3020|     16|				double* mb;
 3021|     16|				uint32_t n;
 3022|     16|				ma=(int64_t*)origdata;
 3023|     16|				mb=data;
 3024|    412|				for (n=0; n<count; n++)
  ------------------
  |  Branch (3024:15): [True: 396, False: 16]
  ------------------
 3025|    396|				{
 3026|    396|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    396|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3026:10): [True: 290, False: 106]
  ------------------
 3027|    290|						TIFFSwabLong8((uint64_t*)ma);
 3028|    396|					*mb++=(double)(*ma++);
 3029|    396|				}
 3030|     16|			}
 3031|     16|			break;
 3032|     55|		case TIFF_RATIONAL:
  ------------------
  |  Branch (3032:3): [True: 55, False: 199]
  ------------------
 3033|     55|			{
 3034|     55|				uint32_t* ma;
 3035|     55|				uint32_t maa;
 3036|     55|				uint32_t mab;
 3037|     55|				double* mb;
 3038|     55|				uint32_t n;
 3039|     55|				ma=(uint32_t*)origdata;
 3040|     55|				mb=data;
 3041|  2.13k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (3041:15): [True: 2.08k, False: 55]
  ------------------
 3042|  2.08k|				{
 3043|  2.08k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  2.08k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3043:10): [True: 1.63k, False: 447]
  ------------------
 3044|  1.63k|						TIFFSwabLong(ma);
 3045|  2.08k|					maa=*ma++;
 3046|  2.08k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  2.08k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3046:10): [True: 1.63k, False: 447]
  ------------------
 3047|  1.63k|						TIFFSwabLong(ma);
 3048|  2.08k|					mab=*ma++;
 3049|  2.08k|					if (mab==0)
  ------------------
  |  Branch (3049:10): [True: 797, False: 1.28k]
  ------------------
 3050|    797|						*mb++=0.0;
 3051|  1.28k|					else
 3052|  1.28k|						*mb++=(double)maa/(double)mab;
 3053|  2.08k|				}
 3054|     55|			}
 3055|     55|			break;
 3056|     38|		case TIFF_SRATIONAL:
  ------------------
  |  Branch (3056:3): [True: 38, False: 216]
  ------------------
 3057|     38|			{
 3058|     38|				uint32_t* ma;
 3059|     38|				int32_t maa;
 3060|     38|				uint32_t mab;
 3061|     38|				double* mb;
 3062|     38|				uint32_t n;
 3063|     38|				ma=(uint32_t*)origdata;
 3064|     38|				mb=data;
 3065|  1.02k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (3065:15): [True: 983, False: 38]
  ------------------
 3066|    983|				{
 3067|    983|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    983|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3067:10): [True: 587, False: 396]
  ------------------
 3068|    587|						TIFFSwabLong(ma);
 3069|    983|					maa=*(int32_t*)ma;
 3070|    983|					ma++;
 3071|    983|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    983|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3071:10): [True: 587, False: 396]
  ------------------
 3072|    587|						TIFFSwabLong(ma);
 3073|    983|					mab=*ma++;
 3074|    983|					if (mab==0)
  ------------------
  |  Branch (3074:10): [True: 321, False: 662]
  ------------------
 3075|    321|						*mb++=0.0;
 3076|    662|					else
 3077|    662|						*mb++=(double)maa/(double)mab;
 3078|    983|				}
 3079|     38|			}
 3080|     38|			break;
 3081|     17|		case TIFF_FLOAT:
  ------------------
  |  Branch (3081:3): [True: 17, False: 237]
  ------------------
 3082|     17|			{
 3083|     17|				float* ma;
 3084|     17|				double* mb;
 3085|     17|				uint32_t n;
 3086|     17|				if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|     17|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3086:9): [True: 8, False: 9]
  ------------------
 3087|      8|					TIFFSwabArrayOfLong((uint32_t*)origdata, count);
 3088|     17|				TIFFCvtIEEEFloatToNative(tif,count,(float*)origdata);
 3089|     17|				ma=(float*)origdata;
 3090|     17|				mb=data;
 3091|    890|				for (n=0; n<count; n++)
  ------------------
  |  Branch (3091:15): [True: 873, False: 17]
  ------------------
 3092|    873|					*mb++=(double)(*ma++);
 3093|     17|			}
 3094|     17|			break;
 3095|    254|	}
 3096|    254|	_TIFFfree(origdata);
 3097|    254|	*value=data;
 3098|    254|	return(TIFFReadDirEntryErrOk);
 3099|    254|}
tif_dirread.c:TIFFReadDirEntryArray:
 1263|  30.8k|{
 1264|  30.8k|    return TIFFReadDirEntryArrayWithLimit(tif, direntry, count,
 1265|  30.8k|                                          desttypesize, value, ~((uint64_t)0));
 1266|  30.8k|}
tif_dirread.c:TIFFReadDirEntryArrayWithLimit:
 1160|  60.9k|{
 1161|  60.9k|	int typesize;
 1162|  60.9k|	uint32_t datasize;
 1163|  60.9k|	void* data;
 1164|  60.9k|        uint64_t target_count64;
 1165|  60.9k|        int original_datasize_clamped;
 1166|  60.9k|	typesize=TIFFDataWidth(direntry->tdir_type);
 1167|       |
 1168|  60.9k|        target_count64 = (direntry->tdir_count > maxcount) ?
  ------------------
  |  Branch (1168:26): [True: 21.0k, False: 39.9k]
  ------------------
 1169|  39.9k|                maxcount : direntry->tdir_count;
 1170|       |
 1171|  60.9k|	if ((target_count64==0)||(typesize==0))
  ------------------
  |  Branch (1171:6): [True: 3.27k, False: 57.6k]
  |  Branch (1171:27): [True: 0, False: 57.6k]
  ------------------
 1172|  3.27k|	{
 1173|  3.27k|		*value=0;
 1174|  3.27k|		return(TIFFReadDirEntryErrOk);
 1175|  3.27k|	}
 1176|  57.6k|        (void) desttypesize;
 1177|       |
 1178|       |        /* We just want to know if the original tag size is more than 4 bytes
 1179|       |         * (classic TIFF) or 8 bytes (BigTIFF)
 1180|       |         */
 1181|  57.6k|        original_datasize_clamped =
 1182|  57.6k|            ((direntry->tdir_count > 10) ? 10 : (int)direntry->tdir_count) * typesize;
  ------------------
  |  Branch (1182:14): [True: 39.4k, False: 18.2k]
  ------------------
 1183|       |
 1184|       |        /* 
 1185|       |         * As a sanity check, make sure we have no more than a 2GB tag array 
 1186|       |         * in either the current data type or the dest data type.  This also
 1187|       |         * avoids problems with overflow of tmsize_t on 32bit systems.
 1188|       |         */
 1189|  57.6k|	if ((uint64_t)(MAX_SIZE_TAG_DATA / typesize) < target_count64)
  ------------------
  |  | 1155|  57.6k|#define MAX_SIZE_TAG_DATA       2147483647U
  ------------------
  |  Branch (1189:6): [True: 4.67k, False: 52.9k]
  ------------------
 1190|  4.67k|		return(TIFFReadDirEntryErrSizesan);
 1191|  52.9k|	if ((uint64_t)(MAX_SIZE_TAG_DATA / desttypesize) < target_count64)
  ------------------
  |  | 1155|  52.9k|#define MAX_SIZE_TAG_DATA       2147483647U
  ------------------
  |  Branch (1191:6): [True: 35, False: 52.9k]
  ------------------
 1192|     35|		return(TIFFReadDirEntryErrSizesan);
 1193|       |
 1194|  52.9k|	*count=(uint32_t)target_count64;
 1195|  52.9k|	datasize=(*count)*typesize;
 1196|  52.9k|	assert((tmsize_t)datasize>0);
 1197|       |
 1198|  52.9k|	if( isMapped(tif) && datasize > (uint64_t)tif->tif_size )
  ------------------
  |  |  208|   105k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  102|  52.9k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (208:23): [True: 0, False: 52.9k]
  |  |  ------------------
  ------------------
  |  Branch (1198:23): [True: 0, False: 0]
  ------------------
 1199|      0|		return TIFFReadDirEntryErrIo;
 1200|       |
 1201|  52.9k|	if( !isMapped(tif) &&
  ------------------
  |  |  208|   105k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  102|  52.9k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (1201:6): [True: 52.9k, False: 0]
  ------------------
 1202|  52.9k|		(((tif->tif_flags&TIFF_BIGTIFF) && datasize > 8) ||
  ------------------
  |  |  110|  52.9k|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (1202:5): [True: 500, False: 52.4k]
  |  Branch (1202:38): [True: 74, False: 426]
  ------------------
 1203|  52.9k|		(!(tif->tif_flags&TIFF_BIGTIFF) && datasize > 4)) )
  ------------------
  |  |  110|  52.8k|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (1203:4): [True: 52.4k, False: 426]
  |  Branch (1203:38): [True: 35.1k, False: 17.3k]
  ------------------
 1204|  35.2k|	{
 1205|  35.2k|		data = NULL;
 1206|  35.2k|	}
 1207|  17.7k|	else
 1208|  17.7k|	{
 1209|  17.7k|		data=_TIFFCheckMalloc(tif, *count, typesize, "ReadDirEntryArray");
 1210|  17.7k|		if (data==0)
  ------------------
  |  Branch (1210:7): [True: 0, False: 17.7k]
  ------------------
 1211|      0|			return(TIFFReadDirEntryErrAlloc);
 1212|  17.7k|	}
 1213|  52.9k|	if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|  52.9k|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (1213:6): [True: 52.4k, False: 500]
  ------------------
 1214|  52.4k|	{
 1215|       |		/* Only the condition on original_datasize_clamped. The second
 1216|       |		 * one is implied, but Coverity Scan cannot see it. */
 1217|  52.4k|		if (original_datasize_clamped<=4 && datasize <= 4 )
  ------------------
  |  Branch (1217:7): [True: 12.3k, False: 40.0k]
  |  Branch (1217:39): [True: 12.3k, False: 0]
  ------------------
 1218|  12.3k|			_TIFFmemcpy(data,&direntry->tdir_offset,datasize);
 1219|  40.0k|		else
 1220|  40.0k|		{
 1221|  40.0k|			enum TIFFReadDirEntryErr err;
 1222|  40.0k|			uint32_t offset = direntry->tdir_offset.toff_long;
 1223|  40.0k|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  40.0k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1223:8): [True: 1.62k, False: 38.4k]
  ------------------
 1224|  1.62k|				TIFFSwabLong(&offset);
 1225|  40.0k|			if( isMapped(tif) )
  ------------------
  |  |  208|  40.0k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  102|  40.0k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (208:23): [True: 0, False: 40.0k]
  |  |  ------------------
  ------------------
 1226|      0|				err=TIFFReadDirEntryData(tif, (uint64_t)offset, (tmsize_t)datasize, data);
 1227|  40.0k|			else
 1228|  40.0k|				err=TIFFReadDirEntryDataAndRealloc(tif, (uint64_t)offset, (tmsize_t)datasize, &data);
 1229|  40.0k|			if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1229:8): [True: 8.38k, False: 31.6k]
  ------------------
 1230|  8.38k|			{
 1231|  8.38k|				_TIFFfree(data);
 1232|  8.38k|				return(err);
 1233|  8.38k|			}
 1234|  40.0k|		}
 1235|  52.4k|	}
 1236|    500|	else
 1237|    500|	{
 1238|       |		/* See above comment for the Classic TIFF case */
 1239|    500|		if (original_datasize_clamped<=8 && datasize <= 8 )
  ------------------
  |  Branch (1239:7): [True: 128, False: 372]
  |  Branch (1239:39): [True: 128, False: 0]
  ------------------
 1240|    128|			_TIFFmemcpy(data,&direntry->tdir_offset,datasize);
 1241|    372|		else
 1242|    372|		{
 1243|    372|			enum TIFFReadDirEntryErr err;
 1244|    372|			uint64_t offset = direntry->tdir_offset.toff_long8;
 1245|    372|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    372|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1245:8): [True: 33, False: 339]
  ------------------
 1246|     33|				TIFFSwabLong8(&offset);
 1247|    372|			if( isMapped(tif) )
  ------------------
  |  |  208|    372|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  102|    372|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (208:23): [True: 0, False: 372]
  |  |  ------------------
  ------------------
 1248|      0|				err=TIFFReadDirEntryData(tif, (uint64_t)offset, (tmsize_t)datasize, data);
 1249|    372|			else
 1250|    372|				err=TIFFReadDirEntryDataAndRealloc(tif, (uint64_t)offset, (tmsize_t)datasize, &data);
 1251|    372|			if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1251:8): [True: 247, False: 125]
  ------------------
 1252|    247|			{
 1253|    247|				_TIFFfree(data);
 1254|    247|				return(err);
 1255|    247|			}
 1256|    372|		}
 1257|    500|	}
 1258|  44.3k|	*value=data;
 1259|  44.3k|	return(TIFFReadDirEntryErrOk);
 1260|  52.9k|}
tif_dirread.c:TIFFReadDirEntryDataAndRealloc:
 1100|  40.4k|{
 1101|  40.4k|#if SIZEOF_SIZE_T == 8
 1102|  40.4k|        tmsize_t threshold = INITIAL_THRESHOLD;
  ------------------
  |  | 1094|  40.4k|#define INITIAL_THRESHOLD (1024 * 1024)
  ------------------
 1103|  40.4k|#endif
 1104|  40.4k|        tmsize_t already_read = 0;
 1105|       |
 1106|  40.4k|        assert( !isMapped(tif) );
 1107|       |
 1108|  40.4k|        if (!SeekOK(tif,offset))
  ------------------
  |  |  234|  40.4k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (1108:13): [True: 8.37k, False: 32.0k]
  ------------------
 1109|  8.37k|                return(TIFFReadDirEntryErrIo);
 1110|       |
 1111|       |        /* On 64 bit processes, read first a maximum of 1 MB, then 10 MB, etc */
 1112|       |        /* so as to avoid allocating too much memory in case the file is too */
 1113|       |        /* short. We could ask for the file size, but this might be */
 1114|       |        /* expensive with some I/O layers (think of reading a gzipped file) */
 1115|       |        /* Restrict to 64 bit processes, so as to avoid reallocs() */
 1116|       |        /* on 32 bit processes where virtual memory is scarce.  */
 1117|  63.9k|        while( already_read < size )
  ------------------
  |  Branch (1117:16): [True: 32.0k, False: 31.8k]
  ------------------
 1118|  32.0k|        {
 1119|  32.0k|            void* new_dest;
 1120|  32.0k|            tmsize_t bytes_read;
 1121|  32.0k|            tmsize_t to_read = size - already_read;
 1122|  32.0k|#if SIZEOF_SIZE_T == 8
 1123|  32.0k|            if( to_read >= threshold && threshold < MAX_THRESHOLD )
  ------------------
  |  | 1096|    116|#define MAX_THRESHOLD (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  | 1095|    116|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |               #define MAX_THRESHOLD (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  | 1095|    116|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |               #define MAX_THRESHOLD (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  | 1095|    116|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |               #define MAX_THRESHOLD (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  | 1094|    116|#define INITIAL_THRESHOLD (1024 * 1024)
  |  |  ------------------
  ------------------
  |  Branch (1123:17): [True: 116, False: 31.9k]
  |  Branch (1123:41): [True: 116, False: 0]
  ------------------
 1124|    116|            {
 1125|    116|                to_read = threshold;
 1126|    116|                threshold *= THRESHOLD_MULTIPLIER;
  ------------------
  |  | 1095|    116|#define THRESHOLD_MULTIPLIER 10
  ------------------
 1127|    116|            }
 1128|  32.0k|#endif
 1129|       |
 1130|  32.0k|            new_dest = (uint8_t*) _TIFFrealloc(
 1131|  32.0k|                            *pdest, already_read + to_read);
 1132|  32.0k|            if( new_dest == NULL )
  ------------------
  |  Branch (1132:17): [True: 0, False: 32.0k]
  ------------------
 1133|      0|            {
 1134|      0|                TIFFErrorExtR(tif, tif->tif_name,
 1135|      0|                            "Failed to allocate memory for %s "
 1136|      0|                            "(%"TIFF_SSIZE_FORMAT" elements of %"TIFF_SSIZE_FORMAT" bytes each)",
 1137|      0|                            "TIFFReadDirEntryArray",
 1138|      0|                             (tmsize_t) 1, already_read + to_read);
 1139|      0|                return TIFFReadDirEntryErrAlloc;
 1140|      0|            }
 1141|  32.0k|            *pdest = new_dest;
 1142|       |
 1143|  32.0k|            bytes_read = TIFFReadFile(tif,
  ------------------
  |  |  212|  32.0k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  ------------------
 1144|  32.0k|                (char*)*pdest + already_read, to_read);
 1145|  32.0k|            already_read += bytes_read;
 1146|  32.0k|            if (bytes_read != to_read) {
  ------------------
  |  Branch (1146:17): [True: 256, False: 31.8k]
  ------------------
 1147|    256|                return TIFFReadDirEntryErrIo;
 1148|    256|            }
 1149|  32.0k|        }
 1150|  31.8k|        return TIFFReadDirEntryErrOk;
 1151|  32.0k|}
tif_dirread.c:TIFFReadDirEntryShortArray:
 1629|  8.67k|{
 1630|  8.67k|	enum TIFFReadDirEntryErr err;
 1631|  8.67k|	uint32_t count;
 1632|  8.67k|	void* origdata;
 1633|  8.67k|	uint16_t* data;
 1634|  8.67k|	switch (direntry->tdir_type)
 1635|  8.67k|	{
 1636|  1.02k|		case TIFF_BYTE:
  ------------------
  |  Branch (1636:3): [True: 1.02k, False: 7.64k]
  ------------------
 1637|  1.14k|		case TIFF_SBYTE:
  ------------------
  |  Branch (1637:3): [True: 121, False: 8.54k]
  ------------------
 1638|  6.77k|		case TIFF_SHORT:
  ------------------
  |  Branch (1638:3): [True: 5.63k, False: 3.03k]
  ------------------
 1639|  7.87k|		case TIFF_SSHORT:
  ------------------
  |  Branch (1639:3): [True: 1.09k, False: 7.57k]
  ------------------
 1640|  7.97k|		case TIFF_LONG:
  ------------------
  |  Branch (1640:3): [True: 101, False: 8.56k]
  ------------------
 1641|  8.12k|		case TIFF_SLONG:
  ------------------
  |  Branch (1641:3): [True: 155, False: 8.51k]
  ------------------
 1642|  8.25k|		case TIFF_LONG8:
  ------------------
  |  Branch (1642:3): [True: 130, False: 8.54k]
  ------------------
 1643|  8.48k|		case TIFF_SLONG8:
  ------------------
  |  Branch (1643:3): [True: 226, False: 8.44k]
  ------------------
 1644|  8.48k|			break;
 1645|    186|		default:
  ------------------
  |  Branch (1645:3): [True: 186, False: 8.48k]
  ------------------
 1646|    186|			return(TIFFReadDirEntryErrType);
 1647|  8.67k|	}
 1648|  8.48k|	err=TIFFReadDirEntryArray(tif,direntry,&count,2,&origdata);
 1649|  8.48k|	if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (1649:6): [True: 2.28k, False: 6.20k]
  |  Branch (1649:36): [True: 199, False: 6.00k]
  ------------------
 1650|  2.48k|	{
 1651|  2.48k|		*value=0;
 1652|  2.48k|		return(err);
 1653|  2.48k|	}
 1654|  6.00k|	switch (direntry->tdir_type)
  ------------------
  |  Branch (1654:10): [True: 1.49k, False: 4.50k]
  ------------------
 1655|  6.00k|	{
 1656|  3.43k|		case TIFF_SHORT:
  ------------------
  |  Branch (1656:3): [True: 3.43k, False: 2.57k]
  ------------------
 1657|  3.43k|			*value=(uint16_t*)origdata;
 1658|  3.43k|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  3.43k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1658:8): [True: 407, False: 3.02k]
  ------------------
 1659|    407|				TIFFSwabArrayOfShort(*value,count);  
 1660|  3.43k|			return(TIFFReadDirEntryErrOk);
 1661|  1.07k|		case TIFF_SSHORT:
  ------------------
  |  Branch (1661:3): [True: 1.07k, False: 4.92k]
  ------------------
 1662|  1.07k|			{
 1663|  1.07k|				int16_t* m;
 1664|  1.07k|				uint32_t n;
 1665|  1.07k|				m=(int16_t*)origdata;
 1666|  3.80k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1666:15): [True: 2.74k, False: 1.06k]
  ------------------
 1667|  2.74k|				{
 1668|  2.74k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  2.74k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1668:10): [True: 467, False: 2.27k]
  ------------------
 1669|    467|						TIFFSwabShort((uint16_t*)m);
 1670|  2.74k|					err=TIFFReadDirEntryCheckRangeShortSshort(*m);
 1671|  2.74k|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1671:10): [True: 10, False: 2.73k]
  ------------------
 1672|     10|					{
 1673|     10|						_TIFFfree(origdata);
 1674|     10|						return(err);
 1675|     10|					}
 1676|  2.73k|					m++;
 1677|  2.73k|				}
 1678|  1.06k|				*value=(uint16_t*)origdata;
 1679|  1.06k|				return(TIFFReadDirEntryErrOk);
 1680|  1.07k|			}
 1681|  6.00k|	}
 1682|  1.49k|	data=(uint16_t*)_TIFFmalloc(count * 2);
 1683|  1.49k|	if (data==0)
  ------------------
  |  Branch (1683:6): [True: 0, False: 1.49k]
  ------------------
 1684|      0|	{
 1685|      0|		_TIFFfree(origdata);
 1686|      0|		return(TIFFReadDirEntryErrAlloc);
 1687|      0|	}
 1688|  1.49k|	switch (direntry->tdir_type)
  ------------------
  |  Branch (1688:10): [True: 0, False: 1.49k]
  ------------------
 1689|  1.49k|	{
 1690|    935|		case TIFF_BYTE:
  ------------------
  |  Branch (1690:3): [True: 935, False: 561]
  ------------------
 1691|    935|			{
 1692|    935|				uint8_t* ma;
 1693|    935|				uint16_t* mb;
 1694|    935|				uint32_t n;
 1695|    935|				ma=(uint8_t*)origdata;
 1696|    935|				mb=data;
 1697|  14.7k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1697:15): [True: 13.7k, False: 935]
  ------------------
 1698|  13.7k|					*mb++=(uint16_t)(*ma++);
 1699|    935|			}
 1700|    935|			break;
 1701|     93|		case TIFF_SBYTE:
  ------------------
  |  Branch (1701:3): [True: 93, False: 1.40k]
  ------------------
 1702|     93|			{
 1703|     93|				int8_t* ma;
 1704|     93|				uint16_t* mb;
 1705|     93|				uint32_t n;
 1706|     93|				ma=(int8_t*)origdata;
 1707|     93|				mb=data;
 1708|  1.25k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1708:15): [True: 1.17k, False: 85]
  ------------------
 1709|  1.17k|				{
 1710|  1.17k|					err=TIFFReadDirEntryCheckRangeShortSbyte(*ma);
 1711|  1.17k|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1711:10): [True: 8, False: 1.16k]
  ------------------
 1712|      8|						break;
 1713|  1.16k|					*mb++=(uint16_t)(*ma++);
 1714|  1.16k|				}
 1715|     93|			}
 1716|     93|			break;
 1717|     76|		case TIFF_LONG:
  ------------------
  |  Branch (1717:3): [True: 76, False: 1.42k]
  ------------------
 1718|     76|			{
 1719|     76|				uint32_t* ma;
 1720|     76|				uint16_t* mb;
 1721|     76|				uint32_t n;
 1722|     76|				ma=(uint32_t*)origdata;
 1723|     76|				mb=data;
 1724|    584|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1724:15): [True: 563, False: 21]
  ------------------
 1725|    563|				{
 1726|    563|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    563|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1726:10): [True: 252, False: 311]
  ------------------
 1727|    252|						TIFFSwabLong(ma);
 1728|    563|					err=TIFFReadDirEntryCheckRangeShortLong(*ma);
 1729|    563|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1729:10): [True: 55, False: 508]
  ------------------
 1730|     55|						break;
 1731|    508|					*mb++=(uint16_t)(*ma++);
 1732|    508|				}
 1733|     76|			}
 1734|     76|			break;
 1735|    114|		case TIFF_SLONG:
  ------------------
  |  Branch (1735:3): [True: 114, False: 1.38k]
  ------------------
 1736|    114|			{
 1737|    114|				int32_t* ma;
 1738|    114|				uint16_t* mb;
 1739|    114|				uint32_t n;
 1740|    114|				ma=(int32_t*)origdata;
 1741|    114|				mb=data;
 1742|  15.0k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1742:15): [True: 14.9k, False: 28]
  ------------------
 1743|  14.9k|				{
 1744|  14.9k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  14.9k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1744:10): [True: 309, False: 14.6k]
  ------------------
 1745|    309|						TIFFSwabLong((uint32_t*)ma);
 1746|  14.9k|					err=TIFFReadDirEntryCheckRangeShortSlong(*ma);
 1747|  14.9k|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1747:10): [True: 86, False: 14.9k]
  ------------------
 1748|     86|						break;
 1749|  14.9k|					*mb++=(uint16_t)(*ma++);
 1750|  14.9k|				}
 1751|    114|			}
 1752|    114|			break;
 1753|     96|		case TIFF_LONG8:
  ------------------
  |  Branch (1753:3): [True: 96, False: 1.40k]
  ------------------
 1754|     96|			{
 1755|     96|				uint64_t* ma;
 1756|     96|				uint16_t* mb;
 1757|     96|				uint32_t n;
 1758|     96|				ma=(uint64_t*)origdata;
 1759|     96|				mb=data;
 1760|    534|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1760:15): [True: 518, False: 16]
  ------------------
 1761|    518|				{
 1762|    518|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    518|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1762:10): [True: 146, False: 372]
  ------------------
 1763|    146|						TIFFSwabLong8(ma);
 1764|    518|					err=TIFFReadDirEntryCheckRangeShortLong8(*ma);
 1765|    518|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1765:10): [True: 80, False: 438]
  ------------------
 1766|     80|						break;
 1767|    438|					*mb++=(uint16_t)(*ma++);
 1768|    438|				}
 1769|     96|			}
 1770|     96|			break;
 1771|    182|		case TIFF_SLONG8:
  ------------------
  |  Branch (1771:3): [True: 182, False: 1.31k]
  ------------------
 1772|    182|			{
 1773|    182|				int64_t* ma;
 1774|    182|				uint16_t* mb;
 1775|    182|				uint32_t n;
 1776|    182|				ma=(int64_t*)origdata;
 1777|    182|				mb=data;
 1778|  1.56k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1778:15): [True: 1.53k, False: 24]
  ------------------
 1779|  1.53k|				{
 1780|  1.53k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  1.53k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1780:10): [True: 309, False: 1.22k]
  ------------------
 1781|    309|						TIFFSwabLong8((uint64_t*)ma);
 1782|  1.53k|					err=TIFFReadDirEntryCheckRangeShortSlong8(*ma);
 1783|  1.53k|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1783:10): [True: 158, False: 1.38k]
  ------------------
 1784|    158|						break;
 1785|  1.38k|					*mb++=(uint16_t)(*ma++);
 1786|  1.38k|				}
 1787|    182|			}
 1788|    182|			break;
 1789|  1.49k|	}
 1790|  1.49k|	_TIFFfree(origdata);
 1791|  1.49k|	if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1791:6): [True: 387, False: 1.10k]
  ------------------
 1792|    387|	{
 1793|    387|		_TIFFfree(data);
 1794|    387|		return(err);
 1795|    387|	}
 1796|  1.10k|	*value=data;
 1797|  1.10k|	return(TIFFReadDirEntryErrOk);
 1798|  1.49k|}
tif_dirread.c:_TIFFGetMaxColorChannels:
 3807|  15.9k|{
 3808|  15.9k|    switch (photometric) {
 3809|    121|	case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  218|    121|#define	    PHOTOMETRIC_PALETTE		3	/* color map indexed */
  ------------------
  |  Branch (3809:2): [True: 121, False: 15.8k]
  ------------------
 3810|  9.56k|	case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  215|  9.56k|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  |  Branch (3810:2): [True: 9.43k, False: 6.55k]
  ------------------
 3811|  9.62k|	case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  216|  9.62k|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  |  Branch (3811:2): [True: 61, False: 15.9k]
  ------------------
 3812|  9.62k|            return 1;
 3813|  5.57k|	case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  221|  5.57k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (3813:2): [True: 5.57k, False: 10.4k]
  ------------------
 3814|  5.75k|	case PHOTOMETRIC_RGB:
  ------------------
  |  |  217|  5.75k|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  |  Branch (3814:2): [True: 180, False: 15.8k]
  ------------------
 3815|  5.90k|	case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  222|  5.90k|#define	    PHOTOMETRIC_CIELAB		8	/* !1976 CIE L*a*b* */
  ------------------
  |  Branch (3815:2): [True: 145, False: 15.8k]
  ------------------
 3816|  6.10k|	case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  227|  6.10k|#define     PHOTOMETRIC_LOGLUV		32845	/* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (3816:2): [True: 205, False: 15.7k]
  ------------------
 3817|  6.10k|	case PHOTOMETRIC_ITULAB:
  ------------------
  |  |  224|  6.10k|#define	    PHOTOMETRIC_ITULAB		10	/* ITU L*a*b* */
  ------------------
  |  Branch (3817:2): [True: 2, False: 15.9k]
  ------------------
 3818|  6.10k|	case PHOTOMETRIC_ICCLAB:
  ------------------
  |  |  223|  6.10k|#define	    PHOTOMETRIC_ICCLAB		9	/* ICC L*a*b* [Adobe TIFF Technote 4] */
  ------------------
  |  Branch (3818:2): [True: 2, False: 15.9k]
  ------------------
 3819|  6.10k|            return 3;
 3820|     92|	case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  220|     92|#define	    PHOTOMETRIC_SEPARATED	5	/* !color separations */
  ------------------
  |  Branch (3820:2): [True: 92, False: 15.9k]
  ------------------
 3821|     95|	case PHOTOMETRIC_MASK:
  ------------------
  |  |  219|     95|#define	    PHOTOMETRIC_MASK		4	/* $holdout mask */
  ------------------
  |  Branch (3821:2): [True: 3, False: 15.9k]
  ------------------
 3822|     95|            return 4;
 3823|    115|	case PHOTOMETRIC_LOGL:
  ------------------
  |  |  226|    115|#define     PHOTOMETRIC_LOGL		32844	/* CIE Log2(L) */
  ------------------
  |  Branch (3823:2): [True: 115, False: 15.8k]
  ------------------
 3824|    115|	case PHOTOMETRIC_CFA:
  ------------------
  |  |  225|    115|#define	    PHOTOMETRIC_CFA		32803	/* color filter array */
  ------------------
  |  Branch (3824:2): [True: 0, False: 15.9k]
  ------------------
 3825|    172|	default:
  ------------------
  |  Branch (3825:2): [True: 57, False: 15.9k]
  ------------------
 3826|    172|            return 0;
 3827|  15.9k|    }
 3828|  15.9k|}
tif_dirread.c:ByteCountLooksBad:
 3831|    780|{
 3832|       |    /*
 3833|       |        * Assume we have wrong StripByteCount value (in case
 3834|       |        * of single strip) in following cases:
 3835|       |        *   - it is equal to zero along with StripOffset;
 3836|       |        *   - it is larger than file itself (in case of uncompressed
 3837|       |        *     image);
 3838|       |        *   - it is smaller than the size of the bytes per row
 3839|       |        *     multiplied on the number of rows.  The last case should
 3840|       |        *     not be checked in the case of writing new image,
 3841|       |        *     because we may do not know the exact strip size
 3842|       |        *     until the whole image will be written and directory
 3843|       |        *     dumped out.
 3844|       |        */
 3845|    780|    uint64_t bytecount = TIFFGetStrileByteCount(tif, 0);
 3846|    780|    uint64_t offset = TIFFGetStrileOffset(tif, 0);
 3847|    780|    uint64_t filesize;
 3848|       |
 3849|    780|    if( offset == 0 )
  ------------------
  |  Branch (3849:9): [True: 180, False: 600]
  ------------------
 3850|    180|        return 0;
 3851|    600|    if (bytecount == 0)
  ------------------
  |  Branch (3851:9): [True: 7, False: 593]
  ------------------
 3852|      7|        return 1;
 3853|    593|    if ( tif->tif_dir.td_compression != COMPRESSION_NONE )
  ------------------
  |  |  176|    593|#define	    COMPRESSION_NONE		1	/* dump mode */
  ------------------
  |  Branch (3853:10): [True: 209, False: 384]
  ------------------
 3854|    209|        return 0;
 3855|    384|    filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  220|    384|	((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 3856|    384|    if( offset <= filesize && bytecount > filesize - offset )
  ------------------
  |  Branch (3856:9): [True: 63, False: 321]
  |  Branch (3856:31): [True: 28, False: 35]
  ------------------
 3857|     28|        return 1;
 3858|    356|    if( tif->tif_mode == O_RDONLY )
  ------------------
  |  Branch (3858:9): [True: 356, False: 0]
  ------------------
 3859|    356|    {
 3860|    356|        uint64_t scanlinesize = TIFFScanlineSize64(tif);
 3861|    356|        if( tif->tif_dir.td_imagelength > 0 &&
  ------------------
  |  Branch (3861:13): [True: 290, False: 66]
  ------------------
 3862|    356|            scanlinesize > UINT64_MAX / tif->tif_dir.td_imagelength )
  ------------------
  |  Branch (3862:13): [True: 1, False: 289]
  ------------------
 3863|      1|        {
 3864|      1|            return 1;
 3865|      1|        }
 3866|    355|        if( bytecount < scanlinesize * tif->tif_dir.td_imagelength)
  ------------------
  |  Branch (3866:13): [True: 34, False: 321]
  ------------------
 3867|     34|            return 1;
 3868|    355|    }
 3869|    321|    return 0;
 3870|    356|}
tif_dirread.c:TIFFReadDirectoryCheckOrder:
 4689|  23.1k|{
 4690|  23.1k|	static const char module[] = "TIFFReadDirectoryCheckOrder";
 4691|  23.1k|	uint16_t m;
 4692|  23.1k|	uint16_t n;
 4693|  23.1k|	TIFFDirEntry* o;
 4694|  23.1k|	m=0;
 4695|  81.9k|	for (n=0, o=dir; n<dircount; n++, o++)
  ------------------
  |  Branch (4695:19): [True: 79.0k, False: 2.92k]
  ------------------
 4696|  79.0k|	{
 4697|  79.0k|		if (o->tdir_tag<m)
  ------------------
  |  Branch (4697:7): [True: 20.2k, False: 58.8k]
  ------------------
 4698|  20.2k|		{
 4699|  20.2k|			TIFFWarningExtR(tif,module,
 4700|  20.2k|			    "Invalid TIFF directory; tags are not sorted in ascending order");
 4701|  20.2k|			break;
 4702|  20.2k|		}
 4703|  58.8k|		m=o->tdir_tag+1;
 4704|  58.8k|	}
 4705|  23.1k|}
tif_dirread.c:TIFFReadDirectoryFindEntry:
 4709|  46.9k|{
 4710|  46.9k|	TIFFDirEntry* m;
 4711|  46.9k|	uint16_t n;
 4712|  46.9k|	(void) tif;
 4713|   570k|	for (m=dir, n=0; n<dircount; m++, n++)
  ------------------
  |  Branch (4713:19): [True: 543k, False: 26.6k]
  ------------------
 4714|   543k|	{
 4715|   543k|		if (m->tdir_tag==tagid)
  ------------------
  |  Branch (4715:7): [True: 20.3k, False: 523k]
  ------------------
 4716|  20.3k|			return(m);
 4717|   543k|	}
 4718|  26.6k|	return(0);
 4719|  46.9k|}
tif_dirread.c:TIFFReadDirectoryFindFieldInfo:
 4723|   673k|{
 4724|   673k|	int32_t ma,mb,mc;
 4725|   673k|	ma=-1;
 4726|   673k|	mc=(int32_t)tif->tif_nfields;
 4727|  5.06M|	while (1)
  ------------------
  |  Branch (4727:9): [Folded - Ignored]
  ------------------
 4728|  5.06M|	{
 4729|  5.06M|		if (ma+1==mc)
  ------------------
  |  Branch (4729:7): [True: 154k, False: 4.91M]
  ------------------
 4730|   154k|		{
 4731|   154k|			*fii = FAILED_FII;
  ------------------
  |  |   43|   154k|#define FAILED_FII    ((uint32_t) -1)
  ------------------
 4732|   154k|			return;
 4733|   154k|		}
 4734|  4.91M|		mb=(ma+mc)/2;
 4735|  4.91M|		if (tif->tif_fields[mb]->field_tag==(uint32_t)tagid)
  ------------------
  |  Branch (4735:7): [True: 519k, False: 4.39M]
  ------------------
 4736|   519k|			break;
 4737|  4.39M|		if (tif->tif_fields[mb]->field_tag<(uint32_t)tagid)
  ------------------
  |  Branch (4737:7): [True: 2.03M, False: 2.35M]
  ------------------
 4738|  2.03M|			ma=mb;
 4739|  2.35M|		else
 4740|  2.35M|			mc=mb;
 4741|  4.39M|	}
 4742|   519k|	while (1)
  ------------------
  |  Branch (4742:9): [Folded - Ignored]
  ------------------
 4743|   519k|	{
 4744|   519k|		if (mb==0)
  ------------------
  |  Branch (4744:7): [True: 22.1k, False: 497k]
  ------------------
 4745|  22.1k|			break;
 4746|   497k|		if (tif->tif_fields[mb-1]->field_tag!=(uint32_t)tagid)
  ------------------
  |  Branch (4746:7): [True: 497k, False: 0]
  ------------------
 4747|   497k|			break;
 4748|      0|		mb--;
 4749|      0|	}
 4750|   519k|	*fii=mb;
 4751|   519k|}
tif_dirread.c:EstimateStripByteCounts:
 4893|  5.28k|{
 4894|  5.28k|	static const char module[] = "EstimateStripByteCounts";
 4895|       |
 4896|  5.28k|	TIFFDirEntry *dp;
 4897|  5.28k|	TIFFDirectory *td = &tif->tif_dir;
 4898|  5.28k|	uint32_t strip;
 4899|       |
 4900|       |    /* Do not try to load stripbytecount as we will compute it */
 4901|  5.28k|        if( !_TIFFFillStrilesInternal( tif, 0 ) )
  ------------------
  |  Branch (4901:13): [True: 0, False: 5.28k]
  ------------------
 4902|      0|            return -1;
 4903|       |
 4904|  5.28k|	if (td->td_stripbytecount_p)
  ------------------
  |  Branch (4904:6): [True: 377, False: 4.91k]
  ------------------
 4905|    377|		_TIFFfree(td->td_stripbytecount_p);
 4906|  5.28k|	td->td_stripbytecount_p = (uint64_t*)
 4907|  5.28k|	    _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64_t),
 4908|  5.28k|		"for \"StripByteCounts\" array");
 4909|  5.28k|        if( td->td_stripbytecount_p == NULL )
  ------------------
  |  Branch (4909:13): [True: 0, False: 5.28k]
  ------------------
 4910|      0|            return -1;
 4911|       |
 4912|  5.28k|	if (td->td_compression != COMPRESSION_NONE) {
  ------------------
  |  |  176|  5.28k|#define	    COMPRESSION_NONE		1	/* dump mode */
  ------------------
  |  Branch (4912:6): [True: 4.08k, False: 1.19k]
  ------------------
 4913|  4.08k|		uint64_t space;
 4914|  4.08k|		uint64_t filesize;
 4915|  4.08k|		uint16_t n;
 4916|  4.08k|		filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  220|  4.08k|	((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 4917|  4.08k|		if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|  4.08k|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (4917:7): [True: 3.95k, False: 137]
  ------------------
 4918|  3.95k|			space=sizeof(TIFFHeaderClassic)+2+dircount*12+4;
 4919|    137|		else
 4920|    137|			space=sizeof(TIFFHeaderBig)+8+dircount*20+8;
 4921|       |		/* calculate amount of space used by indirect values */
 4922|  38.5k|		for (dp = dir, n = dircount; n > 0; n--, dp++)
  ------------------
  |  Branch (4922:32): [True: 34.4k, False: 4.01k]
  ------------------
 4923|  34.4k|		{
 4924|  34.4k|			uint32_t typewidth;
 4925|  34.4k|			uint64_t datasize;
 4926|  34.4k|			typewidth = TIFFDataWidth((TIFFDataType) dp->tdir_type);
 4927|  34.4k|			if (typewidth == 0) {
  ------------------
  |  Branch (4927:8): [True: 52, False: 34.4k]
  ------------------
 4928|     52|				TIFFErrorExtR(tif, module,
 4929|     52|				    "Cannot determine size of unknown tag type %"PRIu16,
 4930|     52|				    dp->tdir_type);
 4931|     52|				return -1;
 4932|     52|			}
 4933|  34.4k|			if( dp->tdir_count > UINT64_MAX / typewidth )
  ------------------
  |  Branch (4933:8): [True: 4, False: 34.4k]
  ------------------
 4934|      4|                            return -1;
 4935|  34.4k|			datasize= (uint64_t)typewidth * dp->tdir_count;
 4936|  34.4k|			if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|  34.4k|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (4936:8): [True: 33.6k, False: 757]
  ------------------
 4937|  33.6k|			{
 4938|  33.6k|				if (datasize<=4)
  ------------------
  |  Branch (4938:9): [True: 25.3k, False: 8.35k]
  ------------------
 4939|  25.3k|					datasize=0;
 4940|  33.6k|			}
 4941|    757|			else
 4942|    757|			{
 4943|    757|				if (datasize<=8)
  ------------------
  |  Branch (4943:9): [True: 457, False: 300]
  ------------------
 4944|    457|					datasize=0;
 4945|    757|			}
 4946|  34.4k|			if( space > UINT64_MAX - datasize )
  ------------------
  |  Branch (4946:8): [True: 15, False: 34.4k]
  ------------------
 4947|     15|                            return -1;
 4948|  34.4k|			space+=datasize;
 4949|  34.4k|		}
 4950|  4.01k|		if( filesize < space )
  ------------------
  |  Branch (4950:7): [True: 3.36k, False: 652]
  ------------------
 4951|       |                    /* we should perhaps return in error ? */
 4952|  3.36k|                    space = filesize;
 4953|    652|                else
 4954|    652|                    space = filesize - space;
 4955|  4.01k|		if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  260|  4.01k|#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  ------------------
  |  Branch (4955:7): [True: 45, False: 3.97k]
  ------------------
 4956|     45|			space /= td->td_samplesperpixel;
 4957|   246k|		for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (4957:19): [True: 242k, False: 4.01k]
  ------------------
 4958|   242k|			td->td_stripbytecount_p[strip] = space;
 4959|       |		/*
 4960|       |		 * This gross hack handles the case were the offset to
 4961|       |		 * the last strip is past the place where we think the strip
 4962|       |		 * should begin.  Since a strip of data must be contiguous,
 4963|       |		 * it's safe to assume that we've overestimated the amount
 4964|       |		 * of data in the strip and trim this number back accordingly.
 4965|       |		 */
 4966|  4.01k|		strip--;
 4967|  4.01k|                if (td->td_stripoffset_p[strip] > UINT64_MAX - td->td_stripbytecount_p[strip])
  ------------------
  |  Branch (4967:21): [True: 9, False: 4.00k]
  ------------------
 4968|      9|                    return -1;
 4969|  4.00k|		if (td->td_stripoffset_p[strip]+td->td_stripbytecount_p[strip] > filesize) {
  ------------------
  |  Branch (4969:7): [True: 3.15k, False: 855]
  ------------------
 4970|  3.15k|                    if( td->td_stripoffset_p[strip] >= filesize ) {
  ------------------
  |  Branch (4970:25): [True: 206, False: 2.94k]
  ------------------
 4971|       |                        /* Not sure what we should in that case... */
 4972|    206|                        td->td_stripbytecount_p[strip] = 0;
 4973|  2.94k|                    } else {
 4974|  2.94k|                        td->td_stripbytecount_p[strip] = filesize - td->td_stripoffset_p[strip];
 4975|  2.94k|                    }
 4976|  3.15k|                }
 4977|  4.00k|	} else if (isTiled(tif)) {
  ------------------
  |  |  207|  1.19k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  1.19k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 222, False: 977]
  |  |  ------------------
  ------------------
 4978|    222|		uint64_t bytespertile = TIFFTileSize64(tif);
 4979|       |
 4980|  9.58M|		for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (4980:19): [True: 9.58M, False: 222]
  ------------------
 4981|  9.58M|		    td->td_stripbytecount_p[strip] = bytespertile;
 4982|    977|	} else {
 4983|    977|		uint64_t rowbytes = TIFFScanlineSize64(tif);
 4984|    977|		uint32_t rowsperstrip = td->td_imagelength / td->td_stripsperimage;
 4985|  11.9M|		for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (4985:19): [True: 11.9M, False: 975]
  ------------------
 4986|  11.9M|                {
 4987|  11.9M|                    if( rowbytes > 0 && rowsperstrip > UINT64_MAX / rowbytes )
  ------------------
  |  Branch (4987:25): [True: 148k, False: 11.8M]
  |  Branch (4987:41): [True: 2, False: 148k]
  ------------------
 4988|      2|                        return -1;
 4989|  11.9M|                    td->td_stripbytecount_p[strip] = rowbytes * rowsperstrip;
 4990|  11.9M|                }
 4991|    977|	}
 4992|  5.20k|	TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
  ------------------
  |  |  199|  5.20k|#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  197|  5.20k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  196|  5.20k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
 4993|  5.20k|	if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))
  ------------------
  |  |  198|  5.20k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  5.20k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  5.20k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4993:6): [True: 3.22k, False: 1.98k]
  ------------------
 4994|  3.22k|		td->td_rowsperstrip = td->td_imagelength;
 4995|  5.20k|	return 1;
 4996|  5.28k|}
tif_dirread.c:MissingRequired:
 5000|  4.33k|{
 5001|  4.33k|	static const char module[] = "MissingRequired";
 5002|       |
 5003|  4.33k|	TIFFErrorExtR(tif, module,
 5004|  4.33k|	    "TIFF directory is missing required \"%s\" field",
 5005|  4.33k|	    tagname);
 5006|  4.33k|}
tif_dirread.c:TIFFFetchDirectory:
 5165|  23.4k|{
 5166|  23.4k|	static const char module[] = "TIFFFetchDirectory";
 5167|       |
 5168|  23.4k|	void* origdir;
 5169|  23.4k|	uint16_t dircount16;
 5170|  23.4k|	uint32_t dirsize;
 5171|  23.4k|	TIFFDirEntry* dir;
 5172|  23.4k|	uint8_t* ma;
 5173|  23.4k|	TIFFDirEntry* mb;
 5174|  23.4k|	uint16_t n;
 5175|       |
 5176|  23.4k|	assert(pdir);
 5177|       |
 5178|  23.4k|	tif->tif_diroff = diroff;
 5179|  23.4k|	if (nextdiroff)
  ------------------
  |  Branch (5179:6): [True: 23.4k, False: 0]
  ------------------
 5180|  23.4k|		*nextdiroff = 0;
 5181|  23.4k|	if (!isMapped(tif)) {
  ------------------
  |  |  208|  23.4k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  102|  23.4k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (5181:6): [True: 23.4k, False: 0]
  ------------------
 5182|  23.4k|		if (!SeekOK(tif, tif->tif_diroff)) {
  ------------------
  |  |  234|  23.4k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (5182:7): [True: 149, False: 23.2k]
  ------------------
 5183|    149|			TIFFErrorExtR(tif, module,
 5184|    149|				"%s: Seek error accessing TIFF directory",
 5185|    149|				tif->tif_name);
 5186|    149|			return 0;
 5187|    149|		}
 5188|  23.2k|		if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|  23.2k|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (5188:7): [True: 21.6k, False: 1.63k]
  ------------------
 5189|  21.6k|		{
 5190|  21.6k|			if (!ReadOK(tif, &dircount16, sizeof (uint16_t))) {
  ------------------
  |  |  231|  21.6k|	(TIFFReadFile((tif),(buf),(size))==(size))
  |  |  ------------------
  |  |  |  |  212|  21.6k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  |  |  ------------------
  ------------------
  |  Branch (5190:8): [True: 2, False: 21.6k]
  ------------------
 5191|      2|				TIFFErrorExtR(tif, module,
 5192|      2|				    "%s: Can not read TIFF directory count",
 5193|      2|				    tif->tif_name);
 5194|      2|				return 0;
 5195|      2|			}
 5196|  21.6k|			if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |   98|  21.6k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5196:8): [True: 1.36k, False: 20.2k]
  ------------------
 5197|  1.36k|				TIFFSwabShort(&dircount16);
 5198|  21.6k|			if (dircount16>4096)
  ------------------
  |  Branch (5198:8): [True: 9, False: 21.6k]
  ------------------
 5199|      9|			{
 5200|      9|				TIFFErrorExtR(tif, module,
 5201|      9|				    "Sanity check on directory count failed, this is probably not a valid IFD offset");
 5202|      9|				return 0;
 5203|      9|			}
 5204|  21.6k|			dirsize = 12;
 5205|  21.6k|		} else {
 5206|  1.63k|			uint64_t dircount64;
 5207|  1.63k|			if (!ReadOK(tif, &dircount64, sizeof (uint64_t))) {
  ------------------
  |  |  231|  1.63k|	(TIFFReadFile((tif),(buf),(size))==(size))
  |  |  ------------------
  |  |  |  |  212|  1.63k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  |  |  ------------------
  ------------------
  |  Branch (5207:8): [True: 5, False: 1.62k]
  ------------------
 5208|      5|				TIFFErrorExtR(tif, module,
 5209|      5|					"%s: Can not read TIFF directory count",
 5210|      5|					tif->tif_name);
 5211|      5|				return 0;
 5212|      5|			}
 5213|  1.62k|			if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |   98|  1.62k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5213:8): [True: 57, False: 1.57k]
  ------------------
 5214|     57|				TIFFSwabLong8(&dircount64);
 5215|  1.62k|			if (dircount64>4096)
  ------------------
  |  Branch (5215:8): [True: 87, False: 1.54k]
  ------------------
 5216|     87|			{
 5217|     87|				TIFFErrorExtR(tif, module,
 5218|     87|				    "Sanity check on directory count failed, this is probably not a valid IFD offset");
 5219|     87|				return 0;
 5220|     87|			}
 5221|  1.54k|			dircount16 = (uint16_t)dircount64;
 5222|  1.54k|			dirsize = 20;
 5223|  1.54k|		}
 5224|  23.1k|		origdir = _TIFFCheckMalloc(tif, dircount16,
 5225|  23.1k|		    dirsize, "to read TIFF directory");
 5226|  23.1k|		if (origdir == NULL)
  ------------------
  |  Branch (5226:7): [True: 1, False: 23.1k]
  ------------------
 5227|      1|			return 0;
 5228|  23.1k|		if (!ReadOK(tif, origdir, (tmsize_t)(dircount16*dirsize))) {
  ------------------
  |  |  231|  23.1k|	(TIFFReadFile((tif),(buf),(size))==(size))
  |  |  ------------------
  |  |  |  |  212|  23.1k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  |  |  ------------------
  ------------------
  |  Branch (5228:7): [True: 39, False: 23.1k]
  ------------------
 5229|     39|			TIFFErrorExtR(tif, module,
 5230|     39|				"%.100s: Can not read TIFF directory",
 5231|     39|				tif->tif_name);
 5232|     39|			_TIFFfree(origdir);
 5233|     39|			return 0;
 5234|     39|		}
 5235|       |		/*
 5236|       |		 * Read offset to next directory for sequential scans if
 5237|       |		 * needed.
 5238|       |		 */
 5239|  23.1k|		if (nextdiroff)
  ------------------
  |  Branch (5239:7): [True: 23.1k, False: 0]
  ------------------
 5240|  23.1k|		{
 5241|  23.1k|			if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|  23.1k|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (5241:8): [True: 21.6k, False: 1.53k]
  ------------------
 5242|  21.6k|			{
 5243|  21.6k|				uint32_t nextdiroff32;
 5244|  21.6k|				if (!ReadOK(tif, &nextdiroff32, sizeof(uint32_t)))
  ------------------
  |  |  231|  21.6k|	(TIFFReadFile((tif),(buf),(size))==(size))
  |  |  ------------------
  |  |  |  |  212|  21.6k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  |  |  ------------------
  ------------------
  |  Branch (5244:9): [True: 2.63k, False: 18.9k]
  ------------------
 5245|  2.63k|					nextdiroff32 = 0;
 5246|  21.6k|				if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  21.6k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5246:9): [True: 1.35k, False: 20.2k]
  ------------------
 5247|  1.35k|					TIFFSwabLong(&nextdiroff32);
 5248|  21.6k|				*nextdiroff=nextdiroff32;
 5249|  21.6k|			} else {
 5250|  1.53k|				if (!ReadOK(tif, nextdiroff, sizeof(uint64_t)))
  ------------------
  |  |  231|  1.53k|	(TIFFReadFile((tif),(buf),(size))==(size))
  |  |  ------------------
  |  |  |  |  212|  1.53k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  |  |  ------------------
  ------------------
  |  Branch (5250:9): [True: 1.06k, False: 470]
  ------------------
 5251|  1.06k|					*nextdiroff = 0;
 5252|  1.53k|				if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  1.53k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5252:9): [True: 52, False: 1.48k]
  ------------------
 5253|     52|					TIFFSwabLong8(nextdiroff);
 5254|  1.53k|			}
 5255|  23.1k|		}
 5256|  23.1k|	} else {
 5257|      0|		tmsize_t m;
 5258|      0|		tmsize_t off;
 5259|      0|		if (tif->tif_diroff > (uint64_t)INT64_MAX)
  ------------------
  |  Branch (5259:7): [True: 0, False: 0]
  ------------------
 5260|      0|		{
 5261|      0|			TIFFErrorExtR(tif,module,"Can not read TIFF directory count");
 5262|      0|			return(0);
 5263|      0|		}
 5264|      0|		off = (tmsize_t) tif->tif_diroff;
 5265|       |
 5266|       |		/*
 5267|       |		 * Check for integer overflow when validating the dir_off,
 5268|       |		 * otherwise a very high offset may cause an OOB read and
 5269|       |		 * crash the client. Make two comparisons instead of
 5270|       |		 *
 5271|       |		 *  off + sizeof(uint16_t) > tif->tif_size
 5272|       |		 *
 5273|       |		 * to avoid overflow.
 5274|       |		 */
 5275|      0|		if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|      0|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (5275:7): [True: 0, False: 0]
  ------------------
 5276|      0|		{
 5277|      0|			m=off+sizeof(uint16_t);
 5278|      0|			if ((m<off) || (m<(tmsize_t)sizeof(uint16_t)) || (m > tif->tif_size)) {
  ------------------
  |  Branch (5278:8): [True: 0, False: 0]
  |  Branch (5278:19): [True: 0, False: 0]
  |  Branch (5278:53): [True: 0, False: 0]
  ------------------
 5279|      0|				TIFFErrorExtR(tif, module,
 5280|      0|					"Can not read TIFF directory count");
 5281|      0|				return 0;
 5282|      0|			} else {
 5283|      0|				_TIFFmemcpy(&dircount16, tif->tif_base + off,
 5284|      0|					    sizeof(uint16_t));
 5285|      0|			}
 5286|      0|			off += sizeof (uint16_t);
 5287|      0|			if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5287:8): [True: 0, False: 0]
  ------------------
 5288|      0|				TIFFSwabShort(&dircount16);
 5289|      0|			if (dircount16>4096)
  ------------------
  |  Branch (5289:8): [True: 0, False: 0]
  ------------------
 5290|      0|			{
 5291|      0|				TIFFErrorExtR(tif, module,
 5292|      0|				    "Sanity check on directory count failed, this is probably not a valid IFD offset");
 5293|      0|				return 0;
 5294|      0|			}
 5295|      0|			dirsize = 12;
 5296|      0|		}
 5297|      0|		else
 5298|      0|		{
 5299|      0|			uint64_t dircount64;
 5300|      0|			m=off+sizeof(uint64_t);
 5301|      0|			if ((m<off) || (m<(tmsize_t)sizeof(uint64_t)) || (m > tif->tif_size)) {
  ------------------
  |  Branch (5301:8): [True: 0, False: 0]
  |  Branch (5301:19): [True: 0, False: 0]
  |  Branch (5301:53): [True: 0, False: 0]
  ------------------
 5302|      0|				TIFFErrorExtR(tif, module,
 5303|      0|					"Can not read TIFF directory count");
 5304|      0|				return 0;
 5305|      0|			} else {
 5306|      0|				_TIFFmemcpy(&dircount64, tif->tif_base + off,
 5307|      0|					    sizeof(uint64_t));
 5308|      0|			}
 5309|      0|			off += sizeof (uint64_t);
 5310|      0|			if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5310:8): [True: 0, False: 0]
  ------------------
 5311|      0|				TIFFSwabLong8(&dircount64);
 5312|      0|			if (dircount64>4096)
  ------------------
  |  Branch (5312:8): [True: 0, False: 0]
  ------------------
 5313|      0|			{
 5314|      0|				TIFFErrorExtR(tif, module,
 5315|      0|				    "Sanity check on directory count failed, this is probably not a valid IFD offset");
 5316|      0|				return 0;
 5317|      0|			}
 5318|      0|			dircount16 = (uint16_t)dircount64;
 5319|      0|			dirsize = 20;
 5320|      0|		}
 5321|      0|		if (dircount16 == 0 )
  ------------------
  |  Branch (5321:7): [True: 0, False: 0]
  ------------------
 5322|      0|		{
 5323|      0|			TIFFErrorExtR(tif, module,
 5324|      0|			             "Sanity check on directory count failed, zero tag directories not supported");
 5325|      0|			return 0;
 5326|      0|		}
 5327|      0|		origdir = _TIFFCheckMalloc(tif, dircount16,
 5328|      0|						dirsize,
 5329|      0|						"to read TIFF directory");
 5330|      0|		if (origdir == NULL)
  ------------------
  |  Branch (5330:7): [True: 0, False: 0]
  ------------------
 5331|      0|			return 0;
 5332|      0|		m=off+dircount16*dirsize;
 5333|      0|		if ((m<off)||(m<(tmsize_t)(dircount16*dirsize))||(m>tif->tif_size)) {
  ------------------
  |  Branch (5333:7): [True: 0, False: 0]
  |  Branch (5333:16): [True: 0, False: 0]
  |  Branch (5333:52): [True: 0, False: 0]
  ------------------
 5334|      0|			TIFFErrorExtR(tif, module,
 5335|      0|				     "Can not read TIFF directory");
 5336|      0|			_TIFFfree(origdir);
 5337|      0|			return 0;
 5338|      0|		} else {
 5339|      0|			_TIFFmemcpy(origdir, tif->tif_base + off,
 5340|      0|				    dircount16 * dirsize);
 5341|      0|		}
 5342|      0|		if (nextdiroff) {
  ------------------
  |  Branch (5342:7): [True: 0, False: 0]
  ------------------
 5343|      0|			off += dircount16 * dirsize;
 5344|      0|			if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|      0|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (5344:8): [True: 0, False: 0]
  ------------------
 5345|      0|			{
 5346|      0|				uint32_t nextdiroff32;
 5347|      0|				m=off+sizeof(uint32_t);
 5348|      0|				if ((m<off) || (m<(tmsize_t)sizeof(uint32_t)) || (m > tif->tif_size))
  ------------------
  |  Branch (5348:9): [True: 0, False: 0]
  |  Branch (5348:20): [True: 0, False: 0]
  |  Branch (5348:54): [True: 0, False: 0]
  ------------------
 5349|      0|					nextdiroff32 = 0;
 5350|      0|				else
 5351|      0|					_TIFFmemcpy(&nextdiroff32, tif->tif_base + off,
 5352|      0|						    sizeof (uint32_t));
 5353|      0|				if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5353:9): [True: 0, False: 0]
  ------------------
 5354|      0|					TIFFSwabLong(&nextdiroff32);
 5355|      0|				*nextdiroff = nextdiroff32;
 5356|      0|			}
 5357|      0|			else
 5358|      0|			{
 5359|      0|				m=off+sizeof(uint64_t);
 5360|      0|				if ((m<off) || (m<(tmsize_t)sizeof(uint64_t)) || (m > tif->tif_size))
  ------------------
  |  Branch (5360:9): [True: 0, False: 0]
  |  Branch (5360:20): [True: 0, False: 0]
  |  Branch (5360:54): [True: 0, False: 0]
  ------------------
 5361|      0|					*nextdiroff = 0;
 5362|      0|				else
 5363|      0|					_TIFFmemcpy(nextdiroff, tif->tif_base + off,
 5364|      0|						    sizeof (uint64_t));
 5365|      0|				if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5365:9): [True: 0, False: 0]
  ------------------
 5366|      0|					TIFFSwabLong8(nextdiroff);
 5367|      0|			}
 5368|      0|		}
 5369|      0|	}
 5370|  23.1k|	dir = (TIFFDirEntry*)_TIFFCheckMalloc(tif, dircount16,
 5371|  23.1k|						sizeof(TIFFDirEntry),
 5372|  23.1k|						"to read TIFF directory");
 5373|  23.1k|	if (dir==0)
  ------------------
  |  Branch (5373:6): [True: 0, False: 23.1k]
  ------------------
 5374|      0|	{
 5375|      0|		_TIFFfree(origdir);
 5376|      0|		return 0;
 5377|      0|	}
 5378|  23.1k|	ma=(uint8_t*)origdir;
 5379|  23.1k|	mb=dir;
 5380|   511k|	for (n=0; n<dircount16; n++)
  ------------------
  |  Branch (5380:12): [True: 488k, False: 23.1k]
  ------------------
 5381|   488k|	{
 5382|   488k|		mb->tdir_ignore = FALSE;
  ------------------
  |  |   62|   488k|#define	FALSE	0
  ------------------
 5383|   488k|		if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|   488k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5383:7): [True: 15.8k, False: 472k]
  ------------------
 5384|  15.8k|			TIFFSwabShort((uint16_t*)ma);
 5385|   488k|		mb->tdir_tag=*(uint16_t*)ma;
 5386|   488k|		ma+=sizeof(uint16_t);
 5387|   488k|		if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|   488k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5387:7): [True: 15.8k, False: 472k]
  ------------------
 5388|  15.8k|			TIFFSwabShort((uint16_t*)ma);
 5389|   488k|		mb->tdir_type=*(uint16_t*)ma;
 5390|   488k|		ma+=sizeof(uint16_t);
 5391|   488k|		if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|   488k|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (5391:7): [True: 471k, False: 16.7k]
  ------------------
 5392|   471k|		{
 5393|   471k|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|   471k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5393:8): [True: 15.4k, False: 455k]
  ------------------
 5394|  15.4k|				TIFFSwabLong((uint32_t*)ma);
 5395|   471k|			mb->tdir_count=(uint64_t)(*(uint32_t*)ma);
 5396|   471k|			ma+=sizeof(uint32_t);
 5397|   471k|			mb->tdir_offset.toff_long8=0;
 5398|   471k|			*(uint32_t*)(&mb->tdir_offset)=*(uint32_t*)ma;
 5399|   471k|			ma+=sizeof(uint32_t);
 5400|   471k|		}
 5401|  16.7k|		else
 5402|  16.7k|		{
 5403|  16.7k|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  16.7k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (5403:8): [True: 381, False: 16.3k]
  ------------------
 5404|    381|				TIFFSwabLong8((uint64_t*)ma);
 5405|  16.7k|                        mb->tdir_count=TIFFReadUInt64(ma);
 5406|  16.7k|			ma+=sizeof(uint64_t);
 5407|  16.7k|			mb->tdir_offset.toff_long8=TIFFReadUInt64(ma);
 5408|  16.7k|			ma+=sizeof(uint64_t);
 5409|  16.7k|		}
 5410|   488k|		mb++;
 5411|   488k|	}
 5412|  23.1k|	_TIFFfree(origdir);
 5413|  23.1k|	*pdir = dir;
 5414|  23.1k|	return dircount16;
 5415|  23.1k|}
tif_dirread.c:TIFFReadUInt64:
  184|  33.5k|{
  185|  33.5k|	UInt64Aligned_t result;
  186|       |
  187|  33.5k|	result.c[0]=value[0];
  188|  33.5k|	result.c[1]=value[1];
  189|  33.5k|	result.c[2]=value[2];
  190|  33.5k|	result.c[3]=value[3];
  191|  33.5k|	result.c[4]=value[4];
  192|  33.5k|	result.c[5]=value[5];
  193|  33.5k|	result.c[6]=value[6];
  194|  33.5k|	result.c[7]=value[7];
  195|       |
  196|  33.5k|	return result.l;
  197|  33.5k|}
tif_dirread.c:TIFFFetchNormalTag:
 5422|   237k|{
 5423|   237k|	static const char module[] = "TIFFFetchNormalTag";
 5424|   237k|	enum TIFFReadDirEntryErr err;
 5425|   237k|	uint32_t fii;
 5426|   237k|	const TIFFField* fip = NULL;
 5427|   237k|	TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii);
 5428|   237k|        if( fii == FAILED_FII )
  ------------------
  |  |   43|   237k|#define FAILED_FII    ((uint32_t) -1)
  ------------------
  |  Branch (5428:13): [True: 0, False: 237k]
  ------------------
 5429|      0|        {
 5430|      0|            TIFFErrorExtR(tif, "TIFFFetchNormalTag",
 5431|      0|                         "No definition found for tag %"PRIu16,
 5432|      0|                         dp->tdir_tag);
 5433|      0|            return 0;
 5434|      0|        }
 5435|   237k|	fip=tif->tif_fields[fii];
 5436|   237k|	assert(fip != NULL); /* should not happen */
 5437|   237k|	assert(fip->set_field_type!=TIFF_SETGET_OTHER);  /* if so, we shouldn't arrive here but deal with this in specialized code */
 5438|   237k|	assert(fip->set_field_type!=TIFF_SETGET_INT);    /* if so, we shouldn't arrive here as this is only the case for pseudo-tags */
 5439|   237k|	err=TIFFReadDirEntryErrOk;
 5440|   237k|	switch (fip->set_field_type)
 5441|   237k|	{
 5442|   118k|		case TIFF_SETGET_UNDEFINED:
  ------------------
  |  Branch (5442:3): [True: 118k, False: 119k]
  ------------------
 5443|   118k|				TIFFErrorExtR(tif, "TIFFFetchNormalTag",
 5444|   118k|					"Defined set_field_type of custom tag %u (%s) is TIFF_SETGET_UNDEFINED and thus tag is not read from file",
 5445|   118k|					fip->field_tag, fip->field_name);
 5446|   118k|			break;
 5447|  2.57k|		case TIFF_SETGET_ASCII:
  ------------------
  |  Branch (5447:3): [True: 2.57k, False: 235k]
  ------------------
 5448|  2.57k|			{
 5449|  2.57k|				uint8_t* data;
 5450|  2.57k|				assert(fip->field_passcount==0);
 5451|  2.57k|				err=TIFFReadDirEntryByteArray(tif,dp,&data);
 5452|  2.57k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5452:9): [True: 814, False: 1.75k]
  ------------------
 5453|    814|				{
 5454|    814|					size_t mb = 0;
 5455|    814|					int n;
 5456|    814|					if (data != NULL)
  ------------------
  |  Branch (5456:10): [True: 758, False: 56]
  ------------------
 5457|    758|					{
 5458|    758|						if (dp->tdir_count > 0 && data[dp->tdir_count - 1] == 0)
  ------------------
  |  Branch (5458:11): [True: 758, False: 0]
  |  Branch (5458:33): [True: 355, False: 403]
  ------------------
 5459|    355|						{
 5460|       |							/* optimization: if data is known to be 0 terminated, we can use strlen() */
 5461|    355|							mb = strlen((const char*)data);
 5462|    355|						}
 5463|    403|						else
 5464|    403|						{
 5465|       |							/* general case. equivalent to non-portable */
 5466|       |							/* mb = strnlen((const char*)data, (uint32_t)dp->tdir_count); */
 5467|    403|							uint8_t* ma = data;
 5468|   524k|							while (mb<(uint32_t)dp->tdir_count)
  ------------------
  |  Branch (5468:15): [True: 524k, False: 283]
  ------------------
 5469|   524k|							{
 5470|   524k|								if (*ma==0)
  ------------------
  |  Branch (5470:13): [True: 120, False: 523k]
  ------------------
 5471|    120|									break;
 5472|   523k|								ma++;
 5473|   523k|								mb++;
 5474|   523k|							}
 5475|    403|						}
 5476|    758|					}
 5477|    814|					if (mb+1<(uint32_t)dp->tdir_count)
  ------------------
  |  Branch (5477:10): [True: 249, False: 565]
  ------------------
 5478|    249|						TIFFWarningExtR(tif,module,"ASCII value for tag \"%s\" contains null byte in value; value incorrectly truncated during reading due to implementation limitations",fip->field_name);
 5479|    565|					else if (mb+1>(uint32_t)dp->tdir_count)
  ------------------
  |  Branch (5479:15): [True: 339, False: 226]
  ------------------
 5480|    339|					{
 5481|    339|						uint8_t* o;
 5482|    339|						TIFFWarningExtR(tif,module,"ASCII value for tag \"%s\" does not end in null byte",fip->field_name);
 5483|       |						/* TIFFReadDirEntryArrayWithLimit() ensures this can't be larger than MAX_SIZE_TAG_DATA */
 5484|    339|						assert((uint32_t)dp->tdir_count + 1 == dp->tdir_count + 1);
 5485|    339|						o=_TIFFmalloc((uint32_t)dp->tdir_count + 1);
 5486|    339|						if (o==NULL)
  ------------------
  |  Branch (5486:11): [True: 0, False: 339]
  ------------------
 5487|      0|						{
 5488|      0|							if (data!=NULL)
  ------------------
  |  Branch (5488:12): [True: 0, False: 0]
  ------------------
 5489|      0|								_TIFFfree(data);
 5490|      0|							return(0);
 5491|      0|						}
 5492|    339|						if (dp->tdir_count > 0 )
  ------------------
  |  Branch (5492:11): [True: 283, False: 56]
  ------------------
 5493|    283|						{
 5494|    283|							_TIFFmemcpy(o,data,(uint32_t)dp->tdir_count);
 5495|    283|						}
 5496|    339|						o[(uint32_t)dp->tdir_count]=0;
 5497|    339|						if (data!=0)
  ------------------
  |  Branch (5497:11): [True: 283, False: 56]
  ------------------
 5498|    283|							_TIFFfree(data);
 5499|    339|						data=o;
 5500|    339|					}
 5501|    814|					n=TIFFSetField(tif,dp->tdir_tag,data);
 5502|    814|					if (data!=0)
  ------------------
  |  Branch (5502:10): [True: 814, False: 0]
  ------------------
 5503|    814|						_TIFFfree(data);
 5504|    814|					if (!n)
  ------------------
  |  Branch (5504:10): [True: 0, False: 814]
  ------------------
 5505|      0|						return(0);
 5506|    814|				}
 5507|  2.57k|			}
 5508|  2.57k|			break;
 5509|  2.57k|		case TIFF_SETGET_UINT8:
  ------------------
  |  Branch (5509:3): [True: 579, False: 237k]
  ------------------
 5510|    579|			{
 5511|    579|				uint8_t data=0;
 5512|    579|				assert(fip->field_readcount==1);
 5513|    579|				assert(fip->field_passcount==0);
 5514|    579|				err=TIFFReadDirEntryByte(tif,dp,&data);
 5515|    579|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5515:9): [True: 63, False: 516]
  ------------------
 5516|     63|				{
 5517|     63|					if (!TIFFSetField(tif,dp->tdir_tag,data))
  ------------------
  |  Branch (5517:10): [True: 0, False: 63]
  ------------------
 5518|      0|						return(0);
 5519|     63|				}
 5520|    579|			}
 5521|    579|			break;
 5522|    579|		case TIFF_SETGET_SINT8:
  ------------------
  |  Branch (5522:3): [True: 0, False: 237k]
  ------------------
 5523|      0|		{
 5524|      0|			int8_t data = 0;
 5525|      0|			assert(fip->field_readcount == 1);
 5526|      0|			assert(fip->field_passcount == 0);
 5527|      0|			err = TIFFReadDirEntrySbyte(tif, dp, &data);
 5528|      0|			if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5528:8): [True: 0, False: 0]
  ------------------
 5529|      0|			{
 5530|      0|				if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (5530:9): [True: 0, False: 0]
  ------------------
 5531|      0|					return(0);
 5532|      0|			}
 5533|      0|		}
 5534|      0|		break;
 5535|  13.6k|		case TIFF_SETGET_UINT16:
  ------------------
  |  Branch (5535:3): [True: 13.6k, False: 224k]
  ------------------
 5536|  13.6k|			{
 5537|  13.6k|				uint16_t data;
 5538|  13.6k|				assert(fip->field_readcount==1);
 5539|  13.6k|				assert(fip->field_passcount==0);
 5540|  13.6k|				err=TIFFReadDirEntryShort(tif,dp,&data);
 5541|  13.6k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5541:9): [True: 10.8k, False: 2.80k]
  ------------------
 5542|  10.8k|				{
 5543|  10.8k|					if (!TIFFSetField(tif,dp->tdir_tag,data))
  ------------------
  |  Branch (5543:10): [True: 154, False: 10.6k]
  ------------------
 5544|    154|						return(0);
 5545|  10.8k|				}
 5546|  13.6k|			}
 5547|  13.4k|			break;
 5548|  13.4k|		case TIFF_SETGET_SINT16:
  ------------------
  |  Branch (5548:3): [True: 0, False: 237k]
  ------------------
 5549|      0|			{
 5550|      0|				int16_t data;
 5551|      0|				assert(fip->field_readcount==1);
 5552|      0|				assert(fip->field_passcount==0);
 5553|      0|				err=TIFFReadDirEntrySshort(tif,dp,&data);
 5554|      0|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5554:9): [True: 0, False: 0]
  ------------------
 5555|      0|				{
 5556|      0|					if (!TIFFSetField(tif,dp->tdir_tag,data))
  ------------------
  |  Branch (5556:10): [True: 0, False: 0]
  ------------------
 5557|      0|						return(0);
 5558|      0|				}
 5559|      0|			}
 5560|      0|			break;
 5561|  65.1k|		case TIFF_SETGET_UINT32:
  ------------------
  |  Branch (5561:3): [True: 65.1k, False: 172k]
  ------------------
 5562|  65.1k|			{
 5563|  65.1k|				uint32_t data;
 5564|  65.1k|				assert(fip->field_readcount==1);
 5565|  65.1k|				assert(fip->field_passcount==0);
 5566|  65.1k|				err=TIFFReadDirEntryLong(tif,dp,&data);
 5567|  65.1k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5567:9): [True: 63.1k, False: 1.98k]
  ------------------
 5568|  63.1k|				{
 5569|  63.1k|					if (!TIFFSetField(tif,dp->tdir_tag,data))
  ------------------
  |  Branch (5569:10): [True: 4, False: 63.1k]
  ------------------
 5570|      4|						return(0);
 5571|  63.1k|				}
 5572|  65.1k|			}
 5573|  65.1k|			break;
 5574|  65.1k|		case TIFF_SETGET_SINT32:
  ------------------
  |  Branch (5574:3): [True: 0, False: 237k]
  ------------------
 5575|      0|			{
 5576|      0|				int32_t data;
 5577|      0|				assert(fip->field_readcount==1);
 5578|      0|				assert(fip->field_passcount==0);
 5579|      0|				err=TIFFReadDirEntrySlong(tif,dp,&data);
 5580|      0|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5580:9): [True: 0, False: 0]
  ------------------
 5581|      0|				{
 5582|      0|					if (!TIFFSetField(tif,dp->tdir_tag,data))
  ------------------
  |  Branch (5582:10): [True: 0, False: 0]
  ------------------
 5583|      0|						return(0);
 5584|      0|				}
 5585|      0|			}
 5586|      0|			break;
 5587|  1.09k|		case TIFF_SETGET_UINT64:
  ------------------
  |  Branch (5587:3): [True: 1.09k, False: 236k]
  ------------------
 5588|  1.09k|			{
 5589|  1.09k|				uint64_t data;
 5590|  1.09k|				assert(fip->field_readcount==1);
 5591|  1.09k|				assert(fip->field_passcount==0);
 5592|  1.09k|				err=TIFFReadDirEntryLong8(tif,dp,&data);
 5593|  1.09k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5593:9): [True: 862, False: 237]
  ------------------
 5594|    862|				{
 5595|    862|					if (!TIFFSetField(tif,dp->tdir_tag,data))
  ------------------
  |  Branch (5595:10): [True: 0, False: 862]
  ------------------
 5596|      0|						return(0);
 5597|    862|				}
 5598|  1.09k|			}
 5599|  1.09k|			break;
 5600|  1.09k|		case TIFF_SETGET_SINT64:
  ------------------
  |  Branch (5600:3): [True: 0, False: 237k]
  ------------------
 5601|      0|			{
 5602|      0|				int64_t data;
 5603|      0|				assert(fip->field_readcount==1);
 5604|      0|				assert(fip->field_passcount==0);
 5605|      0|				err=TIFFReadDirEntrySlong8(tif,dp,&data);
 5606|      0|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5606:9): [True: 0, False: 0]
  ------------------
 5607|      0|				{
 5608|      0|					if (!TIFFSetField(tif,dp->tdir_tag,data))
  ------------------
  |  Branch (5608:10): [True: 0, False: 0]
  ------------------
 5609|      0|						return(0);
 5610|      0|				}
 5611|      0|			}
 5612|      0|			break;
 5613|  2.54k|		case TIFF_SETGET_FLOAT:
  ------------------
  |  Branch (5613:3): [True: 2.54k, False: 235k]
  ------------------
 5614|  2.54k|			{
 5615|  2.54k|				float data;
 5616|  2.54k|				assert(fip->field_readcount==1);
 5617|  2.54k|				assert(fip->field_passcount==0);
 5618|  2.54k|				err=TIFFReadDirEntryFloat(tif,dp,&data);
 5619|  2.54k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5619:9): [True: 1.17k, False: 1.37k]
  ------------------
 5620|  1.17k|				{
 5621|  1.17k|					if (!TIFFSetField(tif,dp->tdir_tag,data))
  ------------------
  |  Branch (5621:10): [True: 58, False: 1.11k]
  ------------------
 5622|     58|						return(0);
 5623|  1.17k|				}
 5624|  2.54k|			}
 5625|  2.48k|			break;
 5626|  2.48k|		case TIFF_SETGET_DOUBLE:
  ------------------
  |  Branch (5626:3): [True: 126, False: 237k]
  ------------------
 5627|    126|			{
 5628|    126|				double data;
 5629|    126|				assert(fip->field_readcount==1);
 5630|    126|				assert(fip->field_passcount==0);
 5631|    126|				err=TIFFReadDirEntryDouble(tif,dp,&data);
 5632|    126|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5632:9): [True: 29, False: 97]
  ------------------
 5633|     29|				{
 5634|     29|					if (!TIFFSetField(tif,dp->tdir_tag,data))
  ------------------
  |  Branch (5634:10): [True: 0, False: 29]
  ------------------
 5635|      0|						return(0);
 5636|     29|				}
 5637|    126|			}
 5638|    126|			break;
 5639|    323|		case TIFF_SETGET_IFD8:
  ------------------
  |  Branch (5639:3): [True: 323, False: 237k]
  ------------------
 5640|    323|			{
 5641|    323|				uint64_t data;
 5642|    323|				assert(fip->field_readcount==1);
 5643|    323|				assert(fip->field_passcount==0);
 5644|    323|				err=TIFFReadDirEntryIfd8(tif,dp,&data);
 5645|    323|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5645:9): [True: 159, False: 164]
  ------------------
 5646|    159|				{
 5647|    159|					if (!TIFFSetField(tif,dp->tdir_tag,data))
  ------------------
  |  Branch (5647:10): [True: 92, False: 67]
  ------------------
 5648|     92|						return(0);
 5649|    159|				}
 5650|    323|			}
 5651|    231|			break;
 5652|  1.64k|		case TIFF_SETGET_UINT16_PAIR:
  ------------------
  |  Branch (5652:3): [True: 1.64k, False: 236k]
  ------------------
 5653|  1.64k|			{
 5654|  1.64k|				uint16_t* data;
 5655|  1.64k|				assert(fip->field_readcount==2);
 5656|  1.64k|				assert(fip->field_passcount==0);
 5657|  1.64k|				if (dp->tdir_count!=2) {
  ------------------
  |  Branch (5657:9): [True: 332, False: 1.31k]
  ------------------
 5658|    332|					TIFFWarningExtR(tif,module,
 5659|    332|						       "incorrect count for field \"%s\", expected 2, got %"PRIu64,
 5660|    332|						       fip->field_name, dp->tdir_count);
 5661|    332|					return(0);
 5662|    332|				}
 5663|  1.31k|				err=TIFFReadDirEntryShortArray(tif,dp,&data);
 5664|  1.31k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5664:9): [True: 1.21k, False: 101]
  ------------------
 5665|  1.21k|				{
 5666|  1.21k|					int m;
 5667|  1.21k|					assert(data); /* avoid CLang static Analyzer false positive */
 5668|  1.21k|					m=TIFFSetField(tif,dp->tdir_tag,data[0],data[1]);
 5669|  1.21k|					_TIFFfree(data);
 5670|  1.21k|					if (!m)
  ------------------
  |  Branch (5670:10): [True: 0, False: 1.21k]
  ------------------
 5671|      0|						return(0);
 5672|  1.21k|				}
 5673|  1.31k|			}
 5674|  1.31k|			break;
 5675|  1.31k|		case TIFF_SETGET_C0_UINT8:
  ------------------
  |  Branch (5675:3): [True: 165, False: 237k]
  ------------------
 5676|    165|			{
 5677|    165|				uint8_t* data;
 5678|    165|				assert(fip->field_readcount>=1);
 5679|    165|				assert(fip->field_passcount==0);
 5680|    165|				if (dp->tdir_count!=(uint64_t)fip->field_readcount) {
  ------------------
  |  Branch (5680:9): [True: 140, False: 25]
  ------------------
 5681|    140|					TIFFWarningExtR(tif,module,
 5682|    140|							"incorrect count for field \"%s\", expected %d, got %"PRIu64,
 5683|    140|							fip->field_name,(int) fip->field_readcount, dp->tdir_count);
 5684|    140|					return(0); 
 5685|    140|				}
 5686|     25|				else
 5687|     25|				{
 5688|     25|					err=TIFFReadDirEntryByteArray(tif,dp,&data);
 5689|     25|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5689:10): [True: 12, False: 13]
  ------------------
 5690|     12|					{
 5691|     12|						int m;
 5692|     12|						m=TIFFSetField(tif,dp->tdir_tag,data);
 5693|     12|						if (data!=0)
  ------------------
  |  Branch (5693:11): [True: 12, False: 0]
  ------------------
 5694|     12|							_TIFFfree(data);
 5695|     12|						if (!m)
  ------------------
  |  Branch (5695:11): [True: 0, False: 12]
  ------------------
 5696|      0|							return(0);
 5697|     12|					}
 5698|     25|				}
 5699|    165|			}
 5700|     25|			break;
 5701|     25|		case TIFF_SETGET_C0_SINT8:
  ------------------
  |  Branch (5701:3): [True: 0, False: 237k]
  ------------------
 5702|      0|			{
 5703|      0|				int8_t * data;
 5704|      0|				assert(fip->field_readcount>=1);
 5705|      0|				assert(fip->field_passcount==0);
 5706|      0|				if (dp->tdir_count!=(uint64_t)fip->field_readcount) {
  ------------------
  |  Branch (5706:9): [True: 0, False: 0]
  ------------------
 5707|      0|					TIFFWarningExtR(tif, module,
 5708|      0|						"incorrect count for field \"%s\", expected %d, got %"PRIu64,
 5709|      0|						fip->field_name, (int)fip->field_readcount, dp->tdir_count);
 5710|      0|					return(0);
 5711|      0|				}
 5712|      0|				else
 5713|      0|				{
 5714|      0|					err=TIFFReadDirEntrySbyteArray(tif,dp,&data);
 5715|      0|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5715:10): [True: 0, False: 0]
  ------------------
 5716|      0|					{
 5717|      0|						int m;
 5718|      0|						m=TIFFSetField(tif,dp->tdir_tag,data);
 5719|      0|						if (data!=0)
  ------------------
  |  Branch (5719:11): [True: 0, False: 0]
  ------------------
 5720|      0|							_TIFFfree(data);
 5721|      0|						if (!m)
  ------------------
  |  Branch (5721:11): [True: 0, False: 0]
  ------------------
 5722|      0|							return(0);
 5723|      0|					}
 5724|      0|				}
 5725|      0|			}
 5726|      0|			break;
 5727|    129|		case TIFF_SETGET_C0_UINT16:
  ------------------
  |  Branch (5727:3): [True: 129, False: 237k]
  ------------------
 5728|    129|			{
 5729|    129|				uint16_t* data;
 5730|    129|				assert(fip->field_readcount>=1);
 5731|    129|				assert(fip->field_passcount==0);
 5732|    129|				if (dp->tdir_count != (uint64_t)fip->field_readcount) {
  ------------------
  |  Branch (5732:9): [True: 119, False: 10]
  ------------------
 5733|    119|					TIFFWarningExtR(tif, module,
 5734|    119|						"incorrect count for field \"%s\", expected %d, got %"PRIu64,
 5735|    119|						fip->field_name, (int)fip->field_readcount, dp->tdir_count);
 5736|    119|					return(0);
 5737|    119|				}
 5738|     10|				else
 5739|     10|				{
 5740|     10|					err=TIFFReadDirEntryShortArray(tif,dp,&data);
 5741|     10|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5741:10): [True: 5, False: 5]
  ------------------
 5742|      5|					{
 5743|      5|						int m;
 5744|      5|						m=TIFFSetField(tif,dp->tdir_tag,data);
 5745|      5|						if (data!=0)
  ------------------
  |  Branch (5745:11): [True: 5, False: 0]
  ------------------
 5746|      5|							_TIFFfree(data);
 5747|      5|						if (!m)
  ------------------
  |  Branch (5747:11): [True: 0, False: 5]
  ------------------
 5748|      0|							return(0);
 5749|      5|					}
 5750|     10|				}
 5751|    129|			}
 5752|     10|			break;
 5753|     10|		case TIFF_SETGET_C0_SINT16:
  ------------------
  |  Branch (5753:3): [True: 0, False: 237k]
  ------------------
 5754|      0|			{
 5755|      0|				int16_t* data;
 5756|      0|				assert(fip->field_readcount>=1);
 5757|      0|				assert(fip->field_passcount==0);
 5758|      0|				if (dp->tdir_count != (uint64_t)fip->field_readcount) {
  ------------------
  |  Branch (5758:9): [True: 0, False: 0]
  ------------------
 5759|      0|					TIFFWarningExtR(tif, module,
 5760|      0|						"incorrect count for field \"%s\", expected %d, got %"PRIu64,
 5761|      0|						fip->field_name, (int)fip->field_readcount, dp->tdir_count);
 5762|      0|					return(0);
 5763|      0|				} 
 5764|      0|				else
 5765|      0|				{
 5766|      0|					err=TIFFReadDirEntrySshortArray(tif,dp,&data);
 5767|      0|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5767:10): [True: 0, False: 0]
  ------------------
 5768|      0|					{
 5769|      0|						int m;
 5770|      0|						m=TIFFSetField(tif,dp->tdir_tag,data);
 5771|      0|						if (data!=0)
  ------------------
  |  Branch (5771:11): [True: 0, False: 0]
  ------------------
 5772|      0|							_TIFFfree(data);
 5773|      0|						if (!m)
  ------------------
  |  Branch (5773:11): [True: 0, False: 0]
  ------------------
 5774|      0|							return(0);
 5775|      0|					}
 5776|      0|				}
 5777|      0|			}
 5778|      0|			break;
 5779|    140|		case TIFF_SETGET_C0_UINT32:
  ------------------
  |  Branch (5779:3): [True: 140, False: 237k]
  ------------------
 5780|    140|			{
 5781|    140|				uint32_t* data;
 5782|    140|				assert(fip->field_readcount>=1);
 5783|    140|				assert(fip->field_passcount==0);
 5784|    140|				if (dp->tdir_count != (uint64_t)fip->field_readcount) {
  ------------------
  |  Branch (5784:9): [True: 113, False: 27]
  ------------------
 5785|    113|					TIFFWarningExtR(tif, module,
 5786|    113|						"incorrect count for field \"%s\", expected %d, got %"PRIu64,
 5787|    113|						fip->field_name, (int)fip->field_readcount, dp->tdir_count);
 5788|    113|					return(0);
 5789|    113|				} 
 5790|     27|				else
 5791|     27|				{
 5792|     27|					err=TIFFReadDirEntryLongArray(tif,dp,&data);
 5793|     27|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5793:10): [True: 14, False: 13]
  ------------------
 5794|     14|					{
 5795|     14|						int m;
 5796|     14|						m=TIFFSetField(tif,dp->tdir_tag,data);
 5797|     14|						if (data!=0)
  ------------------
  |  Branch (5797:11): [True: 14, False: 0]
  ------------------
 5798|     14|							_TIFFfree(data);
 5799|     14|						if (!m)
  ------------------
  |  Branch (5799:11): [True: 0, False: 14]
  ------------------
 5800|      0|							return(0);
 5801|     14|					}
 5802|     27|				}
 5803|    140|			}
 5804|     27|			break;
 5805|     27|		case TIFF_SETGET_C0_SINT32:
  ------------------
  |  Branch (5805:3): [True: 0, False: 237k]
  ------------------
 5806|      0|			{
 5807|      0|				int32_t* data;
 5808|      0|				assert(fip->field_readcount>=1);
 5809|      0|				assert(fip->field_passcount==0);
 5810|      0|				if (dp->tdir_count != (uint64_t)fip->field_readcount) {
  ------------------
  |  Branch (5810:9): [True: 0, False: 0]
  ------------------
 5811|      0|					TIFFWarningExtR(tif, module,
 5812|      0|						"incorrect count for field \"%s\", expected %d, got %"PRIu64,
 5813|      0|						fip->field_name, (int)fip->field_readcount, dp->tdir_count);
 5814|      0|					return(0);
 5815|      0|				} 
 5816|      0|				else
 5817|      0|				{
 5818|      0|					err=TIFFReadDirEntrySlongArray(tif,dp,&data);
 5819|      0|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5819:10): [True: 0, False: 0]
  ------------------
 5820|      0|					{
 5821|      0|						int m;
 5822|      0|						m=TIFFSetField(tif,dp->tdir_tag,data);
 5823|      0|						if (data!=0)
  ------------------
  |  Branch (5823:11): [True: 0, False: 0]
  ------------------
 5824|      0|							_TIFFfree(data);
 5825|      0|						if (!m)
  ------------------
  |  Branch (5825:11): [True: 0, False: 0]
  ------------------
 5826|      0|							return(0);
 5827|      0|					}
 5828|      0|				}
 5829|      0|			}
 5830|      0|			break;
 5831|      0|		case TIFF_SETGET_C0_UINT64:
  ------------------
  |  Branch (5831:3): [True: 0, False: 237k]
  ------------------
 5832|      0|		{
 5833|      0|			uint64_t *data;
 5834|      0|			assert(fip->field_readcount >= 1);
 5835|      0|			assert(fip->field_passcount == 0);
 5836|      0|			if (dp->tdir_count != (uint64_t)fip->field_readcount) {
  ------------------
  |  Branch (5836:8): [True: 0, False: 0]
  ------------------
 5837|      0|				TIFFWarningExtR(tif, module,
 5838|      0|					"incorrect count for field \"%s\", expected %d, got %"PRIu64,
 5839|      0|					fip->field_name, (int)fip->field_readcount, dp->tdir_count);
 5840|      0|				return(0);
 5841|      0|			} else
 5842|      0|			{
 5843|      0|				err = TIFFReadDirEntryLong8Array(tif, dp, &data);
 5844|      0|				if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5844:9): [True: 0, False: 0]
  ------------------
 5845|      0|				{
 5846|      0|					int m;
 5847|      0|					m = TIFFSetField(tif, dp->tdir_tag, data);
 5848|      0|					if (data != 0)
  ------------------
  |  Branch (5848:10): [True: 0, False: 0]
  ------------------
 5849|      0|						_TIFFfree(data);
 5850|      0|					if (!m)
  ------------------
  |  Branch (5850:10): [True: 0, False: 0]
  ------------------
 5851|      0|						return(0);
 5852|      0|				}
 5853|      0|			}
 5854|      0|		}
 5855|      0|		break;
 5856|      0|		case TIFF_SETGET_C0_SINT64:
  ------------------
  |  Branch (5856:3): [True: 0, False: 237k]
  ------------------
 5857|      0|		{
 5858|      0|			int64_t *data;
 5859|      0|			assert(fip->field_readcount >= 1);
 5860|      0|			assert(fip->field_passcount == 0);
 5861|      0|			if (dp->tdir_count != (uint64_t)fip->field_readcount) {
  ------------------
  |  Branch (5861:8): [True: 0, False: 0]
  ------------------
 5862|      0|				TIFFWarningExtR(tif, module,
 5863|      0|					"incorrect count for field \"%s\", expected %d, got %"PRIu64,
 5864|      0|					fip->field_name, (int)fip->field_readcount, dp->tdir_count);
 5865|      0|				return(0);
 5866|      0|			} else
 5867|      0|			{
 5868|      0|				err = TIFFReadDirEntrySlong8Array(tif, dp, &data);
 5869|      0|				if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5869:9): [True: 0, False: 0]
  ------------------
 5870|      0|				{
 5871|      0|					int m;
 5872|      0|					m = TIFFSetField(tif, dp->tdir_tag, data);
 5873|      0|					if (data != 0)
  ------------------
  |  Branch (5873:10): [True: 0, False: 0]
  ------------------
 5874|      0|						_TIFFfree(data);
 5875|      0|					if (!m)
  ------------------
  |  Branch (5875:10): [True: 0, False: 0]
  ------------------
 5876|      0|						return(0);
 5877|      0|				}
 5878|      0|			}
 5879|      0|		}
 5880|      0|		break;
 5881|    504|		case TIFF_SETGET_C0_FLOAT:
  ------------------
  |  Branch (5881:3): [True: 504, False: 237k]
  ------------------
 5882|    504|			{
 5883|    504|				float* data;
 5884|    504|				assert(fip->field_readcount>=1);
 5885|    504|				assert(fip->field_passcount==0);
 5886|    504|				if (dp->tdir_count != (uint64_t)fip->field_readcount) {
  ------------------
  |  Branch (5886:9): [True: 344, False: 160]
  ------------------
 5887|    344|					TIFFWarningExtR(tif, module,
 5888|    344|						"incorrect count for field \"%s\", expected %d, got %"PRIu64,
 5889|    344|						fip->field_name, (int)fip->field_readcount, dp->tdir_count);
 5890|    344|					return(0);
 5891|    344|				} 
 5892|    160|				else
 5893|    160|				{
 5894|    160|					err=TIFFReadDirEntryFloatArray(tif,dp,&data);
 5895|    160|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5895:10): [True: 144, False: 16]
  ------------------
 5896|    144|					{
 5897|    144|						int m;
 5898|    144|						m=TIFFSetField(tif,dp->tdir_tag,data);
 5899|    144|						if (data!=0)
  ------------------
  |  Branch (5899:11): [True: 144, False: 0]
  ------------------
 5900|    144|							_TIFFfree(data);
 5901|    144|						if (!m)
  ------------------
  |  Branch (5901:11): [True: 0, False: 144]
  ------------------
 5902|      0|							return(0);
 5903|    144|					}
 5904|    160|				}
 5905|    504|			}
 5906|    160|			break;
 5907|       |		/*--: Rational2Double: Extend for Double Arrays and Rational-Arrays read into Double-Arrays. */
 5908|    160|		case TIFF_SETGET_C0_DOUBLE:
  ------------------
  |  Branch (5908:3): [True: 0, False: 237k]
  ------------------
 5909|      0|			{
 5910|      0|				double* data;
 5911|      0|				assert(fip->field_readcount>=1);
 5912|      0|				assert(fip->field_passcount==0);
 5913|      0|				if (dp->tdir_count != (uint64_t)fip->field_readcount) {
  ------------------
  |  Branch (5913:9): [True: 0, False: 0]
  ------------------
 5914|      0|					TIFFWarningExtR(tif, module,
 5915|      0|						"incorrect count for field \"%s\", expected %d, got %"PRIu64,
 5916|      0|						fip->field_name, (int)fip->field_readcount, dp->tdir_count);
 5917|      0|					return(0);
 5918|      0|				} 
 5919|      0|				else
 5920|      0|				{
 5921|      0|					err=TIFFReadDirEntryDoubleArray(tif,dp,&data);
 5922|      0|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5922:10): [True: 0, False: 0]
  ------------------
 5923|      0|					{
 5924|      0|						int m;
 5925|      0|						m=TIFFSetField(tif,dp->tdir_tag,data);
 5926|      0|						if (data!=0)
  ------------------
  |  Branch (5926:11): [True: 0, False: 0]
  ------------------
 5927|      0|							_TIFFfree(data);
 5928|      0|						if (!m)
  ------------------
  |  Branch (5928:11): [True: 0, False: 0]
  ------------------
 5929|      0|							return(0);
 5930|      0|					}
 5931|      0|				}
 5932|      0|			}
 5933|      0|			break;
 5934|    219|		case TIFF_SETGET_C16_ASCII:
  ------------------
  |  Branch (5934:3): [True: 219, False: 237k]
  ------------------
 5935|    219|			{
 5936|    219|				uint8_t* data;
 5937|    219|				assert(fip->field_readcount==TIFF_VARIABLE);
 5938|    219|				assert(fip->field_passcount==1);
 5939|    219|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (5939:9): [True: 112, False: 107]
  ------------------
 5940|    112|					err=TIFFReadDirEntryErrCount;
 5941|    107|				else
 5942|    107|				{
 5943|    107|					err=TIFFReadDirEntryByteArray(tif,dp,&data);
 5944|    107|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5944:10): [True: 73, False: 34]
  ------------------
 5945|     73|					{
 5946|     73|						int m;
 5947|     73|						if( data != 0 && dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
  ------------------
  |  Branch (5947:11): [True: 53, False: 20]
  |  Branch (5947:24): [True: 53, False: 0]
  |  Branch (5947:46): [True: 41, False: 12]
  ------------------
 5948|     41|						{
 5949|     41|						    TIFFWarningExtR(tif,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name);
 5950|     41|						    data[dp->tdir_count-1] = '\0';
 5951|     41|						}
 5952|     73|						m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
 5953|     73|						if (data!=0)
  ------------------
  |  Branch (5953:11): [True: 53, False: 20]
  ------------------
 5954|     53|							_TIFFfree(data);
 5955|     73|						if (!m)
  ------------------
  |  Branch (5955:11): [True: 20, False: 53]
  ------------------
 5956|     20|							return(0);
 5957|     73|					}
 5958|    107|				}
 5959|    219|			}
 5960|    199|			break;
 5961|    257|		case TIFF_SETGET_C16_UINT8:
  ------------------
  |  Branch (5961:3): [True: 257, False: 237k]
  ------------------
 5962|    257|			{
 5963|    257|				uint8_t* data;
 5964|    257|				assert(fip->field_readcount==TIFF_VARIABLE);
 5965|    257|				assert(fip->field_passcount==1);
 5966|    257|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (5966:9): [True: 116, False: 141]
  ------------------
 5967|    116|					err=TIFFReadDirEntryErrCount;
 5968|    141|				else
 5969|    141|				{
 5970|    141|					err=TIFFReadDirEntryByteArray(tif,dp,&data);
 5971|    141|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5971:10): [True: 47, False: 94]
  ------------------
 5972|     47|					{
 5973|     47|						int m;
 5974|     47|						m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
 5975|     47|						if (data!=0)
  ------------------
  |  Branch (5975:11): [True: 29, False: 18]
  ------------------
 5976|     29|							_TIFFfree(data);
 5977|     47|						if (!m)
  ------------------
  |  Branch (5977:11): [True: 18, False: 29]
  ------------------
 5978|     18|							return(0);
 5979|     47|					}
 5980|    141|				}
 5981|    257|			}
 5982|    239|			break;
 5983|    239|		case TIFF_SETGET_C16_SINT8:
  ------------------
  |  Branch (5983:3): [True: 0, False: 237k]
  ------------------
 5984|      0|			{
 5985|      0|				int8_t* data;
 5986|      0|				assert(fip->field_readcount==TIFF_VARIABLE);
 5987|      0|				assert(fip->field_passcount==1);
 5988|      0|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (5988:9): [True: 0, False: 0]
  ------------------
 5989|      0|					err=TIFFReadDirEntryErrCount;
 5990|      0|				else
 5991|      0|				{
 5992|      0|					err=TIFFReadDirEntrySbyteArray(tif,dp,&data);
 5993|      0|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (5993:10): [True: 0, False: 0]
  ------------------
 5994|      0|					{
 5995|      0|						int m;
 5996|      0|						m=TIFFSetField(tif,dp->tdir_tag,(uint16_t)(dp->tdir_count),data);
 5997|      0|						if (data!=0)
  ------------------
  |  Branch (5997:11): [True: 0, False: 0]
  ------------------
 5998|      0|							_TIFFfree(data);
 5999|      0|						if (!m)
  ------------------
  |  Branch (5999:11): [True: 0, False: 0]
  ------------------
 6000|      0|							return(0);
 6001|      0|					}
 6002|      0|				}
 6003|      0|			}
 6004|      0|			break;
 6005|    699|		case TIFF_SETGET_C16_UINT16:
  ------------------
  |  Branch (6005:3): [True: 699, False: 237k]
  ------------------
 6006|    699|			{
 6007|    699|				uint16_t* data;
 6008|    699|				assert(fip->field_readcount==TIFF_VARIABLE);
 6009|    699|				assert(fip->field_passcount==1);
 6010|    699|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (6010:9): [True: 93, False: 606]
  ------------------
 6011|     93|					err=TIFFReadDirEntryErrCount;
 6012|    606|				else
 6013|    606|				{
 6014|    606|					err=TIFFReadDirEntryShortArray(tif,dp,&data);
 6015|    606|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6015:10): [True: 287, False: 319]
  ------------------
 6016|    287|					{
 6017|    287|						int m;
 6018|    287|						m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
 6019|    287|						if (data!=0)
  ------------------
  |  Branch (6019:11): [True: 268, False: 19]
  ------------------
 6020|    268|							_TIFFfree(data);
 6021|    287|						if (!m)
  ------------------
  |  Branch (6021:11): [True: 67, False: 220]
  ------------------
 6022|     67|							return(0);
 6023|    287|					}
 6024|    606|				}
 6025|    699|			}
 6026|    632|			break;
 6027|    632|		case TIFF_SETGET_C16_SINT16:
  ------------------
  |  Branch (6027:3): [True: 0, False: 237k]
  ------------------
 6028|      0|			{
 6029|      0|				int16_t* data;
 6030|      0|				assert(fip->field_readcount==TIFF_VARIABLE);
 6031|      0|				assert(fip->field_passcount==1);
 6032|      0|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (6032:9): [True: 0, False: 0]
  ------------------
 6033|      0|					err=TIFFReadDirEntryErrCount;
 6034|      0|				else
 6035|      0|				{
 6036|      0|					err=TIFFReadDirEntrySshortArray(tif,dp,&data);
 6037|      0|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6037:10): [True: 0, False: 0]
  ------------------
 6038|      0|					{
 6039|      0|						int m;
 6040|      0|						m=TIFFSetField(tif,dp->tdir_tag,(uint16_t)(dp->tdir_count),data);
 6041|      0|						if (data!=0)
  ------------------
  |  Branch (6041:11): [True: 0, False: 0]
  ------------------
 6042|      0|							_TIFFfree(data);
 6043|      0|						if (!m)
  ------------------
  |  Branch (6043:11): [True: 0, False: 0]
  ------------------
 6044|      0|							return(0);
 6045|      0|					}
 6046|      0|				}
 6047|      0|			}
 6048|      0|			break;
 6049|    597|		case TIFF_SETGET_C16_UINT32:
  ------------------
  |  Branch (6049:3): [True: 597, False: 237k]
  ------------------
 6050|    597|			{
 6051|    597|				uint32_t* data;
 6052|    597|				assert(fip->field_readcount==TIFF_VARIABLE);
 6053|    597|				assert(fip->field_passcount==1);
 6054|    597|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (6054:9): [True: 100, False: 497]
  ------------------
 6055|    100|					err=TIFFReadDirEntryErrCount;
 6056|    497|				else
 6057|    497|				{
 6058|    497|					err=TIFFReadDirEntryLongArray(tif,dp,&data);
 6059|    497|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6059:10): [True: 150, False: 347]
  ------------------
 6060|    150|					{
 6061|    150|						int m;
 6062|    150|						m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
 6063|    150|						if (data!=0)
  ------------------
  |  Branch (6063:11): [True: 128, False: 22]
  ------------------
 6064|    128|							_TIFFfree(data);
 6065|    150|						if (!m)
  ------------------
  |  Branch (6065:11): [True: 22, False: 128]
  ------------------
 6066|     22|							return(0);
 6067|    150|					}
 6068|    497|				}
 6069|    597|			}
 6070|    575|			break;
 6071|    575|		case TIFF_SETGET_C16_SINT32:
  ------------------
  |  Branch (6071:3): [True: 0, False: 237k]
  ------------------
 6072|      0|			{
 6073|      0|				int32_t* data;
 6074|      0|				assert(fip->field_readcount==TIFF_VARIABLE);
 6075|      0|				assert(fip->field_passcount==1);
 6076|      0|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (6076:9): [True: 0, False: 0]
  ------------------
 6077|      0|					err=TIFFReadDirEntryErrCount;
 6078|      0|				else
 6079|      0|				{
 6080|      0|					err=TIFFReadDirEntrySlongArray(tif,dp,&data);
 6081|      0|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6081:10): [True: 0, False: 0]
  ------------------
 6082|      0|					{
 6083|      0|						int m;
 6084|      0|						m=TIFFSetField(tif,dp->tdir_tag,(uint16_t)(dp->tdir_count),data);
 6085|      0|						if (data!=0)
  ------------------
  |  Branch (6085:11): [True: 0, False: 0]
  ------------------
 6086|      0|							_TIFFfree(data);
 6087|      0|						if (!m)
  ------------------
  |  Branch (6087:11): [True: 0, False: 0]
  ------------------
 6088|      0|							return(0);
 6089|      0|					}
 6090|      0|				}
 6091|      0|			}
 6092|      0|			break;
 6093|      0|		case TIFF_SETGET_C16_UINT64:
  ------------------
  |  Branch (6093:3): [True: 0, False: 237k]
  ------------------
 6094|      0|			{
 6095|      0|				uint64_t* data;
 6096|      0|				assert(fip->field_readcount==TIFF_VARIABLE);
 6097|      0|				assert(fip->field_passcount==1);
 6098|      0|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (6098:9): [True: 0, False: 0]
  ------------------
 6099|      0|					err=TIFFReadDirEntryErrCount;
 6100|      0|				else
 6101|      0|				{
 6102|      0|					err=TIFFReadDirEntryLong8Array(tif,dp,&data);
 6103|      0|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6103:10): [True: 0, False: 0]
  ------------------
 6104|      0|					{
 6105|      0|						int m;
 6106|      0|						m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
 6107|      0|						if (data!=0)
  ------------------
  |  Branch (6107:11): [True: 0, False: 0]
  ------------------
 6108|      0|							_TIFFfree(data);
 6109|      0|						if (!m)
  ------------------
  |  Branch (6109:11): [True: 0, False: 0]
  ------------------
 6110|      0|							return(0);
 6111|      0|					}
 6112|      0|				}
 6113|      0|			}
 6114|      0|			break;
 6115|      0|		case TIFF_SETGET_C16_SINT64:
  ------------------
  |  Branch (6115:3): [True: 0, False: 237k]
  ------------------
 6116|      0|			{
 6117|      0|				int64_t* data;
 6118|      0|				assert(fip->field_readcount==TIFF_VARIABLE);
 6119|      0|				assert(fip->field_passcount==1);
 6120|      0|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (6120:9): [True: 0, False: 0]
  ------------------
 6121|      0|					err=TIFFReadDirEntryErrCount;
 6122|      0|				else
 6123|      0|				{
 6124|      0|					err=TIFFReadDirEntrySlong8Array(tif,dp,&data);
 6125|      0|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6125:10): [True: 0, False: 0]
  ------------------
 6126|      0|					{
 6127|      0|						int m;
 6128|      0|						m=TIFFSetField(tif,dp->tdir_tag,(uint16_t)(dp->tdir_count),data);
 6129|      0|						if (data!=0)
  ------------------
  |  Branch (6129:11): [True: 0, False: 0]
  ------------------
 6130|      0|							_TIFFfree(data);
 6131|      0|						if (!m)
  ------------------
  |  Branch (6131:11): [True: 0, False: 0]
  ------------------
 6132|      0|							return(0);
 6133|      0|					}
 6134|      0|				}
 6135|      0|			}
 6136|      0|			break;
 6137|    607|		case TIFF_SETGET_C16_FLOAT:
  ------------------
  |  Branch (6137:3): [True: 607, False: 237k]
  ------------------
 6138|    607|			{
 6139|    607|				float* data;
 6140|    607|				assert(fip->field_readcount==TIFF_VARIABLE);
 6141|    607|				assert(fip->field_passcount==1);
 6142|    607|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (6142:9): [True: 189, False: 418]
  ------------------
 6143|    189|					err=TIFFReadDirEntryErrCount;
 6144|    418|				else
 6145|    418|				{
 6146|    418|					err=TIFFReadDirEntryFloatArray(tif,dp,&data);
 6147|    418|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6147:10): [True: 300, False: 118]
  ------------------
 6148|    300|					{
 6149|    300|						int m;
 6150|    300|						m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
 6151|    300|						if (data!=0)
  ------------------
  |  Branch (6151:11): [True: 264, False: 36]
  ------------------
 6152|    264|							_TIFFfree(data);
 6153|    300|						if (!m)
  ------------------
  |  Branch (6153:11): [True: 36, False: 264]
  ------------------
 6154|     36|							return(0);
 6155|    300|					}
 6156|    418|				}
 6157|    607|			}
 6158|    571|			break;
 6159|    571|		case TIFF_SETGET_C16_DOUBLE:
  ------------------
  |  Branch (6159:3): [True: 0, False: 237k]
  ------------------
 6160|      0|			{
 6161|      0|				double* data;
 6162|      0|				assert(fip->field_readcount==TIFF_VARIABLE);
 6163|      0|				assert(fip->field_passcount==1);
 6164|      0|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (6164:9): [True: 0, False: 0]
  ------------------
 6165|      0|					err=TIFFReadDirEntryErrCount;
 6166|      0|				else
 6167|      0|				{
 6168|      0|					err=TIFFReadDirEntryDoubleArray(tif,dp,&data);
 6169|      0|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6169:10): [True: 0, False: 0]
  ------------------
 6170|      0|					{
 6171|      0|						int m;
 6172|      0|						m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
 6173|      0|						if (data!=0)
  ------------------
  |  Branch (6173:11): [True: 0, False: 0]
  ------------------
 6174|      0|							_TIFFfree(data);
 6175|      0|						if (!m)
  ------------------
  |  Branch (6175:11): [True: 0, False: 0]
  ------------------
 6176|      0|							return(0);
 6177|      0|					}
 6178|      0|				}
 6179|      0|			}
 6180|      0|			break;
 6181|    136|		case TIFF_SETGET_C16_IFD8:
  ------------------
  |  Branch (6181:3): [True: 136, False: 237k]
  ------------------
 6182|    136|			{
 6183|    136|				uint64_t* data;
 6184|    136|				assert(fip->field_readcount==TIFF_VARIABLE);
 6185|    136|				assert(fip->field_passcount==1);
 6186|    136|				if (dp->tdir_count>0xFFFF)
  ------------------
  |  Branch (6186:9): [True: 78, False: 58]
  ------------------
 6187|     78|					err=TIFFReadDirEntryErrCount;
 6188|     58|				else
 6189|     58|				{
 6190|     58|					err=TIFFReadDirEntryIfd8Array(tif,dp,&data);
 6191|     58|					if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6191:10): [True: 24, False: 34]
  ------------------
 6192|     24|					{
 6193|     24|						int m;
 6194|     24|						m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
 6195|     24|						if (data!=0)
  ------------------
  |  Branch (6195:11): [True: 11, False: 13]
  ------------------
 6196|     11|							_TIFFfree(data);
 6197|     24|						if (!m)
  ------------------
  |  Branch (6197:11): [True: 0, False: 24]
  ------------------
 6198|      0|							return(0);
 6199|     24|					}
 6200|     58|				}
 6201|    136|			}
 6202|    136|			break;
 6203|  8.22k|		case TIFF_SETGET_C32_ASCII:
  ------------------
  |  Branch (6203:3): [True: 8.22k, False: 229k]
  ------------------
 6204|  8.22k|			{
 6205|  8.22k|				uint8_t* data;
 6206|  8.22k|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6207|  8.22k|				assert(fip->field_passcount==1);
 6208|  8.22k|				err=TIFFReadDirEntryByteArray(tif,dp,&data);
 6209|  8.22k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6209:9): [True: 4.58k, False: 3.63k]
  ------------------
 6210|  4.58k|				{
 6211|  4.58k|					int m;
 6212|  4.58k|					if( data != 0 && dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
  ------------------
  |  Branch (6212:10): [True: 4.44k, False: 145]
  |  Branch (6212:23): [True: 4.44k, False: 0]
  |  Branch (6212:45): [True: 2.86k, False: 1.58k]
  ------------------
 6213|  2.86k|					{
 6214|  2.86k|						TIFFWarningExtR(tif,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name);
 6215|  2.86k|											data[dp->tdir_count-1] = '\0';
 6216|  2.86k|					}
 6217|  4.58k|					m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
 6218|  4.58k|					if (data!=0)
  ------------------
  |  Branch (6218:10): [True: 4.44k, False: 145]
  ------------------
 6219|  4.44k|						_TIFFfree(data);
 6220|  4.58k|					if (!m)
  ------------------
  |  Branch (6220:10): [True: 0, False: 4.58k]
  ------------------
 6221|      0|						return(0);
 6222|  4.58k|				}
 6223|  8.22k|			}
 6224|  8.22k|			break;
 6225|  8.22k|		case TIFF_SETGET_C32_UINT8:
  ------------------
  |  Branch (6225:3): [True: 4.51k, False: 233k]
  ------------------
 6226|  4.51k|			{
 6227|  4.51k|				uint8_t* data;
 6228|  4.51k|				uint32_t count = 0;
 6229|  4.51k|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6230|  4.51k|				assert(fip->field_passcount==1);
 6231|  4.51k|				if( fip->field_tag == TIFFTAG_RICHTIFFIPTC &&
  ------------------
  |  |  444|  9.03k|#define TIFFTAG_RICHTIFFIPTC		33723
  ------------------
  |  Branch (6231:9): [True: 10, False: 4.50k]
  ------------------
 6232|  4.51k|				    dp->tdir_type == TIFF_LONG )
  ------------------
  |  Branch (6232:9): [True: 4, False: 6]
  ------------------
 6233|      4|				{
 6234|       |				    /* Adobe's software (wrongly) writes RichTIFFIPTC tag with
 6235|       |				     * data type LONG instead of UNDEFINED. Work around this
 6236|       |				     * frequently found issue */
 6237|      4|				    void* origdata;
 6238|      4|				    err=TIFFReadDirEntryArray(tif,dp,&count,4,&origdata);
 6239|      4|				    if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (6239:13): [True: 1, False: 3]
  |  Branch (6239:43): [True: 1, False: 2]
  ------------------
 6240|      2|				    {
 6241|      2|				        data = NULL;
 6242|      2|				    }
 6243|      2|				    else
 6244|      2|				    {
 6245|      2|				        if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      2|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (6245:17): [True: 1, False: 1]
  ------------------
 6246|      1|				            TIFFSwabArrayOfLong((uint32_t*)origdata,count);
 6247|      2|				        data = (uint8_t*)origdata;
 6248|      2|				        count = (uint32_t)(count * 4);
 6249|      2|				    }
 6250|      4|				}
 6251|  4.51k|				else
 6252|  4.51k|				{
 6253|  4.51k|				    err=TIFFReadDirEntryByteArray(tif,dp,&data);
 6254|  4.51k|				    count = (uint32_t)(dp->tdir_count);
 6255|  4.51k|				}
 6256|  4.51k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6256:9): [True: 1.84k, False: 2.67k]
  ------------------
 6257|  1.84k|				{
 6258|  1.84k|					int m;
 6259|  1.84k|					m=TIFFSetField(tif, dp->tdir_tag, count, data);
 6260|  1.84k|					if (data!=0)
  ------------------
  |  Branch (6260:10): [True: 1.28k, False: 565]
  ------------------
 6261|  1.28k|						_TIFFfree(data);
 6262|  1.84k|					if (!m)
  ------------------
  |  Branch (6262:10): [True: 565, False: 1.28k]
  ------------------
 6263|    565|						return(0);
 6264|  1.84k|				}
 6265|  4.51k|			}
 6266|  3.95k|			break;
 6267|  3.95k|		case TIFF_SETGET_C32_SINT8:
  ------------------
  |  Branch (6267:3): [True: 640, False: 237k]
  ------------------
 6268|    640|			{
 6269|    640|				int8_t* data = NULL;
 6270|    640|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6271|    640|				assert(fip->field_passcount==1);
 6272|    640|				err=TIFFReadDirEntrySbyteArray(tif,dp,&data);
 6273|    640|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6273:9): [True: 325, False: 315]
  ------------------
 6274|    325|				{
 6275|    325|					int m;
 6276|    325|					m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
 6277|    325|					if (data!=0)
  ------------------
  |  Branch (6277:10): [True: 265, False: 60]
  ------------------
 6278|    265|						_TIFFfree(data);
 6279|    325|					if (!m)
  ------------------
  |  Branch (6279:10): [True: 60, False: 265]
  ------------------
 6280|     60|						return(0);
 6281|    325|				}
 6282|    640|			}
 6283|    580|			break;
 6284|  4.67k|		case TIFF_SETGET_C32_UINT16:
  ------------------
  |  Branch (6284:3): [True: 4.67k, False: 233k]
  ------------------
 6285|  4.67k|			{
 6286|  4.67k|				uint16_t* data;
 6287|  4.67k|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6288|  4.67k|				assert(fip->field_passcount==1);
 6289|  4.67k|				err=TIFFReadDirEntryShortArray(tif,dp,&data);
 6290|  4.67k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6290:9): [True: 2.75k, False: 1.92k]
  ------------------
 6291|  2.75k|				{
 6292|  2.75k|					int m;
 6293|  2.75k|					m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
 6294|  2.75k|					if (data!=0)
  ------------------
  |  Branch (6294:10): [True: 2.57k, False: 180]
  ------------------
 6295|  2.57k|						_TIFFfree(data);
 6296|  2.75k|					if (!m)
  ------------------
  |  Branch (6296:10): [True: 180, False: 2.57k]
  ------------------
 6297|    180|						return(0);
 6298|  2.75k|				}
 6299|  4.67k|			}
 6300|  4.49k|			break;
 6301|  4.49k|		case TIFF_SETGET_C32_SINT16:
  ------------------
  |  Branch (6301:3): [True: 740, False: 236k]
  ------------------
 6302|    740|			{
 6303|    740|				int16_t* data = NULL;
 6304|    740|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6305|    740|				assert(fip->field_passcount==1);
 6306|    740|				err=TIFFReadDirEntrySshortArray(tif,dp,&data);
 6307|    740|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6307:9): [True: 279, False: 461]
  ------------------
 6308|    279|				{
 6309|    279|					int m;
 6310|    279|					m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
 6311|    279|					if (data!=0)
  ------------------
  |  Branch (6311:10): [True: 219, False: 60]
  ------------------
 6312|    219|						_TIFFfree(data);
 6313|    279|					if (!m)
  ------------------
  |  Branch (6313:10): [True: 60, False: 219]
  ------------------
 6314|     60|						return(0);
 6315|    279|				}
 6316|    740|			}
 6317|    680|			break;
 6318|  1.63k|		case TIFF_SETGET_C32_UINT32:
  ------------------
  |  Branch (6318:3): [True: 1.63k, False: 236k]
  ------------------
 6319|  1.63k|			{
 6320|  1.63k|				uint32_t* data;
 6321|  1.63k|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6322|  1.63k|				assert(fip->field_passcount==1);
 6323|  1.63k|				err=TIFFReadDirEntryLongArray(tif,dp,&data);
 6324|  1.63k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6324:9): [True: 689, False: 948]
  ------------------
 6325|    689|				{
 6326|    689|					int m;
 6327|    689|					m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
 6328|    689|					if (data!=0)
  ------------------
  |  Branch (6328:10): [True: 610, False: 79]
  ------------------
 6329|    610|						_TIFFfree(data);
 6330|    689|					if (!m)
  ------------------
  |  Branch (6330:10): [True: 79, False: 610]
  ------------------
 6331|     79|						return(0);
 6332|    689|				}
 6333|  1.63k|			}
 6334|  1.55k|			break;
 6335|  1.55k|		case TIFF_SETGET_C32_SINT32:
  ------------------
  |  Branch (6335:3): [True: 636, False: 237k]
  ------------------
 6336|    636|			{
 6337|    636|				int32_t* data = NULL;
 6338|    636|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6339|    636|				assert(fip->field_passcount==1);
 6340|    636|				err=TIFFReadDirEntrySlongArray(tif,dp,&data);
 6341|    636|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6341:9): [True: 164, False: 472]
  ------------------
 6342|    164|				{
 6343|    164|					int m;
 6344|    164|					m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
 6345|    164|					if (data!=0)
  ------------------
  |  Branch (6345:10): [True: 105, False: 59]
  ------------------
 6346|    105|						_TIFFfree(data);
 6347|    164|					if (!m)
  ------------------
  |  Branch (6347:10): [True: 59, False: 105]
  ------------------
 6348|     59|						return(0);
 6349|    164|				}
 6350|    636|			}
 6351|    577|			break;
 6352|  4.38k|		case TIFF_SETGET_C32_UINT64:
  ------------------
  |  Branch (6352:3): [True: 4.38k, False: 233k]
  ------------------
 6353|  4.38k|			{
 6354|  4.38k|				uint64_t* data;
 6355|  4.38k|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6356|  4.38k|				assert(fip->field_passcount==1);
 6357|  4.38k|				err=TIFFReadDirEntryLong8Array(tif,dp,&data);
 6358|  4.38k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6358:9): [True: 4.12k, False: 265]
  ------------------
 6359|  4.12k|				{
 6360|  4.12k|					int m;
 6361|  4.12k|					m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
 6362|  4.12k|					if (data!=0)
  ------------------
  |  Branch (6362:10): [True: 4.01k, False: 113]
  ------------------
 6363|  4.01k|						_TIFFfree(data);
 6364|  4.12k|					if (!m)
  ------------------
  |  Branch (6364:10): [True: 328, False: 3.79k]
  ------------------
 6365|    328|						return(0);
 6366|  4.12k|				}
 6367|  4.38k|			}
 6368|  4.06k|			break;
 6369|  4.06k|		case TIFF_SETGET_C32_SINT64:
  ------------------
  |  Branch (6369:3): [True: 836, False: 236k]
  ------------------
 6370|    836|			{
 6371|    836|				int64_t* data = NULL;
 6372|    836|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6373|    836|				assert(fip->field_passcount==1);
 6374|    836|				err=TIFFReadDirEntrySlong8Array(tif,dp,&data);
 6375|    836|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6375:9): [True: 427, False: 409]
  ------------------
 6376|    427|				{
 6377|    427|					int m;
 6378|    427|					m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
 6379|    427|					if (data!=0)
  ------------------
  |  Branch (6379:10): [True: 322, False: 105]
  ------------------
 6380|    322|						_TIFFfree(data);
 6381|    427|					if (!m)
  ------------------
  |  Branch (6381:10): [True: 368, False: 59]
  ------------------
 6382|    368|						return(0);
 6383|    427|				}
 6384|    836|			}
 6385|    468|			break;
 6386|  1.04k|		case TIFF_SETGET_C32_FLOAT:
  ------------------
  |  Branch (6386:3): [True: 1.04k, False: 236k]
  ------------------
 6387|  1.04k|			{
 6388|  1.04k|				float* data;
 6389|  1.04k|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6390|  1.04k|				assert(fip->field_passcount==1);
 6391|  1.04k|				err=TIFFReadDirEntryFloatArray(tif,dp,&data);
 6392|  1.04k|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6392:9): [True: 608, False: 434]
  ------------------
 6393|    608|				{
 6394|    608|					int m;
 6395|    608|					m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
 6396|    608|					if (data!=0)
  ------------------
  |  Branch (6396:10): [True: 521, False: 87]
  ------------------
 6397|    521|						_TIFFfree(data);
 6398|    608|					if (!m)
  ------------------
  |  Branch (6398:10): [True: 87, False: 521]
  ------------------
 6399|     87|						return(0);
 6400|    608|				}
 6401|  1.04k|			}
 6402|    955|			break;
 6403|    955|		case TIFF_SETGET_C32_DOUBLE:
  ------------------
  |  Branch (6403:3): [True: 357, False: 237k]
  ------------------
 6404|    357|			{
 6405|    357|				double* data;
 6406|    357|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6407|    357|				assert(fip->field_passcount==1);
 6408|    357|				err=TIFFReadDirEntryDoubleArray(tif,dp,&data);
 6409|    357|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6409:9): [True: 174, False: 183]
  ------------------
 6410|    174|				{
 6411|    174|					int m;
 6412|    174|					m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
 6413|    174|					if (data!=0)
  ------------------
  |  Branch (6413:10): [True: 95, False: 79]
  ------------------
 6414|     95|						_TIFFfree(data);
 6415|    174|					if (!m)
  ------------------
  |  Branch (6415:10): [True: 79, False: 95]
  ------------------
 6416|     79|						return(0);
 6417|    174|				}
 6418|    357|			}
 6419|    278|			break;
 6420|    620|		case TIFF_SETGET_C32_IFD8:
  ------------------
  |  Branch (6420:3): [True: 620, False: 237k]
  ------------------
 6421|    620|			{
 6422|    620|				uint64_t* data;
 6423|    620|				assert(fip->field_readcount==TIFF_VARIABLE2);
 6424|    620|				assert(fip->field_passcount==1);
 6425|    620|				err=TIFFReadDirEntryIfd8Array(tif,dp,&data);
 6426|    620|				if (err==TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6426:9): [True: 203, False: 417]
  ------------------
 6427|    203|				{
 6428|    203|					int m;
 6429|    203|					m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
 6430|    203|					if (data!=0)
  ------------------
  |  Branch (6430:10): [True: 132, False: 71]
  ------------------
 6431|    132|						_TIFFfree(data);
 6432|    203|					if (!m)
  ------------------
  |  Branch (6432:10): [True: 71, False: 132]
  ------------------
 6433|     71|						return(0);
 6434|    203|				}
 6435|    620|			}
 6436|    549|			break;
 6437|    549|		default:
  ------------------
  |  Branch (6437:3): [True: 0, False: 237k]
  ------------------
 6438|      0|			assert(0);    /* we should never get here */
 6439|      0|			break;
 6440|   237k|	}
 6441|   234k|	if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6441:6): [True: 22.8k, False: 211k]
  ------------------
 6442|  22.8k|	{
 6443|  22.8k|		TIFFReadDirEntryOutputErr(tif,err,module,fip->field_name,recover);
 6444|  22.8k|		return(0);
 6445|  22.8k|	}
 6446|   211k|	return(1);
 6447|   234k|}
tif_dirread.c:TIFFReadDirEntryByteArray:
 1269|  15.5k|{
 1270|  15.5k|	enum TIFFReadDirEntryErr err;
 1271|  15.5k|	uint32_t count;
 1272|  15.5k|	void* origdata;
 1273|  15.5k|	uint8_t* data;
 1274|  15.5k|	switch (direntry->tdir_type)
 1275|  15.5k|	{
 1276|  8.73k|		case TIFF_ASCII:
  ------------------
  |  Branch (1276:3): [True: 8.73k, False: 6.84k]
  ------------------
 1277|  9.10k|		case TIFF_UNDEFINED:
  ------------------
  |  Branch (1277:3): [True: 367, False: 15.2k]
  ------------------
 1278|  13.3k|		case TIFF_BYTE:
  ------------------
  |  Branch (1278:3): [True: 4.21k, False: 11.3k]
  ------------------
 1279|  13.3k|		case TIFF_SBYTE:
  ------------------
  |  Branch (1279:3): [True: 63, False: 15.5k]
  ------------------
 1280|  13.7k|		case TIFF_SHORT:
  ------------------
  |  Branch (1280:3): [True: 356, False: 15.2k]
  ------------------
 1281|  13.8k|		case TIFF_SSHORT:
  ------------------
  |  Branch (1281:3): [True: 114, False: 15.4k]
  ------------------
 1282|  13.9k|		case TIFF_LONG:
  ------------------
  |  Branch (1282:3): [True: 108, False: 15.4k]
  ------------------
 1283|  14.0k|		case TIFF_SLONG:
  ------------------
  |  Branch (1283:3): [True: 109, False: 15.4k]
  ------------------
 1284|  14.2k|		case TIFF_LONG8:
  ------------------
  |  Branch (1284:3): [True: 165, False: 15.4k]
  ------------------
 1285|  14.4k|		case TIFF_SLONG8:
  ------------------
  |  Branch (1285:3): [True: 234, False: 15.3k]
  ------------------
 1286|  14.4k|			break;
 1287|  1.11k|		default:
  ------------------
  |  Branch (1287:3): [True: 1.11k, False: 14.4k]
  ------------------
 1288|  1.11k|			return(TIFFReadDirEntryErrType);
 1289|  15.5k|	}
 1290|  14.4k|	err=TIFFReadDirEntryArray(tif,direntry,&count,1,&origdata);
 1291|  14.4k|	if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (1291:6): [True: 6.50k, False: 7.96k]
  |  Branch (1291:36): [True: 803, False: 7.15k]
  ------------------
 1292|  7.31k|	{
 1293|  7.31k|		*value=0;
 1294|  7.31k|		return(err);
 1295|  7.31k|	}
 1296|  7.15k|	switch (direntry->tdir_type)
  ------------------
  |  Branch (1296:10): [True: 914, False: 6.24k]
  ------------------
 1297|  7.15k|	{
 1298|  4.83k|		case TIFF_ASCII:
  ------------------
  |  Branch (1298:3): [True: 4.83k, False: 2.32k]
  ------------------
 1299|  5.04k|		case TIFF_UNDEFINED:
  ------------------
  |  Branch (1299:3): [True: 207, False: 6.95k]
  ------------------
 1300|  6.18k|		case TIFF_BYTE:
  ------------------
  |  Branch (1300:3): [True: 1.13k, False: 6.01k]
  ------------------
 1301|  6.18k|			*value=(uint8_t*)origdata;
 1302|  6.18k|			return(TIFFReadDirEntryErrOk);
 1303|     60|		case TIFF_SBYTE:
  ------------------
  |  Branch (1303:3): [True: 60, False: 7.09k]
  ------------------
 1304|     60|			{
 1305|     60|				int8_t* m;
 1306|     60|				uint32_t n;
 1307|     60|				m=(int8_t*)origdata;
 1308|    384|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1308:15): [True: 342, False: 42]
  ------------------
 1309|    342|				{
 1310|    342|					err=TIFFReadDirEntryCheckRangeByteSbyte(*m);
 1311|    342|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1311:10): [True: 18, False: 324]
  ------------------
 1312|     18|					{
 1313|     18|						_TIFFfree(origdata);
 1314|     18|						return(err);
 1315|     18|					}
 1316|    324|					m++;
 1317|    324|				}
 1318|     42|				*value=(uint8_t*)origdata;
 1319|     42|				return(TIFFReadDirEntryErrOk);
 1320|     60|			}
 1321|  7.15k|	}
 1322|    914|	data=(uint8_t*)_TIFFmalloc(count);
 1323|    914|	if (data==0)
  ------------------
  |  Branch (1323:6): [True: 0, False: 914]
  ------------------
 1324|      0|	{
 1325|      0|		_TIFFfree(origdata);
 1326|      0|		return(TIFFReadDirEntryErrAlloc);
 1327|      0|	}
 1328|    914|	switch (direntry->tdir_type)
  ------------------
  |  Branch (1328:10): [True: 0, False: 914]
  ------------------
 1329|    914|	{
 1330|    312|		case TIFF_SHORT:
  ------------------
  |  Branch (1330:3): [True: 312, False: 602]
  ------------------
 1331|    312|			{
 1332|    312|				uint16_t* ma;
 1333|    312|				uint8_t* mb;
 1334|    312|				uint32_t n;
 1335|    312|				ma=(uint16_t*)origdata;
 1336|    312|				mb=data;
 1337|  1.29k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1337:15): [True: 1.08k, False: 215]
  ------------------
 1338|  1.08k|				{
 1339|  1.08k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  1.08k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1339:10): [True: 459, False: 625]
  ------------------
 1340|    459|						TIFFSwabShort(ma);
 1341|  1.08k|					err=TIFFReadDirEntryCheckRangeByteShort(*ma);
 1342|  1.08k|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1342:10): [True: 97, False: 987]
  ------------------
 1343|     97|						break;
 1344|    987|					*mb++=(uint8_t)(*ma++);
 1345|    987|				}
 1346|    312|			}
 1347|    312|			break;
 1348|    102|		case TIFF_SSHORT:
  ------------------
  |  Branch (1348:3): [True: 102, False: 812]
  ------------------
 1349|    102|			{
 1350|    102|				int16_t* ma;
 1351|    102|				uint8_t* mb;
 1352|    102|				uint32_t n;
 1353|    102|				ma=(int16_t*)origdata;
 1354|    102|				mb=data;
 1355|    642|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1355:15): [True: 591, False: 51]
  ------------------
 1356|    591|				{
 1357|    591|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    591|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1357:10): [True: 272, False: 319]
  ------------------
 1358|    272|						TIFFSwabShort((uint16_t*)ma);
 1359|    591|					err=TIFFReadDirEntryCheckRangeByteSshort(*ma);
 1360|    591|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1360:10): [True: 51, False: 540]
  ------------------
 1361|     51|						break;
 1362|    540|					*mb++=(uint8_t)(*ma++);
 1363|    540|				}
 1364|    102|			}
 1365|    102|			break;
 1366|     89|		case TIFF_LONG:
  ------------------
  |  Branch (1366:3): [True: 89, False: 825]
  ------------------
 1367|     89|			{
 1368|     89|				uint32_t* ma;
 1369|     89|				uint8_t* mb;
 1370|     89|				uint32_t n;
 1371|     89|				ma=(uint32_t*)origdata;
 1372|     89|				mb=data;
 1373|    579|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1373:15): [True: 554, False: 25]
  ------------------
 1374|    554|				{
 1375|    554|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    554|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1375:10): [True: 277, False: 277]
  ------------------
 1376|    277|						TIFFSwabLong(ma);
 1377|    554|					err=TIFFReadDirEntryCheckRangeByteLong(*ma);
 1378|    554|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1378:10): [True: 64, False: 490]
  ------------------
 1379|     64|						break;
 1380|    490|					*mb++=(uint8_t)(*ma++);
 1381|    490|				}
 1382|     89|			}
 1383|     89|			break;
 1384|     81|		case TIFF_SLONG:
  ------------------
  |  Branch (1384:3): [True: 81, False: 833]
  ------------------
 1385|     81|			{
 1386|     81|				int32_t* ma;
 1387|     81|				uint8_t* mb;
 1388|     81|				uint32_t n;
 1389|     81|				ma=(int32_t*)origdata;
 1390|     81|				mb=data;
 1391|    547|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1391:15): [True: 533, False: 14]
  ------------------
 1392|    533|				{
 1393|    533|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    533|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1393:10): [True: 217, False: 316]
  ------------------
 1394|    217|						TIFFSwabLong((uint32_t*)ma);
 1395|    533|					err=TIFFReadDirEntryCheckRangeByteSlong(*ma);
 1396|    533|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1396:10): [True: 67, False: 466]
  ------------------
 1397|     67|						break;
 1398|    466|					*mb++=(uint8_t)(*ma++);
 1399|    466|				}
 1400|     81|			}
 1401|     81|			break;
 1402|    140|		case TIFF_LONG8:
  ------------------
  |  Branch (1402:3): [True: 140, False: 774]
  ------------------
 1403|    140|			{
 1404|    140|				uint64_t* ma;
 1405|    140|				uint8_t* mb;
 1406|    140|				uint32_t n;
 1407|    140|				ma=(uint64_t*)origdata;
 1408|    140|				mb=data;
 1409|    662|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1409:15): [True: 640, False: 22]
  ------------------
 1410|    640|				{
 1411|    640|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    640|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1411:10): [True: 230, False: 410]
  ------------------
 1412|    230|						TIFFSwabLong8(ma);
 1413|    640|					err=TIFFReadDirEntryCheckRangeByteLong8(*ma);
 1414|    640|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1414:10): [True: 118, False: 522]
  ------------------
 1415|    118|						break;
 1416|    522|					*mb++=(uint8_t)(*ma++);
 1417|    522|				}
 1418|    140|			}
 1419|    140|			break;
 1420|    190|		case TIFF_SLONG8:
  ------------------
  |  Branch (1420:3): [True: 190, False: 724]
  ------------------
 1421|    190|			{
 1422|    190|				int64_t* ma;
 1423|    190|				uint8_t* mb;
 1424|    190|				uint32_t n;
 1425|    190|				ma=(int64_t*)origdata;
 1426|    190|				mb=data;
 1427|    740|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1427:15): [True: 721, False: 19]
  ------------------
 1428|    721|				{
 1429|    721|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    721|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1429:10): [True: 327, False: 394]
  ------------------
 1430|    327|						TIFFSwabLong8((uint64_t*)ma);
 1431|    721|					err=TIFFReadDirEntryCheckRangeByteSlong8(*ma);
 1432|    721|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1432:10): [True: 171, False: 550]
  ------------------
 1433|    171|						break;
 1434|    550|					*mb++=(uint8_t)(*ma++);
 1435|    550|				}
 1436|    190|			}
 1437|    190|			break;
 1438|    914|	}
 1439|    914|	_TIFFfree(origdata);
 1440|    914|	if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1440:6): [True: 568, False: 346]
  ------------------
 1441|    568|	{
 1442|    568|		_TIFFfree(data);
 1443|    568|		return(err);
 1444|    568|	}
 1445|    346|	*value=data;
 1446|    346|	return(TIFFReadDirEntryErrOk);
 1447|    914|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSbyte:
 3374|    357|{
 3375|    357|	if (value<0)
  ------------------
  |  Branch (3375:6): [True: 23, False: 334]
  ------------------
 3376|     23|		return(TIFFReadDirEntryErrRange);
 3377|    334|	else
 3378|    334|		return(TIFFReadDirEntryErrOk);
 3379|    357|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteShort:
 3382|  1.10k|{
 3383|  1.10k|	if (value>0xFF)
  ------------------
  |  Branch (3383:6): [True: 106, False: 1.00k]
  ------------------
 3384|    106|		return(TIFFReadDirEntryErrRange);
 3385|  1.00k|	else
 3386|  1.00k|		return(TIFFReadDirEntryErrOk);
 3387|  1.10k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSshort:
 3390|    615|{
 3391|    615|	if ((value<0)||(value>0xFF))
  ------------------
  |  Branch (3391:6): [True: 24, False: 591]
  |  Branch (3391:17): [True: 45, False: 546]
  ------------------
 3392|     69|		return(TIFFReadDirEntryErrRange);
 3393|    546|	else
 3394|    546|		return(TIFFReadDirEntryErrOk);
 3395|    615|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteLong:
 3398|    598|{
 3399|    598|	if (value>0xFF)
  ------------------
  |  Branch (3399:6): [True: 98, False: 500]
  ------------------
 3400|     98|		return(TIFFReadDirEntryErrRange);
 3401|    500|	else
 3402|    500|		return(TIFFReadDirEntryErrOk);
 3403|    598|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSlong:
 3406|    593|{
 3407|    593|	if ((value<0)||(value>0xFF))
  ------------------
  |  Branch (3407:6): [True: 58, False: 535]
  |  Branch (3407:17): [True: 63, False: 472]
  ------------------
 3408|    121|		return(TIFFReadDirEntryErrRange);
 3409|    472|	else
 3410|    472|		return(TIFFReadDirEntryErrOk);
 3411|    593|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteLong8:
 3414|    752|{
 3415|    752|	if (value>0xFF)
  ------------------
  |  Branch (3415:6): [True: 221, False: 531]
  ------------------
 3416|    221|		return(TIFFReadDirEntryErrRange);
 3417|    531|	else
 3418|    531|		return(TIFFReadDirEntryErrOk);
 3419|    752|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSlong8:
 3422|    856|{
 3423|    856|	if ((value<0)||(value>0xFF))
  ------------------
  |  Branch (3423:6): [True: 146, False: 710]
  |  Branch (3423:17): [True: 155, False: 555]
  ------------------
 3424|    301|		return(TIFFReadDirEntryErrRange);
 3425|    555|	else
 3426|    555|		return(TIFFReadDirEntryErrOk);
 3427|    856|}
tif_dirread.c:TIFFReadDirEntryByte:
  200|    579|{
  201|    579|	enum TIFFReadDirEntryErr err;
  202|    579|	if (direntry->tdir_count!=1)
  ------------------
  |  Branch (202:6): [True: 150, False: 429]
  ------------------
  203|    150|		return(TIFFReadDirEntryErrCount);
  204|    429|	switch (direntry->tdir_type)
  205|    429|	{
  206|      3|		case TIFF_BYTE:
  ------------------
  |  Branch (206:3): [True: 3, False: 426]
  ------------------
  207|      4|		case TIFF_UNDEFINED:	/* Support to read TIFF_UNDEFINED with field_readcount==1 */
  ------------------
  |  Branch (207:3): [True: 1, False: 428]
  ------------------
  208|      4|			TIFFReadDirEntryCheckedByte(tif,direntry,value);
  209|      4|			return(TIFFReadDirEntryErrOk);
  210|     15|		case TIFF_SBYTE:
  ------------------
  |  Branch (210:3): [True: 15, False: 414]
  ------------------
  211|     15|			{
  212|     15|				int8_t m;
  213|     15|				TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
  214|     15|				err=TIFFReadDirEntryCheckRangeByteSbyte(m);
  215|     15|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (215:9): [True: 5, False: 10]
  ------------------
  216|      5|					return(err);
  217|     10|				*value=(uint8_t)m;
  218|     10|				return(TIFFReadDirEntryErrOk);
  219|     15|			}
  220|     22|		case TIFF_SHORT:
  ------------------
  |  Branch (220:3): [True: 22, False: 407]
  ------------------
  221|     22|			{
  222|     22|				uint16_t m;
  223|     22|				TIFFReadDirEntryCheckedShort(tif,direntry,&m);
  224|     22|				err=TIFFReadDirEntryCheckRangeByteShort(m);
  225|     22|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (225:9): [True: 9, False: 13]
  ------------------
  226|      9|					return(err);
  227|     13|				*value=(uint8_t)m;
  228|     13|				return(TIFFReadDirEntryErrOk);
  229|     22|			}
  230|     24|		case TIFF_SSHORT:
  ------------------
  |  Branch (230:3): [True: 24, False: 405]
  ------------------
  231|     24|			{
  232|     24|				int16_t m;
  233|     24|				TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
  234|     24|				err=TIFFReadDirEntryCheckRangeByteSshort(m);
  235|     24|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (235:9): [True: 18, False: 6]
  ------------------
  236|     18|					return(err);
  237|      6|				*value=(uint8_t)m;
  238|      6|				return(TIFFReadDirEntryErrOk);
  239|     24|			}
  240|     44|		case TIFF_LONG:
  ------------------
  |  Branch (240:3): [True: 44, False: 385]
  ------------------
  241|     44|			{
  242|     44|				uint32_t m;
  243|     44|				TIFFReadDirEntryCheckedLong(tif,direntry,&m);
  244|     44|				err=TIFFReadDirEntryCheckRangeByteLong(m);
  245|     44|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (245:9): [True: 34, False: 10]
  ------------------
  246|     34|					return(err);
  247|     10|				*value=(uint8_t)m;
  248|     10|				return(TIFFReadDirEntryErrOk);
  249|     44|			}
  250|     60|		case TIFF_SLONG:
  ------------------
  |  Branch (250:3): [True: 60, False: 369]
  ------------------
  251|     60|			{
  252|     60|				int32_t m;
  253|     60|				TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
  254|     60|				err=TIFFReadDirEntryCheckRangeByteSlong(m);
  255|     60|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (255:9): [True: 54, False: 6]
  ------------------
  256|     54|					return(err);
  257|      6|				*value=(uint8_t)m;
  258|      6|				return(TIFFReadDirEntryErrOk);
  259|     60|			}
  260|    117|		case TIFF_LONG8:
  ------------------
  |  Branch (260:3): [True: 117, False: 312]
  ------------------
  261|    117|			{
  262|    117|				uint64_t m;
  263|    117|				err=TIFFReadDirEntryCheckedLong8(tif,direntry,&m);
  264|    117|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (264:9): [True: 5, False: 112]
  ------------------
  265|      5|					return(err);
  266|    112|				err=TIFFReadDirEntryCheckRangeByteLong8(m);
  267|    112|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (267:9): [True: 103, False: 9]
  ------------------
  268|    103|					return(err);
  269|      9|				*value=(uint8_t)m;
  270|      9|				return(TIFFReadDirEntryErrOk);
  271|    112|			}
  272|    139|		case TIFF_SLONG8:
  ------------------
  |  Branch (272:3): [True: 139, False: 290]
  ------------------
  273|    139|			{
  274|    139|				int64_t m;
  275|    139|				err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
  276|    139|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (276:9): [True: 4, False: 135]
  ------------------
  277|      4|					return(err);
  278|    135|				err=TIFFReadDirEntryCheckRangeByteSlong8(m);
  279|    135|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (279:9): [True: 130, False: 5]
  ------------------
  280|    130|					return(err);
  281|      5|				*value=(uint8_t)m;
  282|      5|				return(TIFFReadDirEntryErrOk);
  283|    135|			}
  284|      4|		default:
  ------------------
  |  Branch (284:3): [True: 4, False: 425]
  ------------------
  285|      4|			return(TIFFReadDirEntryErrType);
  286|    429|	}
  287|    429|}
tif_dirread.c:TIFFReadDirEntryLong:
  552|  65.1k|{
  553|  65.1k|	enum TIFFReadDirEntryErr err;
  554|  65.1k|	if (direntry->tdir_count!=1)
  ------------------
  |  Branch (554:6): [True: 1.70k, False: 63.4k]
  ------------------
  555|  1.70k|		return(TIFFReadDirEntryErrCount);
  556|  63.4k|	switch (direntry->tdir_type)
  557|  63.4k|	{
  558|  8.29k|		case TIFF_BYTE:
  ------------------
  |  Branch (558:3): [True: 8.29k, False: 55.1k]
  ------------------
  559|  8.29k|			{
  560|  8.29k|				uint8_t m;
  561|  8.29k|				TIFFReadDirEntryCheckedByte(tif,direntry,&m);
  562|  8.29k|				*value=(uint32_t)m;
  563|  8.29k|				return(TIFFReadDirEntryErrOk);
  564|      0|			}
  565|  5.25k|		case TIFF_SBYTE:
  ------------------
  |  Branch (565:3): [True: 5.25k, False: 58.1k]
  ------------------
  566|  5.25k|			{
  567|  5.25k|				int8_t m;
  568|  5.25k|				TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
  569|  5.25k|				err=TIFFReadDirEntryCheckRangeLongSbyte(m);
  570|  5.25k|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (570:9): [True: 7, False: 5.24k]
  ------------------
  571|      7|					return(err);
  572|  5.24k|				*value=(uint32_t)m;
  573|  5.24k|				return(TIFFReadDirEntryErrOk);
  574|  5.25k|			}
  575|  40.8k|		case TIFF_SHORT:
  ------------------
  |  Branch (575:3): [True: 40.8k, False: 22.5k]
  ------------------
  576|  40.8k|			{
  577|  40.8k|				uint16_t m;
  578|  40.8k|				TIFFReadDirEntryCheckedShort(tif,direntry,&m);
  579|  40.8k|				*value=(uint32_t)m;
  580|  40.8k|				return(TIFFReadDirEntryErrOk);
  581|  5.25k|			}
  582|  1.50k|		case TIFF_SSHORT:
  ------------------
  |  Branch (582:3): [True: 1.50k, False: 61.9k]
  ------------------
  583|  1.50k|			{
  584|  1.50k|				int16_t m;
  585|  1.50k|				TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
  586|  1.50k|				err=TIFFReadDirEntryCheckRangeLongSshort(m);
  587|  1.50k|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (587:9): [True: 2, False: 1.49k]
  ------------------
  588|      2|					return(err);
  589|  1.49k|				*value=(uint32_t)m;
  590|  1.49k|				return(TIFFReadDirEntryErrOk);
  591|  1.50k|			}
  592|  5.34k|		case TIFF_LONG:
  ------------------
  |  Branch (592:3): [True: 5.34k, False: 58.0k]
  ------------------
  593|  5.34k|			TIFFReadDirEntryCheckedLong(tif,direntry,value);
  594|  5.34k|			return(TIFFReadDirEntryErrOk);
  595|  1.88k|		case TIFF_SLONG:
  ------------------
  |  Branch (595:3): [True: 1.88k, False: 61.5k]
  ------------------
  596|  1.88k|			{
  597|  1.88k|				int32_t m;
  598|  1.88k|				TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
  599|  1.88k|				err=TIFFReadDirEntryCheckRangeLongSlong(m);
  600|  1.88k|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (600:9): [True: 33, False: 1.84k]
  ------------------
  601|     33|					return(err);
  602|  1.84k|				*value=(uint32_t)m;
  603|  1.84k|				return(TIFFReadDirEntryErrOk);
  604|  1.88k|			}
  605|    137|		case TIFF_LONG8:
  ------------------
  |  Branch (605:3): [True: 137, False: 63.2k]
  ------------------
  606|    137|			{
  607|    137|				uint64_t m;
  608|    137|				err=TIFFReadDirEntryCheckedLong8(tif,direntry,&m);
  609|    137|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (609:9): [True: 12, False: 125]
  ------------------
  610|     12|					return(err);
  611|    125|				err=TIFFReadDirEntryCheckRangeLongLong8(m);
  612|    125|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (612:9): [True: 75, False: 50]
  ------------------
  613|     75|					return(err);
  614|     50|				*value=(uint32_t)m;
  615|     50|				return(TIFFReadDirEntryErrOk);
  616|    125|			}
  617|    155|		case TIFF_SLONG8:
  ------------------
  |  Branch (617:3): [True: 155, False: 63.2k]
  ------------------
  618|    155|			{
  619|    155|				int64_t m;
  620|    155|				err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
  621|    155|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (621:9): [True: 12, False: 143]
  ------------------
  622|     12|					return(err);
  623|    143|				err=TIFFReadDirEntryCheckRangeLongSlong8(m);
  624|    143|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (624:9): [True: 111, False: 32]
  ------------------
  625|    111|					return(err);
  626|     32|				*value=(uint32_t)m;
  627|     32|				return(TIFFReadDirEntryErrOk);
  628|    143|			}
  629|     28|		default:
  ------------------
  |  Branch (629:3): [True: 28, False: 63.3k]
  ------------------
  630|     28|			return(TIFFReadDirEntryErrType);
  631|  63.4k|	}
  632|  63.4k|}  /*-- TIFFReadDirEntryLong() --*/
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSbyte:
 3574|  5.59k|{
 3575|  5.59k|	if (value<0)
  ------------------
  |  Branch (3575:6): [True: 25, False: 5.56k]
  ------------------
 3576|     25|		return(TIFFReadDirEntryErrRange);
 3577|  5.56k|	else
 3578|  5.56k|		return(TIFFReadDirEntryErrOk);
 3579|  5.59k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSshort:
 3582|  75.2k|{
 3583|  75.2k|	if (value<0)
  ------------------
  |  Branch (3583:6): [True: 18, False: 75.2k]
  ------------------
 3584|     18|		return(TIFFReadDirEntryErrRange);
 3585|  75.2k|	else
 3586|  75.2k|		return(TIFFReadDirEntryErrOk);
 3587|  75.2k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSlong:
 3590|  2.82k|{
 3591|  2.82k|	if (value<0)
  ------------------
  |  Branch (3591:6): [True: 74, False: 2.74k]
  ------------------
 3592|     74|		return(TIFFReadDirEntryErrRange);
 3593|  2.74k|	else
 3594|  2.74k|		return(TIFFReadDirEntryErrOk);
 3595|  2.82k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongLong8:
 3599|    708|{
 3600|    708|	if (value > UINT32_MAX)
  ------------------
  |  Branch (3600:6): [True: 140, False: 568]
  ------------------
 3601|    140|		return(TIFFReadDirEntryErrRange);
 3602|    568|	else
 3603|    568|		return(TIFFReadDirEntryErrOk);
 3604|    708|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSlong8:
 3608|    836|{
 3609|    836|	if ((value < 0) || (value > (int64_t) UINT32_MAX))
  ------------------
  |  Branch (3609:6): [True: 140, False: 696]
  |  Branch (3609:21): [True: 130, False: 566]
  ------------------
 3610|    270|		return(TIFFReadDirEntryErrRange);
 3611|    566|	else
 3612|    566|		return(TIFFReadDirEntryErrOk);
 3613|    836|}
tif_dirread.c:TIFFReadDirEntryLong8:
  712|  1.09k|{
  713|  1.09k|	enum TIFFReadDirEntryErr err;
  714|  1.09k|	if (direntry->tdir_count!=1)
  ------------------
  |  Branch (714:6): [True: 128, False: 971]
  ------------------
  715|    128|		return(TIFFReadDirEntryErrCount);
  716|    971|	switch (direntry->tdir_type)
  717|    971|	{
  718|    159|		case TIFF_BYTE:
  ------------------
  |  Branch (718:3): [True: 159, False: 812]
  ------------------
  719|    159|			{
  720|    159|				uint8_t m;
  721|    159|				TIFFReadDirEntryCheckedByte(tif,direntry,&m);
  722|    159|				*value=(uint64_t)m;
  723|    159|				return(TIFFReadDirEntryErrOk);
  724|      0|			}
  725|     90|		case TIFF_SBYTE:
  ------------------
  |  Branch (725:3): [True: 90, False: 881]
  ------------------
  726|     90|			{
  727|     90|				int8_t m;
  728|     90|				TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
  729|     90|				err=TIFFReadDirEntryCheckRangeLong8Sbyte(m);
  730|     90|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (730:9): [True: 3, False: 87]
  ------------------
  731|      3|					return(err);
  732|     87|				*value=(uint64_t)m;
  733|     87|				return(TIFFReadDirEntryErrOk);
  734|     90|			}
  735|     65|		case TIFF_SHORT:
  ------------------
  |  Branch (735:3): [True: 65, False: 906]
  ------------------
  736|     65|			{
  737|     65|				uint16_t m;
  738|     65|				TIFFReadDirEntryCheckedShort(tif,direntry,&m);
  739|     65|				*value=(uint64_t)m;
  740|     65|				return(TIFFReadDirEntryErrOk);
  741|     90|			}
  742|     24|		case TIFF_SSHORT:
  ------------------
  |  Branch (742:3): [True: 24, False: 947]
  ------------------
  743|     24|			{
  744|     24|				int16_t m;
  745|     24|				TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
  746|     24|				err=TIFFReadDirEntryCheckRangeLong8Sshort(m);
  747|     24|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (747:9): [True: 9, False: 15]
  ------------------
  748|      9|					return(err);
  749|     15|				*value=(uint64_t)m;
  750|     15|				return(TIFFReadDirEntryErrOk);
  751|     24|			}
  752|    173|		case TIFF_LONG:
  ------------------
  |  Branch (752:3): [True: 173, False: 798]
  ------------------
  753|    173|			{
  754|    173|				uint32_t m;
  755|    173|				TIFFReadDirEntryCheckedLong(tif,direntry,&m);
  756|    173|				*value=(uint64_t)m;
  757|    173|				return(TIFFReadDirEntryErrOk);
  758|     24|			}
  759|     47|		case TIFF_SLONG:
  ------------------
  |  Branch (759:3): [True: 47, False: 924]
  ------------------
  760|     47|			{
  761|     47|				int32_t m;
  762|     47|				TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
  763|     47|				err=TIFFReadDirEntryCheckRangeLong8Slong(m);
  764|     47|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (764:9): [True: 20, False: 27]
  ------------------
  765|     20|					return(err);
  766|     27|				*value=(uint64_t)m;
  767|     27|				return(TIFFReadDirEntryErrOk);
  768|     47|			}
  769|    320|		case TIFF_LONG8:
  ------------------
  |  Branch (769:3): [True: 320, False: 651]
  ------------------
  770|    320|			err=TIFFReadDirEntryCheckedLong8(tif,direntry,value);
  771|    320|			return(err);
  772|     87|		case TIFF_SLONG8:
  ------------------
  |  Branch (772:3): [True: 87, False: 884]
  ------------------
  773|     87|			{
  774|     87|				int64_t m;
  775|     87|				err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
  776|     87|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (776:9): [True: 11, False: 76]
  ------------------
  777|     11|					return(err);
  778|     76|				err=TIFFReadDirEntryCheckRangeLong8Slong8(m);
  779|     76|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (779:9): [True: 49, False: 27]
  ------------------
  780|     49|					return(err);
  781|     27|				*value=(uint64_t)m;
  782|     27|				return(TIFFReadDirEntryErrOk);
  783|     76|			}
  784|      6|		default:
  ------------------
  |  Branch (784:3): [True: 6, False: 965]
  ------------------
  785|      6|			return(TIFFReadDirEntryErrType);
  786|    971|	}
  787|    971|}  /*-- TIFFReadDirEntryLong8() --*/
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Sbyte:
 3646|  2.90k|{
 3647|  2.90k|	if (value < 0)
  ------------------
  |  Branch (3647:6): [True: 13, False: 2.89k]
  ------------------
 3648|     13|		return(TIFFReadDirEntryErrRange);
 3649|  2.89k|	else
 3650|  2.89k|		return(TIFFReadDirEntryErrOk);
 3651|  2.90k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Sshort:
 3655|  1.41k|{
 3656|  1.41k|	if (value < 0)
  ------------------
  |  Branch (3656:6): [True: 30, False: 1.38k]
  ------------------
 3657|     30|		return(TIFFReadDirEntryErrRange);
 3658|  1.38k|	else
 3659|  1.38k|		return(TIFFReadDirEntryErrOk);
 3660|  1.41k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Slong:
 3664|  1.11k|{
 3665|  1.11k|	if (value < 0)
  ------------------
  |  Branch (3665:6): [True: 32, False: 1.07k]
  ------------------
 3666|     32|		return(TIFFReadDirEntryErrRange);
 3667|  1.07k|	else
 3668|  1.07k|		return(TIFFReadDirEntryErrOk);
 3669|  1.11k|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Slong8:
 3673|    899|{
 3674|    899|	if (value < 0)
  ------------------
  |  Branch (3674:6): [True: 132, False: 767]
  ------------------
 3675|    132|		return(TIFFReadDirEntryErrRange);
 3676|    767|	else
 3677|    767|		return(TIFFReadDirEntryErrOk);
 3678|    899|}
tif_dirread.c:TIFFReadDirEntryFloat:
  860|  2.54k|{
  861|  2.54k|	enum TIFFReadDirEntryErr err;
  862|  2.54k|	if (direntry->tdir_count!=1)
  ------------------
  |  Branch (862:6): [True: 1.04k, False: 1.50k]
  ------------------
  863|  1.04k|		return(TIFFReadDirEntryErrCount);
  864|  1.50k|	switch (direntry->tdir_type)
  865|  1.50k|	{
  866|    111|		case TIFF_BYTE:
  ------------------
  |  Branch (866:3): [True: 111, False: 1.39k]
  ------------------
  867|    111|			{
  868|    111|				uint8_t m;
  869|    111|				TIFFReadDirEntryCheckedByte(tif,direntry,&m);
  870|    111|				*value=(float)m;
  871|    111|				return(TIFFReadDirEntryErrOk);
  872|      0|			}
  873|     20|		case TIFF_SBYTE:
  ------------------
  |  Branch (873:3): [True: 20, False: 1.48k]
  ------------------
  874|     20|			{
  875|     20|				int8_t m;
  876|     20|				TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
  877|     20|				*value=(float)m;
  878|     20|				return(TIFFReadDirEntryErrOk);
  879|      0|			}
  880|    203|		case TIFF_SHORT:
  ------------------
  |  Branch (880:3): [True: 203, False: 1.30k]
  ------------------
  881|    203|			{
  882|    203|				uint16_t m;
  883|    203|				TIFFReadDirEntryCheckedShort(tif,direntry,&m);
  884|    203|				*value=(float)m;
  885|    203|				return(TIFFReadDirEntryErrOk);
  886|      0|			}
  887|     10|		case TIFF_SSHORT:
  ------------------
  |  Branch (887:3): [True: 10, False: 1.49k]
  ------------------
  888|     10|			{
  889|     10|				int16_t m;
  890|     10|				TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
  891|     10|				*value=(float)m;
  892|     10|				return(TIFFReadDirEntryErrOk);
  893|      0|			}
  894|     11|		case TIFF_LONG:
  ------------------
  |  Branch (894:3): [True: 11, False: 1.49k]
  ------------------
  895|     11|			{
  896|     11|				uint32_t m;
  897|     11|				TIFFReadDirEntryCheckedLong(tif,direntry,&m);
  898|     11|				*value=(float)m;
  899|     11|				return(TIFFReadDirEntryErrOk);
  900|      0|			}
  901|     22|		case TIFF_SLONG:
  ------------------
  |  Branch (901:3): [True: 22, False: 1.48k]
  ------------------
  902|     22|			{
  903|     22|				int32_t m;
  904|     22|				TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
  905|     22|				*value=(float)m;
  906|     22|				return(TIFFReadDirEntryErrOk);
  907|      0|			}
  908|     24|		case TIFF_LONG8:
  ------------------
  |  Branch (908:3): [True: 24, False: 1.48k]
  ------------------
  909|     24|			{
  910|     24|				uint64_t m;
  911|     24|				err=TIFFReadDirEntryCheckedLong8(tif,direntry,&m);
  912|     24|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (912:9): [True: 10, False: 14]
  ------------------
  913|     10|					return(err);
  914|       |#if defined(__WIN32__) && (_MSC_VER < 1500)
  915|       |				/*
  916|       |				 * XXX: MSVC 6.0 does not support conversion
  917|       |				 * of 64-bit integers into floating point
  918|       |				 * values.
  919|       |				 */
  920|       |				*value = _TIFFUInt64ToFloat(m);
  921|       |#else
  922|     14|				*value=(float)m;
  923|     14|#endif
  924|     14|				return(TIFFReadDirEntryErrOk);
  925|     24|			}
  926|     36|		case TIFF_SLONG8:
  ------------------
  |  Branch (926:3): [True: 36, False: 1.46k]
  ------------------
  927|     36|			{
  928|     36|				int64_t m;
  929|     36|				err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
  930|     36|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (930:9): [True: 22, False: 14]
  ------------------
  931|     22|					return(err);
  932|     14|				*value=(float)m;
  933|     14|				return(TIFFReadDirEntryErrOk);
  934|     36|			}
  935|    700|		case TIFF_RATIONAL:
  ------------------
  |  Branch (935:3): [True: 700, False: 804]
  ------------------
  936|    700|			{
  937|    700|				double m;
  938|    700|				err=TIFFReadDirEntryCheckedRational(tif,direntry,&m);
  939|    700|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (939:9): [True: 116, False: 584]
  ------------------
  940|    116|					return(err);
  941|    584|				*value=(float)m;
  942|    584|				return(TIFFReadDirEntryErrOk);
  943|    700|			}
  944|    155|		case TIFF_SRATIONAL:
  ------------------
  |  Branch (944:3): [True: 155, False: 1.34k]
  ------------------
  945|    155|			{
  946|    155|				double m;
  947|    155|				err=TIFFReadDirEntryCheckedSrational(tif,direntry,&m);
  948|    155|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (948:9): [True: 33, False: 122]
  ------------------
  949|     33|					return(err);
  950|    122|				*value=(float)m;
  951|    122|				return(TIFFReadDirEntryErrOk);
  952|    155|			}
  953|     36|		case TIFF_FLOAT:
  ------------------
  |  Branch (953:3): [True: 36, False: 1.46k]
  ------------------
  954|     36|			TIFFReadDirEntryCheckedFloat(tif,direntry,value);
  955|     36|			return(TIFFReadDirEntryErrOk);
  956|     73|		case TIFF_DOUBLE:
  ------------------
  |  Branch (956:3): [True: 73, False: 1.43k]
  ------------------
  957|     73|			{
  958|     73|				double m;
  959|     73|				err=TIFFReadDirEntryCheckedDouble(tif,direntry,&m);
  960|     73|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (960:9): [True: 22, False: 51]
  ------------------
  961|     22|					return(err);
  962|     51|				if ((m > FLT_MAX) || (m < -FLT_MAX))
  ------------------
  |  Branch (962:9): [True: 17, False: 34]
  |  Branch (962:26): [True: 10, False: 24]
  ------------------
  963|     27|					return(TIFFReadDirEntryErrRange);
  964|     24|				*value=(float)m;
  965|     24|				return(TIFFReadDirEntryErrOk);
  966|     51|			}
  967|    103|		default:
  ------------------
  |  Branch (967:3): [True: 103, False: 1.40k]
  ------------------
  968|    103|			return(TIFFReadDirEntryErrType);
  969|  1.50k|	}
  970|  1.50k|}
tif_dirread.c:TIFFReadDirEntryCheckedRational:
 3270|    703|{
 3271|    703|	UInt64Aligned_t m;
 3272|       |
 3273|    703|	assert(sizeof(double)==8);
 3274|    703|	assert(sizeof(uint64_t) == 8);
 3275|    703|	assert(sizeof(uint32_t) == 4);
 3276|    703|	if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|    703|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (3276:6): [True: 699, False: 4]
  ------------------
 3277|    699|	{
 3278|    699|		enum TIFFReadDirEntryErr err;
 3279|    699|		uint32_t offset = direntry->tdir_offset.toff_long;
 3280|    699|		if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    699|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3280:7): [True: 45, False: 654]
  ------------------
 3281|     45|			TIFFSwabLong(&offset);
 3282|    699|		err=TIFFReadDirEntryData(tif,offset,8,m.i);
 3283|    699|		if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3283:7): [True: 117, False: 582]
  ------------------
 3284|    117|			return(err);
 3285|    699|	}
 3286|      4|	else
 3287|      4|		m.l = direntry->tdir_offset.toff_long8;
 3288|    586|	if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    586|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3288:6): [True: 36, False: 550]
  ------------------
 3289|     36|		TIFFSwabArrayOfLong(m.i,2);
 3290|       |        /* Not completely sure what we should do when m.i[1]==0, but some */
 3291|       |        /* sanitizers do not like division by 0.0: */
 3292|       |        /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */
 3293|    586|	if (m.i[0]==0 || m.i[1]==0)
  ------------------
  |  Branch (3293:6): [True: 29, False: 557]
  |  Branch (3293:19): [True: 57, False: 500]
  ------------------
 3294|     86|		*value=0.0;
 3295|    500|	else
 3296|    500|		*value=(double)m.i[0]/(double)m.i[1];
 3297|    586|	return(TIFFReadDirEntryErrOk);
 3298|    703|}
tif_dirread.c:TIFFReadDirEntryCheckedSrational:
 3301|    157|{
 3302|    157|	UInt64Aligned_t m;
 3303|    157|	assert(sizeof(double)==8);
 3304|    157|	assert(sizeof(uint64_t) == 8);
 3305|    157|	assert(sizeof(int32_t) == 4);
 3306|    157|	assert(sizeof(uint32_t) == 4);
 3307|    157|	if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|    157|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (3307:6): [True: 156, False: 1]
  ------------------
 3308|    156|	{
 3309|    156|		enum TIFFReadDirEntryErr err;
 3310|    156|		uint32_t offset = direntry->tdir_offset.toff_long;
 3311|    156|		if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    156|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3311:7): [True: 27, False: 129]
  ------------------
 3312|     27|			TIFFSwabLong(&offset);
 3313|    156|		err=TIFFReadDirEntryData(tif,offset,8,m.i);
 3314|    156|		if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3314:7): [True: 34, False: 122]
  ------------------
 3315|     34|			return(err);
 3316|    156|	}
 3317|      1|	else
 3318|      1|		m.l=direntry->tdir_offset.toff_long8;
 3319|    123|	if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    123|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3319:6): [True: 17, False: 106]
  ------------------
 3320|     17|		TIFFSwabArrayOfLong(m.i,2);
 3321|       |        /* Not completely sure what we should do when m.i[1]==0, but some */
 3322|       |        /* sanitizers do not like division by 0.0: */
 3323|       |        /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */
 3324|    123|	if ((int32_t)m.i[0] == 0 || m.i[1] == 0)
  ------------------
  |  Branch (3324:6): [True: 14, False: 109]
  |  Branch (3324:30): [True: 14, False: 95]
  ------------------
 3325|     28|		*value=0.0;
 3326|     95|	else
 3327|     95|		*value= (double)((int32_t)m.i[0]) / (double)m.i[1];
 3328|    123|	return(TIFFReadDirEntryErrOk);
 3329|    157|}
tif_dirread.c:TIFFReadDirEntryCheckedFloat:
 3332|     38|{
 3333|     38|         union
 3334|     38|	 {
 3335|     38|	   float  f;
 3336|     38|	   uint32_t i;
 3337|     38|	 } float_union;
 3338|     38|	assert(sizeof(float)==4);
 3339|     38|	assert(sizeof(uint32_t) == 4);
 3340|     38|	assert(sizeof(float_union)==4);
 3341|     38|	float_union.i=*(uint32_t*)(&direntry->tdir_offset);
 3342|     38|	*value=float_union.f;
 3343|     38|	if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|     38|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3343:6): [True: 19, False: 19]
  ------------------
 3344|     19|		TIFFSwabLong((uint32_t*)value);
 3345|     38|}
tif_dirread.c:TIFFReadDirEntryCheckedDouble:
 3348|     76|{
 3349|     76|	assert(sizeof(double)==8);
 3350|     76|	assert(sizeof(uint64_t) == 8);
 3351|     76|	assert(sizeof(UInt64Aligned_t)==8);
 3352|     76|	if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|     76|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (3352:6): [True: 63, False: 13]
  ------------------
 3353|     63|	{
 3354|     63|		enum TIFFReadDirEntryErr err;
 3355|     63|		uint32_t offset = direntry->tdir_offset.toff_long;
 3356|     63|		if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|     63|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3356:7): [True: 44, False: 19]
  ------------------
 3357|     44|			TIFFSwabLong(&offset);
 3358|     63|		err=TIFFReadDirEntryData(tif,offset,8,value);
 3359|     63|		if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3359:7): [True: 23, False: 40]
  ------------------
 3360|     23|			return(err);
 3361|     63|	}
 3362|     13|	else
 3363|     13|	{
 3364|     13|	       UInt64Aligned_t uint64_union;
 3365|     13|	       uint64_union.l=direntry->tdir_offset.toff_long8;
 3366|     13|	       *value=uint64_union.d;
 3367|     13|	}
 3368|     53|	if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|     53|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3368:6): [True: 34, False: 19]
  ------------------
 3369|     34|		TIFFSwabLong8((uint64_t*)value);
 3370|     53|	return(TIFFReadDirEntryErrOk);
 3371|     76|}
tif_dirread.c:TIFFReadDirEntryDouble:
  973|    126|{
  974|    126|	enum TIFFReadDirEntryErr err;
  975|    126|	if (direntry->tdir_count!=1)
  ------------------
  |  Branch (975:6): [True: 91, False: 35]
  ------------------
  976|     91|		return(TIFFReadDirEntryErrCount);
  977|     35|	switch (direntry->tdir_type)
  978|     35|	{
  979|      3|		case TIFF_BYTE:
  ------------------
  |  Branch (979:3): [True: 3, False: 32]
  ------------------
  980|      3|			{
  981|      3|				uint8_t m;
  982|      3|				TIFFReadDirEntryCheckedByte(tif,direntry,&m);
  983|      3|				*value=(double)m;
  984|      3|				return(TIFFReadDirEntryErrOk);
  985|      0|			}
  986|      1|		case TIFF_SBYTE:
  ------------------
  |  Branch (986:3): [True: 1, False: 34]
  ------------------
  987|      1|			{
  988|      1|				int8_t m;
  989|      1|				TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
  990|      1|				*value=(double)m;
  991|      1|				return(TIFFReadDirEntryErrOk);
  992|      0|			}
  993|      2|		case TIFF_SHORT:
  ------------------
  |  Branch (993:3): [True: 2, False: 33]
  ------------------
  994|      2|			{
  995|      2|				uint16_t m;
  996|      2|				TIFFReadDirEntryCheckedShort(tif,direntry,&m);
  997|      2|				*value=(double)m;
  998|      2|				return(TIFFReadDirEntryErrOk);
  999|      0|			}
 1000|     10|		case TIFF_SSHORT:
  ------------------
  |  Branch (1000:3): [True: 10, False: 25]
  ------------------
 1001|     10|			{
 1002|     10|				int16_t m;
 1003|     10|				TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
 1004|     10|				*value=(double)m;
 1005|     10|				return(TIFFReadDirEntryErrOk);
 1006|      0|			}
 1007|      2|		case TIFF_LONG:
  ------------------
  |  Branch (1007:3): [True: 2, False: 33]
  ------------------
 1008|      2|			{
 1009|      2|				uint32_t m;
 1010|      2|				TIFFReadDirEntryCheckedLong(tif,direntry,&m);
 1011|      2|				*value=(double)m;
 1012|      2|				return(TIFFReadDirEntryErrOk);
 1013|      0|			}
 1014|      2|		case TIFF_SLONG:
  ------------------
  |  Branch (1014:3): [True: 2, False: 33]
  ------------------
 1015|      2|			{
 1016|      2|				int32_t m;
 1017|      2|				TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
 1018|      2|				*value=(double)m;
 1019|      2|				return(TIFFReadDirEntryErrOk);
 1020|      0|			}
 1021|      2|		case TIFF_LONG8:
  ------------------
  |  Branch (1021:3): [True: 2, False: 33]
  ------------------
 1022|      2|			{
 1023|      2|				uint64_t m;
 1024|      2|				err=TIFFReadDirEntryCheckedLong8(tif,direntry,&m);
 1025|      2|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1025:9): [True: 1, False: 1]
  ------------------
 1026|      1|					return(err);
 1027|       |#if defined(__WIN32__) && (_MSC_VER < 1500)
 1028|       |				/*
 1029|       |				 * XXX: MSVC 6.0 does not support conversion
 1030|       |				 * of 64-bit integers into floating point
 1031|       |				 * values.
 1032|       |				 */
 1033|       |				*value = _TIFFUInt64ToDouble(m);
 1034|       |#else
 1035|      1|				*value = (double)m;
 1036|      1|#endif
 1037|      1|				return(TIFFReadDirEntryErrOk);
 1038|      2|			}
 1039|      2|		case TIFF_SLONG8:
  ------------------
  |  Branch (1039:3): [True: 2, False: 33]
  ------------------
 1040|      2|			{
 1041|      2|				int64_t m;
 1042|      2|				err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
 1043|      2|				if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1043:9): [True: 1, False: 1]
  ------------------
 1044|      1|					return(err);
 1045|      1|				*value=(double)m;
 1046|      1|				return(TIFFReadDirEntryErrOk);
 1047|      2|			}
 1048|      3|		case TIFF_RATIONAL:
  ------------------
  |  Branch (1048:3): [True: 3, False: 32]
  ------------------
 1049|      3|			err=TIFFReadDirEntryCheckedRational(tif,direntry,value);
 1050|      3|			return(err);
 1051|      2|		case TIFF_SRATIONAL:
  ------------------
  |  Branch (1051:3): [True: 2, False: 33]
  ------------------
 1052|      2|			err=TIFFReadDirEntryCheckedSrational(tif,direntry,value);
 1053|      2|			return(err);
 1054|      2|		case TIFF_FLOAT:
  ------------------
  |  Branch (1054:3): [True: 2, False: 33]
  ------------------
 1055|      2|			{
 1056|      2|				float m;
 1057|      2|				TIFFReadDirEntryCheckedFloat(tif,direntry,&m);
 1058|      2|				*value=(double)m;
 1059|      2|				return(TIFFReadDirEntryErrOk);
 1060|      2|			}
 1061|      3|		case TIFF_DOUBLE:
  ------------------
  |  Branch (1061:3): [True: 3, False: 32]
  ------------------
 1062|      3|			err=TIFFReadDirEntryCheckedDouble(tif,direntry,value);
 1063|      3|			return(err);
 1064|      1|		default:
  ------------------
  |  Branch (1064:3): [True: 1, False: 34]
  ------------------
 1065|      1|			return(TIFFReadDirEntryErrType);
 1066|     35|	}
 1067|     35|}
tif_dirread.c:TIFFReadDirEntryIfd8:
 1070|    323|{
 1071|    323|	enum TIFFReadDirEntryErr err;
 1072|    323|	if (direntry->tdir_count!=1)
  ------------------
  |  Branch (1072:6): [True: 156, False: 167]
  ------------------
 1073|    156|		return(TIFFReadDirEntryErrCount);
 1074|    167|	switch (direntry->tdir_type)
 1075|    167|	{
 1076|     59|		case TIFF_LONG:
  ------------------
  |  Branch (1076:3): [True: 59, False: 108]
  ------------------
 1077|     60|		case TIFF_IFD:
  ------------------
  |  Branch (1077:3): [True: 1, False: 166]
  ------------------
 1078|     60|			{
 1079|     60|				uint32_t m;
 1080|     60|				TIFFReadDirEntryCheckedLong(tif,direntry,&m);
 1081|     60|				*value=(uint64_t)m;
 1082|     60|				return(TIFFReadDirEntryErrOk);
 1083|     59|			}
 1084|    102|		case TIFF_LONG8:
  ------------------
  |  Branch (1084:3): [True: 102, False: 65]
  ------------------
 1085|    104|		case TIFF_IFD8:
  ------------------
  |  Branch (1085:3): [True: 2, False: 165]
  ------------------
 1086|    104|			err=TIFFReadDirEntryCheckedLong8(tif,direntry,value);
 1087|    104|			return(err);
 1088|      3|		default:
  ------------------
  |  Branch (1088:3): [True: 3, False: 164]
  ------------------
 1089|      3|			return(TIFFReadDirEntryErrType);
 1090|    167|	}
 1091|    167|}
tif_dirread.c:TIFFReadDirEntrySbyteArray:
 1450|    640|{
 1451|    640|	enum TIFFReadDirEntryErr err;
 1452|    640|	uint32_t count;
 1453|    640|	void* origdata;
 1454|    640|	int8_t* data;
 1455|    640|	switch (direntry->tdir_type)
 1456|    640|	{
 1457|      0|		case TIFF_UNDEFINED:
  ------------------
  |  Branch (1457:3): [True: 0, False: 640]
  ------------------
 1458|      0|		case TIFF_BYTE:
  ------------------
  |  Branch (1458:3): [True: 0, False: 640]
  ------------------
 1459|    640|		case TIFF_SBYTE:
  ------------------
  |  Branch (1459:3): [True: 640, False: 0]
  ------------------
 1460|    640|		case TIFF_SHORT:
  ------------------
  |  Branch (1460:3): [True: 0, False: 640]
  ------------------
 1461|    640|		case TIFF_SSHORT:
  ------------------
  |  Branch (1461:3): [True: 0, False: 640]
  ------------------
 1462|    640|		case TIFF_LONG:
  ------------------
  |  Branch (1462:3): [True: 0, False: 640]
  ------------------
 1463|    640|		case TIFF_SLONG:
  ------------------
  |  Branch (1463:3): [True: 0, False: 640]
  ------------------
 1464|    640|		case TIFF_LONG8:
  ------------------
  |  Branch (1464:3): [True: 0, False: 640]
  ------------------
 1465|    640|		case TIFF_SLONG8:
  ------------------
  |  Branch (1465:3): [True: 0, False: 640]
  ------------------
 1466|    640|			break;
 1467|      0|		default:
  ------------------
  |  Branch (1467:3): [True: 0, False: 640]
  ------------------
 1468|      0|			return(TIFFReadDirEntryErrType);
 1469|    640|	}
 1470|    640|	err=TIFFReadDirEntryArray(tif,direntry,&count,1,&origdata);
 1471|    640|	if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (1471:6): [True: 315, False: 325]
  |  Branch (1471:36): [True: 60, False: 265]
  ------------------
 1472|    375|	{
 1473|    375|		*value=0;
 1474|    375|		return(err);
 1475|    375|	}
 1476|    265|	switch (direntry->tdir_type)
  ------------------
  |  Branch (1476:10): [True: 0, False: 265]
  ------------------
 1477|    265|	{
 1478|      0|		case TIFF_UNDEFINED:
  ------------------
  |  Branch (1478:3): [True: 0, False: 265]
  ------------------
 1479|      0|		case TIFF_BYTE:
  ------------------
  |  Branch (1479:3): [True: 0, False: 265]
  ------------------
 1480|      0|			{
 1481|      0|				uint8_t* m;
 1482|      0|				uint32_t n;
 1483|      0|				m=(uint8_t*)origdata;
 1484|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1484:15): [True: 0, False: 0]
  ------------------
 1485|      0|				{
 1486|      0|					err=TIFFReadDirEntryCheckRangeSbyteByte(*m);
 1487|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1487:10): [True: 0, False: 0]
  ------------------
 1488|      0|					{
 1489|      0|						_TIFFfree(origdata);
 1490|      0|						return(err);
 1491|      0|					}
 1492|      0|					m++;
 1493|      0|				}
 1494|      0|				*value=(int8_t*)origdata;
 1495|      0|				return(TIFFReadDirEntryErrOk);
 1496|      0|			}
 1497|    265|		case TIFF_SBYTE:
  ------------------
  |  Branch (1497:3): [True: 265, False: 0]
  ------------------
 1498|    265|			*value=(int8_t*)origdata;
 1499|    265|			return(TIFFReadDirEntryErrOk);
 1500|    265|	}
 1501|      0|	data=(int8_t*)_TIFFmalloc(count);
 1502|      0|	if (data==0)
  ------------------
  |  Branch (1502:6): [True: 0, False: 0]
  ------------------
 1503|      0|	{
 1504|      0|		_TIFFfree(origdata);
 1505|      0|		return(TIFFReadDirEntryErrAlloc);
 1506|      0|	}
 1507|      0|	switch (direntry->tdir_type)
  ------------------
  |  Branch (1507:10): [True: 0, False: 0]
  ------------------
 1508|      0|	{
 1509|      0|		case TIFF_SHORT:
  ------------------
  |  Branch (1509:3): [True: 0, False: 0]
  ------------------
 1510|      0|			{
 1511|      0|				uint16_t* ma;
 1512|      0|				int8_t* mb;
 1513|      0|				uint32_t n;
 1514|      0|				ma=(uint16_t*)origdata;
 1515|      0|				mb=data;
 1516|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1516:15): [True: 0, False: 0]
  ------------------
 1517|      0|				{
 1518|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1518:10): [True: 0, False: 0]
  ------------------
 1519|      0|						TIFFSwabShort(ma);
 1520|      0|					err=TIFFReadDirEntryCheckRangeSbyteShort(*ma);
 1521|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1521:10): [True: 0, False: 0]
  ------------------
 1522|      0|						break;
 1523|      0|					*mb++=(int8_t)(*ma++);
 1524|      0|				}
 1525|      0|			}
 1526|      0|			break;
 1527|      0|		case TIFF_SSHORT:
  ------------------
  |  Branch (1527:3): [True: 0, False: 0]
  ------------------
 1528|      0|			{
 1529|      0|				int16_t* ma;
 1530|      0|				int8_t* mb;
 1531|      0|				uint32_t n;
 1532|      0|				ma=(int16_t*)origdata;
 1533|      0|				mb=data;
 1534|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1534:15): [True: 0, False: 0]
  ------------------
 1535|      0|				{
 1536|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1536:10): [True: 0, False: 0]
  ------------------
 1537|      0|						TIFFSwabShort((uint16_t*)ma);
 1538|      0|					err=TIFFReadDirEntryCheckRangeSbyteSshort(*ma);
 1539|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1539:10): [True: 0, False: 0]
  ------------------
 1540|      0|						break;
 1541|      0|					*mb++=(int8_t)(*ma++);
 1542|      0|				}
 1543|      0|			}
 1544|      0|			break;
 1545|      0|		case TIFF_LONG:
  ------------------
  |  Branch (1545:3): [True: 0, False: 0]
  ------------------
 1546|      0|			{
 1547|      0|				uint32_t* ma;
 1548|      0|				int8_t* mb;
 1549|      0|				uint32_t n;
 1550|      0|				ma=(uint32_t*)origdata;
 1551|      0|				mb=data;
 1552|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1552:15): [True: 0, False: 0]
  ------------------
 1553|      0|				{
 1554|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1554:10): [True: 0, False: 0]
  ------------------
 1555|      0|						TIFFSwabLong(ma);
 1556|      0|					err=TIFFReadDirEntryCheckRangeSbyteLong(*ma);
 1557|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1557:10): [True: 0, False: 0]
  ------------------
 1558|      0|						break;
 1559|      0|					*mb++=(int8_t)(*ma++);
 1560|      0|				}
 1561|      0|			}
 1562|      0|			break;
 1563|      0|		case TIFF_SLONG:
  ------------------
  |  Branch (1563:3): [True: 0, False: 0]
  ------------------
 1564|      0|			{
 1565|      0|				int32_t* ma;
 1566|      0|				int8_t* mb;
 1567|      0|				uint32_t n;
 1568|      0|				ma=(int32_t*)origdata;
 1569|      0|				mb=data;
 1570|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1570:15): [True: 0, False: 0]
  ------------------
 1571|      0|				{
 1572|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1572:10): [True: 0, False: 0]
  ------------------
 1573|      0|						TIFFSwabLong((uint32_t*)ma);
 1574|      0|					err=TIFFReadDirEntryCheckRangeSbyteSlong(*ma);
 1575|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1575:10): [True: 0, False: 0]
  ------------------
 1576|      0|						break;
 1577|      0|					*mb++=(int8_t)(*ma++);
 1578|      0|				}
 1579|      0|			}
 1580|      0|			break;
 1581|      0|		case TIFF_LONG8:
  ------------------
  |  Branch (1581:3): [True: 0, False: 0]
  ------------------
 1582|      0|			{
 1583|      0|				uint64_t* ma;
 1584|      0|				int8_t* mb;
 1585|      0|				uint32_t n;
 1586|      0|				ma=(uint64_t*)origdata;
 1587|      0|				mb=data;
 1588|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1588:15): [True: 0, False: 0]
  ------------------
 1589|      0|				{
 1590|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1590:10): [True: 0, False: 0]
  ------------------
 1591|      0|						TIFFSwabLong8(ma);
 1592|      0|					err=TIFFReadDirEntryCheckRangeSbyteLong8(*ma);
 1593|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1593:10): [True: 0, False: 0]
  ------------------
 1594|      0|						break;
 1595|      0|					*mb++=(int8_t)(*ma++);
 1596|      0|				}
 1597|      0|			}
 1598|      0|			break;
 1599|      0|		case TIFF_SLONG8:
  ------------------
  |  Branch (1599:3): [True: 0, False: 0]
  ------------------
 1600|      0|			{
 1601|      0|				int64_t* ma;
 1602|      0|				int8_t* mb;
 1603|      0|				uint32_t n;
 1604|      0|				ma=(int64_t*)origdata;
 1605|      0|				mb=data;
 1606|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1606:15): [True: 0, False: 0]
  ------------------
 1607|      0|				{
 1608|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1608:10): [True: 0, False: 0]
  ------------------
 1609|      0|						TIFFSwabLong8((uint64_t*)ma);
 1610|      0|					err=TIFFReadDirEntryCheckRangeSbyteSlong8(*ma);
 1611|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1611:10): [True: 0, False: 0]
  ------------------
 1612|      0|						break;
 1613|      0|					*mb++=(int8_t)(*ma++);
 1614|      0|				}
 1615|      0|			}
 1616|      0|			break;
 1617|      0|	}
 1618|      0|	_TIFFfree(origdata);
 1619|      0|	if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1619:6): [True: 0, False: 0]
  ------------------
 1620|      0|	{
 1621|      0|		_TIFFfree(data);
 1622|      0|		return(err);
 1623|      0|	}
 1624|      0|	*value=data;
 1625|      0|	return(TIFFReadDirEntryErrOk);
 1626|      0|}
tif_dirread.c:TIFFReadDirEntrySshortArray:
 1801|    740|{
 1802|    740|	enum TIFFReadDirEntryErr err;
 1803|    740|	uint32_t count;
 1804|    740|	void* origdata;
 1805|    740|	int16_t* data;
 1806|    740|	switch (direntry->tdir_type)
 1807|    740|	{
 1808|      0|		case TIFF_BYTE:
  ------------------
  |  Branch (1808:3): [True: 0, False: 740]
  ------------------
 1809|      0|		case TIFF_SBYTE:
  ------------------
  |  Branch (1809:3): [True: 0, False: 740]
  ------------------
 1810|      0|		case TIFF_SHORT:
  ------------------
  |  Branch (1810:3): [True: 0, False: 740]
  ------------------
 1811|    740|		case TIFF_SSHORT:
  ------------------
  |  Branch (1811:3): [True: 740, False: 0]
  ------------------
 1812|    740|		case TIFF_LONG:
  ------------------
  |  Branch (1812:3): [True: 0, False: 740]
  ------------------
 1813|    740|		case TIFF_SLONG:
  ------------------
  |  Branch (1813:3): [True: 0, False: 740]
  ------------------
 1814|    740|		case TIFF_LONG8:
  ------------------
  |  Branch (1814:3): [True: 0, False: 740]
  ------------------
 1815|    740|		case TIFF_SLONG8:
  ------------------
  |  Branch (1815:3): [True: 0, False: 740]
  ------------------
 1816|    740|			break;
 1817|      0|		default:
  ------------------
  |  Branch (1817:3): [True: 0, False: 740]
  ------------------
 1818|      0|			return(TIFFReadDirEntryErrType);
 1819|    740|	}
 1820|    740|	err=TIFFReadDirEntryArray(tif,direntry,&count,2,&origdata);
 1821|    740|	if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (1821:6): [True: 461, False: 279]
  |  Branch (1821:36): [True: 60, False: 219]
  ------------------
 1822|    521|	{
 1823|    521|		*value=0;
 1824|    521|		return(err);
 1825|    521|	}
 1826|    219|	switch (direntry->tdir_type)
  ------------------
  |  Branch (1826:10): [True: 0, False: 219]
  ------------------
 1827|    219|	{
 1828|      0|		case TIFF_SHORT:
  ------------------
  |  Branch (1828:3): [True: 0, False: 219]
  ------------------
 1829|      0|			{
 1830|      0|				uint16_t* m;
 1831|      0|				uint32_t n;
 1832|      0|				m=(uint16_t*)origdata;
 1833|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1833:15): [True: 0, False: 0]
  ------------------
 1834|      0|				{
 1835|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1835:10): [True: 0, False: 0]
  ------------------
 1836|      0|						TIFFSwabShort(m);
 1837|      0|					err=TIFFReadDirEntryCheckRangeSshortShort(*m);
 1838|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1838:10): [True: 0, False: 0]
  ------------------
 1839|      0|					{
 1840|      0|						_TIFFfree(origdata);
 1841|      0|						return(err);
 1842|      0|					}
 1843|      0|					m++;
 1844|      0|				}
 1845|      0|				*value=(int16_t*)origdata;
 1846|      0|				return(TIFFReadDirEntryErrOk);
 1847|      0|			}
 1848|    219|		case TIFF_SSHORT:
  ------------------
  |  Branch (1848:3): [True: 219, False: 0]
  ------------------
 1849|    219|			*value=(int16_t*)origdata;
 1850|    219|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    219|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1850:8): [True: 81, False: 138]
  ------------------
 1851|     81|				TIFFSwabArrayOfShort((uint16_t*)(*value), count);
 1852|    219|			return(TIFFReadDirEntryErrOk);
 1853|    219|	}
 1854|      0|	data=(int16_t*)_TIFFmalloc(count * 2);
 1855|      0|	if (data==0)
  ------------------
  |  Branch (1855:6): [True: 0, False: 0]
  ------------------
 1856|      0|	{
 1857|      0|		_TIFFfree(origdata);
 1858|      0|		return(TIFFReadDirEntryErrAlloc);
 1859|      0|	}
 1860|      0|	switch (direntry->tdir_type)
  ------------------
  |  Branch (1860:10): [True: 0, False: 0]
  ------------------
 1861|      0|	{
 1862|      0|		case TIFF_BYTE:
  ------------------
  |  Branch (1862:3): [True: 0, False: 0]
  ------------------
 1863|      0|			{
 1864|      0|				uint8_t* ma;
 1865|      0|				int16_t* mb;
 1866|      0|				uint32_t n;
 1867|      0|				ma=(uint8_t*)origdata;
 1868|      0|				mb=data;
 1869|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1869:15): [True: 0, False: 0]
  ------------------
 1870|      0|					*mb++=(int16_t)(*ma++);
 1871|      0|			}
 1872|      0|			break;
 1873|      0|		case TIFF_SBYTE:
  ------------------
  |  Branch (1873:3): [True: 0, False: 0]
  ------------------
 1874|      0|			{
 1875|      0|				int8_t* ma;
 1876|      0|				int16_t* mb;
 1877|      0|				uint32_t n;
 1878|      0|				ma=(int8_t*)origdata;
 1879|      0|				mb=data;
 1880|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1880:15): [True: 0, False: 0]
  ------------------
 1881|      0|					*mb++=(int16_t)(*ma++);
 1882|      0|			}
 1883|      0|			break;
 1884|      0|		case TIFF_LONG:
  ------------------
  |  Branch (1884:3): [True: 0, False: 0]
  ------------------
 1885|      0|			{
 1886|      0|				uint32_t* ma;
 1887|      0|				int16_t* mb;
 1888|      0|				uint32_t n;
 1889|      0|				ma=(uint32_t*)origdata;
 1890|      0|				mb=data;
 1891|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1891:15): [True: 0, False: 0]
  ------------------
 1892|      0|				{
 1893|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1893:10): [True: 0, False: 0]
  ------------------
 1894|      0|						TIFFSwabLong(ma);
 1895|      0|					err=TIFFReadDirEntryCheckRangeSshortLong(*ma);
 1896|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1896:10): [True: 0, False: 0]
  ------------------
 1897|      0|						break;
 1898|      0|					*mb++=(int16_t)(*ma++);
 1899|      0|				}
 1900|      0|			}
 1901|      0|			break;
 1902|      0|		case TIFF_SLONG:
  ------------------
  |  Branch (1902:3): [True: 0, False: 0]
  ------------------
 1903|      0|			{
 1904|      0|				int32_t* ma;
 1905|      0|				int16_t* mb;
 1906|      0|				uint32_t n;
 1907|      0|				ma=(int32_t*)origdata;
 1908|      0|				mb=data;
 1909|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1909:15): [True: 0, False: 0]
  ------------------
 1910|      0|				{
 1911|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1911:10): [True: 0, False: 0]
  ------------------
 1912|      0|						TIFFSwabLong((uint32_t*)ma);
 1913|      0|					err=TIFFReadDirEntryCheckRangeSshortSlong(*ma);
 1914|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1914:10): [True: 0, False: 0]
  ------------------
 1915|      0|						break;
 1916|      0|					*mb++=(int16_t)(*ma++);
 1917|      0|				}
 1918|      0|			}
 1919|      0|			break;
 1920|      0|		case TIFF_LONG8:
  ------------------
  |  Branch (1920:3): [True: 0, False: 0]
  ------------------
 1921|      0|			{
 1922|      0|				uint64_t* ma;
 1923|      0|				int16_t* mb;
 1924|      0|				uint32_t n;
 1925|      0|				ma=(uint64_t*)origdata;
 1926|      0|				mb=data;
 1927|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1927:15): [True: 0, False: 0]
  ------------------
 1928|      0|				{
 1929|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1929:10): [True: 0, False: 0]
  ------------------
 1930|      0|						TIFFSwabLong8(ma);
 1931|      0|					err=TIFFReadDirEntryCheckRangeSshortLong8(*ma);
 1932|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1932:10): [True: 0, False: 0]
  ------------------
 1933|      0|						break;
 1934|      0|					*mb++=(int16_t)(*ma++);
 1935|      0|				}
 1936|      0|			}
 1937|      0|			break;
 1938|      0|		case TIFF_SLONG8:
  ------------------
  |  Branch (1938:3): [True: 0, False: 0]
  ------------------
 1939|      0|			{
 1940|      0|				int64_t* ma;
 1941|      0|				int16_t* mb;
 1942|      0|				uint32_t n;
 1943|      0|				ma=(int64_t*)origdata;
 1944|      0|				mb=data;
 1945|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (1945:15): [True: 0, False: 0]
  ------------------
 1946|      0|				{
 1947|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1947:10): [True: 0, False: 0]
  ------------------
 1948|      0|						TIFFSwabLong8((uint64_t*)ma);
 1949|      0|					err=TIFFReadDirEntryCheckRangeSshortSlong8(*ma);
 1950|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1950:10): [True: 0, False: 0]
  ------------------
 1951|      0|						break;
 1952|      0|					*mb++=(int16_t)(*ma++);
 1953|      0|				}
 1954|      0|			}
 1955|      0|			break;
 1956|      0|	}
 1957|      0|	_TIFFfree(origdata);
 1958|      0|	if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1958:6): [True: 0, False: 0]
  ------------------
 1959|      0|	{
 1960|      0|		_TIFFfree(data);
 1961|      0|		return(err);
 1962|      0|	}
 1963|      0|	*value=data;
 1964|      0|	return(TIFFReadDirEntryErrOk);
 1965|      0|}
tif_dirread.c:TIFFReadDirEntryLongArray:
 1968|  2.16k|{
 1969|  2.16k|	enum TIFFReadDirEntryErr err;
 1970|  2.16k|	uint32_t count;
 1971|  2.16k|	void* origdata;
 1972|  2.16k|	uint32_t* data;
 1973|  2.16k|	switch (direntry->tdir_type)
 1974|  2.16k|	{
 1975|     39|		case TIFF_BYTE:
  ------------------
  |  Branch (1975:3): [True: 39, False: 2.12k]
  ------------------
 1976|     71|		case TIFF_SBYTE:
  ------------------
  |  Branch (1976:3): [True: 32, False: 2.12k]
  ------------------
 1977|     89|		case TIFF_SHORT:
  ------------------
  |  Branch (1977:3): [True: 18, False: 2.14k]
  ------------------
 1978|    123|		case TIFF_SSHORT:
  ------------------
  |  Branch (1978:3): [True: 34, False: 2.12k]
  ------------------
 1979|  1.76k|		case TIFF_LONG:
  ------------------
  |  Branch (1979:3): [True: 1.63k, False: 524]
  ------------------
 1980|  1.82k|		case TIFF_SLONG:
  ------------------
  |  Branch (1980:3): [True: 69, False: 2.09k]
  ------------------
 1981|  1.93k|		case TIFF_LONG8:
  ------------------
  |  Branch (1981:3): [True: 104, False: 2.05k]
  ------------------
 1982|  2.14k|		case TIFF_SLONG8:
  ------------------
  |  Branch (1982:3): [True: 214, False: 1.94k]
  ------------------
 1983|  2.14k|			break;
 1984|     14|		default:
  ------------------
  |  Branch (1984:3): [True: 14, False: 2.14k]
  ------------------
 1985|     14|			return(TIFFReadDirEntryErrType);
 1986|  2.16k|	}
 1987|  2.14k|	err=TIFFReadDirEntryArray(tif,direntry,&count,4,&origdata);
 1988|  2.14k|	if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (1988:6): [True: 995, False: 1.15k]
  |  Branch (1988:36): [True: 101, False: 1.05k]
  ------------------
 1989|  1.09k|	{
 1990|  1.09k|		*value=0;
 1991|  1.09k|		return(err);
 1992|  1.09k|	}
 1993|  1.05k|	switch (direntry->tdir_type)
  ------------------
  |  Branch (1993:10): [True: 384, False: 667]
  ------------------
 1994|  1.05k|	{
 1995|    610|		case TIFF_LONG:
  ------------------
  |  Branch (1995:3): [True: 610, False: 441]
  ------------------
 1996|    610|			*value=(uint32_t*)origdata;
 1997|    610|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    610|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (1997:8): [True: 144, False: 466]
  ------------------
 1998|    144|				TIFFSwabArrayOfLong(*value,count);
 1999|    610|			return(TIFFReadDirEntryErrOk);
 2000|     57|		case TIFF_SLONG:
  ------------------
  |  Branch (2000:3): [True: 57, False: 994]
  ------------------
 2001|     57|			{
 2002|     57|				int32_t* m;
 2003|     57|				uint32_t n;
 2004|     57|				m=(int32_t*)origdata;
 2005|    955|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2005:15): [True: 939, False: 16]
  ------------------
 2006|    939|				{
 2007|    939|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    939|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2007:10): [True: 307, False: 632]
  ------------------
 2008|    307|						TIFFSwabLong((uint32_t*)m);
 2009|    939|					err=TIFFReadDirEntryCheckRangeLongSlong(*m);
 2010|    939|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2010:10): [True: 41, False: 898]
  ------------------
 2011|     41|					{
 2012|     41|						_TIFFfree(origdata);
 2013|     41|						return(err);
 2014|     41|					}
 2015|    898|					m++;
 2016|    898|				}
 2017|     16|				*value=(uint32_t*)origdata;
 2018|     16|				return(TIFFReadDirEntryErrOk);
 2019|     57|			}
 2020|  1.05k|	}
 2021|    384|	data=(uint32_t*)_TIFFmalloc(count * 4);
 2022|    384|	if (data==0)
  ------------------
  |  Branch (2022:6): [True: 0, False: 384]
  ------------------
 2023|      0|	{
 2024|      0|		_TIFFfree(origdata);
 2025|      0|		return(TIFFReadDirEntryErrAlloc);
 2026|      0|	}
 2027|    384|	switch (direntry->tdir_type)
  ------------------
  |  Branch (2027:10): [True: 0, False: 384]
  ------------------
 2028|    384|	{
 2029|     27|		case TIFF_BYTE:
  ------------------
  |  Branch (2029:3): [True: 27, False: 357]
  ------------------
 2030|     27|			{
 2031|     27|				uint8_t* ma;
 2032|     27|				uint32_t* mb;
 2033|     27|				uint32_t n;
 2034|     27|				ma=(uint8_t*)origdata;
 2035|     27|				mb=data;
 2036|    629|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2036:15): [True: 602, False: 27]
  ------------------
 2037|    602|					*mb++=(uint32_t)(*ma++);
 2038|     27|			}
 2039|     27|			break;
 2040|     30|		case TIFF_SBYTE:
  ------------------
  |  Branch (2040:3): [True: 30, False: 354]
  ------------------
 2041|     30|			{
 2042|     30|				int8_t* ma;
 2043|     30|				uint32_t* mb;
 2044|     30|				uint32_t n;
 2045|     30|				ma=(int8_t*)origdata;
 2046|     30|				mb=data;
 2047|    351|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2047:15): [True: 339, False: 12]
  ------------------
 2048|    339|				{
 2049|    339|					err=TIFFReadDirEntryCheckRangeLongSbyte(*ma);
 2050|    339|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2050:10): [True: 18, False: 321]
  ------------------
 2051|     18|						break;
 2052|    321|					*mb++=(uint32_t)(*ma++);
 2053|    321|				}
 2054|     30|			}
 2055|     30|			break;
 2056|     16|		case TIFF_SHORT:
  ------------------
  |  Branch (2056:3): [True: 16, False: 368]
  ------------------
 2057|     16|			{
 2058|     16|				uint16_t* ma;
 2059|     16|				uint32_t* mb;
 2060|     16|				uint32_t n;
 2061|     16|				ma=(uint16_t*)origdata;
 2062|     16|				mb=data;
 2063|    436|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2063:15): [True: 420, False: 16]
  ------------------
 2064|    420|				{
 2065|    420|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    420|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2065:10): [True: 208, False: 212]
  ------------------
 2066|    208|						TIFFSwabShort(ma);
 2067|    420|					*mb++=(uint32_t)(*ma++);
 2068|    420|				}
 2069|     16|			}
 2070|     16|			break;
 2071|     31|		case TIFF_SSHORT:
  ------------------
  |  Branch (2071:3): [True: 31, False: 353]
  ------------------
 2072|     31|			{
 2073|     31|				int16_t* ma;
 2074|     31|				uint32_t* mb;
 2075|     31|				uint32_t n;
 2076|     31|				ma=(int16_t*)origdata;
 2077|     31|				mb=data;
 2078|  73.7k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2078:15): [True: 73.7k, False: 15]
  ------------------
 2079|  73.7k|				{
 2080|  73.7k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  73.7k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2080:10): [True: 205, False: 73.5k]
  ------------------
 2081|    205|						TIFFSwabShort((uint16_t*)ma);
 2082|  73.7k|					err=TIFFReadDirEntryCheckRangeLongSshort(*ma);
 2083|  73.7k|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2083:10): [True: 16, False: 73.7k]
  ------------------
 2084|     16|						break;
 2085|  73.7k|					*mb++=(uint32_t)(*ma++);
 2086|  73.7k|				}
 2087|     31|			}
 2088|     31|			break;
 2089|     87|		case TIFF_LONG8:
  ------------------
  |  Branch (2089:3): [True: 87, False: 297]
  ------------------
 2090|     87|			{
 2091|     87|				uint64_t* ma;
 2092|     87|				uint32_t* mb;
 2093|     87|				uint32_t n;
 2094|     87|				ma=(uint64_t*)origdata;
 2095|     87|				mb=data;
 2096|    605|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2096:15): [True: 583, False: 22]
  ------------------
 2097|    583|				{
 2098|    583|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    583|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2098:10): [True: 268, False: 315]
  ------------------
 2099|    268|						TIFFSwabLong8(ma);
 2100|    583|					err=TIFFReadDirEntryCheckRangeLongLong8(*ma);
 2101|    583|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2101:10): [True: 65, False: 518]
  ------------------
 2102|     65|						break;
 2103|    518|					*mb++=(uint32_t)(*ma++);
 2104|    518|				}
 2105|     87|			}
 2106|     87|			break;
 2107|    193|		case TIFF_SLONG8:
  ------------------
  |  Branch (2107:3): [True: 193, False: 191]
  ------------------
 2108|    193|			{
 2109|    193|				int64_t* ma;
 2110|    193|				uint32_t* mb;
 2111|    193|				uint32_t n;
 2112|    193|				ma=(int64_t*)origdata;
 2113|    193|				mb=data;
 2114|    727|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2114:15): [True: 693, False: 34]
  ------------------
 2115|    693|				{
 2116|    693|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    693|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2116:10): [True: 231, False: 462]
  ------------------
 2117|    231|						TIFFSwabLong8((uint64_t*)ma);
 2118|    693|					err=TIFFReadDirEntryCheckRangeLongSlong8(*ma);
 2119|    693|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2119:10): [True: 159, False: 534]
  ------------------
 2120|    159|						break;
 2121|    534|					*mb++=(uint32_t)(*ma++);
 2122|    534|				}
 2123|    193|			}
 2124|    193|			break;
 2125|    384|	}
 2126|    384|	_TIFFfree(origdata);
 2127|    384|	if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2127:6): [True: 258, False: 126]
  ------------------
 2128|    258|	{
 2129|    258|		_TIFFfree(data);
 2130|    258|		return(err);
 2131|    258|	}
 2132|    126|	*value=data;
 2133|    126|	return(TIFFReadDirEntryErrOk);
 2134|    384|}
tif_dirread.c:TIFFReadDirEntrySlongArray:
 2137|    636|{
 2138|    636|	enum TIFFReadDirEntryErr err;
 2139|    636|	uint32_t count;
 2140|    636|	void* origdata;
 2141|    636|	int32_t* data;
 2142|    636|	switch (direntry->tdir_type)
 2143|    636|	{
 2144|      0|		case TIFF_BYTE:
  ------------------
  |  Branch (2144:3): [True: 0, False: 636]
  ------------------
 2145|      0|		case TIFF_SBYTE:
  ------------------
  |  Branch (2145:3): [True: 0, False: 636]
  ------------------
 2146|      0|		case TIFF_SHORT:
  ------------------
  |  Branch (2146:3): [True: 0, False: 636]
  ------------------
 2147|      0|		case TIFF_SSHORT:
  ------------------
  |  Branch (2147:3): [True: 0, False: 636]
  ------------------
 2148|      0|		case TIFF_LONG:
  ------------------
  |  Branch (2148:3): [True: 0, False: 636]
  ------------------
 2149|    636|		case TIFF_SLONG:
  ------------------
  |  Branch (2149:3): [True: 636, False: 0]
  ------------------
 2150|    636|		case TIFF_LONG8:
  ------------------
  |  Branch (2150:3): [True: 0, False: 636]
  ------------------
 2151|    636|		case TIFF_SLONG8:
  ------------------
  |  Branch (2151:3): [True: 0, False: 636]
  ------------------
 2152|    636|			break;
 2153|      0|		default:
  ------------------
  |  Branch (2153:3): [True: 0, False: 636]
  ------------------
 2154|      0|			return(TIFFReadDirEntryErrType);
 2155|    636|	}
 2156|    636|	err=TIFFReadDirEntryArray(tif,direntry,&count,4,&origdata);
 2157|    636|	if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (2157:6): [True: 472, False: 164]
  |  Branch (2157:36): [True: 59, False: 105]
  ------------------
 2158|    531|	{
 2159|    531|		*value=0;
 2160|    531|		return(err);
 2161|    531|	}
 2162|    105|	switch (direntry->tdir_type)
  ------------------
  |  Branch (2162:10): [True: 0, False: 105]
  ------------------
 2163|    105|	{
 2164|      0|		case TIFF_LONG:
  ------------------
  |  Branch (2164:3): [True: 0, False: 105]
  ------------------
 2165|      0|			{
 2166|      0|				uint32_t* m;
 2167|      0|				uint32_t n;
 2168|      0|				m=(uint32_t*)origdata;
 2169|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2169:15): [True: 0, False: 0]
  ------------------
 2170|      0|				{
 2171|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2171:10): [True: 0, False: 0]
  ------------------
 2172|      0|						TIFFSwabLong((uint32_t*)m);
 2173|      0|					err=TIFFReadDirEntryCheckRangeSlongLong(*m);
 2174|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2174:10): [True: 0, False: 0]
  ------------------
 2175|      0|					{
 2176|      0|						_TIFFfree(origdata);
 2177|      0|						return(err);
 2178|      0|					}
 2179|      0|					m++;
 2180|      0|				}
 2181|      0|				*value=(int32_t*)origdata;
 2182|      0|				return(TIFFReadDirEntryErrOk);
 2183|      0|			}
 2184|    105|		case TIFF_SLONG:
  ------------------
  |  Branch (2184:3): [True: 105, False: 0]
  ------------------
 2185|    105|			*value=(int32_t*)origdata;
 2186|    105|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    105|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2186:8): [True: 19, False: 86]
  ------------------
 2187|     19|				TIFFSwabArrayOfLong((uint32_t*)(*value), count);
 2188|    105|			return(TIFFReadDirEntryErrOk);
 2189|    105|	}
 2190|      0|	data=(int32_t*)_TIFFmalloc(count * 4);
 2191|      0|	if (data==0)
  ------------------
  |  Branch (2191:6): [True: 0, False: 0]
  ------------------
 2192|      0|	{
 2193|      0|		_TIFFfree(origdata);
 2194|      0|		return(TIFFReadDirEntryErrAlloc);
 2195|      0|	}
 2196|      0|	switch (direntry->tdir_type)
  ------------------
  |  Branch (2196:10): [True: 0, False: 0]
  ------------------
 2197|      0|	{
 2198|      0|		case TIFF_BYTE:
  ------------------
  |  Branch (2198:3): [True: 0, False: 0]
  ------------------
 2199|      0|			{
 2200|      0|				uint8_t* ma;
 2201|      0|				int32_t* mb;
 2202|      0|				uint32_t n;
 2203|      0|				ma=(uint8_t*)origdata;
 2204|      0|				mb=data;
 2205|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2205:15): [True: 0, False: 0]
  ------------------
 2206|      0|					*mb++=(int32_t)(*ma++);
 2207|      0|			}
 2208|      0|			break;
 2209|      0|		case TIFF_SBYTE:
  ------------------
  |  Branch (2209:3): [True: 0, False: 0]
  ------------------
 2210|      0|			{
 2211|      0|				int8_t* ma;
 2212|      0|				int32_t* mb;
 2213|      0|				uint32_t n;
 2214|      0|				ma=(int8_t*)origdata;
 2215|      0|				mb=data;
 2216|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2216:15): [True: 0, False: 0]
  ------------------
 2217|      0|					*mb++=(int32_t)(*ma++);
 2218|      0|			}
 2219|      0|			break;
 2220|      0|		case TIFF_SHORT:
  ------------------
  |  Branch (2220:3): [True: 0, False: 0]
  ------------------
 2221|      0|			{
 2222|      0|				uint16_t* ma;
 2223|      0|				int32_t* mb;
 2224|      0|				uint32_t n;
 2225|      0|				ma=(uint16_t*)origdata;
 2226|      0|				mb=data;
 2227|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2227:15): [True: 0, False: 0]
  ------------------
 2228|      0|				{
 2229|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2229:10): [True: 0, False: 0]
  ------------------
 2230|      0|						TIFFSwabShort(ma);
 2231|      0|					*mb++=(int32_t)(*ma++);
 2232|      0|				}
 2233|      0|			}
 2234|      0|			break;
 2235|      0|		case TIFF_SSHORT:
  ------------------
  |  Branch (2235:3): [True: 0, False: 0]
  ------------------
 2236|      0|			{
 2237|      0|				int16_t* ma;
 2238|      0|				int32_t* mb;
 2239|      0|				uint32_t n;
 2240|      0|				ma=(int16_t*)origdata;
 2241|      0|				mb=data;
 2242|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2242:15): [True: 0, False: 0]
  ------------------
 2243|      0|				{
 2244|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2244:10): [True: 0, False: 0]
  ------------------
 2245|      0|						TIFFSwabShort((uint16_t*)ma);
 2246|      0|					*mb++=(int32_t)(*ma++);
 2247|      0|				}
 2248|      0|			}
 2249|      0|			break;
 2250|      0|		case TIFF_LONG8:
  ------------------
  |  Branch (2250:3): [True: 0, False: 0]
  ------------------
 2251|      0|			{
 2252|      0|				uint64_t* ma;
 2253|      0|				int32_t* mb;
 2254|      0|				uint32_t n;
 2255|      0|				ma=(uint64_t*)origdata;
 2256|      0|				mb=data;
 2257|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2257:15): [True: 0, False: 0]
  ------------------
 2258|      0|				{
 2259|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2259:10): [True: 0, False: 0]
  ------------------
 2260|      0|						TIFFSwabLong8(ma);
 2261|      0|					err=TIFFReadDirEntryCheckRangeSlongLong8(*ma);
 2262|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2262:10): [True: 0, False: 0]
  ------------------
 2263|      0|						break;
 2264|      0|					*mb++=(int32_t)(*ma++);
 2265|      0|				}
 2266|      0|			}
 2267|      0|			break;
 2268|      0|		case TIFF_SLONG8:
  ------------------
  |  Branch (2268:3): [True: 0, False: 0]
  ------------------
 2269|      0|			{
 2270|      0|				int64_t* ma;
 2271|      0|				int32_t* mb;
 2272|      0|				uint32_t n;
 2273|      0|				ma=(int64_t*)origdata;
 2274|      0|				mb=data;
 2275|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2275:15): [True: 0, False: 0]
  ------------------
 2276|      0|				{
 2277|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2277:10): [True: 0, False: 0]
  ------------------
 2278|      0|						TIFFSwabLong8((uint64_t*)ma);
 2279|      0|					err=TIFFReadDirEntryCheckRangeSlongSlong8(*ma);
 2280|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2280:10): [True: 0, False: 0]
  ------------------
 2281|      0|						break;
 2282|      0|					*mb++=(int32_t)(*ma++);
 2283|      0|				}
 2284|      0|			}
 2285|      0|			break;
 2286|      0|	}
 2287|      0|	_TIFFfree(origdata);
 2288|      0|	if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2288:6): [True: 0, False: 0]
  ------------------
 2289|      0|	{
 2290|      0|		_TIFFfree(data);
 2291|      0|		return(err);
 2292|      0|	}
 2293|      0|	*value=data;
 2294|      0|	return(TIFFReadDirEntryErrOk);
 2295|      0|}
tif_dirread.c:TIFFReadDirEntryLong8Array:
 2465|  4.38k|{
 2466|  4.38k|    return TIFFReadDirEntryLong8ArrayWithLimit(tif, direntry, value, ~((uint64_t)0));
 2467|  4.38k|}
tif_dirread.c:TIFFReadDirEntryLong8ArrayWithLimit:
 2299|  30.3k|{
 2300|  30.3k|	enum TIFFReadDirEntryErr err;
 2301|  30.3k|	uint32_t count;
 2302|  30.3k|	void* origdata;
 2303|  30.3k|	uint64_t* data;
 2304|  30.3k|	switch (direntry->tdir_type)
 2305|  30.3k|	{
 2306|  15.9k|		case TIFF_BYTE:
  ------------------
  |  Branch (2306:3): [True: 15.9k, False: 14.4k]
  ------------------
 2307|  17.8k|		case TIFF_SBYTE:
  ------------------
  |  Branch (2307:3): [True: 1.94k, False: 28.4k]
  ------------------
 2308|  21.1k|		case TIFF_SHORT:
  ------------------
  |  Branch (2308:3): [True: 3.26k, False: 27.0k]
  ------------------
 2309|  21.6k|		case TIFF_SSHORT:
  ------------------
  |  Branch (2309:3): [True: 543, False: 29.8k]
  ------------------
 2310|  25.5k|		case TIFF_LONG:
  ------------------
  |  Branch (2310:3): [True: 3.85k, False: 26.4k]
  ------------------
 2311|  25.6k|		case TIFF_SLONG:
  ------------------
  |  Branch (2311:3): [True: 121, False: 30.2k]
  ------------------
 2312|  29.8k|		case TIFF_LONG8:
  ------------------
  |  Branch (2312:3): [True: 4.19k, False: 26.1k]
  ------------------
 2313|  30.1k|		case TIFF_SLONG8:
  ------------------
  |  Branch (2313:3): [True: 288, False: 30.0k]
  ------------------
 2314|  30.1k|			break;
 2315|    230|		default:
  ------------------
  |  Branch (2315:3): [True: 230, False: 30.1k]
  ------------------
 2316|    230|			return(TIFFReadDirEntryErrType);
 2317|  30.3k|	}
 2318|  30.1k|	err=TIFFReadDirEntryArrayWithLimit(tif,direntry,&count,8,&origdata,maxcount);
 2319|  30.1k|	if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (2319:6): [True: 732, False: 29.3k]
  |  Branch (2319:36): [True: 1.60k, False: 27.7k]
  ------------------
 2320|  2.33k|	{
 2321|  2.33k|		*value=0;
 2322|  2.33k|		return(err);
 2323|  2.33k|	}
 2324|  27.7k|	switch (direntry->tdir_type)
  ------------------
  |  Branch (2324:10): [True: 23.8k, False: 3.96k]
  ------------------
 2325|  27.7k|	{
 2326|  3.76k|		case TIFF_LONG8:
  ------------------
  |  Branch (2326:3): [True: 3.76k, False: 24.0k]
  ------------------
 2327|  3.76k|			*value=(uint64_t*)origdata;
 2328|  3.76k|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  3.76k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2328:8): [True: 23, False: 3.73k]
  ------------------
 2329|     23|				TIFFSwabArrayOfLong8(*value,count);
 2330|  3.76k|			return(TIFFReadDirEntryErrOk);
 2331|    204|		case TIFF_SLONG8:
  ------------------
  |  Branch (2331:3): [True: 204, False: 27.5k]
  ------------------
 2332|    204|			{
 2333|    204|				int64_t* m;
 2334|    204|				uint32_t n;
 2335|    204|				m=(int64_t*)origdata;
 2336|    944|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2336:15): [True: 823, False: 121]
  ------------------
 2337|    823|				{
 2338|    823|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    823|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2338:10): [True: 304, False: 519]
  ------------------
 2339|    304|						TIFFSwabLong8((uint64_t*)m);
 2340|    823|					err=TIFFReadDirEntryCheckRangeLong8Slong8(*m);
 2341|    823|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2341:10): [True: 83, False: 740]
  ------------------
 2342|     83|					{
 2343|     83|						_TIFFfree(origdata);
 2344|     83|						return(err);
 2345|     83|					}
 2346|    740|					m++;
 2347|    740|				}
 2348|    121|				*value=(uint64_t*)origdata;
 2349|    121|				return(TIFFReadDirEntryErrOk);
 2350|    204|			}
 2351|  27.7k|	}
 2352|  23.8k|	data=(uint64_t*)_TIFFmalloc(count * 8);
 2353|  23.8k|	if (data==0)
  ------------------
  |  Branch (2353:6): [True: 0, False: 23.8k]
  ------------------
 2354|      0|	{
 2355|      0|		_TIFFfree(origdata);
 2356|      0|		return(TIFFReadDirEntryErrAlloc);
 2357|      0|	}
 2358|  23.8k|	switch (direntry->tdir_type)
  ------------------
  |  Branch (2358:10): [True: 0, False: 23.8k]
  ------------------
 2359|  23.8k|	{
 2360|  15.3k|		case TIFF_BYTE:
  ------------------
  |  Branch (2360:3): [True: 15.3k, False: 8.48k]
  ------------------
 2361|  15.3k|			{
 2362|  15.3k|				uint8_t* ma;
 2363|  15.3k|				uint64_t* mb;
 2364|  15.3k|				uint32_t n;
 2365|  15.3k|				ma=(uint8_t*)origdata;
 2366|  15.3k|				mb=data;
 2367|  1.01M|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2367:15): [True: 995k, False: 15.3k]
  ------------------
 2368|   995k|					*mb++=(uint64_t)(*ma++);
 2369|  15.3k|			}
 2370|  15.3k|			break;
 2371|  1.45k|		case TIFF_SBYTE:
  ------------------
  |  Branch (2371:3): [True: 1.45k, False: 22.3k]
  ------------------
 2372|  1.45k|			{
 2373|  1.45k|				int8_t* ma;
 2374|  1.45k|				uint64_t* mb;
 2375|  1.45k|				uint32_t n;
 2376|  1.45k|				ma=(int8_t*)origdata;
 2377|  1.45k|				mb=data;
 2378|  4.25k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2378:15): [True: 2.81k, False: 1.44k]
  ------------------
 2379|  2.81k|				{
 2380|  2.81k|					err=TIFFReadDirEntryCheckRangeLong8Sbyte(*ma);
 2381|  2.81k|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2381:10): [True: 10, False: 2.80k]
  ------------------
 2382|     10|						break;
 2383|  2.80k|					*mb++=(uint64_t)(*ma++);
 2384|  2.80k|				}
 2385|  1.45k|			}
 2386|  1.45k|			break;
 2387|  3.21k|		case TIFF_SHORT:
  ------------------
  |  Branch (2387:3): [True: 3.21k, False: 20.5k]
  ------------------
 2388|  3.21k|			{
 2389|  3.21k|				uint16_t* ma;
 2390|  3.21k|				uint64_t* mb;
 2391|  3.21k|				uint32_t n;
 2392|  3.21k|				ma=(uint16_t*)origdata;
 2393|  3.21k|				mb=data;
 2394|   176k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2394:15): [True: 173k, False: 3.21k]
  ------------------
 2395|   173k|				{
 2396|   173k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|   173k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2396:10): [True: 224, False: 173k]
  ------------------
 2397|    224|						TIFFSwabShort(ma);
 2398|   173k|					*mb++=(uint64_t)(*ma++);
 2399|   173k|				}
 2400|  3.21k|			}
 2401|  3.21k|			break;
 2402|    318|		case TIFF_SSHORT:
  ------------------
  |  Branch (2402:3): [True: 318, False: 23.4k]
  ------------------
 2403|    318|			{
 2404|    318|				int16_t* ma;
 2405|    318|				uint64_t* mb;
 2406|    318|				uint32_t n;
 2407|    318|				ma=(int16_t*)origdata;
 2408|    318|				mb=data;
 2409|  1.68k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2409:15): [True: 1.38k, False: 297]
  ------------------
 2410|  1.38k|				{
 2411|  1.38k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  1.38k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2411:10): [True: 221, False: 1.16k]
  ------------------
 2412|    221|						TIFFSwabShort((uint16_t*)ma);
 2413|  1.38k|					err=TIFFReadDirEntryCheckRangeLong8Sshort(*ma);
 2414|  1.38k|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2414:10): [True: 21, False: 1.36k]
  ------------------
 2415|     21|						break;
 2416|  1.36k|					*mb++=(uint64_t)(*ma++);
 2417|  1.36k|				}
 2418|    318|			}
 2419|    318|			break;
 2420|  3.42k|		case TIFF_LONG:
  ------------------
  |  Branch (2420:3): [True: 3.42k, False: 20.3k]
  ------------------
 2421|  3.42k|			{
 2422|  3.42k|				uint32_t* ma;
 2423|  3.42k|				uint64_t* mb;
 2424|  3.42k|				uint32_t n;
 2425|  3.42k|				ma=(uint32_t*)origdata;
 2426|  3.42k|				mb=data;
 2427|  77.3k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2427:15): [True: 73.9k, False: 3.42k]
  ------------------
 2428|  73.9k|				{
 2429|  73.9k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  73.9k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2429:10): [True: 2.28k, False: 71.6k]
  ------------------
 2430|  2.28k|						TIFFSwabLong(ma);
 2431|  73.9k|					*mb++=(uint64_t)(*ma++);
 2432|  73.9k|				}
 2433|  3.42k|			}
 2434|  3.42k|			break;
 2435|     78|		case TIFF_SLONG:
  ------------------
  |  Branch (2435:3): [True: 78, False: 23.7k]
  ------------------
 2436|     78|			{
 2437|     78|				int32_t* ma;
 2438|     78|				uint64_t* mb;
 2439|     78|				uint32_t n;
 2440|     78|				ma=(int32_t*)origdata;
 2441|     78|				mb=data;
 2442|  1.13k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2442:15): [True: 1.06k, False: 66]
  ------------------
 2443|  1.06k|				{
 2444|  1.06k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  1.06k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2444:10): [True: 553, False: 511]
  ------------------
 2445|    553|						TIFFSwabLong((uint32_t*)ma);
 2446|  1.06k|					err=TIFFReadDirEntryCheckRangeLong8Slong(*ma);
 2447|  1.06k|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2447:10): [True: 12, False: 1.05k]
  ------------------
 2448|     12|						break;
 2449|  1.05k|					*mb++=(uint64_t)(*ma++);
 2450|  1.05k|				}
 2451|     78|			}
 2452|     78|			break;
 2453|  23.8k|	}
 2454|  23.8k|	_TIFFfree(origdata);
 2455|  23.8k|	if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2455:6): [True: 43, False: 23.7k]
  ------------------
 2456|     43|	{
 2457|     43|		_TIFFfree(data);
 2458|     43|		return(err);
 2459|     43|	}
 2460|  23.7k|	*value=data;
 2461|  23.7k|	return(TIFFReadDirEntryErrOk);
 2462|  23.8k|}
tif_dirread.c:TIFFReadDirEntrySlong8Array:
 2470|    836|{
 2471|    836|	enum TIFFReadDirEntryErr err;
 2472|    836|	uint32_t count;
 2473|    836|	void* origdata;
 2474|    836|	int64_t* data;
 2475|    836|	switch (direntry->tdir_type)
 2476|    836|	{
 2477|      0|		case TIFF_BYTE:
  ------------------
  |  Branch (2477:3): [True: 0, False: 836]
  ------------------
 2478|      0|		case TIFF_SBYTE:
  ------------------
  |  Branch (2478:3): [True: 0, False: 836]
  ------------------
 2479|      0|		case TIFF_SHORT:
  ------------------
  |  Branch (2479:3): [True: 0, False: 836]
  ------------------
 2480|      0|		case TIFF_SSHORT:
  ------------------
  |  Branch (2480:3): [True: 0, False: 836]
  ------------------
 2481|      0|		case TIFF_LONG:
  ------------------
  |  Branch (2481:3): [True: 0, False: 836]
  ------------------
 2482|      0|		case TIFF_SLONG:
  ------------------
  |  Branch (2482:3): [True: 0, False: 836]
  ------------------
 2483|      0|		case TIFF_LONG8:
  ------------------
  |  Branch (2483:3): [True: 0, False: 836]
  ------------------
 2484|    836|		case TIFF_SLONG8:
  ------------------
  |  Branch (2484:3): [True: 836, False: 0]
  ------------------
 2485|    836|			break;
 2486|      0|		default:
  ------------------
  |  Branch (2486:3): [True: 0, False: 836]
  ------------------
 2487|      0|			return(TIFFReadDirEntryErrType);
 2488|    836|	}
 2489|    836|	err=TIFFReadDirEntryArray(tif,direntry,&count,8,&origdata);
 2490|    836|	if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (2490:6): [True: 409, False: 427]
  |  Branch (2490:36): [True: 105, False: 322]
  ------------------
 2491|    514|	{
 2492|    514|		*value=0;
 2493|    514|		return(err);
 2494|    514|	}
 2495|    322|	switch (direntry->tdir_type)
  ------------------
  |  Branch (2495:10): [True: 0, False: 322]
  ------------------
 2496|    322|	{
 2497|      0|		case TIFF_LONG8:
  ------------------
  |  Branch (2497:3): [True: 0, False: 322]
  ------------------
 2498|      0|			{
 2499|      0|				uint64_t* m;
 2500|      0|				uint32_t n;
 2501|      0|				m=(uint64_t*)origdata;
 2502|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2502:15): [True: 0, False: 0]
  ------------------
 2503|      0|				{
 2504|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2504:10): [True: 0, False: 0]
  ------------------
 2505|      0|						TIFFSwabLong8(m);
 2506|      0|					err=TIFFReadDirEntryCheckRangeSlong8Long8(*m);
 2507|      0|					if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2507:10): [True: 0, False: 0]
  ------------------
 2508|      0|					{
 2509|      0|						_TIFFfree(origdata);
 2510|      0|						return(err);
 2511|      0|					}
 2512|      0|					m++;
 2513|      0|				}
 2514|      0|				*value=(int64_t*)origdata;
 2515|      0|				return(TIFFReadDirEntryErrOk);
 2516|      0|			}
 2517|    322|		case TIFF_SLONG8:
  ------------------
  |  Branch (2517:3): [True: 322, False: 0]
  ------------------
 2518|    322|			*value=(int64_t*)origdata;
 2519|    322|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    322|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2519:8): [True: 22, False: 300]
  ------------------
 2520|     22|				TIFFSwabArrayOfLong8((uint64_t*)(*value), count);
 2521|    322|			return(TIFFReadDirEntryErrOk);
 2522|    322|	}
 2523|      0|	data=(int64_t*)_TIFFmalloc(count * 8);
 2524|      0|	if (data==0)
  ------------------
  |  Branch (2524:6): [True: 0, False: 0]
  ------------------
 2525|      0|	{
 2526|      0|		_TIFFfree(origdata);
 2527|      0|		return(TIFFReadDirEntryErrAlloc);
 2528|      0|	}
 2529|      0|	switch (direntry->tdir_type)
  ------------------
  |  Branch (2529:10): [True: 0, False: 0]
  ------------------
 2530|      0|	{
 2531|      0|		case TIFF_BYTE:
  ------------------
  |  Branch (2531:3): [True: 0, False: 0]
  ------------------
 2532|      0|			{
 2533|      0|				uint8_t* ma;
 2534|      0|				int64_t* mb;
 2535|      0|				uint32_t n;
 2536|      0|				ma=(uint8_t*)origdata;
 2537|      0|				mb=data;
 2538|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2538:15): [True: 0, False: 0]
  ------------------
 2539|      0|					*mb++=(int64_t)(*ma++);
 2540|      0|			}
 2541|      0|			break;
 2542|      0|		case TIFF_SBYTE:
  ------------------
  |  Branch (2542:3): [True: 0, False: 0]
  ------------------
 2543|      0|			{
 2544|      0|				int8_t* ma;
 2545|      0|				int64_t* mb;
 2546|      0|				uint32_t n;
 2547|      0|				ma=(int8_t*)origdata;
 2548|      0|				mb=data;
 2549|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2549:15): [True: 0, False: 0]
  ------------------
 2550|      0|					*mb++=(int64_t)(*ma++);
 2551|      0|			}
 2552|      0|			break;
 2553|      0|		case TIFF_SHORT:
  ------------------
  |  Branch (2553:3): [True: 0, False: 0]
  ------------------
 2554|      0|			{
 2555|      0|				uint16_t* ma;
 2556|      0|				int64_t* mb;
 2557|      0|				uint32_t n;
 2558|      0|				ma=(uint16_t*)origdata;
 2559|      0|				mb=data;
 2560|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2560:15): [True: 0, False: 0]
  ------------------
 2561|      0|				{
 2562|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2562:10): [True: 0, False: 0]
  ------------------
 2563|      0|						TIFFSwabShort(ma);
 2564|      0|					*mb++=(int64_t)(*ma++);
 2565|      0|				}
 2566|      0|			}
 2567|      0|			break;
 2568|      0|		case TIFF_SSHORT:
  ------------------
  |  Branch (2568:3): [True: 0, False: 0]
  ------------------
 2569|      0|			{
 2570|      0|				int16_t* ma;
 2571|      0|				int64_t* mb;
 2572|      0|				uint32_t n;
 2573|      0|				ma=(int16_t*)origdata;
 2574|      0|				mb=data;
 2575|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2575:15): [True: 0, False: 0]
  ------------------
 2576|      0|				{
 2577|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2577:10): [True: 0, False: 0]
  ------------------
 2578|      0|						TIFFSwabShort((uint16_t*)ma);
 2579|      0|					*mb++=(int64_t)(*ma++);
 2580|      0|				}
 2581|      0|			}
 2582|      0|			break;
 2583|      0|		case TIFF_LONG:
  ------------------
  |  Branch (2583:3): [True: 0, False: 0]
  ------------------
 2584|      0|			{
 2585|      0|				uint32_t* ma;
 2586|      0|				int64_t* mb;
 2587|      0|				uint32_t n;
 2588|      0|				ma=(uint32_t*)origdata;
 2589|      0|				mb=data;
 2590|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2590:15): [True: 0, False: 0]
  ------------------
 2591|      0|				{
 2592|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2592:10): [True: 0, False: 0]
  ------------------
 2593|      0|						TIFFSwabLong(ma);
 2594|      0|					*mb++=(int64_t)(*ma++);
 2595|      0|				}
 2596|      0|			}
 2597|      0|			break;
 2598|      0|		case TIFF_SLONG:
  ------------------
  |  Branch (2598:3): [True: 0, False: 0]
  ------------------
 2599|      0|			{
 2600|      0|				int32_t* ma;
 2601|      0|				int64_t* mb;
 2602|      0|				uint32_t n;
 2603|      0|				ma=(int32_t*)origdata;
 2604|      0|				mb=data;
 2605|      0|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2605:15): [True: 0, False: 0]
  ------------------
 2606|      0|				{
 2607|      0|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2607:10): [True: 0, False: 0]
  ------------------
 2608|      0|						TIFFSwabLong((uint32_t*)ma);
 2609|      0|					*mb++=(int64_t)(*ma++);
 2610|      0|				}
 2611|      0|			}
 2612|      0|			break;
 2613|      0|	}
 2614|      0|	_TIFFfree(origdata);
 2615|      0|	*value=data;
 2616|      0|	return(TIFFReadDirEntryErrOk);
 2617|      0|}
tif_dirread.c:TIFFReadDirEntryFloatArray:
 2620|  1.62k|{
 2621|  1.62k|	enum TIFFReadDirEntryErr err;
 2622|  1.62k|	uint32_t count;
 2623|  1.62k|	void* origdata;
 2624|  1.62k|	float* data;
 2625|  1.62k|	switch (direntry->tdir_type)
 2626|  1.62k|	{
 2627|     55|		case TIFF_BYTE:
  ------------------
  |  Branch (2627:3): [True: 55, False: 1.56k]
  ------------------
 2628|    124|		case TIFF_SBYTE:
  ------------------
  |  Branch (2628:3): [True: 69, False: 1.55k]
  ------------------
 2629|    166|		case TIFF_SHORT:
  ------------------
  |  Branch (2629:3): [True: 42, False: 1.57k]
  ------------------
 2630|    208|		case TIFF_SSHORT:
  ------------------
  |  Branch (2630:3): [True: 42, False: 1.57k]
  ------------------
 2631|    247|		case TIFF_LONG:
  ------------------
  |  Branch (2631:3): [True: 39, False: 1.58k]
  ------------------
 2632|    289|		case TIFF_SLONG:
  ------------------
  |  Branch (2632:3): [True: 42, False: 1.57k]
  ------------------
 2633|    333|		case TIFF_LONG8:
  ------------------
  |  Branch (2633:3): [True: 44, False: 1.57k]
  ------------------
 2634|    386|		case TIFF_SLONG8:
  ------------------
  |  Branch (2634:3): [True: 53, False: 1.56k]
  ------------------
 2635|    835|		case TIFF_RATIONAL:
  ------------------
  |  Branch (2635:3): [True: 449, False: 1.17k]
  ------------------
 2636|  1.23k|		case TIFF_SRATIONAL:
  ------------------
  |  Branch (2636:3): [True: 404, False: 1.21k]
  ------------------
 2637|  1.52k|		case TIFF_FLOAT:
  ------------------
  |  Branch (2637:3): [True: 284, False: 1.33k]
  ------------------
 2638|  1.58k|		case TIFF_DOUBLE:
  ------------------
  |  Branch (2638:3): [True: 66, False: 1.55k]
  ------------------
 2639|  1.58k|			break;
 2640|     31|		default:
  ------------------
  |  Branch (2640:3): [True: 31, False: 1.58k]
  ------------------
 2641|     31|			return(TIFFReadDirEntryErrType);
 2642|  1.62k|	}
 2643|  1.58k|	err=TIFFReadDirEntryArray(tif,direntry,&count,4,&origdata);
 2644|  1.58k|	if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (2644:6): [True: 537, False: 1.05k]
  |  Branch (2644:36): [True: 123, False: 929]
  ------------------
 2645|    660|	{
 2646|    660|		*value=0;
 2647|    660|		return(err);
 2648|    660|	}
 2649|    929|	switch (direntry->tdir_type)
  ------------------
  |  Branch (2649:10): [True: 734, False: 195]
  ------------------
 2650|    929|	{
 2651|    195|		case TIFF_FLOAT:
  ------------------
  |  Branch (2651:3): [True: 195, False: 734]
  ------------------
 2652|    195|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    195|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2652:8): [True: 14, False: 181]
  ------------------
 2653|     14|				TIFFSwabArrayOfLong((uint32_t*)origdata, count);
 2654|    195|			TIFFCvtIEEEDoubleToNative(tif,count,(float*)origdata);
 2655|    195|			*value=(float*)origdata;
 2656|    195|			return(TIFFReadDirEntryErrOk);
 2657|    929|	}
 2658|    734|	data=(float*)_TIFFmalloc(count*sizeof(float));
 2659|    734|	if (data==0)
  ------------------
  |  Branch (2659:6): [True: 0, False: 734]
  ------------------
 2660|      0|	{
 2661|      0|		_TIFFfree(origdata);
 2662|      0|		return(TIFFReadDirEntryErrAlloc);
 2663|      0|	}
 2664|    734|	switch (direntry->tdir_type)
  ------------------
  |  Branch (2664:10): [True: 0, False: 734]
  ------------------
 2665|    734|	{
 2666|     38|		case TIFF_BYTE:
  ------------------
  |  Branch (2666:3): [True: 38, False: 696]
  ------------------
 2667|     38|			{
 2668|     38|				uint8_t* ma;
 2669|     38|				float* mb;
 2670|     38|				uint32_t n;
 2671|     38|				ma=(uint8_t*)origdata;
 2672|     38|				mb=data;
 2673|  3.20k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2673:15): [True: 3.17k, False: 38]
  ------------------
 2674|  3.17k|					*mb++=(float)(*ma++);
 2675|     38|			}
 2676|     38|			break;
 2677|     59|		case TIFF_SBYTE:
  ------------------
  |  Branch (2677:3): [True: 59, False: 675]
  ------------------
 2678|     59|			{
 2679|     59|				int8_t* ma;
 2680|     59|				float* mb;
 2681|     59|				uint32_t n;
 2682|     59|				ma=(int8_t*)origdata;
 2683|     59|				mb=data;
 2684|    737|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2684:15): [True: 678, False: 59]
  ------------------
 2685|    678|					*mb++=(float)(*ma++);
 2686|     59|			}
 2687|     59|			break;
 2688|     38|		case TIFF_SHORT:
  ------------------
  |  Branch (2688:3): [True: 38, False: 696]
  ------------------
 2689|     38|			{
 2690|     38|				uint16_t* ma;
 2691|     38|				float* mb;
 2692|     38|				uint32_t n;
 2693|     38|				ma=(uint16_t*)origdata;
 2694|     38|				mb=data;
 2695|    563|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2695:15): [True: 525, False: 38]
  ------------------
 2696|    525|				{
 2697|    525|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    525|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2697:10): [True: 200, False: 325]
  ------------------
 2698|    200|						TIFFSwabShort(ma);
 2699|    525|					*mb++=(float)(*ma++);
 2700|    525|				}
 2701|     38|			}
 2702|     38|			break;
 2703|     34|		case TIFF_SSHORT:
  ------------------
  |  Branch (2703:3): [True: 34, False: 700]
  ------------------
 2704|     34|			{
 2705|     34|				int16_t* ma;
 2706|     34|				float* mb;
 2707|     34|				uint32_t n;
 2708|     34|				ma=(int16_t*)origdata;
 2709|     34|				mb=data;
 2710|  1.33k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2710:15): [True: 1.30k, False: 34]
  ------------------
 2711|  1.30k|				{
 2712|  1.30k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  1.30k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2712:10): [True: 338, False: 963]
  ------------------
 2713|    338|						TIFFSwabShort((uint16_t*)ma);
 2714|  1.30k|					*mb++=(float)(*ma++);
 2715|  1.30k|				}
 2716|     34|			}
 2717|     34|			break;
 2718|     29|		case TIFF_LONG:
  ------------------
  |  Branch (2718:3): [True: 29, False: 705]
  ------------------
 2719|     29|			{
 2720|     29|				uint32_t* ma;
 2721|     29|				float* mb;
 2722|     29|				uint32_t n;
 2723|     29|				ma=(uint32_t*)origdata;
 2724|     29|				mb=data;
 2725|    470|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2725:15): [True: 441, False: 29]
  ------------------
 2726|    441|				{
 2727|    441|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    441|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2727:10): [True: 194, False: 247]
  ------------------
 2728|    194|						TIFFSwabLong(ma);
 2729|    441|					*mb++=(float)(*ma++);
 2730|    441|				}
 2731|     29|			}
 2732|     29|			break;
 2733|     22|		case TIFF_SLONG:
  ------------------
  |  Branch (2733:3): [True: 22, False: 712]
  ------------------
 2734|     22|			{
 2735|     22|				int32_t* ma;
 2736|     22|				float* mb;
 2737|     22|				uint32_t n;
 2738|     22|				ma=(int32_t*)origdata;
 2739|     22|				mb=data;
 2740|    457|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2740:15): [True: 435, False: 22]
  ------------------
 2741|    435|				{
 2742|    435|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    435|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2742:10): [True: 219, False: 216]
  ------------------
 2743|    219|						TIFFSwabLong((uint32_t*)ma);
 2744|    435|					*mb++=(float)(*ma++);
 2745|    435|				}
 2746|     22|			}
 2747|     22|			break;
 2748|     36|		case TIFF_LONG8:
  ------------------
  |  Branch (2748:3): [True: 36, False: 698]
  ------------------
 2749|     36|			{
 2750|     36|				uint64_t* ma;
 2751|     36|				float* mb;
 2752|     36|				uint32_t n;
 2753|     36|				ma=(uint64_t*)origdata;
 2754|     36|				mb=data;
 2755|    668|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2755:15): [True: 632, False: 36]
  ------------------
 2756|    632|				{
 2757|    632|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|    632|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2757:10): [True: 206, False: 426]
  ------------------
 2758|    206|						TIFFSwabLong8(ma);
 2759|       |#if defined(__WIN32__) && (_MSC_VER < 1500)
 2760|       |					/*
 2761|       |					 * XXX: MSVC 6.0 does not support
 2762|       |					 * conversion of 64-bit integers into
 2763|       |					 * floating point values.
 2764|       |					 */
 2765|       |					*mb++ = _TIFFUInt64ToFloat(*ma++);
 2766|       |#else
 2767|    632|					*mb++ = (float)(*ma++);
 2768|    632|#endif
 2769|    632|				}
 2770|     36|			}
 2771|     36|			break;
 2772|     32|		case TIFF_SLONG8:
  ------------------
  |  Branch (2772:3): [True: 32, False: 702]
  ------------------
 2773|     32|			{
 2774|     32|				int64_t* ma;
 2775|     32|				float* mb;
 2776|     32|				uint32_t n;
 2777|     32|				ma=(int64_t*)origdata;
 2778|     32|				mb=data;
 2779|  2.37k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2779:15): [True: 2.34k, False: 32]
  ------------------
 2780|  2.34k|				{
 2781|  2.34k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  2.34k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2781:10): [True: 208, False: 2.13k]
  ------------------
 2782|    208|						TIFFSwabLong8((uint64_t*)ma);
 2783|  2.34k|					*mb++=(float)(*ma++);
 2784|  2.34k|				}
 2785|     32|			}
 2786|     32|			break;
 2787|    257|		case TIFF_RATIONAL:
  ------------------
  |  Branch (2787:3): [True: 257, False: 477]
  ------------------
 2788|    257|			{
 2789|    257|				uint32_t* ma;
 2790|    257|				uint32_t maa;
 2791|    257|				uint32_t mab;
 2792|    257|				float* mb;
 2793|    257|				uint32_t n;
 2794|    257|				ma=(uint32_t*)origdata;
 2795|    257|				mb=data;
 2796|  4.23k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2796:15): [True: 3.97k, False: 257]
  ------------------
 2797|  3.97k|				{
 2798|  3.97k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  3.97k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2798:10): [True: 2.16k, False: 1.81k]
  ------------------
 2799|  2.16k|						TIFFSwabLong(ma);
 2800|  3.97k|					maa=*ma++;
 2801|  3.97k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  3.97k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2801:10): [True: 2.16k, False: 1.81k]
  ------------------
 2802|  2.16k|						TIFFSwabLong(ma);
 2803|  3.97k|					mab=*ma++;
 2804|  3.97k|					if (mab==0)
  ------------------
  |  Branch (2804:10): [True: 926, False: 3.05k]
  ------------------
 2805|    926|						*mb++=0.0;
 2806|  3.05k|					else
 2807|  3.05k|						*mb++=(float)maa/(float)mab;
 2808|  3.97k|				}
 2809|    257|			}
 2810|    257|			break;
 2811|    131|		case TIFF_SRATIONAL:
  ------------------
  |  Branch (2811:3): [True: 131, False: 603]
  ------------------
 2812|    131|			{
 2813|    131|				uint32_t* ma;
 2814|    131|				int32_t maa;
 2815|    131|				uint32_t mab;
 2816|    131|				float* mb;
 2817|    131|				uint32_t n;
 2818|    131|				ma=(uint32_t*)origdata;
 2819|    131|				mb=data;
 2820|  1.97k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2820:15): [True: 1.84k, False: 131]
  ------------------
 2821|  1.84k|				{
 2822|  1.84k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  1.84k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2822:10): [True: 245, False: 1.59k]
  ------------------
 2823|    245|						TIFFSwabLong(ma);
 2824|  1.84k|					maa=*(int32_t*)ma;
 2825|  1.84k|					ma++;
 2826|  1.84k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  1.84k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2826:10): [True: 245, False: 1.59k]
  ------------------
 2827|    245|						TIFFSwabLong(ma);
 2828|  1.84k|					mab=*ma++;
 2829|  1.84k|					if (mab==0)
  ------------------
  |  Branch (2829:10): [True: 533, False: 1.31k]
  ------------------
 2830|    533|						*mb++=0.0;
 2831|  1.31k|					else
 2832|  1.31k|						*mb++=(float)maa/(float)mab;
 2833|  1.84k|				}
 2834|    131|			}
 2835|    131|			break;
 2836|     58|		case TIFF_DOUBLE:
  ------------------
  |  Branch (2836:3): [True: 58, False: 676]
  ------------------
 2837|     58|			{
 2838|     58|				double* ma;
 2839|     58|				float* mb;
 2840|     58|				uint32_t n;
 2841|     58|				if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|     58|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (2841:9): [True: 14, False: 44]
  ------------------
 2842|     14|					TIFFSwabArrayOfLong8((uint64_t*)origdata, count);
 2843|     58|				TIFFCvtIEEEDoubleToNative(tif,count,(double*)origdata);
 2844|     58|				ma=(double*)origdata;
 2845|     58|				mb=data;
 2846|  1.94k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (2846:15): [True: 1.88k, False: 58]
  ------------------
 2847|  1.88k|                                {
 2848|  1.88k|                                    double val = *ma++;
 2849|  1.88k|                                    if( val > FLT_MAX )
  ------------------
  |  Branch (2849:41): [True: 320, False: 1.56k]
  ------------------
 2850|    320|                                        val = FLT_MAX;
 2851|  1.56k|                                    else if( val < -FLT_MAX )
  ------------------
  |  Branch (2851:46): [True: 450, False: 1.11k]
  ------------------
 2852|    450|                                        val = -FLT_MAX;
 2853|  1.88k|                                    *mb++=(float)val;
 2854|  1.88k|                                }
 2855|     58|			}
 2856|     58|			break;
 2857|    734|	}
 2858|    734|	_TIFFfree(origdata);
 2859|    734|	*value=data;
 2860|    734|	return(TIFFReadDirEntryErrOk);
 2861|    734|}
tif_dirread.c:TIFFReadDirEntryIfd8Array:
 3102|    678|{
 3103|    678|	enum TIFFReadDirEntryErr err;
 3104|    678|	uint32_t count;
 3105|    678|	void* origdata;
 3106|    678|	uint64_t* data;
 3107|    678|	switch (direntry->tdir_type)
 3108|    678|	{
 3109|     34|		case TIFF_LONG:
  ------------------
  |  Branch (3109:3): [True: 34, False: 644]
  ------------------
 3110|     44|		case TIFF_LONG8:
  ------------------
  |  Branch (3110:3): [True: 10, False: 668]
  ------------------
 3111|    213|		case TIFF_IFD:
  ------------------
  |  Branch (3111:3): [True: 169, False: 509]
  ------------------
 3112|    664|		case TIFF_IFD8:
  ------------------
  |  Branch (3112:3): [True: 451, False: 227]
  ------------------
 3113|    664|			break;
 3114|     14|		default:
  ------------------
  |  Branch (3114:3): [True: 14, False: 664]
  ------------------
 3115|     14|			return(TIFFReadDirEntryErrType);
 3116|    678|	}
 3117|    664|	err=TIFFReadDirEntryArray(tif,direntry,&count,8,&origdata);
 3118|    664|	if ((err!=TIFFReadDirEntryErrOk)||(origdata==0))
  ------------------
  |  Branch (3118:6): [True: 437, False: 227]
  |  Branch (3118:36): [True: 84, False: 143]
  ------------------
 3119|    521|	{
 3120|    521|		*value=0;
 3121|    521|		return(err);
 3122|    521|	}
 3123|    143|	switch (direntry->tdir_type)
  ------------------
  |  Branch (3123:10): [True: 103, False: 40]
  ------------------
 3124|    143|	{
 3125|      1|		case TIFF_LONG8:
  ------------------
  |  Branch (3125:3): [True: 1, False: 142]
  ------------------
 3126|     40|		case TIFF_IFD8:
  ------------------
  |  Branch (3126:3): [True: 39, False: 104]
  ------------------
 3127|     40|			*value=(uint64_t*)origdata;
 3128|     40|			if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|     40|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3128:8): [True: 19, False: 21]
  ------------------
 3129|     19|				TIFFSwabArrayOfLong8(*value,count);
 3130|     40|			return(TIFFReadDirEntryErrOk);
 3131|    143|	}
 3132|    103|	data=(uint64_t*)_TIFFmalloc(count * 8);
 3133|    103|	if (data==0)
  ------------------
  |  Branch (3133:6): [True: 0, False: 103]
  ------------------
 3134|      0|	{
 3135|      0|		_TIFFfree(origdata);
 3136|      0|		return(TIFFReadDirEntryErrAlloc);
 3137|      0|	}
 3138|    103|	switch (direntry->tdir_type)
  ------------------
  |  Branch (3138:10): [True: 0, False: 103]
  ------------------
 3139|    103|	{
 3140|     10|		case TIFF_LONG:
  ------------------
  |  Branch (3140:3): [True: 10, False: 93]
  ------------------
 3141|    103|		case TIFF_IFD:
  ------------------
  |  Branch (3141:3): [True: 93, False: 10]
  ------------------
 3142|    103|			{
 3143|    103|				uint32_t* ma;
 3144|    103|				uint64_t* mb;
 3145|    103|				uint32_t n;
 3146|    103|				ma=(uint32_t*)origdata;
 3147|    103|				mb=data;
 3148|  2.64k|				for (n=0; n<count; n++)
  ------------------
  |  Branch (3148:15): [True: 2.54k, False: 103]
  ------------------
 3149|  2.54k|				{
 3150|  2.54k|					if (tif->tif_flags&TIFF_SWAB)
  ------------------
  |  |   98|  2.54k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (3150:10): [True: 470, False: 2.07k]
  ------------------
 3151|    470|						TIFFSwabLong(ma);
 3152|  2.54k|					*mb++=(uint64_t)(*ma++);
 3153|  2.54k|				}
 3154|    103|			}
 3155|    103|			break;
 3156|    103|	}
 3157|    103|	_TIFFfree(origdata);
 3158|    103|	*value=data;
 3159|    103|	return(TIFFReadDirEntryErrOk);
 3160|    103|}
tif_dirread.c:TIFFFetchStripThing:
 6455|  25.9k|{
 6456|  25.9k|	static const char module[] = "TIFFFetchStripThing";
 6457|  25.9k|	enum TIFFReadDirEntryErr err;
 6458|  25.9k|	uint64_t* data;
 6459|  25.9k|	err=TIFFReadDirEntryLong8ArrayWithLimit(tif,dir,&data,nstrips);
 6460|  25.9k|	if (err!=TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6460:6): [True: 823, False: 25.1k]
  ------------------
 6461|    823|	{
 6462|    823|		const TIFFField* fip = TIFFFieldWithTag(tif,dir->tdir_tag); 
 6463|    823|		TIFFReadDirEntryOutputErr(tif,err,module,fip ? fip->field_name : "unknown tagname",0);
  ------------------
  |  Branch (6463:44): [True: 823, False: 0]
  ------------------
 6464|    823|		return(0);
 6465|    823|	}
 6466|  25.1k|	if (dir->tdir_count<(uint64_t)nstrips)
  ------------------
  |  Branch (6466:6): [True: 3.31k, False: 21.8k]
  ------------------
 6467|  3.31k|	{
 6468|  3.31k|		uint64_t* resizeddata;
 6469|  3.31k|		const TIFFField* fip = TIFFFieldWithTag(tif,dir->tdir_tag);
 6470|  3.31k|		const char* pszMax = getenv("LIBTIFF_STRILE_ARRAY_MAX_RESIZE_COUNT");
 6471|  3.31k|		uint32_t max_nstrips = 1000000;
 6472|  3.31k|		if( pszMax )
  ------------------
  |  Branch (6472:7): [True: 0, False: 3.31k]
  ------------------
 6473|      0|			max_nstrips = (uint32_t) atoi(pszMax);
 6474|  3.31k|		TIFFReadDirEntryOutputErr(tif,TIFFReadDirEntryErrCount,
 6475|  3.31k|		            module,
 6476|  3.31k|		            fip ? fip->field_name : "unknown tagname",
  ------------------
  |  Branch (6476:15): [True: 3.31k, False: 0]
  ------------------
 6477|  3.31k|		            ( nstrips <= max_nstrips ) );
 6478|       |
 6479|  3.31k|		if( nstrips > max_nstrips )
  ------------------
  |  Branch (6479:7): [True: 32, False: 3.27k]
  ------------------
 6480|     32|		{
 6481|     32|			_TIFFfree(data);
 6482|     32|			return(0);
 6483|     32|		}
 6484|       |
 6485|  3.27k|		resizeddata=(uint64_t*)_TIFFCheckMalloc(tif, nstrips, sizeof(uint64_t), "for strip array");
 6486|  3.27k|		if (resizeddata==0) {
  ------------------
  |  Branch (6486:7): [True: 0, False: 3.27k]
  ------------------
 6487|      0|			_TIFFfree(data);
 6488|      0|			return(0);
 6489|      0|		}
 6490|  3.27k|		if( dir->tdir_count )
  ------------------
  |  Branch (6490:7): [True: 1.80k, False: 1.47k]
  ------------------
 6491|  1.80k|			_TIFFmemcpy(resizeddata,data, (uint32_t)dir->tdir_count * sizeof(uint64_t));
 6492|  3.27k|		_TIFFmemset(resizeddata+(uint32_t)dir->tdir_count, 0, (nstrips - (uint32_t)dir->tdir_count) * sizeof(uint64_t));
 6493|  3.27k|		_TIFFfree(data);
 6494|  3.27k|		data=resizeddata;
 6495|  3.27k|	}
 6496|  25.1k|	*lpp=data;
 6497|  25.1k|	return(1);
 6498|  25.1k|}
tif_dirread.c:ChopUpSingleUncompressedStrip:
 6635|  1.22k|{
 6636|  1.22k|	register TIFFDirectory *td = &tif->tif_dir;
 6637|  1.22k|	uint64_t bytecount;
 6638|  1.22k|	uint64_t offset;
 6639|  1.22k|	uint32_t rowblock;
 6640|  1.22k|	uint64_t rowblockbytes;
 6641|  1.22k|	uint64_t stripbytes;
 6642|  1.22k|	uint32_t nstrips;
 6643|  1.22k|	uint32_t rowsperstrip;
 6644|       |
 6645|  1.22k|	bytecount = TIFFGetStrileByteCount(tif, 0);
 6646|       |        /* On a newly created file, just re-opened to be filled, we */
 6647|       |        /* don't want strip chop to trigger as it is going to cause issues */
 6648|       |        /* later ( StripOffsets and StripByteCounts improperly filled) . */
 6649|  1.22k|        if( bytecount == 0 && tif->tif_mode != O_RDONLY )
  ------------------
  |  Branch (6649:13): [True: 211, False: 1.01k]
  |  Branch (6649:31): [True: 0, False: 211]
  ------------------
 6650|      0|            return;
 6651|  1.22k|	offset = TIFFGetStrileByteCount(tif, 0);
 6652|  1.22k|	assert(td->td_planarconfig == PLANARCONFIG_CONTIG);
 6653|  1.22k|	if ((td->td_photometric == PHOTOMETRIC_YCBCR)&&
  ------------------
  |  |  221|  1.22k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (6653:6): [True: 57, False: 1.17k]
  ------------------
 6654|  1.22k|	    (!isUpSampled(tif)))
  ------------------
  |  |  210|     57|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  105|     57|	#define TIFF_UPSAMPLED   0x04000U /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (6654:6): [True: 57, False: 0]
  ------------------
 6655|     57|		rowblock = td->td_ycbcrsubsampling[1];
 6656|  1.17k|	else
 6657|  1.17k|		rowblock = 1;
 6658|  1.22k|	rowblockbytes = TIFFVTileSize64(tif, rowblock);
 6659|       |	/*
 6660|       |	 * Make the rows hold at least one scanline, but fill specified amount
 6661|       |	 * of data if possible.
 6662|       |	 */
 6663|  1.22k|	if (rowblockbytes > STRIP_SIZE_DEFAULT) {
  ------------------
  |  |  113|  1.22k|#define STRIP_SIZE_DEFAULT 8192
  ------------------
  |  Branch (6663:6): [True: 641, False: 586]
  ------------------
 6664|    641|		stripbytes = rowblockbytes;
 6665|    641|		rowsperstrip = rowblock;
 6666|    641|	} else if (rowblockbytes > 0 ) {
  ------------------
  |  Branch (6666:13): [True: 310, False: 276]
  ------------------
 6667|    310|		uint32_t rowblocksperstrip;
 6668|    310|		rowblocksperstrip = (uint32_t) (STRIP_SIZE_DEFAULT / rowblockbytes);
  ------------------
  |  |  113|    310|#define STRIP_SIZE_DEFAULT 8192
  ------------------
 6669|    310|		rowsperstrip = rowblocksperstrip * rowblock;
 6670|    310|		stripbytes = rowblocksperstrip * rowblockbytes;
 6671|    310|	}
 6672|    276|	else
 6673|    276|	    return;
 6674|       |
 6675|       |	/*
 6676|       |	 * never increase the number of rows per strip
 6677|       |	 */
 6678|    951|	if (rowsperstrip >= td->td_rowsperstrip)
  ------------------
  |  Branch (6678:6): [True: 142, False: 809]
  ------------------
 6679|    142|		return;
 6680|    809|        nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
  ------------------
  |  |  242|    809|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 793, False: 16]
  |  |  ------------------
  |  |  243|    809|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|    809|			   0U)
  ------------------
 6681|    809|        if( nstrips == 0 )
  ------------------
  |  Branch (6681:13): [True: 66, False: 743]
  ------------------
 6682|     66|            return;
 6683|       |
 6684|       |        /* If we are going to allocate a lot of memory, make sure that the */
 6685|       |        /* file is as big as needed */
 6686|    743|        if( tif->tif_mode == O_RDONLY &&
  ------------------
  |  Branch (6686:13): [True: 743, False: 0]
  ------------------
 6687|    743|            nstrips > 1000000 &&
  ------------------
  |  Branch (6687:13): [True: 524, False: 219]
  ------------------
 6688|    743|            (offset >= TIFFGetFileSize(tif) ||
  ------------------
  |  |  220|  1.04k|	((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
  |  Branch (6688:14): [True: 457, False: 67]
  ------------------
 6689|    524|             stripbytes > (TIFFGetFileSize(tif) - offset) / (nstrips - 1)) )
  ------------------
  |  |  220|     67|	((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
  |  Branch (6689:14): [True: 18, False: 49]
  ------------------
 6690|    475|        {
 6691|    475|            return;
 6692|    475|        }
 6693|       |
 6694|    268|        allocChoppedUpStripArrays(tif, nstrips, stripbytes, rowsperstrip);
 6695|    268|}
tif_dirread.c:allocChoppedUpStripArrays:
 6560|    463|{
 6561|    463|    TIFFDirectory *td = &tif->tif_dir;
 6562|    463|    uint64_t bytecount;
 6563|    463|    uint64_t offset;
 6564|    463|    uint64_t last_offset;
 6565|    463|    uint64_t last_bytecount;
 6566|    463|    uint32_t i;
 6567|    463|    uint64_t *newcounts;
 6568|    463|    uint64_t *newoffsets;
 6569|       |
 6570|    463|    offset = TIFFGetStrileOffset(tif, 0);
 6571|    463|    last_offset = TIFFGetStrileOffset(tif, td->td_nstrips-1);
 6572|    463|    last_bytecount = TIFFGetStrileByteCount(tif, td->td_nstrips-1);
 6573|    463|    if( last_offset > UINT64_MAX - last_bytecount ||
  ------------------
  |  Branch (6573:9): [True: 60, False: 403]
  ------------------
 6574|    463|        last_offset + last_bytecount < offset )
  ------------------
  |  Branch (6574:9): [True: 1, False: 402]
  ------------------
 6575|     61|    {
 6576|     61|        return;
 6577|     61|    }
 6578|    402|    bytecount = last_offset + last_bytecount - offset;
 6579|       |
 6580|    402|    newcounts = (uint64_t*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64_t),
 6581|    402|                                             "for chopped \"StripByteCounts\" array");
 6582|    402|    newoffsets = (uint64_t*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64_t),
 6583|    402|                                              "for chopped \"StripOffsets\" array");
 6584|    402|    if (newcounts == NULL || newoffsets == NULL) {
  ------------------
  |  Branch (6584:9): [True: 0, False: 402]
  |  Branch (6584:30): [True: 0, False: 402]
  ------------------
 6585|       |        /*
 6586|       |        * Unable to allocate new strip information, give up and use
 6587|       |        * the original one strip information.
 6588|       |        */
 6589|      0|        if (newcounts != NULL)
  ------------------
  |  Branch (6589:13): [True: 0, False: 0]
  ------------------
 6590|      0|            _TIFFfree(newcounts);
 6591|      0|        if (newoffsets != NULL)
  ------------------
  |  Branch (6591:13): [True: 0, False: 0]
  ------------------
 6592|      0|            _TIFFfree(newoffsets);
 6593|      0|        return;
 6594|      0|    }
 6595|       |
 6596|       |    /*
 6597|       |     * Fill the strip information arrays with new bytecounts and offsets
 6598|       |     * that reflect the broken-up format.
 6599|       |     */
 6600|  2.69G|    for (i = 0; i < nstrips; i++)
  ------------------
  |  Branch (6600:17): [True: 2.69G, False: 402]
  ------------------
 6601|  2.69G|    {
 6602|  2.69G|        if (stripbytes > bytecount)
  ------------------
  |  Branch (6602:13): [True: 149, False: 2.69G]
  ------------------
 6603|    149|            stripbytes = bytecount;
 6604|  2.69G|        newcounts[i] = stripbytes;
 6605|  2.69G|        newoffsets[i] = stripbytes ? offset : 0;
  ------------------
  |  Branch (6605:25): [True: 2.69G, False: 334k]
  ------------------
 6606|  2.69G|        offset += stripbytes;
 6607|  2.69G|        bytecount -= stripbytes;
 6608|  2.69G|    }
 6609|       |
 6610|       |    /*
 6611|       |     * Replace old single strip info with multi-strip info.
 6612|       |     */
 6613|    402|    td->td_stripsperimage = td->td_nstrips = nstrips;
 6614|    402|    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
  ------------------
  |  |  252|    402|#define	TIFFTAG_ROWSPERSTRIP		278	/* rows per strip of data */
  ------------------
 6615|       |
 6616|    402|    _TIFFfree(td->td_stripbytecount_p);
 6617|    402|    _TIFFfree(td->td_stripoffset_p);
 6618|    402|    td->td_stripbytecount_p = newcounts;
 6619|    402|    td->td_stripoffset_p = newoffsets;
 6620|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 6621|       |    td->td_stripbytecountsorted = 1;
 6622|       |#endif
 6623|    402|    tif->tif_flags |= TIFF_CHOPPEDUPARRAYS;
  ------------------
  |  |  117|    402|        #define TIFF_CHOPPEDUPARRAYS 0x4000000U /* set when allocChoppedUpStripArrays() has modified strip array */
  ------------------
 6624|    402|}
tif_dirread.c:TryChopUpUncompressedBigTiff:
 6705|    660|{
 6706|    660|    TIFFDirectory *td = &tif->tif_dir;
 6707|    660|    uint32_t rowblock;
 6708|    660|    uint64_t rowblockbytes;
 6709|    660|    uint32_t i;
 6710|    660|    uint64_t stripsize;
 6711|    660|    uint32_t rowblocksperstrip;
 6712|    660|    uint32_t rowsperstrip;
 6713|    660|    uint64_t stripbytes;
 6714|    660|    uint32_t nstrips;
 6715|       |
 6716|    660|    stripsize = TIFFStripSize64(tif);
 6717|       |
 6718|    660|    assert( tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG );
 6719|    660|    assert( tif->tif_dir.td_compression == COMPRESSION_NONE );
 6720|    660|    assert( (tif->tif_flags&(TIFF_STRIPCHOP|TIFF_ISTILED)) == TIFF_STRIPCHOP );
 6721|    660|    assert( stripsize > 0x7FFFFFFFUL );
 6722|       |
 6723|       |    /* On a newly created file, just re-opened to be filled, we */
 6724|       |    /* don't want strip chop to trigger as it is going to cause issues */
 6725|       |    /* later ( StripOffsets and StripByteCounts improperly filled) . */
 6726|    660|    if( TIFFGetStrileByteCount(tif, 0) == 0 && tif->tif_mode != O_RDONLY )
  ------------------
  |  Branch (6726:9): [True: 11, False: 649]
  |  Branch (6726:48): [True: 0, False: 11]
  ------------------
 6727|      0|        return;
 6728|       |
 6729|    660|    if ((td->td_photometric == PHOTOMETRIC_YCBCR)&&
  ------------------
  |  |  221|    660|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (6729:9): [True: 5, False: 655]
  ------------------
 6730|    660|        (!isUpSampled(tif)))
  ------------------
  |  |  210|      5|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  105|      5|	#define TIFF_UPSAMPLED   0x04000U /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (6730:9): [True: 5, False: 0]
  ------------------
 6731|      5|        rowblock = td->td_ycbcrsubsampling[1];
 6732|    655|    else
 6733|    655|        rowblock = 1;
 6734|    660|    rowblockbytes = TIFFVStripSize64(tif, rowblock);
 6735|    660|    if( rowblockbytes == 0 || rowblockbytes > 0x7FFFFFFFUL )
  ------------------
  |  Branch (6735:9): [True: 0, False: 660]
  |  Branch (6735:31): [True: 71, False: 589]
  ------------------
 6736|     71|    {
 6737|       |        /* In case of file with gigantic width */
 6738|     71|        return;
 6739|     71|    }
 6740|       |
 6741|       |    /* Check that the strips are contiguous and of the expected size */
 6742|  1.14k|    for( i = 0; i < td->td_nstrips; i++ )
  ------------------
  |  Branch (6742:17): [True: 695, False: 447]
  ------------------
 6743|    695|    {
 6744|    695|        if( i == td->td_nstrips - 1 )
  ------------------
  |  Branch (6744:13): [True: 483, False: 212]
  ------------------
 6745|    483|        {
 6746|    483|            if( TIFFGetStrileByteCount(tif, i) < TIFFVStripSize64(
  ------------------
  |  Branch (6746:17): [True: 36, False: 447]
  ------------------
 6747|    483|                    tif, td->td_imagelength - i * td->td_rowsperstrip ) )
 6748|     36|            {
 6749|     36|                return;
 6750|     36|            }
 6751|    483|        }
 6752|    212|        else
 6753|    212|        {
 6754|    212|            if( TIFFGetStrileByteCount(tif, i) != stripsize )
  ------------------
  |  Branch (6754:17): [True: 4, False: 208]
  ------------------
 6755|      4|            {
 6756|      4|                return;
 6757|      4|            }
 6758|    208|            if( i > 0 && TIFFGetStrileOffset(tif, i) !=
  ------------------
  |  Branch (6758:17): [True: 105, False: 103]
  |  Branch (6758:26): [True: 102, False: 3]
  ------------------
 6759|    105|                    TIFFGetStrileOffset(tif, i-1) + TIFFGetStrileByteCount(tif, i-1) )
 6760|    102|            {
 6761|    102|                return;
 6762|    102|            }
 6763|    208|        }
 6764|    695|    }
 6765|       |
 6766|       |    /* Aim for 512 MB strips (that will still be manageable by 32 bit builds */
 6767|    447|    rowblocksperstrip = (uint32_t) (512 * 1024 * 1024 / rowblockbytes);
 6768|    447|    if( rowblocksperstrip == 0 )
  ------------------
  |  Branch (6768:9): [True: 8, False: 439]
  ------------------
 6769|      8|        rowblocksperstrip = 1;
 6770|    447|    rowsperstrip = rowblocksperstrip * rowblock;
 6771|    447|    stripbytes = rowblocksperstrip * rowblockbytes;
 6772|    447|    assert( stripbytes <= 0x7FFFFFFFUL );
 6773|       |
 6774|    447|    nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
  ------------------
  |  |  242|    447|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 425, False: 22]
  |  |  ------------------
  |  |  243|    447|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|    447|			   0U)
  ------------------
 6775|    447|    if( nstrips == 0 )
  ------------------
  |  Branch (6775:9): [True: 22, False: 425]
  ------------------
 6776|     22|        return;
 6777|       |
 6778|       |    /* If we are going to allocate a lot of memory, make sure that the */
 6779|       |    /* file is as big as needed */
 6780|    425|    if( tif->tif_mode == O_RDONLY &&
  ------------------
  |  Branch (6780:9): [True: 425, False: 0]
  ------------------
 6781|    425|        nstrips > 1000000 )
  ------------------
  |  Branch (6781:9): [True: 231, False: 194]
  ------------------
 6782|    231|    {
 6783|    231|        uint64_t last_offset = TIFFGetStrileOffset(tif, td->td_nstrips - 1);
 6784|    231|        uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  220|    231|	((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 6785|    231|        uint64_t last_bytecount = TIFFGetStrileByteCount(tif, td->td_nstrips - 1);
 6786|    231|        if( last_offset > filesize ||
  ------------------
  |  Branch (6786:13): [True: 152, False: 79]
  ------------------
 6787|    231|            last_bytecount > filesize - last_offset )
  ------------------
  |  Branch (6787:13): [True: 78, False: 1]
  ------------------
 6788|    230|        {
 6789|    230|            return;
 6790|    230|        }
 6791|    231|    }
 6792|       |
 6793|    195|    allocChoppedUpStripArrays(tif, nstrips, stripbytes, rowsperstrip);
 6794|    195|}
tif_dirread.c:_TIFFGetStrileOffsetOrByteCountValue:
 7075|  3.82M|{
 7076|  3.82M|    TIFFDirectory *td = &tif->tif_dir;
 7077|  3.82M|    if( pbErr )
  ------------------
  |  Branch (7077:9): [True: 1.96M, False: 1.86M]
  ------------------
 7078|  1.96M|        *pbErr = 0;
 7079|  3.82M|    if( (tif->tif_flags&TIFF_DEFERSTRILELOAD) && !(tif->tif_flags&TIFF_CHOPPEDUPARRAYS) )
  ------------------
  |  |  115|  3.82M|        #define TIFF_DEFERSTRILELOAD 0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
                  if( (tif->tif_flags&TIFF_DEFERSTRILELOAD) && !(tif->tif_flags&TIFF_CHOPPEDUPARRAYS) )
  ------------------
  |  |  117|      0|        #define TIFF_CHOPPEDUPARRAYS 0x4000000U /* set when allocChoppedUpStripArrays() has modified strip array */
  ------------------
  |  Branch (7079:9): [True: 0, False: 3.82M]
  |  Branch (7079:50): [True: 0, False: 0]
  ------------------
 7080|      0|    {
 7081|      0|        if( !(tif->tif_flags&TIFF_LAZYSTRILELOAD) ||
  ------------------
  |  |  116|      0|        #define TIFF_LAZYSTRILELOAD  0x2000000U /* lazy/ondemand loading of strip/tile offset/bytecount values. Only used if TIFF_DEFERSTRILELOAD is set and in read-only mode */
  ------------------
  |  Branch (7081:13): [True: 0, False: 0]
  ------------------
 7082|       |            /* If the values may fit in the toff_long/toff_long8 member */
 7083|       |            /* then use _TIFFFillStriles to simplify _TIFFFetchStrileValue */
 7084|      0|            dirent->tdir_count <= 4 )
  ------------------
  |  Branch (7084:13): [True: 0, False: 0]
  ------------------
 7085|      0|        {
 7086|      0|            if( !_TIFFFillStriles(tif) )
  ------------------
  |  Branch (7086:17): [True: 0, False: 0]
  ------------------
 7087|      0|            {
 7088|      0|                if( pbErr )
  ------------------
  |  Branch (7088:21): [True: 0, False: 0]
  ------------------
 7089|      0|                    *pbErr = 1;
 7090|       |                /* Do not return, as we want this function to always */
 7091|       |                /* return the same value if called several times with */
 7092|       |                /* the same arguments */
 7093|      0|            }
 7094|      0|        }
 7095|      0|        else
 7096|      0|        {
 7097|      0|             if( !_TIFFFetchStrileValue(tif, strile, dirent, parray) )
  ------------------
  |  Branch (7097:18): [True: 0, False: 0]
  ------------------
 7098|      0|             {
 7099|      0|                if( pbErr )
  ------------------
  |  Branch (7099:21): [True: 0, False: 0]
  ------------------
 7100|      0|                    *pbErr = 1;
 7101|      0|                 return 0;
 7102|      0|             }
 7103|      0|        }
 7104|      0|    }
 7105|  3.82M|    if( *parray == NULL || strile >= td->td_nstrips )
  ------------------
  |  Branch (7105:9): [True: 5.65k, False: 3.82M]
  |  Branch (7105:28): [True: 0, False: 3.82M]
  ------------------
 7106|  5.65k|    {
 7107|  5.65k|        if( pbErr )
  ------------------
  |  Branch (7107:13): [True: 5.65k, False: 0]
  ------------------
 7108|  5.65k|            *pbErr = 1;
 7109|  5.65k|        return 0;
 7110|  5.65k|    }
 7111|  3.82M|    return (*parray)[strile];
 7112|  3.82M|}
tif_dirread.c:_TIFFFillStrilesInternal:
 7151|  5.95k|{
 7152|  5.95k|    register TIFFDirectory *td = &tif->tif_dir;
 7153|  5.95k|    int return_value = 1;
 7154|       |
 7155|       |    /* Do not do anything if TIFF_DEFERSTRILELOAD is not set */
 7156|  5.95k|    if( !(tif->tif_flags&TIFF_DEFERSTRILELOAD) || (tif->tif_flags&TIFF_CHOPPEDUPARRAYS) != 0 )
  ------------------
  |  |  115|  5.95k|        #define TIFF_DEFERSTRILELOAD 0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
                  if( !(tif->tif_flags&TIFF_DEFERSTRILELOAD) || (tif->tif_flags&TIFF_CHOPPEDUPARRAYS) != 0 )
  ------------------
  |  |  117|      0|        #define TIFF_CHOPPEDUPARRAYS 0x4000000U /* set when allocChoppedUpStripArrays() has modified strip array */
  ------------------
  |  Branch (7156:9): [True: 5.95k, False: 0]
  |  Branch (7156:51): [True: 0, False: 0]
  ------------------
 7157|  5.95k|        return 1;
 7158|       |
 7159|      0|    if( tif->tif_flags&TIFF_LAZYSTRILELOAD )
  ------------------
  |  |  116|      0|        #define TIFF_LAZYSTRILELOAD  0x2000000U /* lazy/ondemand loading of strip/tile offset/bytecount values. Only used if TIFF_DEFERSTRILELOAD is set and in read-only mode */
  ------------------
  |  Branch (7159:9): [True: 0, False: 0]
  ------------------
 7160|      0|    {
 7161|       |        /* In case of lazy loading, reload completely the arrays */
 7162|      0|        _TIFFfree(td->td_stripoffset_p);
 7163|      0|        _TIFFfree(td->td_stripbytecount_p);
 7164|      0|        td->td_stripoffset_p = NULL;
 7165|      0|        td->td_stripbytecount_p = NULL;
 7166|      0|        td->td_stripoffsetbyteallocsize = 0;
 7167|      0|        tif->tif_flags &= ~TIFF_LAZYSTRILELOAD;
  ------------------
  |  |  116|      0|        #define TIFF_LAZYSTRILELOAD  0x2000000U /* lazy/ondemand loading of strip/tile offset/bytecount values. Only used if TIFF_DEFERSTRILELOAD is set and in read-only mode */
  ------------------
 7168|      0|    }
 7169|       |
 7170|       |    /* If stripoffset array is already loaded, exit with success */
 7171|      0|    if( td->td_stripoffset_p != NULL )
  ------------------
  |  Branch (7171:9): [True: 0, False: 0]
  ------------------
 7172|      0|            return 1;
 7173|       |
 7174|       |    /* If tdir_count was canceled, then we already got there, but in error */
 7175|      0|    if( td->td_stripoffset_entry.tdir_count == 0 )
  ------------------
  |  Branch (7175:9): [True: 0, False: 0]
  ------------------
 7176|      0|            return 0;
 7177|       |
 7178|      0|    if (!TIFFFetchStripThing(tif,&(td->td_stripoffset_entry),
  ------------------
  |  Branch (7178:9): [True: 0, False: 0]
  ------------------
 7179|      0|                                td->td_nstrips,&td->td_stripoffset_p))
 7180|      0|    {
 7181|      0|            return_value = 0;
 7182|      0|    }
 7183|       |
 7184|      0|    if (loadStripByteCount &&
  ------------------
  |  Branch (7184:9): [True: 0, False: 0]
  ------------------
 7185|      0|        !TIFFFetchStripThing(tif,&(td->td_stripbytecount_entry),
  ------------------
  |  Branch (7185:9): [True: 0, False: 0]
  ------------------
 7186|      0|                                td->td_nstrips,&td->td_stripbytecount_p))
 7187|      0|    {
 7188|      0|            return_value = 0;
 7189|      0|    }
 7190|       |
 7191|      0|    _TIFFmemset( &(td->td_stripoffset_entry), 0, sizeof(TIFFDirEntry));
 7192|      0|    _TIFFmemset( &(td->td_stripbytecount_entry), 0, sizeof(TIFFDirEntry));
 7193|       |
 7194|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 7195|       |    if (tif->tif_dir.td_nstrips > 1 && return_value == 1 ) {
 7196|       |            uint32_t strip;
 7197|       |
 7198|       |            tif->tif_dir.td_stripbytecountsorted = 1;
 7199|       |            for (strip = 1; strip < tif->tif_dir.td_nstrips; strip++) {
 7200|       |                    if (tif->tif_dir.td_stripoffset_p[strip - 1] >
 7201|       |                        tif->tif_dir.td_stripoffset_p[strip]) {
 7202|       |                            tif->tif_dir.td_stripbytecountsorted = 0;
 7203|       |                            break;
 7204|       |                    }
 7205|       |            }
 7206|       |    }
 7207|       |#endif
 7208|       |
 7209|      0|    return return_value;
 7210|      0|}

TIFFInitDumpMode:
  115|  23.1k|{
  116|  23.1k|	(void) scheme;
  117|  23.1k|	tif->tif_fixuptags = DumpFixupTags;  
  118|  23.1k|	tif->tif_decoderow = DumpModeDecode;
  119|  23.1k|	tif->tif_decodestrip = DumpModeDecode;
  120|  23.1k|	tif->tif_decodetile = DumpModeDecode;
  121|  23.1k|	tif->tif_encoderow = DumpModeEncode;
  122|  23.1k|	tif->tif_encodestrip = DumpModeEncode;
  123|  23.1k|	tif->tif_encodetile = DumpModeEncode; 
  124|  23.1k|	tif->tif_seek = DumpModeSeek;
  125|  23.1k|	return (1);
  126|  23.1k|}
tif_dumpmode.c:DumpFixupTags:
   34|  2.12k|{
   35|  2.12k|	(void) tif;
   36|  2.12k|	return (1);
   37|  2.12k|}
tif_dumpmode.c:DumpModeDecode:
   77|  1.87k|{
   78|  1.87k|	static const char module[] = "DumpModeDecode";
   79|  1.87k|	(void) s;
   80|  1.87k|	if (tif->tif_rawcc < cc) {
  ------------------
  |  Branch (80:6): [True: 304, False: 1.57k]
  ------------------
   81|    304|		TIFFErrorExtR(tif, module,
   82|    304|"Not enough data for scanline %"PRIu32", expected a request for at most %"TIFF_SSIZE_FORMAT" bytes, got a request for %"TIFF_SSIZE_FORMAT" bytes",
   83|    304|		             tif->tif_row,
   84|    304|		             tif->tif_rawcc,
   85|    304|		             cc);
   86|    304|		return (0);
   87|    304|	}
   88|       |	/*
   89|       |	 * Avoid copy if client has setup raw
   90|       |	 * data buffer to avoid extra copy.
   91|       |	 */
   92|  1.57k|	if (tif->tif_rawcp != buf)
  ------------------
  |  Branch (92:6): [True: 1.57k, False: 0]
  ------------------
   93|  1.57k|		_TIFFmemcpy(buf, tif->tif_rawcp, cc);
   94|  1.57k|	tif->tif_rawcp += cc;
   95|  1.57k|	tif->tif_rawcc -= cc;  
   96|  1.57k|	return (1);
   97|  1.87k|}

TIFFSetErrorHandler:
   34|  23.5k|{
   35|  23.5k|	TIFFErrorHandler prev = _TIFFerrorHandler;
   36|  23.5k|	_TIFFerrorHandler = handler;
   37|  23.5k|	return (prev);
   38|  23.5k|}
TIFFErrorExtR:
   85|  88.4M|{
   86|  88.4M|	va_list ap;
   87|  88.4M|	if (tif && tif->tif_errorhandler) {
  ------------------
  |  Branch (87:6): [True: 88.4M, False: 0]
  |  Branch (87:13): [True: 0, False: 88.4M]
  ------------------
   88|      0|		va_start(ap, fmt);
   89|      0|		int stop = (*tif->tif_errorhandler)(tif->tif_clientdata, module, fmt, ap);
   90|      0|		va_end(ap);
   91|      0|		if (stop) return;
  ------------------
  |  Branch (91:7): [True: 0, False: 0]
  ------------------
   92|      0|	}
   93|  88.4M|	if (_TIFFerrorHandler) {
  ------------------
  |  Branch (93:6): [True: 88.4M, False: 0]
  ------------------
   94|  88.4M|		va_start(ap, fmt);	
   95|  88.4M|		(*_TIFFerrorHandler)(module, fmt, ap);
   96|  88.4M|		va_end(ap);
   97|  88.4M|	}
   98|  88.4M|	if (_TIFFerrorHandlerExt) {
  ------------------
  |  Branch (98:6): [True: 0, False: 88.4M]
  ------------------
   99|      0|		va_start(ap, fmt);
  100|      0|		(*_TIFFerrorHandlerExt)(tif ? tif->tif_clientdata : NULL, module, fmt, ap);
  ------------------
  |  Branch (100:27): [True: 0, False: 0]
  ------------------
  101|      0|		va_end(ap);
  102|      0|	}
  103|  88.4M|}

_TIFFFax3fillruns:
  350|  89.1M|{
  351|  89.1M|	static const unsigned char _fillmasks[] =
  352|  89.1M|	    { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
  353|  89.1M|	unsigned char* cp;
  354|  89.1M|	uint32_t x, bx, run;
  355|  89.1M|	int32_t n, nw;
  356|  89.1M|	int64_t* lp;
  357|       |
  358|  89.1M|	if ((erun-runs)&1)
  ------------------
  |  Branch (358:6): [True: 88.7M, False: 337k]
  ------------------
  359|  88.7M|	    *erun++ = 0;
  360|  89.1M|	x = 0;
  361|   180M|	for (; runs < erun; runs += 2) {
  ------------------
  |  Branch (361:9): [True: 91.2M, False: 89.1M]
  ------------------
  362|  91.2M|	    run = runs[0];
  363|  91.2M|	    if (x+run > lastx || run > lastx )
  ------------------
  |  Branch (363:10): [True: 697k, False: 90.5M]
  |  Branch (363:27): [True: 0, False: 90.5M]
  ------------------
  364|   697k|		run = runs[0] = (uint32_t) (lastx - x);
  365|  91.2M|	    if (run) {
  ------------------
  |  Branch (365:10): [True: 90.3M, False: 878k]
  ------------------
  366|  90.3M|		cp = buf + (x>>3);
  367|  90.3M|		bx = x&7;
  368|  90.3M|		if (run > 8-bx) {
  ------------------
  |  Branch (368:7): [True: 89.2M, False: 1.08M]
  ------------------
  369|  89.2M|		    if (bx) {			/* align to byte boundary */
  ------------------
  |  Branch (369:11): [True: 836k, False: 88.4M]
  ------------------
  370|   836k|			*cp++ &= 0xff << (8-bx);
  371|   836k|			run -= 8-bx;
  372|   836k|		    }
  373|  89.2M|		    if( (n = run >> 3) != 0 ) {	/* multiple bytes to fill */
  ------------------
  |  Branch (373:11): [True: 88.8M, False: 409k]
  ------------------
  374|  88.8M|			if ((n/sizeof (int64_t)) > 1) {
  ------------------
  |  Branch (374:8): [True: 924k, False: 87.9M]
  ------------------
  375|       |			    /*
  376|       |			     * Align to int64_tword boundary and fill.
  377|       |			     */
  378|  2.36M|			    for (; n && !isAligned(cp, int64_t); n--)
  ------------------
  |  |   92|  2.36M|#define isAligned(p,t) ((((size_t)(p)) & (sizeof (t)-1)) == 0)
  ------------------
  |  Branch (378:15): [True: 2.36M, False: 0]
  |  Branch (378:20): [True: 1.43M, False: 924k]
  ------------------
  379|  1.43M|				    *cp++ = 0x00;
  380|   924k|			    lp = (int64_t*) cp;
  381|   924k|			    nw = (int32_t)(n / sizeof (int64_t));
  382|   924k|			    n -= nw * sizeof (int64_t);
  383|  1.28G|			    do {
  384|  1.28G|				    *lp++ = 0L;
  385|  1.28G|			    } while (--nw);
  ------------------
  |  Branch (385:17): [True: 1.28G, False: 924k]
  ------------------
  386|   924k|			    cp = (unsigned char*) lp;
  387|   924k|			}
  388|  88.8M|			ZERO(n, cp);
  ------------------
  |  |  338|   359M|    for (int32_t izero = 0; izero < (n); ++izero) \
  |  |  ------------------
  |  |  |  Branch (338:29): [True: 270M, False: 88.8M]
  |  |  ------------------
  |  |  339|   270M|    {                                             \
  |  |  340|   270M|        (cp)[izero] = 0;                          \
  |  |  341|   270M|    }                                             \
  |  |  342|  88.8M|    (cp) += (n);
  ------------------
  389|  88.8M|			run &= 7;
  390|  88.8M|		    }
  391|  89.2M|		    if (run)
  ------------------
  |  Branch (391:11): [True: 89.0M, False: 221k]
  ------------------
  392|  89.0M|			cp[0] &= 0xff >> run;
  393|  89.2M|		} else
  394|  1.08M|		    cp[0] &= ~(_fillmasks[run]>>bx);
  395|  90.3M|		x += runs[0];
  396|  90.3M|	    }
  397|  91.2M|	    run = runs[1];
  398|  91.2M|	    if (x+run > lastx || run > lastx )
  ------------------
  |  Branch (398:10): [True: 0, False: 91.2M]
  |  Branch (398:27): [True: 0, False: 91.2M]
  ------------------
  399|      0|		run = runs[1] = lastx - x;
  400|  91.2M|	    if (run) {
  ------------------
  |  Branch (400:10): [True: 1.38M, False: 89.8M]
  ------------------
  401|  1.38M|		cp = buf + (x>>3);
  402|  1.38M|		bx = x&7;
  403|  1.38M|		if (run > 8-bx) {
  ------------------
  |  Branch (403:7): [True: 628k, False: 760k]
  ------------------
  404|   628k|		    if (bx) {			/* align to byte boundary */
  ------------------
  |  Branch (404:11): [True: 610k, False: 17.9k]
  ------------------
  405|   610k|			*cp++ |= 0xff >> bx;
  406|   610k|			run -= 8-bx;
  407|   610k|		    }
  408|   628k|		    if( (n = run>>3) != 0 ) {	/* multiple bytes to fill */
  ------------------
  |  Branch (408:11): [True: 154k, False: 474k]
  ------------------
  409|   154k|			if ((n/sizeof (int64_t)) > 1) {
  ------------------
  |  Branch (409:8): [True: 67.5k, False: 86.8k]
  ------------------
  410|       |			    /*
  411|       |			     * Align to int64_t boundary and fill.
  412|       |			     */
  413|   374k|			    for (; n && !isAligned(cp, int64_t); n--)
  ------------------
  |  |   92|   374k|#define isAligned(p,t) ((((size_t)(p)) & (sizeof (t)-1)) == 0)
  ------------------
  |  Branch (413:15): [True: 374k, False: 0]
  |  Branch (413:20): [True: 306k, False: 67.5k]
  ------------------
  414|   306k|				*cp++ = 0xff;
  415|  67.5k|			    lp = (int64_t*) cp;
  416|  67.5k|			    nw = (int32_t)(n / sizeof (int64_t));
  417|  67.5k|			    n -= nw * sizeof (int64_t);
  418|   135M|			    do {
  419|   135M|				*lp++ = -1L;
  420|   135M|			    } while (--nw);
  ------------------
  |  Branch (420:17): [True: 135M, False: 67.5k]
  ------------------
  421|  67.5k|			    cp = (unsigned char*) lp;
  422|  67.5k|			}
  423|   154k|			FILL(n, cp);
  ------------------
  |  |  331|   831k|    for (int32_t ifill = 0; ifill < (n); ++ifill) \
  |  |  ------------------
  |  |  |  Branch (331:29): [True: 677k, False: 154k]
  |  |  ------------------
  |  |  332|   677k|    {                                             \
  |  |  333|   677k|        (cp)[ifill] = 0xff;                       \
  |  |  334|   677k|    }                                             \
  |  |  335|   154k|    (cp) += (n);
  ------------------
  424|   154k|			run &= 7;
  425|   154k|		    }
  426|       |                    /* Explicit 0xff masking to make icc -check=conversions happy */
  427|   628k|		    if (run)
  ------------------
  |  Branch (427:11): [True: 606k, False: 21.6k]
  ------------------
  428|   606k|			cp[0] = (unsigned char)((cp[0] | (0xff00 >> run))&0xff);
  429|   628k|		} else
  430|   760k|		    cp[0] |= _fillmasks[run]>>bx;
  431|  1.38M|		x += runs[1];
  432|  1.38M|	    }
  433|  91.2M|	}
  434|  89.1M|	assert(x == lastx);
  435|  89.1M|}
TIFFInitCCITTFax3:
 1379|  1.19k|{
 1380|  1.19k|	(void) scheme;
 1381|  1.19k|	if (InitCCITTFax3(tif)) {
  ------------------
  |  Branch (1381:6): [True: 1.19k, False: 0]
  ------------------
 1382|       |		/*
 1383|       |		 * Merge codec-specific tag information.
 1384|       |		 */
 1385|  1.19k|		if (!_TIFFMergeFields(tif, fax3Fields,
  ------------------
  |  Branch (1385:7): [True: 0, False: 1.19k]
  ------------------
 1386|  1.19k|				      TIFFArrayCount(fax3Fields))) {
  ------------------
  |  |  261|  1.19k|#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
  ------------------
 1387|      0|			TIFFErrorExtR(tif, "TIFFInitCCITTFax3",
 1388|      0|			"Merging CCITT Fax 3 codec-specific tags failed");
 1389|      0|			return 0;
 1390|      0|		}
 1391|       |
 1392|       |		/*
 1393|       |		 * The default format is Class/F-style w/o RTC.
 1394|       |		 */
 1395|  1.19k|		return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
  ------------------
  |  |  607|  1.19k|#define	TIFFTAG_FAXMODE			65536	/* Group 3/4 format control */
  ------------------
              		return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
  ------------------
  |  |  613|  1.19k|#define	    FAXMODE_CLASSF	FAXMODE_NORTC	/* TIFF Class F */
  |  |  ------------------
  |  |  |  |  609|  1.19k|#define	    FAXMODE_NORTC	0x0001		/* no RTC at end of data */
  |  |  ------------------
  ------------------
 1396|  1.19k|	} else
 1397|      0|		return 01;
 1398|  1.19k|}
TIFFInitCCITTFax4:
 1511|    709|{
 1512|    709|	(void) scheme;
 1513|    709|	if (InitCCITTFax3(tif)) {		/* reuse G3 support */
  ------------------
  |  Branch (1513:6): [True: 709, False: 0]
  ------------------
 1514|       |		/*
 1515|       |		 * Merge codec-specific tag information.
 1516|       |		 */
 1517|    709|		if (!_TIFFMergeFields(tif, fax4Fields,
  ------------------
  |  Branch (1517:7): [True: 0, False: 709]
  ------------------
 1518|    709|				      TIFFArrayCount(fax4Fields))) {
  ------------------
  |  |  261|    709|#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
  ------------------
 1519|      0|			TIFFErrorExtR(tif, "TIFFInitCCITTFax4",
 1520|      0|			"Merging CCITT Fax 4 codec-specific tags failed");
 1521|      0|			return 0;
 1522|      0|		}
 1523|       |
 1524|    709|		tif->tif_decoderow = Fax4Decode;
 1525|    709|		tif->tif_decodestrip = Fax4Decode;
 1526|    709|		tif->tif_decodetile = Fax4Decode;
 1527|    709|		tif->tif_encoderow = Fax4Encode;
 1528|    709|		tif->tif_encodestrip = Fax4Encode;
 1529|    709|		tif->tif_encodetile = Fax4Encode;
 1530|    709|		tif->tif_postencode = Fax4PostEncode;
 1531|       |		/*
 1532|       |		 * Suppress RTC at the end of each strip.
 1533|       |		 */
 1534|    709|		return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC);
  ------------------
  |  |  607|    709|#define	TIFFTAG_FAXMODE			65536	/* Group 3/4 format control */
  ------------------
              		return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC);
  ------------------
  |  |  609|    709|#define	    FAXMODE_NORTC	0x0001		/* no RTC at end of data */
  ------------------
 1535|    709|	} else
 1536|      0|		return (0);
 1537|    709|}
TIFFInitCCITTRLE:
 1598|    196|{
 1599|    196|	(void) scheme;
 1600|    196|	if (InitCCITTFax3(tif)) {		/* reuse G3 support */
  ------------------
  |  Branch (1600:6): [True: 196, False: 0]
  ------------------
 1601|    196|		tif->tif_decoderow = Fax3DecodeRLE;
 1602|    196|		tif->tif_decodestrip = Fax3DecodeRLE;
 1603|    196|		tif->tif_decodetile = Fax3DecodeRLE;
 1604|       |		/*
 1605|       |		 * Suppress RTC+EOLs when encoding and byte-align data.
 1606|       |		 */
 1607|    196|		return TIFFSetField(tif, TIFFTAG_FAXMODE,
  ------------------
  |  |  607|    196|#define	TIFFTAG_FAXMODE			65536	/* Group 3/4 format control */
  ------------------
 1608|    196|		    FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_BYTEALIGN);
  ------------------
  |  |  609|    196|#define	    FAXMODE_NORTC	0x0001		/* no RTC at end of data */
  ------------------
              		    FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_BYTEALIGN);
  ------------------
  |  |  610|    196|#define	    FAXMODE_NOEOL	0x0002		/* no EOL code at end of row */
  ------------------
              		    FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_BYTEALIGN);
  ------------------
  |  |  611|    196|#define	    FAXMODE_BYTEALIGN	0x0004		/* byte align row */
  ------------------
 1609|    196|	} else
 1610|      0|		return (0);
 1611|    196|}
TIFFInitCCITTRLEW:
 1615|     72|{
 1616|     72|	(void) scheme;
 1617|     72|	if (InitCCITTFax3(tif)) {		/* reuse G3 support */
  ------------------
  |  Branch (1617:6): [True: 72, False: 0]
  ------------------
 1618|     72|		tif->tif_decoderow = Fax3DecodeRLE;
 1619|     72|		tif->tif_decodestrip = Fax3DecodeRLE;
 1620|     72|		tif->tif_decodetile = Fax3DecodeRLE;  
 1621|       |		/*
 1622|       |		 * Suppress RTC+EOLs when encoding and word-align data.
 1623|       |		 */
 1624|     72|		return TIFFSetField(tif, TIFFTAG_FAXMODE,
  ------------------
  |  |  607|     72|#define	TIFFTAG_FAXMODE			65536	/* Group 3/4 format control */
  ------------------
 1625|     72|		    FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_WORDALIGN);
  ------------------
  |  |  609|     72|#define	    FAXMODE_NORTC	0x0001		/* no RTC at end of data */
  ------------------
              		    FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_WORDALIGN);
  ------------------
  |  |  610|     72|#define	    FAXMODE_NOEOL	0x0002		/* no EOL code at end of row */
  ------------------
              		    FAXMODE_NORTC|FAXMODE_NOEOL|FAXMODE_WORDALIGN);
  ------------------
  |  |  612|     72|#define	    FAXMODE_WORDALIGN	0x0008		/* word align row */
  ------------------
 1626|     72|	} else
 1627|      0|		return (0);
 1628|     72|}
tif_fax3.c:InitCCITTFax3:
 1310|  2.16k|{
 1311|  2.16k|	static const char module[] = "InitCCITTFax3";
 1312|  2.16k|	Fax3BaseState* sp;
 1313|       |
 1314|       |	/*
 1315|       |	 * Merge codec-specific tag information.
 1316|       |	 */
 1317|  2.16k|	if (!_TIFFMergeFields(tif, faxFields, TIFFArrayCount(faxFields))) {
  ------------------
  |  |  261|  2.16k|#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
  ------------------
  |  Branch (1317:6): [True: 0, False: 2.16k]
  ------------------
 1318|      0|		TIFFErrorExtR(tif, "InitCCITTFax3",
 1319|      0|			"Merging common CCITT Fax codec-specific tags failed");
 1320|      0|		return 0;
 1321|      0|	}
 1322|       |
 1323|       |	/*
 1324|       |	 * Allocate state block so tag methods have storage to record values.
 1325|       |	 */
 1326|  2.16k|	tif->tif_data = (uint8_t*)
 1327|  2.16k|		_TIFFmalloc(sizeof (Fax3CodecState));
 1328|       |
 1329|  2.16k|	if (tif->tif_data == NULL) {
  ------------------
  |  Branch (1329:6): [True: 0, False: 2.16k]
  ------------------
 1330|      0|		TIFFErrorExtR(tif, module,
 1331|      0|		    "No space for state block");
 1332|      0|		return (0);
 1333|      0|	}
 1334|  2.16k|	_TIFFmemset(tif->tif_data, 0, sizeof (Fax3CodecState));
 1335|       |
 1336|  2.16k|	sp = Fax3State(tif);
  ------------------
  |  |   63|  2.16k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  ------------------
 1337|  2.16k|        sp->rw_mode = tif->tif_mode;
 1338|       |
 1339|       |	/*
 1340|       |	 * Override parent get/set field methods.
 1341|       |	 */
 1342|  2.16k|	sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1343|  2.16k|	tif->tif_tagmethods.vgetfield = Fax3VGetField; /* hook for codec tags */
 1344|  2.16k|	sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1345|  2.16k|	tif->tif_tagmethods.vsetfield = Fax3VSetField; /* hook for codec tags */
 1346|  2.16k|	sp->printdir = tif->tif_tagmethods.printdir;
 1347|  2.16k|	tif->tif_tagmethods.printdir = Fax3PrintDir;   /* hook for codec tags */
 1348|  2.16k|	sp->groupoptions = 0;	
 1349|       |
 1350|  2.16k|	if (sp->rw_mode == O_RDONLY) /* FIXME: improve for in place update */
  ------------------
  |  Branch (1350:6): [True: 2.16k, False: 0]
  ------------------
 1351|  2.16k|		tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */
  ------------------
  |  |   99|  2.16k|	#define TIFF_NOBITREV    0x00100U /* inhibit bit reversal logic */
  ------------------
 1352|  2.16k|	DecoderState(tif)->runs = NULL;
  ------------------
  |  |   88|  2.16k|#define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  ------------------
  |  |  |  |   63|  2.16k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
 1353|  2.16k|	TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns);
  ------------------
  |  |  623|  2.16k|#define	TIFFTAG_FAXFILLFUNC		65540	/* G3/G4 fill function */
  ------------------
 1354|  2.16k|	EncoderState(tif)->refline = NULL;
  ------------------
  |  |   89|  2.16k|#define EncoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  ------------------
  |  |  |  |   63|  2.16k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
 1355|       |
 1356|       |	/*
 1357|       |	 * Install codec methods.
 1358|       |	 */
 1359|  2.16k|	tif->tif_fixuptags = Fax3FixupTags;
 1360|  2.16k|	tif->tif_setupdecode = Fax3SetupState;
 1361|  2.16k|	tif->tif_predecode = Fax3PreDecode;
 1362|  2.16k|	tif->tif_decoderow = Fax3Decode1D;
 1363|  2.16k|	tif->tif_decodestrip = Fax3Decode1D;
 1364|  2.16k|	tif->tif_decodetile = Fax3Decode1D;
 1365|  2.16k|	tif->tif_setupencode = Fax3SetupState;
 1366|  2.16k|	tif->tif_preencode = Fax3PreEncode;
 1367|  2.16k|	tif->tif_postencode = Fax3PostEncode;
 1368|  2.16k|	tif->tif_encoderow = Fax3Encode;
 1369|  2.16k|	tif->tif_encodestrip = Fax3Encode;
 1370|  2.16k|	tif->tif_encodetile = Fax3Encode;
 1371|  2.16k|	tif->tif_close = Fax3Close;
 1372|  2.16k|	tif->tif_cleanup = Fax3Cleanup;
 1373|       |
 1374|  2.16k|	return (1);
 1375|  2.16k|}
tif_fax3.c:Fax3VGetField:
 1219|  21.2k|{
 1220|  21.2k|	Fax3BaseState* sp = Fax3State(tif);
  ------------------
  |  |   63|  21.2k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  ------------------
 1221|       |
 1222|  21.2k|	assert(sp != 0);
 1223|       |
 1224|  21.2k|	switch (tag) {
 1225|      0|	case TIFFTAG_FAXMODE:
  ------------------
  |  |  607|      0|#define	TIFFTAG_FAXMODE			65536	/* Group 3/4 format control */
  ------------------
  |  Branch (1225:2): [True: 0, False: 21.2k]
  ------------------
 1226|      0|		*va_arg(ap, int*) = sp->mode;
 1227|      0|		break;
 1228|      0|	case TIFFTAG_FAXFILLFUNC:
  ------------------
  |  |  623|      0|#define	TIFFTAG_FAXFILLFUNC		65540	/* G3/G4 fill function */
  ------------------
  |  Branch (1228:2): [True: 0, False: 21.2k]
  ------------------
 1229|      0|		*va_arg(ap, TIFFFaxFillFunc*) = DecoderState(tif)->fill;
  ------------------
  |  |   88|      0|#define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  ------------------
  |  |  |  |   63|      0|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
 1230|      0|		break;
 1231|      0|	case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  273|      0|#define	TIFFTAG_GROUP3OPTIONS		292	/* 32 flag bits */
  ------------------
  |  Branch (1231:2): [True: 0, False: 21.2k]
  ------------------
 1232|      0|	case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  278|      0|#define	TIFFTAG_GROUP4OPTIONS		293	/* 32 flag bits */
  ------------------
  |  Branch (1232:2): [True: 0, False: 21.2k]
  ------------------
 1233|      0|		*va_arg(ap, uint32_t*) = sp->groupoptions;
 1234|      0|		break;
 1235|      0|	case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  309|      0|#define	TIFFTAG_BADFAXLINES		326	/* lines w/ wrong pixel count */
  ------------------
  |  Branch (1235:2): [True: 0, False: 21.2k]
  ------------------
 1236|      0|		*va_arg(ap, uint32_t*) = sp->badfaxlines;
 1237|      0|		break;
 1238|      0|	case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  310|      0|#define	TIFFTAG_CLEANFAXDATA		327	/* regenerated line info */
  ------------------
  |  Branch (1238:2): [True: 0, False: 21.2k]
  ------------------
 1239|      0|		*va_arg(ap, uint16_t*) = sp->cleanfaxdata;
 1240|      0|		break;
 1241|      0|	case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  314|      0|#define	TIFFTAG_CONSECUTIVEBADFAXLINES	328	/* max consecutive bad lines */
  ------------------
  |  Branch (1241:2): [True: 0, False: 21.2k]
  ------------------
 1242|      0|		*va_arg(ap, uint32_t*) = sp->badfaxrun;
 1243|      0|		break;
 1244|  21.2k|	default:
  ------------------
  |  Branch (1244:2): [True: 21.2k, False: 0]
  ------------------
 1245|  21.2k|		return (*sp->vgetparent)(tif, tag, ap);
 1246|  21.2k|	}
 1247|      0|	return (1);
 1248|  21.2k|}
tif_fax3.c:Fax3VSetField:
 1171|  15.0k|{
 1172|  15.0k|	Fax3BaseState* sp = Fax3State(tif);
  ------------------
  |  |   63|  15.0k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  ------------------
 1173|  15.0k|	const TIFFField* fip;
 1174|       |
 1175|  15.0k|	assert(sp != 0);
 1176|  15.0k|	assert(sp->vsetparent != 0);
 1177|       |
 1178|  15.0k|	switch (tag) {
 1179|  2.16k|	case TIFFTAG_FAXMODE:
  ------------------
  |  |  607|  2.16k|#define	TIFFTAG_FAXMODE			65536	/* Group 3/4 format control */
  ------------------
  |  Branch (1179:2): [True: 2.16k, False: 12.8k]
  ------------------
 1180|  2.16k|		sp->mode = (int) va_arg(ap, int);
 1181|  2.16k|		return 1;			/* NB: pseudo tag */
 1182|  2.16k|	case TIFFTAG_FAXFILLFUNC:
  ------------------
  |  |  623|  2.16k|#define	TIFFTAG_FAXFILLFUNC		65540	/* G3/G4 fill function */
  ------------------
  |  Branch (1182:2): [True: 2.16k, False: 12.8k]
  ------------------
 1183|  2.16k|		DecoderState(tif)->fill = va_arg(ap, TIFFFaxFillFunc);
  ------------------
  |  |   88|  2.16k|#define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  ------------------
  |  |  |  |   63|  2.16k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
 1184|  2.16k|		return 1;			/* NB: pseudo tag */
 1185|    797|	case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  273|    797|#define	TIFFTAG_GROUP3OPTIONS		292	/* 32 flag bits */
  ------------------
  |  Branch (1185:2): [True: 797, False: 14.2k]
  ------------------
 1186|       |		/* XXX: avoid reading options if compression mismatches. */
 1187|    797|		if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
  ------------------
  |  |  178|    797|#define	    COMPRESSION_CCITTFAX3	3	/* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1187:7): [True: 797, False: 0]
  ------------------
 1188|    797|			sp->groupoptions = (uint32_t) va_arg(ap, uint32_t);
 1189|    797|		break;
 1190|      2|	case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  278|      2|#define	TIFFTAG_GROUP4OPTIONS		293	/* 32 flag bits */
  ------------------
  |  Branch (1190:2): [True: 2, False: 15.0k]
  ------------------
 1191|       |		/* XXX: avoid reading options if compression mismatches. */
 1192|      2|		if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)
  ------------------
  |  |  180|      2|#define	    COMPRESSION_CCITTFAX4	4	/* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (1192:7): [True: 2, False: 0]
  ------------------
 1193|      2|			sp->groupoptions = (uint32_t) va_arg(ap, uint32_t);
 1194|      2|		break;
 1195|      4|	case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  309|      4|#define	TIFFTAG_BADFAXLINES		326	/* lines w/ wrong pixel count */
  ------------------
  |  Branch (1195:2): [True: 4, False: 15.0k]
  ------------------
 1196|      4|		sp->badfaxlines = (uint32_t) va_arg(ap, uint32_t);
 1197|      4|		break;
 1198|      3|	case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  310|      3|#define	TIFFTAG_CLEANFAXDATA		327	/* regenerated line info */
  ------------------
  |  Branch (1198:2): [True: 3, False: 15.0k]
  ------------------
 1199|      3|		sp->cleanfaxdata = (uint16_t) va_arg(ap, uint16_vap);
 1200|      3|		break;
 1201|      3|	case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  314|      3|#define	TIFFTAG_CONSECUTIVEBADFAXLINES	328	/* max consecutive bad lines */
  ------------------
  |  Branch (1201:2): [True: 3, False: 15.0k]
  ------------------
 1202|      3|		sp->badfaxrun = (uint32_t) va_arg(ap, uint32_t);
 1203|      3|		break;
 1204|  9.89k|	default:
  ------------------
  |  Branch (1204:2): [True: 9.89k, False: 5.14k]
  ------------------
 1205|  9.89k|		return (*sp->vsetparent)(tif, tag, ap);
 1206|  15.0k|	}
 1207|       |	
 1208|    809|	if ((fip = TIFFFieldWithTag(tif, tag)) != NULL)
  ------------------
  |  Branch (1208:6): [True: 809, False: 0]
  ------------------
 1209|    809|		TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  199|    809|#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  197|    809|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  196|    809|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
 1210|      0|	else
 1211|      0|		return 0;
 1212|       |
 1213|    809|	tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |   94|    809|	#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1214|    809|	return 1;
 1215|    809|}
tif_fax3.c:Fax3FixupTags:
  441|  1.98k|{
  442|  1.98k|	(void) tif;
  443|  1.98k|	return (1);
  444|  1.98k|}
tif_fax3.c:Fax3SetupState:
  455|  1.89k|{
  456|  1.89k|	static const char module[] = "Fax3SetupState";
  457|  1.89k|	TIFFDirectory* td = &tif->tif_dir;
  458|  1.89k|	Fax3BaseState* sp = Fax3State(tif);
  ------------------
  |  |   63|  1.89k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  ------------------
  459|  1.89k|	int needsRefLine;
  460|  1.89k|	Fax3CodecState* dsp = (Fax3CodecState*) Fax3State(tif);
  ------------------
  |  |   63|  1.89k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  ------------------
  461|  1.89k|	tmsize_t rowbytes;
  462|  1.89k|	uint32_t rowpixels;
  463|       |
  464|  1.89k|	if (td->td_bitspersample != 1) {
  ------------------
  |  Branch (464:6): [True: 4, False: 1.88k]
  ------------------
  465|      4|		TIFFErrorExtR(tif, module,
  466|      4|		    "Bits/sample must be 1 for Group 3/4 encoding/decoding");
  467|      4|		return (0);
  468|      4|	}
  469|       |	/*
  470|       |	 * Calculate the scanline/tile widths.
  471|       |	 */
  472|  1.88k|	if (isTiled(tif)) {
  ------------------
  |  |  207|  1.88k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  1.88k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 1.88k, False: 0]
  |  |  ------------------
  ------------------
  473|  1.88k|		rowbytes = TIFFTileRowSize(tif);
  474|  1.88k|		rowpixels = td->td_tilewidth;
  475|  1.88k|	} else {
  476|      0|		rowbytes = TIFFScanlineSize(tif);
  477|      0|		rowpixels = td->td_imagewidth;
  478|      0|	}
  479|  1.88k|	if ((int64_t)rowbytes < ((int64_t)rowpixels + 7) / 8)
  ------------------
  |  Branch (479:6): [True: 0, False: 1.88k]
  ------------------
  480|      0|	{
  481|      0|		TIFFErrorExtR(tif, module,
  482|      0|			"Inconsistent number of bytes per row : rowbytes=%" PRId64 " rowpixels=%" PRIu32,
  483|      0|                     (int64_t) rowbytes, rowpixels);
  484|      0|		return (0);
  485|      0|	}
  486|  1.88k|	sp->rowbytes = rowbytes;
  487|  1.88k|	sp->rowpixels = rowpixels;
  488|       |	/*
  489|       |	 * Allocate any additional space required for decoding/encoding.
  490|       |	 */
  491|  1.88k|	needsRefLine = (
  492|  1.88k|	    (sp->groupoptions & GROUP3OPT_2DENCODING) ||
  ------------------
  |  |  275|  1.88k|#define	    GROUP3OPT_2DENCODING	0x1	/* 2-dimensional coding */
  ------------------
  |  Branch (492:6): [True: 759, False: 1.12k]
  ------------------
  493|  1.88k|	    td->td_compression == COMPRESSION_CCITTFAX4
  ------------------
  |  |  180|  1.12k|#define	    COMPRESSION_CCITTFAX4	4	/* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (493:6): [True: 593, False: 534]
  ------------------
  494|  1.88k|	);
  495|       |
  496|       |	/*
  497|       |	  Assure that allocation computations do not overflow.
  498|       |	  
  499|       |	  TIFFroundup and TIFFSafeMultiply return zero on integer overflow
  500|       |	*/
  501|  1.88k|	dsp->runs=(uint32_t*) NULL;
  502|  1.88k|	dsp->nruns = TIFFroundup_32(rowpixels,32);
  ------------------
  |  |  250|  1.88k|#define TIFFroundup_32(x, y) (TIFFhowmany_32(x,y)*(y))
  |  |  ------------------
  |  |  |  |  242|  1.88k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (242:31): [True: 1.88k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  243|  1.88k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  |  |  244|  1.88k|			   0U)
  |  |  ------------------
  ------------------
  503|  1.88k|	if (needsRefLine) {
  ------------------
  |  Branch (503:6): [True: 1.35k, False: 534]
  ------------------
  504|  1.35k|		dsp->nruns = TIFFSafeMultiply(uint32_t, dsp->nruns, 2);
  ------------------
  |  |  256|  1.35k|#define TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
  |  |  ------------------
  |  |  |  Branch (256:35): [Folded - Ignored]
  |  |  |  Branch (256:55): [True: 1.35k, False: 0]
  |  |  ------------------
  ------------------
  505|  1.35k|	}
  506|  1.88k|	if ((dsp->nruns == 0) || (TIFFSafeMultiply(uint32_t, dsp->nruns, 2) == 0)) {
  ------------------
  |  |  256|  1.88k|#define TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
  |  |  ------------------
  |  |  |  Branch (256:35): [Folded - Ignored]
  |  |  |  Branch (256:55): [True: 1.88k, False: 1]
  |  |  ------------------
  ------------------
  |  Branch (506:6): [True: 0, False: 1.88k]
  |  Branch (506:27): [True: 1, False: 1.88k]
  ------------------
  507|      1|		TIFFErrorExtR(tif, tif->tif_name,
  508|      1|			     "Row pixels integer overflow (rowpixels %"PRIu32")",
  509|      1|			     rowpixels);
  510|      1|		return (0);
  511|      1|	}
  512|  1.88k|	dsp->runs = (uint32_t*) _TIFFCheckMalloc(tif,
  513|  1.88k|                                             TIFFSafeMultiply(uint32_t, dsp->nruns, 2),
  ------------------
  |  |  256|  1.88k|#define TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
  |  |  ------------------
  |  |  |  Branch (256:35): [Folded - Ignored]
  |  |  |  Branch (256:55): [True: 1.88k, False: 0]
  |  |  ------------------
  ------------------
  514|  1.88k|                                             sizeof (uint32_t),
  515|  1.88k|                                             "for Group 3/4 run arrays");
  516|  1.88k|	if (dsp->runs == NULL)
  ------------------
  |  Branch (516:6): [True: 0, False: 1.88k]
  ------------------
  517|      0|		return (0);
  518|  1.88k|	memset( dsp->runs, 0, TIFFSafeMultiply(uint32_t,dsp->nruns,2)*sizeof(uint32_t));
  ------------------
  |  |  256|  1.88k|#define TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
  |  |  ------------------
  |  |  |  Branch (256:35): [Folded - Ignored]
  |  |  |  Branch (256:55): [True: 1.88k, False: 0]
  |  |  ------------------
  ------------------
  519|  1.88k|	dsp->curruns = dsp->runs;
  520|  1.88k|	if (needsRefLine)
  ------------------
  |  Branch (520:6): [True: 1.35k, False: 534]
  ------------------
  521|  1.35k|		dsp->refruns = dsp->runs + dsp->nruns;
  522|    534|	else
  523|    534|		dsp->refruns = NULL;
  524|  1.88k|	if (td->td_compression == COMPRESSION_CCITTFAX3
  ------------------
  |  |  178|  3.77k|#define	    COMPRESSION_CCITTFAX3	3	/* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (524:6): [True: 1.08k, False: 805]
  ------------------
  525|  1.88k|	    && is2DEncoding(dsp)) {	/* NB: default is 1D routine */
  ------------------
  |  |   91|  1.08k|#define is2DEncoding(sp) (sp->b.groupoptions & GROUP3OPT_2DENCODING)
  |  |  ------------------
  |  |  |  |  275|  1.08k|#define	    GROUP3OPT_2DENCODING	0x1	/* 2-dimensional coding */
  |  |  ------------------
  |  |  |  Branch (91:26): [True: 759, False: 321]
  |  |  ------------------
  ------------------
  526|    759|		tif->tif_decoderow = Fax3Decode2D;
  527|    759|		tif->tif_decodestrip = Fax3Decode2D;
  528|    759|		tif->tif_decodetile = Fax3Decode2D;
  529|    759|	}
  530|       |
  531|  1.88k|	if (needsRefLine) {		/* 2d encoding */
  ------------------
  |  Branch (531:6): [True: 1.35k, False: 534]
  ------------------
  532|  1.35k|		Fax3CodecState* esp = EncoderState(tif);
  ------------------
  |  |   89|  1.35k|#define EncoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  ------------------
  |  |  |  |   63|  1.35k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  533|       |		/*
  534|       |		 * 2d encoding requires a scanline
  535|       |		 * buffer for the ``reference line''; the
  536|       |		 * scanline against which delta encoding
  537|       |		 * is referenced.  The reference line must
  538|       |		 * be initialized to be ``white'' (done elsewhere).
  539|       |		 */
  540|  1.35k|		esp->refline = (unsigned char*) _TIFFmalloc(rowbytes);
  541|  1.35k|		if (esp->refline == NULL) {
  ------------------
  |  Branch (541:7): [True: 0, False: 1.35k]
  ------------------
  542|      0|			TIFFErrorExtR(tif, module,
  543|      0|			    "No space for Group 3/4 reference line");
  544|      0|			return (0);
  545|      0|		}
  546|  1.35k|	} else					/* 1d encoding */
  547|    534|		EncoderState(tif)->refline = NULL;
  ------------------
  |  |   89|    534|#define EncoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  ------------------
  |  |  |  |   63|    534|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  548|       |
  549|  1.88k|	return (1);
  550|  1.88k|}
tif_fax3.c:Fax3Decode2D:
  276|  39.6k|{
  277|  39.6k|	DECLARE_STATE_2D(tif, sp, "Fax3Decode2D");
  ------------------
  |  |  118|  39.6k|    DECLARE_STATE(tif, sp, mod);					\
  |  |  ------------------
  |  |  |  |  103|  39.6k|    static const char module[] = mod;					\
  |  |  |  |  104|  39.6k|    Fax3CodecState* sp = DecoderState(tif);				\
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  39.6k|#define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|  39.6k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  105|  39.6k|    int a0;				/* reference element */		\
  |  |  |  |  106|  39.6k|    int lastx = sp->b.rowpixels;	/* last element in row */	\
  |  |  |  |  107|  39.6k|    uint32_t BitAcc;			/* bit accumulator */		\
  |  |  |  |  108|  39.6k|    int BitsAvail;			/* # valid bits in BitAcc */	\
  |  |  |  |  109|  39.6k|    int RunLength;			/* length of current run */	\
  |  |  |  |  110|  39.6k|    unsigned char* cp;			/* next byte of input data */	\
  |  |  |  |  111|  39.6k|    unsigned char* ep;			/* end of input data */		\
  |  |  |  |  112|  39.6k|    uint32_t* pa;				/* place to stuff next run */	\
  |  |  |  |  113|  39.6k|    uint32_t* thisrun;			/* current row's run array */	\
  |  |  |  |  114|  39.6k|    int EOLcnt;				/* # EOL codes recognized */	\
  |  |  |  |  115|  39.6k|    const unsigned char* bitmap = sp->bitmap;	/* input data bit reverser */	\
  |  |  |  |  116|  39.6k|    const TIFFFaxTabEnt* TabEnt
  |  |  ------------------
  |  |  119|  39.6k|    int b1;				/* next change on prev line */	\
  |  |  120|  39.6k|    uint32_t* pb				/* next run in reference line */\
  ------------------
  278|  39.6k|	int is1D;			/* current line is 1d/2d-encoded */
  279|  39.6k|	(void) s;
  280|  39.6k|	if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (280:6): [True: 0, False: 39.6k]
  ------------------
  281|      0|	{
  282|      0|		TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
  283|      0|		return (-1);
  284|      0|	}
  285|  39.6k|	CACHE_STATE(tif, sp);
  ------------------
  |  |  124|  39.6k|#define	CACHE_STATE(tif, sp) do {					\
  |  |  125|  39.6k|    BitAcc = sp->data;							\
  |  |  126|  39.6k|    BitsAvail = sp->bit;						\
  |  |  127|  39.6k|    EOLcnt = sp->EOLcnt;						\
  |  |  128|  39.6k|    cp = (unsigned char*) tif->tif_rawcp;				\
  |  |  129|  39.6k|    ep = cp + tif->tif_rawcc;						\
  |  |  130|  39.6k|} while (0)
  |  |  ------------------
  |  |  |  Branch (130:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  286|  1.88M|	while (occ > 0) {
  ------------------
  |  Branch (286:9): [True: 1.87M, False: 5.47k]
  ------------------
  287|  1.87M|		a0 = 0;
  288|  1.87M|		RunLength = 0;
  289|  1.87M|		pa = thisrun = sp->curruns;
  290|       |#ifdef FAX3_DEBUG
  291|       |		printf("\nBitAcc=%08"PRIX32", BitsAvail = %d EOLcnt = %d",
  292|       |		    BitAcc, BitsAvail, EOLcnt);
  293|       |#endif
  294|  1.87M|		SYNC_EOL(EOF2D);
  ------------------
  |  |  264|  1.87M|#define	SYNC_EOL(eoflab) do {						\
  |  |  265|  1.87M|    if (EOLcnt == 0) {							\
  |  |  ------------------
  |  |  |  Branch (265:9): [True: 1.18M, False: 692k]
  |  |  ------------------
  |  |  266|  96.3M|	for (;;) {							\
  |  |  267|  96.3M|	    NeedBits16(11,eoflab);					\
  |  |  ------------------
  |  |  |  |  151|  96.3M|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  152|  96.3M|    if (BitsAvail < (n)) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (152:9): [True: 12.8M, False: 83.5M]
  |  |  |  |  ------------------
  |  |  |  |  153|  12.8M|	if (EndOfData()) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|  12.8M|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (111:21): [True: 114k, False: 12.7M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  154|   114k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (154:10): [True: 467, False: 114k]
  |  |  |  |  ------------------
  |  |  |  |  155|   114k|		goto eoflab;						\
  |  |  |  |  156|   114k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  157|  12.7M|	} else {							\
  |  |  |  |  158|  12.7M|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  159|  12.7M|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (159:10): [True: 128k, False: 12.6M]
  |  |  |  |  ------------------
  |  |  |  |  160|   128k|		if (EndOfData()) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|   128k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (111:21): [True: 5.21k, False: 122k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  161|  5.21k|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  162|  5.21k|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  163|   122k|		} else {						\
  |  |  |  |  164|   122k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  165|   122k|		    BitsAvail += 8;					\
  |  |  |  |  166|   122k|		}							\
  |  |  |  |  167|   128k|	    }								\
  |  |  |  |  168|  12.7M|	}								\
  |  |  |  |  169|  12.8M|    }									\
  |  |  |  |  170|  96.3M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  268|  96.3M|	    if (GetBits(11) == 0)					\
  |  |  ------------------
  |  |  |  |  172|  96.3M|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  ------------------
  |  |  |  Branch (268:10): [True: 1.18M, False: 95.1M]
  |  |  ------------------
  |  |  269|  96.3M|		break;							\
  |  |  270|  96.3M|	    ClrBits(1);							\
  |  |  ------------------
  |  |  |  |  173|  95.1M|#define ClrBits(n) do {							\
  |  |  |  |  174|  95.1M|    BitsAvail -= (n);							\
  |  |  |  |  175|  95.1M|    BitAcc >>= (n);							\
  |  |  |  |  176|  95.1M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  271|  95.1M|	}								\
  |  |  272|  1.18M|    }									\
  |  |  273|  24.0M|    for (;;) {								\
  |  |  274|  24.0M|	NeedBits8(8,eoflab);						\
  |  |  ------------------
  |  |  |  |  137|  24.0M|#define NeedBits8(n,eoflab) do {					\
  |  |  |  |  138|  24.0M|    if (BitsAvail < (n)) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (138:9): [True: 21.9M, False: 2.12M]
  |  |  |  |  ------------------
  |  |  |  |  139|  21.9M|	if (EndOfData()) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|  21.9M|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (111:21): [True: 42.6k, False: 21.8M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  140|  42.6k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:10): [True: 21.8k, False: 20.8k]
  |  |  |  |  ------------------
  |  |  |  |  141|  42.6k|		goto eoflab;						\
  |  |  |  |  142|  42.6k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  143|  21.8M|	} else {							\
  |  |  |  |  144|  21.8M|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  145|  21.8M|	    BitsAvail += 8;						\
  |  |  |  |  146|  21.8M|	}								\
  |  |  |  |  147|  21.9M|    }									\
  |  |  |  |  148|  24.0M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (148:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  275|  24.0M|	if (GetBits(8))							\
  |  |  ------------------
  |  |  |  |  172|  24.0M|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:20): [True: 1.85M, False: 22.1M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  276|  24.0M|	    break;							\
  |  |  277|  24.0M|	ClrBits(8);							\
  |  |  ------------------
  |  |  |  |  173|  22.1M|#define ClrBits(n) do {							\
  |  |  |  |  174|  22.1M|    BitsAvail -= (n);							\
  |  |  |  |  175|  22.1M|    BitAcc >>= (n);							\
  |  |  |  |  176|  22.1M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  278|  22.1M|    }									\
  |  |  279|  8.82M|    while (GetBits(1) == 0)						\
  |  |  ------------------
  |  |  |  |  172|  8.82M|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  ------------------
  |  |  |  Branch (279:12): [True: 6.96M, False: 1.85M]
  |  |  ------------------
  |  |  280|  6.96M|	ClrBits(1);							\
  |  |  ------------------
  |  |  |  |  173|  8.82M|#define ClrBits(n) do {							\
  |  |  |  |  174|  6.96M|    BitsAvail -= (n);							\
  |  |  |  |  175|  6.96M|    BitAcc >>= (n);							\
  |  |  |  |  176|  6.96M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  281|  1.85M|    ClrBits(1);				/* EOL bit */			\
  |  |  ------------------
  |  |  |  |  173|  1.85M|#define ClrBits(n) do {							\
  |  |  |  |  174|  1.85M|    BitsAvail -= (n);							\
  |  |  |  |  175|  1.85M|    BitAcc >>= (n);							\
  |  |  |  |  176|  1.85M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  282|  1.85M|    EOLcnt = 0;				/* reset EOL counter/flag */	\
  |  |  283|  1.85M|} while (0)
  |  |  ------------------
  |  |  |  Branch (283:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  295|  1.85M|		NeedBits8(1, EOF2D);
  ------------------
  |  |  137|  1.85M|#define NeedBits8(n,eoflab) do {					\
  |  |  138|  1.85M|    if (BitsAvail < (n)) {						\
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 222k, False: 1.63M]
  |  |  ------------------
  |  |  139|   222k|	if (EndOfData()) {						\
  |  |  ------------------
  |  |  |  |  111|   222k|#define EndOfData()	(cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (111:21): [True: 356, False: 222k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  140|    356|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  ------------------
  |  |  |  Branch (140:10): [True: 356, False: 0]
  |  |  ------------------
  |  |  141|    356|		goto eoflab;						\
  |  |  142|    356|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  143|   222k|	} else {							\
  |  |  144|   222k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  145|   222k|	    BitsAvail += 8;						\
  |  |  146|   222k|	}								\
  |  |  147|   222k|    }									\
  |  |  148|  1.85M|} while (0)
  |  |  ------------------
  |  |  |  Branch (148:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  296|  1.85M|		is1D = GetBits(1);	/* 1D/2D-encoding tag bit */
  ------------------
  |  |  172|  1.85M|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  ------------------
  297|  1.85M|		ClrBits(1);
  ------------------
  |  |  173|  1.85M|#define ClrBits(n) do {							\
  |  |  174|  1.85M|    BitsAvail -= (n);							\
  |  |  175|  1.85M|    BitAcc >>= (n);							\
  |  |  176|  1.85M|} while (0)
  |  |  ------------------
  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  298|       |#ifdef FAX3_DEBUG
  299|       |		printf(" %s\n-------------------- %"PRIu32"\n",
  300|       |		    is1D ? "1D" : "2D", tif->tif_row);
  301|       |		fflush(stdout);
  302|       |#endif
  303|  1.85M|		pb = sp->refruns;
  304|  1.85M|		b1 = *pb++;
  305|  1.85M|		if (is1D)
  ------------------
  |  Branch (305:7): [True: 570k, False: 1.28M]
  ------------------
  306|   570k|			EXPAND1D(EOF2Da);
  ------------------
  |  |  322|   570k|#define EXPAND1D(eoflab) do {						\
  |  |  323|   855k|    for (;;) {								\
  |  |  324|  1.15M|	for (;;) {							\
  |  |  325|  1.15M|	    LOOKUP16(12, TIFFFaxWhiteTable, eof1d);			\
  |  |  ------------------
  |  |  |  |  232|  1.15M|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|  1.15M|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.15M|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|  1.15M|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 896k, False: 261k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   896k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   896k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 3.64k, False: 892k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.64k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 395, False: 3.24k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  3.64k|		goto eoflab;						\
  |  |  |  |  |  |  156|  3.64k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|   892k|	} else {							\
  |  |  |  |  |  |  158|   892k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|   892k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 127k, False: 765k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|   127k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   127k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 327, False: 127k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    327|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    327|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|   127k|		} else {						\
  |  |  |  |  |  |  164|   127k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|   127k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|   127k|		}							\
  |  |  |  |  |  |  167|   127k|	    }								\
  |  |  |  |  |  |  168|   892k|	}								\
  |  |  |  |  |  |  169|   896k|    }									\
  |  |  |  |  |  |  170|  1.15M|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|  1.15M|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  1.15M|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|  1.15M|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|  1.15M|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|  1.15M|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|  1.15M|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|  1.15M|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|  1.15M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  1.15M|	    switch (TabEnt->State) {					\
  |  |  327|  89.4k|	    case S_EOL:							\
  |  |  ------------------
  |  |  |  |   80|  89.4k|#define S_EOL      12
  |  |  ------------------
  |  |  |  Branch (327:6): [True: 89.4k, False: 1.06M]
  |  |  ------------------
  |  |  328|  89.4k|		EOLcnt = 1;						\
  |  |  329|  89.4k|		goto done1d;						\
  |  |  330|   726k|	    case S_TermW:						\
  |  |  ------------------
  |  |  |  |   75|   726k|#define S_TermW    7
  |  |  ------------------
  |  |  |  Branch (330:6): [True: 726k, False: 431k]
  |  |  ------------------
  |  |  331|   726k|		SETVALUE(TabEnt->Param);					\
  |  |  ------------------
  |  |  |  |  242|   726k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   726k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 726k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   726k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   726k|    a0 += (x);								\
  |  |  |  |  250|   726k|    RunLength = 0;							\
  |  |  |  |  251|   726k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  332|   726k|		goto doneWhite1d;					\
  |  |  333|   726k|	    case S_MakeUpW:						\
  |  |  ------------------
  |  |  |  |   77|   275k|#define S_MakeUpW  9
  |  |  ------------------
  |  |  |  Branch (333:6): [True: 275k, False: 882k]
  |  |  ------------------
  |  |  334|   302k|	    case S_MakeUp:						\
  |  |  ------------------
  |  |  |  |   79|   302k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (334:6): [True: 27.2k, False: 1.13M]
  |  |  ------------------
  |  |  335|   302k|		a0 += TabEnt->Param;					\
  |  |  336|   302k|		RunLength += TabEnt->Param;				\
  |  |  337|   302k|		break;							\
  |  |  338|   275k|	    default:							\
  |  |  ------------------
  |  |  |  Branch (338:6): [True: 39.4k, False: 1.11M]
  |  |  ------------------
  |  |  339|  39.4k|		unexpected("WhiteTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|  39.4k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  340|  39.4k|		goto done1d;						\
  |  |  341|  1.15M|	    }								\
  |  |  342|  1.15M|	}								\
  |  |  343|   855k|    doneWhite1d:							\
  |  |  344|   726k|	if (a0 >= lastx)						\
  |  |  ------------------
  |  |  |  Branch (344:6): [True: 241k, False: 484k]
  |  |  ------------------
  |  |  345|   726k|	    goto done1d;						\
  |  |  346|   726k|	for (;;) {							\
  |  |  347|   502k|	    LOOKUP16(13, TIFFFaxBlackTable, eof1d);			\
  |  |  ------------------
  |  |  |  |  232|   502k|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|   502k|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   502k|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|   502k|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 368k, False: 133k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   368k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   368k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 3.56k, False: 365k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.56k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 281, False: 3.28k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  3.56k|		goto eoflab;						\
  |  |  |  |  |  |  156|  3.56k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|   365k|	} else {							\
  |  |  |  |  |  |  158|   365k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|   365k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 10.0k, False: 355k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  10.0k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  10.0k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 361, False: 9.71k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    361|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    361|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  9.71k|		} else {						\
  |  |  |  |  |  |  164|  9.71k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  9.71k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  9.71k|		}							\
  |  |  |  |  |  |  167|  10.0k|	    }								\
  |  |  |  |  |  |  168|   365k|	}								\
  |  |  |  |  |  |  169|   368k|    }									\
  |  |  |  |  |  |  170|   502k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|   502k|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|   502k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|   502k|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|   502k|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|   502k|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|   502k|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|   502k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|   502k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  348|   502k|	    switch (TabEnt->State) {					\
  |  |  349|  31.1k|	    case S_EOL:							\
  |  |  ------------------
  |  |  |  |   80|  31.1k|#define S_EOL      12
  |  |  ------------------
  |  |  |  Branch (349:6): [True: 31.1k, False: 471k]
  |  |  ------------------
  |  |  350|  31.1k|		EOLcnt = 1;						\
  |  |  351|  31.1k|		goto done1d;						\
  |  |  352|   440k|	    case S_TermB:						\
  |  |  ------------------
  |  |  |  |   76|   440k|#define S_TermB    8
  |  |  ------------------
  |  |  |  Branch (352:6): [True: 440k, False: 61.7k]
  |  |  ------------------
  |  |  353|   440k|		SETVALUE(TabEnt->Param);					\
  |  |  ------------------
  |  |  |  |  242|   440k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   440k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 440k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   440k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   440k|    a0 += (x);								\
  |  |  |  |  250|   440k|    RunLength = 0;							\
  |  |  |  |  251|   440k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  354|   440k|		goto doneBlack1d;					\
  |  |  355|   440k|	    case S_MakeUpB:						\
  |  |  ------------------
  |  |  |  |   78|  3.33k|#define S_MakeUpB  10
  |  |  ------------------
  |  |  |  Branch (355:6): [True: 3.33k, False: 499k]
  |  |  ------------------
  |  |  356|  18.2k|	    case S_MakeUp:						\
  |  |  ------------------
  |  |  |  |   79|  18.2k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (356:6): [True: 14.9k, False: 487k]
  |  |  ------------------
  |  |  357|  18.2k|		a0 += TabEnt->Param;					\
  |  |  358|  18.2k|		RunLength += TabEnt->Param;				\
  |  |  359|  18.2k|		break;							\
  |  |  360|  12.2k|	    default:							\
  |  |  ------------------
  |  |  |  Branch (360:6): [True: 12.2k, False: 490k]
  |  |  ------------------
  |  |  361|  12.2k|		unexpected("BlackTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|  12.2k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  362|  12.2k|		goto done1d;						\
  |  |  363|   502k|	    }								\
  |  |  364|   502k|	}								\
  |  |  365|   484k|    doneBlack1d:							\
  |  |  366|   440k|	if (a0 >= lastx)						\
  |  |  ------------------
  |  |  |  Branch (366:6): [True: 156k, False: 284k]
  |  |  ------------------
  |  |  367|   440k|	    goto done1d;						\
  |  |  368|   440k|        if( *(pa-1) == 0 && *(pa-2) == 0 )				\
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 693, False: 283k]
  |  |  |  Branch (368:29): [True: 251, False: 442]
  |  |  ------------------
  |  |  369|   284k|            pa -= 2;                                                    \
  |  |  370|   284k|    }									\
  |  |  371|    676|eof1d:									\
  |  |  372|    676|    prematureEOF(a0);							\
  |  |  ------------------
  |  |  |  |  220|    676|#define	prematureEOF(a0)	Fax3PrematureEOF(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  373|    676|    CLEANUP_RUNS();							\
  |  |  ------------------
  |  |  |  |  290|    676|#define	CLEANUP_RUNS() do {						\
  |  |  |  |  291|    676|    if (RunLength)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (291:9): [True: 455, False: 221]
  |  |  |  |  ------------------
  |  |  |  |  292|    676|	SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|    455|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|    455|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 455]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|    455|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|    455|    a0 += (x);								\
  |  |  |  |  |  |  250|    455|    RunLength = 0;							\
  |  |  |  |  |  |  251|    455|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  293|    676|    if (a0 != lastx) {							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (293:9): [True: 598, False: 78]
  |  |  |  |  ------------------
  |  |  |  |  294|    598|	badlength(a0, lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|    598|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  |  |  ------------------
  |  |  |  |  295|    935|	while (a0 > lastx && pa > thisrun)				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (295:9): [True: 337, False: 598]
  |  |  |  |  |  Branch (295:23): [True: 337, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  296|    598|	    a0 -= *--pa;						\
  |  |  |  |  297|    598|	if (a0 < lastx) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (297:6): [True: 598, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  298|    598|	    if (a0 < 0)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (298:10): [True: 0, False: 598]
  |  |  |  |  ------------------
  |  |  |  |  299|    598|		a0 = 0;							\
  |  |  |  |  300|    598|	    if ((pa-thisrun)&1)						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (300:10): [True: 311, False: 287]
  |  |  |  |  ------------------
  |  |  |  |  301|    598|		SETVALUE(0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|    311|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|    311|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 311]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|    311|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|    311|    a0 += (x);								\
  |  |  |  |  |  |  250|    311|    RunLength = 0;							\
  |  |  |  |  |  |  251|    311|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  302|    598|	    SETVALUE(lastx - a0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|    598|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|    598|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 598]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|    598|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|    598|    a0 += (x);								\
  |  |  |  |  |  |  250|    598|    RunLength = 0;							\
  |  |  |  |  |  |  251|    598|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  303|    598|	} else if (a0 > lastx) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (303:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  305|      0|	    SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  306|      0|	}								\
  |  |  |  |  307|    598|    }									\
  |  |  |  |  308|    676|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  374|   570k|    goto eoflab;							\
  |  |  375|   570k|done1d:									\
  |  |  376|   570k|    CLEANUP_RUNS();							\
  |  |  ------------------
  |  |  |  |  290|   570k|#define	CLEANUP_RUNS() do {						\
  |  |  |  |  291|   570k|    if (RunLength)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (291:9): [True: 10.0k, False: 560k]
  |  |  |  |  ------------------
  |  |  |  |  292|   570k|	SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  10.0k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  10.0k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 10.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  10.0k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  10.0k|    a0 += (x);								\
  |  |  |  |  |  |  250|  10.0k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  10.0k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  293|   570k|    if (a0 != lastx) {							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (293:9): [True: 467k, False: 102k]
  |  |  |  |  ------------------
  |  |  |  |  294|   467k|	badlength(a0, lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|   467k|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  |  |  ------------------
  |  |  |  |  295|   773k|	while (a0 > lastx && pa > thisrun)				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (295:9): [True: 305k, False: 467k]
  |  |  |  |  |  Branch (295:23): [True: 305k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  296|   467k|	    a0 -= *--pa;						\
  |  |  |  |  297|   467k|	if (a0 < lastx) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (297:6): [True: 467k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  298|   467k|	    if (a0 < 0)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (298:10): [True: 0, False: 467k]
  |  |  |  |  ------------------
  |  |  |  |  299|   467k|		a0 = 0;							\
  |  |  |  |  300|   467k|	    if ((pa-thisrun)&1)						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (300:10): [True: 110k, False: 357k]
  |  |  |  |  ------------------
  |  |  |  |  301|   467k|		SETVALUE(0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|   110k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|   110k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 110k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|   110k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|   110k|    a0 += (x);								\
  |  |  |  |  |  |  250|   110k|    RunLength = 0;							\
  |  |  |  |  |  |  251|   110k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  302|   467k|	    SETVALUE(lastx - a0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|   467k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|   467k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 467k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|   467k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|   467k|    a0 += (x);								\
  |  |  |  |  |  |  250|   467k|    RunLength = 0;							\
  |  |  |  |  |  |  251|   467k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  303|   467k|	} else if (a0 > lastx) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (303:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  305|      0|	    SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  306|      0|	}								\
  |  |  |  |  307|   467k|    }									\
  |  |  |  |  308|   570k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  377|   570k|} while (0)
  |  |  ------------------
  |  |  |  Branch (377:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  307|  1.28M|		else
  308|  1.28M|			EXPAND2D(EOF2Da);
  ------------------
  |  |  398|  1.28M|#define EXPAND2D(eoflab) do {						\
  |  |  399|  2.81M|    while (a0 < lastx) {						\
  |  |  ------------------
  |  |  |  Branch (399:12): [True: 2.22M, False: 595k]
  |  |  ------------------
  |  |  400|  2.22M|	if (pa >= thisrun + sp->nruns) {				\
  |  |  ------------------
  |  |  |  Branch (400:6): [True: 739, False: 2.22M]
  |  |  ------------------
  |  |  401|    739|		TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  402|    739|		             sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    739|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    739|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 739, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               		             sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    739|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    739|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 739, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|    739|		return (-1);						\
  |  |  404|    739|	}								\
  |  |  405|  2.22M|	LOOKUP8(7, TIFFFaxMainTable, eof2d);				\
  |  |  ------------------
  |  |  |  |  227|  2.22M|#define LOOKUP8(wid,tab,eoflab) do {					\
  |  |  |  |  228|  2.22M|    NeedBits8(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  137|  2.22M|#define NeedBits8(n,eoflab) do {					\
  |  |  |  |  |  |  138|  2.22M|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (138:9): [True: 897k, False: 1.32M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  139|   897k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   897k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 3.04k, False: 894k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  140|  3.04k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (140:10): [True: 367, False: 2.67k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  141|  3.04k|		goto eoflab;						\
  |  |  |  |  |  |  142|  3.04k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  143|   894k|	} else {							\
  |  |  |  |  |  |  144|   894k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  145|   894k|	    BitsAvail += 8;						\
  |  |  |  |  |  |  146|   894k|	}								\
  |  |  |  |  |  |  147|   897k|    }									\
  |  |  |  |  |  |  148|  2.22M|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (148:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  229|  2.22M|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  2.22M|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  230|  2.22M|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|  2.22M|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|  2.22M|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|  2.22M|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|  2.22M|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  231|  2.22M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (231:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  406|  2.22M|	switch (TabEnt->State) {					\
  |  |  407|  87.8k|	case S_Pass:							\
  |  |  ------------------
  |  |  |  |   69|  87.8k|#define S_Pass     1
  |  |  ------------------
  |  |  |  Branch (407:2): [True: 87.8k, False: 2.13M]
  |  |  ------------------
  |  |  408|  87.8k|	    CHECK_b1;							\
  |  |  ------------------
  |  |  |  |  383|  87.8k|#define CHECK_b1 do {							\
  |  |  |  |  384|  87.8k|    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:9): [True: 14.4k, False: 73.4k]
  |  |  |  |  |  Branch (384:31): [True: 15.0k, False: 14.1k]
  |  |  |  |  |  Branch (384:43): [True: 15.0k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  385|  15.0k|	if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (385:6): [True: 245, False: 14.7k]
  |  |  |  |  ------------------
  |  |  |  |  386|    245|	    TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  387|    245|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    245|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    245|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 245, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    245|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    245|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 245, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  388|    245|	    return (-1);						\
  |  |  |  |  389|    245|	}								\
  |  |  |  |  390|  15.0k|	b1 += pb[0] + pb[1];						\
  |  |  |  |  391|  14.7k|	pb += 2;							\
  |  |  |  |  392|  14.7k|    }									\
  |  |  |  |  393|  87.8k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  409|  87.8k|	    if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  ------------------
  |  |  |  Branch (409:10): [True: 230, False: 87.3k]
  |  |  ------------------
  |  |  410|    230|	        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  411|    230|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    230|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    230|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 230, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    230|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    230|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 230, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  412|    230|	        return (-1);						\
  |  |  413|    230|	    }								\
  |  |  414|  87.6k|	    b1 += *pb++;						\
  |  |  415|  87.3k|	    RunLength += b1 - a0;					\
  |  |  416|  87.3k|	    a0 = b1;							\
  |  |  417|  87.3k|	    b1 += *pb++;						\
  |  |  418|  87.3k|	    break;							\
  |  |  419|   154k|	case S_Horiz:							\
  |  |  ------------------
  |  |  |  |   70|   154k|#define S_Horiz    2
  |  |  ------------------
  |  |  |  Branch (419:2): [True: 154k, False: 2.06M]
  |  |  ------------------
  |  |  420|   154k|	    if ((pa-thisrun)&1) {					\
  |  |  ------------------
  |  |  |  Branch (420:10): [True: 21.5k, False: 132k]
  |  |  ------------------
  |  |  421|  23.8k|		for (;;) {	/* black first */			\
  |  |  422|  23.8k|		    LOOKUP16(13, TIFFFaxBlackTable, eof2d);		\
  |  |  ------------------
  |  |  |  |  232|  23.8k|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|  23.8k|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  23.8k|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|  23.8k|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 23.5k, False: 331]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  23.5k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  23.5k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 619, False: 22.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|    619|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 213, False: 406]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|    619|		goto eoflab;						\
  |  |  |  |  |  |  156|    619|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|  22.9k|	} else {							\
  |  |  |  |  |  |  158|  22.9k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|  22.9k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 3.03k, False: 19.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  3.03k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  3.03k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 275, False: 2.75k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    275|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    275|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  2.75k|		} else {						\
  |  |  |  |  |  |  164|  2.75k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  2.75k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  2.75k|		}							\
  |  |  |  |  |  |  167|  3.03k|	    }								\
  |  |  |  |  |  |  168|  22.9k|	}								\
  |  |  |  |  |  |  169|  23.5k|    }									\
  |  |  |  |  |  |  170|  23.8k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|  23.8k|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  23.6k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|  23.6k|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|  23.6k|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|  23.6k|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|  23.6k|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|  23.6k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|  23.6k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  423|  23.8k|		    switch (TabEnt->State) {				\
  |  |  424|  18.4k|		    case S_TermB:					\
  |  |  ------------------
  |  |  |  |   76|  18.4k|#define S_TermB    8
  |  |  ------------------
  |  |  |  Branch (424:7): [True: 18.4k, False: 5.20k]
  |  |  ------------------
  |  |  425|  18.4k|			SETVALUE(TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|  18.4k|#define SETVALUE(x) do {							\
  |  |  |  |  243|  18.4k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 18.4k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|  18.4k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|  18.4k|    a0 += (x);								\
  |  |  |  |  250|  18.4k|    RunLength = 0;							\
  |  |  |  |  251|  18.4k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  426|  18.4k|			goto doneWhite2da;				\
  |  |  427|  18.4k|		    case S_MakeUpB:					\
  |  |  ------------------
  |  |  |  |   78|    402|#define S_MakeUpB  10
  |  |  ------------------
  |  |  |  Branch (427:7): [True: 402, False: 23.2k]
  |  |  ------------------
  |  |  428|  2.36k|		    case S_MakeUp:					\
  |  |  ------------------
  |  |  |  |   79|  2.36k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (428:7): [True: 1.96k, False: 21.7k]
  |  |  ------------------
  |  |  429|  2.36k|			a0 += TabEnt->Param;				\
  |  |  430|  2.36k|			RunLength += TabEnt->Param;			\
  |  |  431|  2.36k|			break;						\
  |  |  432|  2.84k|		    default:						\
  |  |  ------------------
  |  |  |  Branch (432:7): [True: 2.84k, False: 20.8k]
  |  |  ------------------
  |  |  433|  2.84k|			goto badBlack2d;				\
  |  |  434|  23.6k|		    }							\
  |  |  435|  23.6k|		}							\
  |  |  436|  21.5k|	    doneWhite2da:;						\
  |  |  437|  36.9k|		for (;;) {	/* then white */			\
  |  |  438|  36.9k|		    LOOKUP16(12, TIFFFaxWhiteTable, eof2d);		\
  |  |  ------------------
  |  |  |  |  232|  36.9k|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|  36.9k|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  36.9k|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|  36.9k|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 23.3k, False: 13.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  23.3k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  23.3k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 1.35k, False: 21.9k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  1.35k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 679, False: 673]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  1.35k|		goto eoflab;						\
  |  |  |  |  |  |  156|  1.35k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|  21.9k|	} else {							\
  |  |  |  |  |  |  158|  21.9k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|  21.9k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 2.26k, False: 19.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  2.26k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  2.26k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 390, False: 1.87k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    390|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    390|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  1.87k|		} else {						\
  |  |  |  |  |  |  164|  1.87k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  1.87k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  1.87k|		}							\
  |  |  |  |  |  |  167|  2.26k|	    }								\
  |  |  |  |  |  |  168|  21.9k|	}								\
  |  |  |  |  |  |  169|  23.3k|    }									\
  |  |  |  |  |  |  170|  36.9k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|  36.9k|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  36.2k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|  36.2k|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|  36.2k|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|  36.2k|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|  36.2k|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|  36.2k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|  36.2k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  439|  36.9k|		    switch (TabEnt->State) {				\
  |  |  440|  16.2k|		    case S_TermW:					\
  |  |  ------------------
  |  |  |  |   75|  16.2k|#define S_TermW    7
  |  |  ------------------
  |  |  |  Branch (440:7): [True: 16.2k, False: 20.0k]
  |  |  ------------------
  |  |  441|  16.2k|			SETVALUE(TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|  16.2k|#define SETVALUE(x) do {							\
  |  |  |  |  243|  16.2k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 295, False: 15.9k]
  |  |  |  |  ------------------
  |  |  |  |  244|    295|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|    295|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    295|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    295|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 295, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    295|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    295|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 295, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|    295|        return (-1);							\
  |  |  |  |  247|    295|    }									\
  |  |  |  |  248|  16.2k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|  15.9k|    a0 += (x);								\
  |  |  |  |  250|  15.9k|    RunLength = 0;							\
  |  |  |  |  251|  15.9k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  442|  16.2k|			goto doneBlack2da;				\
  |  |  443|  16.2k|		    case S_MakeUpW:					\
  |  |  ------------------
  |  |  |  |   77|  14.1k|#define S_MakeUpW  9
  |  |  ------------------
  |  |  |  Branch (443:7): [True: 14.1k, False: 22.1k]
  |  |  ------------------
  |  |  444|  18.4k|		    case S_MakeUp:					\
  |  |  ------------------
  |  |  |  |   79|  18.4k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (444:7): [True: 4.31k, False: 31.9k]
  |  |  ------------------
  |  |  445|  18.4k|			a0 += TabEnt->Param;				\
  |  |  446|  18.4k|			RunLength += TabEnt->Param;			\
  |  |  447|  18.4k|			break;						\
  |  |  448|  14.1k|		    default:						\
  |  |  ------------------
  |  |  |  Branch (448:7): [True: 1.58k, False: 34.6k]
  |  |  ------------------
  |  |  449|  1.58k|			goto badWhite2d;				\
  |  |  450|  36.2k|		    }							\
  |  |  451|  36.2k|		}							\
  |  |  452|  18.4k|	    doneBlack2da:;						\
  |  |  453|   132k|	    } else {							\
  |  |  454|   174k|		for (;;) {	/* white first */			\
  |  |  455|   174k|		    LOOKUP16(12, TIFFFaxWhiteTable, eof2d);		\
  |  |  ------------------
  |  |  |  |  232|   174k|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|   174k|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   174k|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|   174k|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 160k, False: 13.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   160k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   160k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 1.00k, False: 159k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  1.00k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 219, False: 788]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  1.00k|		goto eoflab;						\
  |  |  |  |  |  |  156|  1.00k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|   159k|	} else {							\
  |  |  |  |  |  |  158|   159k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|   159k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 2.43k, False: 157k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  2.43k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  2.43k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 220, False: 2.21k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    220|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    220|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  2.21k|		} else {						\
  |  |  |  |  |  |  164|  2.21k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  2.21k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  2.21k|		}							\
  |  |  |  |  |  |  167|  2.43k|	    }								\
  |  |  |  |  |  |  168|   159k|	}								\
  |  |  |  |  |  |  169|   160k|    }									\
  |  |  |  |  |  |  170|   174k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|   174k|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|   173k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|   173k|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|   173k|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|   173k|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|   173k|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|   173k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|   173k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  456|   174k|		    switch (TabEnt->State) {				\
  |  |  457|   117k|		    case S_TermW:					\
  |  |  ------------------
  |  |  |  |   75|   117k|#define S_TermW    7
  |  |  ------------------
  |  |  |  Branch (457:7): [True: 117k, False: 55.9k]
  |  |  ------------------
  |  |  458|   117k|			SETVALUE(TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|   117k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   117k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 117k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   117k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   117k|    a0 += (x);								\
  |  |  |  |  250|   117k|    RunLength = 0;							\
  |  |  |  |  251|   117k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  459|   117k|			goto doneWhite2db;				\
  |  |  460|   117k|		    case S_MakeUpW:					\
  |  |  ------------------
  |  |  |  |   77|  24.1k|#define S_MakeUpW  9
  |  |  ------------------
  |  |  |  Branch (460:7): [True: 24.1k, False: 149k]
  |  |  ------------------
  |  |  461|  41.0k|		    case S_MakeUp:					\
  |  |  ------------------
  |  |  |  |   79|  41.0k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (461:7): [True: 16.9k, False: 156k]
  |  |  ------------------
  |  |  462|  41.0k|			a0 += TabEnt->Param;				\
  |  |  463|  41.0k|			RunLength += TabEnt->Param;			\
  |  |  464|  41.0k|			break;						\
  |  |  465|  24.1k|		    default:						\
  |  |  ------------------
  |  |  |  Branch (465:7): [True: 14.8k, False: 159k]
  |  |  ------------------
  |  |  466|  14.8k|			goto badWhite2d;				\
  |  |  467|   173k|		    }							\
  |  |  468|   173k|		}							\
  |  |  469|   132k|	    doneWhite2db:;						\
  |  |  470|   124k|		for (;;) {	/* then black */			\
  |  |  471|   124k|		    LOOKUP16(13, TIFFFaxBlackTable, eof2d);		\
  |  |  ------------------
  |  |  |  |  232|   124k|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|   124k|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   124k|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|   124k|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 108k, False: 15.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   108k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   108k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 1.23k, False: 107k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  1.23k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 406, False: 831]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  1.23k|		goto eoflab;						\
  |  |  |  |  |  |  156|  1.23k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|   107k|	} else {							\
  |  |  |  |  |  |  158|   107k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|   107k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 5.85k, False: 101k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  5.85k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  5.85k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 223, False: 5.63k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    223|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    223|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  5.63k|		} else {						\
  |  |  |  |  |  |  164|  5.63k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  5.63k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  5.63k|		}							\
  |  |  |  |  |  |  167|  5.85k|	    }								\
  |  |  |  |  |  |  168|   107k|	}								\
  |  |  |  |  |  |  169|   108k|    }									\
  |  |  |  |  |  |  170|   124k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|   124k|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|   124k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|   124k|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|   124k|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|   124k|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|   124k|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|   124k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|   124k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  472|   124k|		    switch (TabEnt->State) {				\
  |  |  473|  97.0k|		    case S_TermB:					\
  |  |  ------------------
  |  |  |  |   76|  97.0k|#define S_TermB    8
  |  |  ------------------
  |  |  |  Branch (473:7): [True: 97.0k, False: 27.1k]
  |  |  ------------------
  |  |  474|  97.0k|			SETVALUE(TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|  97.0k|#define SETVALUE(x) do {							\
  |  |  |  |  243|  97.0k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 97.0k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|  97.0k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|  97.0k|    a0 += (x);								\
  |  |  |  |  250|  97.0k|    RunLength = 0;							\
  |  |  |  |  251|  97.0k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  475|  97.0k|			goto doneBlack2db;				\
  |  |  476|  97.0k|		    case S_MakeUpB:					\
  |  |  ------------------
  |  |  |  |   78|  3.54k|#define S_MakeUpB  10
  |  |  ------------------
  |  |  |  Branch (476:7): [True: 3.54k, False: 120k]
  |  |  ------------------
  |  |  477|  6.59k|		    case S_MakeUp:					\
  |  |  ------------------
  |  |  |  |   79|  6.59k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (477:7): [True: 3.05k, False: 121k]
  |  |  ------------------
  |  |  478|  6.59k|			a0 += TabEnt->Param;				\
  |  |  479|  6.59k|			RunLength += TabEnt->Param;			\
  |  |  480|  6.59k|			break;						\
  |  |  481|  20.5k|		    default:						\
  |  |  ------------------
  |  |  |  Branch (481:7): [True: 20.5k, False: 103k]
  |  |  ------------------
  |  |  482|  20.5k|			goto badBlack2d;				\
  |  |  483|   124k|		    }							\
  |  |  484|   124k|		}							\
  |  |  485|   117k|	    doneBlack2db:;						\
  |  |  486|  97.0k|	    }								\
  |  |  487|   154k|	    CHECK_b1;							\
  |  |  ------------------
  |  |  |  |  383|   112k|#define CHECK_b1 do {							\
  |  |  |  |  384|   183k|    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:9): [True: 112k, False: 0]
  |  |  |  |  |  Branch (384:31): [True: 160k, False: 22.4k]
  |  |  |  |  |  Branch (384:43): [True: 70.6k, False: 90.2k]
  |  |  |  |  ------------------
  |  |  |  |  385|  70.6k|	if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (385:6): [True: 218, False: 70.4k]
  |  |  |  |  ------------------
  |  |  |  |  386|    218|	    TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  387|    218|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    218|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    218|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 218, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    218|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    218|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 218, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  388|    218|	    return (-1);						\
  |  |  |  |  389|    218|	}								\
  |  |  |  |  390|  70.6k|	b1 += pb[0] + pb[1];						\
  |  |  |  |  391|  70.4k|	pb += 2;							\
  |  |  |  |  392|  70.4k|    }									\
  |  |  |  |  393|   112k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|   112k|	    break;							\
  |  |  489|   489k|	case S_V0:							\
  |  |  ------------------
  |  |  |  |   71|   489k|#define S_V0       3
  |  |  ------------------
  |  |  |  Branch (489:2): [True: 489k, False: 1.73M]
  |  |  ------------------
  |  |  490|   489k|	    CHECK_b1;							\
  |  |  ------------------
  |  |  |  |  383|   489k|#define CHECK_b1 do {							\
  |  |  |  |  384|   489k|    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:9): [True: 197k, False: 291k]
  |  |  |  |  |  Branch (384:31): [True: 80.2k, False: 197k]
  |  |  |  |  |  Branch (384:43): [True: 80.2k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  385|  80.2k|	if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (385:6): [True: 396, False: 79.8k]
  |  |  |  |  ------------------
  |  |  |  |  386|    396|	    TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  387|    396|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    396|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    396|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 396, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    396|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    396|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 396, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  388|    396|	    return (-1);						\
  |  |  |  |  389|    396|	}								\
  |  |  |  |  390|  80.2k|	b1 += pb[0] + pb[1];						\
  |  |  |  |  391|  79.8k|	pb += 2;							\
  |  |  |  |  392|  79.8k|    }									\
  |  |  |  |  393|   489k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  491|   489k|	    SETVALUE(b1 - a0);						\
  |  |  ------------------
  |  |  |  |  242|   489k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   489k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 489k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   489k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   489k|    a0 += (x);								\
  |  |  |  |  250|   489k|    RunLength = 0;							\
  |  |  |  |  251|   489k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  492|   489k|	    if( pb >= sp->refruns + sp->nruns) { 			\
  |  |  ------------------
  |  |  |  Branch (492:10): [True: 258, False: 488k]
  |  |  ------------------
  |  |  493|    258|	        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  494|    258|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    258|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    258|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 258, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    258|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    258|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 258, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  495|    258|	        return (-1);						\
  |  |  496|    258|	    }								\
  |  |  497|   489k|	    b1 += *pb++;						\
  |  |  498|   488k|	    break;							\
  |  |  499|   489k|	case S_VR:							\
  |  |  ------------------
  |  |  |  |   72|   154k|#define S_VR       4
  |  |  ------------------
  |  |  |  Branch (499:2): [True: 154k, False: 2.06M]
  |  |  ------------------
  |  |  500|   154k|	    CHECK_b1;							\
  |  |  ------------------
  |  |  |  |  383|   154k|#define CHECK_b1 do {							\
  |  |  |  |  384|   154k|    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:9): [True: 32.6k, False: 121k]
  |  |  |  |  |  Branch (384:31): [True: 62.5k, False: 32.4k]
  |  |  |  |  |  Branch (384:43): [True: 62.5k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  385|  62.5k|	if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (385:6): [True: 243, False: 62.2k]
  |  |  |  |  ------------------
  |  |  |  |  386|    243|	    TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  387|    243|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    243|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    243|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 243, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    243|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    243|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 243, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  388|    243|	    return (-1);						\
  |  |  |  |  389|    243|	}								\
  |  |  |  |  390|  62.5k|	b1 += pb[0] + pb[1];						\
  |  |  |  |  391|  62.2k|	pb += 2;							\
  |  |  |  |  392|  62.2k|    }									\
  |  |  |  |  393|   154k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  501|   154k|	    SETVALUE(b1 - a0 + TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|   154k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   154k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 154k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   154k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   154k|    a0 += (x);								\
  |  |  |  |  250|   154k|    RunLength = 0;							\
  |  |  |  |  251|   154k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  502|   154k|	    if( pb >= sp->refruns + sp->nruns) { 			\
  |  |  ------------------
  |  |  |  Branch (502:10): [True: 1.30k, False: 153k]
  |  |  ------------------
  |  |  503|  1.30k|	        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  504|  1.30k|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|  1.30k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|  1.30k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 1.30k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|  1.30k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|  1.30k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 1.30k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  505|  1.30k|	        return (-1);						\
  |  |  506|  1.30k|	    }								\
  |  |  507|   154k|	    b1 += *pb++;						\
  |  |  508|   153k|	    break;							\
  |  |  509|   695k|	case S_VL:							\
  |  |  ------------------
  |  |  |  |   73|   695k|#define S_VL       5
  |  |  ------------------
  |  |  |  Branch (509:2): [True: 695k, False: 1.52M]
  |  |  ------------------
  |  |  510|   695k|	    CHECK_b1;							\
  |  |  ------------------
  |  |  |  |  383|   695k|#define CHECK_b1 do {							\
  |  |  |  |  384|   855k|    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:9): [True: 532k, False: 162k]
  |  |  |  |  |  Branch (384:31): [True: 322k, False: 532k]
  |  |  |  |  |  Branch (384:43): [True: 322k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  385|   322k|	if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (385:6): [True: 245, False: 322k]
  |  |  |  |  ------------------
  |  |  |  |  386|    245|	    TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  387|    245|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    245|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    245|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 245, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    245|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    245|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 245, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  388|    245|	    return (-1);						\
  |  |  |  |  389|    245|	}								\
  |  |  |  |  390|   322k|	b1 += pb[0] + pb[1];						\
  |  |  |  |  391|   322k|	pb += 2;							\
  |  |  |  |  392|   322k|    }									\
  |  |  |  |  393|   695k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  511|   695k|	    if (b1 < (int) (a0 + TabEnt->Param)) {			\
  |  |  ------------------
  |  |  |  Branch (511:10): [True: 5.55k, False: 689k]
  |  |  ------------------
  |  |  512|  5.55k|		unexpected("VL", a0);				\
  |  |  ------------------
  |  |  |  |  188|  5.55k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  513|  5.55k|		goto eol2d;						\
  |  |  514|  5.55k|	    }								\
  |  |  515|   695k|	    SETVALUE(b1 - a0 - TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|   689k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   689k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 689k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   689k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   689k|    a0 += (x);								\
  |  |  |  |  250|   689k|    RunLength = 0;							\
  |  |  |  |  251|   689k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  516|   689k|	    b1 -= *--pb;						\
  |  |  517|   689k|	    break;							\
  |  |  518|   689k|	case S_Ext:							\
  |  |  ------------------
  |  |  |  |   74|  61.0k|#define S_Ext      6
  |  |  ------------------
  |  |  |  Branch (518:2): [True: 61.0k, False: 2.16M]
  |  |  ------------------
  |  |  519|  61.0k|	    *pa++ = lastx - a0;						\
  |  |  520|  61.0k|	    extension(a0);						\
  |  |  ------------------
  |  |  |  |  199|  61.0k|#define	extension(a0)	Fax3Extension(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  521|  61.0k|	    goto eol2d;							\
  |  |  522|   689k|	case S_EOL:							\
  |  |  ------------------
  |  |  |  |   80|   578k|#define S_EOL      12
  |  |  ------------------
  |  |  |  Branch (522:2): [True: 578k, False: 1.64M]
  |  |  ------------------
  |  |  523|   578k|	    *pa++ = lastx - a0;						\
  |  |  524|   578k|	    NeedBits8(4,eof2d);						\
  |  |  ------------------
  |  |  |  |  137|   578k|#define NeedBits8(n,eoflab) do {					\
  |  |  |  |  138|   578k|    if (BitsAvail < (n)) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (138:9): [True: 518k, False: 59.9k]
  |  |  |  |  ------------------
  |  |  |  |  139|   518k|	if (EndOfData()) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|   518k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (111:21): [True: 3.04k, False: 515k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  140|  3.04k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:10): [True: 2.12k, False: 920]
  |  |  |  |  ------------------
  |  |  |  |  141|  3.04k|		goto eoflab;						\
  |  |  |  |  142|  3.04k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  143|   515k|	} else {							\
  |  |  |  |  144|   515k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  145|   515k|	    BitsAvail += 8;						\
  |  |  |  |  146|   515k|	}								\
  |  |  |  |  147|   518k|    }									\
  |  |  |  |  148|   578k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (148:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|   578k|	    if (GetBits(4))						\
  |  |  ------------------
  |  |  |  |  172|   576k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:20): [True: 145k, False: 430k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  526|   576k|		unexpected("EOL", a0);					\
  |  |  ------------------
  |  |  |  |  188|   145k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  527|   576k|            ClrBits(4);                                                 \
  |  |  ------------------
  |  |  |  |  173|   576k|#define ClrBits(n) do {							\
  |  |  |  |  174|   576k|    BitsAvail -= (n);							\
  |  |  |  |  175|   576k|    BitAcc >>= (n);							\
  |  |  |  |  176|   576k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  528|   576k|	    EOLcnt = 1;							\
  |  |  529|   576k|	    goto eol2d;							\
  |  |  530|   578k|	default:							\
  |  |  ------------------
  |  |  |  Branch (530:2): [True: 0, False: 2.22M]
  |  |  ------------------
  |  |  531|      0|	badMain2d:							\
  |  |  532|      0|	    unexpected("MainTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|      0|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  533|      0|	    goto eol2d;							\
  |  |  534|  23.3k|	badBlack2d:							\
  |  |  535|  23.3k|	    unexpected("BlackTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|  23.3k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  536|  23.3k|	    goto eol2d;							\
  |  |  537|  16.3k|	badWhite2d:							\
  |  |  538|  16.3k|	    unexpected("WhiteTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|  16.3k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  539|  16.3k|	    goto eol2d;							\
  |  |  540|  4.01k|	eof2d:								\
  |  |  541|  4.01k|	    prematureEOF(a0);						\
  |  |  ------------------
  |  |  |  |  220|  4.01k|#define	prematureEOF(a0)	Fax3PrematureEOF(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  542|  4.01k|	    CLEANUP_RUNS();						\
  |  |  ------------------
  |  |  |  |  290|  4.01k|#define	CLEANUP_RUNS() do {						\
  |  |  |  |  291|  4.01k|    if (RunLength)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (291:9): [True: 1.60k, False: 2.41k]
  |  |  |  |  ------------------
  |  |  |  |  292|  4.01k|	SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  1.60k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  1.60k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 34, False: 1.56k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|     34|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|     34|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|     34|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|     34|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 34, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|     34|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|     34|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 34, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|     34|        return (-1);							\
  |  |  |  |  |  |  247|     34|    }									\
  |  |  |  |  |  |  248|  1.60k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  1.56k|    a0 += (x);								\
  |  |  |  |  |  |  250|  1.56k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  1.56k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  293|  4.01k|    if (a0 != lastx) {							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (293:9): [True: 3.87k, False: 105]
  |  |  |  |  ------------------
  |  |  |  |  294|  3.87k|	badlength(a0, lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|  3.87k|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  |  |  ------------------
  |  |  |  |  295|  5.77k|	while (a0 > lastx && pa > thisrun)				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (295:9): [True: 1.90k, False: 3.87k]
  |  |  |  |  |  Branch (295:23): [True: 1.90k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  296|  3.87k|	    a0 -= *--pa;						\
  |  |  |  |  297|  3.87k|	if (a0 < lastx) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (297:6): [True: 3.66k, False: 212]
  |  |  |  |  ------------------
  |  |  |  |  298|  3.66k|	    if (a0 < 0)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (298:10): [True: 0, False: 3.66k]
  |  |  |  |  ------------------
  |  |  |  |  299|  3.66k|		a0 = 0;							\
  |  |  |  |  300|  3.66k|	    if ((pa-thisrun)&1)						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (300:10): [True: 2.65k, False: 1.00k]
  |  |  |  |  ------------------
  |  |  |  |  301|  3.66k|		SETVALUE(0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  2.65k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  2.65k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 2.65k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  2.65k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  2.65k|    a0 += (x);								\
  |  |  |  |  |  |  250|  2.65k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  2.65k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  302|  3.66k|	    SETVALUE(lastx - a0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  3.66k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  3.66k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 90, False: 3.57k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|     90|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|     90|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|     90|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|     90|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 90, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|     90|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|     90|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 90, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|     90|        return (-1);							\
  |  |  |  |  |  |  247|     90|    }									\
  |  |  |  |  |  |  248|  3.66k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  3.57k|    a0 += (x);								\
  |  |  |  |  |  |  250|  3.57k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  3.57k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  303|  3.66k|	} else if (a0 > lastx) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (303:13): [True: 0, False: 212]
  |  |  |  |  ------------------
  |  |  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  305|      0|	    SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  306|      0|	}								\
  |  |  |  |  307|  3.87k|    }									\
  |  |  |  |  308|  3.97k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  4.01k|	    goto eoflab;						\
  |  |  544|  2.22M|	}								\
  |  |  545|  2.22M|    }									\
  |  |  546|  1.28M|    if (RunLength) {							\
  |  |  ------------------
  |  |  |  Branch (546:9): [True: 68.5k, False: 526k]
  |  |  ------------------
  |  |  547|  68.5k|	if (RunLength + a0 < lastx) {					\
  |  |  ------------------
  |  |  |  Branch (547:6): [True: 0, False: 68.5k]
  |  |  ------------------
  |  |  548|      0|	    /* expect a final V0 */					\
  |  |  549|      0|	    NeedBits8(1,eof2d);						\
  |  |  ------------------
  |  |  |  |  137|      0|#define NeedBits8(n,eoflab) do {					\
  |  |  |  |  138|      0|    if (BitsAvail < (n)) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (138:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  139|      0|	if (EndOfData()) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|      0|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (111:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  140|      0|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:10): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  141|      0|		goto eoflab;						\
  |  |  |  |  142|      0|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  143|      0|	} else {							\
  |  |  |  |  144|      0|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  145|      0|	    BitsAvail += 8;						\
  |  |  |  |  146|      0|	}								\
  |  |  |  |  147|      0|    }									\
  |  |  |  |  148|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (148:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  550|      0|	    if (!GetBits(1))						\
  |  |  ------------------
  |  |  |  |  172|      0|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  ------------------
  |  |  |  Branch (550:10): [True: 0, False: 0]
  |  |  ------------------
  |  |  551|      0|		goto badMain2d;						\
  |  |  552|      0|	    ClrBits(1);							\
  |  |  ------------------
  |  |  |  |  173|      0|#define ClrBits(n) do {							\
  |  |  |  |  174|      0|    BitsAvail -= (n);							\
  |  |  |  |  175|      0|    BitAcc >>= (n);							\
  |  |  |  |  176|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  553|      0|	}								\
  |  |  554|  68.5k|	SETVALUE(0);							\
  |  |  ------------------
  |  |  |  |  242|  68.5k|#define SETVALUE(x) do {							\
  |  |  |  |  243|  68.5k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 68.5k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|  68.5k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|  68.5k|    a0 += (x);								\
  |  |  |  |  250|  68.5k|    RunLength = 0;							\
  |  |  |  |  251|  68.5k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  555|  1.27M|    }									\
  |  |  556|  1.27M|eol2d:									\
  |  |  557|  1.27M|    CLEANUP_RUNS();							\
  |  |  ------------------
  |  |  |  |  290|  1.27M|#define	CLEANUP_RUNS() do {						\
  |  |  |  |  291|  1.27M|    if (RunLength)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (291:9): [True: 7.84k, False: 1.26M]
  |  |  |  |  ------------------
  |  |  |  |  292|  1.27M|	SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  7.84k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  7.84k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 566, False: 7.27k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|    566|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|    566|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|    566|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|    566|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 566, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|    566|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|    566|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 566, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|    566|        return (-1);							\
  |  |  |  |  |  |  247|    566|    }									\
  |  |  |  |  |  |  248|  7.84k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  7.27k|    a0 += (x);								\
  |  |  |  |  |  |  250|  7.27k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  7.27k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  293|  1.27M|    if (a0 != lastx) {							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (293:9): [True: 831k, False: 445k]
  |  |  |  |  ------------------
  |  |  |  |  294|   831k|	badlength(a0, lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|   831k|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  |  |  ------------------
  |  |  |  |  295|  1.04M|	while (a0 > lastx && pa > thisrun)				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (295:9): [True: 211k, False: 831k]
  |  |  |  |  |  Branch (295:23): [True: 211k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  296|   831k|	    a0 -= *--pa;						\
  |  |  |  |  297|   831k|	if (a0 < lastx) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (297:6): [True: 828k, False: 3.18k]
  |  |  |  |  ------------------
  |  |  |  |  298|   828k|	    if (a0 < 0)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (298:10): [True: 0, False: 828k]
  |  |  |  |  ------------------
  |  |  |  |  299|   828k|		a0 = 0;							\
  |  |  |  |  300|   828k|	    if ((pa-thisrun)&1)						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (300:10): [True: 591k, False: 237k]
  |  |  |  |  ------------------
  |  |  |  |  301|   828k|		SETVALUE(0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|   591k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|   591k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 591k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|   591k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|   591k|    a0 += (x);								\
  |  |  |  |  |  |  250|   591k|    RunLength = 0;							\
  |  |  |  |  |  |  251|   591k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  302|   828k|	    SETVALUE(lastx - a0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|   828k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|   828k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 2.09k, False: 826k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|  2.09k|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|  2.09k|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|  2.09k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|  2.09k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 2.09k, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|  2.09k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|  2.09k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 2.09k, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|  2.09k|        return (-1);							\
  |  |  |  |  |  |  247|  2.09k|    }									\
  |  |  |  |  |  |  248|   828k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|   826k|    a0 += (x);								\
  |  |  |  |  |  |  250|   826k|    RunLength = 0;							\
  |  |  |  |  |  |  251|   826k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  303|   828k|	} else if (a0 > lastx) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (303:13): [True: 0, False: 3.18k]
  |  |  |  |  ------------------
  |  |  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  305|      0|	    SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  306|      0|	}								\
  |  |  |  |  307|   831k|    }									\
  |  |  |  |  308|  1.27M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  558|  1.27M|} while (0)
  |  |  ------------------
  |  |  |  Branch (558:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  309|  1.84M|		(*sp->fill)(buf, thisrun, pa, lastx);
  310|  1.84M|		if (pa < thisrun + sp->nruns) {
  ------------------
  |  Branch (310:7): [True: 1.84M, False: 3.04k]
  ------------------
  311|  1.84M|			SETVALUE(0);	/* imaginary change for reference */
  ------------------
  |  |  242|  1.84M|#define SETVALUE(x) do {							\
  |  |  243|  1.84M|    if (pa >= thisrun + sp->nruns) {					\
  |  |  ------------------
  |  |  |  Branch (243:9): [True: 0, False: 1.84M]
  |  |  ------------------
  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  246|      0|        return (-1);							\
  |  |  247|      0|    }									\
  |  |  248|  1.84M|    *pa++ = RunLength + (x);						\
  |  |  249|  1.84M|    a0 += (x);								\
  |  |  250|  1.84M|    RunLength = 0;							\
  |  |  251|  1.84M|} while (0)
  |  |  ------------------
  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  312|  1.84M|		}
  313|  1.84M|		SWAP(uint32_t*, sp->curruns, sp->refruns);
  ------------------
  |  |  270|  1.84M|#define	SWAP(t,a,b)	{ t x; x = (a); (a) = (b); (b) = x; }
  ------------------
  314|  1.84M|		buf += sp->b.rowbytes;
  315|  1.84M|		occ -= sp->b.rowbytes;
  316|  1.84M|		sp->line++;
  317|  1.84M|		continue;
  318|  22.6k|	EOF2D:				/* premature EOF */
  319|  22.6k|		CLEANUP_RUNS();
  ------------------
  |  |  290|  22.6k|#define	CLEANUP_RUNS() do {						\
  |  |  291|  22.6k|    if (RunLength)							\
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 0, False: 22.6k]
  |  |  ------------------
  |  |  292|  22.6k|	SETVALUE(0);							\
  |  |  ------------------
  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  251|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  293|  22.6k|    if (a0 != lastx) {							\
  |  |  ------------------
  |  |  |  Branch (293:9): [True: 22.6k, False: 0]
  |  |  ------------------
  |  |  294|  22.6k|	badlength(a0, lastx);						\
  |  |  ------------------
  |  |  |  |  210|  22.6k|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  ------------------
  |  |  295|  22.6k|	while (a0 > lastx && pa > thisrun)				\
  |  |  ------------------
  |  |  |  Branch (295:9): [True: 0, False: 22.6k]
  |  |  |  Branch (295:23): [True: 0, False: 0]
  |  |  ------------------
  |  |  296|  22.6k|	    a0 -= *--pa;						\
  |  |  297|  22.6k|	if (a0 < lastx) {						\
  |  |  ------------------
  |  |  |  Branch (297:6): [True: 22.6k, False: 0]
  |  |  ------------------
  |  |  298|  22.6k|	    if (a0 < 0)							\
  |  |  ------------------
  |  |  |  Branch (298:10): [True: 0, False: 22.6k]
  |  |  ------------------
  |  |  299|  22.6k|		a0 = 0;							\
  |  |  300|  22.6k|	    if ((pa-thisrun)&1)						\
  |  |  ------------------
  |  |  |  Branch (300:10): [True: 0, False: 22.6k]
  |  |  ------------------
  |  |  301|  22.6k|		SETVALUE(0);						\
  |  |  ------------------
  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  251|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  302|  22.6k|	    SETVALUE(lastx - a0);						\
  |  |  ------------------
  |  |  |  |  242|  22.6k|#define SETVALUE(x) do {							\
  |  |  |  |  243|  22.6k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 22.6k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|  22.6k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|  22.6k|    a0 += (x);								\
  |  |  |  |  250|  22.6k|    RunLength = 0;							\
  |  |  |  |  251|  22.6k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  303|  22.6k|	} else if (a0 > lastx) {					\
  |  |  ------------------
  |  |  |  Branch (303:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  ------------------
  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  251|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|      0|	    SETVALUE(0);							\
  |  |  ------------------
  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  251|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  306|      0|	}								\
  |  |  307|  22.6k|    }									\
  |  |  308|  22.6k|} while (0)
  |  |  ------------------
  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  320|  27.1k|	EOF2Da:				/* premature EOF */
  321|  27.1k|		(*sp->fill)(buf, thisrun, pa, lastx);
  322|  27.1k|		UNCACHE_STATE(tif, sp);
  ------------------
  |  |  134|  27.1k|#define	UNCACHE_STATE(tif, sp) do {					\
  |  |  135|  27.1k|    sp->bit = BitsAvail;						\
  |  |  136|  27.1k|    sp->data = BitAcc;							\
  |  |  137|  27.1k|    sp->EOLcnt = EOLcnt;						\
  |  |  138|  27.1k|    tif->tif_rawcc -= (tmsize_t)((uint8_t*) cp - tif->tif_rawcp);		\
  |  |  139|  27.1k|    tif->tif_rawcp = (uint8_t*) cp;					\
  |  |  140|  27.1k|} while (0)
  |  |  ------------------
  |  |  |  Branch (140:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  323|  27.1k|		return (-1);
  324|  22.6k|	}
  325|  5.47k|	UNCACHE_STATE(tif, sp);
  ------------------
  |  |  134|  5.47k|#define	UNCACHE_STATE(tif, sp) do {					\
  |  |  135|  5.47k|    sp->bit = BitsAvail;						\
  |  |  136|  5.47k|    sp->data = BitAcc;							\
  |  |  137|  5.47k|    sp->EOLcnt = EOLcnt;						\
  |  |  138|  5.47k|    tif->tif_rawcc -= (tmsize_t)((uint8_t*) cp - tif->tif_rawcp);		\
  |  |  139|  5.47k|    tif->tif_rawcp = (uint8_t*) cp;					\
  |  |  140|  5.47k|} while (0)
  |  |  ------------------
  |  |  |  Branch (140:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  326|  5.47k|	return (1);
  327|  39.6k|}
tif_fax3.c:Fax3Unexpected:
  182|  86.8M|{
  183|  86.8M|	TIFFErrorExtR(tif, module, "Bad code word at line %"PRIu32" of %s %"PRIu32" (x %"PRIu32")",
  184|  86.8M|	    line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  207|  86.8M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  86.8M|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 86.8M, False: 0]
  |  |  ------------------
  ------------------
  185|  86.8M|	    (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
  ------------------
  |  |  207|  86.8M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  86.8M|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 86.8M, False: 0]
  |  |  ------------------
  ------------------
  186|  86.8M|	    a0);
  187|  86.8M|}
tif_fax3.c:Fax3PrematureEOF:
  214|  16.1k|{
  215|  16.1k|	TIFFWarningExtR(tif, module, "Premature EOF at line %"PRIu32" of %s %"PRIu32" (x %"PRIu32")",
  216|  16.1k|	    line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  207|  16.1k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  16.1k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 16.1k, False: 0]
  |  |  ------------------
  ------------------
  217|  16.1k|	    (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
  ------------------
  |  |  207|  16.1k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  16.1k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 16.1k, False: 0]
  |  |  ------------------
  ------------------
  218|  16.1k|	    a0);
  219|  16.1k|}
tif_fax3.c:Fax3BadLength:
  203|  88.2M|{
  204|  88.2M|	TIFFWarningExtR(tif, module, "%s at line %"PRIu32" of %s %"PRIu32" (got %"PRIu32", expected %"PRIu32")",
  205|  88.2M|	    a0 < lastx ? "Premature EOL" : "Line length mismatch",
  ------------------
  |  Branch (205:6): [True: 87.5M, False: 643k]
  ------------------
  206|  88.2M|	    line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  207|  88.2M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  88.2M|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 88.2M, False: 0]
  |  |  ------------------
  ------------------
  207|  88.2M|	    (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
  ------------------
  |  |  207|  88.2M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  88.2M|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 88.2M, False: 0]
  |  |  ------------------
  ------------------
  208|  88.2M|	    a0, lastx);
  209|  88.2M|}
tif_fax3.c:Fax3Extension:
  192|   103k|{
  193|   103k|	TIFFErrorExtR(tif, module,
  194|   103k|	    "Uncompressed data (not supported) at line %"PRIu32" of %s %"PRIu32" (x %"PRIu32")",
  195|   103k|	    line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  207|   103k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|   103k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 103k, False: 0]
  |  |  ------------------
  ------------------
  196|   103k|	    (isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip),
  ------------------
  |  |  207|   103k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|   103k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 103k, False: 0]
  |  |  ------------------
  ------------------
  197|   103k|	    a0);
  198|   103k|}
tif_fax3.c:Fax3PreDecode:
  147|  77.7k|{
  148|  77.7k|	Fax3CodecState* sp = DecoderState(tif);
  ------------------
  |  |   88|  77.7k|#define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  ------------------
  |  |  |  |   63|  77.7k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  149|       |
  150|  77.7k|	(void) s;
  151|  77.7k|	assert(sp != NULL);
  152|  77.7k|	sp->bit = 0;			/* force initial read */
  153|  77.7k|	sp->data = 0;
  154|  77.7k|	sp->EOLcnt = 0;			/* force initial scan for EOL */
  155|       |	/*
  156|       |	 * Decoder assumes lsb-to-msb bit order.  Note that we select
  157|       |	 * this here rather than in Fax3SetupState so that viewers can
  158|       |	 * hold the image open, fiddle with the FillOrder tag value,
  159|       |	 * and then re-decode the image.  Otherwise they'd need to close
  160|       |	 * and open the image to get the state reset.
  161|       |	 */
  162|  77.7k|	sp->bitmap =
  163|  77.7k|	    TIFFGetBitRevTable(tif->tif_dir.td_fillorder != FILLORDER_LSB2MSB);
  ------------------
  |  |  236|  77.7k|#define	    FILLORDER_LSB2MSB		2	/* least significant -> most */
  ------------------
  164|  77.7k|	sp->curruns = sp->runs;
  165|  77.7k|	if (sp->refruns) {		/* init reference line to white */
  ------------------
  |  Branch (165:6): [True: 63.3k, False: 14.4k]
  ------------------
  166|  63.3k|		sp->refruns = sp->runs + sp->nruns;
  167|  63.3k|		sp->refruns[0] = (uint32_t) sp->b.rowpixels;
  168|  63.3k|		sp->refruns[1] = 0;
  169|  63.3k|	}
  170|  77.7k|	sp->line = 0;
  171|  77.7k|	return (1);
  172|  77.7k|}
tif_fax3.c:Fax3Decode1D:
  233|  8.60k|{
  234|  8.60k|	DECLARE_STATE(tif, sp, "Fax3Decode1D");
  ------------------
  |  |  103|  8.60k|    static const char module[] = mod;					\
  |  |  104|  8.60k|    Fax3CodecState* sp = DecoderState(tif);				\
  |  |  ------------------
  |  |  |  |   88|  8.60k|#define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|  8.60k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  105|  8.60k|    int a0;				/* reference element */		\
  |  |  106|  8.60k|    int lastx = sp->b.rowpixels;	/* last element in row */	\
  |  |  107|  8.60k|    uint32_t BitAcc;			/* bit accumulator */		\
  |  |  108|  8.60k|    int BitsAvail;			/* # valid bits in BitAcc */	\
  |  |  109|  8.60k|    int RunLength;			/* length of current run */	\
  |  |  110|  8.60k|    unsigned char* cp;			/* next byte of input data */	\
  |  |  111|  8.60k|    unsigned char* ep;			/* end of input data */		\
  |  |  112|  8.60k|    uint32_t* pa;				/* place to stuff next run */	\
  |  |  113|  8.60k|    uint32_t* thisrun;			/* current row's run array */	\
  |  |  114|  8.60k|    int EOLcnt;				/* # EOL codes recognized */	\
  |  |  115|  8.60k|    const unsigned char* bitmap = sp->bitmap;	/* input data bit reverser */	\
  |  |  116|  8.60k|    const TIFFFaxTabEnt* TabEnt
  ------------------
  235|  8.60k|	(void) s;
  236|  8.60k|	if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (236:6): [True: 0, False: 8.60k]
  ------------------
  237|      0|	{
  238|      0|		TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
  239|      0|		return (-1);
  240|      0|	}
  241|  8.60k|	CACHE_STATE(tif, sp);
  ------------------
  |  |  124|  8.60k|#define	CACHE_STATE(tif, sp) do {					\
  |  |  125|  8.60k|    BitAcc = sp->data;							\
  |  |  126|  8.60k|    BitsAvail = sp->bit;						\
  |  |  127|  8.60k|    EOLcnt = sp->EOLcnt;						\
  |  |  128|  8.60k|    cp = (unsigned char*) tif->tif_rawcp;				\
  |  |  129|  8.60k|    ep = cp + tif->tif_rawcc;						\
  |  |  130|  8.60k|} while (0)
  |  |  ------------------
  |  |  |  Branch (130:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  242|  8.60k|	thisrun = sp->curruns;
  243|  89.7k|	while (occ > 0) {
  ------------------
  |  Branch (243:9): [True: 89.1k, False: 575]
  ------------------
  244|  89.1k|		a0 = 0;
  245|  89.1k|		RunLength = 0;
  246|  89.1k|		pa = thisrun;
  247|       |#ifdef FAX3_DEBUG
  248|       |		printf("\nBitAcc=%08"PRIX32", BitsAvail = %d\n", BitAcc, BitsAvail);
  249|       |		printf("-------------------- %"PRIu32"\n", tif->tif_row);
  250|       |		fflush(stdout);
  251|       |#endif
  252|  89.1k|		SYNC_EOL(EOF1D);
  ------------------
  |  |  264|  89.1k|#define	SYNC_EOL(eoflab) do {						\
  |  |  265|  89.1k|    if (EOLcnt == 0) {							\
  |  |  ------------------
  |  |  |  Branch (265:9): [True: 34.8k, False: 54.2k]
  |  |  ------------------
  |  |  266|  2.67M|	for (;;) {							\
  |  |  267|  2.67M|	    NeedBits16(11,eoflab);					\
  |  |  ------------------
  |  |  |  |  151|  2.67M|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  152|  2.67M|    if (BitsAvail < (n)) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (152:9): [True: 377k, False: 2.30M]
  |  |  |  |  ------------------
  |  |  |  |  153|   377k|	if (EndOfData()) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|   377k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (111:21): [True: 31.1k, False: 346k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  154|  31.1k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (154:10): [True: 0, False: 31.1k]
  |  |  |  |  ------------------
  |  |  |  |  155|  31.1k|		goto eoflab;						\
  |  |  |  |  156|  31.1k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  157|   346k|	} else {							\
  |  |  |  |  158|   346k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  159|   346k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (159:10): [True: 8.70k, False: 337k]
  |  |  |  |  ------------------
  |  |  |  |  160|  8.70k|		if (EndOfData()) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|  8.70k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (111:21): [True: 1.87k, False: 6.82k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  161|  1.87k|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  162|  1.87k|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  163|  6.82k|		} else {						\
  |  |  |  |  164|  6.82k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  165|  6.82k|		    BitsAvail += 8;					\
  |  |  |  |  166|  6.82k|		}							\
  |  |  |  |  167|  8.70k|	    }								\
  |  |  |  |  168|   346k|	}								\
  |  |  |  |  169|   377k|    }									\
  |  |  |  |  170|  2.67M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  268|  2.67M|	    if (GetBits(11) == 0)					\
  |  |  ------------------
  |  |  |  |  172|  2.67M|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  ------------------
  |  |  |  Branch (268:10): [True: 34.8k, False: 2.64M]
  |  |  ------------------
  |  |  269|  2.67M|		break;							\
  |  |  270|  2.67M|	    ClrBits(1);							\
  |  |  ------------------
  |  |  |  |  173|  2.64M|#define ClrBits(n) do {							\
  |  |  |  |  174|  2.64M|    BitsAvail -= (n);							\
  |  |  |  |  175|  2.64M|    BitAcc >>= (n);							\
  |  |  |  |  176|  2.64M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  271|  2.64M|	}								\
  |  |  272|  34.8k|    }									\
  |  |  273|   217k|    for (;;) {								\
  |  |  274|   217k|	NeedBits8(8,eoflab);						\
  |  |  ------------------
  |  |  |  |  137|   217k|#define NeedBits8(n,eoflab) do {					\
  |  |  |  |  138|   217k|    if (BitsAvail < (n)) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (138:9): [True: 149k, False: 67.9k]
  |  |  |  |  ------------------
  |  |  |  |  139|   149k|	if (EndOfData()) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|   149k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (111:21): [True: 13.5k, False: 135k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  140|  13.5k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:10): [True: 6.76k, False: 6.74k]
  |  |  |  |  ------------------
  |  |  |  |  141|  13.5k|		goto eoflab;						\
  |  |  |  |  142|  13.5k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  143|   135k|	} else {							\
  |  |  |  |  144|   135k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  145|   135k|	    BitsAvail += 8;						\
  |  |  |  |  146|   135k|	}								\
  |  |  |  |  147|   149k|    }									\
  |  |  |  |  148|   217k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (148:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  275|   217k|	if (GetBits(8))							\
  |  |  ------------------
  |  |  |  |  172|   210k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:20): [True: 82.3k, False: 127k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  276|   210k|	    break;							\
  |  |  277|   210k|	ClrBits(8);							\
  |  |  ------------------
  |  |  |  |  173|   127k|#define ClrBits(n) do {							\
  |  |  |  |  174|   127k|    BitsAvail -= (n);							\
  |  |  |  |  175|   127k|    BitAcc >>= (n);							\
  |  |  |  |  176|   127k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  278|   127k|    }									\
  |  |  279|   379k|    while (GetBits(1) == 0)						\
  |  |  ------------------
  |  |  |  |  172|   379k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  ------------------
  |  |  |  Branch (279:12): [True: 297k, False: 82.3k]
  |  |  ------------------
  |  |  280|   297k|	ClrBits(1);							\
  |  |  ------------------
  |  |  |  |  173|   379k|#define ClrBits(n) do {							\
  |  |  |  |  174|   297k|    BitsAvail -= (n);							\
  |  |  |  |  175|   297k|    BitAcc >>= (n);							\
  |  |  |  |  176|   297k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  281|  82.3k|    ClrBits(1);				/* EOL bit */			\
  |  |  ------------------
  |  |  |  |  173|  82.3k|#define ClrBits(n) do {							\
  |  |  |  |  174|  82.3k|    BitsAvail -= (n);							\
  |  |  |  |  175|  82.3k|    BitAcc >>= (n);							\
  |  |  |  |  176|  82.3k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  282|  82.3k|    EOLcnt = 0;				/* reset EOL counter/flag */	\
  |  |  283|  82.3k|} while (0)
  |  |  ------------------
  |  |  |  Branch (283:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  253|  82.3k|		EXPAND1D(EOF1Da);
  ------------------
  |  |  322|  82.3k|#define EXPAND1D(eoflab) do {						\
  |  |  323|   225k|    for (;;) {								\
  |  |  324|  1.17M|	for (;;) {							\
  |  |  325|  1.17M|	    LOOKUP16(12, TIFFFaxWhiteTable, eof1d);			\
  |  |  ------------------
  |  |  |  |  232|  1.17M|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|  1.17M|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  1.17M|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|  1.17M|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 1.06M, False: 109k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  1.06M|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  1.06M|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 3.29k, False: 1.06M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.29k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 690, False: 2.60k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  3.29k|		goto eoflab;						\
  |  |  |  |  |  |  156|  3.29k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|  1.06M|	} else {							\
  |  |  |  |  |  |  158|  1.06M|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|  1.06M|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 35.2k, False: 1.02M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  35.2k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  35.2k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 468, False: 34.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    468|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    468|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  34.8k|		} else {						\
  |  |  |  |  |  |  164|  34.8k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  34.8k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  34.8k|		}							\
  |  |  |  |  |  |  167|  35.2k|	    }								\
  |  |  |  |  |  |  168|  1.06M|	}								\
  |  |  |  |  |  |  169|  1.06M|    }									\
  |  |  |  |  |  |  170|  1.17M|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|  1.17M|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  1.17M|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|  1.17M|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|  1.17M|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|  1.17M|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|  1.17M|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|  1.17M|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|  1.17M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  1.17M|	    switch (TabEnt->State) {					\
  |  |  327|  35.6k|	    case S_EOL:							\
  |  |  ------------------
  |  |  |  |   80|  35.6k|#define S_EOL      12
  |  |  ------------------
  |  |  |  Branch (327:6): [True: 35.6k, False: 1.13M]
  |  |  ------------------
  |  |  328|  35.6k|		EOLcnt = 1;						\
  |  |  329|  35.6k|		goto done1d;						\
  |  |  330|   184k|	    case S_TermW:						\
  |  |  ------------------
  |  |  |  |   75|   184k|#define S_TermW    7
  |  |  ------------------
  |  |  |  Branch (330:6): [True: 184k, False: 990k]
  |  |  ------------------
  |  |  331|   184k|		SETVALUE(TabEnt->Param);					\
  |  |  ------------------
  |  |  |  |  242|   184k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   184k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 184k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   184k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   184k|    a0 += (x);								\
  |  |  |  |  250|   184k|    RunLength = 0;							\
  |  |  |  |  251|   184k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  332|   184k|		goto doneWhite1d;					\
  |  |  333|   920k|	    case S_MakeUpW:						\
  |  |  ------------------
  |  |  |  |   77|   920k|#define S_MakeUpW  9
  |  |  ------------------
  |  |  |  Branch (333:6): [True: 920k, False: 254k]
  |  |  ------------------
  |  |  334|   950k|	    case S_MakeUp:						\
  |  |  ------------------
  |  |  |  |   79|   950k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (334:6): [True: 29.6k, False: 1.14M]
  |  |  ------------------
  |  |  335|   950k|		a0 += TabEnt->Param;					\
  |  |  336|   950k|		RunLength += TabEnt->Param;				\
  |  |  337|   950k|		break;							\
  |  |  338|   920k|	    default:							\
  |  |  ------------------
  |  |  |  Branch (338:6): [True: 4.69k, False: 1.16M]
  |  |  ------------------
  |  |  339|  4.69k|		unexpected("WhiteTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|  4.69k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  340|  4.69k|		goto done1d;						\
  |  |  341|  1.17M|	    }								\
  |  |  342|  1.17M|	}								\
  |  |  343|   225k|    doneWhite1d:							\
  |  |  344|   184k|	if (a0 >= lastx)						\
  |  |  ------------------
  |  |  |  Branch (344:6): [True: 10.1k, False: 173k]
  |  |  ------------------
  |  |  345|   184k|	    goto done1d;						\
  |  |  346|   184k|	for (;;) {							\
  |  |  347|   182k|	    LOOKUP16(13, TIFFFaxBlackTable, eof1d);			\
  |  |  ------------------
  |  |  |  |  232|   182k|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|   182k|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   182k|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|   182k|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 137k, False: 44.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   137k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   137k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 2.77k, False: 134k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.77k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 573, False: 2.20k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  2.77k|		goto eoflab;						\
  |  |  |  |  |  |  156|  2.77k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|   134k|	} else {							\
  |  |  |  |  |  |  158|   134k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|   134k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 5.82k, False: 128k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  5.82k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  5.82k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 708, False: 5.11k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    708|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    708|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  5.11k|		} else {						\
  |  |  |  |  |  |  164|  5.11k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  5.11k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  5.11k|		}							\
  |  |  |  |  |  |  167|  5.82k|	    }								\
  |  |  |  |  |  |  168|   134k|	}								\
  |  |  |  |  |  |  169|   137k|    }									\
  |  |  |  |  |  |  170|   182k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|   182k|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|   181k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|   181k|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|   181k|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|   181k|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|   181k|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|   181k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|   181k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  348|   182k|	    switch (TabEnt->State) {					\
  |  |  349|  19.1k|	    case S_EOL:							\
  |  |  ------------------
  |  |  |  |   80|  19.1k|#define S_EOL      12
  |  |  ------------------
  |  |  |  Branch (349:6): [True: 19.1k, False: 162k]
  |  |  ------------------
  |  |  350|  19.1k|		EOLcnt = 1;						\
  |  |  351|  19.1k|		goto done1d;						\
  |  |  352|   147k|	    case S_TermB:						\
  |  |  ------------------
  |  |  |  |   76|   147k|#define S_TermB    8
  |  |  ------------------
  |  |  |  Branch (352:6): [True: 147k, False: 33.9k]
  |  |  ------------------
  |  |  353|   147k|		SETVALUE(TabEnt->Param);					\
  |  |  ------------------
  |  |  |  |  242|   147k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   147k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 147k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   147k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   147k|    a0 += (x);								\
  |  |  |  |  250|   147k|    RunLength = 0;							\
  |  |  |  |  251|   147k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  354|   147k|		goto doneBlack1d;					\
  |  |  355|   147k|	    case S_MakeUpB:						\
  |  |  ------------------
  |  |  |  |   78|  3.47k|#define S_MakeUpB  10
  |  |  ------------------
  |  |  |  Branch (355:6): [True: 3.47k, False: 177k]
  |  |  ------------------
  |  |  356|  8.13k|	    case S_MakeUp:						\
  |  |  ------------------
  |  |  |  |   79|  8.13k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (356:6): [True: 4.65k, False: 176k]
  |  |  ------------------
  |  |  357|  8.13k|		a0 += TabEnt->Param;					\
  |  |  358|  8.13k|		RunLength += TabEnt->Param;				\
  |  |  359|  8.13k|		break;							\
  |  |  360|  6.72k|	    default:							\
  |  |  ------------------
  |  |  |  Branch (360:6): [True: 6.72k, False: 174k]
  |  |  ------------------
  |  |  361|  6.72k|		unexpected("BlackTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|  6.72k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  362|  6.72k|		goto done1d;						\
  |  |  363|   181k|	    }								\
  |  |  364|   181k|	}								\
  |  |  365|   173k|    doneBlack1d:							\
  |  |  366|   147k|	if (a0 >= lastx)						\
  |  |  ------------------
  |  |  |  Branch (366:6): [True: 4.76k, False: 142k]
  |  |  ------------------
  |  |  367|   147k|	    goto done1d;						\
  |  |  368|   147k|        if( *(pa-1) == 0 && *(pa-2) == 0 )				\
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 767, False: 141k]
  |  |  |  Branch (368:29): [True: 217, False: 550]
  |  |  ------------------
  |  |  369|   142k|            pa -= 2;                                                    \
  |  |  370|   142k|    }									\
  |  |  371|  1.26k|eof1d:									\
  |  |  372|  1.26k|    prematureEOF(a0);							\
  |  |  ------------------
  |  |  |  |  220|  1.26k|#define	prematureEOF(a0)	Fax3PrematureEOF(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  373|  1.26k|    CLEANUP_RUNS();							\
  |  |  ------------------
  |  |  |  |  290|  1.26k|#define	CLEANUP_RUNS() do {						\
  |  |  |  |  291|  1.26k|    if (RunLength)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (291:9): [True: 1.00k, False: 257]
  |  |  |  |  ------------------
  |  |  |  |  292|  1.26k|	SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  1.00k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  1.00k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 1.00k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  1.00k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  1.00k|    a0 += (x);								\
  |  |  |  |  |  |  250|  1.00k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  1.00k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  293|  1.26k|    if (a0 != lastx) {							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (293:9): [True: 979, False: 284]
  |  |  |  |  ------------------
  |  |  |  |  294|    979|	badlength(a0, lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|    979|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  |  |  ------------------
  |  |  |  |  295|  1.50k|	while (a0 > lastx && pa > thisrun)				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (295:9): [True: 527, False: 979]
  |  |  |  |  |  Branch (295:23): [True: 527, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  296|    979|	    a0 -= *--pa;						\
  |  |  |  |  297|    979|	if (a0 < lastx) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (297:6): [True: 979, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  298|    979|	    if (a0 < 0)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (298:10): [True: 0, False: 979]
  |  |  |  |  ------------------
  |  |  |  |  299|    979|		a0 = 0;							\
  |  |  |  |  300|    979|	    if ((pa-thisrun)&1)						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (300:10): [True: 480, False: 499]
  |  |  |  |  ------------------
  |  |  |  |  301|    979|		SETVALUE(0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|    480|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|    480|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 480]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|    480|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|    480|    a0 += (x);								\
  |  |  |  |  |  |  250|    480|    RunLength = 0;							\
  |  |  |  |  |  |  251|    480|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  302|    979|	    SETVALUE(lastx - a0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|    979|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|    979|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 979]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|    979|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|    979|    a0 += (x);								\
  |  |  |  |  |  |  250|    979|    RunLength = 0;							\
  |  |  |  |  |  |  251|    979|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  303|    979|	} else if (a0 > lastx) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (303:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  305|      0|	    SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  306|      0|	}								\
  |  |  |  |  307|    979|    }									\
  |  |  |  |  308|  1.26k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  374|  81.1k|    goto eoflab;							\
  |  |  375|  81.1k|done1d:									\
  |  |  376|  81.1k|    CLEANUP_RUNS();							\
  |  |  ------------------
  |  |  |  |  290|  81.1k|#define	CLEANUP_RUNS() do {						\
  |  |  |  |  291|  81.1k|    if (RunLength)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (291:9): [True: 3.25k, False: 77.8k]
  |  |  |  |  ------------------
  |  |  |  |  292|  81.1k|	SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  3.25k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  3.25k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 3.25k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  3.25k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  3.25k|    a0 += (x);								\
  |  |  |  |  |  |  250|  3.25k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  3.25k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  293|  81.1k|    if (a0 != lastx) {							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (293:9): [True: 80.5k, False: 544]
  |  |  |  |  ------------------
  |  |  |  |  294|  80.5k|	badlength(a0, lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|  80.5k|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  |  |  ------------------
  |  |  |  |  295|  97.3k|	while (a0 > lastx && pa > thisrun)				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (295:9): [True: 16.7k, False: 80.5k]
  |  |  |  |  |  Branch (295:23): [True: 16.7k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  296|  80.5k|	    a0 -= *--pa;						\
  |  |  |  |  297|  80.5k|	if (a0 < lastx) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (297:6): [True: 80.5k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  298|  80.5k|	    if (a0 < 0)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (298:10): [True: 0, False: 80.5k]
  |  |  |  |  ------------------
  |  |  |  |  299|  80.5k|		a0 = 0;							\
  |  |  |  |  300|  80.5k|	    if ((pa-thisrun)&1)						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (300:10): [True: 30.9k, False: 49.6k]
  |  |  |  |  ------------------
  |  |  |  |  301|  80.5k|		SETVALUE(0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  30.9k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  30.9k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 30.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  30.9k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  30.9k|    a0 += (x);								\
  |  |  |  |  |  |  250|  30.9k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  30.9k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  302|  80.5k|	    SETVALUE(lastx - a0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  80.5k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  80.5k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 80.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  80.5k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  80.5k|    a0 += (x);								\
  |  |  |  |  |  |  250|  80.5k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  80.5k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  303|  80.5k|	} else if (a0 > lastx) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (303:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  305|      0|	    SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  306|      0|	}								\
  |  |  |  |  307|  80.5k|    }									\
  |  |  |  |  308|  81.1k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  377|  81.1k|} while (0)
  |  |  ------------------
  |  |  |  Branch (377:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  254|  81.1k|		(*sp->fill)(buf, thisrun, pa, lastx);
  255|  81.1k|		buf += sp->b.rowbytes;
  256|  81.1k|		occ -= sp->b.rowbytes;
  257|  81.1k|		sp->line++;
  258|  81.1k|		continue;
  259|  6.76k|	EOF1D:				/* premature EOF */
  260|  6.76k|		CLEANUP_RUNS();
  ------------------
  |  |  290|  6.76k|#define	CLEANUP_RUNS() do {						\
  |  |  291|  6.76k|    if (RunLength)							\
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 0, False: 6.76k]
  |  |  ------------------
  |  |  292|  6.76k|	SETVALUE(0);							\
  |  |  ------------------
  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  251|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  293|  6.76k|    if (a0 != lastx) {							\
  |  |  ------------------
  |  |  |  Branch (293:9): [True: 6.76k, False: 0]
  |  |  ------------------
  |  |  294|  6.76k|	badlength(a0, lastx);						\
  |  |  ------------------
  |  |  |  |  210|  6.76k|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  ------------------
  |  |  295|  6.76k|	while (a0 > lastx && pa > thisrun)				\
  |  |  ------------------
  |  |  |  Branch (295:9): [True: 0, False: 6.76k]
  |  |  |  Branch (295:23): [True: 0, False: 0]
  |  |  ------------------
  |  |  296|  6.76k|	    a0 -= *--pa;						\
  |  |  297|  6.76k|	if (a0 < lastx) {						\
  |  |  ------------------
  |  |  |  Branch (297:6): [True: 6.76k, False: 0]
  |  |  ------------------
  |  |  298|  6.76k|	    if (a0 < 0)							\
  |  |  ------------------
  |  |  |  Branch (298:10): [True: 0, False: 6.76k]
  |  |  ------------------
  |  |  299|  6.76k|		a0 = 0;							\
  |  |  300|  6.76k|	    if ((pa-thisrun)&1)						\
  |  |  ------------------
  |  |  |  Branch (300:10): [True: 0, False: 6.76k]
  |  |  ------------------
  |  |  301|  6.76k|		SETVALUE(0);						\
  |  |  ------------------
  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  251|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  302|  6.76k|	    SETVALUE(lastx - a0);						\
  |  |  ------------------
  |  |  |  |  242|  6.76k|#define SETVALUE(x) do {							\
  |  |  |  |  243|  6.76k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 6.76k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|  6.76k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|  6.76k|    a0 += (x);								\
  |  |  |  |  250|  6.76k|    RunLength = 0;							\
  |  |  |  |  251|  6.76k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  303|  6.76k|	} else if (a0 > lastx) {					\
  |  |  ------------------
  |  |  |  Branch (303:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  ------------------
  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  251|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|      0|	    SETVALUE(0);							\
  |  |  ------------------
  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  251|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  306|      0|	}								\
  |  |  307|  6.76k|    }									\
  |  |  308|  6.76k|} while (0)
  |  |  ------------------
  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  261|  8.02k|	EOF1Da:				/* premature EOF */
  262|  8.02k|		(*sp->fill)(buf, thisrun, pa, lastx);
  263|  8.02k|		UNCACHE_STATE(tif, sp);
  ------------------
  |  |  134|  8.02k|#define	UNCACHE_STATE(tif, sp) do {					\
  |  |  135|  8.02k|    sp->bit = BitsAvail;						\
  |  |  136|  8.02k|    sp->data = BitAcc;							\
  |  |  137|  8.02k|    sp->EOLcnt = EOLcnt;						\
  |  |  138|  8.02k|    tif->tif_rawcc -= (tmsize_t)((uint8_t*) cp - tif->tif_rawcp);		\
  |  |  139|  8.02k|    tif->tif_rawcp = (uint8_t*) cp;					\
  |  |  140|  8.02k|} while (0)
  |  |  ------------------
  |  |  |  Branch (140:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  264|  8.02k|		return (-1);
  265|  6.76k|	}
  266|    575|	UNCACHE_STATE(tif, sp);
  ------------------
  |  |  134|    575|#define	UNCACHE_STATE(tif, sp) do {					\
  |  |  135|    575|    sp->bit = BitsAvail;						\
  |  |  136|    575|    sp->data = BitAcc;							\
  |  |  137|    575|    sp->EOLcnt = EOLcnt;						\
  |  |  138|    575|    tif->tif_rawcc -= (tmsize_t)((uint8_t*) cp - tif->tif_rawcp);		\
  |  |  139|    575|    tif->tif_rawcp = (uint8_t*) cp;					\
  |  |  140|    575|} while (0)
  |  |  ------------------
  |  |  |  Branch (140:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  267|    575|	return (1);
  268|  8.60k|}
tif_fax3.c:Fax3Cleanup:
 1130|  2.16k|{
 1131|  2.16k|	Fax3CodecState* sp = DecoderState(tif);
  ------------------
  |  |   88|  2.16k|#define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  ------------------
  |  |  |  |   63|  2.16k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
 1132|       |	
 1133|  2.16k|	assert(sp != 0);
 1134|       |
 1135|  2.16k|	tif->tif_tagmethods.vgetfield = sp->b.vgetparent;
 1136|  2.16k|	tif->tif_tagmethods.vsetfield = sp->b.vsetparent;
 1137|  2.16k|	tif->tif_tagmethods.printdir = sp->b.printdir;
 1138|       |
 1139|  2.16k|	if (sp->runs)
  ------------------
  |  Branch (1139:6): [True: 1.88k, False: 283]
  ------------------
 1140|  1.88k|		_TIFFfree(sp->runs);
 1141|  2.16k|	if (sp->refline)
  ------------------
  |  Branch (1141:6): [True: 1.35k, False: 817]
  ------------------
 1142|  1.35k|		_TIFFfree(sp->refline);
 1143|       |
 1144|  2.16k|	_TIFFfree(tif->tif_data);
 1145|  2.16k|	tif->tif_data = NULL;
 1146|       |
 1147|  2.16k|	_TIFFSetDefaultCompressionState(tif);
 1148|  2.16k|}
tif_fax3.c:Fax4Decode:
 1411|  23.6k|{
 1412|  23.6k|	DECLARE_STATE_2D(tif, sp, "Fax4Decode");
  ------------------
  |  |  118|  23.6k|    DECLARE_STATE(tif, sp, mod);					\
  |  |  ------------------
  |  |  |  |  103|  23.6k|    static const char module[] = mod;					\
  |  |  |  |  104|  23.6k|    Fax3CodecState* sp = DecoderState(tif);				\
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|  23.6k|#define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   63|  23.6k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  105|  23.6k|    int a0;				/* reference element */		\
  |  |  |  |  106|  23.6k|    int lastx = sp->b.rowpixels;	/* last element in row */	\
  |  |  |  |  107|  23.6k|    uint32_t BitAcc;			/* bit accumulator */		\
  |  |  |  |  108|  23.6k|    int BitsAvail;			/* # valid bits in BitAcc */	\
  |  |  |  |  109|  23.6k|    int RunLength;			/* length of current run */	\
  |  |  |  |  110|  23.6k|    unsigned char* cp;			/* next byte of input data */	\
  |  |  |  |  111|  23.6k|    unsigned char* ep;			/* end of input data */		\
  |  |  |  |  112|  23.6k|    uint32_t* pa;				/* place to stuff next run */	\
  |  |  |  |  113|  23.6k|    uint32_t* thisrun;			/* current row's run array */	\
  |  |  |  |  114|  23.6k|    int EOLcnt;				/* # EOL codes recognized */	\
  |  |  |  |  115|  23.6k|    const unsigned char* bitmap = sp->bitmap;	/* input data bit reverser */	\
  |  |  |  |  116|  23.6k|    const TIFFFaxTabEnt* TabEnt
  |  |  ------------------
  |  |  119|  23.6k|    int b1;				/* next change on prev line */	\
  |  |  120|  23.6k|    uint32_t* pb				/* next run in reference line */\
  ------------------
 1413|  23.6k|	(void) s;
 1414|  23.6k|	if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (1414:6): [True: 0, False: 23.6k]
  ------------------
 1415|      0|	{
 1416|      0|		TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
 1417|      0|		return (-1);
 1418|      0|	}
 1419|  23.6k|	CACHE_STATE(tif, sp);
  ------------------
  |  |  124|  23.6k|#define	CACHE_STATE(tif, sp) do {					\
  |  |  125|  23.6k|    BitAcc = sp->data;							\
  |  |  126|  23.6k|    BitsAvail = sp->bit;						\
  |  |  127|  23.6k|    EOLcnt = sp->EOLcnt;						\
  |  |  128|  23.6k|    cp = (unsigned char*) tif->tif_rawcp;				\
  |  |  129|  23.6k|    ep = cp + tif->tif_rawcc;						\
  |  |  130|  23.6k|} while (0)
  |  |  ------------------
  |  |  |  Branch (130:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1420|   527k|	while (occ > 0) {
  ------------------
  |  Branch (1420:9): [True: 525k, False: 1.92k]
  ------------------
 1421|   525k|		a0 = 0;
 1422|   525k|		RunLength = 0;
 1423|   525k|		pa = thisrun = sp->curruns;
 1424|   525k|		pb = sp->refruns;
 1425|   525k|		b1 = *pb++;
 1426|       |#ifdef FAX3_DEBUG
 1427|       |		printf("\nBitAcc=%08"PRIX32", BitsAvail = %d\n", BitAcc, BitsAvail);
 1428|       |		printf("-------------------- %d\n", tif->tif_row);
 1429|       |		fflush(stdout);
 1430|       |#endif
 1431|   525k|		EXPAND2D(EOFG4);
  ------------------
  |  |  398|   525k|#define EXPAND2D(eoflab) do {						\
  |  |  399|  1.90M|    while (a0 < lastx) {						\
  |  |  ------------------
  |  |  |  Branch (399:12): [True: 1.45M, False: 453k]
  |  |  ------------------
  |  |  400|  1.45M|	if (pa >= thisrun + sp->nruns) {				\
  |  |  ------------------
  |  |  |  Branch (400:6): [True: 210, False: 1.45M]
  |  |  ------------------
  |  |  401|    210|		TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  402|    210|		             sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    210|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    210|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 210, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               		             sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    210|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    210|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 210, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|    210|		return (-1);						\
  |  |  404|    210|	}								\
  |  |  405|  1.45M|	LOOKUP8(7, TIFFFaxMainTable, eof2d);				\
  |  |  ------------------
  |  |  |  |  227|  1.45M|#define LOOKUP8(wid,tab,eoflab) do {					\
  |  |  |  |  228|  1.45M|    NeedBits8(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  137|  1.45M|#define NeedBits8(n,eoflab) do {					\
  |  |  |  |  |  |  138|  1.45M|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (138:9): [True: 353k, False: 1.10M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  139|   353k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   353k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 11.3k, False: 341k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  140|  11.3k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (140:10): [True: 464, False: 10.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  141|  11.3k|		goto eoflab;						\
  |  |  |  |  |  |  142|  11.3k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  143|   341k|	} else {							\
  |  |  |  |  |  |  144|   341k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  145|   341k|	    BitsAvail += 8;						\
  |  |  |  |  |  |  146|   341k|	}								\
  |  |  |  |  |  |  147|   353k|    }									\
  |  |  |  |  |  |  148|  1.45M|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (148:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  229|  1.45M|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  1.45M|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  230|  1.45M|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|  1.45M|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|  1.45M|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|  1.45M|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|  1.45M|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  231|  1.45M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (231:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  406|  1.45M|	switch (TabEnt->State) {					\
  |  |  407|  58.4k|	case S_Pass:							\
  |  |  ------------------
  |  |  |  |   69|  58.4k|#define S_Pass     1
  |  |  ------------------
  |  |  |  Branch (407:2): [True: 58.4k, False: 1.39M]
  |  |  ------------------
  |  |  408|  58.4k|	    CHECK_b1;							\
  |  |  ------------------
  |  |  |  |  383|  58.4k|#define CHECK_b1 do {							\
  |  |  |  |  384|  58.4k|    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:9): [True: 21.6k, False: 36.8k]
  |  |  |  |  |  Branch (384:31): [True: 10.2k, False: 21.6k]
  |  |  |  |  |  Branch (384:43): [True: 10.2k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  385|  10.2k|	if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (385:6): [True: 0, False: 10.2k]
  |  |  |  |  ------------------
  |  |  |  |  386|      0|	    TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  387|      0|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  388|      0|	    return (-1);						\
  |  |  |  |  389|      0|	}								\
  |  |  |  |  390|  10.2k|	b1 += pb[0] + pb[1];						\
  |  |  |  |  391|  10.2k|	pb += 2;							\
  |  |  |  |  392|  10.2k|    }									\
  |  |  |  |  393|  58.4k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  409|  58.4k|	    if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  ------------------
  |  |  |  Branch (409:10): [True: 242, False: 58.2k]
  |  |  ------------------
  |  |  410|    242|	        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  411|    242|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    242|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    242|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 242, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    242|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    242|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 242, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  412|    242|	        return (-1);						\
  |  |  413|    242|	    }								\
  |  |  414|  58.4k|	    b1 += *pb++;						\
  |  |  415|  58.2k|	    RunLength += b1 - a0;					\
  |  |  416|  58.2k|	    a0 = b1;							\
  |  |  417|  58.2k|	    b1 += *pb++;						\
  |  |  418|  58.2k|	    break;							\
  |  |  419|   227k|	case S_Horiz:							\
  |  |  ------------------
  |  |  |  |   70|   227k|#define S_Horiz    2
  |  |  ------------------
  |  |  |  Branch (419:2): [True: 227k, False: 1.22M]
  |  |  ------------------
  |  |  420|   227k|	    if ((pa-thisrun)&1) {					\
  |  |  ------------------
  |  |  |  Branch (420:10): [True: 58.4k, False: 169k]
  |  |  ------------------
  |  |  421|  60.1k|		for (;;) {	/* black first */			\
  |  |  422|  60.1k|		    LOOKUP16(13, TIFFFaxBlackTable, eof2d);		\
  |  |  ------------------
  |  |  |  |  232|  60.1k|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|  60.1k|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  60.1k|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|  60.1k|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 59.6k, False: 530]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  59.6k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  59.6k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 1.00k, False: 58.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  1.00k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 211, False: 796]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  1.00k|		goto eoflab;						\
  |  |  |  |  |  |  156|  1.00k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|  58.6k|	} else {							\
  |  |  |  |  |  |  158|  58.6k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|  58.6k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 5.77k, False: 52.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  5.77k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  5.77k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 255, False: 5.51k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    255|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    255|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  5.51k|		} else {						\
  |  |  |  |  |  |  164|  5.51k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  5.51k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  5.51k|		}							\
  |  |  |  |  |  |  167|  5.77k|	    }								\
  |  |  |  |  |  |  168|  58.6k|	}								\
  |  |  |  |  |  |  169|  59.6k|    }									\
  |  |  |  |  |  |  170|  60.1k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|  60.1k|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  59.9k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|  59.9k|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|  59.9k|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|  59.9k|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|  59.9k|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|  59.9k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|  59.9k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  423|  60.1k|		    switch (TabEnt->State) {				\
  |  |  424|  57.4k|		    case S_TermB:					\
  |  |  ------------------
  |  |  |  |   76|  57.4k|#define S_TermB    8
  |  |  ------------------
  |  |  |  Branch (424:7): [True: 57.4k, False: 2.49k]
  |  |  ------------------
  |  |  425|  57.4k|			SETVALUE(TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|  57.4k|#define SETVALUE(x) do {							\
  |  |  |  |  243|  57.4k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 57.4k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|  57.4k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|  57.4k|    a0 += (x);								\
  |  |  |  |  250|  57.4k|    RunLength = 0;							\
  |  |  |  |  251|  57.4k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  426|  57.4k|			goto doneWhite2da;				\
  |  |  427|  57.4k|		    case S_MakeUpB:					\
  |  |  ------------------
  |  |  |  |   78|    665|#define S_MakeUpB  10
  |  |  ------------------
  |  |  |  Branch (427:7): [True: 665, False: 59.2k]
  |  |  ------------------
  |  |  428|  1.72k|		    case S_MakeUp:					\
  |  |  ------------------
  |  |  |  |   79|  1.72k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (428:7): [True: 1.06k, False: 58.8k]
  |  |  ------------------
  |  |  429|  1.72k|			a0 += TabEnt->Param;				\
  |  |  430|  1.72k|			RunLength += TabEnt->Param;			\
  |  |  431|  1.72k|			break;						\
  |  |  432|    767|		    default:						\
  |  |  ------------------
  |  |  |  Branch (432:7): [True: 767, False: 59.1k]
  |  |  ------------------
  |  |  433|    767|			goto badBlack2d;				\
  |  |  434|  59.9k|		    }							\
  |  |  435|  59.9k|		}							\
  |  |  436|  58.4k|	    doneWhite2da:;						\
  |  |  437|   114k|		for (;;) {	/* then white */			\
  |  |  438|   114k|		    LOOKUP16(12, TIFFFaxWhiteTable, eof2d);		\
  |  |  ------------------
  |  |  |  |  232|   114k|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|   114k|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   114k|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|   114k|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 68.4k, False: 46.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  68.4k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  68.4k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 2.14k, False: 66.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.14k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 360, False: 1.78k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  2.14k|		goto eoflab;						\
  |  |  |  |  |  |  156|  2.14k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|  66.2k|	} else {							\
  |  |  |  |  |  |  158|  66.2k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|  66.2k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 1.80k, False: 64.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  1.80k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  1.80k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 237, False: 1.56k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    237|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    237|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  1.56k|		} else {						\
  |  |  |  |  |  |  164|  1.56k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  1.56k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  1.56k|		}							\
  |  |  |  |  |  |  167|  1.80k|	    }								\
  |  |  |  |  |  |  168|  66.2k|	}								\
  |  |  |  |  |  |  169|  68.4k|    }									\
  |  |  |  |  |  |  170|   114k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|   114k|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|   114k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|   114k|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|   114k|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|   114k|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|   114k|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|   114k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|   114k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  439|   114k|		    switch (TabEnt->State) {				\
  |  |  440|  55.6k|		    case S_TermW:					\
  |  |  ------------------
  |  |  |  |   75|  55.6k|#define S_TermW    7
  |  |  ------------------
  |  |  |  Branch (440:7): [True: 55.6k, False: 58.7k]
  |  |  ------------------
  |  |  441|  55.6k|			SETVALUE(TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|  55.6k|#define SETVALUE(x) do {							\
  |  |  |  |  243|  55.6k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 318, False: 55.3k]
  |  |  |  |  ------------------
  |  |  |  |  244|    318|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|    318|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    318|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    318|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 318, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|    318|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    318|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 318, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|    318|        return (-1);							\
  |  |  |  |  247|    318|    }									\
  |  |  |  |  248|  55.6k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|  55.3k|    a0 += (x);								\
  |  |  |  |  250|  55.3k|    RunLength = 0;							\
  |  |  |  |  251|  55.3k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  442|  55.6k|			goto doneBlack2da;				\
  |  |  443|  55.6k|		    case S_MakeUpW:					\
  |  |  ------------------
  |  |  |  |   77|  55.0k|#define S_MakeUpW  9
  |  |  ------------------
  |  |  |  Branch (443:7): [True: 55.0k, False: 59.3k]
  |  |  ------------------
  |  |  444|  57.3k|		    case S_MakeUp:					\
  |  |  ------------------
  |  |  |  |   79|  57.3k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (444:7): [True: 2.31k, False: 112k]
  |  |  ------------------
  |  |  445|  57.3k|			a0 += TabEnt->Param;				\
  |  |  446|  57.3k|			RunLength += TabEnt->Param;			\
  |  |  447|  57.3k|			break;						\
  |  |  448|  55.0k|		    default:						\
  |  |  ------------------
  |  |  |  Branch (448:7): [True: 1.40k, False: 113k]
  |  |  ------------------
  |  |  449|  1.40k|			goto badWhite2d;				\
  |  |  450|   114k|		    }							\
  |  |  451|   114k|		}							\
  |  |  452|  57.4k|	    doneBlack2da:;						\
  |  |  453|   169k|	    } else {							\
  |  |  454|   215k|		for (;;) {	/* white first */			\
  |  |  455|   215k|		    LOOKUP16(12, TIFFFaxWhiteTable, eof2d);		\
  |  |  ------------------
  |  |  |  |  232|   215k|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|   215k|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   215k|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|   215k|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 174k, False: 40.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   174k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   174k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 2.16k, False: 172k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.16k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 309, False: 1.85k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  2.16k|		goto eoflab;						\
  |  |  |  |  |  |  156|  2.16k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|   172k|	} else {							\
  |  |  |  |  |  |  158|   172k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|   172k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 1.63k, False: 170k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  1.63k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  1.63k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 281, False: 1.35k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    281|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    281|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  1.35k|		} else {						\
  |  |  |  |  |  |  164|  1.35k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  1.35k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  1.35k|		}							\
  |  |  |  |  |  |  167|  1.63k|	    }								\
  |  |  |  |  |  |  168|   172k|	}								\
  |  |  |  |  |  |  169|   174k|    }									\
  |  |  |  |  |  |  170|   215k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|   215k|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|   214k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|   214k|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|   214k|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|   214k|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|   214k|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|   214k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|   214k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  456|   215k|		    switch (TabEnt->State) {				\
  |  |  457|   166k|		    case S_TermW:					\
  |  |  ------------------
  |  |  |  |   75|   166k|#define S_TermW    7
  |  |  ------------------
  |  |  |  Branch (457:7): [True: 166k, False: 48.2k]
  |  |  ------------------
  |  |  458|   166k|			SETVALUE(TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|   166k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   166k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 166k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   166k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   166k|    a0 += (x);								\
  |  |  |  |  250|   166k|    RunLength = 0;							\
  |  |  |  |  251|   166k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  459|   166k|			goto doneWhite2db;				\
  |  |  460|   166k|		    case S_MakeUpW:					\
  |  |  ------------------
  |  |  |  |   77|  42.9k|#define S_MakeUpW  9
  |  |  ------------------
  |  |  |  Branch (460:7): [True: 42.9k, False: 171k]
  |  |  ------------------
  |  |  461|  46.0k|		    case S_MakeUp:					\
  |  |  ------------------
  |  |  |  |   79|  46.0k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (461:7): [True: 3.02k, False: 211k]
  |  |  ------------------
  |  |  462|  46.0k|			a0 += TabEnt->Param;				\
  |  |  463|  46.0k|			RunLength += TabEnt->Param;			\
  |  |  464|  46.0k|			break;						\
  |  |  465|  42.9k|		    default:						\
  |  |  ------------------
  |  |  |  Branch (465:7): [True: 2.18k, False: 212k]
  |  |  ------------------
  |  |  466|  2.18k|			goto badWhite2d;				\
  |  |  467|   214k|		    }							\
  |  |  468|   214k|		}							\
  |  |  469|   169k|	    doneWhite2db:;						\
  |  |  470|   169k|		for (;;) {	/* then black */			\
  |  |  471|   169k|		    LOOKUP16(13, TIFFFaxBlackTable, eof2d);		\
  |  |  ------------------
  |  |  |  |  232|   169k|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|   169k|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   169k|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|   169k|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 136k, False: 32.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   136k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   136k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 2.09k, False: 134k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  2.09k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 86, False: 2.01k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  2.09k|		goto eoflab;						\
  |  |  |  |  |  |  156|  2.09k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|   134k|	} else {							\
  |  |  |  |  |  |  158|   134k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|   134k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 32.0k, False: 102k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  32.0k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  32.0k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 364, False: 31.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    364|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    364|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  31.6k|		} else {						\
  |  |  |  |  |  |  164|  31.6k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  31.6k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  31.6k|		}							\
  |  |  |  |  |  |  167|  32.0k|	    }								\
  |  |  |  |  |  |  168|   134k|	}								\
  |  |  |  |  |  |  169|   136k|    }									\
  |  |  |  |  |  |  170|   169k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|   169k|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|   168k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|   168k|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|   168k|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|   168k|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|   168k|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|   168k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|   168k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  472|   169k|		    switch (TabEnt->State) {				\
  |  |  473|   164k|		    case S_TermB:					\
  |  |  ------------------
  |  |  |  |   76|   164k|#define S_TermB    8
  |  |  ------------------
  |  |  |  Branch (473:7): [True: 164k, False: 4.72k]
  |  |  ------------------
  |  |  474|   164k|			SETVALUE(TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|   164k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   164k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 164k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   164k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   164k|    a0 += (x);								\
  |  |  |  |  250|   164k|    RunLength = 0;							\
  |  |  |  |  251|   164k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  475|   164k|			goto doneBlack2db;				\
  |  |  476|   164k|		    case S_MakeUpB:					\
  |  |  ------------------
  |  |  |  |   78|  1.78k|#define S_MakeUpB  10
  |  |  ------------------
  |  |  |  Branch (476:7): [True: 1.78k, False: 167k]
  |  |  ------------------
  |  |  477|  2.51k|		    case S_MakeUp:					\
  |  |  ------------------
  |  |  |  |   79|  2.51k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (477:7): [True: 728, False: 168k]
  |  |  ------------------
  |  |  478|  2.51k|			a0 += TabEnt->Param;				\
  |  |  479|  2.51k|			RunLength += TabEnt->Param;			\
  |  |  480|  2.51k|			break;						\
  |  |  481|  2.20k|		    default:						\
  |  |  ------------------
  |  |  |  Branch (481:7): [True: 2.20k, False: 166k]
  |  |  ------------------
  |  |  482|  2.20k|			goto badBlack2d;				\
  |  |  483|   168k|		    }							\
  |  |  484|   168k|		}							\
  |  |  485|   166k|	    doneBlack2db:;						\
  |  |  486|   164k|	    }								\
  |  |  487|   227k|	    CHECK_b1;							\
  |  |  ------------------
  |  |  |  |  383|   219k|#define CHECK_b1 do {							\
  |  |  |  |  384|   373k|    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:9): [True: 219k, False: 0]
  |  |  |  |  |  Branch (384:31): [True: 240k, False: 133k]
  |  |  |  |  |  Branch (384:43): [True: 154k, False: 86.5k]
  |  |  |  |  ------------------
  |  |  |  |  385|   154k|	if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (385:6): [True: 0, False: 154k]
  |  |  |  |  ------------------
  |  |  |  |  386|      0|	    TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  387|      0|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  388|      0|	    return (-1);						\
  |  |  |  |  389|      0|	}								\
  |  |  |  |  390|   154k|	b1 += pb[0] + pb[1];						\
  |  |  |  |  391|   154k|	pb += 2;							\
  |  |  |  |  392|   154k|    }									\
  |  |  |  |  393|   219k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|   219k|	    break;							\
  |  |  489|   647k|	case S_V0:							\
  |  |  ------------------
  |  |  |  |   71|   647k|#define S_V0       3
  |  |  ------------------
  |  |  |  Branch (489:2): [True: 647k, False: 807k]
  |  |  ------------------
  |  |  490|   647k|	    CHECK_b1;							\
  |  |  ------------------
  |  |  |  |  383|   647k|#define CHECK_b1 do {							\
  |  |  |  |  384|   647k|    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:9): [True: 339k, False: 308k]
  |  |  |  |  |  Branch (384:31): [True: 110k, False: 339k]
  |  |  |  |  |  Branch (384:43): [True: 110k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  385|   110k|	if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (385:6): [True: 0, False: 110k]
  |  |  |  |  ------------------
  |  |  |  |  386|      0|	    TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  387|      0|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  388|      0|	    return (-1);						\
  |  |  |  |  389|      0|	}								\
  |  |  |  |  390|   110k|	b1 += pb[0] + pb[1];						\
  |  |  |  |  391|   110k|	pb += 2;							\
  |  |  |  |  392|   110k|    }									\
  |  |  |  |  393|   647k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  491|   647k|	    SETVALUE(b1 - a0);						\
  |  |  ------------------
  |  |  |  |  242|   647k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   647k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 647k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   647k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   647k|    a0 += (x);								\
  |  |  |  |  250|   647k|    RunLength = 0;							\
  |  |  |  |  251|   647k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  492|   647k|	    if( pb >= sp->refruns + sp->nruns) { 			\
  |  |  ------------------
  |  |  |  Branch (492:10): [True: 276, False: 647k]
  |  |  ------------------
  |  |  493|    276|	        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  494|    276|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    276|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    276|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 276, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    276|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    276|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 276, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  495|    276|	        return (-1);						\
  |  |  496|    276|	    }								\
  |  |  497|   647k|	    b1 += *pb++;						\
  |  |  498|   647k|	    break;							\
  |  |  499|   647k|	case S_VR:							\
  |  |  ------------------
  |  |  |  |   72|  69.9k|#define S_VR       4
  |  |  ------------------
  |  |  |  Branch (499:2): [True: 69.9k, False: 1.38M]
  |  |  ------------------
  |  |  500|  69.9k|	    CHECK_b1;							\
  |  |  ------------------
  |  |  |  |  383|  69.9k|#define CHECK_b1 do {							\
  |  |  |  |  384|  69.9k|    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:9): [True: 42.9k, False: 26.9k]
  |  |  |  |  |  Branch (384:31): [True: 16.9k, False: 42.9k]
  |  |  |  |  |  Branch (384:43): [True: 16.9k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  385|  16.9k|	if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (385:6): [True: 0, False: 16.9k]
  |  |  |  |  ------------------
  |  |  |  |  386|      0|	    TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  387|      0|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  388|      0|	    return (-1);						\
  |  |  |  |  389|      0|	}								\
  |  |  |  |  390|  16.9k|	b1 += pb[0] + pb[1];						\
  |  |  |  |  391|  16.9k|	pb += 2;							\
  |  |  |  |  392|  16.9k|    }									\
  |  |  |  |  393|  69.9k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  501|  69.9k|	    SETVALUE(b1 - a0 + TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|  69.9k|#define SETVALUE(x) do {							\
  |  |  |  |  243|  69.9k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 69.9k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|  69.9k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|  69.9k|    a0 += (x);								\
  |  |  |  |  250|  69.9k|    RunLength = 0;							\
  |  |  |  |  251|  69.9k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  502|  69.9k|	    if( pb >= sp->refruns + sp->nruns) { 			\
  |  |  ------------------
  |  |  |  Branch (502:10): [True: 247, False: 69.7k]
  |  |  ------------------
  |  |  503|    247|	        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  504|    247|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    247|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    247|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 247, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    247|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    247|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 247, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  505|    247|	        return (-1);						\
  |  |  506|    247|	    }								\
  |  |  507|  69.9k|	    b1 += *pb++;						\
  |  |  508|  69.7k|	    break;							\
  |  |  509|   390k|	case S_VL:							\
  |  |  ------------------
  |  |  |  |   73|   390k|#define S_VL       5
  |  |  ------------------
  |  |  |  Branch (509:2): [True: 390k, False: 1.06M]
  |  |  ------------------
  |  |  510|   390k|	    CHECK_b1;							\
  |  |  ------------------
  |  |  |  |  383|   390k|#define CHECK_b1 do {							\
  |  |  |  |  384|   513k|    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (384:9): [True: 329k, False: 61.0k]
  |  |  |  |  |  Branch (384:31): [True: 184k, False: 329k]
  |  |  |  |  |  Branch (384:43): [True: 184k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  385|   184k|	if( pb + 1 >= sp->refruns + sp->nruns) { 			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (385:6): [True: 0, False: 184k]
  |  |  |  |  ------------------
  |  |  |  |  386|      0|	    TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  387|      0|	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	                sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  388|      0|	    return (-1);						\
  |  |  |  |  389|      0|	}								\
  |  |  |  |  390|   184k|	b1 += pb[0] + pb[1];						\
  |  |  |  |  391|   184k|	pb += 2;							\
  |  |  |  |  392|   184k|    }									\
  |  |  |  |  393|   390k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (393:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  511|   390k|	    if (b1 < (int) (a0 + TabEnt->Param)) {			\
  |  |  ------------------
  |  |  |  Branch (511:10): [True: 1.90k, False: 388k]
  |  |  ------------------
  |  |  512|  1.90k|		unexpected("VL", a0);				\
  |  |  ------------------
  |  |  |  |  188|  1.90k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  513|  1.90k|		goto eol2d;						\
  |  |  514|  1.90k|	    }								\
  |  |  515|   390k|	    SETVALUE(b1 - a0 - TabEnt->Param);				\
  |  |  ------------------
  |  |  |  |  242|   388k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   388k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 388k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   388k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   388k|    a0 += (x);								\
  |  |  |  |  250|   388k|    RunLength = 0;							\
  |  |  |  |  251|   388k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  516|   388k|	    b1 -= *--pb;						\
  |  |  517|   388k|	    break;							\
  |  |  518|   388k|	case S_Ext:							\
  |  |  ------------------
  |  |  |  |   74|  42.6k|#define S_Ext      6
  |  |  ------------------
  |  |  |  Branch (518:2): [True: 42.6k, False: 1.41M]
  |  |  ------------------
  |  |  519|  42.6k|	    *pa++ = lastx - a0;						\
  |  |  520|  42.6k|	    extension(a0);						\
  |  |  ------------------
  |  |  |  |  199|  42.6k|#define	extension(a0)	Fax3Extension(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  521|  42.6k|	    goto eol2d;							\
  |  |  522|   388k|	case S_EOL:							\
  |  |  ------------------
  |  |  |  |   80|  18.2k|#define S_EOL      12
  |  |  ------------------
  |  |  |  Branch (522:2): [True: 18.2k, False: 1.43M]
  |  |  ------------------
  |  |  523|  18.2k|	    *pa++ = lastx - a0;						\
  |  |  524|  18.2k|	    NeedBits8(4,eof2d);						\
  |  |  ------------------
  |  |  |  |  137|  18.2k|#define NeedBits8(n,eoflab) do {					\
  |  |  |  |  138|  18.2k|    if (BitsAvail < (n)) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (138:9): [True: 14.4k, False: 3.71k]
  |  |  |  |  ------------------
  |  |  |  |  139|  14.4k|	if (EndOfData()) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|  14.4k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (111:21): [True: 6.54k, False: 7.95k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  140|  6.54k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:10): [True: 5.18k, False: 1.35k]
  |  |  |  |  ------------------
  |  |  |  |  141|  6.54k|		goto eoflab;						\
  |  |  |  |  142|  6.54k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  143|  7.95k|	} else {							\
  |  |  |  |  144|  7.95k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  145|  7.95k|	    BitsAvail += 8;						\
  |  |  |  |  146|  7.95k|	}								\
  |  |  |  |  147|  14.4k|    }									\
  |  |  |  |  148|  18.2k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (148:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|  18.2k|	    if (GetBits(4))						\
  |  |  ------------------
  |  |  |  |  172|  13.0k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (172:20): [True: 4.92k, False: 8.09k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  526|  13.0k|		unexpected("EOL", a0);					\
  |  |  ------------------
  |  |  |  |  188|  4.92k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  527|  13.0k|            ClrBits(4);                                                 \
  |  |  ------------------
  |  |  |  |  173|  13.0k|#define ClrBits(n) do {							\
  |  |  |  |  174|  13.0k|    BitsAvail -= (n);							\
  |  |  |  |  175|  13.0k|    BitAcc >>= (n);							\
  |  |  |  |  176|  13.0k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  528|  13.0k|	    EOLcnt = 1;							\
  |  |  529|  13.0k|	    goto eol2d;							\
  |  |  530|  18.2k|	default:							\
  |  |  ------------------
  |  |  |  Branch (530:2): [True: 0, False: 1.45M]
  |  |  ------------------
  |  |  531|      0|	badMain2d:							\
  |  |  532|      0|	    unexpected("MainTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|      0|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  533|      0|	    goto eol2d;							\
  |  |  534|  2.97k|	badBlack2d:							\
  |  |  535|  2.97k|	    unexpected("BlackTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|  2.97k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  536|  2.97k|	    goto eol2d;							\
  |  |  537|  3.59k|	badWhite2d:							\
  |  |  538|  3.59k|	    unexpected("WhiteTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|  3.59k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  539|  3.59k|	    goto eol2d;							\
  |  |  540|  6.61k|	eof2d:								\
  |  |  541|  6.61k|	    prematureEOF(a0);						\
  |  |  ------------------
  |  |  |  |  220|  6.61k|#define	prematureEOF(a0)	Fax3PrematureEOF(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  542|  6.61k|	    CLEANUP_RUNS();						\
  |  |  ------------------
  |  |  |  |  290|  6.61k|#define	CLEANUP_RUNS() do {						\
  |  |  |  |  291|  6.61k|    if (RunLength)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (291:9): [True: 1.15k, False: 5.46k]
  |  |  |  |  ------------------
  |  |  |  |  292|  6.61k|	SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  1.15k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  1.15k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 10, False: 1.14k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|     10|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|     10|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|     10|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|     10|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 10, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|     10|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|     10|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 10, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|     10|        return (-1);							\
  |  |  |  |  |  |  247|     10|    }									\
  |  |  |  |  |  |  248|  1.15k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  1.14k|    a0 += (x);								\
  |  |  |  |  |  |  250|  1.14k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  1.14k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  293|  6.61k|    if (a0 != lastx) {							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (293:9): [True: 6.58k, False: 21]
  |  |  |  |  ------------------
  |  |  |  |  294|  6.58k|	badlength(a0, lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|  6.58k|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  |  |  ------------------
  |  |  |  |  295|  7.58k|	while (a0 > lastx && pa > thisrun)				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (295:9): [True: 995, False: 6.58k]
  |  |  |  |  |  Branch (295:23): [True: 995, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  296|  6.58k|	    a0 -= *--pa;						\
  |  |  |  |  297|  6.58k|	if (a0 < lastx) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (297:6): [True: 6.28k, False: 297]
  |  |  |  |  ------------------
  |  |  |  |  298|  6.28k|	    if (a0 < 0)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (298:10): [True: 0, False: 6.28k]
  |  |  |  |  ------------------
  |  |  |  |  299|  6.28k|		a0 = 0;							\
  |  |  |  |  300|  6.28k|	    if ((pa-thisrun)&1)						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (300:10): [True: 3.49k, False: 2.79k]
  |  |  |  |  ------------------
  |  |  |  |  301|  6.28k|		SETVALUE(0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  3.49k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  3.49k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 3.49k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  3.49k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  3.49k|    a0 += (x);								\
  |  |  |  |  |  |  250|  3.49k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  3.49k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  302|  6.28k|	    SETVALUE(lastx - a0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  6.28k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  6.28k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 20, False: 6.26k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|     20|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|     20|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|     20|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|     20|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 20, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|     20|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|     20|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 20, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|     20|        return (-1);							\
  |  |  |  |  |  |  247|     20|    }									\
  |  |  |  |  |  |  248|  6.28k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  6.26k|    a0 += (x);								\
  |  |  |  |  |  |  250|  6.26k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  6.26k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  303|  6.28k|	} else if (a0 > lastx) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (303:13): [True: 0, False: 297]
  |  |  |  |  ------------------
  |  |  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  305|      0|	    SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  306|      0|	}								\
  |  |  |  |  307|  6.58k|    }									\
  |  |  |  |  308|  6.60k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  6.61k|	    goto eoflab;						\
  |  |  544|  1.45M|	}								\
  |  |  545|  1.45M|    }									\
  |  |  546|   525k|    if (RunLength) {							\
  |  |  ------------------
  |  |  |  Branch (546:9): [True: 42.8k, False: 410k]
  |  |  ------------------
  |  |  547|  42.8k|	if (RunLength + a0 < lastx) {					\
  |  |  ------------------
  |  |  |  Branch (547:6): [True: 0, False: 42.8k]
  |  |  ------------------
  |  |  548|      0|	    /* expect a final V0 */					\
  |  |  549|      0|	    NeedBits8(1,eof2d);						\
  |  |  ------------------
  |  |  |  |  137|      0|#define NeedBits8(n,eoflab) do {					\
  |  |  |  |  138|      0|    if (BitsAvail < (n)) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (138:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  139|      0|	if (EndOfData()) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|      0|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (111:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  140|      0|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (140:10): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  141|      0|		goto eoflab;						\
  |  |  |  |  142|      0|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  143|      0|	} else {							\
  |  |  |  |  144|      0|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  145|      0|	    BitsAvail += 8;						\
  |  |  |  |  146|      0|	}								\
  |  |  |  |  147|      0|    }									\
  |  |  |  |  148|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (148:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  550|      0|	    if (!GetBits(1))						\
  |  |  ------------------
  |  |  |  |  172|      0|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  ------------------
  |  |  |  Branch (550:10): [True: 0, False: 0]
  |  |  ------------------
  |  |  551|      0|		goto badMain2d;						\
  |  |  552|      0|	    ClrBits(1);							\
  |  |  ------------------
  |  |  |  |  173|      0|#define ClrBits(n) do {							\
  |  |  |  |  174|      0|    BitsAvail -= (n);							\
  |  |  |  |  175|      0|    BitAcc >>= (n);							\
  |  |  |  |  176|      0|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  553|      0|	}								\
  |  |  554|  42.8k|	SETVALUE(0);							\
  |  |  ------------------
  |  |  |  |  242|  42.8k|#define SETVALUE(x) do {							\
  |  |  |  |  243|  42.8k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 42.8k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|  42.8k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|  42.8k|    a0 += (x);								\
  |  |  |  |  250|  42.8k|    RunLength = 0;							\
  |  |  |  |  251|  42.8k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  555|   517k|    }									\
  |  |  556|   517k|eol2d:									\
  |  |  557|   517k|    CLEANUP_RUNS();							\
  |  |  ------------------
  |  |  |  |  290|   517k|#define	CLEANUP_RUNS() do {						\
  |  |  |  |  291|   517k|    if (RunLength)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (291:9): [True: 2.10k, False: 515k]
  |  |  |  |  ------------------
  |  |  |  |  292|   517k|	SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  2.10k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  2.10k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 96, False: 2.00k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|     96|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|     96|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|     96|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|     96|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 96, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|     96|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|     96|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 96, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|     96|        return (-1);							\
  |  |  |  |  |  |  247|     96|    }									\
  |  |  |  |  |  |  248|  2.10k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  2.00k|    a0 += (x);								\
  |  |  |  |  |  |  250|  2.00k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  2.00k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  293|   517k|    if (a0 != lastx) {							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (293:9): [True: 177k, False: 339k]
  |  |  |  |  ------------------
  |  |  |  |  294|   177k|	badlength(a0, lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|   177k|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  |  |  ------------------
  |  |  |  |  295|   357k|	while (a0 > lastx && pa > thisrun)				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (295:9): [True: 180k, False: 177k]
  |  |  |  |  |  Branch (295:23): [True: 180k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  296|   180k|	    a0 -= *--pa;						\
  |  |  |  |  297|   177k|	if (a0 < lastx) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (297:6): [True: 176k, False: 933]
  |  |  |  |  ------------------
  |  |  |  |  298|   176k|	    if (a0 < 0)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (298:10): [True: 0, False: 176k]
  |  |  |  |  ------------------
  |  |  |  |  299|   176k|		a0 = 0;							\
  |  |  |  |  300|   176k|	    if ((pa-thisrun)&1)						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (300:10): [True: 53.1k, False: 123k]
  |  |  |  |  ------------------
  |  |  |  |  301|   176k|		SETVALUE(0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  53.1k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  53.1k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 53.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  53.1k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  53.1k|    a0 += (x);								\
  |  |  |  |  |  |  250|  53.1k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  53.1k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  302|   176k|	    SETVALUE(lastx - a0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|   176k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|   176k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 392, False: 176k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|    392|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|    392|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|    392|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|    392|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 392, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|    392|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|    392|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 392, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|    392|        return (-1);							\
  |  |  |  |  |  |  247|    392|    }									\
  |  |  |  |  |  |  248|   176k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|   176k|    a0 += (x);								\
  |  |  |  |  |  |  250|   176k|    RunLength = 0;							\
  |  |  |  |  |  |  251|   176k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  303|   176k|	} else if (a0 > lastx) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (303:13): [True: 0, False: 933]
  |  |  |  |  ------------------
  |  |  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  305|      0|	    SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  306|      0|	}								\
  |  |  |  |  307|   177k|    }									\
  |  |  |  |  308|   517k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  558|   517k|} while (0)
  |  |  ------------------
  |  |  |  Branch (558:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1432|   516k|                if (EOLcnt)
  ------------------
  |  Branch (1432:21): [True: 13.0k, False: 503k]
  ------------------
 1433|  13.0k|                    goto EOFG4;
 1434|   503k|		if (((lastx + 7) >> 3) > (int)occ)	/* check for buffer overrun */
  ------------------
  |  Branch (1434:7): [True: 0, False: 503k]
  ------------------
 1435|      0|		{
 1436|      0|			TIFFErrorExtR(tif, module,
 1437|      0|			             "Buffer overrun detected : %"TIFF_SSIZE_FORMAT" bytes available, %d bits needed",
 1438|      0|			             occ, lastx);
 1439|      0|			return -1;
 1440|      0|		}
 1441|   503k|		(*sp->fill)(buf, thisrun, pa, lastx);
 1442|   503k|		SETVALUE(0);		/* imaginary change for reference */
  ------------------
  |  |  242|   503k|#define SETVALUE(x) do {							\
  |  |  243|   503k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  ------------------
  |  |  |  Branch (243:9): [True: 324, False: 503k]
  |  |  ------------------
  |  |  244|    324|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  245|    324|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    324|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    324|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 324, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  ------------------
  |  |  |  |  207|    324|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  101|    324|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (207:22): [True: 324, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  246|    324|        return (-1);							\
  |  |  247|    324|    }									\
  |  |  248|   503k|    *pa++ = RunLength + (x);						\
  |  |  249|   503k|    a0 += (x);								\
  |  |  250|   503k|    RunLength = 0;							\
  |  |  251|   503k|} while (0)
  |  |  ------------------
  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1443|   503k|		SWAP(uint32_t*, sp->curruns, sp->refruns);
  ------------------
  |  | 1405|   503k|#define SWAP(t,a,b) { t x; x = (a); (a) = (b); (b) = x; }
  ------------------
 1444|   503k|		buf += sp->b.rowbytes;
 1445|   503k|		occ -= sp->b.rowbytes;
 1446|   503k|		sp->line++;
 1447|   503k|		continue;
 1448|  19.6k|	EOFG4:
 1449|  19.6k|                NeedBits16( 13, BADG4 );
  ------------------
  |  |  151|  19.6k|#define NeedBits16(n,eoflab) do {					\
  |  |  152|  19.6k|    if (BitsAvail < (n)) {						\
  |  |  ------------------
  |  |  |  Branch (152:9): [True: 19.6k, False: 0]
  |  |  ------------------
  |  |  153|  19.6k|	if (EndOfData()) {						\
  |  |  ------------------
  |  |  |  |  111|  19.6k|#define EndOfData()	(cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (111:21): [True: 8.39k, False: 11.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  8.39k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  ------------------
  |  |  |  Branch (154:10): [True: 8.03k, False: 361]
  |  |  ------------------
  |  |  155|  8.39k|		goto eoflab;						\
  |  |  156|  8.39k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  157|  11.2k|	} else {							\
  |  |  158|  11.2k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  159|  11.2k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  ------------------
  |  |  |  Branch (159:10): [True: 1.12k, False: 10.0k]
  |  |  ------------------
  |  |  160|  1.12k|		if (EndOfData()) {					\
  |  |  ------------------
  |  |  |  |  111|  1.12k|#define EndOfData()	(cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (111:21): [True: 228, False: 895]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|    228|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  162|    228|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  163|    895|		} else {						\
  |  |  164|    895|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  165|    895|		    BitsAvail += 8;					\
  |  |  166|    895|		}							\
  |  |  167|  1.12k|	    }								\
  |  |  168|  11.2k|	}								\
  |  |  169|  19.6k|    }									\
  |  |  170|  19.6k|} while (0)
  |  |  ------------------
  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1450|  19.6k|        BADG4:
 1451|       |#ifdef FAX3_DEBUG
 1452|       |                if( GetBits(13) != 0x1001 )
 1453|       |                    fputs( "Bad EOFB\n", stderr );
 1454|       |#endif                
 1455|  19.6k|                ClrBits( 13 );
  ------------------
  |  |  173|  19.6k|#define ClrBits(n) do {							\
  |  |  174|  19.6k|    BitsAvail -= (n);							\
  |  |  175|  19.6k|    BitAcc >>= (n);							\
  |  |  176|  19.6k|} while (0)
  |  |  ------------------
  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1456|  19.6k|		if (((lastx + 7) >> 3) > (int)occ)	/* check for buffer overrun */
  ------------------
  |  Branch (1456:7): [True: 0, False: 19.6k]
  ------------------
 1457|      0|		{
 1458|      0|			TIFFErrorExtR(tif, module,
 1459|      0|			             "Buffer overrun detected : %"TIFF_SSIZE_FORMAT" bytes available, %d bits needed",
 1460|      0|			             occ, lastx);
 1461|      0|			return -1;
 1462|      0|		}
 1463|  19.6k|		(*sp->fill)(buf, thisrun, pa, lastx);
 1464|  19.6k|		UNCACHE_STATE(tif, sp);
  ------------------
  |  |  134|  19.6k|#define	UNCACHE_STATE(tif, sp) do {					\
  |  |  135|  19.6k|    sp->bit = BitsAvail;						\
  |  |  136|  19.6k|    sp->data = BitAcc;							\
  |  |  137|  19.6k|    sp->EOLcnt = EOLcnt;						\
  |  |  138|  19.6k|    tif->tif_rawcc -= (tmsize_t)((uint8_t*) cp - tif->tif_rawcp);		\
  |  |  139|  19.6k|    tif->tif_rawcp = (uint8_t*) cp;					\
  |  |  140|  19.6k|} while (0)
  |  |  ------------------
  |  |  |  Branch (140:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1465|  19.6k|		return ( sp->line ? 1 : -1);	/* don't error on badly-terminated strips */
  ------------------
  |  Branch (1465:12): [True: 13.1k, False: 6.41k]
  ------------------
 1466|  19.6k|	}
 1467|  1.92k|	UNCACHE_STATE(tif, sp);
  ------------------
  |  |  134|  1.92k|#define	UNCACHE_STATE(tif, sp) do {					\
  |  |  135|  1.92k|    sp->bit = BitsAvail;						\
  |  |  136|  1.92k|    sp->data = BitAcc;							\
  |  |  137|  1.92k|    sp->EOLcnt = EOLcnt;						\
  |  |  138|  1.92k|    tif->tif_rawcc -= (tmsize_t)((uint8_t*) cp - tif->tif_rawcp);		\
  |  |  139|  1.92k|    tif->tif_rawcp = (uint8_t*) cp;					\
  |  |  140|  1.92k|} while (0)
  |  |  ------------------
  |  |  |  Branch (140:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1468|  1.92k|	return (1);
 1469|  23.6k|}
tif_fax3.c:Fax3DecodeRLE:
 1549|  5.86k|{
 1550|  5.86k|	DECLARE_STATE(tif, sp, "Fax3DecodeRLE");
  ------------------
  |  |  103|  5.86k|    static const char module[] = mod;					\
  |  |  104|  5.86k|    Fax3CodecState* sp = DecoderState(tif);				\
  |  |  ------------------
  |  |  |  |   88|  5.86k|#define DecoderState(tif) ((Fax3CodecState*) Fax3State(tif))
  |  |  |  |  ------------------
  |  |  |  |  |  |   63|  5.86k|#define	Fax3State(tif)		((Fax3BaseState*) (tif)->tif_data)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  105|  5.86k|    int a0;				/* reference element */		\
  |  |  106|  5.86k|    int lastx = sp->b.rowpixels;	/* last element in row */	\
  |  |  107|  5.86k|    uint32_t BitAcc;			/* bit accumulator */		\
  |  |  108|  5.86k|    int BitsAvail;			/* # valid bits in BitAcc */	\
  |  |  109|  5.86k|    int RunLength;			/* length of current run */	\
  |  |  110|  5.86k|    unsigned char* cp;			/* next byte of input data */	\
  |  |  111|  5.86k|    unsigned char* ep;			/* end of input data */		\
  |  |  112|  5.86k|    uint32_t* pa;				/* place to stuff next run */	\
  |  |  113|  5.86k|    uint32_t* thisrun;			/* current row's run array */	\
  |  |  114|  5.86k|    int EOLcnt;				/* # EOL codes recognized */	\
  |  |  115|  5.86k|    const unsigned char* bitmap = sp->bitmap;	/* input data bit reverser */	\
  |  |  116|  5.86k|    const TIFFFaxTabEnt* TabEnt
  ------------------
 1551|  5.86k|	int mode = sp->b.mode;
 1552|  5.86k|	(void) s;
 1553|  5.86k|	if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (1553:6): [True: 0, False: 5.86k]
  ------------------
 1554|      0|	{
 1555|      0|		TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
 1556|      0|		return (-1);
 1557|      0|	}
 1558|  5.86k|	CACHE_STATE(tif, sp);
  ------------------
  |  |  124|  5.86k|#define	CACHE_STATE(tif, sp) do {					\
  |  |  125|  5.86k|    BitAcc = sp->data;							\
  |  |  126|  5.86k|    BitsAvail = sp->bit;						\
  |  |  127|  5.86k|    EOLcnt = sp->EOLcnt;						\
  |  |  128|  5.86k|    cp = (unsigned char*) tif->tif_rawcp;				\
  |  |  129|  5.86k|    ep = cp + tif->tif_rawcc;						\
  |  |  130|  5.86k|} while (0)
  |  |  ------------------
  |  |  |  Branch (130:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1559|  5.86k|	thisrun = sp->curruns;
 1560|  86.6M|	while (occ > 0) {
  ------------------
  |  Branch (1560:9): [True: 86.6M, False: 2.24k]
  ------------------
 1561|  86.6M|		a0 = 0;
 1562|  86.6M|		RunLength = 0;
 1563|  86.6M|		pa = thisrun;
 1564|       |#ifdef FAX3_DEBUG
 1565|       |		printf("\nBitAcc=%08"PRIX32", BitsAvail = %d\n", BitAcc, BitsAvail);
 1566|       |		printf("-------------------- %"PRIu32"\n", tif->tif_row);
 1567|       |		fflush(stdout);
 1568|       |#endif
 1569|  86.6M|		EXPAND1D(EOFRLE);
  ------------------
  |  |  322|  86.6M|#define EXPAND1D(eoflab) do {						\
  |  |  323|  86.7M|    for (;;) {								\
  |  |  324|  86.7M|	for (;;) {							\
  |  |  325|  86.7M|	    LOOKUP16(12, TIFFFaxWhiteTable, eof1d);			\
  |  |  ------------------
  |  |  |  |  232|  86.7M|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|  86.7M|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  86.7M|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|  86.7M|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 122k, False: 86.6M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|   122k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|   122k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 6.29k, False: 116k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  6.29k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 3.14k, False: 3.14k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  6.29k|		goto eoflab;						\
  |  |  |  |  |  |  156|  6.29k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|   116k|	} else {							\
  |  |  |  |  |  |  158|   116k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|   116k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 47.4k, False: 68.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  47.4k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  47.4k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 1.33k, False: 46.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|  1.33k|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|  1.33k|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  46.1k|		} else {						\
  |  |  |  |  |  |  164|  46.1k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  46.1k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  46.1k|		}							\
  |  |  |  |  |  |  167|  47.4k|	    }								\
  |  |  |  |  |  |  168|   116k|	}								\
  |  |  |  |  |  |  169|   122k|    }									\
  |  |  |  |  |  |  170|  86.7M|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|  86.7M|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|  86.7M|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|  86.7M|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|  86.7M|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|  86.7M|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|  86.7M|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|  86.7M|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|  86.7M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  86.7M|	    switch (TabEnt->State) {					\
  |  |  327|  20.7k|	    case S_EOL:							\
  |  |  ------------------
  |  |  |  |   80|  20.7k|#define S_EOL      12
  |  |  ------------------
  |  |  |  Branch (327:6): [True: 20.7k, False: 86.7M]
  |  |  ------------------
  |  |  328|  20.7k|		EOLcnt = 1;						\
  |  |  329|  20.7k|		goto done1d;						\
  |  |  330|   121k|	    case S_TermW:						\
  |  |  ------------------
  |  |  |  |   75|   121k|#define S_TermW    7
  |  |  ------------------
  |  |  |  Branch (330:6): [True: 121k, False: 86.6M]
  |  |  ------------------
  |  |  331|   121k|		SETVALUE(TabEnt->Param);					\
  |  |  ------------------
  |  |  |  |  242|   121k|#define SETVALUE(x) do {							\
  |  |  |  |  243|   121k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 121k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|   121k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|   121k|    a0 += (x);								\
  |  |  |  |  250|   121k|    RunLength = 0;							\
  |  |  |  |  251|   121k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  332|   121k|		goto doneWhite1d;					\
  |  |  333|   121k|	    case S_MakeUpW:						\
  |  |  ------------------
  |  |  |  |   77|  30.8k|#define S_MakeUpW  9
  |  |  ------------------
  |  |  |  Branch (333:6): [True: 30.8k, False: 86.7M]
  |  |  ------------------
  |  |  334|  43.1k|	    case S_MakeUp:						\
  |  |  ------------------
  |  |  |  |   79|  43.1k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (334:6): [True: 12.3k, False: 86.7M]
  |  |  ------------------
  |  |  335|  43.1k|		a0 += TabEnt->Param;					\
  |  |  336|  43.1k|		RunLength += TabEnt->Param;				\
  |  |  337|  43.1k|		break;							\
  |  |  338|  86.5M|	    default:							\
  |  |  ------------------
  |  |  |  Branch (338:6): [True: 86.5M, False: 185k]
  |  |  ------------------
  |  |  339|  86.5M|		unexpected("WhiteTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|  86.5M|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  340|  86.5M|		goto done1d;						\
  |  |  341|  86.7M|	    }								\
  |  |  342|  86.7M|	}								\
  |  |  343|  86.7M|    doneWhite1d:							\
  |  |  344|   121k|	if (a0 >= lastx)						\
  |  |  ------------------
  |  |  |  Branch (344:6): [True: 21.8k, False: 99.8k]
  |  |  ------------------
  |  |  345|   121k|	    goto done1d;						\
  |  |  346|   121k|	for (;;) {							\
  |  |  347|   105k|	    LOOKUP16(13, TIFFFaxBlackTable, eof1d);			\
  |  |  ------------------
  |  |  |  |  232|   105k|#define LOOKUP16(wid,tab,eoflab) do {					\
  |  |  |  |  233|   105k|    NeedBits16(wid,eoflab);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  151|   105k|#define NeedBits16(n,eoflab) do {					\
  |  |  |  |  |  |  152|   105k|    if (BitsAvail < (n)) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (152:9): [True: 86.8k, False: 18.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  153|  86.8k|	if (EndOfData()) {						\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  86.8k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 3.20k, False: 83.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  154|  3.20k|	    if (BitsAvail == 0)			/* no valid bits */	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (154:10): [True: 476, False: 2.72k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|  3.20k|		goto eoflab;						\
  |  |  |  |  |  |  156|  3.20k|	    BitsAvail = (n);			/* pad with zeros */	\
  |  |  |  |  |  |  157|  83.6k|	} else {							\
  |  |  |  |  |  |  158|  83.6k|	    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;		\
  |  |  |  |  |  |  159|  83.6k|	    if ((BitsAvail += 8) < (n)) {				\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (159:10): [True: 4.84k, False: 78.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  4.84k|		if (EndOfData()) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  111|  4.84k|#define EndOfData()	(cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (111:21): [True: 665, False: 4.17k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  161|    665|		    /* NB: we know BitsAvail is non-zero here */	\
  |  |  |  |  |  |  162|    665|		    BitsAvail = (n);		/* pad with zeros */	\
  |  |  |  |  |  |  163|  4.17k|		} else {						\
  |  |  |  |  |  |  164|  4.17k|		    BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail;	\
  |  |  |  |  |  |  165|  4.17k|		    BitsAvail += 8;					\
  |  |  |  |  |  |  166|  4.17k|		}							\
  |  |  |  |  |  |  167|  4.84k|	    }								\
  |  |  |  |  |  |  168|  83.6k|	}								\
  |  |  |  |  |  |  169|  86.8k|    }									\
  |  |  |  |  |  |  170|   105k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  234|   105k|    TabEnt = tab + GetBits(wid);					\
  |  |  |  |  ------------------
  |  |  |  |  |  |  172|   104k|#define GetBits(n)	(BitAcc & ((1<<(n))-1))
  |  |  |  |  ------------------
  |  |  |  |  235|   104k|    ClrBits(TabEnt->Width);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|   104k|#define ClrBits(n) do {							\
  |  |  |  |  |  |  174|   104k|    BitsAvail -= (n);							\
  |  |  |  |  |  |  175|   104k|    BitAcc >>= (n);							\
  |  |  |  |  |  |  176|   104k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  236|   104k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (236:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  348|   105k|	    switch (TabEnt->State) {					\
  |  |  349|  6.80k|	    case S_EOL:							\
  |  |  ------------------
  |  |  |  |   80|  6.80k|#define S_EOL      12
  |  |  ------------------
  |  |  |  Branch (349:6): [True: 6.80k, False: 97.9k]
  |  |  ------------------
  |  |  350|  6.80k|		EOLcnt = 1;						\
  |  |  351|  6.80k|		goto done1d;						\
  |  |  352|  89.1k|	    case S_TermB:						\
  |  |  ------------------
  |  |  |  |   76|  89.1k|#define S_TermB    8
  |  |  ------------------
  |  |  |  Branch (352:6): [True: 89.1k, False: 15.6k]
  |  |  ------------------
  |  |  353|  89.1k|		SETVALUE(TabEnt->Param);					\
  |  |  ------------------
  |  |  |  |  242|  89.1k|#define SETVALUE(x) do {							\
  |  |  |  |  243|  89.1k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (243:9): [True: 0, False: 89.1k]
  |  |  |  |  ------------------
  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  247|      0|    }									\
  |  |  |  |  248|  89.1k|    *pa++ = RunLength + (x);						\
  |  |  |  |  249|  89.1k|    a0 += (x);								\
  |  |  |  |  250|  89.1k|    RunLength = 0;							\
  |  |  |  |  251|  89.1k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  354|  89.1k|		goto doneBlack1d;					\
  |  |  355|  89.1k|	    case S_MakeUpB:						\
  |  |  ------------------
  |  |  |  |   78|  3.14k|#define S_MakeUpB  10
  |  |  ------------------
  |  |  |  Branch (355:6): [True: 3.14k, False: 101k]
  |  |  ------------------
  |  |  356|  5.41k|	    case S_MakeUp:						\
  |  |  ------------------
  |  |  |  |   79|  5.41k|#define S_MakeUp   11
  |  |  ------------------
  |  |  |  Branch (356:6): [True: 2.27k, False: 102k]
  |  |  ------------------
  |  |  357|  5.41k|		a0 += TabEnt->Param;					\
  |  |  358|  5.41k|		RunLength += TabEnt->Param;				\
  |  |  359|  5.41k|		break;							\
  |  |  360|  3.41k|	    default:							\
  |  |  ------------------
  |  |  |  Branch (360:6): [True: 3.41k, False: 101k]
  |  |  ------------------
  |  |  361|  3.41k|		unexpected("BlackTable", a0);				\
  |  |  ------------------
  |  |  |  |  188|  3.41k|#define	unexpected(table, a0)	Fax3Unexpected(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  362|  3.41k|		goto done1d;						\
  |  |  363|   104k|	    }								\
  |  |  364|   104k|	}								\
  |  |  365|  99.8k|    doneBlack1d:							\
  |  |  366|  89.1k|	if (a0 >= lastx)						\
  |  |  ------------------
  |  |  |  Branch (366:6): [True: 5.42k, False: 83.7k]
  |  |  ------------------
  |  |  367|  89.1k|	    goto done1d;						\
  |  |  368|  89.1k|        if( *(pa-1) == 0 && *(pa-2) == 0 )				\
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 777, False: 82.9k]
  |  |  |  Branch (368:29): [True: 276, False: 501]
  |  |  ------------------
  |  |  369|  83.7k|            pa -= 2;                                                    \
  |  |  370|  83.7k|    }									\
  |  |  371|  3.62k|eof1d:									\
  |  |  372|  3.62k|    prematureEOF(a0);							\
  |  |  ------------------
  |  |  |  |  220|  3.62k|#define	prematureEOF(a0)	Fax3PrematureEOF(module, tif, sp->line, a0)
  |  |  ------------------
  |  |  373|  3.62k|    CLEANUP_RUNS();							\
  |  |  ------------------
  |  |  |  |  290|  3.62k|#define	CLEANUP_RUNS() do {						\
  |  |  |  |  291|  3.62k|    if (RunLength)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (291:9): [True: 519, False: 3.10k]
  |  |  |  |  ------------------
  |  |  |  |  292|  3.62k|	SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|    519|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|    519|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 519]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|    519|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|    519|    a0 += (x);								\
  |  |  |  |  |  |  250|    519|    RunLength = 0;							\
  |  |  |  |  |  |  251|    519|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  293|  3.62k|    if (a0 != lastx) {							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (293:9): [True: 3.37k, False: 243]
  |  |  |  |  ------------------
  |  |  |  |  294|  3.37k|	badlength(a0, lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|  3.37k|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  |  |  ------------------
  |  |  |  |  295|  3.65k|	while (a0 > lastx && pa > thisrun)				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (295:9): [True: 275, False: 3.37k]
  |  |  |  |  |  Branch (295:23): [True: 275, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  296|  3.37k|	    a0 -= *--pa;						\
  |  |  |  |  297|  3.37k|	if (a0 < lastx) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (297:6): [True: 3.37k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  298|  3.37k|	    if (a0 < 0)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (298:10): [True: 0, False: 3.37k]
  |  |  |  |  ------------------
  |  |  |  |  299|  3.37k|		a0 = 0;							\
  |  |  |  |  300|  3.37k|	    if ((pa-thisrun)&1)						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (300:10): [True: 232, False: 3.14k]
  |  |  |  |  ------------------
  |  |  |  |  301|  3.37k|		SETVALUE(0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|    232|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|    232|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 232]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|    232|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|    232|    a0 += (x);								\
  |  |  |  |  |  |  250|    232|    RunLength = 0;							\
  |  |  |  |  |  |  251|    232|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  302|  3.37k|	    SETVALUE(lastx - a0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  3.37k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  3.37k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 3.37k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  3.37k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  3.37k|    a0 += (x);								\
  |  |  |  |  |  |  250|  3.37k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  3.37k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  303|  3.37k|	} else if (a0 > lastx) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (303:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  305|      0|	    SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  306|      0|	}								\
  |  |  |  |  307|  3.37k|    }									\
  |  |  |  |  308|  3.62k|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  374|  86.6M|    goto eoflab;							\
  |  |  375|  86.6M|done1d:									\
  |  |  376|  86.6M|    CLEANUP_RUNS();							\
  |  |  ------------------
  |  |  |  |  290|  86.6M|#define	CLEANUP_RUNS() do {						\
  |  |  |  |  291|  86.6M|    if (RunLength)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (291:9): [True: 5.46k, False: 86.6M]
  |  |  |  |  ------------------
  |  |  |  |  292|  86.6M|	SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  5.46k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  5.46k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 5.46k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  5.46k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  5.46k|    a0 += (x);								\
  |  |  |  |  |  |  250|  5.46k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  5.46k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  293|  86.6M|    if (a0 != lastx) {							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (293:9): [True: 86.6M, False: 819]
  |  |  |  |  ------------------
  |  |  |  |  294|  86.6M|	badlength(a0, lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|  86.6M|#define	badlength(a0,lastx)	Fax3BadLength(module, tif, sp->line, a0, lastx)
  |  |  |  |  ------------------
  |  |  |  |  295|  86.6M|	while (a0 > lastx && pa > thisrun)				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (295:9): [True: 31.7k, False: 86.6M]
  |  |  |  |  |  Branch (295:23): [True: 31.7k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  296|  86.6M|	    a0 -= *--pa;						\
  |  |  |  |  297|  86.6M|	if (a0 < lastx) {						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (297:6): [True: 86.6M, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  298|  86.6M|	    if (a0 < 0)							\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (298:10): [True: 0, False: 86.6M]
  |  |  |  |  ------------------
  |  |  |  |  299|  86.6M|		a0 = 0;							\
  |  |  |  |  300|  86.6M|	    if ((pa-thisrun)&1)						\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (300:10): [True: 15.3k, False: 86.6M]
  |  |  |  |  ------------------
  |  |  |  |  301|  86.6M|		SETVALUE(0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  15.3k|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  15.3k|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 15.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  15.3k|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  15.3k|    a0 += (x);								\
  |  |  |  |  |  |  250|  15.3k|    RunLength = 0;							\
  |  |  |  |  |  |  251|  15.3k|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  302|  86.6M|	    SETVALUE(lastx - a0);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|  86.6M|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|  86.6M|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 86.6M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|  86.6M|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|  86.6M|    a0 += (x);								\
  |  |  |  |  |  |  250|  86.6M|    RunLength = 0;							\
  |  |  |  |  |  |  251|  86.6M|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  303|  86.6M|	} else if (a0 > lastx) {					\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (303:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  304|      0|	    SETVALUE(lastx);						\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  305|      0|	    SETVALUE(0);							\
  |  |  |  |  ------------------
  |  |  |  |  |  |  242|      0|#define SETVALUE(x) do {							\
  |  |  |  |  |  |  243|      0|    if (pa >= thisrun + sp->nruns) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (243:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  244|      0|        TIFFErrorExtR(tif, module, "Buffer overflow at line %u of %s %u",	\
  |  |  |  |  |  |  245|      0|                    sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                                   sp->line, isTiled(tif) ? "tile" : "strip", isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip);	\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  246|      0|        return (-1);							\
  |  |  |  |  |  |  247|      0|    }									\
  |  |  |  |  |  |  248|      0|    *pa++ = RunLength + (x);						\
  |  |  |  |  |  |  249|      0|    a0 += (x);								\
  |  |  |  |  |  |  250|      0|    RunLength = 0;							\
  |  |  |  |  |  |  251|      0|} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (251:10): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  306|      0|	}								\
  |  |  |  |  307|  86.6M|    }									\
  |  |  |  |  308|  86.6M|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (308:10): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  377|  86.6M|} while (0)
  |  |  ------------------
  |  |  |  Branch (377:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1570|  86.6M|		(*sp->fill)(buf, thisrun, pa, lastx);
 1571|       |		/*
 1572|       |		 * Cleanup at the end of the row.
 1573|       |		 */
 1574|  86.6M|		if (mode & FAXMODE_BYTEALIGN) {
  ------------------
  |  |  611|  86.6M|#define	    FAXMODE_BYTEALIGN	0x0004		/* byte align row */
  ------------------
  |  Branch (1574:7): [True: 86.5M, False: 62.1k]
  ------------------
 1575|  86.5M|			int n = BitsAvail - (BitsAvail &~ 7);
 1576|  86.5M|			ClrBits(n);
  ------------------
  |  |  173|  86.5M|#define ClrBits(n) do {							\
  |  |  174|  86.5M|    BitsAvail -= (n);							\
  |  |  175|  86.5M|    BitAcc >>= (n);							\
  |  |  176|  86.5M|} while (0)
  |  |  ------------------
  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1577|  86.5M|		} else if (mode & FAXMODE_WORDALIGN) {
  ------------------
  |  |  612|  62.1k|#define	    FAXMODE_WORDALIGN	0x0008		/* word align row */
  ------------------
  |  Branch (1577:14): [True: 62.1k, False: 0]
  ------------------
 1578|  62.1k|			int n = BitsAvail - (BitsAvail &~ 15);
 1579|  62.1k|			ClrBits(n);
  ------------------
  |  |  173|  62.1k|#define ClrBits(n) do {							\
  |  |  174|  62.1k|    BitsAvail -= (n);							\
  |  |  175|  62.1k|    BitAcc >>= (n);							\
  |  |  176|  62.1k|} while (0)
  |  |  ------------------
  |  |  |  Branch (176:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1580|  62.1k|			if (BitsAvail == 0 && !isAligned(cp, uint16_t))
  ------------------
  |  |   92|  31.5k|#define isAligned(p,t) ((((size_t)(p)) & (sizeof (t)-1)) == 0)
  ------------------
  |  Branch (1580:8): [True: 31.5k, False: 30.5k]
  |  Branch (1580:26): [True: 16.9k, False: 14.5k]
  ------------------
 1581|  16.9k|			    cp++;
 1582|  62.1k|		}
 1583|  86.6M|		buf += sp->b.rowbytes;
 1584|  86.6M|		occ -= sp->b.rowbytes;
 1585|  86.6M|		sp->line++;
 1586|  86.6M|		continue;
 1587|  3.62k|	EOFRLE:				/* premature EOF */
 1588|  3.62k|		(*sp->fill)(buf, thisrun, pa, lastx);
 1589|  3.62k|		UNCACHE_STATE(tif, sp);
  ------------------
  |  |  134|  3.62k|#define	UNCACHE_STATE(tif, sp) do {					\
  |  |  135|  3.62k|    sp->bit = BitsAvail;						\
  |  |  136|  3.62k|    sp->data = BitAcc;							\
  |  |  137|  3.62k|    sp->EOLcnt = EOLcnt;						\
  |  |  138|  3.62k|    tif->tif_rawcc -= (tmsize_t)((uint8_t*) cp - tif->tif_rawcp);		\
  |  |  139|  3.62k|    tif->tif_rawcp = (uint8_t*) cp;					\
  |  |  140|  3.62k|} while (0)
  |  |  ------------------
  |  |  |  Branch (140:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1590|  3.62k|		return (-1);
 1591|  86.6M|	}
 1592|  2.24k|	UNCACHE_STATE(tif, sp);
  ------------------
  |  |  134|  2.24k|#define	UNCACHE_STATE(tif, sp) do {					\
  |  |  135|  2.24k|    sp->bit = BitsAvail;						\
  |  |  136|  2.24k|    sp->data = BitAcc;							\
  |  |  137|  2.24k|    sp->EOLcnt = EOLcnt;						\
  |  |  138|  2.24k|    tif->tif_rawcc -= (tmsize_t)((uint8_t*) cp - tif->tif_rawcp);		\
  |  |  139|  2.24k|    tif->tif_rawcp = (uint8_t*) cp;					\
  |  |  140|  2.24k|} while (0)
  |  |  ------------------
  |  |  |  Branch (140:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1593|  2.24k|	return (1);
 1594|  5.86k|}

TIFFRGBAImageOK:
   78|  24.1k|{
   79|  24.1k|	TIFFDirectory* td = &tif->tif_dir;
   80|  24.1k|	uint16_t photometric;
   81|  24.1k|	int colorchannels;
   82|       |
   83|  24.1k|	if (!tif->tif_decodestatus) {
  ------------------
  |  Branch (83:6): [True: 1, False: 24.1k]
  ------------------
   84|      1|		snprintf(emsg, EMSG_BUF_SIZE, "Sorry, requested compression method is not configured");
  ------------------
  |  |   52|      1|#define EMSG_BUF_SIZE 1024
  ------------------
   85|      1|		return (0);
   86|      1|	}
   87|  24.1k|	switch (td->td_bitspersample) {
   88|  9.62k|		case 1:
  ------------------
  |  Branch (88:3): [True: 9.62k, False: 14.4k]
  ------------------
   89|  9.95k|		case 2:
  ------------------
  |  Branch (89:3): [True: 334, False: 23.7k]
  ------------------
   90|  10.0k|		case 4:
  ------------------
  |  Branch (90:3): [True: 71, False: 24.0k]
  ------------------
   91|  23.1k|		case 8:
  ------------------
  |  Branch (91:3): [True: 13.1k, False: 10.9k]
  ------------------
   92|  24.1k|		case 16:
  ------------------
  |  Branch (92:3): [True: 915, False: 23.1k]
  ------------------
   93|  24.1k|			break;
   94|      7|		default:
  ------------------
  |  Branch (94:3): [True: 7, False: 24.1k]
  ------------------
   95|      7|			snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle images with %"PRIu16"-bit samples",
  ------------------
  |  |   52|      7|#define EMSG_BUF_SIZE 1024
  ------------------
   96|      7|			    td->td_bitspersample);
   97|      7|			return (0);
   98|  24.1k|	}
   99|  24.1k|        if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP) {
  ------------------
  |  |  330|  24.1k|#define	    SAMPLEFORMAT_IEEEFP		3	/* !IEEE floating point data */
  ------------------
  |  Branch (99:13): [True: 1, False: 24.1k]
  ------------------
  100|      1|                snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle images with IEEE floating-point samples");
  ------------------
  |  |   52|      1|#define EMSG_BUF_SIZE 1024
  ------------------
  101|      1|                return (0);
  102|      1|        }
  103|  24.1k|	colorchannels = td->td_samplesperpixel - td->td_extrasamples;
  104|  24.1k|	if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) {
  ------------------
  |  |  214|  24.1k|#define	TIFFTAG_PHOTOMETRIC		262	/* photometric interpretation */
  ------------------
  |  Branch (104:6): [True: 14.8k, False: 9.20k]
  ------------------
  105|  14.8k|		switch (colorchannels) {
  106|  14.8k|			case 1:
  ------------------
  |  Branch (106:4): [True: 14.8k, False: 1]
  ------------------
  107|  14.8k|				photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  216|  14.8k|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  108|  14.8k|				break;
  109|      0|			case 3:
  ------------------
  |  Branch (109:4): [True: 0, False: 14.8k]
  ------------------
  110|      0|				photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  217|      0|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  111|      0|				break;
  112|      1|			default:
  ------------------
  |  Branch (112:4): [True: 1, False: 14.8k]
  ------------------
  113|      1|				snprintf(emsg, EMSG_BUF_SIZE, "Missing needed %s tag", photoTag);
  ------------------
  |  |   52|      1|#define EMSG_BUF_SIZE 1024
  ------------------
  114|      1|				return (0);
  115|  14.8k|		}
  116|  14.8k|	}
  117|  24.1k|	switch (photometric) {
  118|     29|		case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  215|     29|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  |  Branch (118:3): [True: 29, False: 24.0k]
  ------------------
  119|  15.0k|		case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  216|  15.0k|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  |  Branch (119:3): [True: 15.0k, False: 9.04k]
  ------------------
  120|  15.2k|		case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  218|  15.2k|#define	    PHOTOMETRIC_PALETTE		3	/* color map indexed */
  ------------------
  |  Branch (120:3): [True: 109, False: 23.9k]
  ------------------
  121|  15.2k|			if (td->td_planarconfig == PLANARCONFIG_CONTIG
  ------------------
  |  |  259|  30.4k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (121:8): [True: 14.6k, False: 592]
  ------------------
  122|  15.2k|			    && td->td_samplesperpixel != 1
  ------------------
  |  Branch (122:11): [True: 768, False: 13.8k]
  ------------------
  123|  15.2k|			    && td->td_bitspersample < 8 ) {
  ------------------
  |  Branch (123:11): [True: 6, False: 762]
  ------------------
  124|      6|				snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   52|      6|#define EMSG_BUF_SIZE 1024
  ------------------
  125|      6|				    "Sorry, can not handle contiguous data with %s=%"PRIu16", "
  126|      6|				    "and %s=%"PRIu16" and Bits/Sample=%"PRIu16"",
  127|      6|				    photoTag, photometric,
  128|      6|				    "Samples/pixel", td->td_samplesperpixel,
  129|      6|				    td->td_bitspersample);
  130|      6|				return (0);
  131|      6|			}
  132|       |			/*
  133|       |			 * We should likely validate that any extra samples are either
  134|       |			 * to be ignored, or are alpha, and if alpha we should try to use
  135|       |			 * them.  But for now we won't bother with this.
  136|       |			*/
  137|  15.1k|			break;
  138|  15.1k|		case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  221|  7.51k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (138:3): [True: 7.51k, False: 16.5k]
  ------------------
  139|       |			/*
  140|       |			 * TODO: if at all meaningful and useful, make more complete
  141|       |			 * support check here, or better still, refactor to let supporting
  142|       |			 * code decide whether there is support and what meaningful
  143|       |			 * error to return
  144|       |			 */
  145|  7.51k|			break;
  146|    311|		case PHOTOMETRIC_RGB:
  ------------------
  |  |  217|    311|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  |  Branch (146:3): [True: 311, False: 23.7k]
  ------------------
  147|    311|			if (colorchannels < 3) {
  ------------------
  |  Branch (147:8): [True: 3, False: 308]
  ------------------
  148|      3|				snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle RGB image with %s=%d",
  ------------------
  |  |   52|      3|#define EMSG_BUF_SIZE 1024
  ------------------
  149|      3|				    "Color channels", colorchannels);
  150|      3|				return (0);
  151|      3|			}
  152|    308|			break;
  153|    308|		case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  220|    175|#define	    PHOTOMETRIC_SEPARATED	5	/* !color separations */
  ------------------
  |  Branch (153:3): [True: 175, False: 23.9k]
  ------------------
  154|    175|			{
  155|    175|				uint16_t inkset;
  156|    175|				TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
  ------------------
  |  |  316|    175|#define	TIFFTAG_INKSET			332	/* !inks in separated image */
  ------------------
  157|    175|				if (inkset != INKSET_CMYK) {
  ------------------
  |  |  317|    175|#define	    INKSET_CMYK			1	/* !cyan-magenta-yellow-black color */
  ------------------
  |  Branch (157:9): [True: 1, False: 174]
  ------------------
  158|      1|					snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   52|      1|#define EMSG_BUF_SIZE 1024
  ------------------
  159|      1|					    "Sorry, can not handle separated image with %s=%d",
  160|      1|					    "InkSet", inkset);
  161|      1|					return 0;
  162|      1|				}
  163|    174|				if (td->td_samplesperpixel < 4) {
  ------------------
  |  Branch (163:9): [True: 6, False: 168]
  ------------------
  164|      6|					snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   52|      6|#define EMSG_BUF_SIZE 1024
  ------------------
  165|      6|					    "Sorry, can not handle separated image with %s=%"PRIu16,
  166|      6|					    "Samples/pixel", td->td_samplesperpixel);
  167|      6|					return 0;
  168|      6|				}
  169|    168|				break;
  170|    174|			}
  171|    212|		case PHOTOMETRIC_LOGL:
  ------------------
  |  |  226|    212|#define     PHOTOMETRIC_LOGL		32844	/* CIE Log2(L) */
  ------------------
  |  Branch (171:3): [True: 212, False: 23.8k]
  ------------------
  172|    212|			if (td->td_compression != COMPRESSION_SGILOG) {
  ------------------
  |  |  205|    212|#define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
  ------------------
  |  Branch (172:8): [True: 10, False: 202]
  ------------------
  173|     10|				snprintf(emsg, EMSG_BUF_SIZE, "Sorry, LogL data must have %s=%d",
  ------------------
  |  |   52|     10|#define EMSG_BUF_SIZE 1024
  ------------------
  174|     10|				    "Compression", COMPRESSION_SGILOG);
  ------------------
  |  |  205|     10|#define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
  ------------------
  175|     10|				return (0);
  176|     10|			}
  177|    202|			break;
  178|    385|		case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  227|    385|#define     PHOTOMETRIC_LOGLUV		32845	/* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (178:3): [True: 385, False: 23.7k]
  ------------------
  179|    385|			if (td->td_compression != COMPRESSION_SGILOG &&
  ------------------
  |  |  205|    770|#define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
  ------------------
  |  Branch (179:8): [True: 175, False: 210]
  ------------------
  180|    385|			    td->td_compression != COMPRESSION_SGILOG24) {
  ------------------
  |  |  206|    175|#define     COMPRESSION_SGILOG24	34677	/* SGI Log 24-bit packed */
  ------------------
  |  Branch (180:8): [True: 8, False: 167]
  ------------------
  181|      8|				snprintf(emsg, EMSG_BUF_SIZE, "Sorry, LogLuv data must have %s=%d or %d",
  ------------------
  |  |   52|      8|#define EMSG_BUF_SIZE 1024
  ------------------
  182|      8|				    "Compression", COMPRESSION_SGILOG, COMPRESSION_SGILOG24);
  ------------------
  |  |  205|      8|#define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
  ------------------
              				    "Compression", COMPRESSION_SGILOG, COMPRESSION_SGILOG24);
  ------------------
  |  |  206|      8|#define     COMPRESSION_SGILOG24	34677	/* SGI Log 24-bit packed */
  ------------------
  183|      8|				return (0);
  184|      8|			}
  185|    377|			if (td->td_planarconfig != PLANARCONFIG_CONTIG) {
  ------------------
  |  |  259|    377|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (185:8): [True: 1, False: 376]
  ------------------
  186|      1|				snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle LogLuv images with %s=%"PRIu16,
  ------------------
  |  |   52|      1|#define EMSG_BUF_SIZE 1024
  ------------------
  187|      1|				    "Planarconfiguration", td->td_planarconfig);
  188|      1|				return (0);
  189|      1|			}
  190|    376|			if ( td->td_samplesperpixel != 3 || colorchannels != 3 ) {
  ------------------
  |  Branch (190:9): [True: 3, False: 373]
  |  Branch (190:40): [True: 1, False: 372]
  ------------------
  191|      4|                                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   52|      4|#define EMSG_BUF_SIZE 1024
  ------------------
  192|      4|                                        "Sorry, can not handle image with %s=%"PRIu16", %s=%d",
  193|      4|                                        "Samples/pixel", td->td_samplesperpixel,
  194|      4|                                        "colorchannels", colorchannels);
  195|      4|                                return 0;
  196|      4|                        }
  197|    372|			break;
  198|    372|		case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  222|    279|#define	    PHOTOMETRIC_CIELAB		8	/* !1976 CIE L*a*b* */
  ------------------
  |  Branch (198:3): [True: 279, False: 23.8k]
  ------------------
  199|    279|                        if ( td->td_samplesperpixel != 3 || colorchannels != 3 || (td->td_bitspersample != 8 && td->td_bitspersample != 16) ) {
  ------------------
  |  Branch (199:30): [True: 5, False: 274]
  |  Branch (199:61): [True: 1, False: 273]
  |  Branch (199:84): [True: 173, False: 100]
  |  Branch (199:113): [True: 1, False: 172]
  ------------------
  200|      7|                                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   52|      7|#define EMSG_BUF_SIZE 1024
  ------------------
  201|      7|                                        "Sorry, can not handle image with %s=%"PRIu16", %s=%d and %s=%"PRIu16,
  202|      7|                                        "Samples/pixel", td->td_samplesperpixel,
  203|      7|                                        "colorchannels", colorchannels,
  204|      7|                                        "Bits/sample", td->td_bitspersample);
  205|      7|                                return 0;
  206|      7|                        }
  207|    272|			break;
  208|    272|                default:
  ------------------
  |  Branch (208:17): [True: 27, False: 24.0k]
  ------------------
  209|     27|			snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle image with %s=%"PRIu16,
  ------------------
  |  |   52|     27|#define EMSG_BUF_SIZE 1024
  ------------------
  210|     27|			    photoTag, photometric);
  211|     27|			return (0);
  212|  24.1k|	}
  213|  24.0k|	return (1);
  214|  24.1k|}
TIFFRGBAImageEnd:
  218|  12.0k|{
  219|  12.0k|	if (img->Map) {
  ------------------
  |  Branch (219:6): [True: 4, False: 12.0k]
  ------------------
  220|      4|		_TIFFfree(img->Map);
  221|      4|		img->Map = NULL;
  222|      4|	}
  223|  12.0k|	if (img->BWmap) {
  ------------------
  |  Branch (223:6): [True: 7.38k, False: 4.63k]
  ------------------
  224|  7.38k|		_TIFFfree(img->BWmap);
  225|  7.38k|		img->BWmap = NULL;
  226|  7.38k|	}
  227|  12.0k|	if (img->PALmap) {
  ------------------
  |  Branch (227:6): [True: 54, False: 11.9k]
  ------------------
  228|     54|		_TIFFfree(img->PALmap);
  229|     54|		img->PALmap = NULL;
  230|     54|	}
  231|  12.0k|	if (img->ycbcr) {
  ------------------
  |  Branch (231:6): [True: 2.13k, False: 9.88k]
  ------------------
  232|  2.13k|		_TIFFfree(img->ycbcr);
  233|  2.13k|		img->ycbcr = NULL;
  234|  2.13k|	}
  235|  12.0k|	if (img->cielab) {
  ------------------
  |  Branch (235:6): [True: 134, False: 11.8k]
  ------------------
  236|    134|		_TIFFfree(img->cielab);
  237|    134|		img->cielab = NULL;
  238|    134|	}
  239|  12.0k|	if (img->UaToAa) {
  ------------------
  |  Branch (239:6): [True: 64, False: 11.9k]
  ------------------
  240|     64|		_TIFFfree(img->UaToAa);
  241|     64|		img->UaToAa = NULL;
  242|     64|	}
  243|  12.0k|	if (img->Bitdepth16To8) {
  ------------------
  |  Branch (243:6): [True: 121, False: 11.8k]
  ------------------
  244|    121|		_TIFFfree(img->Bitdepth16To8);
  245|    121|		img->Bitdepth16To8 = NULL;
  246|    121|	}
  247|       |
  248|  12.0k|	if( img->redcmap ) {
  ------------------
  |  Branch (248:6): [True: 54, False: 11.9k]
  ------------------
  249|     54|		_TIFFfree( img->redcmap );
  250|     54|		_TIFFfree( img->greencmap );
  251|     54|		_TIFFfree( img->bluecmap );
  252|     54|                img->redcmap = img->greencmap = img->bluecmap = NULL;
  253|     54|	}
  254|  12.0k|}
TIFFRGBAImageBegin:
  269|  12.0k|{
  270|  12.0k|	uint16_t* sampleinfo;
  271|  12.0k|	uint16_t extrasamples;
  272|  12.0k|	uint16_t planarconfig;
  273|  12.0k|	uint16_t compress;
  274|  12.0k|	int colorchannels;
  275|  12.0k|	uint16_t *red_orig, *green_orig, *blue_orig;
  276|  12.0k|	int n_color;
  277|       |	
  278|  12.0k|	if( !TIFFRGBAImageOK(tif, emsg) )
  ------------------
  |  Branch (278:6): [True: 0, False: 12.0k]
  ------------------
  279|      0|		return 0;
  280|       |
  281|       |	/* Initialize to normal values */
  282|  12.0k|	img->row_offset = 0;
  283|  12.0k|	img->col_offset = 0;
  284|  12.0k|	img->redcmap = NULL;
  285|  12.0k|	img->greencmap = NULL;
  286|  12.0k|	img->bluecmap = NULL;
  287|  12.0k|	img->Map = NULL;
  288|  12.0k|	img->BWmap = NULL;
  289|  12.0k|	img->PALmap = NULL;
  290|  12.0k|	img->ycbcr = NULL;
  291|  12.0k|	img->cielab = NULL;
  292|  12.0k|	img->UaToAa = NULL;
  293|  12.0k|	img->Bitdepth16To8 = NULL;
  294|  12.0k|	img->req_orientation = ORIENTATION_BOTLEFT;     /* It is the default */
  ------------------
  |  |  246|  12.0k|#define	    ORIENTATION_BOTLEFT		4	/* row 0 bottom, col 0 lhs */
  ------------------
  295|       |
  296|  12.0k|	img->tif = tif;
  297|  12.0k|	img->stoponerr = stop;
  298|  12.0k|	TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
  ------------------
  |  |  174|  12.0k|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
  299|  12.0k|	switch (img->bitspersample) {
  300|  4.78k|		case 1:
  ------------------
  |  Branch (300:3): [True: 4.78k, False: 7.23k]
  ------------------
  301|  4.94k|		case 2:
  ------------------
  |  Branch (301:3): [True: 166, False: 11.8k]
  ------------------
  302|  4.98k|		case 4:
  ------------------
  |  Branch (302:3): [True: 35, False: 11.9k]
  ------------------
  303|  11.5k|		case 8:
  ------------------
  |  Branch (303:3): [True: 6.57k, False: 5.44k]
  ------------------
  304|  12.0k|		case 16:
  ------------------
  |  Branch (304:3): [True: 456, False: 11.5k]
  ------------------
  305|  12.0k|			break;
  306|      0|		default:
  ------------------
  |  Branch (306:3): [True: 0, False: 12.0k]
  ------------------
  307|      0|			snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle images with %"PRIu16"-bit samples",
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  308|      0|			    img->bitspersample);
  309|      0|			goto fail_return;
  310|  12.0k|	}
  311|  12.0k|	img->alpha = 0;
  312|  12.0k|	TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);
  ------------------
  |  |  251|  12.0k|#define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
  ------------------
  313|  12.0k|	TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES,
  ------------------
  |  |  323|  12.0k|#define	TIFFTAG_EXTRASAMPLES		338	/* !info about extra samples */
  ------------------
  314|  12.0k|	    &extrasamples, &sampleinfo);
  315|  12.0k|	if (extrasamples >= 1)
  ------------------
  |  Branch (315:6): [True: 857, False: 11.1k]
  ------------------
  316|    857|	{
  317|    857|		switch (sampleinfo[0]) {
  ------------------
  |  Branch (317:11): [True: 0, False: 857]
  ------------------
  318|    691|			case EXTRASAMPLE_UNSPECIFIED:          /* Workaround for some images without */
  ------------------
  |  |  324|    691|#define	    EXTRASAMPLE_UNSPECIFIED	0	/* !unspecified data */
  ------------------
  |  Branch (318:4): [True: 691, False: 166]
  ------------------
  319|    691|				if (img->samplesperpixel > 3)  /* correct info about alpha channel */
  ------------------
  |  Branch (319:9): [True: 359, False: 332]
  ------------------
  320|    359|					img->alpha = EXTRASAMPLE_ASSOCALPHA;
  ------------------
  |  |  325|    359|#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
  ------------------
  321|    691|				break;
  322|     71|			case EXTRASAMPLE_ASSOCALPHA:           /* data is pre-multiplied */
  ------------------
  |  |  325|     71|#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
  ------------------
  |  Branch (322:4): [True: 71, False: 786]
  ------------------
  323|    166|			case EXTRASAMPLE_UNASSALPHA:           /* data is not pre-multiplied */
  ------------------
  |  |  326|    166|#define	    EXTRASAMPLE_UNASSALPHA	2	/* !unassociated alpha data */
  ------------------
  |  Branch (323:4): [True: 95, False: 762]
  ------------------
  324|    166|				img->alpha = sampleinfo[0];
  325|    166|				break;
  326|    857|		}
  327|    857|	}
  328|       |
  329|  12.0k|#ifdef DEFAULT_EXTRASAMPLE_AS_ALPHA
  330|  12.0k|	if( !TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric))
  ------------------
  |  |  214|  12.0k|#define	TIFFTAG_PHOTOMETRIC		262	/* photometric interpretation */
  ------------------
  |  Branch (330:6): [True: 7.44k, False: 4.57k]
  ------------------
  331|  7.44k|		img->photometric = PHOTOMETRIC_MINISWHITE;
  ------------------
  |  |  215|  7.44k|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  332|       |
  333|  12.0k|	if( extrasamples == 0
  ------------------
  |  Branch (333:6): [True: 11.1k, False: 857]
  ------------------
  334|  12.0k|	    && img->samplesperpixel == 4
  ------------------
  |  Branch (334:9): [True: 23, False: 11.1k]
  ------------------
  335|  12.0k|	    && img->photometric == PHOTOMETRIC_RGB )
  ------------------
  |  |  217|     23|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  |  Branch (335:9): [True: 0, False: 23]
  ------------------
  336|      0|	{
  337|      0|		img->alpha = EXTRASAMPLE_ASSOCALPHA;
  ------------------
  |  |  325|      0|#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
  ------------------
  338|      0|		extrasamples = 1;
  339|      0|	}
  340|  12.0k|#endif
  341|       |
  342|  12.0k|	colorchannels = img->samplesperpixel - extrasamples;
  343|  12.0k|	TIFFGetFieldDefaulted(tif, TIFFTAG_COMPRESSION, &compress);
  ------------------
  |  |  175|  12.0k|#define	TIFFTAG_COMPRESSION		259	/* data compression technique */
  ------------------
  344|  12.0k|	TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig);
  ------------------
  |  |  258|  12.0k|#define	TIFFTAG_PLANARCONFIG		284	/* storage organization */
  ------------------
  345|  12.0k|	if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric)) {
  ------------------
  |  |  214|  12.0k|#define	TIFFTAG_PHOTOMETRIC		262	/* photometric interpretation */
  ------------------
  |  Branch (345:6): [True: 7.44k, False: 4.57k]
  ------------------
  346|  7.44k|		switch (colorchannels) {
  347|  7.44k|			case 1:
  ------------------
  |  Branch (347:4): [True: 7.44k, False: 0]
  ------------------
  348|  7.44k|				if (isCCITTCompression(tif))
  ------------------
  |  Branch (348:9): [True: 1.91k, False: 5.52k]
  ------------------
  349|  1.91k|					img->photometric = PHOTOMETRIC_MINISWHITE;
  ------------------
  |  |  215|  1.91k|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  350|  5.52k|				else
  351|  5.52k|					img->photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  216|  5.52k|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  352|  7.44k|				break;
  353|      0|			case 3:
  ------------------
  |  Branch (353:4): [True: 0, False: 7.44k]
  ------------------
  354|      0|				img->photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  217|      0|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  355|      0|				break;
  356|      0|			default:
  ------------------
  |  Branch (356:4): [True: 0, False: 7.44k]
  ------------------
  357|      0|				snprintf(emsg, EMSG_BUF_SIZE, "Missing needed %s tag", photoTag);
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  358|      0|                                goto fail_return;
  359|  7.44k|		}
  360|  7.44k|	}
  361|  12.0k|	switch (img->photometric) {
  362|     54|		case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  218|     54|#define	    PHOTOMETRIC_PALETTE		3	/* color map indexed */
  ------------------
  |  Branch (362:3): [True: 54, False: 11.9k]
  ------------------
  363|     54|			if (!TIFFGetField(tif, TIFFTAG_COLORMAP,
  ------------------
  |  |  303|     54|#define	TIFFTAG_COLORMAP		320	/* RGB map for palette image */
  ------------------
  |  Branch (363:8): [True: 0, False: 54]
  ------------------
  364|     54|			    &red_orig, &green_orig, &blue_orig)) {
  365|      0|				snprintf(emsg, EMSG_BUF_SIZE, "Missing required \"Colormap\" tag");
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  366|      0|                                goto fail_return;
  367|      0|			}
  368|       |
  369|       |			/* copy the colormaps so we can modify them */
  370|     54|			n_color = (1U << img->bitspersample);
  371|     54|			img->redcmap = (uint16_t *) _TIFFmalloc(sizeof(uint16_t) * n_color);
  372|     54|			img->greencmap = (uint16_t *) _TIFFmalloc(sizeof(uint16_t) * n_color);
  373|     54|			img->bluecmap = (uint16_t *) _TIFFmalloc(sizeof(uint16_t) * n_color);
  374|     54|			if( !img->redcmap || !img->greencmap || !img->bluecmap ) {
  ------------------
  |  Branch (374:8): [True: 0, False: 54]
  |  Branch (374:25): [True: 0, False: 54]
  |  Branch (374:44): [True: 0, False: 54]
  ------------------
  375|      0|				snprintf(emsg, EMSG_BUF_SIZE, "Out of memory for colormap copy");
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  376|      0|                                goto fail_return;
  377|      0|			}
  378|       |
  379|     54|			_TIFFmemcpy( img->redcmap, red_orig, n_color * 2 );
  380|     54|			_TIFFmemcpy( img->greencmap, green_orig, n_color * 2 );
  381|     54|			_TIFFmemcpy( img->bluecmap, blue_orig, n_color * 2 );
  382|       |
  383|       |			/* fall through... */
  384|  1.98k|		case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  215|  1.98k|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  |  Branch (384:3): [True: 1.93k, False: 10.0k]
  ------------------
  385|  7.59k|		case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  216|  7.59k|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  |  Branch (385:3): [True: 5.61k, False: 6.40k]
  ------------------
  386|  7.59k|			if (planarconfig == PLANARCONFIG_CONTIG
  ------------------
  |  |  259|  15.1k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (386:8): [True: 7.30k, False: 296]
  ------------------
  387|  7.59k|			    && img->samplesperpixel != 1
  ------------------
  |  Branch (387:11): [True: 381, False: 6.92k]
  ------------------
  388|  7.59k|			    && img->bitspersample < 8 ) {
  ------------------
  |  Branch (388:11): [True: 0, False: 381]
  ------------------
  389|      0|				snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  390|      0|				    "Sorry, can not handle contiguous data with %s=%"PRIu16", "
  391|      0|				    "and %s=%"PRIu16" and Bits/Sample=%"PRIu16,
  392|      0|				    photoTag, img->photometric,
  393|      0|				    "Samples/pixel", img->samplesperpixel,
  394|      0|				    img->bitspersample);
  395|      0|                                goto fail_return;
  396|      0|			}
  397|  7.59k|			break;
  398|  7.59k|		case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  221|  3.75k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (398:3): [True: 3.75k, False: 8.25k]
  ------------------
  399|       |			/* It would probably be nice to have a reality check here. */
  400|  3.75k|			if (planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  259|  3.75k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (400:8): [True: 3.12k, False: 629]
  ------------------
  401|       |				/* can rely on libjpeg to convert to RGB */
  402|       |				/* XXX should restore current state on exit */
  403|  3.12k|				switch (compress) {
  404|  1.61k|					case COMPRESSION_JPEG:
  ------------------
  |  |  184|  1.61k|#define	    COMPRESSION_JPEG		7	/* %JPEG DCT compression */
  ------------------
  |  Branch (404:6): [True: 1.61k, False: 1.51k]
  ------------------
  405|       |						/*
  406|       |						 * TODO: when complete tests verify complete desubsampling
  407|       |						 * and YCbCr handling, remove use of TIFFTAG_JPEGCOLORMODE in
  408|       |						 * favor of tif_getimage.c native handling
  409|       |						 */
  410|  1.61k|						TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
  ------------------
  |  |  616|  1.61k|#define	TIFFTAG_JPEGCOLORMODE		65538	/* Auto RGB<=>YCbCr convert? */
  ------------------
              						TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
  ------------------
  |  |  618|  1.61k|#define	    JPEGCOLORMODE_RGB	0x0001		/* do auto conversion */
  ------------------
  411|  1.61k|						img->photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  217|  1.61k|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  412|  1.61k|						break;
  413|  1.51k|					default:
  ------------------
  |  Branch (413:6): [True: 1.51k, False: 1.61k]
  ------------------
  414|  1.51k|						/* do nothing */;
  415|  1.51k|						break;
  416|  3.12k|				}
  417|       |			/*
  418|       |			 * TODO: if at all meaningful and useful, make more complete
  419|       |			 * support check here, or better still, refactor to let supporting
  420|       |			 * code decide whether there is support and what meaningful
  421|       |			 * error to return
  422|       |			 */
  423|  3.75k|			break;
  424|  3.75k|		case PHOTOMETRIC_RGB:
  ------------------
  |  |  217|    154|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  |  Branch (424:3): [True: 154, False: 11.8k]
  ------------------
  425|    154|			if (colorchannels < 3) {
  ------------------
  |  Branch (425:8): [True: 0, False: 154]
  ------------------
  426|      0|				snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle RGB image with %s=%d",
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  427|      0|				    "Color channels", colorchannels);
  428|      0|                                goto fail_return;
  429|      0|			}
  430|    154|			break;
  431|    154|		case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  220|     84|#define	    PHOTOMETRIC_SEPARATED	5	/* !color separations */
  ------------------
  |  Branch (431:3): [True: 84, False: 11.9k]
  ------------------
  432|     84|			{
  433|     84|				uint16_t inkset;
  434|     84|				TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
  ------------------
  |  |  316|     84|#define	TIFFTAG_INKSET			332	/* !inks in separated image */
  ------------------
  435|     84|				if (inkset != INKSET_CMYK) {
  ------------------
  |  |  317|     84|#define	    INKSET_CMYK			1	/* !cyan-magenta-yellow-black color */
  ------------------
  |  Branch (435:9): [True: 0, False: 84]
  ------------------
  436|      0|					snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle separated image with %s=%"PRIu16,
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  437|      0|					    "InkSet", inkset);
  438|      0|                                        goto fail_return;
  439|      0|				}
  440|     84|				if (img->samplesperpixel < 4) {
  ------------------
  |  Branch (440:9): [True: 0, False: 84]
  ------------------
  441|      0|					snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle separated image with %s=%"PRIu16,
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  442|      0|					    "Samples/pixel", img->samplesperpixel);
  443|      0|                                        goto fail_return;
  444|      0|				}
  445|     84|			}
  446|     84|			break;
  447|    101|		case PHOTOMETRIC_LOGL:
  ------------------
  |  |  226|    101|#define     PHOTOMETRIC_LOGL		32844	/* CIE Log2(L) */
  ------------------
  |  Branch (447:3): [True: 101, False: 11.9k]
  ------------------
  448|    101|			if (compress != COMPRESSION_SGILOG) {
  ------------------
  |  |  205|    101|#define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
  ------------------
  |  Branch (448:8): [True: 0, False: 101]
  ------------------
  449|      0|				snprintf(emsg, EMSG_BUF_SIZE, "Sorry, LogL data must have %s=%d",
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  450|      0|				    "Compression", COMPRESSION_SGILOG);
  ------------------
  |  |  205|      0|#define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
  ------------------
  451|      0|                                goto fail_return;
  452|      0|			}
  453|    101|			TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  653|    101|#define TIFFTAG_SGILOGDATAFMT		65560	/* SGILog user data format */
  ------------------
              			TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  657|    101|#define     SGILOGDATAFMT_8BIT		3	/* 8-bit RGB monitor values */
  ------------------
  454|    101|			img->photometric = PHOTOMETRIC_MINISBLACK;	/* little white lie */
  ------------------
  |  |  216|    101|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  455|    101|			img->bitspersample = 8;
  456|    101|			break;
  457|    186|		case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  227|    186|#define     PHOTOMETRIC_LOGLUV		32845	/* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (457:3): [True: 186, False: 11.8k]
  ------------------
  458|    186|			if (compress != COMPRESSION_SGILOG && compress != COMPRESSION_SGILOG24) {
  ------------------
  |  |  205|    372|#define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
  ------------------
              			if (compress != COMPRESSION_SGILOG && compress != COMPRESSION_SGILOG24) {
  ------------------
  |  |  206|     82|#define     COMPRESSION_SGILOG24	34677	/* SGI Log 24-bit packed */
  ------------------
  |  Branch (458:8): [True: 82, False: 104]
  |  Branch (458:42): [True: 0, False: 82]
  ------------------
  459|      0|				snprintf(emsg, EMSG_BUF_SIZE, "Sorry, LogLuv data must have %s=%d or %d",
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  460|      0|				    "Compression", COMPRESSION_SGILOG, COMPRESSION_SGILOG24);
  ------------------
  |  |  205|      0|#define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
  ------------------
              				    "Compression", COMPRESSION_SGILOG, COMPRESSION_SGILOG24);
  ------------------
  |  |  206|      0|#define     COMPRESSION_SGILOG24	34677	/* SGI Log 24-bit packed */
  ------------------
  461|      0|                                goto fail_return;
  462|      0|			}
  463|    186|			if (planarconfig != PLANARCONFIG_CONTIG) {
  ------------------
  |  |  259|    186|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (463:8): [True: 0, False: 186]
  ------------------
  464|      0|				snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle LogLuv images with %s=%"PRIu16,
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  465|      0|				    "Planarconfiguration", planarconfig);
  466|      0|				return (0);
  467|      0|			}
  468|    186|			TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  653|    186|#define TIFFTAG_SGILOGDATAFMT		65560	/* SGILog user data format */
  ------------------
              			TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  657|    186|#define     SGILOGDATAFMT_8BIT		3	/* 8-bit RGB monitor values */
  ------------------
  469|    186|			img->photometric = PHOTOMETRIC_RGB;		/* little white lie */
  ------------------
  |  |  217|    186|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  470|    186|			img->bitspersample = 8;
  471|    186|			break;
  472|    136|		case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  222|    136|#define	    PHOTOMETRIC_CIELAB		8	/* !1976 CIE L*a*b* */
  ------------------
  |  Branch (472:3): [True: 136, False: 11.8k]
  ------------------
  473|    136|			break;
  474|      0|		default:
  ------------------
  |  Branch (474:3): [True: 0, False: 12.0k]
  ------------------
  475|      0|			snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle image with %s=%"PRIu16,
  ------------------
  |  |   52|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  476|      0|			    photoTag, img->photometric);
  477|      0|                        goto fail_return;
  478|  12.0k|	}
  479|  12.0k|	TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
  ------------------
  |  |  172|  12.0k|#define	TIFFTAG_IMAGEWIDTH		256	/* image width in pixels */
  ------------------
  480|  12.0k|	TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
  ------------------
  |  |  173|  12.0k|#define	TIFFTAG_IMAGELENGTH		257	/* image height in pixels */
  ------------------
  481|  12.0k|	TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
  ------------------
  |  |  242|  12.0k|#define	TIFFTAG_ORIENTATION		274	/* +image orientation */
  ------------------
  482|  12.0k|	img->isContig =
  483|  12.0k|	    !(planarconfig == PLANARCONFIG_SEPARATE && img->samplesperpixel > 1);
  ------------------
  |  |  260|  24.0k|#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  ------------------
  |  Branch (483:8): [True: 991, False: 11.0k]
  |  Branch (483:49): [True: 947, False: 44]
  ------------------
  484|  12.0k|	if (img->isContig) {
  ------------------
  |  Branch (484:6): [True: 11.0k, False: 947]
  ------------------
  485|  11.0k|		if (!PickContigCase(img)) {
  ------------------
  |  Branch (485:7): [True: 852, False: 10.2k]
  ------------------
  486|    852|			snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle image");
  ------------------
  |  |   52|    852|#define EMSG_BUF_SIZE 1024
  ------------------
  487|    852|			goto fail_return;
  488|    852|		}
  489|  11.0k|	} else {
  490|    947|		if (!PickSeparateCase(img)) {
  ------------------
  |  Branch (490:7): [True: 24, False: 923]
  ------------------
  491|     24|			snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle image");
  ------------------
  |  |   52|     24|#define EMSG_BUF_SIZE 1024
  ------------------
  492|     24|			goto fail_return;
  493|     24|		}
  494|    947|	}
  495|  11.1k|	return 1;
  496|       |
  497|    876|  fail_return:
  498|    876|        TIFFRGBAImageEnd( img );
  499|    876|        return 0;
  500|  12.0k|}
TIFFRGBAImageGet:
  504|  11.1k|{
  505|  11.1k|    if (img->get == NULL) {
  ------------------
  |  Branch (505:9): [True: 0, False: 11.1k]
  ------------------
  506|      0|		TIFFErrorExtR(img->tif, TIFFFileName(img->tif), "No \"get\" routine setup");
  507|      0|		return (0);
  508|      0|	}
  509|  11.1k|	if (img->put.any == NULL) {
  ------------------
  |  Branch (509:6): [True: 0, False: 11.1k]
  ------------------
  510|      0|		TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
  511|      0|		"No \"put\" routine setupl; probably can not handle image format");
  512|      0|		return (0);
  513|      0|    }
  514|  11.1k|    return (*img->get)(img, raster, w, h);
  515|  11.1k|}
TIFFReadRGBAImageOriented:
  525|  12.0k|{
  526|  12.0k|    char emsg[EMSG_BUF_SIZE] = "";
  527|  12.0k|    TIFFRGBAImage img;
  528|  12.0k|    int ok;
  529|       |
  530|  12.0k|	if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, stop, emsg)) {
  ------------------
  |  Branch (530:6): [True: 12.0k, False: 83]
  |  Branch (530:36): [True: 11.1k, False: 876]
  ------------------
  531|  11.1k|		img.req_orientation = (uint16_t)orientation;
  532|       |		/* XXX verify rwidth and rheight against width and height */
  533|  11.1k|		ok = TIFFRGBAImageGet(&img, raster+(rheight-img.height)*rwidth,
  534|  11.1k|			rwidth, img.height);
  535|  11.1k|		TIFFRGBAImageEnd(&img);
  536|  11.1k|	} else {
  537|    959|		TIFFErrorExtR(tif, TIFFFileName(tif), "%s", emsg);
  538|    959|		ok = 0;
  539|    959|    }
  540|  12.0k|    return (ok);
  541|  12.0k|}
TIFFReadRGBAImage:
  550|  12.0k|{
  551|  12.0k|	return TIFFReadRGBAImageOriented(tif, rwidth, rheight, raster,
  552|  12.0k|					 ORIENTATION_BOTLEFT, stop);
  ------------------
  |  |  246|  12.0k|#define	    ORIENTATION_BOTLEFT		4	/* row 0 bottom, col 0 lhs */
  ------------------
  553|  12.0k|}
tif_getimage.c:isCCITTCompression:
  258|  7.44k|{
  259|  7.44k|    uint16_t compress;
  260|  7.44k|    TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
  ------------------
  |  |  175|  7.44k|#define	TIFFTAG_COMPRESSION		259	/* data compression technique */
  ------------------
  261|  7.44k|    return (compress == COMPRESSION_CCITTFAX3 ||
  ------------------
  |  |  178|  14.8k|#define	    COMPRESSION_CCITTFAX3	3	/* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (261:13): [True: 1.09k, False: 6.35k]
  ------------------
  262|  7.44k|	    compress == COMPRESSION_CCITTFAX4 ||
  ------------------
  |  |  180|  13.8k|#define	    COMPRESSION_CCITTFAX4	4	/* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (262:6): [True: 612, False: 5.74k]
  ------------------
  263|  7.44k|	    compress == COMPRESSION_CCITTRLE ||
  ------------------
  |  |  177|  13.1k|#define	    COMPRESSION_CCITTRLE	2	/* CCITT modified Huffman RLE */
  ------------------
  |  Branch (263:6): [True: 154, False: 5.59k]
  ------------------
  264|  7.44k|	    compress == COMPRESSION_CCITTRLEW);
  ------------------
  |  |  188|  5.59k|#define	    COMPRESSION_CCITTRLEW	32771	/* #1 w/ word alignment */
  ------------------
  |  Branch (264:6): [True: 63, False: 5.52k]
  ------------------
  265|  7.44k|}
tif_getimage.c:PickContigCase:
 2601|  11.0k|{
 2602|  11.0k|	img->get = TIFFIsTiled(img->tif) ? gtTileContig : gtStripContig;
  ------------------
  |  Branch (2602:13): [True: 11.0k, False: 0]
  ------------------
 2603|  11.0k|	img->put.contig = NULL;
 2604|  11.0k|	switch (img->photometric) {
  ------------------
  |  Branch (2604:10): [True: 0, False: 11.0k]
  ------------------
 2605|  1.92k|		case PHOTOMETRIC_RGB:
  ------------------
  |  |  217|  1.92k|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  |  Branch (2605:3): [True: 1.92k, False: 9.14k]
  ------------------
 2606|  1.92k|			switch (img->bitspersample) {
  ------------------
  |  Branch (2606:12): [True: 821, False: 1.10k]
  ------------------
 2607|  1.04k|				case 8:
  ------------------
  |  Branch (2607:5): [True: 1.04k, False: 875]
  ------------------
 2608|  1.04k|					if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
  ------------------
  |  |  325|  2.09k|#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
  ------------------
  |  Branch (2608:10): [True: 53, False: 994]
  ------------------
 2609|  1.04k|						img->samplesperpixel >= 4)
  ------------------
  |  Branch (2609:7): [True: 52, False: 1]
  ------------------
 2610|     52|						img->put.contig = putRGBAAcontig8bittile;
 2611|    995|					else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
  ------------------
  |  |  326|  1.99k|#define	    EXTRASAMPLE_UNASSALPHA	2	/* !unassociated alpha data */
  ------------------
  |  Branch (2611:15): [True: 22, False: 973]
  ------------------
 2612|    995|							 img->samplesperpixel >= 4)
  ------------------
  |  Branch (2612:9): [True: 19, False: 3]
  ------------------
 2613|     19|					{
 2614|     19|						if (BuildMapUaToAa(img))
  ------------------
  |  Branch (2614:11): [True: 19, False: 0]
  ------------------
 2615|     19|							img->put.contig = putRGBUAcontig8bittile;
 2616|     19|					}
 2617|    976|					else if( img->samplesperpixel >= 3 )
  ------------------
  |  Branch (2617:15): [True: 972, False: 4]
  ------------------
 2618|    972|						img->put.contig = putRGBcontig8bittile;
 2619|  1.04k|					break;
 2620|     54|				case 16:
  ------------------
  |  Branch (2620:5): [True: 54, False: 1.86k]
  ------------------
 2621|     54|					if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
  ------------------
  |  |  325|    108|#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
  ------------------
  |  Branch (2621:10): [True: 23, False: 31]
  ------------------
 2622|     54|						img->samplesperpixel >=4 )
  ------------------
  |  Branch (2622:7): [True: 22, False: 1]
  ------------------
 2623|     22|					{
 2624|     22|						if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (2624:11): [True: 22, False: 0]
  ------------------
 2625|     22|							img->put.contig = putRGBAAcontig16bittile;
 2626|     22|					}
 2627|     32|					else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
  ------------------
  |  |  326|     64|#define	    EXTRASAMPLE_UNASSALPHA	2	/* !unassociated alpha data */
  ------------------
  |  Branch (2627:15): [True: 9, False: 23]
  ------------------
 2628|     32|							 img->samplesperpixel >=4 )
  ------------------
  |  Branch (2628:9): [True: 8, False: 1]
  ------------------
 2629|      8|					{
 2630|      8|						if (BuildMapBitdepth16To8(img) &&
  ------------------
  |  Branch (2630:11): [True: 8, False: 0]
  ------------------
 2631|      8|						    BuildMapUaToAa(img))
  ------------------
  |  Branch (2631:11): [True: 8, False: 0]
  ------------------
 2632|      8|							img->put.contig = putRGBUAcontig16bittile;
 2633|      8|					}
 2634|     24|					else if( img->samplesperpixel >=3 )
  ------------------
  |  Branch (2634:15): [True: 23, False: 1]
  ------------------
 2635|     23|					{
 2636|     23|						if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (2636:11): [True: 23, False: 0]
  ------------------
 2637|     23|							img->put.contig = putRGBcontig16bittile;
 2638|     23|					}
 2639|     54|					break;
 2640|  1.92k|			}
 2641|  1.92k|			break;
 2642|  1.92k|		case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  220|     59|#define	    PHOTOMETRIC_SEPARATED	5	/* !color separations */
  ------------------
  |  Branch (2642:3): [True: 59, False: 11.0k]
  ------------------
 2643|     59|			if (img->samplesperpixel >=4 && buildMap(img)) {
  ------------------
  |  Branch (2643:8): [True: 59, False: 0]
  |  Branch (2643:36): [True: 59, False: 0]
  ------------------
 2644|     59|				if (img->bitspersample == 8) {
  ------------------
  |  Branch (2644:9): [True: 55, False: 4]
  ------------------
 2645|     55|					if (!img->Map)
  ------------------
  |  Branch (2645:10): [True: 55, False: 0]
  ------------------
 2646|     55|						img->put.contig = putRGBcontig8bitCMYKtile;
 2647|      0|					else
 2648|      0|						img->put.contig = putRGBcontig8bitCMYKMaptile;
 2649|     55|				}
 2650|     59|			}
 2651|     59|			break;
 2652|     54|		case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  218|     54|#define	    PHOTOMETRIC_PALETTE		3	/* color map indexed */
  ------------------
  |  Branch (2652:3): [True: 54, False: 11.0k]
  ------------------
 2653|     54|			if (buildMap(img)) {
  ------------------
  |  Branch (2653:8): [True: 54, False: 0]
  ------------------
 2654|     54|				switch (img->bitspersample) {
  ------------------
  |  Branch (2654:13): [True: 0, False: 54]
  ------------------
 2655|     21|					case 8:
  ------------------
  |  Branch (2655:6): [True: 21, False: 33]
  ------------------
 2656|     21|						img->put.contig = put8bitcmaptile;
 2657|     21|						break;
 2658|      0|					case 4:
  ------------------
  |  Branch (2658:6): [True: 0, False: 54]
  ------------------
 2659|      0|						img->put.contig = put4bitcmaptile;
 2660|      0|						break;
 2661|     33|					case 2:
  ------------------
  |  Branch (2661:6): [True: 33, False: 21]
  ------------------
 2662|     33|						img->put.contig = put2bitcmaptile;
 2663|     33|						break;
 2664|      0|					case 1:
  ------------------
  |  Branch (2664:6): [True: 0, False: 54]
  ------------------
 2665|      0|						img->put.contig = put1bitcmaptile;
 2666|      0|						break;
 2667|     54|				}
 2668|     54|			}
 2669|     54|			break;
 2670|  1.93k|		case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  215|  1.93k|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  |  Branch (2670:3): [True: 1.93k, False: 9.13k]
  ------------------
 2671|  7.38k|		case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  216|  7.38k|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  |  Branch (2671:3): [True: 5.45k, False: 5.61k]
  ------------------
 2672|  7.38k|			if (buildMap(img)) {
  ------------------
  |  Branch (2672:8): [True: 7.38k, False: 0]
  ------------------
 2673|  7.38k|				switch (img->bitspersample) {
  ------------------
  |  Branch (2673:13): [True: 0, False: 7.38k]
  ------------------
 2674|    248|					case 16:
  ------------------
  |  Branch (2674:6): [True: 248, False: 7.13k]
  ------------------
 2675|    248|						img->put.contig = put16bitbwtile;
 2676|    248|						break;
 2677|  3.30k|					case 8:
  ------------------
  |  Branch (2677:6): [True: 3.30k, False: 4.07k]
  ------------------
 2678|  3.30k|						if (img->alpha && img->samplesperpixel == 2)
  ------------------
  |  Branch (2678:11): [True: 84, False: 3.22k]
  |  Branch (2678:25): [True: 29, False: 55]
  ------------------
 2679|     29|							img->put.contig = putagreytile;
 2680|  3.28k|						else
 2681|  3.28k|							img->put.contig = putgreytile;
 2682|  3.30k|						break;
 2683|     35|					case 4:
  ------------------
  |  Branch (2683:6): [True: 35, False: 7.35k]
  ------------------
 2684|     35|						img->put.contig = put4bitbwtile;
 2685|     35|						break;
 2686|    133|					case 2:
  ------------------
  |  Branch (2686:6): [True: 133, False: 7.25k]
  ------------------
 2687|    133|						img->put.contig = put2bitbwtile;
 2688|    133|						break;
 2689|  3.66k|					case 1:
  ------------------
  |  Branch (2689:6): [True: 3.66k, False: 3.72k]
  ------------------
 2690|  3.66k|						img->put.contig = put1bitbwtile;
 2691|  3.66k|						break;
 2692|  7.38k|				}
 2693|  7.38k|			}
 2694|  7.38k|			break;
 2695|  7.38k|		case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  221|  1.51k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (2695:3): [True: 1.51k, False: 9.55k]
  ------------------
 2696|  1.51k|			if ((img->bitspersample==8) && (img->samplesperpixel==3))
  ------------------
  |  Branch (2696:8): [True: 1.50k, False: 6]
  |  Branch (2696:35): [True: 1.50k, False: 3]
  ------------------
 2697|  1.50k|			{
 2698|  1.50k|				if (initYCbCrConversion(img)!=0)
  ------------------
  |  Branch (2698:9): [True: 1.49k, False: 11]
  ------------------
 2699|  1.49k|				{
 2700|       |					/*
 2701|       |					 * The 6.0 spec says that subsampling must be
 2702|       |					 * one of 1, 2, or 4, and that vertical subsampling
 2703|       |					 * must always be <= horizontal subsampling; so
 2704|       |					 * there are only a few possibilities and we just
 2705|       |					 * enumerate the cases.
 2706|       |					 * Joris: added support for the [1,2] case, nonetheless, to accommodate
 2707|       |					 * some OJPEG files
 2708|       |					 */
 2709|  1.49k|					uint16_t SubsamplingHor;
 2710|  1.49k|					uint16_t SubsamplingVer;
 2711|  1.49k|					TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &SubsamplingHor, &SubsamplingVer);
  ------------------
  |  |  386|  1.49k|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
 2712|  1.49k|					switch ((SubsamplingHor<<4)|SubsamplingVer) {
  ------------------
  |  Branch (2712:14): [True: 1, False: 1.49k]
  ------------------
 2713|     76|						case 0x44:
  ------------------
  |  Branch (2713:7): [True: 76, False: 1.41k]
  ------------------
 2714|     76|							img->put.contig = putcontig8bitYCbCr44tile;
 2715|     76|							break;
 2716|     57|						case 0x42:
  ------------------
  |  Branch (2716:7): [True: 57, False: 1.43k]
  ------------------
 2717|     57|							img->put.contig = putcontig8bitYCbCr42tile;
 2718|     57|							break;
 2719|     31|						case 0x41:
  ------------------
  |  Branch (2719:7): [True: 31, False: 1.46k]
  ------------------
 2720|     31|							img->put.contig = putcontig8bitYCbCr41tile;
 2721|     31|							break;
 2722|  1.18k|						case 0x22:
  ------------------
  |  Branch (2722:7): [True: 1.18k, False: 309]
  ------------------
 2723|  1.18k|							img->put.contig = putcontig8bitYCbCr22tile;
 2724|  1.18k|							break;
 2725|     27|						case 0x21:
  ------------------
  |  Branch (2725:7): [True: 27, False: 1.46k]
  ------------------
 2726|     27|							img->put.contig = putcontig8bitYCbCr21tile;
 2727|     27|							break;
 2728|     27|						case 0x12:
  ------------------
  |  Branch (2728:7): [True: 27, False: 1.46k]
  ------------------
 2729|     27|							img->put.contig = putcontig8bitYCbCr12tile;
 2730|     27|							break;
 2731|     90|						case 0x11:
  ------------------
  |  Branch (2731:7): [True: 90, False: 1.40k]
  ------------------
 2732|     90|							img->put.contig = putcontig8bitYCbCr11tile;
 2733|     90|							break;
 2734|  1.49k|					}
 2735|  1.49k|				}
 2736|  1.50k|			}
 2737|  1.51k|			break;
 2738|  1.51k|		case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  222|    135|#define	    PHOTOMETRIC_CIELAB		8	/* !1976 CIE L*a*b* */
  ------------------
  |  Branch (2738:3): [True: 135, False: 10.9k]
  ------------------
 2739|    135|			if (img->samplesperpixel == 3 && buildMap(img)) {
  ------------------
  |  Branch (2739:8): [True: 135, False: 0]
  |  Branch (2739:37): [True: 135, False: 0]
  ------------------
 2740|    135|				if (img->bitspersample == 8 || img->bitspersample == 16)
  ------------------
  |  Branch (2740:9): [True: 50, False: 85]
  |  Branch (2740:36): [True: 85, False: 0]
  ------------------
 2741|    135|					img->put.contig = initCIELabConversion(img);
 2742|    135|				break;
 2743|    135|			}
 2744|  11.0k|	}
 2745|  11.0k|	return ((img->get!=NULL) && (img->put.contig!=NULL));
  ------------------
  |  Branch (2745:10): [True: 11.0k, False: 0]
  |  Branch (2745:30): [True: 10.2k, False: 852]
  ------------------
 2746|  11.0k|}
tif_getimage.c:gtTileContig:
  624|  10.2k|{
  625|  10.2k|    TIFF* tif = img->tif;
  626|  10.2k|    tileContigRoutine put = img->put.contig;
  627|  10.2k|    uint32_t col, row, y, rowstoread;
  628|  10.2k|    tmsize_t pos;
  629|  10.2k|    uint32_t tw, th;
  630|  10.2k|    unsigned char* buf = NULL;
  631|  10.2k|    int32_t fromskew, toskew;
  632|  10.2k|    uint32_t nrow;
  633|  10.2k|    int ret = 1, flip;
  634|  10.2k|    uint32_t this_tw, tocol;
  635|  10.2k|    int32_t this_toskew, leftmost_toskew;
  636|  10.2k|    int32_t leftmost_fromskew;
  637|  10.2k|    uint32_t leftmost_tw;
  638|  10.2k|    tmsize_t bufsize;
  639|       |
  640|  10.2k|    bufsize = TIFFTileSize(tif);
  641|  10.2k|    if (bufsize == 0) {
  ------------------
  |  Branch (641:9): [True: 0, False: 10.2k]
  ------------------
  642|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s", "No space for tile buffer");
  643|      0|        return (0);
  644|      0|    }
  645|       |
  646|  10.2k|    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
  ------------------
  |  |  305|  10.2k|#define	TIFFTAG_TILEWIDTH		322	/* !tile width in pixels */
  ------------------
  647|  10.2k|    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
  ------------------
  |  |  306|  10.2k|#define	TIFFTAG_TILELENGTH		323	/* !tile height in pixels */
  ------------------
  648|       |
  649|  10.2k|    flip = setorientation(img);
  650|  10.2k|    if (flip & FLIP_VERTICALLY) {
  ------------------
  |  |   49|  10.2k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (650:9): [True: 10.1k, False: 72]
  ------------------
  651|  10.1k|        if ((tw + w) > INT_MAX) {
  ------------------
  |  Branch (651:13): [True: 0, False: 10.1k]
  ------------------
  652|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s", "unsupported tile size (too wide)");
  653|      0|            return (0);
  654|      0|        }
  655|  10.1k|        y = h - 1;
  656|  10.1k|        toskew = -(int32_t)(tw + w);
  657|  10.1k|    }
  658|     72|    else {
  659|     72|        if (tw > (INT_MAX + w)) {
  ------------------
  |  Branch (659:13): [True: 0, False: 72]
  ------------------
  660|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s", "unsupported tile size (too wide)");
  661|      0|            return (0);
  662|      0|        }
  663|     72|        y = 0;
  664|     72|        toskew = -(int32_t)(tw - w);
  665|     72|    }
  666|       |     
  667|       |    /*
  668|       |     *	Leftmost tile is clipped on left side if col_offset > 0.
  669|       |     */
  670|  10.2k|    leftmost_fromskew = img->col_offset % tw;
  671|  10.2k|    leftmost_tw = tw - leftmost_fromskew;
  672|  10.2k|    leftmost_toskew = toskew + leftmost_fromskew;
  673|   188k|    for (row = 0; ret != 0 && row < h; row += nrow)
  ------------------
  |  Branch (673:19): [True: 185k, False: 2.57k]
  |  Branch (673:31): [True: 178k, False: 7.64k]
  ------------------
  674|   178k|    {
  675|   178k|        rowstoread = th - (row + img->row_offset) % th;
  676|   178k|    	nrow = (row + rowstoread > h ? h - row : rowstoread);
  ------------------
  |  Branch (676:14): [True: 9.10k, False: 168k]
  ------------------
  677|   178k|	fromskew = leftmost_fromskew;
  678|   178k|	this_tw = leftmost_tw;
  679|   178k|	this_toskew = leftmost_toskew;
  680|   178k|	tocol = 0;
  681|   178k|	col = img->col_offset;
  682|  1.30M|	while (tocol < w)
  ------------------
  |  Branch (682:9): [True: 1.12M, False: 175k]
  ------------------
  683|  1.12M|        {
  684|  1.12M|	    if (_TIFFReadTileAndAllocBuffer(tif, (void**) &buf, bufsize, col,
  ------------------
  |  Branch (684:10): [True: 996k, False: 132k]
  ------------------
  685|  1.12M|			     row+img->row_offset, 0, 0)==(tmsize_t)(-1) &&
  686|  1.12M|                (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (686:18): [True: 2.57k, False: 994k]
  |  Branch (686:33): [True: 0, False: 994k]
  ------------------
  687|  2.57k|            {
  688|  2.57k|                ret = 0;
  689|  2.57k|                break;
  690|  2.57k|            }
  691|  1.12M|            pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif) + \
  692|  1.12M|		   ((tmsize_t) fromskew * img->samplesperpixel);
  693|  1.12M|	    if (tocol + this_tw > w) 
  ------------------
  |  Branch (693:10): [True: 119k, False: 1.00M]
  ------------------
  694|   119k|	    {
  695|       |		/*
  696|       |		 * Rightmost tile is clipped on right side.
  697|       |		 */
  698|   119k|		fromskew = tw - (w - tocol);
  699|   119k|		this_tw = tw - fromskew;
  700|   119k|		this_toskew = toskew + fromskew;
  701|   119k|	    }
  702|  1.12M|	    tmsize_t roffset = (tmsize_t) y * w + tocol;
  703|  1.12M|	    (*put)(img, raster + roffset, tocol, y, this_tw, nrow, fromskew, this_toskew, buf + pos);
  704|  1.12M|	    tocol += this_tw;
  705|  1.12M|	    col += this_tw;
  706|       |	    /*
  707|       |	     * After the leftmost tile, tiles are no longer clipped on left side.
  708|       |	     */
  709|  1.12M|	    fromskew = 0;
  710|  1.12M|	    this_tw = tw;
  711|  1.12M|	    this_toskew = toskew;
  712|  1.12M|	}
  713|       |
  714|   178k|        y += ((flip & FLIP_VERTICALLY) ? -(int32_t) nrow : (int32_t) nrow);
  ------------------
  |  |   49|   178k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (714:15): [True: 175k, False: 2.14k]
  ------------------
  715|   178k|    }
  716|  10.2k|    _TIFFfree(buf);
  717|       |
  718|  10.2k|    if (flip & FLIP_HORIZONTALLY) {
  ------------------
  |  |   50|  10.2k|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (718:9): [True: 79, False: 10.1k]
  ------------------
  719|     79|	    uint32_t line;
  720|       |
  721|   223k|	    for (line = 0; line < h; line++) {
  ------------------
  |  Branch (721:21): [True: 223k, False: 79]
  ------------------
  722|   223k|		    uint32_t *left = raster + (line * w);
  723|   223k|		    uint32_t *right = left + w - 1;
  724|       |		    
  725|   219M|		    while ( left < right ) {
  ------------------
  |  Branch (725:15): [True: 219M, False: 223k]
  ------------------
  726|   219M|			    uint32_t temp = *left;
  727|   219M|			    *left = *right;
  728|   219M|			    *right = temp;
  729|   219M|			    left++;
  730|   219M|				right--;
  731|   219M|		    }
  732|   223k|	    }
  733|     79|    }
  734|       |
  735|  10.2k|    return (ret);
  736|  10.2k|}
tif_getimage.c:setorientation:
  557|  11.1k|{
  558|  11.1k|	switch (img->orientation) {
  559|  10.9k|		case ORIENTATION_TOPLEFT:
  ------------------
  |  |  243|  10.9k|#define	    ORIENTATION_TOPLEFT		1	/* row 0 top, col 0 lhs */
  ------------------
  |  Branch (559:3): [True: 10.9k, False: 219]
  ------------------
  560|  10.9k|		case ORIENTATION_LEFTTOP:
  ------------------
  |  |  247|  10.9k|#define	    ORIENTATION_LEFTTOP		5	/* row 0 lhs, col 0 top */
  ------------------
  |  Branch (560:3): [True: 2, False: 11.1k]
  ------------------
  561|  10.9k|			if (img->req_orientation == ORIENTATION_TOPRIGHT ||
  ------------------
  |  |  244|  21.8k|#define	    ORIENTATION_TOPRIGHT	2	/* row 0 top, col 0 rhs */
  ------------------
  |  Branch (561:8): [True: 0, False: 10.9k]
  ------------------
  562|  10.9k|			    img->req_orientation == ORIENTATION_RIGHTTOP)
  ------------------
  |  |  248|  10.9k|#define	    ORIENTATION_RIGHTTOP	6	/* row 0 rhs, col 0 top */
  ------------------
  |  Branch (562:8): [True: 0, False: 10.9k]
  ------------------
  563|      0|				return FLIP_HORIZONTALLY;
  ------------------
  |  |   50|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
  564|  10.9k|			else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
  ------------------
  |  |  245|  21.8k|#define	    ORIENTATION_BOTRIGHT	3	/* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (564:13): [True: 0, False: 10.9k]
  ------------------
  565|  10.9k|			    img->req_orientation == ORIENTATION_RIGHTBOT)
  ------------------
  |  |  249|  10.9k|#define	    ORIENTATION_RIGHTBOT	7	/* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (565:8): [True: 0, False: 10.9k]
  ------------------
  566|      0|				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
              				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   49|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  567|  10.9k|			else if (img->req_orientation == ORIENTATION_BOTLEFT ||
  ------------------
  |  |  246|  21.8k|#define	    ORIENTATION_BOTLEFT		4	/* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (567:13): [True: 10.9k, False: 0]
  ------------------
  568|  10.9k|			    img->req_orientation == ORIENTATION_LEFTBOT)
  ------------------
  |  |  250|      0|#define	    ORIENTATION_LEFTBOT		8	/* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (568:8): [True: 0, False: 0]
  ------------------
  569|  10.9k|				return FLIP_VERTICALLY;
  ------------------
  |  |   49|  10.9k|#define FLIP_VERTICALLY 0x01
  ------------------
  570|      0|			else
  571|      0|				return 0;
  572|     59|		case ORIENTATION_TOPRIGHT:
  ------------------
  |  |  244|     59|#define	    ORIENTATION_TOPRIGHT	2	/* row 0 top, col 0 rhs */
  ------------------
  |  Branch (572:3): [True: 59, False: 11.0k]
  ------------------
  573|     80|		case ORIENTATION_RIGHTTOP:
  ------------------
  |  |  248|     80|#define	    ORIENTATION_RIGHTTOP	6	/* row 0 rhs, col 0 top */
  ------------------
  |  Branch (573:3): [True: 21, False: 11.1k]
  ------------------
  574|     80|			if (img->req_orientation == ORIENTATION_TOPLEFT ||
  ------------------
  |  |  243|    160|#define	    ORIENTATION_TOPLEFT		1	/* row 0 top, col 0 lhs */
  ------------------
  |  Branch (574:8): [True: 0, False: 80]
  ------------------
  575|     80|			    img->req_orientation == ORIENTATION_LEFTTOP)
  ------------------
  |  |  247|     80|#define	    ORIENTATION_LEFTTOP		5	/* row 0 lhs, col 0 top */
  ------------------
  |  Branch (575:8): [True: 0, False: 80]
  ------------------
  576|      0|				return FLIP_HORIZONTALLY;
  ------------------
  |  |   50|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
  577|     80|			else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
  ------------------
  |  |  245|    160|#define	    ORIENTATION_BOTRIGHT	3	/* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (577:13): [True: 0, False: 80]
  ------------------
  578|     80|			    img->req_orientation == ORIENTATION_RIGHTBOT)
  ------------------
  |  |  249|     80|#define	    ORIENTATION_RIGHTBOT	7	/* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (578:8): [True: 0, False: 80]
  ------------------
  579|      0|				return FLIP_VERTICALLY;
  ------------------
  |  |   49|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  580|     80|			else if (img->req_orientation == ORIENTATION_BOTLEFT ||
  ------------------
  |  |  246|    160|#define	    ORIENTATION_BOTLEFT		4	/* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (580:13): [True: 80, False: 0]
  ------------------
  581|     80|			    img->req_orientation == ORIENTATION_LEFTBOT)
  ------------------
  |  |  250|      0|#define	    ORIENTATION_LEFTBOT		8	/* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (581:8): [True: 0, False: 0]
  ------------------
  582|     80|				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|     80|#define FLIP_HORIZONTALLY 0x02
  ------------------
              				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   49|     80|#define FLIP_VERTICALLY 0x01
  ------------------
  583|      0|			else
  584|      0|				return 0;
  585|     99|		case ORIENTATION_BOTRIGHT:
  ------------------
  |  |  245|     99|#define	    ORIENTATION_BOTRIGHT	3	/* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (585:3): [True: 99, False: 11.0k]
  ------------------
  586|    104|		case ORIENTATION_RIGHTBOT:
  ------------------
  |  |  249|    104|#define	    ORIENTATION_RIGHTBOT	7	/* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (586:3): [True: 5, False: 11.1k]
  ------------------
  587|    104|			if (img->req_orientation == ORIENTATION_TOPLEFT ||
  ------------------
  |  |  243|    208|#define	    ORIENTATION_TOPLEFT		1	/* row 0 top, col 0 lhs */
  ------------------
  |  Branch (587:8): [True: 0, False: 104]
  ------------------
  588|    104|			    img->req_orientation == ORIENTATION_LEFTTOP)
  ------------------
  |  |  247|    104|#define	    ORIENTATION_LEFTTOP		5	/* row 0 lhs, col 0 top */
  ------------------
  |  Branch (588:8): [True: 0, False: 104]
  ------------------
  589|      0|				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
              				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   49|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  590|    104|			else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
  ------------------
  |  |  244|    208|#define	    ORIENTATION_TOPRIGHT	2	/* row 0 top, col 0 rhs */
  ------------------
  |  Branch (590:13): [True: 0, False: 104]
  ------------------
  591|    104|			    img->req_orientation == ORIENTATION_RIGHTTOP)
  ------------------
  |  |  248|    104|#define	    ORIENTATION_RIGHTTOP	6	/* row 0 rhs, col 0 top */
  ------------------
  |  Branch (591:8): [True: 0, False: 104]
  ------------------
  592|      0|				return FLIP_VERTICALLY;
  ------------------
  |  |   49|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  593|    104|			else if (img->req_orientation == ORIENTATION_BOTLEFT ||
  ------------------
  |  |  246|    208|#define	    ORIENTATION_BOTLEFT		4	/* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (593:13): [True: 104, False: 0]
  ------------------
  594|    104|			    img->req_orientation == ORIENTATION_LEFTBOT)
  ------------------
  |  |  250|      0|#define	    ORIENTATION_LEFTBOT		8	/* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (594:8): [True: 0, False: 0]
  ------------------
  595|    104|				return FLIP_HORIZONTALLY;
  ------------------
  |  |   50|    104|#define FLIP_HORIZONTALLY 0x02
  ------------------
  596|      0|			else
  597|      0|				return 0;
  598|     31|		case ORIENTATION_BOTLEFT:
  ------------------
  |  |  246|     31|#define	    ORIENTATION_BOTLEFT		4	/* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (598:3): [True: 31, False: 11.1k]
  ------------------
  599|     33|		case ORIENTATION_LEFTBOT:
  ------------------
  |  |  250|     33|#define	    ORIENTATION_LEFTBOT		8	/* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (599:3): [True: 2, False: 11.1k]
  ------------------
  600|     33|			if (img->req_orientation == ORIENTATION_TOPLEFT ||
  ------------------
  |  |  243|     66|#define	    ORIENTATION_TOPLEFT		1	/* row 0 top, col 0 lhs */
  ------------------
  |  Branch (600:8): [True: 0, False: 33]
  ------------------
  601|     33|			    img->req_orientation == ORIENTATION_LEFTTOP)
  ------------------
  |  |  247|     33|#define	    ORIENTATION_LEFTTOP		5	/* row 0 lhs, col 0 top */
  ------------------
  |  Branch (601:8): [True: 0, False: 33]
  ------------------
  602|      0|				return FLIP_VERTICALLY;
  ------------------
  |  |   49|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  603|     33|			else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
  ------------------
  |  |  244|     66|#define	    ORIENTATION_TOPRIGHT	2	/* row 0 top, col 0 rhs */
  ------------------
  |  Branch (603:13): [True: 0, False: 33]
  ------------------
  604|     33|			    img->req_orientation == ORIENTATION_RIGHTTOP)
  ------------------
  |  |  248|     33|#define	    ORIENTATION_RIGHTTOP	6	/* row 0 rhs, col 0 top */
  ------------------
  |  Branch (604:8): [True: 0, False: 33]
  ------------------
  605|      0|				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
              				return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   49|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  606|     33|			else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
  ------------------
  |  |  245|     66|#define	    ORIENTATION_BOTRIGHT	3	/* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (606:13): [True: 0, False: 33]
  ------------------
  607|     33|			    img->req_orientation == ORIENTATION_RIGHTBOT)
  ------------------
  |  |  249|     33|#define	    ORIENTATION_RIGHTBOT	7	/* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (607:8): [True: 0, False: 33]
  ------------------
  608|      0|				return FLIP_HORIZONTALLY;
  ------------------
  |  |   50|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
  609|     33|			else
  610|     33|				return 0;
  611|      0|		default:	/* NOTREACHED */
  ------------------
  |  Branch (611:3): [True: 0, False: 11.1k]
  ------------------
  612|      0|			return 0;
  613|  11.1k|	}
  614|  11.1k|}
tif_getimage.c:putRGBAAcontig8bittile:
 1483|    699|{
 1484|    699|    int samplesperpixel = img->samplesperpixel;
 1485|       |
 1486|    699|    (void) x; (void) y;
 1487|    699|    fromskew *= samplesperpixel;
 1488|  8.95k|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1488:12): [True: 8.25k, False: 699]
  ------------------
 1489|  8.25k|	UNROLL8(w, NOP,
  ------------------
  |  | 1214|  8.25k|#define	UNROLL8(w, op1, op2) {		\
  |  | 1215|  8.25k|    uint32_t _x;				\
  |  | 1216|   203k|    for (_x = w; _x >= 8; _x -= 8) {	\
  |  |  ------------------
  |  |  |  Branch (1216:18): [True: 195k, False: 8.25k]
  |  |  ------------------
  |  | 1217|   195k|	op1;				\
  |  | 1218|   195k|	REPEAT8(op2);			\
  |  |  ------------------
  |  |  |  | 1198|   195k|#define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|   195k|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|   195k|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|   195k|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|   195k|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|   195k|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|   195k|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1219|   195k|    }					\
  |  | 1220|  8.25k|    if (_x > 0) {			\
  |  |  ------------------
  |  |  |  Branch (1220:9): [True: 6.83k, False: 1.41k]
  |  |  ------------------
  |  | 1221|  6.83k|	op1;				\
  |  | 1222|  6.83k|	CASE8(_x,op2);			\
  |  |  ------------------
  |  |  |  | 1202|  6.83k|    switch (x) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1202:13): [True: 0, False: 6.83k]
  |  |  |  |  ------------------
  |  |  |  | 1203|    711|    case 7: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1203:5): [True: 711, False: 6.12k]
  |  |  |  |  ------------------
  |  |  |  | 1204|  1.44k|    case 6: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1204:5): [True: 729, False: 6.11k]
  |  |  |  |  ------------------
  |  |  |  | 1205|  2.13k|    case 5: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1205:5): [True: 691, False: 6.14k]
  |  |  |  |  ------------------
  |  |  |  | 1206|  3.02k|    case 4: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1206:5): [True: 894, False: 5.94k]
  |  |  |  |  ------------------
  |  |  |  | 1207|  3.84k|    case 3: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1207:5): [True: 815, False: 6.02k]
  |  |  |  |  ------------------
  |  |  |  | 1208|  4.82k|    case 2: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1208:5): [True: 989, False: 5.85k]
  |  |  |  |  ------------------
  |  |  |  | 1209|  6.83k|    case 1: op;				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1209:5): [True: 2.01k, False: 4.82k]
  |  |  |  |  ------------------
  |  |  |  | 1210|  6.83k|    }
  |  |  ------------------
  |  | 1223|  6.83k|    }					\
  |  | 1224|  8.25k|}
  ------------------
 1490|  8.25k|	    *cp++ = PACK4(pp[0], pp[1], pp[2], pp[3]);
 1491|  8.25k|	    pp += samplesperpixel);
 1492|  8.25k|	cp += toskew;
 1493|  8.25k|	pp += fromskew;
 1494|  8.25k|    }
 1495|    699|}
tif_getimage.c:BuildMapUaToAa:
 2825|     64|{
 2826|     64|	static const char module[]="BuildMapUaToAa";
 2827|     64|	uint8_t* m;
 2828|     64|	uint16_t na,nv;
 2829|     64|	assert(img->UaToAa==NULL);
 2830|     64|	img->UaToAa=_TIFFmalloc(65536);
 2831|     64|	if (img->UaToAa==NULL)
  ------------------
  |  Branch (2831:6): [True: 0, False: 64]
  ------------------
 2832|      0|	{
 2833|      0|		TIFFErrorExtR(img->tif,module,"Out of memory");
 2834|      0|		return(0);
 2835|      0|	}
 2836|     64|	m=img->UaToAa;
 2837|  16.4k|	for (na=0; na<256; na++)
  ------------------
  |  Branch (2837:13): [True: 16.3k, False: 64]
  ------------------
 2838|  16.3k|	{
 2839|  4.21M|		for (nv=0; nv<256; nv++)
  ------------------
  |  Branch (2839:14): [True: 4.19M, False: 16.3k]
  ------------------
 2840|  4.19M|			*m++=(uint8_t)((nv * na + 127) / 255);
 2841|  16.3k|	}
 2842|     64|	return(1);
 2843|     64|}
tif_getimage.c:putRGBUAcontig8bittile:
 1502|    265|{
 1503|    265|	int samplesperpixel = img->samplesperpixel;
 1504|    265|	(void) y;
 1505|    265|	fromskew *= samplesperpixel;
 1506|    854|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1506:9): [True: 589, False: 265]
  ------------------
 1507|    589|		uint32_t r, g, b, a;
 1508|    589|		uint8_t* m;
 1509|  37.9k|		for (x = w; x > 0; --x) {
  ------------------
  |  Branch (1509:15): [True: 37.3k, False: 589]
  ------------------
 1510|  37.3k|			a = pp[3];
 1511|  37.3k|			m = img->UaToAa+((size_t) a<<8);
 1512|  37.3k|			r = m[pp[0]];
 1513|  37.3k|			g = m[pp[1]];
 1514|  37.3k|			b = m[pp[2]];
 1515|  37.3k|			*cp++ = PACK4(r,g,b,a);
  ------------------
  |  | 1255|  37.3k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|((uint32_t)(a)<<24))
  ------------------
 1516|  37.3k|			pp += samplesperpixel;
 1517|  37.3k|		}
 1518|    589|		cp += toskew;
 1519|    589|		pp += fromskew;
 1520|    589|	}
 1521|    265|}
tif_getimage.c:putRGBcontig8bittile:
 1464|  45.6k|{
 1465|  45.6k|    int samplesperpixel = img->samplesperpixel;
 1466|       |
 1467|  45.6k|    (void) x; (void) y;
 1468|  45.6k|    fromskew *= samplesperpixel;
 1469|  13.4M|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1469:12): [True: 13.3M, False: 45.6k]
  ------------------
 1470|  13.3M|	UNROLL8(w, NOP,
  ------------------
  |  | 1214|  13.3M|#define	UNROLL8(w, op1, op2) {		\
  |  | 1215|  13.3M|    uint32_t _x;				\
  |  | 1216|   290M|    for (_x = w; _x >= 8; _x -= 8) {	\
  |  |  ------------------
  |  |  |  Branch (1216:18): [True: 277M, False: 13.3M]
  |  |  ------------------
  |  | 1217|   277M|	op1;				\
  |  | 1218|   277M|	REPEAT8(op2);			\
  |  |  ------------------
  |  |  |  | 1198|   277M|#define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|   277M|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|   277M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|   277M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|   277M|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|   277M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|   277M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1219|   277M|    }					\
  |  | 1220|  13.3M|    if (_x > 0) {			\
  |  |  ------------------
  |  |  |  Branch (1220:9): [True: 12.9M, False: 476k]
  |  |  ------------------
  |  | 1221|  12.9M|	op1;				\
  |  | 1222|  12.9M|	CASE8(_x,op2);			\
  |  |  ------------------
  |  |  |  | 1202|  12.9M|    switch (x) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1202:13): [True: 0, False: 12.9M]
  |  |  |  |  ------------------
  |  |  |  | 1203|   354k|    case 7: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1203:5): [True: 354k, False: 12.5M]
  |  |  |  |  ------------------
  |  |  |  | 1204|  6.40M|    case 6: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1204:5): [True: 6.05M, False: 6.85M]
  |  |  |  |  ------------------
  |  |  |  | 1205|  7.70M|    case 5: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1205:5): [True: 1.29M, False: 11.6M]
  |  |  |  |  ------------------
  |  |  |  | 1206|  7.96M|    case 4: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1206:5): [True: 256k, False: 12.6M]
  |  |  |  |  ------------------
  |  |  |  | 1207|  12.0M|    case 3: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1207:5): [True: 4.11M, False: 8.79M]
  |  |  |  |  ------------------
  |  |  |  | 1208|  12.2M|    case 2: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1208:5): [True: 175k, False: 12.7M]
  |  |  |  |  ------------------
  |  |  |  | 1209|  12.9M|    case 1: op;				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1209:5): [True: 656k, False: 12.2M]
  |  |  |  |  ------------------
  |  |  |  | 1210|  12.9M|    }
  |  |  ------------------
  |  | 1223|  12.9M|    }					\
  |  | 1224|  13.3M|}
  ------------------
 1471|  13.3M|	    *cp++ = PACK(pp[0], pp[1], pp[2]);
 1472|  13.3M|	    pp += samplesperpixel);
 1473|  13.3M|	cp += toskew;
 1474|  13.3M|	pp += fromskew;
 1475|  13.3M|    }
 1476|  45.6k|}
tif_getimage.c:BuildMapBitdepth16To8:
 2847|    121|{
 2848|    121|	static const char module[]="BuildMapBitdepth16To8";
 2849|    121|	uint8_t* m;
 2850|    121|	uint32_t n;
 2851|    121|	assert(img->Bitdepth16To8==NULL);
 2852|    121|	img->Bitdepth16To8=_TIFFmalloc(65536);
 2853|    121|	if (img->Bitdepth16To8==NULL)
  ------------------
  |  Branch (2853:6): [True: 0, False: 121]
  ------------------
 2854|      0|	{
 2855|      0|		TIFFErrorExtR(img->tif,module,"Out of memory");
 2856|      0|		return(0);
 2857|      0|	}
 2858|    121|	m=img->Bitdepth16To8;
 2859|  7.92M|	for (n=0; n<65536; n++)
  ------------------
  |  Branch (2859:12): [True: 7.92M, False: 121]
  ------------------
 2860|  7.92M|		*m++=(uint8_t)((n + 128) / 257);
 2861|    121|	return(1);
 2862|    121|}
tif_getimage.c:putRGBAAcontig16bittile:
 1549|    301|{
 1550|    301|	int samplesperpixel = img->samplesperpixel;
 1551|    301|	uint16_t *wp = (uint16_t *)pp;
 1552|    301|	(void) y;
 1553|    301|	fromskew *= samplesperpixel;
 1554|  6.46k|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1554:9): [True: 6.15k, False: 301]
  ------------------
 1555|   124k|		for (x = w; x > 0; --x) {
  ------------------
  |  Branch (1555:15): [True: 117k, False: 6.15k]
  ------------------
 1556|   117k|			*cp++ = PACK4(img->Bitdepth16To8[wp[0]],
  ------------------
  |  | 1255|   117k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|((uint32_t)(a)<<24))
  ------------------
 1557|   117k|			    img->Bitdepth16To8[wp[1]],
 1558|   117k|			    img->Bitdepth16To8[wp[2]],
 1559|   117k|			    img->Bitdepth16To8[wp[3]]);
 1560|   117k|			wp += samplesperpixel;
 1561|   117k|		}
 1562|  6.15k|		cp += toskew;
 1563|  6.15k|		wp += fromskew;
 1564|  6.15k|	}
 1565|    301|}
tif_getimage.c:putRGBUAcontig16bittile:
 1572|    139|{
 1573|    139|	int samplesperpixel = img->samplesperpixel;
 1574|    139|	uint16_t *wp = (uint16_t *)pp;
 1575|    139|	(void) y;
 1576|    139|	fromskew *= samplesperpixel;
 1577|    415|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1577:9): [True: 276, False: 139]
  ------------------
 1578|    276|		uint32_t r,g,b,a;
 1579|    276|		uint8_t* m;
 1580|  17.9k|		for (x = w; x > 0; --x) {
  ------------------
  |  Branch (1580:15): [True: 17.6k, False: 276]
  ------------------
 1581|  17.6k|			a = img->Bitdepth16To8[wp[3]];
 1582|  17.6k|			m = img->UaToAa+((size_t) a<<8);
 1583|  17.6k|			r = m[img->Bitdepth16To8[wp[0]]];
 1584|  17.6k|			g = m[img->Bitdepth16To8[wp[1]]];
 1585|  17.6k|			b = m[img->Bitdepth16To8[wp[2]]];
 1586|  17.6k|			*cp++ = PACK4(r,g,b,a);
  ------------------
  |  | 1255|  17.6k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|((uint32_t)(a)<<24))
  ------------------
 1587|  17.6k|			wp += samplesperpixel;
 1588|  17.6k|		}
 1589|    276|		cp += toskew;
 1590|    276|		wp += fromskew;
 1591|    276|	}
 1592|    139|}
tif_getimage.c:putRGBcontig16bittile:
 1527|    519|{
 1528|    519|	int samplesperpixel = img->samplesperpixel;
 1529|    519|	uint16_t *wp = (uint16_t *)pp;
 1530|    519|	(void) y;
 1531|    519|	fromskew *= samplesperpixel;
 1532|  4.15k|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1532:9): [True: 3.63k, False: 519]
  ------------------
 1533|   167k|		for (x = w; x > 0; --x) {
  ------------------
  |  Branch (1533:15): [True: 163k, False: 3.63k]
  ------------------
 1534|   163k|			*cp++ = PACK(img->Bitdepth16To8[wp[0]],
  ------------------
  |  | 1253|   163k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  ------------------
  |  |  |  | 1251|   163k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  ------------------
  ------------------
 1535|   163k|			    img->Bitdepth16To8[wp[1]],
 1536|   163k|			    img->Bitdepth16To8[wp[2]]);
 1537|   163k|			wp += samplesperpixel;
 1538|   163k|		}
 1539|  3.63k|		cp += toskew;
 1540|  3.63k|		wp += fromskew;
 1541|  3.63k|	}
 1542|    519|}
tif_getimage.c:buildMap:
 2563|  7.63k|{
 2564|  7.63k|    switch (img->photometric) {
  ------------------
  |  Branch (2564:13): [True: 135, False: 7.49k]
  ------------------
 2565|      0|    case PHOTOMETRIC_RGB:
  ------------------
  |  |  217|      0|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  |  Branch (2565:5): [True: 0, False: 7.63k]
  ------------------
 2566|      0|    case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  221|      0|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (2566:5): [True: 0, False: 7.63k]
  ------------------
 2567|     59|    case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  220|     59|#define	    PHOTOMETRIC_SEPARATED	5	/* !color separations */
  ------------------
  |  Branch (2567:5): [True: 59, False: 7.57k]
  ------------------
 2568|     59|	if (img->bitspersample == 8)
  ------------------
  |  Branch (2568:6): [True: 55, False: 4]
  ------------------
 2569|     55|	    break;
 2570|       |	/* fall through... */
 2571|  5.45k|    case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  216|  5.45k|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  |  Branch (2571:5): [True: 5.45k, False: 2.18k]
  ------------------
 2572|  7.38k|    case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  215|  7.38k|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  |  Branch (2572:5): [True: 1.93k, False: 5.70k]
  ------------------
 2573|  7.38k|	if (!setupMap(img))
  ------------------
  |  Branch (2573:6): [True: 0, False: 7.38k]
  ------------------
 2574|      0|	    return (0);
 2575|  7.38k|	break;
 2576|  7.38k|    case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  218|     54|#define	    PHOTOMETRIC_PALETTE		3	/* color map indexed */
  ------------------
  |  Branch (2576:5): [True: 54, False: 7.57k]
  ------------------
 2577|       |	/*
 2578|       |	 * Convert 16-bit colormap to 8-bit (unless it looks
 2579|       |	 * like an old-style 8-bit colormap).
 2580|       |	 */
 2581|     54|	if (checkcmap(img) == 16)
  ------------------
  |  Branch (2581:6): [True: 41, False: 13]
  ------------------
 2582|     41|	    cvtcmap(img);
 2583|     13|	else
 2584|     13|	    TIFFWarningExtR(img->tif, TIFFFileName(img->tif), "Assuming 8-bit colormap");
 2585|       |	/*
 2586|       |	 * Use mapping table and colormap to construct
 2587|       |	 * unpacking tables for samples < 8 bits.
 2588|       |	 */
 2589|     54|	if (img->bitspersample <= 8 && !makecmap(img))
  ------------------
  |  Branch (2589:6): [True: 54, False: 0]
  |  Branch (2589:33): [True: 0, False: 54]
  ------------------
 2590|      0|	    return (0);
 2591|     54|	break;
 2592|  7.63k|    }
 2593|  7.63k|    return (1);
 2594|  7.63k|}
tif_getimage.c:setupMap:
 2429|  7.38k|{
 2430|  7.38k|    int32_t x, range;
 2431|       |
 2432|  7.38k|    range = (int32_t)((1L << img->bitspersample) - 1);
 2433|       |    
 2434|       |    /* treat 16 bit the same as eight bit */
 2435|  7.38k|    if( img->bitspersample == 16 )
  ------------------
  |  Branch (2435:9): [True: 248, False: 7.14k]
  ------------------
 2436|    248|        range = (int32_t) 255;
 2437|       |
 2438|  7.38k|    img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
 2439|  7.38k|    if (img->Map == NULL) {
  ------------------
  |  Branch (2439:9): [True: 0, False: 7.38k]
  ------------------
 2440|      0|		TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
 2441|      0|			"No space for photometric conversion table");
 2442|      0|		return (0);
 2443|      0|    }
 2444|  7.38k|    if (img->photometric == PHOTOMETRIC_MINISWHITE) {
  ------------------
  |  |  215|  7.38k|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  |  Branch (2444:9): [True: 1.93k, False: 5.45k]
  ------------------
 2445|  8.60k|	for (x = 0; x <= range; x++)
  ------------------
  |  Branch (2445:14): [True: 6.67k, False: 1.93k]
  ------------------
 2446|  6.67k|	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
 2447|  5.45k|    } else {
 2448|   917k|	for (x = 0; x <= range; x++)
  ------------------
  |  Branch (2448:14): [True: 912k, False: 5.45k]
  ------------------
 2449|   912k|	    img->Map[x] = (TIFFRGBValue) ((x * 255) / range);
 2450|  5.45k|    }
 2451|  7.38k|    if (img->bitspersample <= 16 &&
  ------------------
  |  Branch (2451:9): [True: 7.38k, False: 0]
  ------------------
 2452|  7.38k|	(img->photometric == PHOTOMETRIC_MINISBLACK ||
  ------------------
  |  |  216|  14.7k|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  |  Branch (2452:3): [True: 5.45k, False: 1.93k]
  ------------------
 2453|  7.38k|	 img->photometric == PHOTOMETRIC_MINISWHITE)) {
  ------------------
  |  |  215|  1.93k|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  |  Branch (2453:3): [True: 1.93k, False: 4]
  ------------------
 2454|       |	/*
 2455|       |	 * Use photometric mapping table to construct
 2456|       |	 * unpacking tables for samples <= 8 bits.
 2457|       |	 */
 2458|  7.38k|	if (!makebwmap(img))
  ------------------
  |  Branch (2458:6): [True: 0, False: 7.38k]
  ------------------
 2459|      0|	    return (0);
 2460|       |	/* no longer need Map, free it */
 2461|  7.38k|	_TIFFfree(img->Map);
 2462|  7.38k|	img->Map = NULL;
 2463|  7.38k|    }
 2464|  7.38k|    return (1);
 2465|  7.38k|}
tif_getimage.c:makebwmap:
 2370|  7.38k|{
 2371|  7.38k|    TIFFRGBValue* Map = img->Map;
 2372|  7.38k|    int bitspersample = img->bitspersample;
 2373|  7.38k|    int nsamples = 8 / bitspersample;
 2374|  7.38k|    int i;
 2375|  7.38k|    uint32_t* p;
 2376|       |
 2377|  7.38k|    if( nsamples == 0 )
  ------------------
  |  Branch (2377:9): [True: 248, False: 7.13k]
  ------------------
 2378|    248|        nsamples = 1;
 2379|       |
 2380|  7.38k|    img->BWmap = (uint32_t**) _TIFFmalloc(
 2381|  7.38k|	256*sizeof (uint32_t *) + (256 * nsamples * sizeof(uint32_t)));
 2382|  7.38k|    if (img->BWmap == NULL) {
  ------------------
  |  Branch (2382:9): [True: 0, False: 7.38k]
  ------------------
 2383|      0|		TIFFErrorExtR(img->tif, TIFFFileName(img->tif), "No space for B&W mapping table");
 2384|      0|		return (0);
 2385|      0|    }
 2386|  7.38k|    p = (uint32_t*)(img->BWmap + 256);
 2387|  1.89M|    for (i = 0; i < 256; i++) {
  ------------------
  |  Branch (2387:17): [True: 1.89M, False: 7.38k]
  ------------------
 2388|  1.89M|	TIFFRGBValue c;
 2389|  1.89M|	img->BWmap[i] = p;
 2390|  1.89M|	switch (bitspersample) {
  ------------------
  |  Branch (2390:10): [True: 0, False: 1.89M]
  ------------------
 2391|      0|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
 2392|   936k|	case 1:
  ------------------
  |  Branch (2392:2): [True: 936k, False: 953k]
  ------------------
 2393|   936k|	    GREY(i>>7);
  ------------------
  |  | 2391|   936k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|   936k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   936k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2394|   936k|	    GREY((i>>6)&1);
  ------------------
  |  | 2391|   936k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|   936k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   936k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2395|   936k|	    GREY((i>>5)&1);
  ------------------
  |  | 2391|   936k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|   936k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   936k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2396|   936k|	    GREY((i>>4)&1);
  ------------------
  |  | 2391|   936k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|   936k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   936k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2397|   936k|	    GREY((i>>3)&1);
  ------------------
  |  | 2391|   936k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|   936k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   936k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2398|   936k|	    GREY((i>>2)&1);
  ------------------
  |  | 2391|   936k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|   936k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   936k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2399|   936k|	    GREY((i>>1)&1);
  ------------------
  |  | 2391|   936k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|   936k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   936k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2400|   936k|	    GREY(i&1);
  ------------------
  |  | 2391|   936k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|   936k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   936k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2401|   936k|	    break;
 2402|  34.0k|	case 2:
  ------------------
  |  Branch (2402:2): [True: 34.0k, False: 1.85M]
  ------------------
 2403|  34.0k|	    GREY(i>>6);
  ------------------
  |  | 2391|  34.0k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|  34.0k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  34.0k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2404|  34.0k|	    GREY((i>>4)&3);
  ------------------
  |  | 2391|  34.0k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|  34.0k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  34.0k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2405|  34.0k|	    GREY((i>>2)&3);
  ------------------
  |  | 2391|  34.0k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|  34.0k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  34.0k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2406|  34.0k|	    GREY(i&3);
  ------------------
  |  | 2391|  34.0k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|  34.0k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  34.0k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2407|  34.0k|	    break;
 2408|  8.96k|	case 4:
  ------------------
  |  Branch (2408:2): [True: 8.96k, False: 1.88M]
  ------------------
 2409|  8.96k|	    GREY(i>>4);
  ------------------
  |  | 2391|  8.96k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|  8.96k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  8.96k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2410|  8.96k|	    GREY(i&0xf);
  ------------------
  |  | 2391|  8.96k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|  8.96k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  8.96k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2411|  8.96k|	    break;
 2412|   847k|	case 8:
  ------------------
  |  Branch (2412:2): [True: 847k, False: 1.04M]
  ------------------
 2413|   910k|        case 16:
  ------------------
  |  Branch (2413:9): [True: 63.4k, False: 1.82M]
  ------------------
 2414|   910k|	    GREY(i);
  ------------------
  |  | 2391|   910k|#define	GREY(x)	c = Map[x]; *p++ = PACK(c,c,c);
  |  |  ------------------
  |  |  |  | 1253|   910k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   910k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2415|   910k|	    break;
 2416|  1.89M|	}
 2417|  1.89M|#undef	GREY
 2418|  1.89M|    }
 2419|  7.38k|    return (1);
 2420|  7.38k|}
tif_getimage.c:checkcmap:
 2469|     54|{
 2470|     54|    uint16_t* r = img->redcmap;
 2471|     54|    uint16_t* g = img->greencmap;
 2472|     54|    uint16_t* b = img->bluecmap;
 2473|     54|    long n = 1L<<img->bitspersample;
 2474|       |
 2475|  3.34k|    while (n-- > 0)
  ------------------
  |  Branch (2475:12): [True: 3.33k, False: 13]
  ------------------
 2476|  3.33k|	if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
  ------------------
  |  Branch (2476:6): [True: 33, False: 3.29k]
  |  Branch (2476:21): [True: 4, False: 3.29k]
  |  Branch (2476:36): [True: 4, False: 3.29k]
  ------------------
 2477|     41|	    return (16);
 2478|     13|    return (8);
 2479|     54|}
tif_getimage.c:cvtcmap:
 2483|     41|{
 2484|     41|    uint16_t* r = img->redcmap;
 2485|     41|    uint16_t* g = img->greencmap;
 2486|     41|    uint16_t* b = img->bluecmap;
 2487|     41|    long i;
 2488|       |
 2489|  2.47k|    for (i = (1L<<img->bitspersample)-1; i >= 0; i--) {
  ------------------
  |  Branch (2489:42): [True: 2.43k, False: 41]
  ------------------
 2490|  2.43k|#define	CVT(x)		((uint16_t)((x)>>8))
 2491|  2.43k|	r[i] = CVT(r[i]);
  ------------------
  |  | 2490|  2.43k|#define	CVT(x)		((uint16_t)((x)>>8))
  ------------------
 2492|  2.43k|	g[i] = CVT(g[i]);
  ------------------
  |  | 2490|  2.43k|#define	CVT(x)		((uint16_t)((x)>>8))
  ------------------
 2493|  2.43k|	b[i] = CVT(b[i]);
  ------------------
  |  | 2490|  2.43k|#define	CVT(x)		((uint16_t)((x)>>8))
  ------------------
 2494|  2.43k|#undef	CVT
 2495|  2.43k|    }
 2496|     41|}
tif_getimage.c:makecmap:
 2507|     54|{
 2508|     54|    int bitspersample = img->bitspersample;
 2509|     54|    int nsamples = 8 / bitspersample;
 2510|     54|    uint16_t* r = img->redcmap;
 2511|     54|    uint16_t* g = img->greencmap;
 2512|     54|    uint16_t* b = img->bluecmap;
 2513|     54|    uint32_t *p;
 2514|     54|    int i;
 2515|       |
 2516|     54|    img->PALmap = (uint32_t**) _TIFFmalloc(
 2517|     54|	256*sizeof (uint32_t *) + (256 * nsamples * sizeof(uint32_t)));
 2518|     54|    if (img->PALmap == NULL) {
  ------------------
  |  Branch (2518:9): [True: 0, False: 54]
  ------------------
 2519|      0|		TIFFErrorExtR(img->tif, TIFFFileName(img->tif), "No space for Palette mapping table");
 2520|      0|		return (0);
 2521|      0|	}
 2522|     54|    p = (uint32_t*)(img->PALmap + 256);
 2523|  13.8k|    for (i = 0; i < 256; i++) {
  ------------------
  |  Branch (2523:17): [True: 13.8k, False: 54]
  ------------------
 2524|  13.8k|	TIFFRGBValue c;
 2525|  13.8k|	img->PALmap[i] = p;
 2526|  13.8k|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
 2527|  13.8k|	switch (bitspersample) {
  ------------------
  |  Branch (2527:10): [True: 0, False: 13.8k]
  ------------------
 2528|      0|	case 1:
  ------------------
  |  Branch (2528:2): [True: 0, False: 13.8k]
  ------------------
 2529|      0|	    CMAP(i>>7);
  ------------------
  |  | 2526|      0|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|      0|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|      0|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2530|      0|	    CMAP((i>>6)&1);
  ------------------
  |  | 2526|      0|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|      0|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|      0|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2531|      0|	    CMAP((i>>5)&1);
  ------------------
  |  | 2526|      0|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|      0|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|      0|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2532|      0|	    CMAP((i>>4)&1);
  ------------------
  |  | 2526|      0|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|      0|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|      0|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2533|      0|	    CMAP((i>>3)&1);
  ------------------
  |  | 2526|      0|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|      0|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|      0|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2534|      0|	    CMAP((i>>2)&1);
  ------------------
  |  | 2526|      0|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|      0|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|      0|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2535|      0|	    CMAP((i>>1)&1);
  ------------------
  |  | 2526|      0|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|      0|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|      0|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2536|      0|	    CMAP(i&1);
  ------------------
  |  | 2526|      0|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|      0|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|      0|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2537|      0|	    break;
 2538|  8.44k|	case 2:
  ------------------
  |  Branch (2538:2): [True: 8.44k, False: 5.37k]
  ------------------
 2539|  8.44k|	    CMAP(i>>6);
  ------------------
  |  | 2526|  8.44k|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|  8.44k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  8.44k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2540|  8.44k|	    CMAP((i>>4)&3);
  ------------------
  |  | 2526|  8.44k|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|  8.44k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  8.44k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2541|  8.44k|	    CMAP((i>>2)&3);
  ------------------
  |  | 2526|  8.44k|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|  8.44k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  8.44k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2542|  8.44k|	    CMAP(i&3);
  ------------------
  |  | 2526|  8.44k|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|  8.44k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  8.44k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2543|  8.44k|	    break;
 2544|      0|	case 4:
  ------------------
  |  Branch (2544:2): [True: 0, False: 13.8k]
  ------------------
 2545|      0|	    CMAP(i>>4);
  ------------------
  |  | 2526|      0|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|      0|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|      0|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2546|      0|	    CMAP(i&0xf);
  ------------------
  |  | 2526|      0|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|      0|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|      0|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2547|      0|	    break;
 2548|  5.37k|	case 8:
  ------------------
  |  Branch (2548:2): [True: 5.37k, False: 8.44k]
  ------------------
 2549|  5.37k|	    CMAP(i);
  ------------------
  |  | 2526|  5.37k|#define	CMAP(x)	c = (TIFFRGBValue) x; *p++ = PACK(r[c]&0xff, g[c]&0xff, b[c]&0xff);
  |  |  ------------------
  |  |  |  | 1253|  5.37k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  5.37k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2550|  5.37k|	    break;
 2551|  13.8k|	}
 2552|  13.8k|#undef CMAP
 2553|  13.8k|    }
 2554|     54|    return (1);
 2555|     54|}
tif_getimage.c:putRGBcontig8bitCMYKtile:
 1600|  88.1k|{
 1601|  88.1k|    int samplesperpixel = img->samplesperpixel;
 1602|  88.1k|    uint16_t r, g, b, k;
 1603|       |
 1604|  88.1k|    (void) x; (void) y;
 1605|  88.1k|    fromskew *= samplesperpixel;
 1606|   308k|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1606:12): [True: 220k, False: 88.1k]
  ------------------
 1607|   220k|	UNROLL8(w, NOP,
  ------------------
  |  | 1214|   220k|#define	UNROLL8(w, op1, op2) {		\
  |  | 1215|   220k|    uint32_t _x;				\
  |  | 1216|  13.7M|    for (_x = w; _x >= 8; _x -= 8) {	\
  |  |  ------------------
  |  |  |  Branch (1216:18): [True: 13.5M, False: 220k]
  |  |  ------------------
  |  | 1217|  13.5M|	op1;				\
  |  | 1218|  13.5M|	REPEAT8(op2);			\
  |  |  ------------------
  |  |  |  | 1198|  13.5M|#define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|  13.5M|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  13.5M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  13.5M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|  13.5M|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  13.5M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  13.5M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1219|  13.5M|    }					\
  |  | 1220|   220k|    if (_x > 0) {			\
  |  |  ------------------
  |  |  |  Branch (1220:9): [True: 220k, False: 366]
  |  |  ------------------
  |  | 1221|   220k|	op1;				\
  |  | 1222|   220k|	CASE8(_x,op2);			\
  |  |  ------------------
  |  |  |  | 1202|   220k|    switch (x) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1202:13): [True: 0, False: 220k]
  |  |  |  |  ------------------
  |  |  |  | 1203|  95.8k|    case 7: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1203:5): [True: 95.8k, False: 124k]
  |  |  |  |  ------------------
  |  |  |  | 1204|  97.6k|    case 6: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1204:5): [True: 1.86k, False: 218k]
  |  |  |  |  ------------------
  |  |  |  | 1205|  97.7k|    case 5: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1205:5): [True: 60, False: 220k]
  |  |  |  |  ------------------
  |  |  |  | 1206|  97.9k|    case 4: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1206:5): [True: 211, False: 219k]
  |  |  |  |  ------------------
  |  |  |  | 1207|   154k|    case 3: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1207:5): [True: 56.8k, False: 163k]
  |  |  |  |  ------------------
  |  |  |  | 1208|   218k|    case 2: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1208:5): [True: 63.9k, False: 156k]
  |  |  |  |  ------------------
  |  |  |  | 1209|   220k|    case 1: op;				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1209:5): [True: 1.39k, False: 218k]
  |  |  |  |  ------------------
  |  |  |  | 1210|   220k|    }
  |  |  ------------------
  |  | 1223|   220k|    }					\
  |  | 1224|   220k|}
  ------------------
 1608|   220k|	    k = 255 - pp[3];
 1609|   220k|	    r = (k*(255-pp[0]))/255;
 1610|   220k|	    g = (k*(255-pp[1]))/255;
 1611|   220k|	    b = (k*(255-pp[2]))/255;
 1612|   220k|	    *cp++ = PACK(r, g, b);
 1613|   220k|	    pp += samplesperpixel);
 1614|   220k|	cp += toskew;
 1615|   220k|	pp += fromskew;
 1616|   220k|    }
 1617|  88.1k|}
tif_getimage.c:put8bitcmaptile:
 1277|    278|{
 1278|    278|    uint32_t** PALmap = img->PALmap;
 1279|    278|    int samplesperpixel = img->samplesperpixel;
 1280|       |
 1281|    278|    (void) y;
 1282|  12.1k|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1282:12): [True: 11.9k, False: 278]
  ------------------
 1283|  6.13M|	for (x = w; x > 0; --x)
  ------------------
  |  Branch (1283:14): [True: 6.12M, False: 11.9k]
  ------------------
 1284|  6.12M|        {
 1285|  6.12M|	    *cp++ = PALmap[*pp][0];
 1286|  6.12M|            pp += samplesperpixel;
 1287|  6.12M|        }
 1288|  11.9k|	cp += toskew;
 1289|  11.9k|	pp += fromskew;
 1290|  11.9k|    }
 1291|    278|}
tif_getimage.c:put2bitcmaptile:
 1314|  9.66k|{
 1315|  9.66k|    uint32_t** PALmap = img->PALmap;
 1316|       |
 1317|  9.66k|    (void) x; (void) y;
 1318|  9.66k|    fromskew /= 4;
 1319|  9.23M|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1319:12): [True: 9.22M, False: 9.66k]
  ------------------
 1320|  9.22M|	uint32_t* bw;
 1321|  9.22M|	UNROLL4(w, bw = PALmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1225|  9.22M|#define	UNROLL4(w, op1, op2) {		\
  |  | 1226|  9.22M|    uint32_t _x;				\
  |  | 1227|  15.7M|    for (_x = w; _x >= 4; _x -= 4) {	\
  |  |  ------------------
  |  |  |  Branch (1227:18): [True: 6.50M, False: 9.22M]
  |  |  ------------------
  |  | 1228|  6.50M|	op1;				\
  |  | 1229|  6.50M|	REPEAT4(op2);			\
  |  |  ------------------
  |  |  |  | 1199|  6.50M|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1200|  6.50M|#define	REPEAT2(op)	op; op
  |  |  |  |  ------------------
  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1200|  6.50M|#define	REPEAT2(op)	op; op
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1230|  6.50M|    }					\
  |  | 1231|  9.22M|    if (_x > 0) {			\
  |  |  ------------------
  |  |  |  Branch (1231:9): [True: 9.22M, False: 7.84k]
  |  |  ------------------
  |  | 1232|  9.22M|	op1;				\
  |  | 1233|  9.22M|	CASE4(_x,op2);			\
  |  |  ------------------
  |  |  |  | 1211|  9.22M|#define	CASE4(x,op)	switch (x) { case 3: op; /*-fallthrough*/ case 2: op; /*-fallthrough*/ case 1: op; }
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1211:29): [True: 0, False: 9.22M]
  |  |  |  |  |  Branch (1211:34): [True: 6.22k, False: 9.21M]
  |  |  |  |  |  Branch (1211:63): [True: 196k, False: 9.02M]
  |  |  |  |  |  Branch (1211:92): [True: 9.01M, False: 202k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1234|  9.22M|    }					\
  |  | 1235|  9.22M|}
  ------------------
 1322|  9.22M|	cp += toskew;
 1323|  9.22M|	pp += fromskew;
 1324|  9.22M|    }
 1325|  9.66k|}
tif_getimage.c:put16bitbwtile:
 1388|  17.4k|{
 1389|  17.4k|    int samplesperpixel = img->samplesperpixel;
 1390|  17.4k|    uint32_t** BWmap = img->BWmap;
 1391|       |
 1392|  17.4k|    (void) y;
 1393|  37.8M|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1393:12): [True: 37.8M, False: 17.4k]
  ------------------
 1394|  37.8M|        uint16_t *wp = (uint16_t *) pp;
 1395|       |
 1396|   156M|	for (x = w; x > 0; --x)
  ------------------
  |  Branch (1396:14): [True: 118M, False: 37.8M]
  ------------------
 1397|   118M|        {
 1398|       |            /* use high order byte of 16bit value */
 1399|       |
 1400|   118M|	    *cp++ = BWmap[*wp >> 8][0];
 1401|   118M|            pp += 2 * samplesperpixel;
 1402|   118M|            wp += samplesperpixel;
 1403|   118M|        }
 1404|  37.8M|	cp += toskew;
 1405|  37.8M|	pp += fromskew;
 1406|  37.8M|    }
 1407|  17.4k|}
tif_getimage.c:putagreytile:
 1368|  2.29k|{
 1369|  2.29k|    int samplesperpixel = img->samplesperpixel;
 1370|  2.29k|    uint32_t** BWmap = img->BWmap;
 1371|       |
 1372|  2.29k|    (void) y;
 1373|  69.2k|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1373:12): [True: 66.9k, False: 2.29k]
  ------------------
 1374|   276M|	for (x = w; x > 0; --x)
  ------------------
  |  Branch (1374:14): [True: 276M, False: 66.9k]
  ------------------
 1375|   276M|        {
 1376|   276M|            *cp++ = BWmap[*pp][0] & ((uint32_t)*(pp + 1) << 24 | ~A1);
  ------------------
  |  | 1251|   276M|#define A1 (((uint32_t)0xffL)<<24)
  ------------------
 1377|   276M|            pp += samplesperpixel;
 1378|   276M|        }
 1379|  66.9k|	cp += toskew;
 1380|  66.9k|	pp += fromskew;
 1381|  66.9k|    }
 1382|  2.29k|}
tif_getimage.c:putgreytile:
 1348|   206k|{
 1349|   206k|    int samplesperpixel = img->samplesperpixel;
 1350|   206k|    uint32_t** BWmap = img->BWmap;
 1351|       |
 1352|   206k|    (void) y;
 1353|  31.1M|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1353:12): [True: 30.9M, False: 206k]
  ------------------
 1354|  5.22G|	for (x = w; x > 0; --x)
  ------------------
  |  Branch (1354:14): [True: 5.19G, False: 30.9M]
  ------------------
 1355|  5.19G|        {
 1356|  5.19G|	    *cp++ = BWmap[*pp][0];
 1357|  5.19G|            pp += samplesperpixel;
 1358|  5.19G|        }
 1359|  30.9M|	cp += toskew;
 1360|  30.9M|	pp += fromskew;
 1361|  30.9M|    }
 1362|   206k|}
tif_getimage.c:put4bitbwtile:
 1447|  1.00k|{
 1448|  1.00k|    uint32_t** BWmap = img->BWmap;
 1449|       |
 1450|  1.00k|    (void) x; (void) y;
 1451|  1.00k|    fromskew /= 2;
 1452|  14.9k|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1452:12): [True: 13.9k, False: 1.00k]
  ------------------
 1453|  13.9k|	uint32_t* bw;
 1454|  13.9k|	UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1236|  13.9k|#define	UNROLL2(w, op1, op2) {		\
  |  | 1237|  13.9k|    uint32_t _x;				\
  |  | 1238|   869k|    for (_x = w; _x >= 2; _x -= 2) {	\
  |  |  ------------------
  |  |  |  Branch (1238:18): [True: 855k, False: 13.9k]
  |  |  ------------------
  |  | 1239|   855k|	op1;				\
  |  | 1240|   855k|	REPEAT2(op2);			\
  |  |  ------------------
  |  |  |  | 1200|   855k|#define	REPEAT2(op)	op; op
  |  |  ------------------
  |  | 1241|   855k|    }					\
  |  | 1242|  13.9k|    if (_x) {				\
  |  |  ------------------
  |  |  |  Branch (1242:9): [True: 12.2k, False: 1.72k]
  |  |  ------------------
  |  | 1243|  12.2k|	op1;				\
  |  | 1244|  12.2k|	op2;				\
  |  | 1245|  12.2k|    }					\
  |  | 1246|  13.9k|}
  ------------------
 1455|  13.9k|	cp += toskew;
 1456|  13.9k|	pp += fromskew;
 1457|  13.9k|    }
 1458|  1.00k|}
tif_getimage.c:put2bitbwtile:
 1430|  7.78k|{
 1431|  7.78k|    uint32_t** BWmap = img->BWmap;
 1432|       |
 1433|  7.78k|    (void) x; (void) y;
 1434|  7.78k|    fromskew /= 4;
 1435|  6.20M|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1435:12): [True: 6.19M, False: 7.78k]
  ------------------
 1436|  6.19M|	uint32_t* bw;
 1437|  6.19M|	UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1225|  6.19M|#define	UNROLL4(w, op1, op2) {		\
  |  | 1226|  6.19M|    uint32_t _x;				\
  |  | 1227|  61.0M|    for (_x = w; _x >= 4; _x -= 4) {	\
  |  |  ------------------
  |  |  |  Branch (1227:18): [True: 54.8M, False: 6.19M]
  |  |  ------------------
  |  | 1228|  54.8M|	op1;				\
  |  | 1229|  54.8M|	REPEAT4(op2);			\
  |  |  ------------------
  |  |  |  | 1199|  54.8M|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1200|  54.8M|#define	REPEAT2(op)	op; op
  |  |  |  |  ------------------
  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1200|  54.8M|#define	REPEAT2(op)	op; op
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1230|  54.8M|    }					\
  |  | 1231|  6.19M|    if (_x > 0) {			\
  |  |  ------------------
  |  |  |  Branch (1231:9): [True: 6.19M, False: 4.54k]
  |  |  ------------------
  |  | 1232|  6.19M|	op1;				\
  |  | 1233|  6.19M|	CASE4(_x,op2);			\
  |  |  ------------------
  |  |  |  | 1211|  6.19M|#define	CASE4(x,op)	switch (x) { case 3: op; /*-fallthrough*/ case 2: op; /*-fallthrough*/ case 1: op; }
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1211:29): [True: 0, False: 6.19M]
  |  |  |  |  |  Branch (1211:34): [True: 4.80M, False: 1.39M]
  |  |  |  |  |  Branch (1211:63): [True: 50.5k, False: 6.14M]
  |  |  |  |  |  Branch (1211:92): [True: 1.33M, False: 4.85M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1234|  6.19M|    }					\
  |  | 1235|  6.19M|}
  ------------------
 1438|  6.19M|	cp += toskew;
 1439|  6.19M|	pp += fromskew;
 1440|  6.19M|    }
 1441|  7.78k|}
tif_getimage.c:put1bitbwtile:
 1413|   693k|{
 1414|   693k|    uint32_t** BWmap = img->BWmap;
 1415|       |
 1416|   693k|    (void) x; (void) y;
 1417|   693k|    fromskew /= 8;
 1418|   460M|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1418:12): [True: 460M, False: 693k]
  ------------------
 1419|   460M|	uint32_t* bw;
 1420|   460M|	UNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1214|   460M|#define	UNROLL8(w, op1, op2) {		\
  |  | 1215|   460M|    uint32_t _x;				\
  |  | 1216|  1.57G|    for (_x = w; _x >= 8; _x -= 8) {	\
  |  |  ------------------
  |  |  |  Branch (1216:18): [True: 1.11G, False: 460M]
  |  |  ------------------
  |  | 1217|  1.11G|	op1;				\
  |  | 1218|  1.11G|	REPEAT8(op2);			\
  |  |  ------------------
  |  |  |  | 1198|  1.11G|#define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|  1.11G|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  1.11G|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  1.11G|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|  1.11G|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  1.11G|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  1.11G|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1219|  1.11G|    }					\
  |  | 1220|   460M|    if (_x > 0) {			\
  |  |  ------------------
  |  |  |  Branch (1220:9): [True: 450M, False: 9.15M]
  |  |  ------------------
  |  | 1221|   450M|	op1;				\
  |  | 1222|   450M|	CASE8(_x,op2);			\
  |  |  ------------------
  |  |  |  | 1202|   450M|    switch (x) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1202:13): [True: 0, False: 450M]
  |  |  |  |  ------------------
  |  |  |  | 1203|  10.2M|    case 7: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1203:5): [True: 10.2M, False: 440M]
  |  |  |  |  ------------------
  |  |  |  | 1204|  15.5M|    case 6: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1204:5): [True: 5.33M, False: 445M]
  |  |  |  |  ------------------
  |  |  |  | 1205|  19.6M|    case 5: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1205:5): [True: 4.09M, False: 446M]
  |  |  |  |  ------------------
  |  |  |  | 1206|  40.4M|    case 4: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1206:5): [True: 20.7M, False: 430M]
  |  |  |  |  ------------------
  |  |  |  | 1207|  56.7M|    case 3: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1207:5): [True: 16.3M, False: 434M]
  |  |  |  |  ------------------
  |  |  |  | 1208|  66.3M|    case 2: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1208:5): [True: 9.55M, False: 441M]
  |  |  |  |  ------------------
  |  |  |  | 1209|   450M|    case 1: op;				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1209:5): [True: 384M, False: 66.3M]
  |  |  |  |  ------------------
  |  |  |  | 1210|   450M|    }
  |  |  ------------------
  |  | 1223|   450M|    }					\
  |  | 1224|   460M|}
  ------------------
 1421|   460M|	cp += toskew;
 1422|   460M|	pp += fromskew;
 1423|   460M|    }
 1424|   693k|}
tif_getimage.c:initYCbCrConversion:
 2266|  2.13k|{
 2267|  2.13k|	static const char module[] = "initYCbCrConversion";
 2268|       |
 2269|  2.13k|	float *luma, *refBlackWhite;
 2270|       |
 2271|  2.13k|	if (img->ycbcr == NULL) {
  ------------------
  |  Branch (2271:6): [True: 2.13k, False: 0]
  ------------------
 2272|  2.13k|		img->ycbcr = (TIFFYCbCrToRGB*) _TIFFmalloc(
 2273|  2.13k|		    TIFFroundup_32(sizeof (TIFFYCbCrToRGB), sizeof (long))  
  ------------------
  |  |  250|  2.13k|#define TIFFroundup_32(x, y) (TIFFhowmany_32(x,y)*(y))
  |  |  ------------------
  |  |  |  |  242|  2.13k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (242:31): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  243|  2.13k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  |  |  244|  2.13k|			   0U)
  |  |  ------------------
  ------------------
 2274|  2.13k|		    + 4*256*sizeof (TIFFRGBValue)
 2275|  2.13k|		    + 2*256*sizeof (int)
 2276|  2.13k|		    + 3*256*sizeof (int32_t)
 2277|  2.13k|		    );
 2278|  2.13k|		if (img->ycbcr == NULL) {
  ------------------
  |  Branch (2278:7): [True: 0, False: 2.13k]
  ------------------
 2279|      0|			TIFFErrorExtR(img->tif, module,
 2280|      0|			    "No space for YCbCr->RGB conversion state");
 2281|      0|			return (0);
 2282|      0|		}
 2283|  2.13k|	}
 2284|       |
 2285|  2.13k|	TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRCOEFFICIENTS, &luma);
  ------------------
  |  |  385|  2.13k|#define	TIFFTAG_YCBCRCOEFFICIENTS	529	/* !RGB -> YCbCr transform */
  ------------------
 2286|  2.13k|	TIFFGetFieldDefaulted(img->tif, TIFFTAG_REFERENCEBLACKWHITE,
  ------------------
  |  |  390|  2.13k|#define	TIFFTAG_REFERENCEBLACKWHITE	532	/* !colorimetry info */
  ------------------
 2287|  2.13k|	    &refBlackWhite);
 2288|       |
 2289|       |        /* Do some validation to avoid later issues. Detect NaN for now */
 2290|       |        /* and also if lumaGreen is zero since we divide by it later */
 2291|  2.13k|        if( luma[0] != luma[0] ||
  ------------------
  |  Branch (2291:13): [True: 1, False: 2.13k]
  ------------------
 2292|  2.13k|            luma[1] != luma[1] ||
  ------------------
  |  Branch (2292:13): [True: 1, False: 2.12k]
  ------------------
 2293|  2.13k|            luma[1] == 0.0 ||
  ------------------
  |  Branch (2293:13): [True: 2, False: 2.12k]
  ------------------
 2294|  2.13k|            luma[2] != luma[2] )
  ------------------
  |  Branch (2294:13): [True: 1, False: 2.12k]
  ------------------
 2295|      5|        {
 2296|      5|            TIFFErrorExtR(img->tif, module,
 2297|      5|                "Invalid values for YCbCrCoefficients tag");
 2298|      5|            return (0);
 2299|      5|        }
 2300|       |
 2301|  2.12k|        if( !isInRefBlackWhiteRange(refBlackWhite[0]) ||
  ------------------
  |  Branch (2301:13): [True: 1, False: 2.12k]
  ------------------
 2302|  2.12k|            !isInRefBlackWhiteRange(refBlackWhite[1]) ||
  ------------------
  |  Branch (2302:13): [True: 1, False: 2.12k]
  ------------------
 2303|  2.12k|            !isInRefBlackWhiteRange(refBlackWhite[2]) ||
  ------------------
  |  Branch (2303:13): [True: 2, False: 2.12k]
  ------------------
 2304|  2.12k|            !isInRefBlackWhiteRange(refBlackWhite[3]) ||
  ------------------
  |  Branch (2304:13): [True: 1, False: 2.12k]
  ------------------
 2305|  2.12k|            !isInRefBlackWhiteRange(refBlackWhite[4]) ||
  ------------------
  |  Branch (2305:13): [True: 1, False: 2.12k]
  ------------------
 2306|  2.12k|            !isInRefBlackWhiteRange(refBlackWhite[5]) )
  ------------------
  |  Branch (2306:13): [True: 1, False: 2.11k]
  ------------------
 2307|      7|        {
 2308|      7|            TIFFErrorExtR(img->tif, module,
 2309|      7|                "Invalid values for ReferenceBlackWhite tag");
 2310|      7|            return (0);
 2311|      7|        }
 2312|       |
 2313|  2.11k|	if (TIFFYCbCrToRGBInit(img->ycbcr, luma, refBlackWhite) < 0)
  ------------------
  |  Branch (2313:6): [True: 0, False: 2.11k]
  ------------------
 2314|      0|		return(0);
 2315|  2.11k|	return (1);
 2316|  2.11k|}
tif_getimage.c:isInRefBlackWhiteRange:
 2260|  12.7k|{
 2261|  12.7k|    return f > (float)(-0x7FFFFFFF + 128) && f < (float)0x7FFFFFFF;
  ------------------
  |  Branch (2261:12): [True: 12.7k, False: 6]
  |  Branch (2261:46): [True: 12.7k, False: 1]
  ------------------
 2262|  12.7k|}
tif_getimage.c:putcontig8bitYCbCr44tile:
 1855|  3.73k|{
 1856|  3.73k|    uint32_t* cp1 = cp + w + toskew;
 1857|  3.73k|    uint32_t* cp2 = cp1 + w + toskew;
 1858|  3.73k|    uint32_t* cp3 = cp2 + w + toskew;
 1859|  3.73k|    int32_t incr = 3 * w + 4 * toskew;
 1860|       |
 1861|  3.73k|    (void) y;
 1862|       |    /* adjust fromskew */
 1863|  3.73k|    fromskew = (fromskew / 4) * (4*2+2);
 1864|  3.73k|    if ((h & 3) == 0 && (w & 3) == 0) {				        
  ------------------
  |  Branch (1864:9): [True: 2.24k, False: 1.48k]
  |  Branch (1864:25): [True: 582, False: 1.66k]
  ------------------
 1865|  2.11k|        for (; h >= 4; h -= 4) {
  ------------------
  |  Branch (1865:16): [True: 1.53k, False: 582]
  ------------------
 1866|  1.53k|            x = w>>2;
 1867|  94.7k|            do {
 1868|  94.7k|                int32_t Cb = pp[16];
 1869|  94.7k|                int32_t Cr = pp[17];
 1870|       |
 1871|  94.7k|                YCbCrtoRGB(cp [0], pp[ 0]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1872|  94.7k|                YCbCrtoRGB(cp [1], pp[ 1]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1873|  94.7k|                YCbCrtoRGB(cp [2], pp[ 2]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1874|  94.7k|                YCbCrtoRGB(cp [3], pp[ 3]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1875|  94.7k|                YCbCrtoRGB(cp1[0], pp[ 4]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1876|  94.7k|                YCbCrtoRGB(cp1[1], pp[ 5]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1877|  94.7k|                YCbCrtoRGB(cp1[2], pp[ 6]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1878|  94.7k|                YCbCrtoRGB(cp1[3], pp[ 7]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1879|  94.7k|                YCbCrtoRGB(cp2[0], pp[ 8]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1880|  94.7k|                YCbCrtoRGB(cp2[1], pp[ 9]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1881|  94.7k|                YCbCrtoRGB(cp2[2], pp[10]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1882|  94.7k|                YCbCrtoRGB(cp2[3], pp[11]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1883|  94.7k|                YCbCrtoRGB(cp3[0], pp[12]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1884|  94.7k|                YCbCrtoRGB(cp3[1], pp[13]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1885|  94.7k|                YCbCrtoRGB(cp3[2], pp[14]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1886|  94.7k|                YCbCrtoRGB(cp3[3], pp[15]);
  ------------------
  |  | 1845|  94.7k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  94.7k|	uint32_t r, g, b;							\
  |  | 1847|  94.7k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  94.7k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  94.7k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  94.7k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  94.7k|}
  ------------------
 1887|       |
 1888|  94.7k|                cp += 4;
 1889|  94.7k|                cp1 += 4;
 1890|  94.7k|                cp2 += 4;
 1891|  94.7k|                cp3 += 4;
 1892|  94.7k|                pp += 18;
 1893|  94.7k|            } while (--x);
  ------------------
  |  Branch (1893:22): [True: 93.1k, False: 1.53k]
  ------------------
 1894|  1.53k|            cp += incr;
 1895|  1.53k|            cp1 += incr;
 1896|  1.53k|            cp2 += incr;
 1897|  1.53k|            cp3 += incr;
 1898|  1.53k|            pp += fromskew;
 1899|  1.53k|        }
 1900|  3.15k|    } else {
 1901|  55.5k|        while (h > 0) {
  ------------------
  |  Branch (1901:16): [True: 55.5k, False: 0]
  ------------------
 1902|  3.10M|            for (x = w; x > 0;) {
  ------------------
  |  Branch (1902:25): [True: 3.05M, False: 55.5k]
  ------------------
 1903|  3.05M|                int32_t Cb = pp[16];
 1904|  3.05M|                int32_t Cr = pp[17];
 1905|  3.05M|                switch (x) {
 1906|  3.03M|                default:
  ------------------
  |  Branch (1906:17): [True: 3.03M, False: 20.7k]
  ------------------
 1907|  3.03M|                    switch (h) {
 1908|  2.67M|                    default: YCbCrtoRGB(cp3[3], pp[15]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.67M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.67M|	uint32_t r, g, b;							\
  |  | 1847|  2.67M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.67M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.67M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.67M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.67M|}
  ------------------
  |  Branch (1908:21): [True: 2.67M, False: 357k]
  ------------------
 1909|  2.75M|                    case 3:  YCbCrtoRGB(cp2[3], pp[11]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.75M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.75M|	uint32_t r, g, b;							\
  |  | 1847|  2.75M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.75M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.75M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.75M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.75M|}
  ------------------
  |  Branch (1909:21): [True: 84.6k, False: 2.94M]
  ------------------
 1910|  2.76M|                    case 2:  YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.76M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.76M|	uint32_t r, g, b;							\
  |  | 1847|  2.76M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.76M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.76M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.76M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.76M|}
  ------------------
  |  Branch (1910:21): [True: 4.15k, False: 3.02M]
  ------------------
 1911|  3.03M|                    case 1:  YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  3.03M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  3.03M|	uint32_t r, g, b;							\
  |  | 1847|  3.03M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  3.03M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  3.03M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  3.03M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  3.03M|}
  ------------------
  |  Branch (1911:21): [True: 268k, False: 2.76M]
  ------------------
 1912|  3.03M|                    }                                    /* FALLTHROUGH */
 1913|  3.03M|                case 3:
  ------------------
  |  Branch (1913:17): [True: 677, False: 3.05M]
  ------------------
 1914|  3.03M|                    switch (h) {
 1915|  2.67M|                    default: YCbCrtoRGB(cp3[2], pp[14]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.67M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.67M|	uint32_t r, g, b;							\
  |  | 1847|  2.67M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.67M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.67M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.67M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.67M|}
  ------------------
  |  Branch (1915:21): [True: 2.67M, False: 357k]
  ------------------
 1916|  2.75M|                    case 3:  YCbCrtoRGB(cp2[2], pp[10]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.75M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.75M|	uint32_t r, g, b;							\
  |  | 1847|  2.75M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.75M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.75M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.75M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.75M|}
  ------------------
  |  Branch (1916:21): [True: 84.6k, False: 2.94M]
  ------------------
 1917|  2.76M|                    case 2:  YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.76M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.76M|	uint32_t r, g, b;							\
  |  | 1847|  2.76M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.76M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.76M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.76M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.76M|}
  ------------------
  |  Branch (1917:21): [True: 4.16k, False: 3.02M]
  ------------------
 1918|  3.03M|                    case 1:  YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  3.03M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  3.03M|	uint32_t r, g, b;							\
  |  | 1847|  3.03M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  3.03M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  3.03M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  3.03M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  3.03M|}
  ------------------
  |  Branch (1918:21): [True: 269k, False: 2.76M]
  ------------------
 1919|  3.03M|                    }                                    /* FALLTHROUGH */
 1920|  3.05M|                case 2:
  ------------------
  |  Branch (1920:17): [True: 19.4k, False: 3.03M]
  ------------------
 1921|  3.05M|                    switch (h) {
 1922|  2.69M|                    default: YCbCrtoRGB(cp3[1], pp[13]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.69M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.69M|	uint32_t r, g, b;							\
  |  | 1847|  2.69M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.69M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.69M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.69M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.69M|}
  ------------------
  |  Branch (1922:21): [True: 2.69M, False: 358k]
  ------------------
 1923|  2.77M|                    case 3:  YCbCrtoRGB(cp2[1], pp[ 9]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.77M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.77M|	uint32_t r, g, b;							\
  |  | 1847|  2.77M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.77M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.77M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.77M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.77M|}
  ------------------
  |  Branch (1923:21): [True: 84.6k, False: 2.96M]
  ------------------
 1924|  2.78M|                    case 2:  YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.78M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.78M|	uint32_t r, g, b;							\
  |  | 1847|  2.78M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.78M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.78M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.78M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.78M|}
  ------------------
  |  Branch (1924:21): [True: 4.44k, False: 3.04M]
  ------------------
 1925|  3.05M|                    case 1:  YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  3.05M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  3.05M|	uint32_t r, g, b;							\
  |  | 1847|  3.05M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  3.05M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  3.05M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  3.05M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  3.05M|}
  ------------------
  |  Branch (1925:21): [True: 269k, False: 2.78M]
  ------------------
 1926|  3.05M|                    }                                    /* FALLTHROUGH */
 1927|  3.05M|                case 1:
  ------------------
  |  Branch (1927:17): [True: 575, False: 3.05M]
  ------------------
 1928|  3.05M|                    switch (h) {
 1929|  2.69M|                    default: YCbCrtoRGB(cp3[0], pp[12]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.69M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.69M|	uint32_t r, g, b;							\
  |  | 1847|  2.69M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.69M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.69M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.69M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.69M|}
  ------------------
  |  Branch (1929:21): [True: 2.69M, False: 358k]
  ------------------
 1930|  2.77M|                    case 3:  YCbCrtoRGB(cp2[0], pp[ 8]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.77M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.77M|	uint32_t r, g, b;							\
  |  | 1847|  2.77M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.77M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.77M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.77M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.77M|}
  ------------------
  |  Branch (1930:21): [True: 84.6k, False: 2.96M]
  ------------------
 1931|  2.78M|                    case 2:  YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  2.78M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.78M|	uint32_t r, g, b;							\
  |  | 1847|  2.78M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.78M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.78M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.78M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.78M|}
  ------------------
  |  Branch (1931:21): [True: 4.45k, False: 3.04M]
  ------------------
 1932|  3.05M|                    case 1:  YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */
  ------------------
  |  | 1845|  3.05M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  3.05M|	uint32_t r, g, b;							\
  |  | 1847|  3.05M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  3.05M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  3.05M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  3.05M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  3.05M|}
  ------------------
  |  Branch (1932:21): [True: 269k, False: 2.78M]
  ------------------
 1933|  3.05M|                    }                                    /* FALLTHROUGH */
 1934|  3.05M|                }
 1935|  3.05M|                if (x < 4) {
  ------------------
  |  Branch (1935:21): [True: 20.7k, False: 3.03M]
  ------------------
 1936|  20.7k|                    cp += x; cp1 += x; cp2 += x; cp3 += x;
 1937|  20.7k|                    x = 0;
 1938|  20.7k|                }
 1939|  3.03M|                else {
 1940|  3.03M|                    cp += 4; cp1 += 4; cp2 += 4; cp3 += 4;
 1941|  3.03M|                    x -= 4;
 1942|  3.03M|                }
 1943|  3.05M|                pp += 18;
 1944|  3.05M|            }
 1945|  55.5k|            if (h <= 4)
  ------------------
  |  Branch (1945:17): [True: 3.15k, False: 52.3k]
  ------------------
 1946|  3.15k|                break;
 1947|  52.3k|            h -= 4;
 1948|  52.3k|            cp += incr;
 1949|  52.3k|            cp1 += incr;
 1950|  52.3k|            cp2 += incr;
 1951|  52.3k|            cp3 += incr;
 1952|  52.3k|            pp += fromskew;
 1953|  52.3k|        }
 1954|  3.15k|    }
 1955|  3.73k|}
tif_getimage.c:putcontig8bitYCbCr42tile:
 1961|  3.32k|{
 1962|  3.32k|    uint32_t* cp1 = cp + w + toskew;
 1963|  3.32k|    int32_t incr = 2 * toskew + w;
 1964|       |
 1965|  3.32k|    (void) y;
 1966|  3.32k|    fromskew = (fromskew / 4) * (4*2+2);
 1967|  3.32k|    if ((w & 3) == 0 && (h & 1) == 0) {
  ------------------
  |  Branch (1967:9): [True: 1.99k, False: 1.32k]
  |  Branch (1967:25): [True: 1.05k, False: 938]
  ------------------
 1968|  9.67k|        for (; h >= 2; h -= 2) {
  ------------------
  |  Branch (1968:16): [True: 8.62k, False: 1.05k]
  ------------------
 1969|  8.62k|            x = w>>2;
 1970|   209k|            do {
 1971|   209k|                int32_t Cb = pp[8];
 1972|   209k|                int32_t Cr = pp[9];
 1973|       |                
 1974|   209k|                YCbCrtoRGB(cp [0], pp[0]);
  ------------------
  |  | 1845|   209k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   209k|	uint32_t r, g, b;							\
  |  | 1847|   209k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   209k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   209k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   209k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   209k|}
  ------------------
 1975|   209k|                YCbCrtoRGB(cp [1], pp[1]);
  ------------------
  |  | 1845|   209k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   209k|	uint32_t r, g, b;							\
  |  | 1847|   209k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   209k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   209k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   209k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   209k|}
  ------------------
 1976|   209k|                YCbCrtoRGB(cp [2], pp[2]);
  ------------------
  |  | 1845|   209k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   209k|	uint32_t r, g, b;							\
  |  | 1847|   209k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   209k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   209k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   209k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   209k|}
  ------------------
 1977|   209k|                YCbCrtoRGB(cp [3], pp[3]);
  ------------------
  |  | 1845|   209k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   209k|	uint32_t r, g, b;							\
  |  | 1847|   209k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   209k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   209k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   209k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   209k|}
  ------------------
 1978|   209k|                YCbCrtoRGB(cp1[0], pp[4]);
  ------------------
  |  | 1845|   209k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   209k|	uint32_t r, g, b;							\
  |  | 1847|   209k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   209k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   209k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   209k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   209k|}
  ------------------
 1979|   209k|                YCbCrtoRGB(cp1[1], pp[5]);
  ------------------
  |  | 1845|   209k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   209k|	uint32_t r, g, b;							\
  |  | 1847|   209k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   209k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   209k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   209k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   209k|}
  ------------------
 1980|   209k|                YCbCrtoRGB(cp1[2], pp[6]);
  ------------------
  |  | 1845|   209k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   209k|	uint32_t r, g, b;							\
  |  | 1847|   209k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   209k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   209k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   209k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   209k|}
  ------------------
 1981|   209k|                YCbCrtoRGB(cp1[3], pp[7]);
  ------------------
  |  | 1845|   209k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   209k|	uint32_t r, g, b;							\
  |  | 1847|   209k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   209k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   209k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   209k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   209k|}
  ------------------
 1982|       |                
 1983|   209k|                cp += 4;
 1984|   209k|                cp1 += 4;
 1985|   209k|                pp += 10;
 1986|   209k|            } while (--x);
  ------------------
  |  Branch (1986:22): [True: 201k, False: 8.62k]
  ------------------
 1987|  8.62k|            cp += incr;
 1988|  8.62k|            cp1 += incr;
 1989|  8.62k|            pp += fromskew;
 1990|  8.62k|        }
 1991|  2.26k|    } else {
 1992|   108k|        while (h > 0) {
  ------------------
  |  Branch (1992:16): [True: 108k, False: 0]
  ------------------
 1993|   742k|            for (x = w; x > 0;) {
  ------------------
  |  Branch (1993:25): [True: 633k, False: 108k]
  ------------------
 1994|   633k|                int32_t Cb = pp[8];
 1995|   633k|                int32_t Cr = pp[9];
 1996|   633k|                switch (x) {
 1997|   534k|                default:
  ------------------
  |  Branch (1997:17): [True: 534k, False: 98.3k]
  ------------------
 1998|   534k|                    switch (h) {
 1999|   515k|                    default: YCbCrtoRGB(cp1[3], pp[ 7]); /* FALLTHROUGH */
  ------------------
  |  | 1845|   515k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   515k|	uint32_t r, g, b;							\
  |  | 1847|   515k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   515k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   515k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   515k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   515k|}
  ------------------
  |  Branch (1999:21): [True: 515k, False: 19.5k]
  ------------------
 2000|   534k|                    case 1:  YCbCrtoRGB(cp [3], pp[ 3]); /* FALLTHROUGH */
  ------------------
  |  | 1845|   534k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   534k|	uint32_t r, g, b;							\
  |  | 1847|   534k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   534k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   534k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   534k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   534k|}
  ------------------
  |  Branch (2000:21): [True: 19.5k, False: 515k]
  ------------------
 2001|   534k|                    }                                    /* FALLTHROUGH */
 2002|   560k|                case 3:
  ------------------
  |  Branch (2002:17): [True: 26.0k, False: 607k]
  ------------------
 2003|   560k|                    switch (h) {
 2004|   541k|                    default: YCbCrtoRGB(cp1[2], pp[ 6]); /* FALLTHROUGH */
  ------------------
  |  | 1845|   541k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   541k|	uint32_t r, g, b;							\
  |  | 1847|   541k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   541k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   541k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   541k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   541k|}
  ------------------
  |  Branch (2004:21): [True: 541k, False: 19.5k]
  ------------------
 2005|   560k|                    case 1:  YCbCrtoRGB(cp [2], pp[ 2]); /* FALLTHROUGH */
  ------------------
  |  | 1845|   560k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   560k|	uint32_t r, g, b;							\
  |  | 1847|   560k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   560k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   560k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   560k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   560k|}
  ------------------
  |  Branch (2005:21): [True: 19.5k, False: 541k]
  ------------------
 2006|   560k|                    }                                    /* FALLTHROUGH */
 2007|   631k|                case 2:
  ------------------
  |  Branch (2007:17): [True: 70.9k, False: 562k]
  ------------------
 2008|   631k|                    switch (h) {
 2009|   612k|                    default: YCbCrtoRGB(cp1[1], pp[ 5]); /* FALLTHROUGH */
  ------------------
  |  | 1845|   612k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   612k|	uint32_t r, g, b;							\
  |  | 1847|   612k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   612k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   612k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   612k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   612k|}
  ------------------
  |  Branch (2009:21): [True: 612k, False: 19.5k]
  ------------------
 2010|   631k|                    case 1:  YCbCrtoRGB(cp [1], pp[ 1]); /* FALLTHROUGH */
  ------------------
  |  | 1845|   631k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   631k|	uint32_t r, g, b;							\
  |  | 1847|   631k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   631k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   631k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   631k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   631k|}
  ------------------
  |  Branch (2010:21): [True: 19.5k, False: 612k]
  ------------------
 2011|   631k|                    }                                    /* FALLTHROUGH */
 2012|   633k|                case 1:
  ------------------
  |  Branch (2012:17): [True: 1.33k, False: 631k]
  ------------------
 2013|   633k|                    switch (h) {
 2014|   613k|                    default: YCbCrtoRGB(cp1[0], pp[ 4]); /* FALLTHROUGH */
  ------------------
  |  | 1845|   613k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   613k|	uint32_t r, g, b;							\
  |  | 1847|   613k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   613k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   613k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   613k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   613k|}
  ------------------
  |  Branch (2014:21): [True: 613k, False: 19.5k]
  ------------------
 2015|   633k|                    case 1:  YCbCrtoRGB(cp [0], pp[ 0]); /* FALLTHROUGH */
  ------------------
  |  | 1845|   633k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   633k|	uint32_t r, g, b;							\
  |  | 1847|   633k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   633k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   633k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   633k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   633k|}
  ------------------
  |  Branch (2015:21): [True: 19.5k, False: 613k]
  ------------------
 2016|   633k|                    }                                    /* FALLTHROUGH */
 2017|   633k|                }
 2018|   633k|                if (x < 4) {
  ------------------
  |  Branch (2018:21): [True: 98.3k, False: 534k]
  ------------------
 2019|  98.3k|                    cp += x; cp1 += x;
 2020|  98.3k|                    x = 0;
 2021|  98.3k|                }
 2022|   534k|                else {
 2023|   534k|                    cp += 4; cp1 += 4;
 2024|   534k|                    x -= 4;
 2025|   534k|                }
 2026|   633k|                pp += 10;
 2027|   633k|            }
 2028|   108k|            if (h <= 2)
  ------------------
  |  Branch (2028:17): [True: 2.26k, False: 106k]
  ------------------
 2029|  2.26k|                break;
 2030|   106k|            h -= 2;
 2031|   106k|            cp += incr;
 2032|   106k|            cp1 += incr;
 2033|   106k|            pp += fromskew;
 2034|   106k|        }
 2035|  2.26k|    }
 2036|  3.32k|}
tif_getimage.c:putcontig8bitYCbCr41tile:
 2042|  1.28k|{
 2043|  1.28k|    (void) y;
 2044|  1.28k|    fromskew = (fromskew / 4) * (4*1+2);
 2045|   128k|    do {
 2046|   128k|	x = w>>2;
 2047|   845k|	while(x>0) {
  ------------------
  |  Branch (2047:8): [True: 717k, False: 128k]
  ------------------
 2048|   717k|	    int32_t Cb = pp[4];
 2049|   717k|	    int32_t Cr = pp[5];
 2050|       |
 2051|   717k|	    YCbCrtoRGB(cp [0], pp[0]);
  ------------------
  |  | 1845|   717k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   717k|	uint32_t r, g, b;							\
  |  | 1847|   717k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   717k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   717k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   717k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   717k|}
  ------------------
 2052|   717k|	    YCbCrtoRGB(cp [1], pp[1]);
  ------------------
  |  | 1845|   717k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   717k|	uint32_t r, g, b;							\
  |  | 1847|   717k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   717k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   717k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   717k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   717k|}
  ------------------
 2053|   717k|	    YCbCrtoRGB(cp [2], pp[2]);
  ------------------
  |  | 1845|   717k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   717k|	uint32_t r, g, b;							\
  |  | 1847|   717k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   717k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   717k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   717k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   717k|}
  ------------------
 2054|   717k|	    YCbCrtoRGB(cp [3], pp[3]);
  ------------------
  |  | 1845|   717k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   717k|	uint32_t r, g, b;							\
  |  | 1847|   717k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   717k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   717k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   717k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   717k|}
  ------------------
 2055|       |
 2056|   717k|	    cp += 4;
 2057|   717k|	    pp += 6;
 2058|   717k|		x--;
 2059|   717k|	}
 2060|       |
 2061|   128k|        if( (w&3) != 0 )
  ------------------
  |  Branch (2061:13): [True: 43.2k, False: 85.0k]
  ------------------
 2062|  43.2k|        {
 2063|  43.2k|	    int32_t Cb = pp[4];
 2064|  43.2k|	    int32_t Cr = pp[5];
 2065|       |
 2066|  43.2k|            switch( (w&3) ) {
  ------------------
  |  Branch (2066:21): [True: 0, False: 43.2k]
  ------------------
 2067|  2.65k|              case 3: YCbCrtoRGB(cp [2], pp[2]); /*-fallthrough*/
  ------------------
  |  | 1845|  2.65k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  2.65k|	uint32_t r, g, b;							\
  |  | 1847|  2.65k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  2.65k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  2.65k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  2.65k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  2.65k|}
  ------------------
  |  Branch (2067:15): [True: 2.65k, False: 40.5k]
  ------------------
 2068|  6.13k|              case 2: YCbCrtoRGB(cp [1], pp[1]); /*-fallthrough*/
  ------------------
  |  | 1845|  6.13k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  6.13k|	uint32_t r, g, b;							\
  |  | 1847|  6.13k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  6.13k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  6.13k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  6.13k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  6.13k|}
  ------------------
  |  Branch (2068:15): [True: 3.47k, False: 39.7k]
  ------------------
 2069|  43.2k|              case 1: YCbCrtoRGB(cp [0], pp[0]); /*-fallthrough*/
  ------------------
  |  | 1845|  43.2k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  43.2k|	uint32_t r, g, b;							\
  |  | 1847|  43.2k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  43.2k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  43.2k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  43.2k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  43.2k|}
  ------------------
  |  Branch (2069:15): [True: 37.0k, False: 6.13k]
  ------------------
 2070|  43.2k|              case 0: break;
  ------------------
  |  Branch (2070:15): [True: 0, False: 43.2k]
  ------------------
 2071|  43.2k|            }
 2072|       |
 2073|  43.2k|            cp += (w&3);
 2074|  43.2k|            pp += 6;
 2075|  43.2k|        }
 2076|       |
 2077|   128k|	cp += toskew;
 2078|   128k|	pp += fromskew;
 2079|   128k|    } while (--h);
  ------------------
  |  Branch (2079:14): [True: 126k, False: 1.28k]
  ------------------
 2080|       |
 2081|  1.28k|}
tif_getimage.c:putcontig8bitYCbCr22tile:
 2087|  24.0k|{
 2088|  24.0k|	uint32_t* cp2;
 2089|  24.0k|	int32_t incr = 2 * toskew + w;
 2090|  24.0k|	(void) y;
 2091|  24.0k|	fromskew = (fromskew / 2) * (2*2+2);
 2092|  24.0k|	cp2 = cp+w+toskew;
 2093|  2.35M|	while (h>=2) {
  ------------------
  |  Branch (2093:9): [True: 2.33M, False: 24.0k]
  ------------------
 2094|  2.33M|		x = w;
 2095|   115M|		while (x>=2) {
  ------------------
  |  Branch (2095:10): [True: 112M, False: 2.33M]
  ------------------
 2096|   112M|			uint32_t Cb = pp[4];
 2097|   112M|			uint32_t Cr = pp[5];
 2098|   112M|			YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 1845|   112M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   112M|	uint32_t r, g, b;							\
  |  | 1847|   112M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   112M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   112M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   112M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   112M|}
  ------------------
 2099|   112M|			YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 1845|   112M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   112M|	uint32_t r, g, b;							\
  |  | 1847|   112M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   112M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   112M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   112M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   112M|}
  ------------------
 2100|   112M|			YCbCrtoRGB(cp2[0], pp[2]);
  ------------------
  |  | 1845|   112M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   112M|	uint32_t r, g, b;							\
  |  | 1847|   112M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   112M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   112M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   112M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   112M|}
  ------------------
 2101|   112M|			YCbCrtoRGB(cp2[1], pp[3]);
  ------------------
  |  | 1845|   112M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   112M|	uint32_t r, g, b;							\
  |  | 1847|   112M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   112M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   112M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   112M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   112M|}
  ------------------
 2102|   112M|			cp += 2;
 2103|   112M|			cp2 += 2;
 2104|   112M|			pp += 6;
 2105|   112M|			x -= 2;
 2106|   112M|		}
 2107|  2.33M|		if (x==1) {
  ------------------
  |  Branch (2107:7): [True: 1.96M, False: 370k]
  ------------------
 2108|  1.96M|			uint32_t Cb = pp[4];
 2109|  1.96M|			uint32_t Cr = pp[5];
 2110|  1.96M|			YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 1845|  1.96M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  1.96M|	uint32_t r, g, b;							\
  |  | 1847|  1.96M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  1.96M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  1.96M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  1.96M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  1.96M|}
  ------------------
 2111|  1.96M|			YCbCrtoRGB(cp2[0], pp[2]);
  ------------------
  |  | 1845|  1.96M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  1.96M|	uint32_t r, g, b;							\
  |  | 1847|  1.96M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  1.96M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  1.96M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  1.96M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  1.96M|}
  ------------------
 2112|  1.96M|			cp ++ ;
 2113|  1.96M|			cp2 ++ ;
 2114|  1.96M|			pp += 6;
 2115|  1.96M|		}
 2116|  2.33M|		cp += incr;
 2117|  2.33M|		cp2 += incr;
 2118|  2.33M|		pp += fromskew;
 2119|  2.33M|		h-=2;
 2120|  2.33M|	}
 2121|  24.0k|	if (h==1) {
  ------------------
  |  Branch (2121:6): [True: 6.60k, False: 17.4k]
  ------------------
 2122|  6.60k|		x = w;
 2123|   679k|		while (x>=2) {
  ------------------
  |  Branch (2123:10): [True: 673k, False: 6.60k]
  ------------------
 2124|   673k|			uint32_t Cb = pp[4];
 2125|   673k|			uint32_t Cr = pp[5];
 2126|   673k|			YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 1845|   673k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   673k|	uint32_t r, g, b;							\
  |  | 1847|   673k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   673k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   673k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   673k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   673k|}
  ------------------
 2127|   673k|			YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 1845|   673k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   673k|	uint32_t r, g, b;							\
  |  | 1847|   673k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   673k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   673k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   673k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   673k|}
  ------------------
 2128|   673k|			cp += 2;
 2129|   673k|			cp2 += 2;
 2130|   673k|			pp += 6;
 2131|   673k|			x -= 2;
 2132|   673k|		}
 2133|  6.60k|		if (x==1) {
  ------------------
  |  Branch (2133:7): [True: 5.10k, False: 1.50k]
  ------------------
 2134|  5.10k|			uint32_t Cb = pp[4];
 2135|  5.10k|			uint32_t Cr = pp[5];
 2136|  5.10k|			YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 1845|  5.10k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  5.10k|	uint32_t r, g, b;							\
  |  | 1847|  5.10k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  5.10k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  5.10k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  5.10k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  5.10k|}
  ------------------
 2137|  5.10k|		}
 2138|  6.60k|	}
 2139|  24.0k|}
tif_getimage.c:putcontig8bitYCbCr21tile:
 2145|  2.20k|{
 2146|  2.20k|	(void) y;
 2147|  2.20k|	fromskew = (fromskew / 2) * (2*1+2);
 2148|  10.5k|	do {
 2149|  10.5k|		x = w>>1;
 2150|   794k|		while(x>0) {
  ------------------
  |  Branch (2150:9): [True: 783k, False: 10.5k]
  ------------------
 2151|   783k|			int32_t Cb = pp[2];
 2152|   783k|			int32_t Cr = pp[3];
 2153|       |
 2154|   783k|			YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 1845|   783k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   783k|	uint32_t r, g, b;							\
  |  | 1847|   783k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   783k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   783k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   783k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   783k|}
  ------------------
 2155|   783k|			YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 1845|   783k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   783k|	uint32_t r, g, b;							\
  |  | 1847|   783k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   783k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   783k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   783k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   783k|}
  ------------------
 2156|       |
 2157|   783k|			cp += 2;
 2158|   783k|			pp += 4;
 2159|   783k|			x --;
 2160|   783k|		}
 2161|       |
 2162|  10.5k|		if( (w&1) != 0 )
  ------------------
  |  Branch (2162:7): [True: 9.95k, False: 556]
  ------------------
 2163|  9.95k|		{
 2164|  9.95k|			int32_t Cb = pp[2];
 2165|  9.95k|			int32_t Cr = pp[3];
 2166|       |
 2167|  9.95k|			YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 1845|  9.95k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  9.95k|	uint32_t r, g, b;							\
  |  | 1847|  9.95k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  9.95k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  9.95k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  9.95k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  9.95k|}
  ------------------
 2168|       |
 2169|  9.95k|			cp += 1;
 2170|  9.95k|			pp += 4;
 2171|  9.95k|		}
 2172|       |
 2173|  10.5k|		cp += toskew;
 2174|  10.5k|		pp += fromskew;
 2175|  10.5k|	} while (--h);
  ------------------
  |  Branch (2175:11): [True: 8.30k, False: 2.20k]
  ------------------
 2176|  2.20k|}
tif_getimage.c:putcontig8bitYCbCr12tile:
 2182|    467|{
 2183|    467|	uint32_t* cp2;
 2184|    467|	int32_t incr = 2 * toskew + w;
 2185|    467|	(void) y;
 2186|    467|	fromskew = (fromskew / 1) * (1 * 2 + 2);
 2187|    467|	cp2 = cp+w+toskew;
 2188|  20.0k|	while (h>=2) {
  ------------------
  |  Branch (2188:9): [True: 19.5k, False: 467]
  ------------------
 2189|  19.5k|		x = w;
 2190|  1.27M|		do {
 2191|  1.27M|			uint32_t Cb = pp[2];
 2192|  1.27M|			uint32_t Cr = pp[3];
 2193|  1.27M|			YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 1845|  1.27M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  1.27M|	uint32_t r, g, b;							\
  |  | 1847|  1.27M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  1.27M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  1.27M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  1.27M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  1.27M|}
  ------------------
 2194|  1.27M|			YCbCrtoRGB(cp2[0], pp[1]);
  ------------------
  |  | 1845|  1.27M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  1.27M|	uint32_t r, g, b;							\
  |  | 1847|  1.27M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  1.27M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  1.27M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  1.27M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  1.27M|}
  ------------------
 2195|  1.27M|			cp ++;
 2196|  1.27M|			cp2 ++;
 2197|  1.27M|			pp += 4;
 2198|  1.27M|		} while (--x);
  ------------------
  |  Branch (2198:12): [True: 1.25M, False: 19.5k]
  ------------------
 2199|  19.5k|		cp += incr;
 2200|  19.5k|		cp2 += incr;
 2201|  19.5k|		pp += fromskew;
 2202|  19.5k|		h-=2;
 2203|  19.5k|	}
 2204|    467|	if (h==1) {
  ------------------
  |  Branch (2204:6): [True: 206, False: 261]
  ------------------
 2205|    206|		x = w;
 2206|  49.4k|		do {
 2207|  49.4k|			uint32_t Cb = pp[2];
 2208|  49.4k|			uint32_t Cr = pp[3];
 2209|  49.4k|			YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 1845|  49.4k|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|  49.4k|	uint32_t r, g, b;							\
  |  | 1847|  49.4k|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|  49.4k|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|  49.4k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|  49.4k|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|  49.4k|}
  ------------------
 2210|  49.4k|			cp ++;
 2211|  49.4k|			pp += 4;
 2212|  49.4k|		} while (--x);
  ------------------
  |  Branch (2212:12): [True: 49.1k, False: 206]
  ------------------
 2213|    206|	}
 2214|    467|}
tif_getimage.c:putcontig8bitYCbCr11tile:
 2220|  5.03k|{
 2221|  5.03k|	(void) y;
 2222|  5.03k|	fromskew = (fromskew / 1) * (1 * 1 + 2);
 2223|   436k|	do {
 2224|   436k|		x = w; /* was x = w>>1; patched 2000/09/25 warmerda@home.com */
 2225|   182M|		do {
 2226|   182M|			int32_t Cb = pp[1];
 2227|   182M|			int32_t Cr = pp[2];
 2228|       |
 2229|   182M|			YCbCrtoRGB(*cp++, pp[0]);
  ------------------
  |  | 1845|   182M|#define	YCbCrtoRGB(dst, Y) {						\
  |  | 1846|   182M|	uint32_t r, g, b;							\
  |  | 1847|   182M|	TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b);		\
  |  | 1848|   182M|	dst = PACK(r, g, b);						\
  |  |  ------------------
  |  |  |  | 1253|   182M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1251|   182M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1849|   182M|}
  ------------------
 2230|       |
 2231|   182M|			pp += 3;
 2232|   182M|		} while (--x);
  ------------------
  |  Branch (2232:12): [True: 182M, False: 436k]
  ------------------
 2233|   436k|		cp += toskew;
 2234|   436k|		pp += fromskew;
 2235|   436k|	} while (--h);
  ------------------
  |  Branch (2235:11): [True: 431k, False: 5.03k]
  ------------------
 2236|  5.03k|}
tif_getimage.c:initCIELabConversion:
 2320|    135|{
 2321|    135|	static const char module[] = "initCIELabConversion";
 2322|       |
 2323|    135|	float   *whitePoint;
 2324|    135|	float   refWhite[3];
 2325|       |
 2326|    135|	TIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &whitePoint);
  ------------------
  |  |  301|    135|#define	TIFFTAG_WHITEPOINT		318	/* image white point */
  ------------------
 2327|    135|	if (whitePoint[1] == 0.0f ) {
  ------------------
  |  Branch (2327:6): [True: 1, False: 134]
  ------------------
 2328|      1|		TIFFErrorExtR(img->tif, module,
 2329|      1|		    "Invalid value for WhitePoint tag.");
 2330|      1|		return NULL;
 2331|      1|        }
 2332|       |
 2333|    134|	if (!img->cielab) {
  ------------------
  |  Branch (2333:6): [True: 134, False: 0]
  ------------------
 2334|    134|		img->cielab = (TIFFCIELabToRGB *)
 2335|    134|			_TIFFmalloc(sizeof(TIFFCIELabToRGB));
 2336|    134|		if (!img->cielab) {
  ------------------
  |  Branch (2336:7): [True: 0, False: 134]
  ------------------
 2337|      0|			TIFFErrorExtR(img->tif, module,
 2338|      0|			    "No space for CIE L*a*b*->RGB conversion state.");
 2339|      0|			return NULL;
 2340|      0|		}
 2341|    134|	}
 2342|       |
 2343|    134|	refWhite[1] = 100.0F;
 2344|    134|	refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
 2345|    134|	refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1])
 2346|    134|		      / whitePoint[1] * refWhite[1];
 2347|    134|	if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0) {
  ------------------
  |  Branch (2347:6): [True: 0, False: 134]
  ------------------
 2348|      0|		TIFFErrorExtR(img->tif, module,
 2349|      0|		    "Failed to initialize CIE L*a*b*->RGB conversion state.");
 2350|      0|		_TIFFfree(img->cielab);
 2351|      0|		return NULL;
 2352|      0|	}
 2353|       |
 2354|    134|	if (img->bitspersample == 8)
  ------------------
  |  Branch (2354:6): [True: 50, False: 84]
  ------------------
 2355|     50|		return putcontig8bitCIELab8;
 2356|     84|	else if (img->bitspersample == 16)
  ------------------
  |  Branch (2356:11): [True: 84, False: 0]
  ------------------
 2357|     84|		return putcontig8bitCIELab16;
 2358|      0|	return NULL;
 2359|    134|}
tif_getimage.c:putcontig8bitCIELab8:
 1794|  11.2k|{
 1795|  11.2k|	float X, Y, Z;
 1796|  11.2k|	uint32_t r, g, b;
 1797|  11.2k|	(void) y;
 1798|  11.2k|	fromskew *= 3;
 1799|  11.2M|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1799:9): [True: 11.2M, False: 11.2k]
  ------------------
 1800|  35.9M|		for (x = w; x > 0; --x) {
  ------------------
  |  Branch (1800:15): [True: 24.7M, False: 11.2M]
  ------------------
 1801|  24.7M|			TIFFCIELabToXYZ(img->cielab,
 1802|  24.7M|					(unsigned char)pp[0],
 1803|  24.7M|					(signed char)pp[1],
 1804|  24.7M|					(signed char)pp[2],
 1805|  24.7M|					&X, &Y, &Z);
 1806|  24.7M|			TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b);
 1807|  24.7M|			*cp++ = PACK(r, g, b);
  ------------------
  |  | 1253|  24.7M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  ------------------
  |  |  |  | 1251|  24.7M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  ------------------
  ------------------
 1808|  24.7M|			pp += 3;
 1809|  24.7M|		}
 1810|  11.2M|		cp += toskew;
 1811|  11.2M|		pp += fromskew;
 1812|  11.2M|	}
 1813|  11.2k|}
tif_getimage.c:putcontig8bitCIELab16:
 1819|    321|{
 1820|    321|	float X, Y, Z;
 1821|    321|	uint32_t r, g, b;
 1822|    321|	uint16_t *wp = (uint16_t *)pp;
 1823|    321|	(void) y;
 1824|    321|	fromskew *= 3;
 1825|   140k|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1825:9): [True: 140k, False: 321]
  ------------------
 1826|  8.14M|		for (x = w; x > 0; --x) {
  ------------------
  |  Branch (1826:15): [True: 8.00M, False: 140k]
  ------------------
 1827|  8.00M|			TIFFCIELab16ToXYZ(img->cielab,
 1828|  8.00M|					  (uint16_t)wp[0],
 1829|  8.00M|					  (int16_t)wp[1],
 1830|  8.00M|					  (int16_t)wp[2],
 1831|  8.00M|					  &X, &Y, &Z);
 1832|  8.00M|			TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b);
 1833|  8.00M|			*cp++ = PACK(r, g, b);
  ------------------
  |  | 1253|  8.00M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  ------------------
  |  |  |  | 1251|  8.00M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  ------------------
  ------------------
 1834|  8.00M|			wp += 3;
 1835|  8.00M|		}
 1836|   140k|		cp += toskew;
 1837|   140k|		wp += fromskew;
 1838|   140k|	}
 1839|    321|}
tif_getimage.c:PickSeparateCase:
 2756|    947|{
 2757|    947|	img->get = TIFFIsTiled(img->tif) ? gtTileSeparate : gtStripSeparate;
  ------------------
  |  Branch (2757:13): [True: 947, False: 0]
  ------------------
 2758|    947|	img->put.separate = NULL;
 2759|    947|	switch (img->photometric) {
  ------------------
  |  Branch (2759:10): [True: 1, False: 946]
  ------------------
 2760|      1|	case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  215|      1|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  |  Branch (2760:2): [True: 1, False: 946]
  ------------------
 2761|    260|	case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  216|    260|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  |  Branch (2761:2): [True: 259, False: 688]
  ------------------
 2762|       |		/* greyscale images processed pretty much as RGB by gtTileSeparate */
 2763|    292|	case PHOTOMETRIC_RGB:
  ------------------
  |  |  217|    292|#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
  ------------------
  |  Branch (2763:2): [True: 32, False: 915]
  ------------------
 2764|    292|		switch (img->bitspersample) {
  ------------------
  |  Branch (2764:11): [True: 3, False: 289]
  ------------------
 2765|    221|		case 8:
  ------------------
  |  Branch (2765:3): [True: 221, False: 71]
  ------------------
 2766|    221|			if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
  ------------------
  |  |  325|    221|#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
  ------------------
  |  Branch (2766:8): [True: 121, False: 100]
  ------------------
 2767|    121|				img->put.separate = putRGBAAseparate8bittile;
 2768|    100|			else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
  ------------------
  |  |  326|    100|#define	    EXTRASAMPLE_UNASSALPHA	2	/* !unassociated alpha data */
  ------------------
  |  Branch (2768:13): [True: 22, False: 78]
  ------------------
 2769|     22|			{
 2770|     22|				if (BuildMapUaToAa(img))
  ------------------
  |  Branch (2770:9): [True: 22, False: 0]
  ------------------
 2771|     22|					img->put.separate = putRGBUAseparate8bittile;
 2772|     22|			}
 2773|     78|			else
 2774|     78|				img->put.separate = putRGBseparate8bittile;
 2775|    221|			break;
 2776|     68|		case 16:
  ------------------
  |  Branch (2776:3): [True: 68, False: 224]
  ------------------
 2777|     68|			if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
  ------------------
  |  |  325|     68|#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
  ------------------
  |  Branch (2777:8): [True: 21, False: 47]
  ------------------
 2778|     21|			{
 2779|     21|				if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (2779:9): [True: 21, False: 0]
  ------------------
 2780|     21|					img->put.separate = putRGBAAseparate16bittile;
 2781|     21|			}
 2782|     47|			else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
  ------------------
  |  |  326|     47|#define	    EXTRASAMPLE_UNASSALPHA	2	/* !unassociated alpha data */
  ------------------
  |  Branch (2782:13): [True: 15, False: 32]
  ------------------
 2783|     15|			{
 2784|     15|				if (BuildMapBitdepth16To8(img) &&
  ------------------
  |  Branch (2784:9): [True: 15, False: 0]
  ------------------
 2785|     15|				    BuildMapUaToAa(img))
  ------------------
  |  Branch (2785:9): [True: 15, False: 0]
  ------------------
 2786|     15|					img->put.separate = putRGBUAseparate16bittile;
 2787|     15|			}
 2788|     32|			else
 2789|     32|			{
 2790|     32|				if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (2790:9): [True: 32, False: 0]
  ------------------
 2791|     32|					img->put.separate = putRGBseparate16bittile;
 2792|     32|			}
 2793|     68|			break;
 2794|    292|		}
 2795|    292|		break;
 2796|    292|	case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  220|     25|#define	    PHOTOMETRIC_SEPARATED	5	/* !color separations */
  ------------------
  |  Branch (2796:2): [True: 25, False: 922]
  ------------------
 2797|     25|		if (img->bitspersample == 8 && img->samplesperpixel == 4)
  ------------------
  |  Branch (2797:7): [True: 23, False: 2]
  |  Branch (2797:34): [True: 22, False: 1]
  ------------------
 2798|     22|		{
 2799|     22|			img->alpha = 1; // Not alpha, but seems like the only way to get 4th band
 2800|     22|			img->put.separate = putCMYKseparate8bittile;
 2801|     22|		}
 2802|     25|		break;
 2803|    629|	case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  221|    629|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (2803:2): [True: 629, False: 318]
  ------------------
 2804|    629|		if ((img->bitspersample==8) && (img->samplesperpixel==3))
  ------------------
  |  Branch (2804:7): [True: 628, False: 1]
  |  Branch (2804:34): [True: 626, False: 2]
  ------------------
 2805|    626|		{
 2806|    626|			if (initYCbCrConversion(img)!=0)
  ------------------
  |  Branch (2806:8): [True: 625, False: 1]
  ------------------
 2807|    625|			{
 2808|    625|				uint16_t hs, vs;
 2809|    625|				TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &hs, &vs);
  ------------------
  |  |  386|    625|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
 2810|    625|				switch ((hs<<4)|vs) {
  ------------------
  |  Branch (2810:13): [True: 13, False: 612]
  ------------------
 2811|    612|				case 0x11:
  ------------------
  |  Branch (2811:5): [True: 612, False: 13]
  ------------------
 2812|    612|					img->put.separate = putseparate8bitYCbCr11tile;
 2813|    612|					break;
 2814|       |					/* TODO: add other cases here */
 2815|    625|				}
 2816|    625|			}
 2817|    626|		}
 2818|    629|		break;
 2819|    947|	}
 2820|    947|	return ((img->get!=NULL) && (img->put.separate!=NULL));
  ------------------
  |  Branch (2820:10): [True: 947, False: 0]
  |  Branch (2820:30): [True: 923, False: 24]
  ------------------
 2821|    947|}
tif_getimage.c:gtTileSeparate:
  746|    923|{
  747|    923|	TIFF* tif = img->tif;
  748|    923|	tileSeparateRoutine put = img->put.separate;
  749|    923|	uint32_t col, row, y, rowstoread;
  750|    923|	tmsize_t pos;
  751|    923|	uint32_t tw, th;
  752|    923|	unsigned char* buf = NULL;
  753|    923|	unsigned char* p0 = NULL;
  754|    923|	unsigned char* p1 = NULL;
  755|    923|	unsigned char* p2 = NULL;
  756|    923|	unsigned char* pa = NULL;
  757|    923|	tmsize_t tilesize;
  758|    923|	tmsize_t bufsize;
  759|    923|	int32_t fromskew, toskew;
  760|    923|	int alpha = img->alpha;
  761|    923|	uint32_t nrow;
  762|    923|	int ret = 1, flip;
  763|    923|        uint16_t colorchannels;
  764|    923|	uint32_t this_tw, tocol;
  765|    923|	int32_t this_toskew, leftmost_toskew;
  766|    923|	int32_t leftmost_fromskew;
  767|    923|	uint32_t leftmost_tw;
  768|       |
  769|    923|	tilesize = TIFFTileSize(tif);  
  770|    923|	bufsize = _TIFFMultiplySSize(tif, alpha?4:3,tilesize, "gtTileSeparate");
  ------------------
  |  Branch (770:36): [True: 210, False: 713]
  ------------------
  771|    923|	if (bufsize == 0) {
  ------------------
  |  Branch (771:6): [True: 0, False: 923]
  ------------------
  772|      0|		return (0);
  773|      0|	}
  774|       |
  775|    923|	TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
  ------------------
  |  |  305|    923|#define	TIFFTAG_TILEWIDTH		322	/* !tile width in pixels */
  ------------------
  776|    923|	TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
  ------------------
  |  |  306|    923|#define	TIFFTAG_TILELENGTH		323	/* !tile height in pixels */
  ------------------
  777|       |
  778|    923|	flip = setorientation(img);
  779|    923|	if (flip & FLIP_VERTICALLY) {
  ------------------
  |  |   49|    923|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (779:6): [True: 858, False: 65]
  ------------------
  780|    858|		if ((tw + w) > INT_MAX) {
  ------------------
  |  Branch (780:7): [True: 0, False: 858]
  ------------------
  781|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s", "unsupported tile size (too wide)");
  782|      0|            return (0);
  783|      0|        }
  784|    858|		y = h - 1;
  785|    858|		toskew = -(int32_t)(tw + w);
  786|    858|	}
  787|     65|	else {
  788|     65|		if (tw > (INT_MAX + w)) {
  ------------------
  |  Branch (788:7): [True: 0, False: 65]
  ------------------
  789|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s", "unsupported tile size (too wide)");
  790|      0|            return (0);
  791|      0|        }
  792|     65|		y = 0;
  793|     65|		toskew = -(int32_t)(tw - w);
  794|     65|	}
  795|       |
  796|    923|        switch( img->photometric )
  797|    923|        {
  798|      1|          case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  215|      1|#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
  ------------------
  |  Branch (798:11): [True: 1, False: 922]
  ------------------
  799|    257|          case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  216|    257|#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
  ------------------
  |  Branch (799:11): [True: 256, False: 667]
  ------------------
  800|    257|          case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  218|    257|#define	    PHOTOMETRIC_PALETTE		3	/* color map indexed */
  ------------------
  |  Branch (800:11): [True: 0, False: 923]
  ------------------
  801|    257|            colorchannels = 1;
  802|    257|            break;
  803|       |
  804|    666|          default:
  ------------------
  |  Branch (804:11): [True: 666, False: 257]
  ------------------
  805|    666|            colorchannels = 3;
  806|    666|            break;
  807|    923|        }
  808|       |
  809|       |	/*
  810|       |	 *	Leftmost tile is clipped on left side if col_offset > 0.
  811|       |	 */
  812|    923|	leftmost_fromskew = img->col_offset % tw;
  813|    923|	leftmost_tw = tw - leftmost_fromskew;
  814|    923|	leftmost_toskew = toskew + leftmost_fromskew;
  815|  29.1k|	for (row = 0; ret != 0 && row < h; row += nrow)
  ------------------
  |  Branch (815:16): [True: 29.0k, False: 141]
  |  Branch (815:28): [True: 28.2k, False: 782]
  ------------------
  816|  28.2k|	{
  817|  28.2k|		rowstoread = th - (row + img->row_offset) % th;
  818|  28.2k|		nrow = (row + rowstoread > h ? h - row : rowstoread);
  ------------------
  |  Branch (818:11): [True: 834, False: 27.4k]
  ------------------
  819|  28.2k|		fromskew = leftmost_fromskew;
  820|  28.2k|		this_tw = leftmost_tw;
  821|  28.2k|		this_toskew = leftmost_toskew;
  822|  28.2k|		tocol = 0;
  823|  28.2k|		col = img->col_offset;
  824|   202k|		while (tocol < w)
  ------------------
  |  Branch (824:10): [True: 174k, False: 28.1k]
  ------------------
  825|   174k|		{
  826|   174k|                        if( buf == NULL )
  ------------------
  |  Branch (826:29): [True: 923, False: 173k]
  ------------------
  827|    923|                        {
  828|    923|                            if (_TIFFReadTileAndAllocBuffer(
  ------------------
  |  Branch (828:33): [True: 323, False: 600]
  ------------------
  829|    923|                                    tif, (void**) &buf, bufsize, col,
  830|    923|                                    row+img->row_offset,0,0)==(tmsize_t)(-1)
  831|    923|                                && (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (831:37): [True: 141, False: 182]
  |  Branch (831:52): [True: 0, False: 182]
  ------------------
  832|    141|                            {
  833|    141|                                    ret = 0;
  834|    141|                                    break;
  835|    141|                            }
  836|    782|                            p0 = buf;
  837|    782|                            if( colorchannels == 1 )
  ------------------
  |  Branch (837:33): [True: 184, False: 598]
  ------------------
  838|    184|                            {
  839|    184|                                p2 = p1 = p0;
  840|    184|                                pa = (alpha?(p0+3*tilesize):NULL);
  ------------------
  |  Branch (840:39): [True: 106, False: 78]
  ------------------
  841|    184|                            }
  842|    598|                            else
  843|    598|                            {
  844|    598|                                p1 = p0 + tilesize;
  845|    598|                                p2 = p1 + tilesize;
  846|    598|                                pa = (alpha?(p2+tilesize):NULL);
  ------------------
  |  Branch (846:39): [True: 50, False: 548]
  ------------------
  847|    598|                            }
  848|    782|                        }
  849|   173k|			else if (TIFFReadTile(tif, p0, col,  
  ------------------
  |  Branch (849:13): [True: 166k, False: 7.27k]
  ------------------
  850|   173k|			    row+img->row_offset,0,0)==(tmsize_t)(-1) && img->stoponerr)
  ------------------
  |  Branch (850:52): [True: 0, False: 166k]
  ------------------
  851|      0|			{
  852|      0|				ret = 0;
  853|      0|				break;
  854|      0|			}
  855|   174k|			if (colorchannels > 1 
  ------------------
  |  Branch (855:8): [True: 17.6k, False: 156k]
  ------------------
  856|   174k|                            && TIFFReadTile(tif, p1, col,  
  ------------------
  |  Branch (856:32): [True: 13.6k, False: 3.95k]
  ------------------
  857|  17.6k|                                            row+img->row_offset,0,1) == (tmsize_t)(-1) 
  858|   174k|                            && img->stoponerr)
  ------------------
  |  Branch (858:32): [True: 0, False: 13.6k]
  ------------------
  859|      0|			{
  860|      0|				ret = 0;
  861|      0|				break;
  862|      0|			}
  863|   174k|			if (colorchannels > 1 
  ------------------
  |  Branch (863:8): [True: 17.6k, False: 156k]
  ------------------
  864|   174k|                            && TIFFReadTile(tif, p2, col,  
  ------------------
  |  Branch (864:32): [True: 17.5k, False: 67]
  ------------------
  865|  17.6k|                                            row+img->row_offset,0,2) == (tmsize_t)(-1) 
  866|   174k|                            && img->stoponerr)
  ------------------
  |  Branch (866:32): [True: 0, False: 17.5k]
  ------------------
  867|      0|			{
  868|      0|				ret = 0;
  869|      0|				break;
  870|      0|			}
  871|   174k|			if (alpha
  ------------------
  |  Branch (871:8): [True: 142k, False: 32.0k]
  ------------------
  872|   174k|                            && TIFFReadTile(tif,pa,col,  
  ------------------
  |  Branch (872:32): [True: 142k, False: 104]
  ------------------
  873|   142k|                                            row+img->row_offset,0,colorchannels) == (tmsize_t)(-1) 
  874|   174k|                            && img->stoponerr)
  ------------------
  |  Branch (874:32): [True: 0, False: 142k]
  ------------------
  875|      0|                        {
  876|      0|                            ret = 0;
  877|      0|                            break;
  878|      0|			}
  879|       |
  880|   174k|			pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif) + \
  881|   174k|			   ((tmsize_t) fromskew * img->samplesperpixel);
  882|   174k|			if (tocol + this_tw > w) 
  ------------------
  |  Branch (882:8): [True: 27.7k, False: 146k]
  ------------------
  883|  27.7k|			{
  884|       |				/*
  885|       |				 * Rightmost tile is clipped on right side.
  886|       |				 */
  887|  27.7k|				fromskew = tw - (w - tocol);
  888|  27.7k|				this_tw = tw - fromskew;
  889|  27.7k|				this_toskew = toskew + fromskew;
  890|  27.7k|			}
  891|   174k|			tmsize_t roffset = (tmsize_t) y * w + tocol;
  892|   174k|			(*put)(img, raster + roffset, tocol, y, this_tw, nrow, fromskew, this_toskew, \
  893|   174k|				p0 + pos, p1 + pos, p2 + pos, (alpha?(pa+pos):NULL));
  ------------------
  |  Branch (893:36): [True: 142k, False: 32.0k]
  ------------------
  894|   174k|			tocol += this_tw;
  895|   174k|			col += this_tw;
  896|       |			/*
  897|       |			* After the leftmost tile, tiles are no longer clipped on left side.
  898|       |			*/
  899|   174k|			fromskew = 0;
  900|   174k|			this_tw = tw;
  901|   174k|			this_toskew = toskew;
  902|   174k|		}
  903|       |
  904|  28.2k|		y += ((flip & FLIP_VERTICALLY) ? -(int32_t) nrow : (int32_t) nrow);
  ------------------
  |  |   49|  28.2k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (904:9): [True: 20.6k, False: 7.61k]
  ------------------
  905|  28.2k|	}
  906|       |
  907|    923|	if (flip & FLIP_HORIZONTALLY) {
  ------------------
  |  |   50|    923|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (907:6): [True: 105, False: 818]
  ------------------
  908|    105|		uint32_t line;
  909|       |
  910|   326k|		for (line = 0; line < h; line++) {
  ------------------
  |  Branch (910:18): [True: 326k, False: 105]
  ------------------
  911|   326k|			uint32_t *left = raster + (line * w);
  912|   326k|			uint32_t *right = left + w - 1;
  913|       |
  914|  6.62M|			while ( left < right ) {
  ------------------
  |  Branch (914:12): [True: 6.30M, False: 326k]
  ------------------
  915|  6.30M|				uint32_t temp = *left;
  916|  6.30M|				*left = *right;
  917|  6.30M|				*right = temp;
  918|  6.30M|				left++;
  919|  6.30M|				right--;
  920|  6.30M|			}
  921|   326k|		}
  922|    105|	}
  923|       |
  924|    923|	_TIFFfree(buf);
  925|    923|	return (ret);
  926|    923|}
tif_getimage.c:putRGBAAseparate8bittile:
 1673|   133k|{
 1674|   133k|	(void) img; (void) x; (void) y; 
 1675|   682k|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1675:9): [True: 548k, False: 133k]
  ------------------
 1676|   548k|		UNROLL8(w, NOP, *cp++ = PACK4(*r++, *g++, *b++, *a++));
  ------------------
  |  | 1214|   548k|#define	UNROLL8(w, op1, op2) {		\
  |  | 1215|   548k|    uint32_t _x;				\
  |  | 1216|  9.29M|    for (_x = w; _x >= 8; _x -= 8) {	\
  |  |  ------------------
  |  |  |  Branch (1216:18): [True: 8.74M, False: 548k]
  |  |  ------------------
  |  | 1217|  8.74M|	op1;				\
  |  | 1218|  8.74M|	REPEAT8(op2);			\
  |  |  ------------------
  |  |  |  | 1198|  8.74M|#define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|  8.74M|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  8.74M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  8.74M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|  8.74M|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  8.74M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  8.74M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1219|  8.74M|    }					\
  |  | 1220|   548k|    if (_x > 0) {			\
  |  |  ------------------
  |  |  |  Branch (1220:9): [True: 511k, False: 36.9k]
  |  |  ------------------
  |  | 1221|   511k|	op1;				\
  |  | 1222|   511k|	CASE8(_x,op2);			\
  |  |  ------------------
  |  |  |  | 1202|   511k|    switch (x) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1202:13): [True: 0, False: 511k]
  |  |  |  |  ------------------
  |  |  |  | 1203|  13.9k|    case 7: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1203:5): [True: 13.9k, False: 497k]
  |  |  |  |  ------------------
  |  |  |  | 1204|  22.4k|    case 6: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1204:5): [True: 8.50k, False: 503k]
  |  |  |  |  ------------------
  |  |  |  | 1205|  23.7k|    case 5: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1205:5): [True: 1.26k, False: 510k]
  |  |  |  |  ------------------
  |  |  |  | 1206|  91.5k|    case 4: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1206:5): [True: 67.7k, False: 443k]
  |  |  |  |  ------------------
  |  |  |  | 1207|   421k|    case 3: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1207:5): [True: 329k, False: 181k]
  |  |  |  |  ------------------
  |  |  |  | 1208|   427k|    case 2: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1208:5): [True: 5.81k, False: 505k]
  |  |  |  |  ------------------
  |  |  |  | 1209|   511k|    case 1: op;				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1209:5): [True: 84.4k, False: 427k]
  |  |  |  |  ------------------
  |  |  |  | 1210|   511k|    }
  |  |  ------------------
  |  | 1223|   511k|    }					\
  |  | 1224|   548k|}
  ------------------
 1677|   548k|		SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1249|   548k|#define	SKEW4(r,g,b,a,skew)	{ r += skew; g += skew; b += skew; a+= skew; }
  ------------------
 1678|   548k|		cp += toskew;
 1679|   548k|	}
 1680|   133k|}
tif_getimage.c:putRGBUAseparate8bittile:
 1706|    247|{
 1707|    247|	(void) img; (void) y;
 1708|  2.88k|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1708:9): [True: 2.64k, False: 247]
  ------------------
 1709|  2.64k|		uint32_t rv, gv, bv, av;
 1710|  2.64k|		uint8_t* m;
 1711|   109k|		for (x = w; x > 0; --x) {
  ------------------
  |  Branch (1711:15): [True: 106k, False: 2.64k]
  ------------------
 1712|   106k|			av = *a++;
 1713|   106k|			m = img->UaToAa+((size_t) av<<8);
 1714|   106k|			rv = m[*r++];
 1715|   106k|			gv = m[*g++];
 1716|   106k|			bv = m[*b++];
 1717|   106k|			*cp++ = PACK4(rv,gv,bv,av);
  ------------------
  |  | 1255|   106k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|((uint32_t)(a)<<24))
  ------------------
 1718|   106k|		}
 1719|  2.64k|		SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1249|  2.64k|#define	SKEW4(r,g,b,a,skew)	{ r += skew; g += skew; b += skew; a+= skew; }
  ------------------
 1720|  2.64k|		cp += toskew;
 1721|  2.64k|	}
 1722|    247|}
tif_getimage.c:putRGBseparate8bittile:
 1660|  2.48k|{
 1661|  2.48k|    (void) img; (void) x; (void) y; (void) a;
 1662|   854k|    for( ; h > 0; --h) {
  ------------------
  |  Branch (1662:12): [True: 852k, False: 2.48k]
  ------------------
 1663|   852k|	UNROLL8(w, NOP, *cp++ = PACK(*r++, *g++, *b++));
  ------------------
  |  | 1214|   852k|#define	UNROLL8(w, op1, op2) {		\
  |  | 1215|   852k|    uint32_t _x;				\
  |  | 1216|  2.82M|    for (_x = w; _x >= 8; _x -= 8) {	\
  |  |  ------------------
  |  |  |  Branch (1216:18): [True: 1.97M, False: 852k]
  |  |  ------------------
  |  | 1217|  1.97M|	op1;				\
  |  | 1218|  1.97M|	REPEAT8(op2);			\
  |  |  ------------------
  |  |  |  | 1198|  1.97M|#define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|  1.97M|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  1.97M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  1.97M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define	REPEAT8(op)	REPEAT4(op); REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1199|  1.97M|#define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  1.97M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define	REPEAT4(op)	REPEAT2(op); REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1200|  1.97M|#define	REPEAT2(op)	op; op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1219|  1.97M|    }					\
  |  | 1220|   852k|    if (_x > 0) {			\
  |  |  ------------------
  |  |  |  Branch (1220:9): [True: 650k, False: 201k]
  |  |  ------------------
  |  | 1221|   650k|	op1;				\
  |  | 1222|   650k|	CASE8(_x,op2);			\
  |  |  ------------------
  |  |  |  | 1202|   650k|    switch (x) {			\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1202:13): [True: 0, False: 650k]
  |  |  |  |  ------------------
  |  |  |  | 1203|   161k|    case 7: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1203:5): [True: 161k, False: 489k]
  |  |  |  |  ------------------
  |  |  |  | 1204|   173k|    case 6: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1204:5): [True: 12.8k, False: 637k]
  |  |  |  |  ------------------
  |  |  |  | 1205|   175k|    case 5: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1205:5): [True: 1.77k, False: 648k]
  |  |  |  |  ------------------
  |  |  |  | 1206|   397k|    case 4: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1206:5): [True: 221k, False: 429k]
  |  |  |  |  ------------------
  |  |  |  | 1207|   529k|    case 3: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1207:5): [True: 132k, False: 517k]
  |  |  |  |  ------------------
  |  |  |  | 1208|   532k|    case 2: op; /*-fallthrough*/ \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1208:5): [True: 2.19k, False: 648k]
  |  |  |  |  ------------------
  |  |  |  | 1209|   650k|    case 1: op;				\
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1209:5): [True: 118k, False: 532k]
  |  |  |  |  ------------------
  |  |  |  | 1210|   650k|    }
  |  |  ------------------
  |  | 1223|   650k|    }					\
  |  | 1224|   852k|}
  ------------------
 1664|   852k|	SKEW(r, g, b, fromskew);
  ------------------
  |  | 1248|   852k|#define	SKEW(r,g,b,skew)	{ r += skew; g += skew; b += skew; }
  ------------------
 1665|   852k|	cp += toskew;
 1666|   852k|    }
 1667|  2.48k|}
tif_getimage.c:putRGBAAseparate16bittile:
 1747|    194|{
 1748|    194|	uint16_t *wr = (uint16_t*) r;
 1749|    194|	uint16_t *wg = (uint16_t*) g;
 1750|    194|	uint16_t *wb = (uint16_t*) b;
 1751|    194|	uint16_t *wa = (uint16_t*) a;
 1752|    194|	(void) img; (void) y;
 1753|  19.4k|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1753:9): [True: 19.2k, False: 194]
  ------------------
 1754|   530k|		for (x = 0; x < w; x++)
  ------------------
  |  Branch (1754:15): [True: 511k, False: 19.2k]
  ------------------
 1755|   511k|			*cp++ = PACK4(img->Bitdepth16To8[*wr++],
  ------------------
  |  | 1255|   511k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|((uint32_t)(a)<<24))
  ------------------
 1756|  19.2k|			    img->Bitdepth16To8[*wg++],
 1757|  19.2k|			    img->Bitdepth16To8[*wb++],
 1758|  19.2k|			    img->Bitdepth16To8[*wa++]);
 1759|  19.2k|		SKEW4(wr, wg, wb, wa, fromskew);
  ------------------
  |  | 1249|  19.2k|#define	SKEW4(r,g,b,a,skew)	{ r += skew; g += skew; b += skew; a+= skew; }
  ------------------
 1760|  19.2k|		cp += toskew;
 1761|  19.2k|	}
 1762|    194|}
tif_getimage.c:putRGBUAseparate16bittile:
 1768|  1.55k|{
 1769|  1.55k|	uint16_t *wr = (uint16_t*) r;
 1770|  1.55k|	uint16_t *wg = (uint16_t*) g;
 1771|  1.55k|	uint16_t *wb = (uint16_t*) b;
 1772|  1.55k|	uint16_t *wa = (uint16_t*) a;
 1773|  1.55k|	(void) img; (void) y;
 1774|  44.6k|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1774:9): [True: 43.1k, False: 1.55k]
  ------------------
 1775|  43.1k|		uint32_t r2,g2,b2,a2;
 1776|  43.1k|		uint8_t* m;
 1777|   682k|		for (x = w; x > 0; --x) {
  ------------------
  |  Branch (1777:15): [True: 639k, False: 43.1k]
  ------------------
 1778|   639k|			a2 = img->Bitdepth16To8[*wa++];
 1779|   639k|			m = img->UaToAa+((size_t) a2<<8);
 1780|   639k|			r2 = m[img->Bitdepth16To8[*wr++]];
 1781|   639k|			g2 = m[img->Bitdepth16To8[*wg++]];
 1782|   639k|			b2 = m[img->Bitdepth16To8[*wb++]];
 1783|   639k|			*cp++ = PACK4(r2,g2,b2,a2);
  ------------------
  |  | 1255|   639k|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|((uint32_t)(a)<<24))
  ------------------
 1784|   639k|		}
 1785|  43.1k|		SKEW4(wr, wg, wb, wa, fromskew);
  ------------------
  |  | 1249|  43.1k|#define	SKEW4(r,g,b,a,skew)	{ r += skew; g += skew; b += skew; a+= skew; }
  ------------------
 1786|  43.1k|		cp += toskew;
 1787|  43.1k|	}
 1788|  1.55k|}
tif_getimage.c:putRGBseparate16bittile:
 1728|  19.0k|{
 1729|  19.0k|	uint16_t *wr = (uint16_t*) r;
 1730|  19.0k|	uint16_t *wg = (uint16_t*) g;
 1731|  19.0k|	uint16_t *wb = (uint16_t*) b;
 1732|  19.0k|	(void) img; (void) y; (void) a;
 1733|   227k|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1733:9): [True: 208k, False: 19.0k]
  ------------------
 1734|  5.30M|		for (x = 0; x < w; x++)
  ------------------
  |  Branch (1734:15): [True: 5.09M, False: 208k]
  ------------------
 1735|  5.09M|			*cp++ = PACK(img->Bitdepth16To8[*wr++],
  ------------------
  |  | 1253|  5.09M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  ------------------
  |  |  |  | 1251|  5.09M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  ------------------
  ------------------
 1736|   208k|			    img->Bitdepth16To8[*wg++],
 1737|   208k|			    img->Bitdepth16To8[*wb++]);
 1738|   208k|		SKEW(wr, wg, wb, fromskew);
  ------------------
  |  | 1248|   208k|#define	SKEW(r,g,b,skew)	{ r += skew; g += skew; b += skew; }
  ------------------
 1739|   208k|		cp += toskew;
 1740|   208k|	}
 1741|  19.0k|}
tif_getimage.c:putCMYKseparate8bittile:
 1686|  6.29k|{
 1687|  6.29k|	(void) img; (void) y;
 1688|   792k|	for( ; h > 0; --h) {
  ------------------
  |  Branch (1688:9): [True: 785k, False: 6.29k]
  ------------------
 1689|   785k|		uint32_t rv, gv, bv, kv;
 1690|  7.04M|		for (x = w; x > 0; --x) {
  ------------------
  |  Branch (1690:15): [True: 6.26M, False: 785k]
  ------------------
 1691|  6.26M|			kv = 255 - *a++;
 1692|  6.26M|			rv = (kv*(255-*r++))/255;
 1693|  6.26M|			gv = (kv*(255-*g++))/255;
 1694|  6.26M|			bv = (kv*(255-*b++))/255;
 1695|  6.26M|			*cp++ = PACK4(rv,gv,bv,255);
  ------------------
  |  | 1255|  6.26M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|((uint32_t)(a)<<24))
  ------------------
 1696|  6.26M|		}
 1697|   785k|		SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1249|   785k|#define	SKEW4(r,g,b,a,skew)	{ r += skew; g += skew; b += skew; a+= skew; }
  ------------------
 1698|   785k|		cp += toskew;
 1699|   785k|	}
 1700|  6.29k|}
tif_getimage.c:putseparate8bitYCbCr11tile:
 2242|  10.7k|{
 2243|  10.7k|	(void) y;
 2244|  10.7k|	(void) a;
 2245|       |	/* TODO: naming of input vars is still off, change obfuscating declaration inside define, or resolve obfuscation */
 2246|   586k|	for( ; h > 0; --h) {
  ------------------
  |  Branch (2246:9): [True: 575k, False: 10.7k]
  ------------------
 2247|   575k|		x = w;
 2248|  34.7M|		do {
 2249|  34.7M|			uint32_t dr, dg, db;
 2250|  34.7M|			TIFFYCbCrtoRGB(img->ycbcr,*r++,*g++,*b++,&dr,&dg,&db);
 2251|  34.7M|			*cp++ = PACK(dr,dg,db);
  ------------------
  |  | 1253|  34.7M|	((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
  |  |  ------------------
  |  |  |  | 1251|  34.7M|#define A1 (((uint32_t)0xffL)<<24)
  |  |  ------------------
  ------------------
 2252|  34.7M|		} while (--x);
  ------------------
  |  Branch (2252:12): [True: 34.1M, False: 575k]
  ------------------
 2253|   575k|		SKEW(r, g, b, fromskew);
  ------------------
  |  | 1248|   575k|#define	SKEW(r,g,b,skew)	{ r += skew; g += skew; b += skew; }
  ------------------
 2254|   575k|		cp += toskew;
 2255|   575k|	}
 2256|  10.7k|}

TIFFInitJBIG:
  201|     10|{
  202|     10|        (void)scheme;
  203|     10|	assert(scheme == COMPRESSION_JBIG);
  204|       |
  205|       |	/*
  206|       |	 * These flags are set so the JBIG Codec can control when to reverse
  207|       |	 * bits and when not to and to allow the jbig decoder and bit reverser
  208|       |	 * to write to memory when necessary.
  209|       |	 */
  210|     10|	tif->tif_flags |= TIFF_NOBITREV;
  ------------------
  |  |   99|     10|	#define TIFF_NOBITREV    0x00100U /* inhibit bit reversal logic */
  ------------------
  211|     10|	tif->tif_flags &= ~TIFF_MAPPED;
  ------------------
  |  |  102|     10|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  ------------------
  212|       |	/* We may have read from a previous IFD and thus set TIFF_BUFFERMMAP and
  213|       |	 * cleared TIFF_MYBUFFER. It is necessary to restore them to their initial
  214|       |	 * value to be consistent with the state of a non-memory mapped file.
  215|       |	 */
  216|     10|	if (tif->tif_flags&TIFF_BUFFERMMAP) {
  ------------------
  |  |  114|     10|        #define TIFF_BUFFERMMAP 0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  |  Branch (216:6): [True: 0, False: 10]
  ------------------
  217|      0|		tif->tif_rawdata = NULL;
  218|      0|		tif->tif_rawdatasize = 0;
  219|      0|		tif->tif_flags &= ~TIFF_BUFFERMMAP;
  ------------------
  |  |  114|      0|        #define TIFF_BUFFERMMAP 0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  220|      0|		tif->tif_flags |= TIFF_MYBUFFER;
  ------------------
  |  |  100|      0|	#define TIFF_MYBUFFER    0x00200U /* my raw data buffer; free on close */
  ------------------
  221|      0|	}
  222|       |
  223|       |	/* Setup the function pointers for encode, decode, and cleanup. */
  224|     10|	tif->tif_setupdecode = JBIGSetupDecode;
  225|     10|	tif->tif_decodestrip = JBIGDecode;
  226|       |
  227|     10|	tif->tif_setupencode = JBIGSetupEncode;
  228|     10|	tif->tif_encodestrip = JBIGEncode;
  229|       |
  230|     10|	return 1;
  231|     10|}
tif_jbig.c:JBIGSetupDecode:
   39|      8|{
   40|      8|	if (TIFFNumberOfStrips(tif) != 1)
  ------------------
  |  Branch (40:6): [True: 1, False: 7]
  ------------------
   41|      1|	{
   42|      1|		TIFFErrorExtR(tif, "JBIG", "Multistrip images not supported in decoder");
   43|      1|		return 0;
   44|      1|	}
   45|       |
   46|      7|	return 1;
   47|      8|}

TIFFInitJPEG:
 2473|  5.32k|int TIFFInitJPEG(TIFF *tif, int scheme) {
 2474|  5.32k|  JPEGState *sp;
 2475|       |
 2476|  5.32k|  (void)scheme;
 2477|  5.32k|  assert(scheme == COMPRESSION_JPEG);
 2478|       |
 2479|       |  /*
 2480|       |   * Merge codec-specific tag information.
 2481|       |   */
 2482|  5.32k|  if (!_TIFFMergeFields(tif, jpegFields, TIFFArrayCount(jpegFields))) {
  ------------------
  |  |  261|  5.32k|#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
  ------------------
  |  Branch (2482:7): [True: 0, False: 5.32k]
  ------------------
 2483|      0|    TIFFErrorExtR(tif, "TIFFInitJPEG",
 2484|      0|                 "Merging JPEG codec-specific tags failed");
 2485|      0|    return 0;
 2486|      0|  }
 2487|       |
 2488|       |  /*
 2489|       |   * Allocate state block so tag methods have storage to record values.
 2490|       |   */
 2491|  5.32k|  tif->tif_data = (uint8_t *)_TIFFmalloc(sizeof(JPEGState));
 2492|       |
 2493|  5.32k|  if (tif->tif_data == NULL) {
  ------------------
  |  Branch (2493:7): [True: 0, False: 5.32k]
  ------------------
 2494|      0|    TIFFErrorExtR(tif, "TIFFInitJPEG",
 2495|      0|                 "No space for JPEG state block");
 2496|      0|    return 0;
 2497|      0|  }
 2498|  5.32k|  _TIFFmemset(tif->tif_data, 0, sizeof(JPEGState));
 2499|       |
 2500|  5.32k|  sp = JState(tif);
  ------------------
  |  |  201|  5.32k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2501|       |  /*
 2502|       |   * Override parent get/set field methods.
 2503|       |   */
 2504|  5.32k|  sp->otherSettings.vgetparent = tif->tif_tagmethods.vgetfield;
 2505|  5.32k|  sp->otherSettings.vsetparent = tif->tif_tagmethods.vsetfield;
 2506|  5.32k|  sp->otherSettings.printdir = tif->tif_tagmethods.printdir;
 2507|       |
 2508|  5.32k|  sp->otherSettings.defsparent = tif->tif_defstripsize;
 2509|  5.32k|  sp->otherSettings.deftparent = tif->tif_deftilesize;
 2510|       |
 2511|  5.32k|  TIFFInitJPEGCommon(tif);
 2512|       |
 2513|       |  /*
 2514|       |  ** Create a JPEGTables field if no directory has yet been created.
 2515|       |  ** We do this just to ensure that sufficient space is reserved for
 2516|       |  ** the JPEGTables field.  It will be properly created the right
 2517|       |  ** size later.
 2518|       |  */
 2519|  5.32k|  if (tif->tif_diroff == 0) {
  ------------------
  |  Branch (2519:7): [True: 0, False: 5.32k]
  ------------------
 2520|      0|#define SIZE_OF_JPEGTABLES 2000
 2521|       |    /*
 2522|       |    The following line assumes incorrectly that all JPEG-in-TIFF files will have
 2523|       |    a JPEGTABLES tag generated and causes null-filled JPEGTABLES tags to be
 2524|       |    written when the JPEG data is placed with TIFFWriteRawStrip.  The field bit
 2525|       |    should be set, anyway, later when actual JPEGTABLES header is generated, so
 2526|       |    removing it here hopefully is harmless. TIFFSetFieldBit(tif,
 2527|       |    FIELD_JPEGTABLES);
 2528|       |    */
 2529|      0|    sp->otherSettings.jpegtables_length = SIZE_OF_JPEGTABLES;
  ------------------
  |  | 2520|      0|#define SIZE_OF_JPEGTABLES 2000
  ------------------
 2530|      0|    sp->otherSettings.jpegtables =
 2531|      0|        (void *)_TIFFmalloc(sp->otherSettings.jpegtables_length);
 2532|      0|    if (sp->otherSettings.jpegtables) {
  ------------------
  |  Branch (2532:9): [True: 0, False: 0]
  ------------------
 2533|      0|      _TIFFmemset(sp->otherSettings.jpegtables, 0, SIZE_OF_JPEGTABLES);
  ------------------
  |  | 2520|      0|#define SIZE_OF_JPEGTABLES 2000
  ------------------
 2534|      0|    } else {
 2535|      0|      TIFFErrorExtR(tif, "TIFFInitJPEG",
 2536|      0|                   "Failed to allocate memory for JPEG tables");
 2537|      0|      return 0;
 2538|      0|    }
 2539|      0|#undef SIZE_OF_JPEGTABLES
 2540|      0|  }
 2541|  5.32k|  return 1;
 2542|  5.32k|}
tif_jpeg.c:TIFFjpeg_create_decompress:
  305|  3.81k|static int TIFFjpeg_create_decompress(JPEGState *sp) {
  306|       |  /* initialize JPEG error handling */
  307|  3.81k|  sp->cinfo.d.err = jpeg_std_error(&sp->err);
  308|  3.81k|  sp->err.error_exit = TIFFjpeg_error_exit;
  309|  3.81k|  sp->err.output_message = TIFFjpeg_output_message;
  310|       |
  311|       |  /* set client_data to avoid UMR warning from tools like Purify */
  312|  3.81k|  sp->cinfo.d.client_data = NULL;
  313|       |
  314|  3.81k|  return CALLVJPEG(sp, jpeg_create_decompress(&sp->cinfo.d));
  ------------------
  |  |  291|  3.81k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  290|  3.81k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.81k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  315|  3.81k|}
tif_jpeg.c:TIFFjpeg_error_exit:
  236|   122k|static void TIFFjpeg_error_exit(j_common_ptr cinfo) {
  237|   122k|  JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  238|   122k|  char buffer[JMSG_LENGTH_MAX];
  239|       |
  240|   122k|  (*cinfo->err->format_message)(cinfo, buffer);
  241|   122k|  TIFFErrorExtR(sp->tif, "JPEGLib", "%s",
  242|   122k|               buffer);        /* display the error message */
  243|   122k|  jpeg_abort(cinfo);           /* clean up libjpeg state */
  244|   122k|  LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
  ------------------
  |  |  149|   122k|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
  245|   122k|}
tif_jpeg.c:TIFFjpeg_output_message:
  252|  75.2k|static void TIFFjpeg_output_message(j_common_ptr cinfo) {
  253|  75.2k|  char buffer[JMSG_LENGTH_MAX];
  254|       |
  255|  75.2k|  (*cinfo->err->format_message)(cinfo, buffer);
  256|  75.2k|  TIFFWarningExtR(((JPEGState *)cinfo)->tif, "JPEGLib", "%s",
  257|  75.2k|                 buffer);
  258|  75.2k|}
tif_jpeg.c:TIFFjpeg_data_src:
  600|  3.81k|static void TIFFjpeg_data_src(JPEGState *sp) {
  601|  3.81k|  sp->cinfo.d.src = &sp->src;
  602|  3.81k|  sp->src.init_source = std_init_source;
  603|  3.81k|  sp->src.fill_input_buffer = std_fill_input_buffer;
  604|  3.81k|  sp->src.skip_input_data = std_skip_input_data;
  605|  3.81k|  sp->src.resync_to_restart = jpeg_resync_to_restart;
  606|  3.81k|  sp->src.term_source = std_term_source;
  607|  3.81k|  sp->src.bytes_in_buffer = 0; /* for safety */
  608|  3.81k|  sp->src.next_input_byte = NULL;
  609|  3.81k|}
tif_jpeg.c:std_init_source:
  539|   148k|static void std_init_source(j_decompress_ptr cinfo) {
  540|   148k|  JPEGState *sp = (JPEGState *)cinfo;
  541|   148k|  TIFF *tif = sp->tif;
  542|       |
  543|   148k|  sp->src.next_input_byte = (const JOCTET *)tif->tif_rawdata;
  544|   148k|  sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
  545|   148k|}
tif_jpeg.c:std_fill_input_buffer:
  547|   275k|static boolean std_fill_input_buffer(j_decompress_ptr cinfo) {
  548|   275k|  JPEGState *sp = (JPEGState *)cinfo;
  549|   275k|  static const JOCTET dummy_EOI[2] = {0xFF, JPEG_EOI};
  550|       |
  551|       |#ifdef IPPJ_HUFF
  552|       |  /*
  553|       |   * The Intel IPP performance library does not necessarily read the whole
  554|       |   * input buffer in one pass, so it is possible to get here with data
  555|       |   * yet to read.
  556|       |   *
  557|       |   * We just return without doing anything, until the entire buffer has
  558|       |   * been read.
  559|       |   * http://trac.osgeo.org/gdal/wiki/JpegIPP
  560|       |   */
  561|       |  if (sp->src.bytes_in_buffer > 0) {
  562|       |    return (TRUE);
  563|       |  }
  564|       |#endif
  565|       |
  566|       |  /*
  567|       |   * Normally the whole strip/tile is read and so we don't need to do
  568|       |   * a fill.  In the case of CHUNKY_STRIP_READ_SUPPORT we might not have
  569|       |   * all the data, but the rawdata is refreshed between scanlines and
  570|       |   * we push this into the io machinery in JPEGDecode().
  571|       |   * http://trac.osgeo.org/gdal/ticket/3894
  572|       |   */
  573|       |
  574|   275k|  WARNMS(cinfo, JWRN_JPEG_EOF);
  575|       |  /* insert a fake EOI marker */
  576|   275k|  sp->src.next_input_byte = dummy_EOI;
  577|   275k|  sp->src.bytes_in_buffer = 2;
  578|   275k|  return (TRUE);
  ------------------
  |  |   61|   275k|#define	TRUE	1
  ------------------
  579|   275k|}
tif_jpeg.c:std_skip_input_data:
  581|  50.7k|static void std_skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
  582|  50.7k|  JPEGState *sp = (JPEGState *)cinfo;
  583|       |
  584|  50.7k|  if (num_bytes > 0) {
  ------------------
  |  Branch (584:7): [True: 50.7k, False: 0]
  ------------------
  585|  50.7k|    if ((size_t)num_bytes > sp->src.bytes_in_buffer) {
  ------------------
  |  Branch (585:9): [True: 9.13k, False: 41.6k]
  ------------------
  586|       |      /* oops, buffer overrun */
  587|  9.13k|      (void)std_fill_input_buffer(cinfo);
  588|  41.6k|    } else {
  589|  41.6k|      sp->src.next_input_byte += (size_t)num_bytes;
  590|  41.6k|      sp->src.bytes_in_buffer -= (size_t)num_bytes;
  591|  41.6k|    }
  592|  50.7k|  }
  593|  50.7k|}
tif_jpeg.c:std_term_source:
  595|  22.9k|static void std_term_source(j_decompress_ptr cinfo) {
  596|       |  /* No work necessary here */
  597|  22.9k|  (void)cinfo;
  598|  22.9k|}
tif_jpeg.c:TIFFjpeg_read_header:
  360|   148k|static int TIFFjpeg_read_header(JPEGState *sp, boolean require_image) {
  361|   148k|  return CALLJPEG(sp, -1, jpeg_read_header(&sp->cinfo.d, require_image));
  ------------------
  |  |  290|   148k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  148|   148k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  362|   148k|}
tif_jpeg.c:TIFFjpeg_destroy:
  404|  3.81k|static int TIFFjpeg_destroy(JPEGState *sp) {
  405|  3.81k|  return CALLVJPEG(sp, jpeg_destroy(&sp->cinfo.comm));
  ------------------
  |  |  291|  3.81k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  290|  3.81k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  3.81k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  406|  3.81k|}
tif_jpeg.c:TIFFjpeg_has_multiple_scans:
  364|  40.9k|static int TIFFjpeg_has_multiple_scans(JPEGState *sp) {
  365|  40.9k|  return CALLJPEG(sp, 0, jpeg_has_multiple_scans(&sp->cinfo.d));
  ------------------
  |  |  290|  40.9k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  148|  40.9k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  366|  40.9k|}
tif_jpeg.c:TIFFInitJPEGCommon:
 2432|  5.32k|static void TIFFInitJPEGCommon(TIFF *tif) {
 2433|  5.32k|  JPEGState *sp;
 2434|       |
 2435|  5.32k|  sp = JState(tif);
  ------------------
  |  |  201|  5.32k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2436|  5.32k|  sp->tif = tif; /* back link */
 2437|       |
 2438|       |  /* Default values for codec-specific fields */
 2439|  5.32k|  sp->otherSettings.jpegtables = NULL;
 2440|  5.32k|  sp->otherSettings.jpegtables_length = 0;
 2441|  5.32k|  sp->otherSettings.jpegquality = 75; /* Default IJG quality */
 2442|  5.32k|  sp->otherSettings.jpegcolormode = JPEGCOLORMODE_RAW;
  ------------------
  |  |  617|  5.32k|#define	    JPEGCOLORMODE_RAW	0x0000		/* no conversion (default) */
  ------------------
 2443|  5.32k|  sp->otherSettings.jpegtablesmode = JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  620|  5.32k|#define	    JPEGTABLESMODE_QUANT 0x0001		/* include quantization tbls */
  ------------------
                sp->otherSettings.jpegtablesmode = JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  621|  5.32k|#define	    JPEGTABLESMODE_HUFF	0x0002		/* include Huffman tbls */
  ------------------
 2444|  5.32k|  sp->otherSettings.ycbcrsampling_fetched = 0;
 2445|       |
 2446|  5.32k|  tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */
 2447|  5.32k|  tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */
 2448|  5.32k|  tif->tif_tagmethods.printdir = JPEGPrintDir;   /* hook for codec tags */
 2449|       |
 2450|       |  /*
 2451|       |   * Install codec methods.
 2452|       |   */
 2453|  5.32k|  tif->tif_fixuptags = JPEGFixupTags;
 2454|  5.32k|  tif->tif_setupdecode = JPEGSetupDecode;
 2455|  5.32k|  tif->tif_predecode = JPEGPreDecode;
 2456|  5.32k|  tif->tif_decoderow = JPEGDecode;
 2457|  5.32k|  tif->tif_decodestrip = JPEGDecode;
 2458|  5.32k|  tif->tif_decodetile = JPEGDecode;
 2459|  5.32k|  tif->tif_setupencode = JPEGSetupEncode;
 2460|  5.32k|  tif->tif_preencode = JPEGPreEncode;
 2461|  5.32k|  tif->tif_postencode = JPEGPostEncode;
 2462|  5.32k|  tif->tif_encoderow = JPEGEncode;
 2463|  5.32k|  tif->tif_encodestrip = JPEGEncode;
 2464|  5.32k|  tif->tif_encodetile = JPEGEncode;
 2465|  5.32k|  tif->tif_cleanup = JPEGCleanup;
 2466|       |
 2467|  5.32k|  tif->tif_defstripsize = JPEGDefaultStripSize;
 2468|  5.32k|  tif->tif_deftilesize = JPEGDefaultTileSize;
 2469|  5.32k|  tif->tif_flags |= TIFF_NOBITREV; /* no bit reversal, please */
  ------------------
  |  |   99|  5.32k|	#define TIFF_NOBITREV    0x00100U /* inhibit bit reversal logic */
  ------------------
 2470|  5.32k|  sp->cinfo_initialized = FALSE;
  ------------------
  |  |   62|  5.32k|#define	FALSE	0
  ------------------
 2471|  5.32k|}
tif_jpeg.c:JPEGVGetField:
 2303|  60.7k|static int JPEGVGetField(TIFF *tif, uint32_t tag, va_list ap) {
 2304|  60.7k|  JPEGState *sp = JState(tif);
  ------------------
  |  |  201|  60.7k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2305|       |
 2306|  60.7k|  assert(sp != NULL);
 2307|       |
 2308|  60.7k|  switch (tag) {
 2309|      0|  case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  344|      0|#define	TIFFTAG_JPEGTABLES		347	/* %JPEG table stream */
  ------------------
  |  Branch (2309:3): [True: 0, False: 60.7k]
  ------------------
 2310|      0|    *va_arg(ap, uint32_t *) = sp->otherSettings.jpegtables_length;
 2311|      0|    *va_arg(ap, const void **) = sp->otherSettings.jpegtables;
 2312|      0|    break;
 2313|      0|  case TIFFTAG_JPEGQUALITY:
  ------------------
  |  |  614|      0|#define	TIFFTAG_JPEGQUALITY		65537	/* Compression quality level */
  ------------------
  |  Branch (2313:3): [True: 0, False: 60.7k]
  ------------------
 2314|      0|    *va_arg(ap, int *) = sp->otherSettings.jpegquality;
 2315|      0|    break;
 2316|      0|  case TIFFTAG_JPEGCOLORMODE:
  ------------------
  |  |  616|      0|#define	TIFFTAG_JPEGCOLORMODE		65538	/* Auto RGB<=>YCbCr convert? */
  ------------------
  |  Branch (2316:3): [True: 0, False: 60.7k]
  ------------------
 2317|      0|    *va_arg(ap, int *) = sp->otherSettings.jpegcolormode;
 2318|      0|    break;
 2319|      0|  case TIFFTAG_JPEGTABLESMODE:
  ------------------
  |  |  619|      0|#define	TIFFTAG_JPEGTABLESMODE		65539	/* What to put in JPEGTables */
  ------------------
  |  Branch (2319:3): [True: 0, False: 60.7k]
  ------------------
 2320|      0|    *va_arg(ap, int *) = sp->otherSettings.jpegtablesmode;
 2321|      0|    break;
 2322|  60.7k|  default:
  ------------------
  |  Branch (2322:3): [True: 60.7k, False: 0]
  ------------------
 2323|  60.7k|    return (*sp->otherSettings.vgetparent)(tif, tag, ap);
 2324|  60.7k|  }
 2325|      0|  return (1);
 2326|  60.7k|}
tif_jpeg.c:JPEGVSetField:
 2251|  30.3k|static int JPEGVSetField(TIFF *tif, uint32_t tag, va_list ap) {
 2252|  30.3k|  JPEGState *sp = JState(tif);
  ------------------
  |  |  201|  30.3k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2253|  30.3k|  const TIFFField *fip;
 2254|  30.3k|  uint32_t v32;
 2255|       |
 2256|  30.3k|  assert(sp != NULL);
 2257|       |
 2258|  30.3k|  switch (tag) {
 2259|      5|  case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  344|      5|#define	TIFFTAG_JPEGTABLES		347	/* %JPEG table stream */
  ------------------
  |  Branch (2259:3): [True: 5, False: 30.3k]
  ------------------
 2260|      5|    v32 = (uint32_t)va_arg(ap, uint32_t);
 2261|      5|    if (v32 == 0) {
  ------------------
  |  Branch (2261:9): [True: 2, False: 3]
  ------------------
 2262|       |      /* XXX */
 2263|      2|      return (0);
 2264|      2|    }
 2265|      3|    _TIFFsetByteArray(&sp->otherSettings.jpegtables, va_arg(ap, void *), v32);
 2266|      3|    sp->otherSettings.jpegtables_length = v32;
 2267|      3|    TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
  ------------------
  |  |  199|      3|#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  197|      3|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  196|      3|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
 2268|      3|    break;
 2269|      0|  case TIFFTAG_JPEGQUALITY:
  ------------------
  |  |  614|      0|#define	TIFFTAG_JPEGQUALITY		65537	/* Compression quality level */
  ------------------
  |  Branch (2269:3): [True: 0, False: 30.3k]
  ------------------
 2270|      0|    sp->otherSettings.jpegquality = (int)va_arg(ap, int);
 2271|      0|    return (1); /* pseudo tag */
 2272|  1.61k|  case TIFFTAG_JPEGCOLORMODE:
  ------------------
  |  |  616|  1.61k|#define	TIFFTAG_JPEGCOLORMODE		65538	/* Auto RGB<=>YCbCr convert? */
  ------------------
  |  Branch (2272:3): [True: 1.61k, False: 28.7k]
  ------------------
 2273|  1.61k|    sp->otherSettings.jpegcolormode = (int)va_arg(ap, int);
 2274|  1.61k|    JPEGResetUpsampled(tif);
 2275|  1.61k|    return (1); /* pseudo tag */
 2276|  2.10k|  case TIFFTAG_PHOTOMETRIC: {
  ------------------
  |  |  214|  2.10k|#define	TIFFTAG_PHOTOMETRIC		262	/* photometric interpretation */
  ------------------
  |  Branch (2276:3): [True: 2.10k, False: 28.2k]
  ------------------
 2277|  2.10k|    int ret_value = (*sp->otherSettings.vsetparent)(tif, tag, ap);
 2278|  2.10k|    JPEGResetUpsampled(tif);
 2279|  2.10k|    return ret_value;
 2280|      5|  }
 2281|      0|  case TIFFTAG_JPEGTABLESMODE:
  ------------------
  |  |  619|      0|#define	TIFFTAG_JPEGTABLESMODE		65539	/* What to put in JPEGTables */
  ------------------
  |  Branch (2281:3): [True: 0, False: 30.3k]
  ------------------
 2282|      0|    sp->otherSettings.jpegtablesmode = (int)va_arg(ap, int);
 2283|      0|    return (1); /* pseudo tag */
 2284|      5|  case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  386|      5|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
  |  Branch (2284:3): [True: 5, False: 30.3k]
  ------------------
 2285|       |    /* mark the fact that we have a real ycbcrsubsampling! */
 2286|      5|    sp->otherSettings.ycbcrsampling_fetched = 1;
 2287|       |    /* should we be recomputing upsampling info here? */
 2288|      5|    return (*sp->otherSettings.vsetparent)(tif, tag, ap);
 2289|  26.6k|  default:
  ------------------
  |  Branch (2289:3): [True: 26.6k, False: 3.73k]
  ------------------
 2290|  26.6k|    return (*sp->otherSettings.vsetparent)(tif, tag, ap);
 2291|  30.3k|  }
 2292|       |
 2293|      3|  if ((fip = TIFFFieldWithTag(tif, tag)) != NULL) {
  ------------------
  |  Branch (2293:7): [True: 3, False: 0]
  ------------------
 2294|      3|    TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  199|      3|#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  197|      3|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  196|      3|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
 2295|      3|  } else {
 2296|      0|    return (0);
 2297|      0|  }
 2298|       |
 2299|      3|  tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |   94|      3|	#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 2300|      3|  return (1);
 2301|      3|}
tif_jpeg.c:JPEGResetUpsampled:
 2219|  3.72k|static void JPEGResetUpsampled(TIFF *tif) {
 2220|  3.72k|  JPEGState *sp = JState(tif);
  ------------------
  |  |  201|  3.72k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2221|  3.72k|  TIFFDirectory *td = &tif->tif_dir;
 2222|       |
 2223|       |  /*
 2224|       |   * Mark whether returned data is up-sampled or not so TIFFStripSize
 2225|       |   * and TIFFTileSize return values that reflect the true amount of
 2226|       |   * data.
 2227|       |   */
 2228|  3.72k|  tif->tif_flags &= ~TIFF_UPSAMPLED;
  ------------------
  |  |  105|  3.72k|	#define TIFF_UPSAMPLED   0x04000U /* library is doing data up-sampling */
  ------------------
 2229|  3.72k|  if (td->td_planarconfig == PLANARCONFIG_CONTIG) {
  ------------------
  |  |  259|  3.72k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (2229:7): [True: 3.70k, False: 22]
  ------------------
 2230|  3.70k|    if (td->td_photometric == PHOTOMETRIC_YCBCR &&
  ------------------
  |  |  221|  7.40k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (2230:9): [True: 3.68k, False: 21]
  ------------------
 2231|  3.70k|        sp->otherSettings.jpegcolormode == JPEGCOLORMODE_RGB) {
  ------------------
  |  |  618|  3.68k|#define	    JPEGCOLORMODE_RGB	0x0001		/* do auto conversion */
  ------------------
  |  Branch (2231:9): [True: 1.61k, False: 2.06k]
  ------------------
 2232|  1.61k|      tif->tif_flags |= TIFF_UPSAMPLED;
  ------------------
  |  |  105|  1.61k|	#define TIFF_UPSAMPLED   0x04000U /* library is doing data up-sampling */
  ------------------
 2233|  2.08k|    } else {
 2234|       |#ifdef notdef
 2235|       |      if (td->td_ycbcrsubsampling[0] != 1 || td->td_ycbcrsubsampling[1] != 1)
 2236|       |        ; /* XXX what about up-sampling? */
 2237|       |#endif
 2238|  2.08k|    }
 2239|  3.70k|  }
 2240|       |
 2241|       |  /*
 2242|       |   * Must recalculate cached tile size in case sampling state changed.
 2243|       |   * Should we really be doing this now if image size isn't set?
 2244|       |   */
 2245|  3.72k|  if (tif->tif_tilesize > 0)
  ------------------
  |  Branch (2245:7): [True: 1.61k, False: 2.10k]
  ------------------
 2246|  1.61k|    tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)(-1);
  ------------------
  |  |  207|  1.61k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  1.61k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 1.61k, False: 0]
  |  |  ------------------
  ------------------
 2247|  3.72k|  if (tif->tif_scanlinesize > 0)
  ------------------
  |  Branch (2247:7): [True: 1.61k, False: 2.10k]
  ------------------
 2248|  1.61k|    tif->tif_scanlinesize = TIFFScanlineSize(tif);
 2249|  3.72k|}
tif_jpeg.c:JPEGFixupTags:
  699|  5.15k|static int JPEGFixupTags(TIFF *tif) {
  700|  5.15k|#ifdef CHECK_JPEG_YCBCR_SUBSAMPLING
  701|  5.15k|  JPEGState *sp = JState(tif);
  ------------------
  |  |  201|  5.15k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
  702|  5.15k|  if ((tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  221|  5.15k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (702:7): [True: 2.05k, False: 3.10k]
  ------------------
  703|  5.15k|      (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  259|  2.05k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (703:7): [True: 2.04k, False: 1]
  ------------------
  704|  5.15k|      (tif->tif_dir.td_samplesperpixel == 3) &&
  ------------------
  |  Branch (704:7): [True: 2.02k, False: 29]
  ------------------
  705|  5.15k|      !sp->otherSettings.ycbcrsampling_fetched)
  ------------------
  |  Branch (705:7): [True: 2.01k, False: 1]
  ------------------
  706|  2.01k|    JPEGFixupTagsSubsampling(tif);
  707|  5.15k|#endif
  708|       |
  709|  5.15k|  return (1);
  710|  5.15k|}
tif_jpeg.c:JPEGFixupTagsSubsampling:
  714|  2.01k|static void JPEGFixupTagsSubsampling(TIFF *tif) {
  715|       |  /*
  716|       |   * Some JPEG-in-TIFF produces do not emit the YCBCRSUBSAMPLING values in
  717|       |   * the TIFF tags, but still use non-default (2,2) values within the jpeg
  718|       |   * data stream itself.  In order for TIFF applications to work properly
  719|       |   * - for instance to get the strip buffer size right - it is imperative
  720|       |   * that the subsampling be available before we start reading the image
  721|       |   * data normally.  This function will attempt to analyze the first strip in
  722|       |   * order to get the sampling values from the jpeg data stream.
  723|       |   *
  724|       |   * Note that JPEGPreDeocode() will produce a fairly loud warning when the
  725|       |   * discovered sampling does not match the default sampling (2,2) or whatever
  726|       |   * was actually in the tiff tags.
  727|       |   *
  728|       |   * See the bug in bugzilla for details:
  729|       |   *
  730|       |   * http://bugzilla.remotesensing.org/show_bug.cgi?id=168
  731|       |   *
  732|       |   * Frank Warmerdam, July 2002
  733|       |   * Joris Van Damme, May 2007
  734|       |   */
  735|  2.01k|  static const char module[] = "JPEGFixupTagsSubsampling";
  736|  2.01k|  struct JPEGFixupTagsSubsamplingData m;
  737|  2.01k|  uint64_t fileoffset = TIFFGetStrileOffset(tif, 0);
  738|       |
  739|  2.01k|  if (fileoffset == 0) {
  ------------------
  |  Branch (739:7): [True: 6, False: 2.01k]
  ------------------
  740|       |    /* Do not even try to check if the first strip/tile does not
  741|       |       yet exist, as occurs when GDAL has created a new NULL file
  742|       |       for instance. */
  743|      6|    return;
  744|      6|  }
  745|       |
  746|  2.01k|  m.tif = tif;
  747|  2.01k|  m.buffersize = 2048;
  748|  2.01k|  m.buffer = _TIFFmalloc(m.buffersize);
  749|  2.01k|  if (m.buffer == NULL) {
  ------------------
  |  Branch (749:7): [True: 0, False: 2.01k]
  ------------------
  750|      0|    TIFFWarningExtR(tif, module,
  751|      0|                   "Unable to allocate memory for auto-correcting of "
  752|      0|                   "subsampling values; auto-correcting skipped");
  753|      0|    return;
  754|      0|  }
  755|  2.01k|  m.buffercurrentbyte = NULL;
  756|  2.01k|  m.bufferbytesleft = 0;
  757|  2.01k|  m.fileoffset = fileoffset;
  758|  2.01k|  m.filepositioned = 0;
  759|  2.01k|  m.filebytesleft = TIFFGetStrileByteCount(tif, 0);
  760|  2.01k|  if (!JPEGFixupTagsSubsamplingSec(&m))
  ------------------
  |  Branch (760:7): [True: 1.44k, False: 573]
  ------------------
  761|  1.44k|    TIFFWarningExtR(
  762|  1.44k|        tif, module,
  763|  1.44k|        "Unable to auto-correct subsampling values, likely corrupt JPEG "
  764|  1.44k|        "compressed data in first strip/tile; auto-correcting skipped");
  765|  2.01k|  _TIFFfree(m.buffer);
  766|  2.01k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingSec:
  769|  2.01k|JPEGFixupTagsSubsamplingSec(struct JPEGFixupTagsSubsamplingData *data) {
  770|  2.01k|  static const char module[] = "JPEGFixupTagsSubsamplingSec";
  771|  2.01k|  uint8_t m;
  772|   112k|  while (1) {
  ------------------
  |  Branch (772:10): [Folded - Ignored]
  ------------------
  773|  1.76M|    while (1) {
  ------------------
  |  Branch (773:12): [Folded - Ignored]
  ------------------
  774|  1.76M|      if (!JPEGFixupTagsSubsamplingReadByte(data, &m))
  ------------------
  |  Branch (774:11): [True: 453, False: 1.76M]
  ------------------
  775|    453|        return (0);
  776|  1.76M|      if (m == 255)
  ------------------
  |  Branch (776:11): [True: 111k, False: 1.65M]
  ------------------
  777|   111k|        break;
  778|  1.76M|    }
  779|   507k|    while (1) {
  ------------------
  |  Branch (779:12): [Folded - Ignored]
  ------------------
  780|   507k|      if (!JPEGFixupTagsSubsamplingReadByte(data, &m))
  ------------------
  |  Branch (780:11): [True: 108, False: 507k]
  ------------------
  781|    108|        return (0);
  782|   507k|      if (m != 255)
  ------------------
  |  Branch (782:11): [True: 111k, False: 395k]
  ------------------
  783|   111k|        break;
  784|   507k|    }
  785|   111k|    switch (m) {
  786|  3.48k|    case JPEG_MARKER_SOI:
  ------------------
  |  |  668|  3.48k|#define JPEG_MARKER_SOI 0xD8
  ------------------
  |  Branch (786:5): [True: 3.48k, False: 108k]
  ------------------
  787|       |      /* this type of marker has no data and should be skipped */
  788|  3.48k|      break;
  789|  5.55k|    case JPEG_MARKER_COM:
  ------------------
  |  |  673|  5.55k|#define JPEG_MARKER_COM 0xFE
  ------------------
  |  Branch (789:5): [True: 5.55k, False: 106k]
  ------------------
  790|  49.3k|    case JPEG_MARKER_APP0:
  ------------------
  |  |  672|  49.3k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (790:5): [True: 43.7k, False: 68.0k]
  ------------------
  791|  49.8k|    case JPEG_MARKER_APP0 + 1:
  ------------------
  |  |  672|  49.8k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (791:5): [True: 538, False: 111k]
  ------------------
  792|  55.2k|    case JPEG_MARKER_APP0 + 2:
  ------------------
  |  |  672|  55.2k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (792:5): [True: 5.35k, False: 106k]
  ------------------
  793|  55.7k|    case JPEG_MARKER_APP0 + 3:
  ------------------
  |  |  672|  55.7k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (793:5): [True: 577, False: 111k]
  ------------------
  794|  56.1k|    case JPEG_MARKER_APP0 + 4:
  ------------------
  |  |  672|  56.1k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (794:5): [True: 362, False: 111k]
  ------------------
  795|  56.7k|    case JPEG_MARKER_APP0 + 5:
  ------------------
  |  |  672|  56.7k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (795:5): [True: 585, False: 111k]
  ------------------
  796|  82.6k|    case JPEG_MARKER_APP0 + 6:
  ------------------
  |  |  672|  82.6k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (796:5): [True: 25.8k, False: 85.9k]
  ------------------
  797|  82.8k|    case JPEG_MARKER_APP0 + 7:
  ------------------
  |  |  672|  82.8k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (797:5): [True: 256, False: 111k]
  ------------------
  798|  83.1k|    case JPEG_MARKER_APP0 + 8:
  ------------------
  |  |  672|  83.1k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (798:5): [True: 291, False: 111k]
  ------------------
  799|  83.6k|    case JPEG_MARKER_APP0 + 9:
  ------------------
  |  |  672|  83.6k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (799:5): [True: 474, False: 111k]
  ------------------
  800|  83.8k|    case JPEG_MARKER_APP0 + 10:
  ------------------
  |  |  672|  83.8k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (800:5): [True: 239, False: 111k]
  ------------------
  801|  87.5k|    case JPEG_MARKER_APP0 + 11:
  ------------------
  |  |  672|  87.5k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (801:5): [True: 3.70k, False: 108k]
  ------------------
  802|  94.8k|    case JPEG_MARKER_APP0 + 12:
  ------------------
  |  |  672|  94.8k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (802:5): [True: 7.27k, False: 104k]
  ------------------
  803|  95.2k|    case JPEG_MARKER_APP0 + 13:
  ------------------
  |  |  672|  95.2k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (803:5): [True: 419, False: 111k]
  ------------------
  804|   101k|    case JPEG_MARKER_APP0 + 14:
  ------------------
  |  |  672|   101k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (804:5): [True: 6.16k, False: 105k]
  ------------------
  805|   104k|    case JPEG_MARKER_APP0 + 15:
  ------------------
  |  |  672|   104k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (805:5): [True: 3.07k, False: 108k]
  ------------------
  806|   105k|    case JPEG_MARKER_DQT:
  ------------------
  |  |  670|   105k|#define JPEG_MARKER_DQT 0xDB
  ------------------
  |  Branch (806:5): [True: 1.23k, False: 110k]
  ------------------
  807|   106k|    case JPEG_MARKER_SOS:
  ------------------
  |  |  669|   106k|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (807:5): [True: 398, False: 111k]
  ------------------
  808|   106k|    case JPEG_MARKER_DHT:
  ------------------
  |  |  667|   106k|#define JPEG_MARKER_DHT 0xC4
  ------------------
  |  Branch (808:5): [True: 605, False: 111k]
  ------------------
  809|   107k|    case JPEG_MARKER_DRI:
  ------------------
  |  |  671|   107k|#define JPEG_MARKER_DRI 0xDD
  ------------------
  |  Branch (809:5): [True: 418, False: 111k]
  ------------------
  810|       |      /* this type of marker has data, but it has no use to us and should be
  811|       |       * skipped */
  812|   107k|      {
  813|   107k|        uint16_t n;
  814|   107k|        if (!JPEGFixupTagsSubsamplingReadWord(data, &n))
  ------------------
  |  Branch (814:13): [True: 229, False: 106k]
  ------------------
  815|    229|          return (0);
  816|   106k|        if (n < 2)
  ------------------
  |  Branch (816:13): [True: 23, False: 106k]
  ------------------
  817|     23|          return (0);
  818|   106k|        n -= 2;
  819|   106k|        if (n > 0)
  ------------------
  |  Branch (819:13): [True: 51.7k, False: 55.1k]
  ------------------
  820|  51.7k|          JPEGFixupTagsSubsamplingSkip(data, n);
  821|   106k|      }
  822|      0|      break;
  823|    435|    case JPEG_MARKER_SOF0:  /* Baseline sequential Huffman */
  ------------------
  |  |  662|    435|#define JPEG_MARKER_SOF0 0xC0
  ------------------
  |  Branch (823:5): [True: 435, False: 111k]
  ------------------
  824|    621|    case JPEG_MARKER_SOF1:  /* Extended sequential Huffman */
  ------------------
  |  |  663|    621|#define JPEG_MARKER_SOF1 0xC1
  ------------------
  |  Branch (824:5): [True: 186, False: 111k]
  ------------------
  825|    805|    case JPEG_MARKER_SOF2:  /* Progressive Huffman: normally not allowed by
  ------------------
  |  |  664|    805|#define JPEG_MARKER_SOF2 0xC2
  ------------------
  |  Branch (825:5): [True: 184, False: 111k]
  ------------------
  826|       |                               TechNote, but that doesn't hurt supporting it */
  827|    957|    case JPEG_MARKER_SOF9:  /* Extended sequential arithmetic */
  ------------------
  |  |  665|    957|#define JPEG_MARKER_SOF9 0xC9
  ------------------
  |  Branch (827:5): [True: 152, False: 111k]
  ------------------
  828|  1.07k|    case JPEG_MARKER_SOF10: /* Progressive arithmetic: normally not allowed by
  ------------------
  |  |  666|  1.07k|#define JPEG_MARKER_SOF10 0xCA
  ------------------
  |  Branch (828:5): [True: 121, False: 111k]
  ------------------
  829|       |                               TechNote, but that doesn't hurt supporting it */
  830|       |      /* this marker contains the subsampling factors we're scanning for */
  831|  1.07k|      {
  832|  1.07k|        uint16_t n;
  833|  1.07k|        uint16_t o;
  834|  1.07k|        uint8_t p;
  835|  1.07k|        uint8_t ph, pv;
  836|  1.07k|        if (!JPEGFixupTagsSubsamplingReadWord(data, &n))
  ------------------
  |  Branch (836:13): [True: 172, False: 906]
  ------------------
  837|    172|          return (0);
  838|    906|        if (n != 8 + data->tif->tif_dir.td_samplesperpixel * 3)
  ------------------
  |  Branch (838:13): [True: 11, False: 895]
  ------------------
  839|     11|          return (0);
  840|    895|        JPEGFixupTagsSubsamplingSkip(data, 7);
  841|    895|        if (!JPEGFixupTagsSubsamplingReadByte(data, &p))
  ------------------
  |  Branch (841:13): [True: 151, False: 744]
  ------------------
  842|    151|          return (0);
  843|    744|        ph = (p >> 4);
  844|    744|        pv = (p & 15);
  845|    744|        JPEGFixupTagsSubsamplingSkip(data, 1);
  846|  1.94k|        for (o = 1; o < data->tif->tif_dir.td_samplesperpixel; o++) {
  ------------------
  |  Branch (846:21): [True: 1.39k, False: 553]
  ------------------
  847|  1.39k|          JPEGFixupTagsSubsamplingSkip(data, 1);
  848|  1.39k|          if (!JPEGFixupTagsSubsamplingReadByte(data, &p))
  ------------------
  |  Branch (848:15): [True: 171, False: 1.22k]
  ------------------
  849|    171|            return (0);
  850|  1.22k|          if (p != 0x11) {
  ------------------
  |  Branch (850:15): [True: 20, False: 1.20k]
  ------------------
  851|     20|            TIFFWarningExtR(data->tif, module,
  852|     20|                           "Subsampling values inside JPEG compressed data "
  853|     20|                           "have no TIFF equivalent, auto-correction of TIFF "
  854|     20|                           "subsampling values failed");
  855|     20|            return (1);
  856|     20|          }
  857|  1.20k|          JPEGFixupTagsSubsamplingSkip(data, 1);
  858|  1.20k|        }
  859|    553|        if (((ph != 1) && (ph != 2) && (ph != 4)) ||
  ------------------
  |  Branch (859:14): [True: 418, False: 135]
  |  Branch (859:27): [True: 138, False: 280]
  |  Branch (859:40): [True: 3, False: 135]
  ------------------
  860|    553|            ((pv != 1) && (pv != 2) && (pv != 4))) {
  ------------------
  |  Branch (860:14): [True: 433, False: 117]
  |  Branch (860:27): [True: 141, False: 292]
  |  Branch (860:40): [True: 1, False: 140]
  ------------------
  861|      4|          TIFFWarningExtR(
  862|      4|              data->tif, module,
  863|      4|              "Subsampling values inside JPEG compressed data have no TIFF "
  864|      4|              "equivalent, auto-correction of TIFF subsampling values failed");
  865|      4|          return (1);
  866|      4|        }
  867|    549|        if ((ph != data->tif->tif_dir.td_ycbcrsubsampling[0]) ||
  ------------------
  |  Branch (867:13): [True: 269, False: 280]
  ------------------
  868|    549|            (pv != data->tif->tif_dir.td_ycbcrsubsampling[1])) {
  ------------------
  |  Branch (868:13): [True: 165, False: 115]
  ------------------
  869|    434|          TIFFWarningExtR(
  870|    434|              data->tif, module,
  871|    434|              "Auto-corrected former TIFF subsampling values [%" PRIu16
  872|    434|              ",%" PRIu16 "] to match subsampling values inside JPEG "
  873|    434|              "compressed data [%" PRIu8 ",%" PRIu8 "]",
  874|    434|              data->tif->tif_dir.td_ycbcrsubsampling[0],
  875|    434|              data->tif->tif_dir.td_ycbcrsubsampling[1], ph, pv);
  876|    434|          data->tif->tif_dir.td_ycbcrsubsampling[0] = ph;
  877|    434|          data->tif->tif_dir.td_ycbcrsubsampling[1] = pv;
  878|    434|        }
  879|    549|      }
  880|      0|      return (1);
  881|    122|    default:
  ------------------
  |  Branch (881:5): [True: 122, False: 111k]
  ------------------
  882|    122|      return (0);
  883|   111k|    }
  884|   111k|  }
  885|  2.01k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingReadByte:
  889|  2.49M|                                 uint8_t *result) {
  890|  2.49M|  if (data->bufferbytesleft == 0) {
  ------------------
  |  Branch (890:7): [True: 4.61k, False: 2.48M]
  ------------------
  891|  4.61k|    uint32_t m;
  892|  4.61k|    if (data->filebytesleft == 0)
  ------------------
  |  Branch (892:9): [True: 327, False: 4.28k]
  ------------------
  893|    327|      return (0);
  894|  4.28k|    if (!data->filepositioned) {
  ------------------
  |  Branch (894:9): [True: 2.82k, False: 1.46k]
  ------------------
  895|  2.82k|      if (TIFFSeekFile(data->tif, data->fileoffset, SEEK_SET) == (toff_t)-1) {
  ------------------
  |  |  216|  2.82k|	((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))
  ------------------
  |  Branch (895:11): [True: 226, False: 2.59k]
  ------------------
  896|    226|        return 0;
  897|    226|      }
  898|  2.59k|      data->filepositioned = 1;
  899|  2.59k|    }
  900|  4.05k|    m = data->buffersize;
  901|  4.05k|    if ((uint64_t)m > data->filebytesleft)
  ------------------
  |  Branch (901:9): [True: 990, False: 3.06k]
  ------------------
  902|    990|      m = (uint32_t)data->filebytesleft;
  903|  4.05k|    assert(m < 0x80000000UL);
  904|  4.05k|    if (TIFFReadFile(data->tif, data->buffer, (tmsize_t)m) != (tmsize_t)m)
  ------------------
  |  |  212|  4.05k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  ------------------
  |  Branch (904:9): [True: 731, False: 3.32k]
  ------------------
  905|    731|      return (0);
  906|  3.32k|    data->buffercurrentbyte = data->buffer;
  907|  3.32k|    data->bufferbytesleft = m;
  908|  3.32k|    data->fileoffset += m;
  909|  3.32k|    data->filebytesleft -= m;
  910|  3.32k|  }
  911|  2.49M|  *result = *data->buffercurrentbyte;
  912|  2.49M|  data->buffercurrentbyte++;
  913|  2.49M|  data->bufferbytesleft--;
  914|  2.49M|  return (1);
  915|  2.49M|}
tif_jpeg.c:JPEGFixupTagsSubsamplingReadWord:
  919|   108k|                                 uint16_t *result) {
  920|   108k|  uint8_t ma;
  921|   108k|  uint8_t mb;
  922|   108k|  if (!JPEGFixupTagsSubsamplingReadByte(data, &ma))
  ------------------
  |  Branch (922:7): [True: 223, False: 108k]
  ------------------
  923|    223|    return (0);
  924|   108k|  if (!JPEGFixupTagsSubsamplingReadByte(data, &mb))
  ------------------
  |  Branch (924:7): [True: 178, False: 107k]
  ------------------
  925|    178|    return (0);
  926|   107k|  *result = (ma << 8) | mb;
  927|   107k|  return (1);
  928|   108k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingSkip:
  932|  55.9k|                             uint16_t skiplength) {
  933|  55.9k|  if ((uint32_t)skiplength <= data->bufferbytesleft) {
  ------------------
  |  Branch (933:7): [True: 54.8k, False: 1.08k]
  ------------------
  934|  54.8k|    data->buffercurrentbyte += skiplength;
  935|  54.8k|    data->bufferbytesleft -= skiplength;
  936|  54.8k|  } else {
  937|  1.08k|    uint16_t m;
  938|  1.08k|    m = (uint16_t)(skiplength - data->bufferbytesleft);
  939|  1.08k|    if (m <= data->filebytesleft) {
  ------------------
  |  Branch (939:9): [True: 974, False: 110]
  ------------------
  940|    974|      data->bufferbytesleft = 0;
  941|    974|      data->fileoffset += m;
  942|    974|      data->filebytesleft -= m;
  943|    974|      data->filepositioned = 0;
  944|    974|    } else {
  945|    110|      data->bufferbytesleft = 0;
  946|    110|      data->filebytesleft = 0;
  947|    110|    }
  948|  1.08k|  }
  949|  55.9k|}
tif_jpeg.c:JPEGSetupDecode:
  953|  3.81k|static int JPEGSetupDecode(TIFF *tif) {
  954|  3.81k|  JPEGState *sp = JState(tif);
  ------------------
  |  |  201|  3.81k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
  955|  3.81k|  TIFFDirectory *td = &tif->tif_dir;
  956|       |
  957|       |#if defined(JPEG_DUAL_MODE_8_12) && !defined(FROM_TIF_JPEG_12)
  958|       |  if (tif->tif_dir.td_bitspersample == 12) {
  959|       |    /* We pass a pointer to a copy of otherSettings, since */
  960|       |    /* TIFFReInitJPEG_12() will clear sp */
  961|       |    JPEGOtherSettings savedOtherSettings = sp->otherSettings;
  962|       |    return TIFFReInitJPEG_12(tif, &savedOtherSettings, COMPRESSION_JPEG, 0);
  963|       |  }
  964|       |#endif
  965|       |
  966|  3.81k|  JPEGInitializeLibJPEG(tif, TRUE);
  ------------------
  |  |   61|  3.81k|#define	TRUE	1
  ------------------
  967|       |
  968|  3.81k|  assert(sp != NULL);
  969|  3.81k|  assert(sp->cinfo.comm.is_decompressor);
  970|       |
  971|       |  /* Read JPEGTables if it is present */
  972|  3.81k|  if (TIFFFieldSet(tif, FIELD_JPEGTABLES)) {
  ------------------
  |  |  198|  3.81k|#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  197|  3.81k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  196|  3.81k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  |  |  |  Branch (198:34): [True: 2, False: 3.81k]
  |  |  ------------------
  ------------------
  973|      2|    TIFFjpeg_tables_src(sp);
  974|      2|    if (TIFFjpeg_read_header(sp, FALSE) != JPEG_HEADER_TABLES_ONLY) {
  ------------------
  |  |   62|      2|#define	FALSE	0
  ------------------
  |  Branch (974:9): [True: 1, False: 1]
  ------------------
  975|      1|      TIFFErrorExtR(tif, "JPEGSetupDecode",
  976|      1|                   "Bogus JPEGTables field");
  977|      1|      return (0);
  978|      1|    }
  979|      2|  }
  980|       |
  981|       |  /* Grab parameters that are same for all strips/tiles */
  982|  3.81k|  sp->photometric = td->td_photometric;
  983|  3.81k|  switch (sp->photometric) {
  984|    759|  case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  221|    759|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (984:3): [True: 759, False: 3.05k]
  ------------------
  985|    759|    sp->h_sampling = td->td_ycbcrsubsampling[0];
  986|    759|    sp->v_sampling = td->td_ycbcrsubsampling[1];
  987|    759|    break;
  988|  3.05k|  default:
  ------------------
  |  Branch (988:3): [True: 3.05k, False: 759]
  ------------------
  989|       |    /* TIFF 6.0 forbids subsampling of all other color spaces */
  990|  3.05k|    sp->h_sampling = 1;
  991|  3.05k|    sp->v_sampling = 1;
  992|  3.05k|    break;
  993|  3.81k|  }
  994|       |
  995|       |  /* Set up for reading normal data */
  996|  3.81k|  TIFFjpeg_data_src(sp);
  997|  3.81k|  tif->tif_postdecode = _TIFFNoPostDecode; /* override byte swapping */
  998|  3.81k|  return (1);
  999|  3.81k|}
tif_jpeg.c:JPEGInitializeLibJPEG:
 2384|  3.81k|static int JPEGInitializeLibJPEG(TIFF *tif, int decompress) {
 2385|  3.81k|  JPEGState *sp = JState(tif);
  ------------------
  |  |  201|  3.81k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2386|       |
 2387|  3.81k|  if (sp->cinfo_initialized) {
  ------------------
  |  Branch (2387:7): [True: 0, False: 3.81k]
  ------------------
 2388|      0|    if (!decompress && sp->cinfo.comm.is_decompressor)
  ------------------
  |  Branch (2388:9): [True: 0, False: 0]
  |  Branch (2388:24): [True: 0, False: 0]
  ------------------
 2389|      0|      TIFFjpeg_destroy(sp);
 2390|      0|    else if (decompress && !sp->cinfo.comm.is_decompressor)
  ------------------
  |  Branch (2390:14): [True: 0, False: 0]
  |  Branch (2390:28): [True: 0, False: 0]
  ------------------
 2391|      0|      TIFFjpeg_destroy(sp);
 2392|      0|    else
 2393|      0|      return 1;
 2394|       |
 2395|      0|    sp->cinfo_initialized = 0;
 2396|      0|  }
 2397|       |
 2398|       |  /*
 2399|       |   * Initialize libjpeg.
 2400|       |   */
 2401|  3.81k|  if (decompress) {
  ------------------
  |  Branch (2401:7): [True: 3.81k, False: 0]
  ------------------
 2402|  3.81k|    if (!TIFFjpeg_create_decompress(sp))
  ------------------
  |  Branch (2402:9): [True: 0, False: 3.81k]
  ------------------
 2403|      0|      return (0);
 2404|  3.81k|  } else {
 2405|      0|    if (!TIFFjpeg_create_compress(sp))
  ------------------
  |  Branch (2405:9): [True: 0, False: 0]
  ------------------
 2406|      0|      return (0);
 2407|      0|#ifndef TIFF_JPEG_MAX_MEMORY_TO_USE
 2408|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
 2409|      0|#endif
 2410|       |    /* libjpeg turbo 1.5.2 honours max_memory_to_use, but has no backing */
 2411|       |    /* store implementation, so better not set max_memory_to_use ourselves. */
 2412|       |    /* See https://github.com/libjpeg-turbo/libjpeg-turbo/issues/162 */
 2413|      0|    if (sp->cinfo.c.mem->max_memory_to_use > 0) {
  ------------------
  |  Branch (2413:9): [True: 0, False: 0]
  ------------------
 2414|       |      /* This is to address bug related in ticket GDAL #1795. */
 2415|      0|      if (getenv("JPEGMEM") == NULL) {
  ------------------
  |  Branch (2415:11): [True: 0, False: 0]
  ------------------
 2416|       |        /* Increase the max memory usable. This helps when creating files */
 2417|       |        /* with "big" tile, without using libjpeg temporary files. */
 2418|       |        /* For example a 512x512 tile with 3 bands */
 2419|       |        /* requires 1.5 MB which is above libjpeg 1MB default */
 2420|      0|        if (sp->cinfo.c.mem->max_memory_to_use < TIFF_JPEG_MAX_MEMORY_TO_USE)
  ------------------
  |  | 2408|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
  ------------------
  |  Branch (2420:13): [True: 0, False: 0]
  ------------------
 2421|      0|          sp->cinfo.c.mem->max_memory_to_use = TIFF_JPEG_MAX_MEMORY_TO_USE;
  ------------------
  |  | 2408|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
  ------------------
 2422|      0|      }
 2423|      0|    }
 2424|      0|  }
 2425|       |
 2426|  3.81k|  sp->cinfo_initialized = TRUE;
  ------------------
  |  |   61|  3.81k|#define	TRUE	1
  ------------------
 2427|       |
 2428|  3.81k|  return 1;
 2429|  3.81k|}
tif_jpeg.c:TIFFjpeg_tables_src:
  623|      2|static void TIFFjpeg_tables_src(JPEGState *sp) {
  624|      2|  TIFFjpeg_data_src(sp);
  625|      2|  sp->src.init_source = tables_init_source;
  626|      2|}
tif_jpeg.c:tables_init_source:
  616|      2|static void tables_init_source(j_decompress_ptr cinfo) {
  617|      2|  JPEGState *sp = (JPEGState *)cinfo;
  618|       |
  619|      2|  sp->src.next_input_byte = (const JOCTET *)sp->otherSettings.jpegtables;
  620|      2|  sp->src.bytes_in_buffer = (size_t)sp->otherSettings.jpegtables_length;
  621|      2|}
tif_jpeg.c:JPEGPreDecode:
 1038|   148k|/*ARGSUSED*/ static int JPEGPreDecode(TIFF *tif, uint16_t s) {
 1039|   148k|  JPEGState *sp = JState(tif);
  ------------------
  |  |  201|   148k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1040|   148k|  TIFFDirectory *td = &tif->tif_dir;
 1041|   148k|  static const char module[] = "JPEGPreDecode";
 1042|   148k|  uint32_t segment_width, segment_height;
 1043|   148k|  int downsampled_output;
 1044|   148k|  int ci;
 1045|       |
 1046|   148k|  assert(sp != NULL);
 1047|       |
 1048|   148k|  if (sp->cinfo.comm.is_decompressor == 0) {
  ------------------
  |  Branch (1048:7): [True: 0, False: 148k]
  ------------------
 1049|      0|    tif->tif_setupdecode(tif);
 1050|      0|  }
 1051|       |
 1052|   148k|  assert(sp->cinfo.comm.is_decompressor);
 1053|       |  /*
 1054|       |   * Reset decoder state from any previous strip/tile,
 1055|       |   * in case application didn't read the whole strip.
 1056|       |   */
 1057|   148k|  if (!TIFFjpeg_abort(sp))
  ------------------
  |  Branch (1057:7): [True: 0, False: 148k]
  ------------------
 1058|      0|    return (0);
 1059|       |  /*
 1060|       |   * Read the header for this strip/tile.
 1061|       |   */
 1062|       |
 1063|   148k|  if (TIFFjpeg_read_header(sp, TRUE) != JPEG_HEADER_OK)
  ------------------
  |  |   61|   148k|#define	TRUE	1
  ------------------
  |  Branch (1063:7): [True: 105k, False: 43.0k]
  ------------------
 1064|   105k|    return (0);
 1065|       |
 1066|  43.0k|  tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1067|  43.0k|  tif->tif_rawcc = sp->src.bytes_in_buffer;
 1068|       |
 1069|       |  /*
 1070|       |   * Check image parameters and set decompression parameters.
 1071|       |   */
 1072|  43.0k|  if (isTiled(tif)) {
  ------------------
  |  |  207|  43.0k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  43.0k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 43.0k, False: 0]
  |  |  ------------------
  ------------------
 1073|  43.0k|    segment_width = td->td_tilewidth;
 1074|  43.0k|    segment_height = td->td_tilelength;
 1075|  43.0k|    sp->bytesperline = TIFFTileRowSize(tif);
 1076|  43.0k|  } else {
 1077|      0|    segment_width = td->td_imagewidth;
 1078|      0|    segment_height = td->td_imagelength - tif->tif_row;
 1079|      0|    if (segment_height > td->td_rowsperstrip)
  ------------------
  |  Branch (1079:9): [True: 0, False: 0]
  ------------------
 1080|      0|      segment_height = td->td_rowsperstrip;
 1081|      0|    sp->bytesperline = TIFFScanlineSize(tif);
 1082|      0|  }
 1083|  43.0k|  if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0) {
  ------------------
  |  |  260|  86.0k|#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  ------------------
  |  Branch (1083:7): [True: 607, False: 42.4k]
  |  Branch (1083:55): [True: 128, False: 479]
  ------------------
 1084|       |    /*
 1085|       |     * For PC 2, scale down the expected strip/tile size
 1086|       |     * to match a downsampled component
 1087|       |     */
 1088|    128|    segment_width = TIFFhowmany_32(segment_width, sp->h_sampling);
  ------------------
  |  |  242|    128|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 128, False: 0]
  |  |  ------------------
  |  |  243|    128|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|    128|			   0U)
  ------------------
 1089|    128|    segment_height = TIFFhowmany_32(segment_height, sp->v_sampling);
  ------------------
  |  |  242|    128|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 128, False: 0]
  |  |  ------------------
  |  |  243|    128|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|    128|			   0U)
  ------------------
 1090|    128|  }
 1091|  43.0k|  if (sp->cinfo.d.image_width < segment_width ||
  ------------------
  |  Branch (1091:7): [True: 41.1k, False: 1.89k]
  ------------------
 1092|  43.0k|      sp->cinfo.d.image_height < segment_height) {
  ------------------
  |  Branch (1092:7): [True: 764, False: 1.12k]
  ------------------
 1093|  41.9k|    TIFFWarningExtR(tif, module,
 1094|  41.9k|                   "Improper JPEG strip/tile size, "
 1095|  41.9k|                   "expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1096|  41.9k|                   segment_width, segment_height, sp->cinfo.d.image_width,
 1097|  41.9k|                   sp->cinfo.d.image_height);
 1098|  41.9k|  }
 1099|  43.0k|  if (sp->cinfo.d.image_width == segment_width &&
  ------------------
  |  Branch (1099:7): [True: 1.06k, False: 41.9k]
  ------------------
 1100|  43.0k|      sp->cinfo.d.image_height > segment_height &&
  ------------------
  |  Branch (1100:7): [True: 483, False: 583]
  ------------------
 1101|  43.0k|      tif->tif_row + segment_height == td->td_imagelength && !isTiled(tif)) {
  ------------------
  |  |  207|      1|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|      1|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (1101:7): [True: 1, False: 482]
  |  Branch (1101:62): [True: 0, False: 1]
  ------------------
 1102|       |    /* Some files have a last strip, that should be truncated, */
 1103|       |    /* but their JPEG codestream has still the maximum strip */
 1104|       |    /* height. Warn about this as this is non compliant, but */
 1105|       |    /* we can safely recover from that. */
 1106|      0|    TIFFWarningExtR(tif, module,
 1107|      0|                   "JPEG strip size exceeds expected dimensions,"
 1108|      0|                   " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1109|      0|                   segment_width, segment_height, sp->cinfo.d.image_width,
 1110|      0|                   sp->cinfo.d.image_height);
 1111|  43.0k|  } else if (sp->cinfo.d.image_width > segment_width ||
  ------------------
  |  Branch (1111:14): [True: 824, False: 42.2k]
  ------------------
 1112|  43.0k|             sp->cinfo.d.image_height > segment_height) {
  ------------------
  |  Branch (1112:14): [True: 731, False: 41.4k]
  ------------------
 1113|       |    /*
 1114|       |     * This case could be dangerous, if the strip or tile size has
 1115|       |     * been reported as less than the amount of data jpeg will
 1116|       |     * return, some potential security issues arise. Catch this
 1117|       |     * case and error out.
 1118|       |     */
 1119|  1.55k|    TIFFErrorExtR(tif, module,
 1120|  1.55k|                 "JPEG strip/tile size exceeds expected dimensions,"
 1121|  1.55k|                 " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1122|  1.55k|                 segment_width, segment_height, sp->cinfo.d.image_width,
 1123|  1.55k|                 sp->cinfo.d.image_height);
 1124|  1.55k|    return (0);
 1125|  1.55k|  }
 1126|  41.4k|  if (sp->cinfo.d.num_components != (td->td_planarconfig == PLANARCONFIG_CONTIG
  ------------------
  |  |  259|  41.4k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (1126:7): [True: 549, False: 40.9k]
  |  Branch (1126:38): [True: 40.8k, False: 607]
  ------------------
 1127|  41.4k|                                         ? td->td_samplesperpixel
 1128|  41.4k|                                         : 1)) {
 1129|    549|    TIFFErrorExtR(tif, module, "Improper JPEG component count");
 1130|    549|    return (0);
 1131|    549|  }
 1132|       |#ifdef JPEG_LIB_MK1
 1133|       |  if (12 != td->td_bitspersample && 8 != td->td_bitspersample) {
 1134|       |    TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1135|       |    return (0);
 1136|       |  }
 1137|       |  sp->cinfo.d.data_precision = td->td_bitspersample;
 1138|       |  sp->cinfo.d.bits_in_jsample = td->td_bitspersample;
 1139|       |#else
 1140|  40.9k|  if (sp->cinfo.d.data_precision != td->td_bitspersample) {
  ------------------
  |  Branch (1140:7): [True: 1, False: 40.9k]
  ------------------
 1141|      1|    TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1142|      1|    return (0);
 1143|      1|  }
 1144|  40.9k|#endif
 1145|       |
 1146|  40.9k|  if (sp->cinfo.d.progressive_mode &&
  ------------------
  |  Branch (1146:7): [True: 17.7k, False: 23.1k]
  ------------------
 1147|  40.9k|      !sp->otherSettings.has_warned_about_progressive_mode) {
  ------------------
  |  Branch (1147:7): [True: 1.76k, False: 15.9k]
  ------------------
 1148|  1.76k|    TIFFWarningExtR(tif, module,
 1149|  1.76k|                   "The JPEG strip/tile is encoded with progressive mode, "
 1150|  1.76k|                   "which is normally not legal for JPEG-in-TIFF.\n"
 1151|  1.76k|                   "libtiff should be able to decode it, but it might "
 1152|  1.76k|                   "cause compatibility issues with other readers");
 1153|  1.76k|    sp->otherSettings.has_warned_about_progressive_mode = TRUE;
  ------------------
  |  |   61|  1.76k|#define	TRUE	1
  ------------------
 1154|  1.76k|  }
 1155|       |
 1156|       |  /* In some cases, libjpeg needs to allocate a lot of memory */
 1157|       |  /* http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf
 1158|       |   */
 1159|  40.9k|  if (TIFFjpeg_has_multiple_scans(sp)) {
  ------------------
  |  Branch (1159:7): [True: 22.3k, False: 18.5k]
  ------------------
 1160|       |    /* In this case libjpeg will need to allocate memory or backing */
 1161|       |    /* store for all coefficients */
 1162|       |    /* See call to jinit_d_coef_controller() from master_selection() */
 1163|       |    /* in libjpeg */
 1164|       |
 1165|       |    /* 1 MB for regular libjpeg usage */
 1166|  22.3k|    toff_t nRequiredMemory = 1024 * 1024;
 1167|       |
 1168|  59.2k|    for (ci = 0; ci < sp->cinfo.d.num_components; ci++) {
  ------------------
  |  Branch (1168:18): [True: 36.8k, False: 22.3k]
  ------------------
 1169|  36.8k|      const jpeg_component_info *compptr = &(sp->cinfo.d.comp_info[ci]);
 1170|  36.8k|      if (compptr->h_samp_factor > 0 && compptr->v_samp_factor > 0) {
  ------------------
  |  Branch (1170:11): [True: 36.8k, False: 0]
  |  Branch (1170:41): [True: 36.8k, False: 0]
  ------------------
 1171|  36.8k|        nRequiredMemory +=
 1172|  36.8k|            (toff_t)(((compptr->width_in_blocks + compptr->h_samp_factor - 1) /
 1173|  36.8k|                      compptr->h_samp_factor)) *
 1174|  36.8k|            ((compptr->height_in_blocks + compptr->v_samp_factor - 1) /
 1175|  36.8k|             compptr->v_samp_factor) *
 1176|  36.8k|            sizeof(JBLOCK);
 1177|  36.8k|      }
 1178|  36.8k|    }
 1179|       |
 1180|  22.3k|    if (sp->cinfo.d.mem->max_memory_to_use > 0 &&
  ------------------
  |  Branch (1180:9): [True: 0, False: 22.3k]
  ------------------
 1181|  22.3k|        nRequiredMemory > (toff_t)(sp->cinfo.d.mem->max_memory_to_use) &&
  ------------------
  |  Branch (1181:9): [True: 0, False: 0]
  ------------------
 1182|  22.3k|        getenv("LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC") == NULL) {
  ------------------
  |  Branch (1182:9): [True: 0, False: 0]
  ------------------
 1183|      0|      TIFFErrorExtR(
 1184|      0|          tif, module,
 1185|      0|          "Reading this image would require libjpeg to allocate "
 1186|      0|          "at least %" PRIu64 " bytes. "
 1187|      0|          "This is disabled since above the %ld threshold. "
 1188|      0|          "You may override this restriction by defining the "
 1189|      0|          "LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC environment variable, "
 1190|      0|          "or setting the JPEGMEM environment variable to a value greater "
 1191|      0|          "or equal to '%" PRIu64 "M'",
 1192|      0|          nRequiredMemory, sp->cinfo.d.mem->max_memory_to_use,
 1193|      0|          (nRequiredMemory + 1000000u - 1u) / 1000000u);
 1194|      0|      return 0;
 1195|      0|    }
 1196|  22.3k|  }
 1197|       |
 1198|  40.9k|  if (td->td_planarconfig == PLANARCONFIG_CONTIG) {
  ------------------
  |  |  259|  40.9k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (1198:7): [True: 40.3k, False: 607]
  ------------------
 1199|       |    /* Component 0 should have expected sampling factors */
 1200|  40.3k|    if (sp->cinfo.d.comp_info[0].h_samp_factor != sp->h_sampling ||
  ------------------
  |  Branch (1200:9): [True: 266, False: 40.0k]
  ------------------
 1201|  40.3k|        sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling) {
  ------------------
  |  Branch (1201:9): [True: 218, False: 39.8k]
  ------------------
 1202|    484|      TIFFErrorExtR(tif, module,
 1203|    484|                   "Improper JPEG sampling factors %d,%d\n"
 1204|    484|                   "Apparently should be %" PRIu16 ",%" PRIu16 ".",
 1205|    484|                   sp->cinfo.d.comp_info[0].h_samp_factor,
 1206|    484|                   sp->cinfo.d.comp_info[0].v_samp_factor, sp->h_sampling,
 1207|    484|                   sp->v_sampling);
 1208|    484|      return (0);
 1209|    484|    }
 1210|       |    /* Rest should have sampling factors 1,1 */
 1211|  56.0k|    for (ci = 1; ci < sp->cinfo.d.num_components; ci++) {
  ------------------
  |  Branch (1211:18): [True: 16.2k, False: 39.8k]
  ------------------
 1212|  16.2k|      if (sp->cinfo.d.comp_info[ci].h_samp_factor != 1 ||
  ------------------
  |  Branch (1212:11): [True: 1, False: 16.2k]
  ------------------
 1213|  16.2k|          sp->cinfo.d.comp_info[ci].v_samp_factor != 1) {
  ------------------
  |  Branch (1213:11): [True: 2, False: 16.2k]
  ------------------
 1214|      3|        TIFFErrorExtR(tif, module,
 1215|      3|                     "Improper JPEG sampling factors");
 1216|      3|        return (0);
 1217|      3|      }
 1218|  16.2k|    }
 1219|  39.8k|  } else {
 1220|       |    /* PC 2's single component should have sampling factors 1,1 */
 1221|    607|    if (sp->cinfo.d.comp_info[0].h_samp_factor != 1 ||
  ------------------
  |  Branch (1221:9): [True: 118, False: 489]
  ------------------
 1222|    607|        sp->cinfo.d.comp_info[0].v_samp_factor != 1) {
  ------------------
  |  Branch (1222:9): [True: 110, False: 379]
  ------------------
 1223|    228|      TIFFErrorExtR(tif, module,
 1224|    228|                   "Improper JPEG sampling factors");
 1225|    228|      return (0);
 1226|    228|    }
 1227|    607|  }
 1228|  40.2k|  downsampled_output = FALSE;
  ------------------
  |  |   62|  40.2k|#define	FALSE	0
  ------------------
 1229|  40.2k|  if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  259|  80.4k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (1229:7): [True: 39.8k, False: 379]
  ------------------
 1230|  40.2k|      sp->photometric == PHOTOMETRIC_YCBCR &&
  ------------------
  |  |  221|  80.0k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (1230:7): [True: 5.13k, False: 34.7k]
  ------------------
 1231|  40.2k|      sp->otherSettings.jpegcolormode == JPEGCOLORMODE_RGB) {
  ------------------
  |  |  618|  5.13k|#define	    JPEGCOLORMODE_RGB	0x0001		/* do auto conversion */
  ------------------
  |  Branch (1231:7): [True: 5.13k, False: 0]
  ------------------
 1232|       |    /* Convert YCbCr to RGB */
 1233|  5.13k|    sp->cinfo.d.jpeg_color_space = JCS_YCbCr;
 1234|  5.13k|    sp->cinfo.d.out_color_space = JCS_RGB;
 1235|  35.0k|  } else {
 1236|       |    /* Suppress colorspace handling */
 1237|  35.0k|    sp->cinfo.d.jpeg_color_space = JCS_UNKNOWN;
 1238|  35.0k|    sp->cinfo.d.out_color_space = JCS_UNKNOWN;
 1239|  35.0k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  259|  70.1k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (1239:9): [True: 34.7k, False: 379]
  ------------------
 1240|  35.0k|        (sp->h_sampling != 1 || sp->v_sampling != 1))
  ------------------
  |  Branch (1240:10): [True: 0, False: 34.7k]
  |  Branch (1240:33): [True: 0, False: 34.7k]
  ------------------
 1241|      0|      downsampled_output = TRUE;
  ------------------
  |  |   61|      0|#define	TRUE	1
  ------------------
 1242|       |    /* XXX what about up-sampling? */
 1243|  35.0k|  }
 1244|  40.2k|  if (downsampled_output) {
  ------------------
  |  Branch (1244:7): [True: 0, False: 40.2k]
  ------------------
 1245|       |    /* Need to use raw-data interface to libjpeg */
 1246|      0|    sp->cinfo.d.raw_data_out = TRUE;
  ------------------
  |  |   61|      0|#define	TRUE	1
  ------------------
 1247|       |#if JPEG_LIB_VERSION >= 70
 1248|       |    sp->cinfo.d.do_fancy_upsampling = FALSE;
 1249|       |#endif /* JPEG_LIB_VERSION >= 70 */
 1250|      0|    tif->tif_decoderow = DecodeRowError;
 1251|      0|    tif->tif_decodestrip = JPEGDecodeRaw;
 1252|      0|    tif->tif_decodetile = JPEGDecodeRaw;
 1253|  40.2k|  } else {
 1254|       |    /* Use normal interface to libjpeg */
 1255|  40.2k|    sp->cinfo.d.raw_data_out = FALSE;
  ------------------
  |  |   62|  40.2k|#define	FALSE	0
  ------------------
 1256|  40.2k|    tif->tif_decoderow = JPEGDecode;
 1257|  40.2k|    tif->tif_decodestrip = JPEGDecode;
 1258|  40.2k|    tif->tif_decodetile = JPEGDecode;
 1259|  40.2k|  }
 1260|       |  /* Start JPEG decompressor */
 1261|  40.2k|  if (!TIFFjpeg_start_decompress(sp))
  ------------------
  |  Branch (1261:7): [True: 7.74k, False: 32.4k]
  ------------------
 1262|  7.74k|    return (0);
 1263|       |  /* Allocate downsampled-data buffers if needed */
 1264|  32.4k|  if (downsampled_output) {
  ------------------
  |  Branch (1264:7): [True: 0, False: 32.4k]
  ------------------
 1265|      0|    if (!alloc_downsampled_buffers(tif, sp->cinfo.d.comp_info,
  ------------------
  |  Branch (1265:9): [True: 0, False: 0]
  ------------------
 1266|      0|                                   sp->cinfo.d.num_components))
 1267|      0|      return (0);
 1268|      0|    sp->scancount = DCTSIZE; /* mark buffer empty */
 1269|      0|  }
 1270|  32.4k|  return (1);
 1271|  32.4k|}
tif_jpeg.c:TIFFjpeg_abort:
  400|   148k|static int TIFFjpeg_abort(JPEGState *sp) {
  401|   148k|  return CALLVJPEG(sp, jpeg_abort(&sp->cinfo.comm));
  ------------------
  |  |  291|   148k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  290|   148k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  148|   148k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  402|   148k|}
tif_jpeg.c:TIFFjpeg_finish_decompress:
  396|  32.3k|static int TIFFjpeg_finish_decompress(JPEGState *sp) {
  397|  32.3k|  return CALLJPEG(sp, -1, (int)jpeg_finish_decompress(&sp->cinfo.d));
  ------------------
  |  |  290|  32.3k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  148|  32.3k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  398|  32.3k|}
tif_jpeg.c:TIFFjpeg_start_decompress:
  368|  40.2k|static int TIFFjpeg_start_decompress(JPEGState *sp) {
  369|  40.2k|  const char *sz_max_allowed_scan_number;
  370|       |  /* progress monitor */
  371|  40.2k|  sp->cinfo.d.progress = &sp->progress;
  372|  40.2k|  sp->progress.progress_monitor = TIFFjpeg_progress_monitor;
  373|  40.2k|  sp->otherSettings.max_allowed_scan_number = 100;
  374|  40.2k|  sz_max_allowed_scan_number = getenv("LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER");
  375|  40.2k|  if (sz_max_allowed_scan_number)
  ------------------
  |  Branch (375:7): [True: 0, False: 40.2k]
  ------------------
  376|      0|    sp->otherSettings.max_allowed_scan_number =
  377|      0|        atoi(sz_max_allowed_scan_number);
  378|       |
  379|  40.2k|  return CALLVJPEG(sp, jpeg_start_decompress(&sp->cinfo.d));
  ------------------
  |  |  291|  40.2k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  290|  40.2k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  148|  40.2k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  380|  40.2k|}
tif_jpeg.c:TIFFjpeg_progress_monitor:
  265|  40.0M|static void TIFFjpeg_progress_monitor(j_common_ptr cinfo) {
  266|  40.0M|  JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  267|  40.0M|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (267:7): [True: 40.0M, False: 0]
  ------------------
  268|  40.0M|    const int scan_no = ((j_decompress_ptr)cinfo)->input_scan_number;
  269|  40.0M|    if (scan_no >= sp->otherSettings.max_allowed_scan_number) {
  ------------------
  |  Branch (269:9): [True: 1, False: 40.0M]
  ------------------
  270|      1|      TIFFErrorExtR(
  271|      1|          ((JPEGState *)cinfo)->tif,
  272|      1|          "TIFFjpeg_progress_monitor",
  273|      1|          "Scan number %d exceeds maximum scans (%d). This limit "
  274|      1|          "can be raised through the LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER "
  275|      1|          "environment variable.",
  276|      1|          scan_no, sp->otherSettings.max_allowed_scan_number);
  277|       |
  278|      1|      jpeg_abort(cinfo);           /* clean up libjpeg state */
  279|      1|      LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
  ------------------
  |  |  149|      1|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
  280|      1|    }
  281|  40.0M|  }
  282|  40.0M|}
tif_jpeg.c:JPEGDecode:
 1278|  32.3k|static int JPEGDecode(TIFF *tif, uint8_t *buf, tmsize_t cc, uint16_t s) {
 1279|  32.3k|  JPEGState *sp = JState(tif);
  ------------------
  |  |  201|  32.3k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1280|  32.3k|  tmsize_t nrows;
 1281|  32.3k|  (void)s;
 1282|       |
 1283|       |  /*
 1284|       |  ** Update available information, buffer may have been refilled
 1285|       |  ** between decode requests
 1286|       |  */
 1287|  32.3k|  sp->src.next_input_byte = (const JOCTET *)tif->tif_rawcp;
 1288|  32.3k|  sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
 1289|       |
 1290|  32.3k|  if (sp->bytesperline == 0)
  ------------------
  |  Branch (1290:7): [True: 0, False: 32.3k]
  ------------------
 1291|      0|    return 0;
 1292|       |
 1293|  32.3k|  nrows = cc / sp->bytesperline;
 1294|  32.3k|  if (cc % sp->bytesperline)
  ------------------
  |  Branch (1294:7): [True: 0, False: 32.3k]
  ------------------
 1295|      0|    TIFFWarningExtR(tif, tif->tif_name,
 1296|      0|                   "fractional scanline not read");
 1297|       |
 1298|  32.3k|  if (nrows > (tmsize_t)sp->cinfo.d.image_height)
  ------------------
  |  Branch (1298:7): [True: 29.8k, False: 2.47k]
  ------------------
 1299|  29.8k|    nrows = sp->cinfo.d.image_height;
 1300|       |
 1301|       |  /* data is expected to be read in multiples of a scanline */
 1302|  32.3k|  if (nrows) {
  ------------------
  |  Branch (1302:7): [True: 32.3k, False: 0]
  ------------------
 1303|  32.2M|    do {
 1304|       |      /*
 1305|       |       * In the libjpeg6b-9a 8bit case.  We read directly into
 1306|       |       * the TIFF buffer.
 1307|       |       */
 1308|  32.2M|      JSAMPROW bufptr = (JSAMPROW)buf;
 1309|       |
 1310|  32.2M|      if (TIFFjpeg_read_scanlines(sp, &bufptr, 1) != 1)
  ------------------
  |  Branch (1310:11): [True: 0, False: 32.2M]
  ------------------
 1311|      0|        return (0);
 1312|       |
 1313|  32.2M|      ++tif->tif_row;
 1314|  32.2M|      buf += sp->bytesperline;
 1315|  32.2M|      cc -= sp->bytesperline;
 1316|  32.2M|    } while (--nrows > 0);
  ------------------
  |  Branch (1316:14): [True: 32.2M, False: 32.3k]
  ------------------
 1317|  32.3k|  }
 1318|       |
 1319|       |  /* Update information on consumed data */
 1320|  32.3k|  tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1321|  32.3k|  tif->tif_rawcc = sp->src.bytes_in_buffer;
 1322|       |
 1323|       |  /* Close down the decompressor if we've finished the strip or tile. */
 1324|  32.3k|  return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height ||
  ------------------
  |  Branch (1324:10): [True: 0, False: 32.3k]
  ------------------
 1325|  32.3k|         TIFFjpeg_finish_decompress(sp);
  ------------------
  |  Branch (1325:10): [True: 32.3k, False: 0]
  ------------------
 1326|  32.3k|}
tif_jpeg.c:TIFFjpeg_read_scanlines:
  383|  32.2M|                                   int max_lines) {
  384|  32.2M|  return CALLJPEG(
  ------------------
  |  |  290|  32.2M|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  148|  32.2M|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  385|  32.2M|      sp, -1,
  386|  32.2M|      (int)jpeg_read_scanlines(&sp->cinfo.d, scanlines, (JDIMENSION)max_lines));
  387|  32.2M|}
tif_jpeg.c:JPEGCleanup:
 2201|  5.32k|static void JPEGCleanup(TIFF *tif) {
 2202|  5.32k|  JPEGState *sp = JState(tif);
  ------------------
  |  |  201|  5.32k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2203|       |
 2204|  5.32k|  assert(sp != 0);
 2205|       |
 2206|  5.32k|  tif->tif_tagmethods.vgetfield = sp->otherSettings.vgetparent;
 2207|  5.32k|  tif->tif_tagmethods.vsetfield = sp->otherSettings.vsetparent;
 2208|  5.32k|  tif->tif_tagmethods.printdir = sp->otherSettings.printdir;
 2209|  5.32k|  if (sp->cinfo_initialized)
  ------------------
  |  Branch (2209:7): [True: 3.81k, False: 1.50k]
  ------------------
 2210|  3.81k|    TIFFjpeg_destroy(sp);           /* release libjpeg resources */
 2211|  5.32k|  if (sp->otherSettings.jpegtables) /* tag value */
  ------------------
  |  Branch (2211:7): [True: 3, False: 5.32k]
  ------------------
 2212|      3|    _TIFFfree(sp->otherSettings.jpegtables);
 2213|  5.32k|  _TIFFfree(tif->tif_data); /* release local state */
 2214|  5.32k|  tif->tif_data = NULL;
 2215|       |
 2216|  5.32k|  _TIFFSetDefaultCompressionState(tif);
 2217|  5.32k|}

LogL16toY:
  744|  35.1M|{
  745|  35.1M|	int	Le = p16 & 0x7fff;
  746|  35.1M|	double	Y;
  747|       |
  748|  35.1M|	if (!Le)
  ------------------
  |  Branch (748:6): [True: 52.2k, False: 35.1M]
  ------------------
  749|  52.2k|		return (0.);
  750|  35.1M|	Y = exp(M_LN2/256.*(Le+.5) - M_LN2*64.);
  751|  35.1M|	return (!(p16 & 0x8000) ? Y : -Y);
  ------------------
  |  Branch (751:10): [True: 765k, False: 34.3M]
  ------------------
  752|  35.1M|}
XYZtoRGB24:
  808|  1.78M|{
  809|  1.78M|	double	r, g, b;
  810|       |					/* assume CCIR-709 primaries */
  811|  1.78M|	r =  2.690*xyz[0] + -1.276*xyz[1] + -0.414*xyz[2];
  812|  1.78M|	g = -1.022*xyz[0] +  1.978*xyz[1] +  0.044*xyz[2];
  813|  1.78M|	b =  0.061*xyz[0] + -0.224*xyz[1] +  1.163*xyz[2];
  814|       |					/* assume 2.0 gamma for speed */
  815|       |	/* could use integer sqrt approx., but this is probably faster */
  816|  1.78M|	rgb[0] = (uint8_t)((r <= 0.) ? 0 : (r >= 1.) ? 255 : (int)(256. * sqrt(r)));
  ------------------
  |  Branch (816:21): [True: 1.66M, False: 118k]
  |  Branch (816:37): [True: 20.9k, False: 97.2k]
  ------------------
  817|  1.78M|	rgb[1] = (uint8_t)((g <= 0.) ? 0 : (g >= 1.) ? 255 : (int)(256. * sqrt(g)));
  ------------------
  |  Branch (817:21): [True: 1.70M, False: 76.4k]
  |  Branch (817:37): [True: 13.3k, False: 63.0k]
  ------------------
  818|  1.78M|	rgb[2] = (uint8_t)((b <= 0.) ? 0 : (b >= 1.) ? 255 : (int)(256. * sqrt(b)));
  ------------------
  |  Branch (818:21): [True: 1.67M, False: 108k]
  |  Branch (818:37): [True: 19.9k, False: 88.7k]
  ------------------
  819|  1.78M|}
LogL10toY:
  826|  24.1k|{
  827|  24.1k|	if (p10 == 0)
  ------------------
  |  Branch (827:6): [True: 6.65k, False: 17.5k]
  ------------------
  828|  6.65k|		return (0.);
  829|  17.5k|	return (exp(M_LN2/64.*(p10+.5) - M_LN2*12.));
  830|  24.1k|}
uv_decode:
  930|  17.5k|{
  931|  17.5k|	int	upper, lower;
  932|  17.5k|	register int	ui, vi;
  933|       |
  934|  17.5k|	if (c < 0 || c >= UV_NDIVS)
  ------------------
  |  |    3|  17.5k|#define UV_NDIVS	16289
  ------------------
  |  Branch (934:6): [True: 0, False: 17.5k]
  |  Branch (934:15): [True: 1.11k, False: 16.4k]
  ------------------
  935|  1.11k|		return (-1);
  936|  16.4k|	lower = 0;				/* binary search */
  937|  16.4k|	upper = UV_NVS;
  ------------------
  |  |    5|  16.4k|#define UV_NVS		163
  ------------------
  938|   133k|	while (upper - lower > 1) {
  ------------------
  |  Branch (938:9): [True: 117k, False: 15.5k]
  ------------------
  939|   117k|		vi = (lower + upper) >> 1;
  940|   117k|		ui = c - uv_row[vi].ncum;
  941|   117k|		if (ui > 0)
  ------------------
  |  Branch (941:7): [True: 39.7k, False: 78.2k]
  ------------------
  942|  39.7k|			lower = vi;
  943|  78.2k|		else if (ui < 0)
  ------------------
  |  Branch (943:12): [True: 77.3k, False: 850]
  ------------------
  944|  77.3k|			upper = vi;
  945|    850|		else {
  946|    850|			lower = vi;
  947|    850|			break;
  948|    850|		}
  949|   117k|	}
  950|  16.4k|	vi = lower;
  951|  16.4k|	ui = c - uv_row[vi].ncum;
  952|  16.4k|	*up = uv_row[vi].ustart + (ui+.5)*UV_SQSIZ;
  ------------------
  |  |    2|  16.4k|#define UV_SQSIZ	(float)0.003500
  ------------------
  953|  16.4k|	*vp = UV_VSTART + (vi+.5)*UV_SQSIZ;
  ------------------
  |  |    4|  16.4k|#define UV_VSTART	(float)0.016940
  ------------------
              	*vp = UV_VSTART + (vi+.5)*UV_SQSIZ;
  ------------------
  |  |    2|  16.4k|#define UV_SQSIZ	(float)0.003500
  ------------------
  954|  16.4k|	return (0);
  955|  17.5k|}
LogLuv24toXYZ:
  962|  24.1k|{
  963|  24.1k|	int	Ce;
  964|  24.1k|	double	L, u, v, s, x, y;
  965|       |					/* decode luminance */
  966|  24.1k|	L = LogL10toY(p>>14 & 0x3ff);
  967|  24.1k|	if (L <= 0.) {
  ------------------
  |  Branch (967:6): [True: 6.65k, False: 17.5k]
  ------------------
  968|  6.65k|		XYZ[0] = XYZ[1] = XYZ[2] = 0.;
  969|  6.65k|		return;
  970|  6.65k|	}
  971|       |					/* decode color */
  972|  17.5k|	Ce = p & 0x3fff;
  973|  17.5k|	if (uv_decode(&u, &v, Ce) < 0) {
  ------------------
  |  Branch (973:6): [True: 1.11k, False: 16.4k]
  ------------------
  974|  1.11k|		u = U_NEU; v = V_NEU;
  ------------------
  |  |  526|  1.11k|#define U_NEU		0.210526316
  ------------------
              		u = U_NEU; v = V_NEU;
  ------------------
  |  |  527|  1.11k|#define V_NEU		0.473684211
  ------------------
  975|  1.11k|	}
  976|  17.5k|	s = 1./(6.*u - 16.*v + 12.);
  977|  17.5k|	x = 9.*u * s;
  978|  17.5k|	y = 4.*v * s;
  979|       |					/* convert to XYZ */
  980|  17.5k|	XYZ[0] = (float)(x/y * L);
  981|  17.5k|	XYZ[1] = (float)L;
  982|  17.5k|	XYZ[2] = (float)((1.-x-y)/y * L);
  983|  17.5k|}
LogLuv32toXYZ:
 1103|  1.75M|{
 1104|  1.75M|	double	L, u, v, s, x, y;
 1105|       |					/* decode luminance */
 1106|  1.75M|	L = LogL16toY((int)p >> 16);
 1107|  1.75M|	if (L <= 0.) {
  ------------------
  |  Branch (1107:6): [True: 1.58M, False: 167k]
  ------------------
 1108|  1.58M|		XYZ[0] = XYZ[1] = XYZ[2] = 0.;
 1109|  1.58M|		return;
 1110|  1.58M|	}
 1111|       |					/* decode color */
 1112|   167k|	u = 1./UVSCALE * ((p>>8 & 0xff) + .5);
  ------------------
  |  |  528|   167k|#define UVSCALE		410.
  ------------------
 1113|   167k|	v = 1./UVSCALE * ((p & 0xff) + .5);
  ------------------
  |  |  528|   167k|#define UVSCALE		410.
  ------------------
 1114|   167k|	s = 1./(6.*u - 16.*v + 12.);
 1115|   167k|	x = 9.*u * s;
 1116|   167k|	y = 4.*v * s;
 1117|       |					/* convert to XYZ */
 1118|   167k|	XYZ[0] = (float)(x/y * L);
 1119|   167k|	XYZ[1] = (float)L;
 1120|   167k|	XYZ[2] = (float)((1.-x-y)/y * L);
 1121|   167k|}
TIFFInitSGILog:
 1682|    372|{
 1683|    372|	static const char module[] = "TIFFInitSGILog";
 1684|    372|	LogLuvState* sp;
 1685|       |
 1686|    372|	assert(scheme == COMPRESSION_SGILOG24 || scheme == COMPRESSION_SGILOG);
 1687|       |
 1688|       |	/*
 1689|       |	 * Merge codec-specific tag information.
 1690|       |	 */
 1691|    372|	if (!_TIFFMergeFields(tif, LogLuvFields,
  ------------------
  |  Branch (1691:6): [True: 0, False: 372]
  ------------------
 1692|    372|			      TIFFArrayCount(LogLuvFields))) {
  ------------------
  |  |  261|    372|#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
  ------------------
 1693|      0|		TIFFErrorExtR(tif, module,
 1694|      0|		    "Merging SGILog codec-specific tags failed");
 1695|      0|		return 0;
 1696|      0|	}
 1697|       |
 1698|       |	/*
 1699|       |	 * Allocate state block so tag methods have storage to record values.
 1700|       |	 */
 1701|    372|	tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof (LogLuvState));
 1702|    372|	if (tif->tif_data == NULL)
  ------------------
  |  Branch (1702:6): [True: 0, False: 372]
  ------------------
 1703|      0|		goto bad;
 1704|    372|	sp = (LogLuvState*) tif->tif_data;
 1705|    372|	_TIFFmemset((void*)sp, 0, sizeof (*sp));
 1706|    372|	sp->user_datafmt = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  175|    372|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1707|    372|	sp->encode_meth = (scheme == COMPRESSION_SGILOG24) ?
  ------------------
  |  |  206|    372|#define     COMPRESSION_SGILOG24	34677	/* SGI Log 24-bit packed */
  ------------------
  |  Branch (1707:20): [True: 108, False: 264]
  ------------------
 1708|    264|	    SGILOGENCODE_RANDITHER : SGILOGENCODE_NODITHER;
  ------------------
  |  |  660|    108|#define     SGILOGENCODE_RANDITHER	1     /* randomly dither encd values */
  ------------------
              	    SGILOGENCODE_RANDITHER : SGILOGENCODE_NODITHER;
  ------------------
  |  |  659|    636|#define     SGILOGENCODE_NODITHER	0     /* do not dither encoded values*/
  ------------------
 1709|    372|	sp->tfunc = _logLuvNop;
 1710|       |
 1711|       |	/*
 1712|       |	 * Install codec methods.
 1713|       |	 * NB: tif_decoderow & tif_encoderow are filled
 1714|       |	 *     in at setup time.
 1715|       |	 */
 1716|    372|	tif->tif_fixuptags = LogLuvFixupTags;  
 1717|    372|	tif->tif_setupdecode = LogLuvSetupDecode;
 1718|    372|	tif->tif_decodestrip = LogLuvDecodeStrip;
 1719|    372|	tif->tif_decodetile = LogLuvDecodeTile;
 1720|    372|	tif->tif_setupencode = LogLuvSetupEncode;
 1721|    372|	tif->tif_encodestrip = LogLuvEncodeStrip;  
 1722|    372|	tif->tif_encodetile = LogLuvEncodeTile;
 1723|    372|	tif->tif_close = LogLuvClose;
 1724|    372|	tif->tif_cleanup = LogLuvCleanup;
 1725|       |
 1726|       |	/*
 1727|       |	 * Override parent get/set field methods.
 1728|       |	 */
 1729|    372|	sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1730|    372|	tif->tif_tagmethods.vgetfield = LogLuvVGetField;   /* hook for codec tags */
 1731|    372|	sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1732|    372|	tif->tif_tagmethods.vsetfield = LogLuvVSetField;   /* hook for codec tags */
 1733|       |
 1734|    372|	return (1);
 1735|      0|bad:
 1736|      0|	TIFFErrorExtR(tif, module,
 1737|      0|		     "%s: No space for LogLuv state block", tif->tif_name);
 1738|      0|	return (0);
 1739|    372|}
tif_luv.c:LogLuvFixupTags:
 1417|    318|{
 1418|    318|	(void) tif;
 1419|    318|	return (1);
 1420|    318|}
tif_luv.c:LogLuvSetupDecode:
 1424|    289|{
 1425|    289|	static const char module[] = "LogLuvSetupDecode";
 1426|    289|	LogLuvState* sp = DecoderState(tif);
  ------------------
  |  |  172|    289|#define DecoderState(tif)	((LogLuvState*) (tif)->tif_data)
  ------------------
 1427|    289|	TIFFDirectory* td = &tif->tif_dir;
 1428|       |
 1429|    289|	tif->tif_postdecode = _TIFFNoPostDecode;
 1430|    289|	switch (td->td_photometric) {
 1431|    186|	case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  227|    186|#define     PHOTOMETRIC_LOGLUV		32845	/* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (1431:2): [True: 186, False: 103]
  ------------------
 1432|    186|		if (!LogLuvInitState(tif))
  ------------------
  |  Branch (1432:7): [True: 0, False: 186]
  ------------------
 1433|      0|			break;
 1434|    186|		if (td->td_compression == COMPRESSION_SGILOG24) {
  ------------------
  |  |  206|    186|#define     COMPRESSION_SGILOG24	34677	/* SGI Log 24-bit packed */
  ------------------
  |  Branch (1434:7): [True: 82, False: 104]
  ------------------
 1435|     82|			tif->tif_decoderow = LogLuvDecode24;
 1436|     82|			switch (sp->user_datafmt) {
  ------------------
  |  Branch (1436:12): [True: 0, False: 82]
  ------------------
 1437|      0|			case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  654|      0|#define     SGILOGDATAFMT_FLOAT		0	/* IEEE float samples */
  ------------------
  |  Branch (1437:4): [True: 0, False: 82]
  ------------------
 1438|      0|				sp->tfunc = Luv24toXYZ;  
 1439|      0|				break;
 1440|      0|			case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  655|      0|#define     SGILOGDATAFMT_16BIT		1	/* 16-bit samples */
  ------------------
  |  Branch (1440:4): [True: 0, False: 82]
  ------------------
 1441|      0|				sp->tfunc = Luv24toLuv48;  
 1442|      0|				break;
 1443|     82|			case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  657|     82|#define     SGILOGDATAFMT_8BIT		3	/* 8-bit RGB monitor values */
  ------------------
  |  Branch (1443:4): [True: 82, False: 0]
  ------------------
 1444|     82|				sp->tfunc = Luv24toRGB;
 1445|     82|				break;
 1446|     82|			}
 1447|    104|		} else {
 1448|    104|			tif->tif_decoderow = LogLuvDecode32;
 1449|    104|			switch (sp->user_datafmt) {
  ------------------
  |  Branch (1449:12): [True: 0, False: 104]
  ------------------
 1450|      0|			case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  654|      0|#define     SGILOGDATAFMT_FLOAT		0	/* IEEE float samples */
  ------------------
  |  Branch (1450:4): [True: 0, False: 104]
  ------------------
 1451|      0|				sp->tfunc = Luv32toXYZ;
 1452|      0|				break;
 1453|      0|			case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  655|      0|#define     SGILOGDATAFMT_16BIT		1	/* 16-bit samples */
  ------------------
  |  Branch (1453:4): [True: 0, False: 104]
  ------------------
 1454|      0|				sp->tfunc = Luv32toLuv48;
 1455|      0|				break;
 1456|    104|			case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  657|    104|#define     SGILOGDATAFMT_8BIT		3	/* 8-bit RGB monitor values */
  ------------------
  |  Branch (1456:4): [True: 104, False: 0]
  ------------------
 1457|    104|				sp->tfunc = Luv32toRGB;
 1458|    104|				break;
 1459|    104|			}
 1460|    104|		}
 1461|    186|		return (1);
 1462|    100|	case PHOTOMETRIC_LOGL:
  ------------------
  |  |  226|    100|#define     PHOTOMETRIC_LOGL		32844	/* CIE Log2(L) */
  ------------------
  |  Branch (1462:2): [True: 100, False: 189]
  ------------------
 1463|    100|		if (!LogL16InitState(tif))
  ------------------
  |  Branch (1463:7): [True: 1, False: 99]
  ------------------
 1464|      1|			break;
 1465|     99|		tif->tif_decoderow = LogL16Decode;
 1466|     99|		switch (sp->user_datafmt) {
  ------------------
  |  Branch (1466:11): [True: 0, False: 99]
  ------------------
 1467|      0|		case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  654|      0|#define     SGILOGDATAFMT_FLOAT		0	/* IEEE float samples */
  ------------------
  |  Branch (1467:3): [True: 0, False: 99]
  ------------------
 1468|      0|			sp->tfunc = L16toY;
 1469|      0|			break;
 1470|     99|		case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  657|     99|#define     SGILOGDATAFMT_8BIT		3	/* 8-bit RGB monitor values */
  ------------------
  |  Branch (1470:3): [True: 99, False: 0]
  ------------------
 1471|     99|			sp->tfunc = L16toGry;
 1472|     99|			break;
 1473|     99|		}
 1474|     99|		return (1);
 1475|      3|	default:
  ------------------
  |  Branch (1475:2): [True: 3, False: 286]
  ------------------
 1476|      3|		TIFFErrorExtR(tif, module,
 1477|      3|		    "Inappropriate photometric interpretation %"PRIu16" for SGILog compression; %s",
 1478|      3|		    td->td_photometric, "must be either LogLUV or LogL");
 1479|      3|		break;
 1480|    289|	}
 1481|      4|	return (0);
 1482|    289|}
tif_luv.c:LogLuvInitState:
 1367|    186|{
 1368|    186|	static const char module[] = "LogLuvInitState";
 1369|    186|	TIFFDirectory* td = &tif->tif_dir;
 1370|    186|	LogLuvState* sp = DecoderState(tif);
  ------------------
  |  |  172|    186|#define DecoderState(tif)	((LogLuvState*) (tif)->tif_data)
  ------------------
 1371|       |
 1372|    186|	assert(sp != NULL);
 1373|    186|	assert(td->td_photometric == PHOTOMETRIC_LOGLUV);
 1374|       |
 1375|       |	/* for some reason, we can't do this in TIFFInitLogLuv */
 1376|    186|	if (td->td_planarconfig != PLANARCONFIG_CONTIG) {
  ------------------
  |  |  259|    186|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (1376:6): [True: 0, False: 186]
  ------------------
 1377|      0|		TIFFErrorExtR(tif, module,
 1378|      0|		    "SGILog compression cannot handle non-contiguous data");
 1379|      0|		return (0);
 1380|      0|	}
 1381|    186|	if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
  ------------------
  |  |  175|    186|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (1381:6): [True: 0, False: 186]
  ------------------
 1382|      0|		sp->user_datafmt = LogLuvGuessDataFmt(td);
 1383|    186|	switch (sp->user_datafmt) {
 1384|      0|	case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  654|      0|#define     SGILOGDATAFMT_FLOAT		0	/* IEEE float samples */
  ------------------
  |  Branch (1384:2): [True: 0, False: 186]
  ------------------
 1385|      0|		sp->pixel_size = 3*sizeof (float);
 1386|      0|		break;
 1387|      0|	case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  655|      0|#define     SGILOGDATAFMT_16BIT		1	/* 16-bit samples */
  ------------------
  |  Branch (1387:2): [True: 0, False: 186]
  ------------------
 1388|      0|		sp->pixel_size = 3*sizeof (int16_t);
 1389|      0|		break;
 1390|      0|	case SGILOGDATAFMT_RAW:
  ------------------
  |  |  656|      0|#define     SGILOGDATAFMT_RAW		2	/* uninterpreted data */
  ------------------
  |  Branch (1390:2): [True: 0, False: 186]
  ------------------
 1391|      0|		sp->pixel_size = sizeof (uint32_t);
 1392|      0|		break;
 1393|    186|	case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  657|    186|#define     SGILOGDATAFMT_8BIT		3	/* 8-bit RGB monitor values */
  ------------------
  |  Branch (1393:2): [True: 186, False: 0]
  ------------------
 1394|    186|		sp->pixel_size = 3*sizeof (uint8_t);
 1395|    186|		break;
 1396|      0|	default:
  ------------------
  |  Branch (1396:2): [True: 0, False: 186]
  ------------------
 1397|      0|		TIFFErrorExtR(tif, module,
 1398|      0|		    "No support for converting user data format to LogLuv");
 1399|      0|		return (0);
 1400|    186|	}
 1401|    186|        if( isTiled(tif) )
  ------------------
  |  |  207|    186|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|    186|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 186, False: 0]
  |  |  ------------------
  ------------------
 1402|    186|            sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength);
 1403|      0|        else if( td->td_rowsperstrip < td->td_imagelength )
  ------------------
  |  Branch (1403:18): [True: 0, False: 0]
  ------------------
 1404|      0|            sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
 1405|      0|        else
 1406|      0|            sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_imagelength);
 1407|    186|	if (multiply_ms(sp->tbuflen, sizeof (uint32_t)) == 0 ||
  ------------------
  |  Branch (1407:6): [True: 0, False: 186]
  ------------------
 1408|    186|        (sp->tbuf = (uint8_t*) _TIFFmalloc(sp->tbuflen * sizeof (uint32_t))) == NULL) {
  ------------------
  |  Branch (1408:9): [True: 0, False: 186]
  ------------------
 1409|      0|		TIFFErrorExtR(tif, module, "No space for SGILog translation buffer");
 1410|      0|		return (0);
 1411|      0|	}
 1412|    186|	return (1);
 1413|    186|}
tif_luv.c:multiply_ms:
 1259|    570|{
 1260|    570|        return _TIFFMultiplySSize(NULL, m1, m2, NULL);
 1261|    570|}
tif_luv.c:LogLuvDecode24:
  254|  22.7k|{
  255|  22.7k|	static const char module[] = "LogLuvDecode24";
  256|  22.7k|	LogLuvState* sp = DecoderState(tif);
  ------------------
  |  |  172|  22.7k|#define DecoderState(tif)	((LogLuvState*) (tif)->tif_data)
  ------------------
  257|  22.7k|	tmsize_t cc;
  258|  22.7k|	tmsize_t i;
  259|  22.7k|	tmsize_t npixels;
  260|  22.7k|	unsigned char* bp;
  261|  22.7k|	uint32_t* tp;
  262|       |
  263|  22.7k|        (void)s;
  264|  22.7k|	assert(s == 0);
  265|  22.7k|	assert(sp != NULL);
  266|       |
  267|  22.7k|	npixels = occ / sp->pixel_size;
  268|       |
  269|  22.7k|	if (sp->user_datafmt == SGILOGDATAFMT_RAW)
  ------------------
  |  |  656|  22.7k|#define     SGILOGDATAFMT_RAW		2	/* uninterpreted data */
  ------------------
  |  Branch (269:6): [True: 0, False: 22.7k]
  ------------------
  270|      0|		tp = (uint32_t *)op;
  271|  22.7k|	else {
  272|  22.7k|		if(sp->tbuflen < npixels) {
  ------------------
  |  Branch (272:6): [True: 0, False: 22.7k]
  ------------------
  273|      0|			TIFFErrorExtR(tif, module,
  274|      0|						 "Translation buffer too short");
  275|      0|			return (0);
  276|      0|		}
  277|  22.7k|		tp = (uint32_t *) sp->tbuf;
  278|  22.7k|	}
  279|       |	/* copy to array of uint32_t */
  280|  22.7k|	bp = (unsigned char*) tif->tif_rawcp;
  281|  22.7k|	cc = tif->tif_rawcc;
  282|  56.8k|	for (i = 0; i < npixels && cc >= 3; i++) {
  ------------------
  |  Branch (282:14): [True: 35.1k, False: 21.7k]
  |  Branch (282:29): [True: 34.1k, False: 998]
  ------------------
  283|  34.1k|		tp[i] = bp[0] << 16 | bp[1] << 8 | bp[2];
  284|  34.1k|		bp += 3;
  285|  34.1k|		cc -= 3;
  286|  34.1k|	}
  287|  22.7k|	tif->tif_rawcp = (uint8_t*) bp;
  288|  22.7k|	tif->tif_rawcc = cc;
  289|  22.7k|	if (i != npixels) {
  ------------------
  |  Branch (289:6): [True: 998, False: 21.7k]
  ------------------
  290|    998|		TIFFErrorExtR(tif, module,
  291|    998|			"Not enough data at row %"PRIu32" (short %"TIFF_SSIZE_FORMAT" pixels)",
  292|    998|			     tif->tif_row,
  293|    998|			     npixels - i);
  294|    998|		return (0);
  295|    998|	}
  296|  21.7k|	(*sp->tfunc)(sp, op, npixels);
  297|  21.7k|	return (1);
  298|  22.7k|}
tif_luv.c:Luv24toRGB:
 1046|  21.7k|{
 1047|  21.7k|	uint32_t* luv = (uint32_t*) sp->tbuf;
 1048|  21.7k|	uint8_t* rgb = (uint8_t*) op;
 1049|       |
 1050|  45.9k|	while (n-- > 0) {
  ------------------
  |  Branch (1050:9): [True: 24.1k, False: 21.7k]
  ------------------
 1051|  24.1k|		float xyz[3];
 1052|       |
 1053|  24.1k|		LogLuv24toXYZ(*luv++, xyz);
 1054|  24.1k|		XYZtoRGB24(xyz, rgb);
 1055|  24.1k|		rgb += 3;
 1056|  24.1k|	}
 1057|  21.7k|}
tif_luv.c:LogLuvDecode32:
  305|  10.2k|{
  306|  10.2k|	static const char module[] = "LogLuvDecode32";
  307|  10.2k|	LogLuvState* sp;
  308|  10.2k|	int shft;
  309|  10.2k|	tmsize_t i;
  310|  10.2k|	tmsize_t npixels;
  311|  10.2k|	unsigned char* bp;
  312|  10.2k|	uint32_t* tp;
  313|  10.2k|	uint32_t b;
  314|  10.2k|	tmsize_t cc;
  315|  10.2k|	int rc;
  316|       |
  317|  10.2k|        (void)s;
  318|  10.2k|	assert(s == 0);
  319|  10.2k|	sp = DecoderState(tif);
  ------------------
  |  |  172|  10.2k|#define DecoderState(tif)	((LogLuvState*) (tif)->tif_data)
  ------------------
  320|  10.2k|	assert(sp != NULL);
  321|       |
  322|  10.2k|	npixels = occ / sp->pixel_size;
  323|       |
  324|  10.2k|	if (sp->user_datafmt == SGILOGDATAFMT_RAW)
  ------------------
  |  |  656|  10.2k|#define     SGILOGDATAFMT_RAW		2	/* uninterpreted data */
  ------------------
  |  Branch (324:6): [True: 0, False: 10.2k]
  ------------------
  325|      0|		tp = (uint32_t*) op;
  326|  10.2k|	else {
  327|  10.2k|		if(sp->tbuflen < npixels) {
  ------------------
  |  Branch (327:6): [True: 0, False: 10.2k]
  ------------------
  328|      0|			TIFFErrorExtR(tif, module,
  329|      0|						 "Translation buffer too short");
  330|      0|			return (0);
  331|      0|		}
  332|  10.2k|		tp = (uint32_t*) sp->tbuf;
  333|  10.2k|	}
  334|  10.2k|	_TIFFmemset((void*) tp, 0, npixels*sizeof (tp[0]));
  335|       |
  336|  10.2k|	bp = (unsigned char*) tif->tif_rawcp;
  337|  10.2k|	cc = tif->tif_rawcc;
  338|       |	/* get each byte string */
  339|  46.8k|	for (shft = 24; shft >= 0; shft -=8) {
  ------------------
  |  Branch (339:18): [True: 37.8k, False: 8.92k]
  ------------------
  340|  1.18M|		for (i = 0; i < npixels && cc > 0; ) {
  ------------------
  |  Branch (340:15): [True: 1.14M, False: 36.5k]
  |  Branch (340:30): [True: 1.14M, False: 1.05k]
  ------------------
  341|  1.14M|			if (*bp >= 128) {		/* run */
  ------------------
  |  Branch (341:8): [True: 73.8k, False: 1.07M]
  ------------------
  342|  73.8k|				if( cc < 2 )
  ------------------
  |  Branch (342:9): [True: 274, False: 73.6k]
  ------------------
  343|    274|					break;
  344|  73.6k|				rc = *bp++ + (2-128);
  345|  73.6k|				b = (uint32_t)*bp++ << shft;
  346|  73.6k|				cc -= 2;
  347|  6.70M|				while (rc-- && i < npixels)
  ------------------
  |  Branch (347:12): [True: 6.66M, False: 44.6k]
  |  Branch (347:20): [True: 6.63M, False: 28.9k]
  ------------------
  348|  6.63M|					tp[i++] |= b;
  349|  1.07M|			} else {			/* non-run */
  350|  1.07M|				rc = *bp++;		/* nul is noop */
  351|  1.55M|				while (--cc && rc-- && i < npixels)
  ------------------
  |  Branch (351:12): [True: 1.55M, False: 987]
  |  Branch (351:20): [True: 492k, False: 1.06M]
  |  Branch (351:28): [True: 484k, False: 7.18k]
  ------------------
  352|   484k|					tp[i++] |= (uint32_t)*bp++ << shft;
  353|  1.07M|			}
  354|  1.14M|		}
  355|  37.8k|		if (i != npixels) {
  ------------------
  |  Branch (355:7): [True: 1.33k, False: 36.5k]
  ------------------
  356|  1.33k|			TIFFErrorExtR(tif, module,
  357|  1.33k|			"Not enough data at row %"PRIu32" (short %"TIFF_SSIZE_FORMAT" pixels)",
  358|  1.33k|				     tif->tif_row,
  359|  1.33k|				     npixels - i);
  360|  1.33k|			tif->tif_rawcp = (uint8_t*) bp;
  361|  1.33k|			tif->tif_rawcc = cc;
  362|  1.33k|			return (0);
  363|  1.33k|		}
  364|  37.8k|	}
  365|  8.92k|	(*sp->tfunc)(sp, op, npixels);
  366|  8.92k|	tif->tif_rawcp = (uint8_t*) bp;
  367|  8.92k|	tif->tif_rawcc = cc;
  368|  8.92k|	return (1);
  369|  10.2k|}
tif_luv.c:Luv32toRGB:
 1184|  8.92k|{
 1185|  8.92k|	uint32_t* luv = (uint32_t*) sp->tbuf;
 1186|  8.92k|	uint8_t* rgb = (uint8_t*) op;
 1187|       |
 1188|  1.76M|	while (n-- > 0) {
  ------------------
  |  Branch (1188:9): [True: 1.75M, False: 8.92k]
  ------------------
 1189|  1.75M|		float xyz[3];
 1190|       |
 1191|  1.75M|		LogLuv32toXYZ(*luv++, xyz);
 1192|  1.75M|		XYZtoRGB24(xyz, rgb);
 1193|  1.75M|		rgb += 3;
 1194|  1.75M|	}
 1195|  8.92k|}
tif_luv.c:LogL16InitState:
 1265|    100|{
 1266|    100|	static const char module[] = "LogL16InitState";
 1267|    100|	TIFFDirectory *td = &tif->tif_dir;
 1268|    100|	LogLuvState* sp = DecoderState(tif);
  ------------------
  |  |  172|    100|#define DecoderState(tif)	((LogLuvState*) (tif)->tif_data)
  ------------------
 1269|       |
 1270|    100|	assert(sp != NULL);
 1271|    100|	assert(td->td_photometric == PHOTOMETRIC_LOGL);
 1272|       |
 1273|    100|	if( td->td_samplesperpixel != 1 )
  ------------------
  |  Branch (1273:6): [True: 1, False: 99]
  ------------------
 1274|      1|	{
 1275|      1|		TIFFErrorExtR(tif, module,
 1276|      1|		             "Sorry, can not handle LogL image with %s=%"PRIu16,
 1277|      1|			     "Samples/pixel", td->td_samplesperpixel);
 1278|      1|		return 0;
 1279|      1|	}
 1280|       |
 1281|       |	/* for some reason, we can't do this in TIFFInitLogL16 */
 1282|     99|	if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
  ------------------
  |  |  175|     99|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (1282:6): [True: 0, False: 99]
  ------------------
 1283|      0|		sp->user_datafmt = LogL16GuessDataFmt(td);
 1284|     99|	switch (sp->user_datafmt) {
 1285|      0|	case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  654|      0|#define     SGILOGDATAFMT_FLOAT		0	/* IEEE float samples */
  ------------------
  |  Branch (1285:2): [True: 0, False: 99]
  ------------------
 1286|      0|		sp->pixel_size = sizeof (float);
 1287|      0|		break;
 1288|      0|	case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  655|      0|#define     SGILOGDATAFMT_16BIT		1	/* 16-bit samples */
  ------------------
  |  Branch (1288:2): [True: 0, False: 99]
  ------------------
 1289|      0|		sp->pixel_size = sizeof (int16_t);
 1290|      0|		break;
 1291|     99|	case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  657|     99|#define     SGILOGDATAFMT_8BIT		3	/* 8-bit RGB monitor values */
  ------------------
  |  Branch (1291:2): [True: 99, False: 0]
  ------------------
 1292|     99|		sp->pixel_size = sizeof (uint8_t);
 1293|     99|		break;
 1294|      0|	default:
  ------------------
  |  Branch (1294:2): [True: 0, False: 99]
  ------------------
 1295|      0|		TIFFErrorExtR(tif, module,
 1296|      0|		    "No support for converting user data format to LogL");
 1297|      0|		return (0);
 1298|     99|	}
 1299|     99|        if( isTiled(tif) )
  ------------------
  |  |  207|     99|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|     99|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 99, False: 0]
  |  |  ------------------
  ------------------
 1300|     99|            sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength);
 1301|      0|        else if( td->td_rowsperstrip < td->td_imagelength )
  ------------------
  |  Branch (1301:18): [True: 0, False: 0]
  ------------------
 1302|      0|            sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
 1303|      0|        else
 1304|      0|            sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_imagelength);
 1305|     99|	if (multiply_ms(sp->tbuflen, sizeof (int16_t)) == 0 ||
  ------------------
  |  Branch (1305:6): [True: 0, False: 99]
  ------------------
 1306|     99|        (sp->tbuf = (uint8_t*) _TIFFmalloc(sp->tbuflen * sizeof (int16_t))) == NULL) {
  ------------------
  |  Branch (1306:9): [True: 0, False: 99]
  ------------------
 1307|      0|		TIFFErrorExtR(tif, module, "No space for SGILog translation buffer");
 1308|      0|		return (0);
 1309|      0|	}
 1310|     99|	return (1);
 1311|     99|}
tif_luv.c:LogL16Decode:
  184|  12.8k|{
  185|  12.8k|	static const char module[] = "LogL16Decode";
  186|  12.8k|	LogLuvState* sp = DecoderState(tif);
  ------------------
  |  |  172|  12.8k|#define DecoderState(tif)	((LogLuvState*) (tif)->tif_data)
  ------------------
  187|  12.8k|	int shft;
  188|  12.8k|	tmsize_t i;
  189|  12.8k|	tmsize_t npixels;
  190|  12.8k|	unsigned char* bp;
  191|  12.8k|	int16_t* tp;
  192|  12.8k|	int16_t b;
  193|  12.8k|	tmsize_t cc;
  194|  12.8k|	int rc;
  195|       |
  196|  12.8k|        (void)s;
  197|  12.8k|	assert(s == 0);
  198|  12.8k|	assert(sp != NULL);
  199|       |
  200|  12.8k|	npixels = occ / sp->pixel_size;
  201|       |
  202|  12.8k|	if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
  ------------------
  |  |  655|  12.8k|#define     SGILOGDATAFMT_16BIT		1	/* 16-bit samples */
  ------------------
  |  Branch (202:6): [True: 0, False: 12.8k]
  ------------------
  203|      0|		tp = (int16_t*) op;
  204|  12.8k|	else {
  205|  12.8k|		if(sp->tbuflen < npixels) {
  ------------------
  |  Branch (205:6): [True: 0, False: 12.8k]
  ------------------
  206|      0|			TIFFErrorExtR(tif, module,
  207|      0|						 "Translation buffer too short");
  208|      0|			return (0);
  209|      0|		}
  210|  12.8k|		tp = (int16_t*) sp->tbuf;
  211|  12.8k|	}
  212|  12.8k|	_TIFFmemset((void*) tp, 0, npixels*sizeof (tp[0]));
  213|       |
  214|  12.8k|	bp = (unsigned char*) tif->tif_rawcp;
  215|  12.8k|	cc = tif->tif_rawcc;
  216|       |	/* get each byte string */
  217|  36.4k|	for (shft = 8; shft >= 0; shft -=8) {
  ------------------
  |  Branch (217:17): [True: 24.9k, False: 11.4k]
  ------------------
  218|   734k|		for (i = 0; i < npixels && cc > 0; ) {
  ------------------
  |  Branch (218:15): [True: 711k, False: 23.5k]
  |  Branch (218:30): [True: 710k, False: 1.16k]
  ------------------
  219|   710k|			if (*bp >= 128) {		/* run */
  ------------------
  |  Branch (219:8): [True: 612k, False: 98.0k]
  ------------------
  220|   612k|				if( cc < 2 )
  ------------------
  |  Branch (220:9): [True: 277, False: 611k]
  ------------------
  221|    277|					break;
  222|   611k|				rc = *bp++ + (2-128);
  223|   611k|				b = (int16_t)(*bp++ << shft);
  224|   611k|				cc -= 2;
  225|  77.8M|				while (rc-- && i < npixels)
  ------------------
  |  Branch (225:12): [True: 77.2M, False: 604k]
  |  Branch (225:20): [True: 77.2M, False: 6.95k]
  ------------------
  226|  77.2M|					tp[i++] |= b;
  227|   611k|			} else {			/* non-run */
  228|  98.0k|				rc = *bp++;		/* nul is noop */
  229|   939k|				while (--cc && rc-- && i < npixels)
  ------------------
  |  Branch (229:12): [True: 938k, False: 1.03k]
  |  Branch (229:20): [True: 855k, False: 83.3k]
  |  Branch (229:28): [True: 841k, False: 13.7k]
  ------------------
  230|   841k|					tp[i++] |= (int16_t)*bp++ << shft;
  231|  98.0k|			}
  232|   710k|		}
  233|  24.9k|		if (i != npixels) {
  ------------------
  |  Branch (233:7): [True: 1.44k, False: 23.5k]
  ------------------
  234|  1.44k|			TIFFErrorExtR(tif, module,
  235|  1.44k|			    "Not enough data at row %"PRIu32" (short %"TIFF_SSIZE_FORMAT" pixels)",
  236|  1.44k|				     tif->tif_row,
  237|  1.44k|				     npixels - i);
  238|  1.44k|			tif->tif_rawcp = (uint8_t*) bp;
  239|  1.44k|			tif->tif_rawcc = cc;
  240|  1.44k|			return (0);
  241|  1.44k|		}
  242|  24.9k|	}
  243|  11.4k|	(*sp->tfunc)(sp, op, npixels);
  244|  11.4k|	tif->tif_rawcp = (uint8_t*) bp;
  245|  11.4k|	tif->tif_rawcc = cc;
  246|  11.4k|	return (1);
  247|  12.8k|}
tif_luv.c:L16toGry:
  783|  11.4k|{
  784|  11.4k|	int16_t* l16 = (int16_t*) sp->tbuf;
  785|  11.4k|	uint8_t* gp = (uint8_t*) op;
  786|       |
  787|  33.4M|	while (n-- > 0) {
  ------------------
  |  Branch (787:9): [True: 33.4M, False: 11.4k]
  ------------------
  788|  33.4M|		double Y = LogL16toY(*l16++);
  789|  33.4M|		*gp++ = (uint8_t) ((Y <= 0.) ? 0 : (Y >= 1.) ? 255 : (int)(256. * sqrt(Y)));
  ------------------
  |  Branch (789:22): [True: 32.8M, False: 597k]
  |  Branch (789:38): [True: 133k, False: 464k]
  ------------------
  790|  33.4M|	}
  791|  11.4k|}
tif_luv.c:LogLuvDecodeTile:
  399|  4.10k|{
  400|  4.10k|	tmsize_t rowlen = TIFFTileRowSize(tif);
  401|       |
  402|  4.10k|        if (rowlen == 0)
  ------------------
  |  Branch (402:13): [True: 0, False: 4.10k]
  ------------------
  403|      0|                return 0;
  404|       |
  405|  4.10k|	assert(cc%rowlen == 0);
  406|  46.2k|	while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s)) {
  ------------------
  |  Branch (406:9): [True: 45.8k, False: 331]
  |  Branch (406:15): [True: 42.1k, False: 3.77k]
  ------------------
  407|  42.1k|		bp += rowlen;
  408|  42.1k|		cc -= rowlen;
  409|  42.1k|	}
  410|  4.10k|	return (cc == 0);
  411|  4.10k|}
tif_luv.c:LogLuvCleanup:
 1582|    372|{
 1583|    372|	LogLuvState* sp = (LogLuvState *)tif->tif_data;
 1584|       |
 1585|    372|	assert(sp != 0);
 1586|       |
 1587|    372|	tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1588|    372|	tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1589|       |
 1590|    372|	if (sp->tbuf)
  ------------------
  |  Branch (1590:6): [True: 285, False: 87]
  ------------------
 1591|    285|		_TIFFfree(sp->tbuf);
 1592|    372|	_TIFFfree(sp);
 1593|    372|	tif->tif_data = NULL;
 1594|       |
 1595|    372|	_TIFFSetDefaultCompressionState(tif);
 1596|    372|}
tif_luv.c:LogLuvVGetField:
 1663|  4.40k|{
 1664|  4.40k|	LogLuvState *sp = (LogLuvState *)tif->tif_data;
 1665|       |
 1666|  4.40k|	switch (tag) {
 1667|      0|	case TIFFTAG_SGILOGDATAFMT:
  ------------------
  |  |  653|      0|#define TIFFTAG_SGILOGDATAFMT		65560	/* SGILog user data format */
  ------------------
  |  Branch (1667:2): [True: 0, False: 4.40k]
  ------------------
 1668|      0|		*va_arg(ap, int*) = sp->user_datafmt;
 1669|      0|		return (1);
 1670|  4.40k|	default:
  ------------------
  |  Branch (1670:2): [True: 4.40k, False: 0]
  ------------------
 1671|  4.40k|		return (*sp->vgetparent)(tif, tag, ap);
 1672|  4.40k|	}
 1673|  4.40k|}
tif_luv.c:LogLuvVSetField:
 1600|  3.14k|{
 1601|  3.14k|	static const char module[] = "LogLuvVSetField";
 1602|  3.14k|	LogLuvState* sp = DecoderState(tif);
  ------------------
  |  |  172|  3.14k|#define DecoderState(tif)	((LogLuvState*) (tif)->tif_data)
  ------------------
 1603|  3.14k|	int bps, fmt;
 1604|       |
 1605|  3.14k|	switch (tag) {
 1606|    287|	case TIFFTAG_SGILOGDATAFMT:
  ------------------
  |  |  653|    287|#define TIFFTAG_SGILOGDATAFMT		65560	/* SGILog user data format */
  ------------------
  |  Branch (1606:2): [True: 287, False: 2.86k]
  ------------------
 1607|    287|		sp->user_datafmt = (int) va_arg(ap, int);
 1608|       |		/*
 1609|       |		 * Tweak the TIFF header so that the rest of libtiff knows what
 1610|       |		 * size of data will be passed between app and library, and
 1611|       |		 * assume that the app knows what it is doing and is not
 1612|       |		 * confused by these header manipulations...
 1613|       |		 */
 1614|    287|		switch (sp->user_datafmt) {
 1615|      0|		case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  654|      0|#define     SGILOGDATAFMT_FLOAT		0	/* IEEE float samples */
  ------------------
  |  Branch (1615:3): [True: 0, False: 287]
  ------------------
 1616|      0|			bps = 32;
 1617|      0|			fmt = SAMPLEFORMAT_IEEEFP;
  ------------------
  |  |  330|      0|#define	    SAMPLEFORMAT_IEEEFP		3	/* !IEEE floating point data */
  ------------------
 1618|      0|			break;
 1619|      0|		case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  655|      0|#define     SGILOGDATAFMT_16BIT		1	/* 16-bit samples */
  ------------------
  |  Branch (1619:3): [True: 0, False: 287]
  ------------------
 1620|      0|			bps = 16;
 1621|      0|			fmt = SAMPLEFORMAT_INT;
  ------------------
  |  |  329|      0|#define	    SAMPLEFORMAT_INT		2	/* !signed integer data */
  ------------------
 1622|      0|			break;
 1623|      0|		case SGILOGDATAFMT_RAW:
  ------------------
  |  |  656|      0|#define     SGILOGDATAFMT_RAW		2	/* uninterpreted data */
  ------------------
  |  Branch (1623:3): [True: 0, False: 287]
  ------------------
 1624|      0|			bps = 32;
 1625|      0|			fmt = SAMPLEFORMAT_UINT;
  ------------------
  |  |  328|      0|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
 1626|      0|			TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
  ------------------
  |  |  251|      0|#define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
  ------------------
 1627|      0|			break;
 1628|    287|		case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  657|    287|#define     SGILOGDATAFMT_8BIT		3	/* 8-bit RGB monitor values */
  ------------------
  |  Branch (1628:3): [True: 287, False: 0]
  ------------------
 1629|    287|			bps = 8;
 1630|    287|			fmt = SAMPLEFORMAT_UINT;
  ------------------
  |  |  328|    287|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
 1631|    287|			break;
 1632|      0|		default:
  ------------------
  |  Branch (1632:3): [True: 0, False: 287]
  ------------------
 1633|      0|			TIFFErrorExtR(tif, tif->tif_name,
 1634|      0|			    "Unknown data format %d for LogLuv compression",
 1635|      0|			    sp->user_datafmt);
 1636|      0|			return (0);
 1637|    287|		}
 1638|    287|		TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps);
  ------------------
  |  |  174|    287|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
 1639|    287|		TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, fmt);
  ------------------
  |  |  327|    287|#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
  ------------------
 1640|       |		/*
 1641|       |		 * Must recalculate sizes should bits/sample change.
 1642|       |		 */
 1643|    287|		tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t) -1;
  ------------------
  |  |  207|    287|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|    287|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 287, False: 0]
  |  |  ------------------
  ------------------
 1644|    287|		tif->tif_scanlinesize = TIFFScanlineSize(tif);
 1645|    287|		return (1);
 1646|      0|	case TIFFTAG_SGILOGENCODE:
  ------------------
  |  |  658|      0|#define TIFFTAG_SGILOGENCODE		65561 /* SGILog data encoding control*/
  ------------------
  |  Branch (1646:2): [True: 0, False: 3.14k]
  ------------------
 1647|      0|		sp->encode_meth = (int) va_arg(ap, int);
 1648|      0|		if (sp->encode_meth != SGILOGENCODE_NODITHER &&
  ------------------
  |  |  659|      0|#define     SGILOGENCODE_NODITHER	0     /* do not dither encoded values*/
  ------------------
  |  Branch (1648:7): [True: 0, False: 0]
  ------------------
 1649|      0|		    sp->encode_meth != SGILOGENCODE_RANDITHER) {
  ------------------
  |  |  660|      0|#define     SGILOGENCODE_RANDITHER	1     /* randomly dither encd values */
  ------------------
  |  Branch (1649:7): [True: 0, False: 0]
  ------------------
 1650|      0|			TIFFErrorExtR(tif, module,
 1651|      0|			    "Unknown encoding %d for LogLuv compression",
 1652|      0|			    sp->encode_meth);
 1653|      0|			return (0);
 1654|      0|		}
 1655|      0|		return (1);
 1656|  2.86k|	default:
  ------------------
  |  Branch (1656:2): [True: 2.86k, False: 287]
  ------------------
 1657|  2.86k|		return (*sp->vsetparent)(tif, tag, ap);
 1658|  3.14k|	}
 1659|  3.14k|}

TIFFInitLZMA:
  418|    137|{
  419|    137|	static const char module[] = "TIFFInitLZMA";
  420|    137|	LZMAState* sp;
  421|    137|	lzma_stream tmp_stream = LZMA_STREAM_INIT;
  422|       |
  423|    137|        (void)scheme;
  424|    137|	assert( scheme == COMPRESSION_LZMA );
  425|       |
  426|       |	/*
  427|       |	 * Merge codec-specific tag information.
  428|       |	 */
  429|    137|	if (!_TIFFMergeFields(tif, lzmaFields, TIFFArrayCount(lzmaFields))) {
  ------------------
  |  |  261|    137|#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
  ------------------
  |  Branch (429:6): [True: 0, False: 137]
  ------------------
  430|      0|		TIFFErrorExtR(tif, module,
  431|      0|			     "Merging LZMA2 codec-specific tags failed");
  432|      0|		return 0;
  433|      0|	}
  434|       |
  435|       |	/*
  436|       |	 * Allocate state block so tag methods have storage to record values.
  437|       |	 */
  438|    137|	tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof(LZMAState));
  439|    137|	if (tif->tif_data == NULL)
  ------------------
  |  Branch (439:6): [True: 0, False: 137]
  ------------------
  440|      0|		goto bad;
  441|    137|	sp = LState(tif);
  ------------------
  |  |   60|    137|#define LState(tif)             ((LZMAState*) (tif)->tif_data)
  ------------------
  442|    137|	memcpy(&sp->stream, &tmp_stream, sizeof(lzma_stream));
  443|       |
  444|       |	/*
  445|       |	 * Override parent get/set field methods.
  446|       |	 */
  447|    137|	sp->vgetparent = tif->tif_tagmethods.vgetfield;
  448|    137|	tif->tif_tagmethods.vgetfield = LZMAVGetField;	/* hook for codec tags */
  449|    137|	sp->vsetparent = tif->tif_tagmethods.vsetfield;
  450|    137|	tif->tif_tagmethods.vsetfield = LZMAVSetField;	/* hook for codec tags */
  451|       |
  452|       |	/* Default values for codec-specific fields */
  453|    137|	sp->preset = LZMA_PRESET_DEFAULT;		/* default comp. level */
  454|    137|	sp->check = LZMA_CHECK_NONE;
  455|    137|	sp->state = 0;
  456|       |
  457|       |	/* Data filters. So far we are using delta and LZMA2 filters only. */
  458|    137|	sp->opt_delta.type = LZMA_DELTA_TYPE_BYTE;
  459|       |	/*
  460|       |	 * The sample size in bytes seems to be reasonable distance for delta
  461|       |	 * filter.
  462|       |	 */
  463|    137|	sp->opt_delta.dist = (tif->tif_dir.td_bitspersample % 8) ?
  ------------------
  |  Branch (463:23): [True: 137, False: 0]
  ------------------
  464|    137|		1 : tif->tif_dir.td_bitspersample / 8;
  465|    137|	sp->filters[0].id = LZMA_FILTER_DELTA;
  466|    137|	sp->filters[0].options = &sp->opt_delta;
  467|       |
  468|    137|	lzma_lzma_preset(&sp->opt_lzma, sp->preset);
  469|    137|	sp->filters[1].id = LZMA_FILTER_LZMA2;
  470|    137|	sp->filters[1].options = &sp->opt_lzma;
  471|       |
  472|    137|	sp->filters[2].id = LZMA_VLI_UNKNOWN;
  473|    137|	sp->filters[2].options = NULL;
  474|       |
  475|       |	/*
  476|       |	 * Install codec methods.
  477|       |	 */
  478|    137|	tif->tif_fixuptags = LZMAFixupTags;
  479|    137|	tif->tif_setupdecode = LZMASetupDecode;
  480|    137|	tif->tif_predecode = LZMAPreDecode;
  481|    137|	tif->tif_decoderow = LZMADecode;
  482|    137|	tif->tif_decodestrip = LZMADecode;
  483|    137|	tif->tif_decodetile = LZMADecode;
  484|    137|	tif->tif_setupencode = LZMASetupEncode;
  485|    137|	tif->tif_preencode = LZMAPreEncode;
  486|    137|	tif->tif_postencode = LZMAPostEncode;
  487|    137|	tif->tif_encoderow = LZMAEncode;
  488|    137|	tif->tif_encodestrip = LZMAEncode;
  489|    137|	tif->tif_encodetile = LZMAEncode;
  490|    137|	tif->tif_cleanup = LZMACleanup;
  491|       |	/*
  492|       |	 * Setup predictor setup.
  493|       |	 */
  494|    137|	(void) TIFFPredictorInit(tif);
  495|    137|	return 1;
  496|      0|bad:
  497|      0|	TIFFErrorExtR(tif, module,
  498|      0|		     "No space for LZMA2 state block");
  499|      0|	return 0;
  500|    137|}
tif_lzma.c:LZMAVGetField:
  398|  2.55k|{
  399|  2.55k|	LZMAState* sp = LState(tif);
  ------------------
  |  |   60|  2.55k|#define LState(tif)             ((LZMAState*) (tif)->tif_data)
  ------------------
  400|       |
  401|  2.55k|	switch (tag) {
  402|      0|	case TIFFTAG_LZMAPRESET:
  ------------------
  |  |  661|      0|#define	TIFFTAG_LZMAPRESET		65562	/* LZMA2 preset (compression level) */
  ------------------
  |  Branch (402:2): [True: 0, False: 2.55k]
  ------------------
  403|      0|		*va_arg(ap, int*) = sp->preset;
  404|      0|		break;
  405|  2.55k|	default:
  ------------------
  |  Branch (405:2): [True: 2.55k, False: 0]
  ------------------
  406|  2.55k|		return (*sp->vgetparent)(tif, tag, ap);
  407|  2.55k|	}
  408|      0|	return 1;
  409|  2.55k|}
tif_lzma.c:LZMAVSetField:
  371|  2.10k|{
  372|  2.10k|	static const char module[] = "LZMAVSetField";
  373|  2.10k|	LZMAState* sp = LState(tif);
  ------------------
  |  |   60|  2.10k|#define LState(tif)             ((LZMAState*) (tif)->tif_data)
  ------------------
  374|       |
  375|  2.10k|	switch (tag) {
  376|      0|	case TIFFTAG_LZMAPRESET:
  ------------------
  |  |  661|      0|#define	TIFFTAG_LZMAPRESET		65562	/* LZMA2 preset (compression level) */
  ------------------
  |  Branch (376:2): [True: 0, False: 2.10k]
  ------------------
  377|      0|		sp->preset = (int) va_arg(ap, int);
  378|      0|		lzma_lzma_preset(&sp->opt_lzma, sp->preset);
  379|      0|		if (sp->state & LSTATE_INIT_ENCODE) {
  ------------------
  |  |   54|      0|#define LSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (379:7): [True: 0, False: 0]
  ------------------
  380|      0|			lzma_ret ret = lzma_stream_encoder(&sp->stream,
  381|      0|							   sp->filters,
  382|      0|							   sp->check);
  383|      0|			if (ret != LZMA_OK) {
  ------------------
  |  Branch (383:8): [True: 0, False: 0]
  ------------------
  384|      0|				TIFFErrorExtR(tif, module,
  385|      0|					     "Liblzma error: %s",
  386|      0|					     LZMAStrerror(ret));
  387|      0|			}
  388|      0|		}
  389|      0|		return 1;
  390|  2.10k|	default:
  ------------------
  |  Branch (390:2): [True: 2.10k, False: 0]
  ------------------
  391|  2.10k|		return (*sp->vsetparent)(tif, tag, ap);
  392|  2.10k|	}
  393|       |	/*NOTREACHED*/
  394|  2.10k|}
tif_lzma.c:LZMAStrerror:
   69|  1.06k|{
   70|  1.06k|	switch (ret) {
   71|      0|		case LZMA_OK:
  ------------------
  |  Branch (71:3): [True: 0, False: 1.06k]
  ------------------
   72|      0|		    return "operation completed successfully";
   73|      0|		case LZMA_STREAM_END:
  ------------------
  |  Branch (73:3): [True: 0, False: 1.06k]
  ------------------
   74|      0|		    return "end of stream was reached";
   75|      0|		case LZMA_NO_CHECK:
  ------------------
  |  Branch (75:3): [True: 0, False: 1.06k]
  ------------------
   76|      0|		    return "input stream has no integrity check";
   77|      0|		case LZMA_UNSUPPORTED_CHECK:
  ------------------
  |  Branch (77:3): [True: 0, False: 1.06k]
  ------------------
   78|      0|		    return "cannot calculate the integrity check";
   79|      0|		case LZMA_GET_CHECK:
  ------------------
  |  Branch (79:3): [True: 0, False: 1.06k]
  ------------------
   80|      0|		    return "integrity check type is now available";
   81|      0|		case LZMA_MEM_ERROR:
  ------------------
  |  Branch (81:3): [True: 0, False: 1.06k]
  ------------------
   82|      0|		    return "cannot allocate memory";
   83|      0|		case LZMA_MEMLIMIT_ERROR:
  ------------------
  |  Branch (83:3): [True: 0, False: 1.06k]
  ------------------
   84|      0|		    return "memory usage limit was reached";
   85|    600|		case LZMA_FORMAT_ERROR:
  ------------------
  |  Branch (85:3): [True: 600, False: 469]
  ------------------
   86|    600|		    return "file format not recognized";
   87|      0|		case LZMA_OPTIONS_ERROR:
  ------------------
  |  Branch (87:3): [True: 0, False: 1.06k]
  ------------------
   88|      0|		    return "invalid or unsupported options";
   89|      0|		case LZMA_DATA_ERROR:
  ------------------
  |  Branch (89:3): [True: 0, False: 1.06k]
  ------------------
   90|      0|		    return "data is corrupt";
   91|    469|		case LZMA_BUF_ERROR:
  ------------------
  |  Branch (91:3): [True: 469, False: 600]
  ------------------
   92|    469|		    return "no progress is possible (stream is truncated or corrupt)";
   93|      0|		case LZMA_PROG_ERROR:
  ------------------
  |  Branch (93:3): [True: 0, False: 1.06k]
  ------------------
   94|      0|		    return "programming error";
   95|      0|		default:
  ------------------
  |  Branch (95:3): [True: 0, False: 1.06k]
  ------------------
   96|      0|		    return "unidentified liblzma error";
   97|  1.06k|	}
   98|  1.06k|}
tif_lzma.c:LZMAFixupTags:
  102|     97|{
  103|     97|	(void) tif;
  104|     97|	return 1;
  105|     97|}
tif_lzma.c:LZMASetupDecode:
  109|     88|{
  110|     88|	LZMAState* sp = DecoderState(tif);
  ------------------
  |  |   61|     88|#define DecoderState(tif)       LState(tif)
  |  |  ------------------
  |  |  |  |   60|     88|#define LState(tif)             ((LZMAState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  111|       |
  112|     88|	assert(sp != NULL);
  113|       |        
  114|       |        /* if we were last encoding, terminate this mode */
  115|     88|	if (sp->state & LSTATE_INIT_ENCODE) {
  ------------------
  |  |   54|     88|#define LSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (115:6): [True: 0, False: 88]
  ------------------
  116|      0|	    lzma_end(&sp->stream);
  117|      0|	    sp->state = 0;
  118|      0|	}
  119|       |
  120|     88|	sp->state |= LSTATE_INIT_DECODE;
  ------------------
  |  |   53|     88|#define LSTATE_INIT_DECODE 0x01
  ------------------
  121|     88|	return 1;
  122|     88|}
tif_lzma.c:LZMAPreDecode:
  129|  1.06k|{
  130|  1.06k|	static const char module[] = "LZMAPreDecode";
  131|  1.06k|	LZMAState* sp = DecoderState(tif);
  ------------------
  |  |   61|  1.06k|#define DecoderState(tif)       LState(tif)
  |  |  ------------------
  |  |  |  |   60|  1.06k|#define LState(tif)             ((LZMAState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  132|  1.06k|	lzma_ret ret;
  133|       |
  134|  1.06k|	(void) s;
  135|  1.06k|	assert(sp != NULL);
  136|       |
  137|  1.06k|	if( (sp->state & LSTATE_INIT_DECODE) == 0 )
  ------------------
  |  |   53|  1.06k|#define LSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (137:6): [True: 0, False: 1.06k]
  ------------------
  138|      0|            tif->tif_setupdecode(tif);
  139|       |
  140|  1.06k|	sp->stream.next_in = tif->tif_rawdata;
  141|  1.06k|	sp->stream.avail_in = (size_t) tif->tif_rawcc;
  142|  1.06k|	if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc) {
  ------------------
  |  Branch (142:6): [True: 0, False: 1.06k]
  ------------------
  143|      0|		TIFFErrorExtR(tif, module,
  144|      0|			     "Liblzma cannot deal with buffers this size");
  145|      0|		return 0;
  146|      0|	}
  147|       |
  148|       |	/*
  149|       |	 * Disable memory limit when decoding. UINT64_MAX is a flag to disable
  150|       |	 * the limit, we are passing (uint64_t)-1 which should be the same.
  151|       |	 */
  152|  1.06k|	ret = lzma_stream_decoder(&sp->stream, (uint64_t)-1, 0);
  153|  1.06k|	if (ret != LZMA_OK) {
  ------------------
  |  Branch (153:6): [True: 0, False: 1.06k]
  ------------------
  154|      0|		TIFFErrorExtR(tif, module,
  155|      0|			     "Error initializing the stream decoder, %s",
  156|      0|			     LZMAStrerror(ret));
  157|      0|		return 0;
  158|      0|	}
  159|  1.06k|	return 1;
  160|  1.06k|}
tif_lzma.c:LZMADecode:
  164|  1.06k|{
  165|  1.06k|	static const char module[] = "LZMADecode";
  166|  1.06k|	LZMAState* sp = DecoderState(tif);
  ------------------
  |  |   61|  1.06k|#define DecoderState(tif)       LState(tif)
  |  |  ------------------
  |  |  |  |   60|  1.06k|#define LState(tif)             ((LZMAState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  167|       |
  168|  1.06k|	(void) s;
  169|  1.06k|	assert(sp != NULL);
  170|  1.06k|	assert(sp->state == LSTATE_INIT_DECODE);
  171|       |
  172|  1.06k|        sp->stream.next_in = tif->tif_rawcp;
  173|  1.06k|        sp->stream.avail_in = (size_t) tif->tif_rawcc;
  174|       |
  175|  1.06k|	sp->stream.next_out = op;
  176|  1.06k|	sp->stream.avail_out = (size_t) occ;
  177|  1.06k|	if ((tmsize_t)sp->stream.avail_out != occ) {
  ------------------
  |  Branch (177:6): [True: 0, False: 1.06k]
  ------------------
  178|      0|		TIFFErrorExtR(tif, module,
  179|      0|			     "Liblzma cannot deal with buffers this size");
  180|      0|		return 0;
  181|      0|	}
  182|       |
  183|  2.00k|	do {
  184|       |		/*
  185|       |		 * Save the current stream state to properly recover from the
  186|       |		 * decoding errors later.
  187|       |		 */
  188|  2.00k|		const uint8_t *next_in = sp->stream.next_in;
  189|  2.00k|		size_t avail_in = sp->stream.avail_in;
  190|       |
  191|  2.00k|		lzma_ret ret = lzma_code(&sp->stream, LZMA_RUN);
  192|  2.00k|		if (ret == LZMA_STREAM_END)
  ------------------
  |  Branch (192:7): [True: 0, False: 2.00k]
  ------------------
  193|      0|			break;
  194|  2.00k|		if (ret == LZMA_MEMLIMIT_ERROR) {
  ------------------
  |  Branch (194:7): [True: 0, False: 2.00k]
  ------------------
  195|      0|			lzma_ret r = lzma_stream_decoder(&sp->stream,
  196|      0|							 lzma_memusage(&sp->stream), 0);
  197|      0|			if (r != LZMA_OK) {
  ------------------
  |  Branch (197:8): [True: 0, False: 0]
  ------------------
  198|      0|				TIFFErrorExtR(tif, module,
  199|      0|					     "Error initializing the stream decoder, %s",
  200|      0|					     LZMAStrerror(r));
  201|      0|				break;
  202|      0|			}
  203|      0|			sp->stream.next_in = next_in;
  204|      0|			sp->stream.avail_in = avail_in;
  205|      0|			continue;
  206|      0|		}
  207|  2.00k|		if (ret != LZMA_OK) {
  ------------------
  |  Branch (207:7): [True: 1.06k, False: 938]
  ------------------
  208|  1.06k|			TIFFErrorExtR(tif, module,
  209|  1.06k|			    "Decoding error at scanline %"PRIu32", %s",
  210|  1.06k|			    tif->tif_row, LZMAStrerror(ret));
  211|  1.06k|			break;
  212|  1.06k|		}
  213|  2.00k|	} while (sp->stream.avail_out > 0);
  ------------------
  |  Branch (213:11): [True: 938, False: 0]
  ------------------
  214|  1.06k|	if (sp->stream.avail_out != 0) {
  ------------------
  |  Branch (214:6): [True: 1.06k, False: 0]
  ------------------
  215|  1.06k|		TIFFErrorExtR(tif, module,
  216|  1.06k|		    "Not enough data at scanline %"PRIu32" (short %"TIFF_SIZE_FORMAT" bytes)",
  217|  1.06k|		    tif->tif_row, sp->stream.avail_out);
  218|  1.06k|		return 0;
  219|  1.06k|	}
  220|       |
  221|      0|        tif->tif_rawcp = (uint8_t *)sp->stream.next_in; /* cast away const */
  222|      0|        tif->tif_rawcc = sp->stream.avail_in;
  223|       |        
  224|      0|	return 1;
  225|  1.06k|}
tif_lzma.c:LZMACleanup:
  349|    137|{
  350|    137|	LZMAState* sp = LState(tif);
  ------------------
  |  |   60|    137|#define LState(tif)             ((LZMAState*) (tif)->tif_data)
  ------------------
  351|       |
  352|    137|	assert(sp != 0);
  353|       |
  354|    137|	(void)TIFFPredictorCleanup(tif);
  355|       |
  356|    137|	tif->tif_tagmethods.vgetfield = sp->vgetparent;
  357|    137|	tif->tif_tagmethods.vsetfield = sp->vsetparent;
  358|       |
  359|    137|	if (sp->state) {
  ------------------
  |  Branch (359:6): [True: 88, False: 49]
  ------------------
  360|     88|		lzma_end(&sp->stream);
  361|     88|		sp->state = 0;
  362|     88|	}
  363|    137|	_TIFFfree(sp);
  364|    137|	tif->tif_data = NULL;
  365|       |
  366|    137|	_TIFFSetDefaultCompressionState(tif);
  367|    137|}

TIFFInitLZW:
 1301|    683|{
 1302|    683|	static const char module[] = "TIFFInitLZW";
 1303|    683|        (void)scheme;
 1304|    683|	assert(scheme == COMPRESSION_LZW);
 1305|       |	/*
 1306|       |	 * Allocate state block so tag methods have storage to record values.
 1307|       |	 */
 1308|    683|	tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof (LZWCodecState));
 1309|    683|	if (tif->tif_data == NULL)
  ------------------
  |  Branch (1309:6): [True: 0, False: 683]
  ------------------
 1310|      0|		goto bad;
 1311|    683|	DecoderState(tif)->dec_codetab = NULL;
  ------------------
  |  |  158|    683|#define DecoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|    683|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
 1312|    683|	DecoderState(tif)->dec_decode = NULL;
  ------------------
  |  |  158|    683|#define DecoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|    683|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
 1313|    683|	EncoderState(tif)->enc_hashtab = NULL;
  ------------------
  |  |  159|    683|#define EncoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|    683|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
 1314|    683|        LZWState(tif)->rw_mode = tif->tif_mode;
  ------------------
  |  |  157|    683|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  ------------------
 1315|       |
 1316|       |	/*
 1317|       |	 * Install codec methods.
 1318|       |	 */
 1319|    683|	tif->tif_fixuptags = LZWFixupTags;
 1320|    683|	tif->tif_setupdecode = LZWSetupDecode;
 1321|    683|	tif->tif_predecode = LZWPreDecode;
 1322|    683|	tif->tif_decoderow = LZWDecode;
 1323|    683|	tif->tif_decodestrip = LZWDecode;
 1324|    683|	tif->tif_decodetile = LZWDecode;
 1325|    683|	tif->tif_setupencode = LZWSetupEncode;
 1326|    683|	tif->tif_preencode = LZWPreEncode;
 1327|    683|	tif->tif_postencode = LZWPostEncode;
 1328|    683|	tif->tif_encoderow = LZWEncode;
 1329|    683|	tif->tif_encodestrip = LZWEncode;
 1330|    683|	tif->tif_encodetile = LZWEncode;
 1331|    683|	tif->tif_cleanup = LZWCleanup;
 1332|       |	/*
 1333|       |	 * Setup predictor setup.
 1334|       |	 */
 1335|    683|	(void) TIFFPredictorInit(tif);
 1336|    683|	return (1);
 1337|      0|bad:
 1338|      0|	TIFFErrorExtR(tif, module,
 1339|      0|		     "No space for LZW state block");
 1340|      0|	return (0);
 1341|    683|}
tif_lzw.c:LZWFixupTags:
  173|    642|{
  174|    642|	(void) tif;
  175|    642|	return (1);
  176|    642|}
tif_lzw.c:LZWSetupDecode:
  180|    803|{
  181|    803|	static const char module[] = "LZWSetupDecode";
  182|    803|	LZWCodecState* sp = DecoderState(tif);
  ------------------
  |  |  158|    803|#define DecoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|    803|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  183|    803|	int code;
  184|       |
  185|    803|	if( sp == NULL )
  ------------------
  |  Branch (185:6): [True: 0, False: 803]
  ------------------
  186|      0|	{
  187|       |		/*
  188|       |		 * Allocate state block so tag methods have storage to record
  189|       |		 * values.
  190|       |		*/
  191|      0|		tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof(LZWCodecState));
  192|      0|		if (tif->tif_data == NULL)
  ------------------
  |  Branch (192:7): [True: 0, False: 0]
  ------------------
  193|      0|		{
  194|      0|			TIFFErrorExtR(tif, module, "No space for LZW state block");
  195|      0|			return (0);
  196|      0|		}
  197|       |
  198|      0|		sp = DecoderState(tif);
  ------------------
  |  |  158|      0|#define DecoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|      0|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  199|      0|		sp->dec_codetab = NULL;
  200|      0|		sp->dec_decode = NULL;
  201|       |
  202|       |		/*
  203|       |		 * Setup predictor setup.
  204|       |		 */
  205|      0|		(void) TIFFPredictorInit(tif);
  206|      0|	}
  207|       |
  208|    803|	if (sp->dec_codetab == NULL) {
  ------------------
  |  Branch (208:6): [True: 613, False: 190]
  ------------------
  209|    613|		sp->dec_codetab = (code_t*)_TIFFmalloc(CSIZE*sizeof (code_t));
  ------------------
  |  |   79|    613|#define CSIZE           (MAXCODE(BITS_MAX)+1024L)
  |  |  ------------------
  |  |  |  |   63|    613|#define MAXCODE(n)	((1L<<(n))-1)
  |  |  ------------------
  ------------------
  210|    613|		if (sp->dec_codetab == NULL) {
  ------------------
  |  Branch (210:7): [True: 0, False: 613]
  ------------------
  211|      0|			TIFFErrorExtR(tif, module,
  212|      0|				     "No space for LZW code table");
  213|      0|			return (0);
  214|      0|		}
  215|       |		/*
  216|       |		 * Pre-load the table.
  217|       |		 */
  218|    613|		code = 255;
  219|   156k|		do {
  220|   156k|			sp->dec_codetab[code].firstchar = (unsigned char)code;
  221|   156k|			sp->dec_codetab[code].value = (unsigned char)code;
  222|   156k|			sp->dec_codetab[code].repeated = true;
  223|   156k|			sp->dec_codetab[code].length = 1;
  224|   156k|			sp->dec_codetab[code].next = NULL;
  225|   156k|		} while (code--);
  ------------------
  |  Branch (225:12): [True: 156k, False: 613]
  ------------------
  226|       |		/*
  227|       |		 * Zero-out the unused entries  */
  228|       |		/* Silence false positive */
  229|       |		/* coverity[overrun-buffer-arg] */
  230|    613|		memset(&sp->dec_codetab[CODE_CLEAR], 0,
  ------------------
  |  |   71|    613|#define CODE_CLEAR      256             /* code to clear string table */
  ------------------
  231|    613|			     (CODE_FIRST - CODE_CLEAR) * sizeof (code_t));
  ------------------
  |  |   73|    613|#define CODE_FIRST      258             /* first free code entry */
  ------------------
              			     (CODE_FIRST - CODE_CLEAR) * sizeof (code_t));
  ------------------
  |  |   71|    613|#define CODE_CLEAR      256             /* code to clear string table */
  ------------------
  232|    613|	}
  233|    803|	return (1);
  234|    803|}
tif_lzw.c:LZWPreDecode:
  241|  18.4k|{
  242|  18.4k|	static const char module[] = "LZWPreDecode";
  243|  18.4k|	LZWCodecState *sp = DecoderState(tif);
  ------------------
  |  |  158|  18.4k|#define DecoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|  18.4k|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  244|       |
  245|  18.4k|	(void) s;
  246|  18.4k|	assert(sp != NULL);
  247|  18.4k|	if( sp->dec_codetab == NULL )
  ------------------
  |  Branch (247:6): [True: 0, False: 18.4k]
  ------------------
  248|      0|        {
  249|      0|            tif->tif_setupdecode( tif );
  250|      0|	    if( sp->dec_codetab == NULL )
  ------------------
  |  Branch (250:10): [True: 0, False: 0]
  ------------------
  251|      0|		return (0);
  252|      0|        }
  253|       |
  254|       |	/*
  255|       |	 * Check for old bit-reversed codes.
  256|       |	 */
  257|  18.4k|	if (tif->tif_rawcc >= 2 &&
  ------------------
  |  Branch (257:6): [True: 16.5k, False: 1.89k]
  ------------------
  258|  18.4k|	    tif->tif_rawdata[0] == 0 && (tif->tif_rawdata[1] & 0x1)) {
  ------------------
  |  Branch (258:6): [True: 4.57k, False: 11.9k]
  |  Branch (258:34): [True: 2.73k, False: 1.84k]
  ------------------
  259|  2.73k|#ifdef LZW_COMPAT
  260|  2.73k|		if (!sp->dec_decode) {
  ------------------
  |  Branch (260:7): [True: 190, False: 2.54k]
  ------------------
  261|    190|			TIFFWarningExtR(tif, module,
  262|    190|			    "Old-style LZW codes, convert file");
  263|       |			/*
  264|       |			 * Override default decoding methods with
  265|       |			 * ones that deal with the old coding.
  266|       |			 * Otherwise the predictor versions set
  267|       |			 * above will call the compatibility routines
  268|       |			 * through the dec_decode method.
  269|       |			 */
  270|    190|			tif->tif_decoderow = LZWDecodeCompat;
  271|    190|			tif->tif_decodestrip = LZWDecodeCompat;
  272|    190|			tif->tif_decodetile = LZWDecodeCompat;
  273|       |			/*
  274|       |			 * If doing horizontal differencing, must
  275|       |			 * re-setup the predictor logic since we
  276|       |			 * switched the basic decoder methods...
  277|       |			 */
  278|    190|			(*tif->tif_setupdecode)(tif);
  279|    190|			sp->dec_decode = LZWDecodeCompat;
  280|    190|		}
  281|  2.73k|		sp->lzw_maxcode = MAXCODE(BITS_MIN);
  ------------------
  |  |  102|  2.73k|#define lzw_maxcode     base.maxcode
  ------------------
              		sp->lzw_maxcode = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  2.73k|#define MAXCODE(n)	((1L<<(n))-1)
  ------------------
  282|       |#else /* !LZW_COMPAT */
  283|       |		if (!sp->dec_decode) {
  284|       |			TIFFErrorExtR(tif, module,
  285|       |			    "Old-style LZW codes not supported");
  286|       |			sp->dec_decode = LZWDecode;
  287|       |		}
  288|       |		return (0);
  289|       |#endif/* !LZW_COMPAT */
  290|  15.7k|	} else {
  291|  15.7k|		sp->lzw_maxcode = MAXCODE(BITS_MIN)-1;
  ------------------
  |  |  102|  15.7k|#define lzw_maxcode     base.maxcode
  ------------------
              		sp->lzw_maxcode = MAXCODE(BITS_MIN)-1;
  ------------------
  |  |   63|  15.7k|#define MAXCODE(n)	((1L<<(n))-1)
  ------------------
  292|  15.7k|		sp->dec_decode = LZWDecode;
  293|  15.7k|	}
  294|  18.4k|	sp->lzw_nbits = BITS_MIN;
  ------------------
  |  |  101|  18.4k|#define lzw_nbits       base.nbits
  ------------------
              	sp->lzw_nbits = BITS_MIN;
  ------------------
  |  |   68|  18.4k|#define BITS_MIN        9               /* start with 9 bits */
  ------------------
  295|  18.4k|	sp->lzw_nextbits = 0;
  ------------------
  |  |  105|  18.4k|#define lzw_nextbits    base.nextbits
  ------------------
  296|  18.4k|	sp->lzw_nextdata = 0;
  ------------------
  |  |  104|  18.4k|#define lzw_nextdata    base.nextdata
  ------------------
  297|       |
  298|  18.4k|	sp->dec_restart = 0;
  299|  18.4k|	sp->dec_nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  18.4k|#define MAXCODE(n)	((1L<<(n))-1)
  ------------------
  300|  18.4k|	sp->dec_bitsleft = 0;
  301|  18.4k|	sp->old_tif_rawcc = 0;
  302|  18.4k|	sp->dec_free_entp = sp->dec_codetab  - 1 ; // + CODE_FIRST;
  303|       |	/*
  304|       |	 * Zero entries that are not yet filled in.  We do
  305|       |	 * this to guard against bogus input data that causes
  306|       |	 * us to index into undefined entries.  If you can
  307|       |	 * come up with a way to safely bounds-check input codes
  308|       |	 * while decoding then you can remove this operation.
  309|       |	 */
  310|  18.4k|	sp->dec_oldcodep = &sp->dec_codetab[0];
  311|  18.4k|	sp->dec_maxcodep = &sp->dec_codetab[sp->dec_nbitsmask-1];
  312|  18.4k|	sp->read_error = 0;
  313|  18.4k|	return (1);
  314|  18.4k|}
tif_lzw.c:LZWDecodeCompat:
  754|  4.36k|{
  755|  4.36k|	static const char module[] = "LZWDecodeCompat";
  756|  4.36k|	LZWCodecState *sp = DecoderState(tif);
  ------------------
  |  |  158|  4.36k|#define DecoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|  4.36k|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  757|  4.36k|	uint8_t *op = (uint8_t*) op0;
  758|  4.36k|	tmsize_t occ = occ0;
  759|  4.36k|	uint8_t *tp;
  760|  4.36k|	uint8_t *bp;
  761|  4.36k|	int code, nbits;
  762|  4.36k|	int len;
  763|  4.36k|	long nextbits, nbitsmask;
  764|  4.36k|	WordType nextdata;
  765|  4.36k|	code_t *codep, *free_entp, *maxcodep, *oldcodep;
  766|       |
  767|  4.36k|	(void) s;
  768|  4.36k|	assert(sp != NULL);
  769|       |
  770|       |	/*
  771|       |	 * Restart interrupted output operation.
  772|       |	 */
  773|  4.36k|	if (sp->dec_restart) {
  ------------------
  |  Branch (773:6): [True: 0, False: 4.36k]
  ------------------
  774|      0|		tmsize_t residue;
  775|       |
  776|      0|		codep = sp->dec_codep;
  777|      0|		residue = codep->length - sp->dec_restart;
  778|      0|		if (residue > occ) {
  ------------------
  |  Branch (778:7): [True: 0, False: 0]
  ------------------
  779|       |			/*
  780|       |			 * Residue from previous decode is sufficient
  781|       |			 * to satisfy decode request.  Skip to the
  782|       |			 * start of the decoded string, place decoded
  783|       |			 * values in the output buffer, and return.
  784|       |			 */
  785|      0|			sp->dec_restart += occ;
  786|      0|			do {
  787|      0|				codep = codep->next;
  788|      0|			} while (--residue > occ);
  ------------------
  |  Branch (788:13): [True: 0, False: 0]
  ------------------
  789|      0|			tp = op + occ;
  790|      0|			do {
  791|      0|				*--tp = codep->value;
  792|      0|				codep = codep->next;
  793|      0|			} while (--occ);
  ------------------
  |  Branch (793:13): [True: 0, False: 0]
  ------------------
  794|      0|			return (1);
  795|      0|		}
  796|       |		/*
  797|       |		 * Residue satisfies only part of the decode request.
  798|       |		 */
  799|      0|		op += residue;
  800|      0|		occ -= residue;
  801|      0|		tp = op;
  802|      0|		do {
  803|      0|			*--tp = codep->value;
  804|      0|			codep = codep->next;
  805|      0|		} while (--residue);
  ------------------
  |  Branch (805:12): [True: 0, False: 0]
  ------------------
  806|      0|		sp->dec_restart = 0;
  807|      0|	}
  808|       |
  809|  4.36k|	bp = (uint8_t*)tif->tif_rawcp;
  810|       |
  811|  4.36k|	sp->dec_bitsleft += (((uint64_t)tif->tif_rawcc - sp->old_tif_rawcc) << 3);
  812|  4.36k|	uint64_t dec_bitsleft = sp->dec_bitsleft;
  813|       |
  814|  4.36k|	nbits = sp->lzw_nbits;
  ------------------
  |  |  101|  4.36k|#define lzw_nbits       base.nbits
  ------------------
  815|  4.36k|	nextdata = sp->lzw_nextdata;
  ------------------
  |  |  104|  4.36k|#define lzw_nextdata    base.nextdata
  ------------------
  816|  4.36k|	nextbits = sp->lzw_nextbits;
  ------------------
  |  |  105|  4.36k|#define lzw_nextbits    base.nextbits
  ------------------
  817|  4.36k|	nbitsmask = sp->dec_nbitsmask;
  818|  4.36k|	oldcodep = sp->dec_oldcodep;
  819|  4.36k|	free_entp = sp->dec_free_entp;
  820|  4.36k|	maxcodep = sp->dec_maxcodep;
  821|       |
  822|  86.0k|	while (occ > 0) {
  ------------------
  |  Branch (822:9): [True: 85.6k, False: 465]
  ------------------
  823|  85.6k|		NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  ------------------
  |  |  725|  85.6k|#define	NextCode(_tif, _sp, _bp, _code, _get, dec_bitsleft) {				\
  |  |  726|  85.6k|	if (dec_bitsleft < (uint64_t)nbits) {			\
  |  |  ------------------
  |  |  |  Branch (726:6): [True: 611, False: 85.0k]
  |  |  ------------------
  |  |  727|    611|		TIFFWarningExtR(_tif, module,		\
  |  |  728|    611|		    "LZWDecode: Strip %"PRIu32" not terminated with EOI code", \
  |  |  729|    611|		    _tif->tif_curstrip);				\
  |  |  730|    611|		_code = CODE_EOI;					\
  |  |  ------------------
  |  |  |  |   72|    611|#define CODE_EOI        257             /* end-of-information code */
  |  |  ------------------
  |  |  731|  85.0k|	} else {							\
  |  |  732|  85.0k|		_get(_sp,_bp,_code);					\
  |  |  ------------------
  |  |  |  |  823|  85.0k|		NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  |  |  |  |  ------------------
  |  |  |  |  |  |  740|  85.0k|#define	GetNextCodeCompat(sp, bp, code) {			\
  |  |  |  |  |  |  741|  85.0k|	nextdata |= (unsigned long) *(bp)++ << nextbits;	\
  |  |  |  |  |  |  742|  85.0k|	nextbits += 8;						\
  |  |  |  |  |  |  743|  85.0k|	if (nextbits < nbits) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (743:6): [True: 27.5k, False: 57.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  744|  27.5k|		nextdata |= (unsigned long) *(bp)++ << nextbits;\
  |  |  |  |  |  |  745|  27.5k|		nextbits += 8;					\
  |  |  |  |  |  |  746|  27.5k|	}							\
  |  |  |  |  |  |  747|  85.0k|	code = (hcode_t)(nextdata & nbitsmask);			\
  |  |  |  |  |  |  748|  85.0k|	nextdata >>= nbits;					\
  |  |  |  |  |  |  749|  85.0k|	nextbits -= nbits;					\
  |  |  |  |  |  |  750|  85.0k|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|  85.0k|		dec_bitsleft -= nbits;				\
  |  |  734|  85.0k|	}								\
  |  |  735|  85.6k|}
  ------------------
  824|  85.6k|		if (code == CODE_EOI)
  ------------------
  |  |   72|  85.6k|#define CODE_EOI        257             /* end-of-information code */
  ------------------
  |  Branch (824:7): [True: 680, False: 84.9k]
  ------------------
  825|    680|			break;
  826|  84.9k|		if (code == CODE_CLEAR) {
  ------------------
  |  |   71|  84.9k|#define CODE_CLEAR      256             /* code to clear string table */
  ------------------
  |  Branch (826:7): [True: 3.11k, False: 81.8k]
  ------------------
  827|  3.91k|			do {
  828|  3.91k|				free_entp = sp->dec_codetab + CODE_FIRST;
  ------------------
  |  |   73|  3.91k|#define CODE_FIRST      258             /* first free code entry */
  ------------------
  829|  3.91k|				_TIFFmemset(free_entp, 0,
  830|  3.91k|					    (CSIZE - CODE_FIRST) * sizeof (code_t));
  ------------------
  |  |   79|  3.91k|#define CSIZE           (MAXCODE(BITS_MAX)+1024L)
  |  |  ------------------
  |  |  |  |   63|  3.91k|#define MAXCODE(n)	((1L<<(n))-1)
  |  |  ------------------
  ------------------
              					    (CSIZE - CODE_FIRST) * sizeof (code_t));
  ------------------
  |  |   73|  3.91k|#define CODE_FIRST      258             /* first free code entry */
  ------------------
  831|  3.91k|				nbits = BITS_MIN;
  ------------------
  |  |   68|  3.91k|#define BITS_MIN        9               /* start with 9 bits */
  ------------------
  832|  3.91k|				nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  3.91k|#define MAXCODE(n)	((1L<<(n))-1)
  ------------------
  833|  3.91k|				maxcodep = sp->dec_codetab + nbitsmask;
  834|  3.91k|				NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  ------------------
  |  |  725|  3.91k|#define	NextCode(_tif, _sp, _bp, _code, _get, dec_bitsleft) {				\
  |  |  726|  3.91k|	if (dec_bitsleft < (uint64_t)nbits) {			\
  |  |  ------------------
  |  |  |  Branch (726:6): [True: 106, False: 3.81k]
  |  |  ------------------
  |  |  727|    106|		TIFFWarningExtR(_tif, module,		\
  |  |  728|    106|		    "LZWDecode: Strip %"PRIu32" not terminated with EOI code", \
  |  |  729|    106|		    _tif->tif_curstrip);				\
  |  |  730|    106|		_code = CODE_EOI;					\
  |  |  ------------------
  |  |  |  |   72|    106|#define CODE_EOI        257             /* end-of-information code */
  |  |  ------------------
  |  |  731|  3.81k|	} else {							\
  |  |  732|  3.81k|		_get(_sp,_bp,_code);					\
  |  |  ------------------
  |  |  |  |  834|  3.81k|				NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  |  |  |  |  ------------------
  |  |  |  |  |  |  740|  3.81k|#define	GetNextCodeCompat(sp, bp, code) {			\
  |  |  |  |  |  |  741|  3.81k|	nextdata |= (unsigned long) *(bp)++ << nextbits;	\
  |  |  |  |  |  |  742|  3.81k|	nextbits += 8;						\
  |  |  |  |  |  |  743|  3.81k|	if (nextbits < nbits) {					\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (743:6): [True: 316, False: 3.49k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  744|    316|		nextdata |= (unsigned long) *(bp)++ << nextbits;\
  |  |  |  |  |  |  745|    316|		nextbits += 8;					\
  |  |  |  |  |  |  746|    316|	}							\
  |  |  |  |  |  |  747|  3.81k|	code = (hcode_t)(nextdata & nbitsmask);			\
  |  |  |  |  |  |  748|  3.81k|	nextdata >>= nbits;					\
  |  |  |  |  |  |  749|  3.81k|	nextbits -= nbits;					\
  |  |  |  |  |  |  750|  3.81k|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|  3.81k|		dec_bitsleft -= nbits;				\
  |  |  734|  3.81k|	}								\
  |  |  735|  3.91k|}
  ------------------
  835|  3.91k|			} while (code == CODE_CLEAR);	/* consecutive CODE_CLEAR codes */
  ------------------
  |  |   71|  3.91k|#define CODE_CLEAR      256             /* code to clear string table */
  ------------------
  |  Branch (835:13): [True: 804, False: 3.11k]
  ------------------
  836|  3.11k|			if (code == CODE_EOI)
  ------------------
  |  |   72|  3.11k|#define CODE_EOI        257             /* end-of-information code */
  ------------------
  |  Branch (836:8): [True: 303, False: 2.81k]
  ------------------
  837|    303|				break;
  838|  2.81k|			if (code > CODE_CLEAR) {
  ------------------
  |  |   71|  2.81k|#define CODE_CLEAR      256             /* code to clear string table */
  ------------------
  |  Branch (838:8): [True: 287, False: 2.52k]
  ------------------
  839|    287|				TIFFErrorExtR(tif, tif->tif_name,
  840|    287|				"LZWDecode: Corrupted LZW table at scanline %"PRIu32,
  841|    287|					     tif->tif_row);
  842|    287|				return (0);
  843|    287|			}
  844|  2.52k|			*op++ = (uint8_t)code;
  845|  2.52k|			occ--;
  846|  2.52k|			oldcodep = sp->dec_codetab + code;
  847|  2.52k|			continue;
  848|  2.81k|		}
  849|  81.8k|		codep = sp->dec_codetab + code;
  850|       |
  851|       |		/*
  852|       |		 * Add the new entry to the code table.
  853|       |		 */
  854|  81.8k|		if (free_entp < &sp->dec_codetab[0] ||
  ------------------
  |  Branch (854:7): [True: 1.66k, False: 80.1k]
  ------------------
  855|  81.8k|		    free_entp >= &sp->dec_codetab[CSIZE]) {
  ------------------
  |  |   79|  80.1k|#define CSIZE           (MAXCODE(BITS_MAX)+1024L)
  |  |  ------------------
  |  |  |  |   63|  80.1k|#define MAXCODE(n)	((1L<<(n))-1)
  |  |  ------------------
  ------------------
  |  Branch (855:7): [True: 1, False: 80.1k]
  ------------------
  856|  1.66k|			TIFFErrorExtR(tif, module,
  857|  1.66k|			    "Corrupted LZW table at scanline %"PRIu32, tif->tif_row);
  858|  1.66k|			return (0);
  859|  1.66k|		}
  860|       |
  861|  80.1k|		free_entp->next = oldcodep;
  862|  80.1k|		if (free_entp->next < &sp->dec_codetab[0] ||
  ------------------
  |  Branch (862:7): [True: 0, False: 80.1k]
  ------------------
  863|  80.1k|		    free_entp->next >= &sp->dec_codetab[CSIZE]) {
  ------------------
  |  |   79|  80.1k|#define CSIZE           (MAXCODE(BITS_MAX)+1024L)
  |  |  ------------------
  |  |  |  |   63|  80.1k|#define MAXCODE(n)	((1L<<(n))-1)
  |  |  ------------------
  ------------------
  |  Branch (863:7): [True: 0, False: 80.1k]
  ------------------
  864|      0|			TIFFErrorExtR(tif, module,
  865|      0|			    "Corrupted LZW table at scanline %"PRIu32, tif->tif_row);
  866|      0|			return (0);
  867|      0|		}
  868|  80.1k|		free_entp->firstchar = free_entp->next->firstchar;
  869|  80.1k|		free_entp->length = free_entp->next->length+1;
  870|  80.1k|		free_entp->value = (codep < free_entp) ?
  ------------------
  |  Branch (870:22): [True: 79.3k, False: 791]
  ------------------
  871|  79.3k|		    codep->firstchar : free_entp->firstchar;
  872|  80.1k|		if (++free_entp > maxcodep) {
  ------------------
  |  Branch (872:7): [True: 1.31k, False: 78.8k]
  ------------------
  873|  1.31k|			if (++nbits > BITS_MAX)		/* should not happen */
  ------------------
  |  |   69|  1.31k|#define BITS_MAX        12              /* max of 12 bit strings */
  ------------------
  |  Branch (873:8): [True: 1.22k, False: 84]
  ------------------
  874|  1.22k|				nbits = BITS_MAX;
  ------------------
  |  |   69|  1.22k|#define BITS_MAX        12              /* max of 12 bit strings */
  ------------------
  875|  1.31k|			nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|  1.31k|#define MAXCODE(n)	((1L<<(n))-1)
  ------------------
  876|  1.31k|			maxcodep = sp->dec_codetab + nbitsmask;
  877|  1.31k|		}
  878|  80.1k|		oldcodep = codep;
  879|  80.1k|		if (code >= 256) {
  ------------------
  |  Branch (879:7): [True: 4.44k, False: 75.7k]
  ------------------
  880|       |			/*
  881|       |			 * Code maps to a string, copy string
  882|       |			 * value to output (written in reverse).
  883|       |			 */
  884|  4.44k|			if(codep->length == 0) {
  ------------------
  |  Branch (884:7): [True: 451, False: 3.99k]
  ------------------
  885|    451|				TIFFErrorExtR(tif, module,
  886|    451|				    "Wrong length of decoded "
  887|    451|				    "string: data probably corrupted at scanline %"PRIu32,
  888|    451|				    tif->tif_row);
  889|    451|				return (0);
  890|    451|			}
  891|  3.99k|			if (codep->length > occ) {
  ------------------
  |  Branch (891:8): [True: 516, False: 3.48k]
  ------------------
  892|       |				/*
  893|       |				 * String is too long for decode buffer,
  894|       |				 * locate portion that will fit, copy to
  895|       |				 * the decode buffer, and setup restart
  896|       |				 * logic for the next decoding call.
  897|       |				 */
  898|    516|				sp->dec_codep = codep;
  899|    655|				do {
  900|    655|					codep = codep->next;
  901|    655|				} while (codep->length > occ);
  ------------------
  |  Branch (901:14): [True: 139, False: 516]
  ------------------
  902|    516|				sp->dec_restart = occ;
  903|    516|				tp = op + occ;
  904|    753|				do  {
  905|    753|					*--tp = codep->value;
  906|    753|					codep = codep->next;
  907|    753|				}  while (--occ);
  ------------------
  |  Branch (907:15): [True: 237, False: 516]
  ------------------
  908|    516|				break;
  909|    516|			}
  910|  3.48k|			len = codep->length;
  911|  3.48k|			tp = op + len;
  912|  7.23k|			do {
  913|  7.23k|				*--tp = codep->value;
  914|  7.23k|				codep = codep->next;
  915|  7.23k|			} while (codep && tp > op);
  ------------------
  |  Branch (915:13): [True: 3.75k, False: 3.48k]
  |  Branch (915:22): [True: 3.75k, False: 0]
  ------------------
  916|  3.48k|			assert(occ >= len);
  917|  3.48k|			op += len;
  918|  3.48k|			occ -= len;
  919|  75.7k|		} else {
  920|  75.7k|			*op++ = (uint8_t)code;
  921|  75.7k|			occ--;
  922|  75.7k|		}
  923|  80.1k|	}
  924|       |
  925|  1.96k|	tif->tif_rawcc -= (tmsize_t)((uint8_t*) bp - tif->tif_rawcp );
  926|  1.96k|	tif->tif_rawcp = (uint8_t*) bp;
  927|       |
  928|  1.96k|	sp->old_tif_rawcc = tif->tif_rawcc;
  929|  1.96k|	sp->dec_bitsleft = dec_bitsleft;
  930|       |
  931|  1.96k|	sp->lzw_nbits = (unsigned short)nbits;
  ------------------
  |  |  101|  1.96k|#define lzw_nbits       base.nbits
  ------------------
  932|  1.96k|	sp->lzw_nextdata = nextdata;
  ------------------
  |  |  104|  1.96k|#define lzw_nextdata    base.nextdata
  ------------------
  933|  1.96k|	sp->lzw_nextbits = nextbits;
  ------------------
  |  |  105|  1.96k|#define lzw_nextbits    base.nextbits
  ------------------
  934|  1.96k|	sp->dec_nbitsmask = nbitsmask;
  935|  1.96k|	sp->dec_oldcodep = oldcodep;
  936|  1.96k|	sp->dec_free_entp = free_entp;
  937|  1.96k|	sp->dec_maxcodep = maxcodep;
  938|       |
  939|  1.96k|	if (occ > 0) {
  ------------------
  |  Branch (939:6): [True: 983, False: 981]
  ------------------
  940|    983|		TIFFErrorExtR(tif, module,
  941|    983|			"Not enough data at scanline %"PRIu32" (short %"PRIu64" bytes)",
  942|    983|			     tif->tif_row, (uint64_t)occ);
  943|    983|		return (0);
  944|    983|	}
  945|    981|	return (1);
  946|  1.96k|}
tif_lzw.c:LZWDecode:
  393|  14.0k|{
  394|  14.0k|	static const char module[] = "LZWDecode";
  395|  14.0k|	LZWCodecState *sp = DecoderState(tif);
  ------------------
  |  |  158|  14.0k|#define DecoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|  14.0k|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  396|  14.0k|	uint8_t *op = (uint8_t*) op0;
  397|  14.0k|	tmsize_t occ = occ0;
  398|  14.0k|	uint8_t *bp;
  399|  14.0k|	long nbits, nextbits, nbitsmask;
  400|  14.0k|	WordType nextdata;
  401|  14.0k|	code_t *free_entp, *maxcodep, *oldcodep;
  402|       |
  403|  14.0k|	(void) s;
  404|  14.0k|	assert(sp != NULL);
  405|  14.0k|	assert(sp->dec_codetab != NULL);
  406|       |
  407|  14.0k|	if (sp->read_error) {
  ------------------
  |  Branch (407:6): [True: 0, False: 14.0k]
  ------------------
  408|      0|		return 0;
  409|      0|	}
  410|       |
  411|       |	/*
  412|       |	 * Restart interrupted output operation.
  413|       |	 */
  414|  14.0k|	if (sp->dec_restart) {
  ------------------
  |  Branch (414:6): [True: 0, False: 14.0k]
  ------------------
  415|      0|		tmsize_t residue;
  416|       |
  417|      0|		code_t* codep = sp->dec_codep;
  418|      0|		residue = codep->length - sp->dec_restart;
  419|      0|		if (residue > occ) {
  ------------------
  |  Branch (419:7): [True: 0, False: 0]
  ------------------
  420|       |			/*
  421|       |			 * Residue from previous decode is sufficient
  422|       |			 * to satisfy decode request.  Skip to the
  423|       |			 * start of the decoded string, place decoded
  424|       |			 * values in the output buffer, and return.
  425|       |			 */
  426|      0|			sp->dec_restart += occ;
  427|      0|			do {
  428|      0|				codep = codep->next;
  429|      0|			} while (--residue > occ && codep);
  ------------------
  |  Branch (429:13): [True: 0, False: 0]
  |  Branch (429:32): [True: 0, False: 0]
  ------------------
  430|      0|			if (codep) {
  ------------------
  |  Branch (430:8): [True: 0, False: 0]
  ------------------
  431|      0|				uint8_t* tp = op + occ;
  432|      0|				do {
  433|      0|					*--tp = codep->value;
  434|      0|					codep = codep->next;
  435|      0|				} while (--occ && codep);
  ------------------
  |  Branch (435:14): [True: 0, False: 0]
  |  Branch (435:23): [True: 0, False: 0]
  ------------------
  436|      0|			}
  437|      0|			return (1);
  438|      0|		}
  439|       |		/*
  440|       |		 * Residue satisfies only part of the decode request.
  441|       |		 */
  442|      0|		op += residue;
  443|      0|		occ -= residue;
  444|      0|		uint8_t* tp = op;
  445|      0|		do {
  446|      0|			*--tp = codep->value;
  447|      0|			codep = codep->next;
  448|      0|		} while (--residue && codep);
  ------------------
  |  Branch (448:12): [True: 0, False: 0]
  |  Branch (448:25): [True: 0, False: 0]
  ------------------
  449|      0|		sp->dec_restart = 0;
  450|      0|	}
  451|       |
  452|  14.0k|	bp = (uint8_t*)tif->tif_rawcp;
  453|  14.0k|	sp->dec_bitsleft += (((uint64_t)tif->tif_rawcc - sp->old_tif_rawcc) << 3);
  454|  14.0k|	uint64_t dec_bitsleft = sp->dec_bitsleft;
  455|  14.0k|	nbits = sp->lzw_nbits;
  ------------------
  |  |  101|  14.0k|#define lzw_nbits       base.nbits
  ------------------
  456|  14.0k|	nextdata = sp->lzw_nextdata;
  ------------------
  |  |  104|  14.0k|#define lzw_nextdata    base.nextdata
  ------------------
  457|  14.0k|	nextbits = sp->lzw_nextbits;
  ------------------
  |  |  105|  14.0k|#define lzw_nextbits    base.nextbits
  ------------------
  458|  14.0k|	nbitsmask = sp->dec_nbitsmask;
  459|  14.0k|	oldcodep = sp->dec_oldcodep;
  460|  14.0k|	free_entp = sp->dec_free_entp;
  461|  14.0k|	maxcodep = sp->dec_maxcodep;
  462|  14.0k|	code_t* const dec_codetab = sp->dec_codetab;
  463|  14.0k|	code_t* codep;
  464|       |
  465|  14.0k|    if (occ == 0) {
  ------------------
  |  Branch (465:9): [True: 0, False: 14.0k]
  ------------------
  466|      0|        goto after_loop;
  467|      0|    }
  468|       |
  469|   296k|begin:
  470|   296k|    {
  471|   296k|        WordType code;
  472|   296k|        GetNextCodeLZW();
  ------------------
  |  |  359|   296k|#define	GetNextCodeLZW() do { \
  |  |  360|   296k|    nextbits -= nbits; \
  |  |  361|   296k|    if (nextbits < 0) { \
  |  |  ------------------
  |  |  |  Branch (361:9): [True: 57.8k, False: 238k]
  |  |  ------------------
  |  |  362|  57.8k|        if (dec_bitsleft >= 8 * SIZEOF_WORDTYPE) { \
  |  |  ------------------
  |  |  |  |   45|  57.8k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  57.8k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (362:13): [True: 52.9k, False: 4.86k]
  |  |  ------------------
  |  |  363|  52.9k|            unsigned codetmp = (unsigned)(nextdata << (-nextbits)); \
  |  |  364|  52.9k|            GetNextData(nextdata, bp); \
  |  |  ------------------
  |  |  |  |  325|  52.9k|#    define GetNextData(nextdata, bp) nextdata = __builtin_bswap64(*(uint64_t*)(bp))
  |  |  ------------------
  |  |  365|  52.9k|            bp += SIZEOF_WORDTYPE; \
  |  |  ------------------
  |  |  |  |   45|  52.9k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  52.9k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  366|  52.9k|            nextbits += 8 * SIZEOF_WORDTYPE; \
  |  |  ------------------
  |  |  |  |   45|  52.9k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  52.9k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  367|  52.9k|            dec_bitsleft -= 8 * SIZEOF_WORDTYPE; \
  |  |  ------------------
  |  |  |  |   45|  52.9k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  52.9k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  368|  52.9k|            code = (WordType)((codetmp | (nextdata >> nextbits)) & nbitsmask); \
  |  |  369|  52.9k|            break; \
  |  |  370|  52.9k|        } \
  |  |  371|  57.8k|        else {\
  |  |  372|  4.86k|            if( dec_bitsleft < 8) { \
  |  |  ------------------
  |  |  |  Branch (372:17): [True: 421, False: 4.44k]
  |  |  ------------------
  |  |  373|    421|                goto no_eoi; \
  |  |  374|    421|            }\
  |  |  375|  4.86k|            nextdata = (nextdata<<8) | *(bp)++; \
  |  |  376|  4.44k|            nextbits += 8; \
  |  |  377|  4.44k|            dec_bitsleft -= 8; \
  |  |  378|  4.44k|            if( nextbits < 0 ) { \
  |  |  ------------------
  |  |  |  Branch (378:17): [True: 2.77k, False: 1.66k]
  |  |  ------------------
  |  |  379|  2.77k|                if( dec_bitsleft < 8) { \
  |  |  ------------------
  |  |  |  Branch (379:21): [True: 1.38k, False: 1.38k]
  |  |  ------------------
  |  |  380|  1.38k|                    goto no_eoi; \
  |  |  381|  1.38k|                }\
  |  |  382|  2.77k|                nextdata = (nextdata<<8) | *(bp)++; \
  |  |  383|  1.38k|                nextbits += 8; \
  |  |  384|  1.38k|                dec_bitsleft -= 8; \
  |  |  385|  1.38k|            } \
  |  |  386|  4.44k|        } \
  |  |  387|  57.8k|    } \
  |  |  388|   296k|    code = (WordType)((nextdata >> nextbits) & nbitsmask); \
  |  |  389|   242k|} while(0)
  |  |  ------------------
  |  |  |  Branch (389:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  473|   295k|        codep = dec_codetab + code;
  474|   295k|        if (code >= CODE_FIRST)
  ------------------
  |  |   73|   295k|#define CODE_FIRST      258             /* first free code entry */
  ------------------
  |  Branch (474:13): [True: 45.9k, False: 249k]
  ------------------
  475|  45.9k|            goto code_above_or_equal_to_258;
  476|   249k|        if (code < 256)
  ------------------
  |  Branch (476:13): [True: 241k, False: 7.74k]
  ------------------
  477|   241k|            goto code_below_256;
  478|  7.74k|        if (code == CODE_EOI)
  ------------------
  |  |   72|  7.74k|#define CODE_EOI        257             /* end-of-information code */
  ------------------
  |  Branch (478:13): [True: 347, False: 7.39k]
  ------------------
  479|    347|            goto after_loop;
  480|  7.39k|        goto code_clear;
  481|       |
  482|   241k|code_below_256:
  483|   241k|        {
  484|   241k|            if (codep > free_entp)
  ------------------
  |  Branch (484:17): [True: 7.20k, False: 234k]
  ------------------
  485|  7.20k|                goto error_code;
  486|   234k|            free_entp->next = oldcodep;
  487|   234k|            free_entp->firstchar = oldcodep->firstchar;
  488|   234k|            free_entp->length = oldcodep->length+1;
  489|   234k|            free_entp->value = (uint8_t)code;
  490|   234k|            free_entp->repeated = (bool)(oldcodep->repeated & (oldcodep->value == code));
  491|   234k|            if (++free_entp > maxcodep) {
  ------------------
  |  Branch (491:17): [True: 2.40k, False: 231k]
  ------------------
  492|  2.40k|                if (++nbits > BITS_MAX)		/* should not happen for a conformant encoder */
  ------------------
  |  |   69|  2.40k|#define BITS_MAX        12              /* max of 12 bit strings */
  ------------------
  |  Branch (492:21): [True: 2.28k, False: 126]
  ------------------
  493|  2.28k|                    nbits = BITS_MAX;
  ------------------
  |  |   69|  2.28k|#define BITS_MAX        12              /* max of 12 bit strings */
  ------------------
  494|  2.40k|                nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|  2.40k|#define MAXCODE(n)	((1L<<(n))-1)
  ------------------
  495|  2.40k|                maxcodep = dec_codetab + nbitsmask-1;
  496|  2.40k|                if( free_entp >= &dec_codetab[CSIZE] )
  ------------------
  |  |   79|  2.40k|#define CSIZE           (MAXCODE(BITS_MAX)+1024L)
  |  |  ------------------
  |  |  |  |   63|  2.40k|#define MAXCODE(n)	((1L<<(n))-1)
  |  |  ------------------
  ------------------
  |  Branch (496:21): [True: 1, False: 2.40k]
  ------------------
  497|      1|                {
  498|       |                    /* At that point, the next valid states are either EOI or a */
  499|       |                    /* CODE_CLEAR. If a regular code is read, at the next */
  500|       |                    /* attempt at registering a new entry, we will error out */
  501|       |                    /* due to setting free_entp before any valid code */
  502|      1|                    free_entp = dec_codetab - 1;
  503|      1|                }
  504|  2.40k|            }
  505|   234k|            oldcodep = codep;
  506|   234k|            *op++ = (uint8_t)code;
  507|   234k|            occ--;
  508|   234k|            if (occ == 0)
  ------------------
  |  Branch (508:17): [True: 323, False: 233k]
  ------------------
  509|    323|                goto after_loop;
  510|   233k|            goto begin;
  511|   234k|        }
  512|       |
  513|   233k|code_above_or_equal_to_258:
  514|  45.9k|        {
  515|       |            /*
  516|       |             * Add the new entry to the code table.
  517|       |             */
  518|       |
  519|  45.9k|            if (codep >= free_entp)
  ------------------
  |  Branch (519:17): [True: 9.01k, False: 36.9k]
  ------------------
  520|  9.01k|            {
  521|  9.01k|                if (codep != free_entp)
  ------------------
  |  Branch (521:21): [True: 1.47k, False: 7.53k]
  ------------------
  522|  1.47k|                    goto error_code;
  523|  7.53k|                free_entp->value = oldcodep->firstchar;
  524|  7.53k|            }
  525|  36.9k|            else
  526|  36.9k|            {
  527|  36.9k|                free_entp->value = codep->firstchar;
  528|  36.9k|            }
  529|  44.5k|            free_entp->repeated = (bool)(oldcodep->repeated & (oldcodep->value == free_entp->value));
  530|  44.5k|            free_entp->next = oldcodep;
  531|       |
  532|  44.5k|            free_entp->firstchar = oldcodep->firstchar;
  533|  44.5k|            free_entp->length = oldcodep->length+1;
  534|  44.5k|            if (++free_entp > maxcodep) {
  ------------------
  |  Branch (534:17): [True: 417, False: 44.0k]
  ------------------
  535|    417|                if (++nbits > BITS_MAX)		/* should not happen for a conformant encoder */
  ------------------
  |  |   69|    417|#define BITS_MAX        12              /* max of 12 bit strings */
  ------------------
  |  Branch (535:21): [True: 399, False: 18]
  ------------------
  536|    399|                    nbits = BITS_MAX;
  ------------------
  |  |   69|    399|#define BITS_MAX        12              /* max of 12 bit strings */
  ------------------
  537|    417|                nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|    417|#define MAXCODE(n)	((1L<<(n))-1)
  ------------------
  538|    417|                maxcodep = dec_codetab + nbitsmask-1;
  539|    417|                if (free_entp >= &dec_codetab[CSIZE])
  ------------------
  |  |   79|    417|#define CSIZE           (MAXCODE(BITS_MAX)+1024L)
  |  |  ------------------
  |  |  |  |   63|    417|#define MAXCODE(n)	((1L<<(n))-1)
  |  |  ------------------
  ------------------
  |  Branch (539:21): [True: 1, False: 416]
  ------------------
  540|      1|                {
  541|       |                    /* At that point, the next valid states are either EOI or a */
  542|       |                    /* CODE_CLEAR. If a regular code is read, at the next */
  543|       |                    /* attempt at registering a new entry, we will error out */
  544|       |                    /* due to setting free_entp before any valid code */
  545|      1|                    free_entp = dec_codetab - 1;
  546|      1|                }
  547|    417|            }
  548|  44.5k|            oldcodep = codep;
  549|       |
  550|       |            /*
  551|       |             * Code maps to a string, copy string
  552|       |             * value to output (written in reverse).
  553|       |             */
  554|       |            /* tiny bit faster on x86_64 to store in unsigned short than int */
  555|  44.5k|            unsigned short len = codep->length;
  556|       |
  557|  44.5k|            if (len < 3) /* equivalent to len == 2 given all other conditions */
  ------------------
  |  Branch (557:17): [True: 19.1k, False: 25.3k]
  ------------------
  558|  19.1k|            {
  559|  19.1k|                if (occ <= 2)
  ------------------
  |  Branch (559:21): [True: 464, False: 18.6k]
  ------------------
  560|    464|                {
  561|    464|                    if (occ == 2)
  ------------------
  |  Branch (561:25): [True: 258, False: 206]
  ------------------
  562|    258|                    {
  563|    258|                        memcpy(op, &(codep->firstchar), 2);
  564|    258|                        op += 2;
  565|    258|                        occ -= 2;
  566|    258|                        goto after_loop;
  567|    258|                    }
  568|    206|                    goto too_short_buffer;
  569|    464|                }
  570|       |
  571|  18.6k|                memcpy(op, &(codep->firstchar), 2);
  572|  18.6k|                op += 2;
  573|  18.6k|                occ -= 2;
  574|  18.6k|                goto begin; /* we can save the comparison occ > 0 */
  575|  19.1k|            }
  576|       |
  577|  25.3k|            if (len == 3)
  ------------------
  |  Branch (577:17): [True: 10.5k, False: 14.8k]
  ------------------
  578|  10.5k|            {
  579|  10.5k|                if (occ <= 3)
  ------------------
  |  Branch (579:21): [True: 396, False: 10.1k]
  ------------------
  580|    396|                {
  581|    396|                    if (occ == 3)
  ------------------
  |  Branch (581:25): [True: 195, False: 201]
  ------------------
  582|    195|                    {
  583|    195|                        op[0] = codep->firstchar;
  584|    195|                        op[1] = codep->next->value;
  585|    195|                        op[2] = codep->value;
  586|    195|                        op += 3;
  587|    195|                        occ -= 3;
  588|    195|                        goto after_loop;
  589|    195|                    }
  590|    201|                    goto too_short_buffer;
  591|    396|                }
  592|       |
  593|  10.1k|                op[0] = codep->firstchar;
  594|  10.1k|                op[1] = codep->next->value;
  595|  10.1k|                op[2] = codep->value;
  596|  10.1k|                op += 3;
  597|  10.1k|                occ -= 3;
  598|  10.1k|                goto begin; /* we can save the comparison occ > 0 */
  599|  10.5k|            }
  600|       |
  601|  14.8k|            if (len > occ)
  ------------------
  |  Branch (601:17): [True: 368, False: 14.4k]
  ------------------
  602|    368|            {
  603|    368|                goto too_short_buffer;
  604|    368|            }
  605|       |
  606|  14.4k|            if (codep->repeated)
  ------------------
  |  Branch (606:17): [True: 6.90k, False: 7.58k]
  ------------------
  607|  6.90k|            {
  608|  6.90k|                memset(op, codep->value, len);
  609|  6.90k|                op += len;
  610|  6.90k|                occ -= len;
  611|  6.90k|                if (occ == 0)
  ------------------
  |  Branch (611:21): [True: 135, False: 6.77k]
  ------------------
  612|    135|                    goto after_loop;
  613|  6.77k|                goto begin;
  614|  6.90k|            }
  615|       |
  616|  7.58k|            uint8_t* tp = op + len;
  617|       |
  618|  7.58k|            assert(len >= 4);
  619|       |
  620|  7.58k|            *--tp = codep->value;
  621|  7.58k|            codep = codep->next;
  622|  7.58k|            *--tp = codep->value;
  623|  7.58k|            codep = codep->next;
  624|  7.58k|            *--tp = codep->value;
  625|  7.58k|            codep = codep->next;
  626|  7.58k|            *--tp = codep->value;
  627|  7.58k|            if (tp > op)
  ------------------
  |  Branch (627:17): [True: 6.81k, False: 771]
  ------------------
  628|  6.81k|            {
  629|  16.0k|                 do {
  630|  16.0k|                    codep = codep->next;
  631|  16.0k|                    *--tp = codep->value;
  632|  16.0k|                } while (tp > op);
  ------------------
  |  Branch (632:26): [True: 9.26k, False: 6.81k]
  ------------------
  633|  6.81k|            }
  634|       |
  635|  7.58k|            assert(occ >= len);
  636|  7.58k|            op += len;
  637|  7.58k|            occ -= len;
  638|  7.58k|            if (occ == 0)
  ------------------
  |  Branch (638:17): [True: 287, False: 7.29k]
  ------------------
  639|    287|                goto after_loop;
  640|  7.29k|            goto begin;
  641|  7.58k|        }
  642|       |
  643|  7.39k|code_clear:
  644|  7.39k|        {
  645|  7.39k|            free_entp = dec_codetab + CODE_FIRST;
  ------------------
  |  |   73|  7.39k|#define CODE_FIRST      258             /* first free code entry */
  ------------------
  646|  7.39k|            nbits = BITS_MIN;
  ------------------
  |  |   68|  7.39k|#define BITS_MIN        9               /* start with 9 bits */
  ------------------
  647|  7.39k|            nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  7.39k|#define MAXCODE(n)	((1L<<(n))-1)
  ------------------
  648|  7.39k|            maxcodep = dec_codetab + nbitsmask-1;
  649|  7.97k|            do {
  650|  7.97k|                GetNextCodeLZW();
  ------------------
  |  |  359|  7.97k|#define	GetNextCodeLZW() do { \
  |  |  360|  7.97k|    nextbits -= nbits; \
  |  |  361|  7.97k|    if (nextbits < 0) { \
  |  |  ------------------
  |  |  |  Branch (361:9): [True: 1.76k, False: 6.21k]
  |  |  ------------------
  |  |  362|  1.76k|        if (dec_bitsleft >= 8 * SIZEOF_WORDTYPE) { \
  |  |  ------------------
  |  |  |  |   45|  1.76k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  1.76k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (362:13): [True: 648, False: 1.11k]
  |  |  ------------------
  |  |  363|    648|            unsigned codetmp = (unsigned)(nextdata << (-nextbits)); \
  |  |  364|    648|            GetNextData(nextdata, bp); \
  |  |  ------------------
  |  |  |  |  325|    648|#    define GetNextData(nextdata, bp) nextdata = __builtin_bswap64(*(uint64_t*)(bp))
  |  |  ------------------
  |  |  365|    648|            bp += SIZEOF_WORDTYPE; \
  |  |  ------------------
  |  |  |  |   45|    648|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    648|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  366|    648|            nextbits += 8 * SIZEOF_WORDTYPE; \
  |  |  ------------------
  |  |  |  |   45|    648|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    648|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  367|    648|            dec_bitsleft -= 8 * SIZEOF_WORDTYPE; \
  |  |  ------------------
  |  |  |  |   45|    648|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|    648|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  368|    648|            code = (WordType)((codetmp | (nextdata >> nextbits)) & nbitsmask); \
  |  |  369|    648|            break; \
  |  |  370|    648|        } \
  |  |  371|  1.76k|        else {\
  |  |  372|  1.11k|            if( dec_bitsleft < 8) { \
  |  |  ------------------
  |  |  |  Branch (372:17): [True: 229, False: 885]
  |  |  ------------------
  |  |  373|    229|                goto no_eoi; \
  |  |  374|    229|            }\
  |  |  375|  1.11k|            nextdata = (nextdata<<8) | *(bp)++; \
  |  |  376|    885|            nextbits += 8; \
  |  |  377|    885|            dec_bitsleft -= 8; \
  |  |  378|    885|            if( nextbits < 0 ) { \
  |  |  ------------------
  |  |  |  Branch (378:17): [True: 232, False: 653]
  |  |  ------------------
  |  |  379|    232|                if( dec_bitsleft < 8) { \
  |  |  ------------------
  |  |  |  Branch (379:21): [True: 86, False: 146]
  |  |  ------------------
  |  |  380|     86|                    goto no_eoi; \
  |  |  381|     86|                }\
  |  |  382|    232|                nextdata = (nextdata<<8) | *(bp)++; \
  |  |  383|    146|                nextbits += 8; \
  |  |  384|    146|                dec_bitsleft -= 8; \
  |  |  385|    146|            } \
  |  |  386|    885|        } \
  |  |  387|  1.76k|    } \
  |  |  388|  7.97k|    code = (WordType)((nextdata >> nextbits) & nbitsmask); \
  |  |  389|  7.01k|} while(0)
  |  |  ------------------
  |  |  |  Branch (389:9): [Folded - Ignored]
  |  |  ------------------
  ------------------
  651|  7.97k|            } while (code == CODE_CLEAR);	/* consecutive CODE_CLEAR codes */
  ------------------
  |  |   71|  7.65k|#define CODE_CLEAR      256             /* code to clear string table */
  ------------------
  |  Branch (651:22): [True: 578, False: 7.08k]
  ------------------
  652|  7.08k|            if (code == CODE_EOI)
  ------------------
  |  |   72|  7.08k|#define CODE_EOI        257             /* end-of-information code */
  ------------------
  |  Branch (652:17): [True: 234, False: 6.84k]
  ------------------
  653|    234|                goto after_loop;
  654|  6.84k|            if (code > CODE_EOI) {
  ------------------
  |  |   72|  6.84k|#define CODE_EOI        257             /* end-of-information code */
  ------------------
  |  Branch (654:17): [True: 391, False: 6.45k]
  ------------------
  655|    391|                goto error_code;
  656|    391|            }
  657|  6.45k|            *op++ = (uint8_t)code;
  658|  6.45k|            occ--;
  659|  6.45k|            oldcodep = dec_codetab + code;
  660|  6.45k|            if (occ == 0)
  ------------------
  |  Branch (660:17): [True: 345, False: 6.11k]
  ------------------
  661|    345|                goto after_loop;
  662|  6.11k|            goto begin;
  663|  6.45k|        }
  664|  6.45k|    }
  665|       |
  666|  6.11k|too_short_buffer:
  667|    775|    {
  668|       |        /*
  669|       |         * String is too long for decode buffer,
  670|       |         * locate portion that will fit, copy to
  671|       |         * the decode buffer, and setup restart
  672|       |         * logic for the next decoding call.
  673|       |         */
  674|    775|        sp->dec_codep = codep;
  675|    983|        do {
  676|    983|            codep = codep->next;
  677|    983|        } while (codep->length > occ);
  ------------------
  |  Branch (677:18): [True: 208, False: 775]
  ------------------
  678|       |
  679|    775|        sp->dec_restart = occ;
  680|    775|        uint8_t* tp = op + occ;
  681|  2.16k|        do  {
  682|  2.16k|            *--tp = codep->value;
  683|  2.16k|            codep = codep->next;
  684|  2.16k|        }  while (--occ);
  ------------------
  |  Branch (684:19): [True: 1.39k, False: 775]
  ------------------
  685|    775|    }
  686|       |
  687|  2.89k|after_loop:
  688|  2.89k|	tif->tif_rawcc -= (tmsize_t)((uint8_t*) bp - tif->tif_rawcp );
  689|  2.89k|	tif->tif_rawcp = (uint8_t*) bp;
  690|  2.89k|	sp->old_tif_rawcc = tif->tif_rawcc;
  691|  2.89k|	sp->dec_bitsleft = dec_bitsleft;
  692|  2.89k|	sp->lzw_nbits = (unsigned short) nbits;
  ------------------
  |  |  101|  2.89k|#define lzw_nbits       base.nbits
  ------------------
  693|  2.89k|	sp->lzw_nextdata = nextdata;
  ------------------
  |  |  104|  2.89k|#define lzw_nextdata    base.nextdata
  ------------------
  694|  2.89k|	sp->lzw_nextbits = nextbits;
  ------------------
  |  |  105|  2.89k|#define lzw_nextbits    base.nextbits
  ------------------
  695|  2.89k|	sp->dec_nbitsmask = nbitsmask;
  696|  2.89k|	sp->dec_oldcodep = oldcodep;
  697|  2.89k|	sp->dec_free_entp = free_entp;
  698|  2.89k|	sp->dec_maxcodep = maxcodep;
  699|       |
  700|  2.89k|	if (occ > 0) {
  ------------------
  |  Branch (700:6): [True: 581, False: 2.31k]
  ------------------
  701|    581|		TIFFErrorExtR(tif, module,
  702|    581|			"Not enough data at scanline %"PRIu32" (short %"PRIu64" bytes)",
  703|    581|			     tif->tif_row, (uint64_t)occ);
  704|    581|		return (0);
  705|    581|	}
  706|  2.31k|	return (1);
  707|       |
  708|  2.12k|no_eoi:
  709|  2.12k|    TIFFErrorExtR(tif, module,
  710|  2.12k|                    "LZWDecode: Strip %"PRIu32" not terminated with EOI code",
  711|  2.12k|                    tif->tif_curstrip);
  712|  2.12k|    return 0;
  713|  9.07k|error_code:
  714|  9.07k|    sp->read_error = 1;
  715|  9.07k|    TIFFErrorExtR(tif, tif->tif_name, "Using code not yet in table");
  716|  9.07k|    return 0;
  717|  2.89k|}
tif_lzw.c:LZWCleanup:
 1282|    683|{
 1283|    683|	(void)TIFFPredictorCleanup(tif);
 1284|       |
 1285|    683|	assert(tif->tif_data != 0);
 1286|       |
 1287|    683|	if (DecoderState(tif)->dec_codetab)
  ------------------
  |  |  158|    683|#define DecoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|    683|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  |  Branch (1287:6): [True: 613, False: 70]
  ------------------
 1288|    613|		_TIFFfree(DecoderState(tif)->dec_codetab);
  ------------------
  |  |  158|    613|#define DecoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|    613|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
 1289|       |
 1290|    683|	if (EncoderState(tif)->enc_hashtab)
  ------------------
  |  |  159|    683|#define EncoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|    683|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  |  Branch (1290:6): [True: 0, False: 683]
  ------------------
 1291|      0|		_TIFFfree(EncoderState(tif)->enc_hashtab);
  ------------------
  |  |  159|      0|#define EncoderState(tif)	((LZWCodecState*) LZWState(tif))
  |  |  ------------------
  |  |  |  |  157|      0|#define LZWState(tif)		((LZWBaseState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
 1292|       |
 1293|    683|	_TIFFfree(tif->tif_data);
 1294|    683|	tif->tif_data = NULL;
 1295|       |
 1296|    683|	_TIFFSetDefaultCompressionState(tif);
 1297|    683|}

TIFFInitNeXT:
  170|    119|{
  171|    119|	(void) scheme;
  172|    119|	tif->tif_predecode = NeXTPreDecode;  
  173|    119|	tif->tif_decoderow = NeXTDecode;  
  174|    119|	tif->tif_decodestrip = NeXTDecode;  
  175|    119|	tif->tif_decodetile = NeXTDecode;
  176|    119|	return (1);
  177|    119|}
tif_next.c:NeXTPreDecode:
  154|  4.45k|{
  155|  4.45k|	static const char module[] = "NeXTPreDecode";
  156|  4.45k|	TIFFDirectory *td = &tif->tif_dir;
  157|  4.45k|	(void)s;
  158|       |
  159|  4.45k|	if( td->td_bitspersample != 2 )
  ------------------
  |  Branch (159:6): [True: 2, False: 4.45k]
  ------------------
  160|      2|	{
  161|      2|		TIFFErrorExtR(tif, module, "Unsupported BitsPerSample = %"PRIu16,
  162|      2|					 td->td_bitspersample);
  163|      2|		return (0);
  164|      2|	}
  165|  4.45k|	return (1);
  166|  4.45k|}
tif_next.c:NeXTDecode:
   48|  4.44k|{
   49|  4.44k|	static const char module[] = "NeXTDecode";
   50|  4.44k|	unsigned char *bp, *op;
   51|  4.44k|	tmsize_t cc;
   52|  4.44k|	uint8_t* row;
   53|  4.44k|	tmsize_t scanline, n;
   54|       |
   55|  4.44k|	(void) s;
   56|       |	/*
   57|       |	 * Each scanline is assumed to start off as all
   58|       |	 * white (we assume a PhotometricInterpretation
   59|       |	 * of ``min-is-black'').
   60|       |	 */
   61|  1.43G|	for (op = (unsigned char*) buf, cc = occ; cc-- > 0;)
  ------------------
  |  Branch (61:44): [True: 1.43G, False: 4.44k]
  ------------------
   62|  1.43G|		*op++ = 0xff;
   63|       |
   64|  4.44k|	bp = (unsigned char *)tif->tif_rawcp;
   65|  4.44k|	cc = tif->tif_rawcc;
   66|  4.44k|	scanline = tif->tif_scanlinesize;
   67|  4.44k|	if (occ % scanline)
  ------------------
  |  Branch (67:6): [True: 223, False: 4.22k]
  ------------------
   68|    223|	{
   69|    223|		TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
   70|    223|		return (0);
   71|    223|	}
   72|   488k|	for (row = buf; cc > 0 && occ > 0; occ -= scanline, row += scanline) {
  ------------------
  |  Branch (72:18): [True: 486k, False: 1.87k]
  |  Branch (72:28): [True: 486k, False: 0]
  ------------------
   73|   486k|		n = *bp++;
   74|   486k|		cc--;
   75|   486k|		switch (n) {
   76|   297k|		case LITERALROW:
  ------------------
  |  |   42|   297k|#define LITERALROW	0x00
  ------------------
  |  Branch (76:3): [True: 297k, False: 188k]
  ------------------
   77|       |			/*
   78|       |			 * The entire scanline is given as literal values.
   79|       |			 */
   80|   297k|			if (cc < scanline)
  ------------------
  |  Branch (80:8): [True: 587, False: 296k]
  ------------------
   81|    587|				goto bad;
   82|   296k|			_TIFFmemcpy(row, bp, scanline);
   83|   296k|			bp += scanline;
   84|   296k|			cc -= scanline;
   85|   296k|			break;
   86|  1.93k|		case LITERALSPAN: {
  ------------------
  |  |   43|  1.93k|#define LITERALSPAN	0x40
  ------------------
  |  Branch (86:3): [True: 1.93k, False: 484k]
  ------------------
   87|  1.93k|			tmsize_t off;
   88|       |			/*
   89|       |			 * The scanline has a literal span that begins at some
   90|       |			 * offset.
   91|       |			 */
   92|  1.93k|			if( cc < 4 )
  ------------------
  |  Branch (92:8): [True: 262, False: 1.67k]
  ------------------
   93|    262|				goto bad;
   94|  1.67k|			off = (bp[0] * 256) + bp[1];
   95|  1.67k|			n = (bp[2] * 256) + bp[3];
   96|  1.67k|			if (cc < 4+n || off+n > scanline)
  ------------------
  |  Branch (96:8): [True: 306, False: 1.36k]
  |  Branch (96:20): [True: 409, False: 960]
  ------------------
   97|    715|				goto bad;
   98|    960|			_TIFFmemcpy(row+off, bp+4, n);
   99|    960|			bp += 4+n;
  100|    960|			cc -= 4+n;
  101|    960|			break;
  102|  1.67k|		}
  103|   187k|		default: {
  ------------------
  |  Branch (103:3): [True: 187k, False: 299k]
  ------------------
  104|   187k|			uint32_t npixels = 0, grey;
  105|   187k|			tmsize_t op_offset = 0;
  106|   187k|			uint32_t imagewidth = tif->tif_dir.td_imagewidth;
  107|   187k|            if( isTiled(tif) )
  ------------------
  |  |  207|   187k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|   187k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 187k, False: 0]
  |  |  ------------------
  ------------------
  108|   187k|                imagewidth = tif->tif_dir.td_tilewidth;
  109|       |
  110|       |			/*
  111|       |			 * The scanline is composed of a sequence of constant
  112|       |			 * color ``runs''.  We shift into ``run mode'' and
  113|       |			 * interpret bytes as codes of the form
  114|       |			 * <color><npixels> until we've filled the scanline.
  115|       |			 */
  116|   187k|			op = row;
  117|   259k|			for (;;) {
  118|   259k|				grey = (uint32_t)((n >> 6) & 0x3);
  119|   259k|				n &= 0x3f;
  120|       |				/*
  121|       |				 * Ensure the run does not exceed the scanline
  122|       |				 * bounds, potentially resulting in a security
  123|       |				 * issue.
  124|       |				 */
  125|   910k|				while (n-- > 0 && npixels < imagewidth && op_offset < scanline)
  ------------------
  |  Branch (125:12): [True: 828k, False: 82.0k]
  |  Branch (125:23): [True: 651k, False: 176k]
  |  Branch (125:47): [True: 651k, False: 290]
  ------------------
  126|   651k|					SETPIXEL(op, grey);
  ------------------
  |  |   33|   651k|#define SETPIXEL(op, v) {			\
  |  |   34|   651k|	switch (npixels++ & 3) {		\
  |  |  ------------------
  |  |  |  Branch (34:10): [True: 0, False: 651k]
  |  |  ------------------
  |  |   35|   197k|	case 0:	op[0]  = (unsigned char) ((v) << 6); break;	\
  |  |  ------------------
  |  |  |  Branch (35:2): [True: 197k, False: 453k]
  |  |  ------------------
  |  |   36|   196k|	case 1:	op[0] |= (v) << 4; break;	\
  |  |  ------------------
  |  |  |  Branch (36:2): [True: 196k, False: 455k]
  |  |  ------------------
  |  |   37|   196k|	case 2:	op[0] |= (v) << 2; break;	\
  |  |  ------------------
  |  |  |  Branch (37:2): [True: 196k, False: 455k]
  |  |  ------------------
  |  |   38|  61.1k|	case 3:	*op++ |= (v);	   op_offset++; break;	\
  |  |  ------------------
  |  |  |  Branch (38:2): [True: 61.1k, False: 590k]
  |  |  ------------------
  |  |   39|   651k|	}					\
  |  |   40|   651k|}
  ------------------
  127|   259k|				if (npixels >= imagewidth)
  ------------------
  |  Branch (127:9): [True: 186k, False: 72.9k]
  ------------------
  128|   186k|					break;
  129|  72.9k|                if (op_offset >= scanline ) {
  ------------------
  |  Branch (129:21): [True: 292, False: 72.6k]
  ------------------
  130|    292|                    TIFFErrorExtR(tif, module, "Invalid data for scanline %"PRIu32,
  131|    292|                        tif->tif_row);
  132|    292|                    return (0);
  133|    292|                }
  134|  72.6k|				if (cc == 0)
  ------------------
  |  Branch (134:9): [True: 490, False: 72.1k]
  ------------------
  135|    490|					goto bad;
  136|  72.1k|				n = *bp++;
  137|  72.1k|				cc--;
  138|  72.1k|			}
  139|   186k|			break;
  140|   187k|		}
  141|   486k|		}
  142|   486k|	}
  143|  1.87k|	tif->tif_rawcp = (uint8_t*) bp;
  144|  1.87k|	tif->tif_rawcc = cc;
  145|  1.87k|	return (1);
  146|  2.05k|bad:
  147|  2.05k|	TIFFErrorExtR(tif, module, "Not enough data for scanline %"PRIu32,
  148|  2.05k|	    tif->tif_row);
  149|  2.05k|	return (0);
  150|  4.22k|}

TIFFInitOJPEG:
  420|  3.33k|{
  421|  3.33k|	static const char module[]="TIFFInitOJPEG";
  422|  3.33k|	OJPEGState* sp;
  423|       |
  424|  3.33k|        (void)scheme;
  425|  3.33k|	assert(scheme==COMPRESSION_OJPEG);
  426|       |
  427|       |        /*
  428|       |	 * Merge codec-specific tag information.
  429|       |	 */
  430|  3.33k|	if (!_TIFFMergeFields(tif, ojpegFields, TIFFArrayCount(ojpegFields))) {
  ------------------
  |  |  261|  3.33k|#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
  ------------------
  |  Branch (430:6): [True: 0, False: 3.33k]
  ------------------
  431|      0|		TIFFErrorExtR(tif, module,
  432|      0|		    "Merging Old JPEG codec-specific tags failed");
  433|      0|		return 0;
  434|      0|	}
  435|       |
  436|       |	/* state block */
  437|  3.33k|	sp=_TIFFmalloc(sizeof(OJPEGState));
  438|  3.33k|	if (sp==NULL)
  ------------------
  |  Branch (438:6): [True: 0, False: 3.33k]
  ------------------
  439|      0|	{
  440|      0|		TIFFErrorExtR(tif,module,"No space for OJPEG state block");
  441|      0|		return(0);
  442|      0|	}
  443|  3.33k|	_TIFFmemset(sp,0,sizeof(OJPEGState));
  444|  3.33k|	sp->tif=tif;
  445|  3.33k|	sp->jpeg_proc=1;
  446|  3.33k|	sp->subsampling_hor=2;
  447|  3.33k|	sp->subsampling_ver=2;
  448|  3.33k|	TIFFSetField(tif,TIFFTAG_YCBCRSUBSAMPLING,2,2);
  ------------------
  |  |  386|  3.33k|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
  449|       |	/* tif codec methods */
  450|  3.33k|	tif->tif_fixuptags=OJPEGFixupTags;  
  451|  3.33k|	tif->tif_setupdecode=OJPEGSetupDecode;
  452|  3.33k|	tif->tif_predecode=OJPEGPreDecode;
  453|  3.33k|	tif->tif_postdecode=OJPEGPostDecode;  
  454|  3.33k|	tif->tif_decoderow=OJPEGDecode;  
  455|  3.33k|	tif->tif_decodestrip=OJPEGDecode;  
  456|  3.33k|	tif->tif_decodetile=OJPEGDecode;  
  457|  3.33k|	tif->tif_setupencode=OJPEGSetupEncode;
  458|  3.33k|	tif->tif_preencode=OJPEGPreEncode;
  459|  3.33k|	tif->tif_postencode=OJPEGPostEncode;
  460|  3.33k|	tif->tif_encoderow=OJPEGEncode;  
  461|  3.33k|	tif->tif_encodestrip=OJPEGEncode;  
  462|  3.33k|	tif->tif_encodetile=OJPEGEncode;  
  463|  3.33k|	tif->tif_cleanup=OJPEGCleanup;
  464|  3.33k|	tif->tif_data=(uint8_t*)sp;
  465|       |	/* tif tag methods */
  466|  3.33k|	sp->vgetparent=tif->tif_tagmethods.vgetfield;
  467|  3.33k|	tif->tif_tagmethods.vgetfield=OJPEGVGetField;
  468|  3.33k|	sp->vsetparent=tif->tif_tagmethods.vsetfield;
  469|  3.33k|	tif->tif_tagmethods.vsetfield=OJPEGVSetField;
  470|  3.33k|	sp->printdir=tif->tif_tagmethods.printdir;
  471|  3.33k|	tif->tif_tagmethods.printdir=OJPEGPrintDir;
  472|       |	/* Some OJPEG files don't have strip or tile offsets or bytecounts tags.
  473|       |	   Some others do, but have totally meaningless or corrupt values
  474|       |	   in these tags. In these cases, the JpegInterchangeFormat stream is
  475|       |	   reliable. In any case, this decoder reads the compressed data itself,
  476|       |	   from the most reliable locations, and we need to notify encapsulating
  477|       |	   LibTiff not to read raw strips or tiles for us. */
  478|  3.33k|	tif->tif_flags|=TIFF_NOREADRAW;
  ------------------
  |  |  108|  3.33k|	#define TIFF_NOREADRAW   0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  479|  3.33k|	return(1);
  480|  3.33k|}
tif_ojpeg.c:OJPEGVGetField:
  484|  40.5k|{
  485|  40.5k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
  486|  40.5k|	switch(tag)
  487|  40.5k|	{
  488|      0|		case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  377|      0|#define	TIFFTAG_JPEGIFOFFSET		513	/* !pointer to SOI marker */
  ------------------
  |  Branch (488:3): [True: 0, False: 40.5k]
  ------------------
  489|      0|			*va_arg(ap, uint64_t*)=(uint64_t)sp->jpeg_interchange_format;
  490|      0|			break;
  491|      0|		case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  378|      0|#define	TIFFTAG_JPEGIFBYTECOUNT		514	/* !JFIF stream length */
  ------------------
  |  Branch (491:3): [True: 0, False: 40.5k]
  ------------------
  492|      0|			*va_arg(ap, uint64_t*)=(uint64_t)sp->jpeg_interchange_format_length;
  493|      0|			break;
  494|  10.0k|		case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  386|  10.0k|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
  |  Branch (494:3): [True: 10.0k, False: 30.5k]
  ------------------
  495|  10.0k|			if (sp->subsamplingcorrect_done==0)
  ------------------
  |  Branch (495:8): [True: 3.09k, False: 6.92k]
  ------------------
  496|  3.09k|				OJPEGSubsamplingCorrect(tif);
  497|  10.0k|			*va_arg(ap, uint16_t*)=(uint16_t)sp->subsampling_hor;
  498|  10.0k|			*va_arg(ap, uint16_t*)=(uint16_t)sp->subsampling_ver;
  499|  10.0k|			break;
  500|      0|		case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  382|      0|#define	TIFFTAG_JPEGQTABLES		519	/* !Q matrix offsets */
  ------------------
  |  Branch (500:3): [True: 0, False: 40.5k]
  ------------------
  501|      0|			*va_arg(ap, uint32_t*)=(uint32_t)sp->qtable_offset_count;
  502|      0|			*va_arg(ap,const void**)=(const void*)sp->qtable_offset;
  503|      0|			break;
  504|      0|		case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  383|      0|#define	TIFFTAG_JPEGDCTABLES		520	/* !DCT table offsets */
  ------------------
  |  Branch (504:3): [True: 0, False: 40.5k]
  ------------------
  505|      0|			*va_arg(ap, uint32_t*)=(uint32_t)sp->dctable_offset_count;
  506|      0|			*va_arg(ap,const void**)=(const void*)sp->dctable_offset;
  507|      0|			break;
  508|      0|		case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  384|      0|#define	TIFFTAG_JPEGACTABLES		521	/* !AC coefficient offsets */
  ------------------
  |  Branch (508:3): [True: 0, False: 40.5k]
  ------------------
  509|      0|			*va_arg(ap, uint32_t*)=(uint32_t)sp->actable_offset_count;
  510|      0|			*va_arg(ap,const void**)=(const void*)sp->actable_offset;
  511|      0|			break;
  512|      0|		case TIFFTAG_JPEGPROC:
  ------------------
  |  |  374|      0|#define	TIFFTAG_JPEGPROC		512	/* !JPEG processing algorithm */
  ------------------
  |  Branch (512:3): [True: 0, False: 40.5k]
  ------------------
  513|      0|			*va_arg(ap, uint16_t*)=(uint16_t)sp->jpeg_proc;
  514|      0|			break;
  515|      0|		case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  379|      0|#define	TIFFTAG_JPEGRESTARTINTERVAL	515	/* !restart interval length */
  ------------------
  |  Branch (515:3): [True: 0, False: 40.5k]
  ------------------
  516|      0|			*va_arg(ap, uint16_t*)=sp->restart_interval;
  517|      0|			break;
  518|  30.5k|		default:
  ------------------
  |  Branch (518:3): [True: 30.5k, False: 10.0k]
  ------------------
  519|  30.5k|			return (*sp->vgetparent)(tif,tag,ap);
  520|  40.5k|	}
  521|  10.0k|	return (1);
  522|  40.5k|}
tif_ojpeg.c:OJPEGSubsamplingCorrect:
 1016|  3.15k|{
 1017|  3.15k|	static const char module[]="OJPEGSubsamplingCorrect";
 1018|  3.15k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1019|  3.15k|	uint8_t mh;
 1020|  3.15k|	uint8_t mv;
 1021|       |        
 1022|  3.15k|	assert(sp->subsamplingcorrect_done==0);
 1023|  3.15k|	if ((tif->tif_dir.td_samplesperpixel!=3) || ((tif->tif_dir.td_photometric!=PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  221|  3.11k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (1023:6): [True: 40, False: 3.11k]
  |  Branch (1023:47): [True: 19, False: 3.09k]
  ------------------
 1024|  3.11k|	    (tif->tif_dir.td_photometric!=PHOTOMETRIC_ITULAB)))
  ------------------
  |  |  224|     19|#define	    PHOTOMETRIC_ITULAB		10	/* ITU L*a*b* */
  ------------------
  |  Branch (1024:6): [True: 19, False: 0]
  ------------------
 1025|     59|	{
 1026|     59|		if (sp->subsampling_tag!=0)
  ------------------
  |  Branch (1026:7): [True: 3, False: 56]
  ------------------
 1027|      3|			TIFFWarningExtR(tif,module,"Subsampling tag not appropriate for this Photometric and/or SamplesPerPixel");
 1028|     59|		sp->subsampling_hor=1;
 1029|     59|		sp->subsampling_ver=1;
 1030|     59|		sp->subsampling_force_desubsampling_inside_decompression=0;
 1031|     59|	}
 1032|  3.09k|	else
 1033|  3.09k|	{
 1034|  3.09k|		sp->subsamplingcorrect_done=1;
 1035|  3.09k|		mh=sp->subsampling_hor;
 1036|  3.09k|		mv=sp->subsampling_ver;
 1037|  3.09k|		sp->subsamplingcorrect=1;
 1038|  3.09k|		OJPEGReadHeaderInfoSec(tif);
 1039|  3.09k|		if (sp->subsampling_force_desubsampling_inside_decompression!=0)
  ------------------
  |  Branch (1039:7): [True: 95, False: 2.99k]
  ------------------
 1040|     95|		{
 1041|     95|			sp->subsampling_hor=1;
 1042|     95|			sp->subsampling_ver=1;
 1043|     95|		}
 1044|  3.09k|		sp->subsamplingcorrect=0;
 1045|  3.09k|		if (((sp->subsampling_hor!=mh) || (sp->subsampling_ver!=mv)) && (sp->subsampling_force_desubsampling_inside_decompression==0))
  ------------------
  |  Branch (1045:8): [True: 104, False: 2.98k]
  |  Branch (1045:37): [True: 1, False: 2.98k]
  |  Branch (1045:67): [True: 10, False: 95]
  ------------------
 1046|     10|		{
 1047|     10|			if (sp->subsampling_tag==0)
  ------------------
  |  Branch (1047:8): [True: 9, False: 1]
  ------------------
 1048|      9|				TIFFWarningExtR(tif,module,"Subsampling tag is not set, yet subsampling inside JPEG data [%"PRIu8",%"PRIu8"] does not match default values [2,2]; assuming subsampling inside JPEG data is correct",sp->subsampling_hor,sp->subsampling_ver);
 1049|      1|			else
 1050|      1|				TIFFWarningExtR(tif,module,"Subsampling inside JPEG data [%"PRIu8",%"PRIu8"] does not match subsampling tag values [%"PRIu8",%"PRIu8"]; assuming subsampling inside JPEG data is correct",sp->subsampling_hor,sp->subsampling_ver,mh,mv);
 1051|     10|		}
 1052|  3.09k|		if (sp->subsampling_force_desubsampling_inside_decompression!=0)
  ------------------
  |  Branch (1052:7): [True: 95, False: 2.99k]
  ------------------
 1053|     95|		{
 1054|     95|			if (sp->subsampling_tag==0)
  ------------------
  |  Branch (1054:8): [True: 94, False: 1]
  ------------------
 1055|     94|				TIFFWarningExtR(tif,module,"Subsampling tag is not set, yet subsampling inside JPEG data does not match default values [2,2] (nor any other values allowed in TIFF); assuming subsampling inside JPEG data is correct and desubsampling inside JPEG decompression");
 1056|      1|			else
 1057|      1|				TIFFWarningExtR(tif,module,"Subsampling inside JPEG data does not match subsampling tag values [%"PRIu8",%"PRIu8"] (nor any other values allowed in TIFF); assuming subsampling inside JPEG data is correct and desubsampling inside JPEG decompression",mh,mv);
 1058|     95|		}
 1059|  3.09k|		if (sp->subsampling_force_desubsampling_inside_decompression==0)
  ------------------
  |  Branch (1059:7): [True: 2.99k, False: 95]
  ------------------
 1060|  2.99k|		{
 1061|  2.99k|			if (sp->subsampling_hor<sp->subsampling_ver)
  ------------------
  |  Branch (1061:8): [True: 20, False: 2.97k]
  ------------------
 1062|     20|				TIFFWarningExtR(tif,module,"Subsampling values [%"PRIu8",%"PRIu8"] are not allowed in TIFF",sp->subsampling_hor,sp->subsampling_ver);
 1063|  2.99k|		}
 1064|  3.09k|	}
 1065|  3.15k|	sp->subsamplingcorrect_done=1;
 1066|  3.15k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSec:
 1320|  4.88k|{
 1321|  4.88k|	static const char module[]="OJPEGReadHeaderInfoSec";
 1322|  4.88k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1323|  4.88k|	uint8_t m;
 1324|  4.88k|	uint16_t n;
 1325|  4.88k|	uint8_t o;
 1326|  4.88k|	if (sp->file_size==0)
  ------------------
  |  Branch (1326:6): [True: 3.14k, False: 1.74k]
  ------------------
 1327|  3.14k|		sp->file_size=TIFFGetFileSize(tif);
  ------------------
  |  |  220|  3.14k|	((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 1328|  4.88k|	if (sp->jpeg_interchange_format!=0)
  ------------------
  |  Branch (1328:6): [True: 720, False: 4.16k]
  ------------------
 1329|    720|	{
 1330|    720|		if (sp->jpeg_interchange_format>=sp->file_size)
  ------------------
  |  Branch (1330:7): [True: 68, False: 652]
  ------------------
 1331|     68|		{
 1332|     68|			sp->jpeg_interchange_format=0;
 1333|     68|			sp->jpeg_interchange_format_length=0;
 1334|     68|		}
 1335|    652|		else
 1336|    652|		{
 1337|    652|			if ((sp->jpeg_interchange_format_length==0) ||
  ------------------
  |  Branch (1337:8): [True: 379, False: 273]
  ------------------
 1338|    652|                            (sp->jpeg_interchange_format > UINT64_MAX - sp->jpeg_interchange_format_length) ||
  ------------------
  |  Branch (1338:29): [True: 9, False: 264]
  ------------------
 1339|    652|                            (sp->jpeg_interchange_format+sp->jpeg_interchange_format_length>sp->file_size))
  ------------------
  |  Branch (1339:29): [True: 156, False: 108]
  ------------------
 1340|    544|				sp->jpeg_interchange_format_length=sp->file_size-sp->jpeg_interchange_format;
 1341|    652|		}
 1342|    720|	}
 1343|  4.88k|	sp->in_buffer_source=osibsNotSetYet;
 1344|  4.88k|	sp->in_buffer_next_strile=0;
 1345|  4.88k|	sp->in_buffer_strile_count=tif->tif_dir.td_nstrips;
 1346|  4.88k|	sp->in_buffer_file_togo=0;
 1347|  4.88k|	sp->in_buffer_togo=0;
 1348|  4.88k|	do
 1349|  19.1k|	{
 1350|  19.1k|		if (OJPEGReadBytePeek(sp,&m)==0)
  ------------------
  |  Branch (1350:7): [True: 903, False: 18.2k]
  ------------------
 1351|    903|			return(0);
 1352|  18.2k|		if (m!=255)
  ------------------
  |  Branch (1352:7): [True: 3.45k, False: 14.7k]
  ------------------
 1353|  3.45k|			break;
 1354|  14.7k|		OJPEGReadByteAdvance(sp);
 1355|  14.7k|		do
 1356|   168k|		{
 1357|   168k|			if (OJPEGReadByte(sp,&m)==0)
  ------------------
  |  Branch (1357:8): [True: 41, False: 168k]
  ------------------
 1358|     41|				return(0);
 1359|   168k|		} while(m==255);
  ------------------
  |  Branch (1359:11): [True: 153k, False: 14.7k]
  ------------------
 1360|  14.7k|		switch(m)
 1361|  14.7k|		{
 1362|    533|			case JPEG_MARKER_SOI:
  ------------------
  |  |  161|    533|#define JPEG_MARKER_SOI 0xD8
  ------------------
  |  Branch (1362:4): [True: 533, False: 14.1k]
  ------------------
 1363|       |				/* this type of marker has no data, and should be skipped */
 1364|    533|				break;
 1365|    666|			case JPEG_MARKER_COM:
  ------------------
  |  |  167|    666|#define JPEG_MARKER_COM 0xFE
  ------------------
  |  Branch (1365:4): [True: 666, False: 14.0k]
  ------------------
 1366|    972|			case JPEG_MARKER_APP0:
  ------------------
  |  |  166|    972|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1366:4): [True: 306, False: 14.3k]
  ------------------
 1367|  1.36k|			case JPEG_MARKER_APP0+1:
  ------------------
  |  |  166|  1.36k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1367:4): [True: 395, False: 14.3k]
  ------------------
 1368|  1.84k|			case JPEG_MARKER_APP0+2:
  ------------------
  |  |  166|  1.84k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1368:4): [True: 473, False: 14.2k]
  ------------------
 1369|  2.13k|			case JPEG_MARKER_APP0+3:
  ------------------
  |  |  166|  2.13k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1369:4): [True: 296, False: 14.4k]
  ------------------
 1370|  4.01k|			case JPEG_MARKER_APP0+4:
  ------------------
  |  |  166|  4.01k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1370:4): [True: 1.87k, False: 12.8k]
  ------------------
 1371|  4.47k|			case JPEG_MARKER_APP0+5:
  ------------------
  |  |  166|  4.47k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1371:4): [True: 466, False: 14.2k]
  ------------------
 1372|  4.74k|			case JPEG_MARKER_APP0+6:
  ------------------
  |  |  166|  4.74k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1372:4): [True: 270, False: 14.4k]
  ------------------
 1373|  5.14k|			case JPEG_MARKER_APP0+7:
  ------------------
  |  |  166|  5.14k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1373:4): [True: 396, False: 14.3k]
  ------------------
 1374|  5.43k|			case JPEG_MARKER_APP0+8:
  ------------------
  |  |  166|  5.43k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1374:4): [True: 291, False: 14.4k]
  ------------------
 1375|  5.74k|			case JPEG_MARKER_APP0+9:
  ------------------
  |  |  166|  5.74k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1375:4): [True: 305, False: 14.3k]
  ------------------
 1376|  5.95k|			case JPEG_MARKER_APP0+10:
  ------------------
  |  |  166|  5.95k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1376:4): [True: 211, False: 14.4k]
  ------------------
 1377|  6.19k|			case JPEG_MARKER_APP0+11:
  ------------------
  |  |  166|  6.19k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1377:4): [True: 240, False: 14.4k]
  ------------------
 1378|  6.56k|			case JPEG_MARKER_APP0+12:
  ------------------
  |  |  166|  6.56k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1378:4): [True: 375, False: 14.3k]
  ------------------
 1379|  6.77k|			case JPEG_MARKER_APP0+13:
  ------------------
  |  |  166|  6.77k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1379:4): [True: 206, False: 14.4k]
  ------------------
 1380|  7.14k|			case JPEG_MARKER_APP0+14:
  ------------------
  |  |  166|  7.14k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1380:4): [True: 376, False: 14.3k]
  ------------------
 1381|  7.64k|			case JPEG_MARKER_APP0+15:
  ------------------
  |  |  166|  7.64k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1381:4): [True: 497, False: 14.2k]
  ------------------
 1382|       |				/* this type of marker has data, but it has no use to us (and no place here) and should be skipped */
 1383|  7.64k|				if (OJPEGReadWord(sp,&n)==0)
  ------------------
  |  Branch (1383:9): [True: 18, False: 7.62k]
  ------------------
 1384|     18|					return(0);
 1385|  7.62k|				if (n<2)
  ------------------
  |  Branch (1385:9): [True: 12, False: 7.61k]
  ------------------
 1386|     12|				{
 1387|     12|					if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1387:10): [True: 2, False: 10]
  ------------------
 1388|      2|						TIFFErrorExtR(tif,module,"Corrupt JPEG data");
 1389|     12|					return(0);
 1390|     12|				}
 1391|  7.61k|				if (n>2)
  ------------------
  |  Branch (1391:9): [True: 7.08k, False: 535]
  ------------------
 1392|  7.08k|					OJPEGReadSkip(sp,n-2);
 1393|  7.61k|				break;
 1394|    266|			case JPEG_MARKER_DRI:
  ------------------
  |  |  165|    266|#define JPEG_MARKER_DRI 0xDD
  ------------------
  |  Branch (1394:4): [True: 266, False: 14.4k]
  ------------------
 1395|    266|				if (OJPEGReadHeaderInfoSecStreamDri(tif)==0)
  ------------------
  |  Branch (1395:9): [True: 15, False: 251]
  ------------------
 1396|     15|					return(0);
 1397|    251|				break;
 1398|  1.70k|			case JPEG_MARKER_DQT:
  ------------------
  |  |  164|  1.70k|#define JPEG_MARKER_DQT 0xDB
  ------------------
  |  Branch (1398:4): [True: 1.70k, False: 13.0k]
  ------------------
 1399|  1.70k|				if (OJPEGReadHeaderInfoSecStreamDqt(tif)==0)
  ------------------
  |  Branch (1399:9): [True: 44, False: 1.65k]
  ------------------
 1400|     44|					return(0);
 1401|  1.65k|				break;
 1402|  4.15k|			case JPEG_MARKER_DHT:
  ------------------
  |  |  159|  4.15k|#define JPEG_MARKER_DHT 0xC4
  ------------------
  |  Branch (1402:4): [True: 4.15k, False: 10.5k]
  ------------------
 1403|  4.15k|				if (OJPEGReadHeaderInfoSecStreamDht(tif)==0)
  ------------------
  |  Branch (1403:9): [True: 44, False: 4.11k]
  ------------------
 1404|     44|					return(0);
 1405|  4.11k|				break;
 1406|  4.11k|			case JPEG_MARKER_SOF0:
  ------------------
  |  |  156|    183|#define JPEG_MARKER_SOF0 0xC0
  ------------------
  |  Branch (1406:4): [True: 183, False: 14.5k]
  ------------------
 1407|    191|			case JPEG_MARKER_SOF1:
  ------------------
  |  |  157|    191|#define JPEG_MARKER_SOF1 0xC1
  ------------------
  |  Branch (1407:4): [True: 8, False: 14.6k]
  ------------------
 1408|    277|			case JPEG_MARKER_SOF3:
  ------------------
  |  |  158|    277|#define JPEG_MARKER_SOF3 0xC3
  ------------------
  |  Branch (1408:4): [True: 86, False: 14.6k]
  ------------------
 1409|    277|				if (OJPEGReadHeaderInfoSecStreamSof(tif,m)==0)
  ------------------
  |  Branch (1409:9): [True: 170, False: 107]
  ------------------
 1410|    170|					return(0);
 1411|    107|				if (sp->subsamplingcorrect!=0)
  ------------------
  |  Branch (1411:9): [True: 64, False: 43]
  ------------------
 1412|     64|					return(1);
 1413|     43|				break;
 1414|     43|			case JPEG_MARKER_SOS:
  ------------------
  |  |  163|     13|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1414:4): [True: 13, False: 14.6k]
  ------------------
 1415|     13|				if (sp->subsamplingcorrect!=0)
  ------------------
  |  Branch (1415:9): [True: 4, False: 9]
  ------------------
 1416|      4|					return(1);
 1417|      9|				assert(sp->plane_sample_offset==0);
 1418|      9|				if (OJPEGReadHeaderInfoSecStreamSos(tif)==0)
  ------------------
  |  Branch (1418:9): [True: 7, False: 2]
  ------------------
 1419|      7|					return(0);
 1420|      2|				break;
 1421|    109|			default:
  ------------------
  |  Branch (1421:4): [True: 109, False: 14.5k]
  ------------------
 1422|    109|				TIFFErrorExtR(tif,module,"Unknown marker type %"PRIu8" in JPEG data", m);
 1423|    109|				return(0);
 1424|  14.7k|		}
 1425|  14.7k|	} while(m!=JPEG_MARKER_SOS);
  ------------------
  |  |  163|  14.2k|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1425:10): [True: 14.2k, False: 2]
  ------------------
 1426|  3.45k|	if (sp->subsamplingcorrect)
  ------------------
  |  Branch (1426:6): [True: 1.90k, False: 1.54k]
  ------------------
 1427|  1.90k|		return(1);
 1428|  1.54k|	if (sp->sof_log==0)
  ------------------
  |  Branch (1428:6): [True: 1.51k, False: 37]
  ------------------
 1429|  1.51k|	{
 1430|  1.51k|		if (OJPEGReadHeaderInfoSecTablesQTable(tif)==0)
  ------------------
  |  Branch (1430:7): [True: 323, False: 1.18k]
  ------------------
 1431|    323|			return(0);
 1432|  1.18k|		sp->sof_marker_id=JPEG_MARKER_SOF0;
  ------------------
  |  |  156|  1.18k|#define JPEG_MARKER_SOF0 0xC0
  ------------------
 1433|  4.68k|		for (o=0; o<sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1433:13): [True: 3.50k, False: 1.18k]
  ------------------
 1434|  3.50k|			sp->sof_c[o]=o;
 1435|  1.18k|		sp->sof_hv[0]=((sp->subsampling_hor<<4)|sp->subsampling_ver);
 1436|  3.50k|		for (o=1; o<sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1436:13): [True: 2.31k, False: 1.18k]
  ------------------
 1437|  2.31k|			sp->sof_hv[o]=17;
 1438|  1.18k|		sp->sof_x=sp->strile_width;
 1439|  1.18k|		sp->sof_y=sp->strile_length_total;
 1440|  1.18k|		sp->sof_log=1;
 1441|  1.18k|		if (OJPEGReadHeaderInfoSecTablesDcTable(tif)==0)
  ------------------
  |  Branch (1441:7): [True: 198, False: 990]
  ------------------
 1442|    198|			return(0);
 1443|    990|		if (OJPEGReadHeaderInfoSecTablesAcTable(tif)==0)
  ------------------
  |  Branch (1443:7): [True: 195, False: 795]
  ------------------
 1444|    195|			return(0);
 1445|  2.32k|		for (o=1; o<sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1445:13): [True: 1.53k, False: 795]
  ------------------
 1446|  1.53k|			sp->sos_cs[o]=o;
 1447|    795|	}
 1448|    832|	return(1);
 1449|  1.54k|}
tif_ojpeg.c:OJPEGReadBytePeek:
 2110|  19.1k|{
 2111|  19.1k|	if (sp->in_buffer_togo==0)
  ------------------
  |  Branch (2111:6): [True: 12.9k, False: 6.16k]
  ------------------
 2112|  12.9k|	{
 2113|  12.9k|		if (OJPEGReadBufferFill(sp)==0)
  ------------------
  |  Branch (2113:7): [True: 903, False: 12.0k]
  ------------------
 2114|    903|			return(0);
 2115|  12.0k|		assert(sp->in_buffer_togo>0);
 2116|  12.0k|	}
 2117|  18.2k|	*byte=*(sp->in_buffer_cur);
 2118|  18.2k|	return(1);
 2119|  19.1k|}
tif_ojpeg.c:OJPEGReadBufferFill:
 2010|  94.3k|{
 2011|  94.3k|	uint16_t m;
 2012|  94.3k|	tmsize_t n;
 2013|       |	/* TODO: double-check: when subsamplingcorrect is set, no call to TIFFErrorExt or TIFFWarningExt should be made
 2014|       |	 * in any other case, seek or read errors should be passed through */
 2015|  94.3k|	do
 2016|  1.59M|	{
 2017|  1.59M|		if (sp->in_buffer_file_togo!=0)
  ------------------
  |  Branch (2017:7): [True: 77.6k, False: 1.51M]
  ------------------
 2018|  77.6k|		{
 2019|  77.6k|			if (sp->in_buffer_file_pos_log==0)
  ------------------
  |  Branch (2019:8): [True: 71.3k, False: 6.31k]
  ------------------
 2020|  71.3k|			{
 2021|  71.3k|				TIFFSeekFile(sp->tif,sp->in_buffer_file_pos,SEEK_SET);
  ------------------
  |  |  216|  71.3k|	((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))
  ------------------
 2022|  71.3k|				sp->in_buffer_file_pos_log=1;
 2023|  71.3k|			}
 2024|  77.6k|			m=OJPEG_BUFFER;
  ------------------
  |  |  153|  77.6k|#define OJPEG_BUFFER 2048
  ------------------
 2025|  77.6k|			if ((uint64_t)m > sp->in_buffer_file_togo)
  ------------------
  |  Branch (2025:8): [True: 69.2k, False: 8.42k]
  ------------------
 2026|  69.2k|				m=(uint16_t)sp->in_buffer_file_togo;
 2027|  77.6k|			n=TIFFReadFile(sp->tif,sp->in_buffer,(tmsize_t)m);
  ------------------
  |  |  212|  77.6k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  ------------------
 2028|  77.6k|			if (n==0)
  ------------------
  |  Branch (2028:8): [True: 178, False: 77.4k]
  ------------------
 2029|    178|				return(0);
 2030|  77.4k|			assert(n>0);
 2031|  77.4k|			assert(n<=OJPEG_BUFFER);
 2032|  77.4k|			assert(n<65536);
 2033|  77.4k|			assert((uint64_t)n <= sp->in_buffer_file_togo);
 2034|  77.4k|			m=(uint16_t)n;
 2035|  77.4k|			sp->in_buffer_togo=m;
 2036|  77.4k|			sp->in_buffer_cur=sp->in_buffer;
 2037|  77.4k|			sp->in_buffer_file_togo-=m;
 2038|  77.4k|			sp->in_buffer_file_pos+=m;
 2039|  77.4k|			break;
 2040|  77.4k|		}
 2041|  1.51M|		sp->in_buffer_file_pos_log=0;
 2042|  1.51M|		switch(sp->in_buffer_source)
 2043|  1.51M|		{
 2044|  4.88k|			case osibsNotSetYet:
  ------------------
  |  Branch (2044:4): [True: 4.88k, False: 1.51M]
  ------------------
 2045|  4.88k|				if (sp->jpeg_interchange_format!=0)
  ------------------
  |  Branch (2045:9): [True: 652, False: 4.23k]
  ------------------
 2046|    652|				{
 2047|    652|					sp->in_buffer_file_pos=sp->jpeg_interchange_format;
 2048|    652|					sp->in_buffer_file_togo=sp->jpeg_interchange_format_length;
 2049|    652|				}
 2050|  4.88k|				sp->in_buffer_source=osibsJpegInterchangeFormat;
 2051|  4.88k|				break;
 2052|  9.18k|			case osibsJpegInterchangeFormat:
  ------------------
  |  Branch (2052:4): [True: 9.18k, False: 1.50M]
  ------------------
 2053|  9.18k|				sp->in_buffer_source=osibsStrile;
 2054|  9.18k|                                break;
 2055|  1.49M|			case osibsStrile:
  ------------------
  |  Branch (2055:4): [True: 1.49M, False: 25.1k]
  ------------------
 2056|  1.49M|				if (sp->in_buffer_next_strile==sp->in_buffer_strile_count)
  ------------------
  |  Branch (2056:9): [True: 6.44k, False: 1.48M]
  ------------------
 2057|  6.44k|					sp->in_buffer_source=osibsEof;
 2058|  1.48M|				else
 2059|  1.48M|				{
 2060|  1.48M|					int err = 0;
 2061|  1.48M|					sp->in_buffer_file_pos=TIFFGetStrileOffsetWithErr(sp->tif, sp->in_buffer_next_strile, &err);
 2062|  1.48M|					if( err )
  ------------------
  |  Branch (2062:10): [True: 471, False: 1.48M]
  ------------------
 2063|    471|						return 0;
 2064|  1.48M|					if (sp->in_buffer_file_pos!=0)
  ------------------
  |  Branch (2064:10): [True: 483k, False: 999k]
  ------------------
 2065|   483k|					{
 2066|   483k|						uint64_t bytecount = TIFFGetStrileByteCountWithErr(sp->tif, sp->in_buffer_next_strile, &err);
 2067|   483k|						if( err )
  ------------------
  |  Branch (2067:11): [True: 5.18k, False: 478k]
  ------------------
 2068|  5.18k|							return 0;
 2069|   478k|						if (sp->in_buffer_file_pos>=sp->file_size)
  ------------------
  |  Branch (2069:11): [True: 433k, False: 44.7k]
  ------------------
 2070|   433k|							sp->in_buffer_file_pos=0;
 2071|  44.7k|						else if (bytecount==0)
  ------------------
  |  Branch (2071:16): [True: 20.1k, False: 24.6k]
  ------------------
 2072|  20.1k|							sp->in_buffer_file_togo=sp->file_size-sp->in_buffer_file_pos;
 2073|  24.6k|						else
 2074|  24.6k|						{
 2075|  24.6k|							sp->in_buffer_file_togo=bytecount;
 2076|  24.6k|							if (sp->in_buffer_file_togo==0)
  ------------------
  |  Branch (2076:12): [True: 0, False: 24.6k]
  ------------------
 2077|      0|								sp->in_buffer_file_pos=0;
 2078|  24.6k|							else if (sp->in_buffer_file_pos > UINT64_MAX - sp->in_buffer_file_togo ||
  ------------------
  |  Branch (2078:17): [True: 216, False: 24.3k]
  ------------------
 2079|  24.6k|                                                                sp->in_buffer_file_pos+sp->in_buffer_file_togo>sp->file_size)
  ------------------
  |  Branch (2079:65): [True: 12.3k, False: 12.0k]
  ------------------
 2080|  12.5k|								sp->in_buffer_file_togo=sp->file_size-sp->in_buffer_file_pos;
 2081|  24.6k|						}
 2082|   478k|					}
 2083|  1.47M|					sp->in_buffer_next_strile++;
 2084|  1.47M|				}
 2085|  1.48M|				break;
 2086|  1.48M|			default:
  ------------------
  |  Branch (2086:4): [True: 11.0k, False: 1.50M]
  ------------------
 2087|  11.0k|				return(0);
 2088|  1.51M|		}
 2089|  1.51M|	} while (1);
  ------------------
  |  Branch (2089:11): [Folded - Ignored]
  ------------------
 2090|  77.4k|	return(1);
 2091|  94.3k|}
tif_ojpeg.c:OJPEGReadByteAdvance:
 2123|  14.7k|{
 2124|  14.7k|	assert(sp->in_buffer_togo>0);
 2125|  14.7k|	sp->in_buffer_cur++;
 2126|  14.7k|	sp->in_buffer_togo--;
 2127|  14.7k|}
tif_ojpeg.c:OJPEGReadByte:
 2095|  20.7M|{
 2096|  20.7M|	if (sp->in_buffer_togo==0)
  ------------------
  |  Branch (2096:6): [True: 46.7k, False: 20.7M]
  ------------------
 2097|  46.7k|	{
 2098|  46.7k|		if (OJPEGReadBufferFill(sp)==0)
  ------------------
  |  Branch (2098:7): [True: 9.13k, False: 37.6k]
  ------------------
 2099|  9.13k|			return(0);
 2100|  37.6k|		assert(sp->in_buffer_togo>0);
 2101|  37.6k|	}
 2102|  20.7M|	*byte=*(sp->in_buffer_cur);
 2103|  20.7M|	sp->in_buffer_cur++;
 2104|  20.7M|	sp->in_buffer_togo--;
 2105|  20.7M|	return(1);
 2106|  20.7M|}
tif_ojpeg.c:OJPEGReadWord:
 2131|  21.2k|{
 2132|  21.2k|	uint8_t m;
 2133|  21.2k|	if (OJPEGReadByte(sp,&m)==0)
  ------------------
  |  Branch (2133:6): [True: 263, False: 20.9k]
  ------------------
 2134|    263|		return(0);
 2135|  20.9k|	*word=(m<<8);
 2136|  20.9k|	if (OJPEGReadByte(sp,&m)==0)
  ------------------
  |  Branch (2136:6): [True: 295, False: 20.6k]
  ------------------
 2137|    295|		return(0);
 2138|  20.6k|	*word|=m;
 2139|  20.6k|	return(1);
 2140|  20.9k|}
tif_ojpeg.c:OJPEGReadSkip:
 2173|  11.1k|{
 2174|  11.1k|	uint16_t m;
 2175|  11.1k|	uint16_t n;
 2176|  11.1k|	m=len;
 2177|  11.1k|	n=m;
 2178|  11.1k|	if (n>sp->in_buffer_togo)
  ------------------
  |  Branch (2178:6): [True: 7.97k, False: 3.15k]
  ------------------
 2179|  7.97k|		n=sp->in_buffer_togo;
 2180|  11.1k|	sp->in_buffer_cur+=n;
 2181|  11.1k|	sp->in_buffer_togo-=n;
 2182|  11.1k|	m-=n;
 2183|  11.1k|	if (m>0)
  ------------------
  |  Branch (2183:6): [True: 7.97k, False: 3.15k]
  ------------------
 2184|  7.97k|	{
 2185|  7.97k|		assert(sp->in_buffer_togo==0);
 2186|  7.97k|		n=m;
 2187|  7.97k|		if ((uint64_t)n > sp->in_buffer_file_togo)
  ------------------
  |  Branch (2187:7): [True: 7.31k, False: 659]
  ------------------
 2188|  7.31k|			n=(uint16_t)sp->in_buffer_file_togo;
 2189|  7.97k|		sp->in_buffer_file_pos+=n;
 2190|  7.97k|		sp->in_buffer_file_togo-=n;
 2191|  7.97k|		sp->in_buffer_file_pos_log=0;
 2192|       |		/* we don't skip past jpeginterchangeformat/strile block...
 2193|       |		 * if that is asked from us, we're dealing with totally bazurk
 2194|       |		 * data anyway, and we've not seen this happening on any
 2195|       |		 * testfile, so we might as well likely cause some other
 2196|       |		 * meaningless error to be passed at some later time
 2197|       |		 */
 2198|  7.97k|	}
 2199|  11.1k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDri:
 1453|    266|{
 1454|       |	/* This could easily cause trouble in some cases... but no such cases have
 1455|       |           occurred so far */
 1456|    266|	static const char module[]="OJPEGReadHeaderInfoSecStreamDri";
 1457|    266|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1458|    266|	uint16_t m;
 1459|    266|	if (OJPEGReadWord(sp,&m)==0)
  ------------------
  |  Branch (1459:6): [True: 3, False: 263]
  ------------------
 1460|      3|		return(0);
 1461|    263|	if (m!=4)
  ------------------
  |  Branch (1461:6): [True: 7, False: 256]
  ------------------
 1462|      7|	{
 1463|      7|		TIFFErrorExtR(tif,module,"Corrupt DRI marker in JPEG data");
 1464|      7|		return(0);
 1465|      7|	}
 1466|    256|	if (OJPEGReadWord(sp,&m)==0)
  ------------------
  |  Branch (1466:6): [True: 5, False: 251]
  ------------------
 1467|      5|		return(0);
 1468|    251|	sp->restart_interval=m;
 1469|    251|	return(1);
 1470|    256|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDqt:
 1474|  1.70k|{
 1475|       |	/* this is a table marker, and it is to be saved as a whole for exact pushing on the jpeg stream later on */
 1476|  1.70k|	static const char module[]="OJPEGReadHeaderInfoSecStreamDqt";
 1477|  1.70k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1478|  1.70k|	uint16_t m;
 1479|  1.70k|	uint32_t na;
 1480|  1.70k|	uint8_t* nb;
 1481|  1.70k|	uint8_t o;
 1482|  1.70k|	if (OJPEGReadWord(sp,&m)==0)
  ------------------
  |  Branch (1482:6): [True: 4, False: 1.69k]
  ------------------
 1483|      4|		return(0);
 1484|  1.69k|	if (m<=2)
  ------------------
  |  Branch (1484:6): [True: 4, False: 1.69k]
  ------------------
 1485|      4|	{
 1486|      4|		if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1486:7): [True: 1, False: 3]
  ------------------
 1487|      1|			TIFFErrorExtR(tif,module,"Corrupt DQT marker in JPEG data");
 1488|      4|		return(0);
 1489|      4|	}
 1490|  1.69k|	if (sp->subsamplingcorrect!=0)
  ------------------
  |  Branch (1490:6): [True: 1.03k, False: 662]
  ------------------
 1491|  1.03k|		OJPEGReadSkip(sp,m-2);
 1492|    662|	else
 1493|    662|	{
 1494|    662|		m-=2;
 1495|    662|		do
 1496|    918|		{
 1497|    918|			if (m<65)
  ------------------
  |  Branch (1497:8): [True: 3, False: 915]
  ------------------
 1498|      3|			{
 1499|      3|				TIFFErrorExtR(tif,module,"Corrupt DQT marker in JPEG data");
 1500|      3|				return(0);
 1501|      3|			}
 1502|    915|			na= sizeof(uint32_t) + 69;
 1503|    915|			nb=_TIFFmalloc(na);
 1504|    915|			if (nb==0)
  ------------------
  |  Branch (1504:8): [True: 0, False: 915]
  ------------------
 1505|      0|			{
 1506|      0|				TIFFErrorExtR(tif,module,"Out of memory");
 1507|      0|				return(0);
 1508|      0|			}
 1509|    915|			*(uint32_t*)nb=na;
 1510|    915|			nb[sizeof(uint32_t)]=255;
 1511|    915|			nb[sizeof(uint32_t) + 1]=JPEG_MARKER_DQT;
  ------------------
  |  |  164|    915|#define JPEG_MARKER_DQT 0xDB
  ------------------
 1512|    915|			nb[sizeof(uint32_t) + 2]=0;
 1513|    915|			nb[sizeof(uint32_t) + 3]=67;
 1514|    915|			if (OJPEGReadBlock(sp,65,&nb[sizeof(uint32_t) + 4]) == 0) {
  ------------------
  |  Branch (1514:8): [True: 7, False: 908]
  ------------------
 1515|      7|				_TIFFfree(nb);
 1516|      7|				return(0);
 1517|      7|			}
 1518|    908|			o= nb[sizeof(uint32_t) + 4] & 15;
 1519|    908|			if (3<o)
  ------------------
  |  Branch (1519:8): [True: 26, False: 882]
  ------------------
 1520|     26|			{
 1521|     26|				TIFFErrorExtR(tif,module,"Corrupt DQT marker in JPEG data");
 1522|     26|				_TIFFfree(nb);
 1523|     26|				return(0);
 1524|     26|			}
 1525|    882|			if (sp->qtable[o]!=0)
  ------------------
  |  Branch (1525:8): [True: 815, False: 67]
  ------------------
 1526|    815|				_TIFFfree(sp->qtable[o]);
 1527|    882|			sp->qtable[o]=nb;
 1528|    882|			m-=65;
 1529|    882|		} while(m>0);
  ------------------
  |  Branch (1529:11): [True: 256, False: 626]
  ------------------
 1530|    662|	}
 1531|  1.65k|	return(1);
 1532|  1.69k|}
tif_ojpeg.c:OJPEGReadBlock:
 2144|  2.62k|{
 2145|  2.62k|	uint16_t mlen;
 2146|  2.62k|	uint8_t* mmem;
 2147|  2.62k|	uint16_t n;
 2148|  2.62k|	assert(len>0);
 2149|  2.62k|	mlen=len;
 2150|  2.62k|	mmem=mem;
 2151|  2.62k|	do
 2152|  4.78k|	{
 2153|  4.78k|		if (sp->in_buffer_togo==0)
  ------------------
  |  Branch (2153:7): [True: 2.20k, False: 2.58k]
  ------------------
 2154|  2.20k|		{
 2155|  2.20k|			if (OJPEGReadBufferFill(sp)==0)
  ------------------
  |  Branch (2155:8): [True: 22, False: 2.17k]
  ------------------
 2156|     22|				return(0);
 2157|  2.17k|			assert(sp->in_buffer_togo>0);
 2158|  2.17k|		}
 2159|  4.76k|		n=mlen;
 2160|  4.76k|		if (n>sp->in_buffer_togo)
  ------------------
  |  Branch (2160:7): [True: 2.16k, False: 2.60k]
  ------------------
 2161|  2.16k|			n=sp->in_buffer_togo;
 2162|  4.76k|		_TIFFmemcpy(mmem,sp->in_buffer_cur,n);
 2163|  4.76k|		sp->in_buffer_cur+=n;
 2164|  4.76k|		sp->in_buffer_togo-=n;
 2165|  4.76k|		mlen-=n;
 2166|  4.76k|		mmem+=n;
 2167|  4.76k|	} while(mlen>0);
  ------------------
  |  Branch (2167:10): [True: 2.16k, False: 2.60k]
  ------------------
 2168|  2.60k|	return(1);
 2169|  2.62k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDht:
 1536|  4.15k|{
 1537|       |	/* this is a table marker, and it is to be saved as a whole for exact pushing on the jpeg stream later on */
 1538|       |	/* TODO: the following assumes there is only one table in this marker... but i'm not quite sure that assumption is guaranteed correct */
 1539|  4.15k|	static const char module[]="OJPEGReadHeaderInfoSecStreamDht";
 1540|  4.15k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1541|  4.15k|	uint16_t m;
 1542|  4.15k|	uint32_t na;
 1543|  4.15k|	uint8_t* nb;
 1544|  4.15k|	uint8_t o;
 1545|  4.15k|	if (OJPEGReadWord(sp,&m)==0)
  ------------------
  |  Branch (1545:6): [True: 4, False: 4.15k]
  ------------------
 1546|      4|		return(0);
 1547|  4.15k|	if (m<=2)
  ------------------
  |  Branch (1547:6): [True: 3, False: 4.15k]
  ------------------
 1548|      3|	{
 1549|      3|		if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1549:7): [True: 1, False: 2]
  ------------------
 1550|      1|			TIFFErrorExtR(tif,module,"Corrupt DHT marker in JPEG data");
 1551|      3|		return(0);
 1552|      3|	}
 1553|  4.15k|	if (sp->subsamplingcorrect!=0)
  ------------------
  |  Branch (1553:6): [True: 2.44k, False: 1.70k]
  ------------------
 1554|  2.44k|	{
 1555|  2.44k|		OJPEGReadSkip(sp,m-2);
 1556|  2.44k|	}
 1557|  1.70k|	else
 1558|  1.70k|	{
 1559|  1.70k|		na= sizeof(uint32_t) + 2 + m;
 1560|  1.70k|		nb=_TIFFmalloc(na);
 1561|  1.70k|		if (nb==0)
  ------------------
  |  Branch (1561:7): [True: 0, False: 1.70k]
  ------------------
 1562|      0|		{
 1563|      0|			TIFFErrorExtR(tif,module,"Out of memory");
 1564|      0|			return(0);
 1565|      0|		}
 1566|  1.70k|		*(uint32_t*)nb=na;
 1567|  1.70k|		nb[sizeof(uint32_t)]=255;
 1568|  1.70k|		nb[sizeof(uint32_t) + 1]=JPEG_MARKER_DHT;
  ------------------
  |  |  159|  1.70k|#define JPEG_MARKER_DHT 0xC4
  ------------------
 1569|  1.70k|		nb[sizeof(uint32_t) + 2]=(m >> 8);
 1570|  1.70k|		nb[sizeof(uint32_t) + 3]=(m & 255);
 1571|  1.70k|		if (OJPEGReadBlock(sp,m-2,&nb[sizeof(uint32_t) + 4]) == 0) {
  ------------------
  |  Branch (1571:7): [True: 15, False: 1.69k]
  ------------------
 1572|     15|                        _TIFFfree(nb);
 1573|     15|			return(0);
 1574|     15|                }
 1575|  1.69k|		o=nb[sizeof(uint32_t) + 4];
 1576|  1.69k|		if ((o&240)==0)
  ------------------
  |  Branch (1576:7): [True: 724, False: 970]
  ------------------
 1577|    724|		{
 1578|    724|			if (3<o)
  ------------------
  |  Branch (1578:8): [True: 6, False: 718]
  ------------------
 1579|      6|			{
 1580|      6|				TIFFErrorExtR(tif,module,"Corrupt DHT marker in JPEG data");
 1581|      6|                                _TIFFfree(nb);
 1582|      6|				return(0);
 1583|      6|			}
 1584|    718|			if (sp->dctable[o]!=0)
  ------------------
  |  Branch (1584:8): [True: 666, False: 52]
  ------------------
 1585|    666|				_TIFFfree(sp->dctable[o]);
 1586|    718|			sp->dctable[o]=nb;
 1587|    718|		}
 1588|    970|		else
 1589|    970|		{
 1590|    970|			if ((o&240)!=16)
  ------------------
  |  Branch (1590:8): [True: 14, False: 956]
  ------------------
 1591|     14|			{
 1592|     14|				TIFFErrorExtR(tif,module,"Corrupt DHT marker in JPEG data");
 1593|     14|                                _TIFFfree(nb);
 1594|     14|				return(0);
 1595|     14|			}
 1596|    956|			o&=15;
 1597|    956|			if (3<o)
  ------------------
  |  Branch (1597:8): [True: 2, False: 954]
  ------------------
 1598|      2|			{
 1599|      2|				TIFFErrorExtR(tif,module,"Corrupt DHT marker in JPEG data");
 1600|      2|                                _TIFFfree(nb);
 1601|      2|				return(0);
 1602|      2|			}
 1603|    954|			if (sp->actable[o]!=0)
  ------------------
  |  Branch (1603:8): [True: 890, False: 64]
  ------------------
 1604|    890|				_TIFFfree(sp->actable[o]);
 1605|    954|			sp->actable[o]=nb;
 1606|    954|		}
 1607|  1.69k|	}
 1608|  4.11k|	return(1);
 1609|  4.15k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamSof:
 1613|    277|{
 1614|       |	/* this marker needs to be checked, and part of its data needs to be saved for regeneration later on */
 1615|    277|	static const char module[]="OJPEGReadHeaderInfoSecStreamSof";
 1616|    277|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1617|    277|	uint16_t m;
 1618|    277|	uint16_t n;
 1619|    277|	uint8_t o;
 1620|    277|	uint16_t p;
 1621|    277|	uint16_t q;
 1622|    277|	if (sp->sof_log!=0)
  ------------------
  |  Branch (1622:6): [True: 2, False: 275]
  ------------------
 1623|      2|	{
 1624|      2|		TIFFErrorExtR(tif,module,"Corrupt JPEG data");
 1625|      2|		return(0);
 1626|      2|	}
 1627|    275|	if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1627:6): [True: 104, False: 171]
  ------------------
 1628|    104|		sp->sof_marker_id=marker_id;
 1629|       |	/* Lf: data length */
 1630|    275|	if (OJPEGReadWord(sp,&m)==0)
  ------------------
  |  Branch (1630:6): [True: 6, False: 269]
  ------------------
 1631|      6|		return(0);
 1632|    269|	if (m<11)
  ------------------
  |  Branch (1632:6): [True: 5, False: 264]
  ------------------
 1633|      5|	{
 1634|      5|		if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1634:7): [True: 1, False: 4]
  ------------------
 1635|      1|			TIFFErrorExtR(tif,module,"Corrupt SOF marker in JPEG data");
 1636|      5|		return(0);
 1637|      5|	}
 1638|    264|	m-=8;
 1639|    264|	if (m%3!=0)
  ------------------
  |  Branch (1639:6): [True: 6, False: 258]
  ------------------
 1640|      6|	{
 1641|      6|		if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1641:7): [True: 1, False: 5]
  ------------------
 1642|      1|			TIFFErrorExtR(tif,module,"Corrupt SOF marker in JPEG data");
 1643|      6|		return(0);
 1644|      6|	}
 1645|    258|	n=m/3;
 1646|    258|	if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1646:6): [True: 100, False: 158]
  ------------------
 1647|    100|	{
 1648|    100|		if (n!=sp->samples_per_pixel)
  ------------------
  |  Branch (1648:7): [True: 16, False: 84]
  ------------------
 1649|     16|		{
 1650|     16|			TIFFErrorExtR(tif,module,"JPEG compressed data indicates unexpected number of samples");
 1651|     16|			return(0);
 1652|     16|		}
 1653|    100|	}
 1654|       |	/* P: Sample precision */
 1655|    242|	if (OJPEGReadByte(sp,&o)==0)
  ------------------
  |  Branch (1655:6): [True: 3, False: 239]
  ------------------
 1656|      3|		return(0);
 1657|    239|	if (o!=8)
  ------------------
  |  Branch (1657:6): [True: 15, False: 224]
  ------------------
 1658|     15|	{
 1659|     15|		if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1659:7): [True: 2, False: 13]
  ------------------
 1660|      2|			TIFFErrorExtR(tif,module,"JPEG compressed data indicates unexpected number of bits per sample");
 1661|     15|		return(0);
 1662|     15|	}
 1663|       |	/* Y: Number of lines, X: Number of samples per line */
 1664|    224|	if (sp->subsamplingcorrect)
  ------------------
  |  Branch (1664:6): [True: 143, False: 81]
  ------------------
 1665|    143|		OJPEGReadSkip(sp,4);
 1666|     81|	else
 1667|     81|	{
 1668|       |		/* Y: Number of lines */
 1669|     81|		if (OJPEGReadWord(sp,&p)==0)
  ------------------
  |  Branch (1669:7): [True: 1, False: 80]
  ------------------
 1670|      1|			return(0);
 1671|     80|		if (((uint32_t)p < sp->image_length) && ((uint32_t)p < sp->strile_length_total))
  ------------------
  |  Branch (1671:7): [True: 5, False: 75]
  |  Branch (1671:43): [True: 5, False: 0]
  ------------------
 1672|      5|		{
 1673|      5|			TIFFErrorExtR(tif,module,"JPEG compressed data indicates unexpected height");
 1674|      5|			return(0);
 1675|      5|		}
 1676|     75|		sp->sof_y=p;
 1677|       |		/* X: Number of samples per line */
 1678|     75|		if (OJPEGReadWord(sp,&p)==0)
  ------------------
  |  Branch (1678:7): [True: 5, False: 70]
  ------------------
 1679|      5|			return(0);
 1680|     70|		if (((uint32_t)p < sp->image_width) && ((uint32_t)p < sp->strile_width))
  ------------------
  |  Branch (1680:7): [True: 15, False: 55]
  |  Branch (1680:42): [True: 10, False: 5]
  ------------------
 1681|     10|		{
 1682|     10|			TIFFErrorExtR(tif,module,"JPEG compressed data indicates unexpected width");
 1683|     10|			return(0);
 1684|     10|		}
 1685|     60|		if ((uint32_t)p > sp->strile_width)
  ------------------
  |  Branch (1685:7): [True: 2, False: 58]
  ------------------
 1686|      2|		{
 1687|      2|			TIFFErrorExtR(tif,module,"JPEG compressed data image width exceeds expected image width");
 1688|      2|			return(0);
 1689|      2|		}
 1690|     58|		sp->sof_x=p;
 1691|     58|	}
 1692|       |	/* Nf: Number of image components in frame */
 1693|    201|	if (OJPEGReadByte(sp,&o)==0)
  ------------------
  |  Branch (1693:6): [True: 8, False: 193]
  ------------------
 1694|      8|		return(0);
 1695|    193|	if (o!=n)
  ------------------
  |  Branch (1695:6): [True: 30, False: 163]
  ------------------
 1696|     30|	{
 1697|     30|		if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1697:7): [True: 2, False: 28]
  ------------------
 1698|      2|			TIFFErrorExtR(tif,module,"Corrupt SOF marker in JPEG data");
 1699|     30|		return(0);
 1700|     30|	}
 1701|       |	/* per component stuff */
 1702|       |	/* TODO: double-check that flow implies that n cannot be as big as to make us overflow sof_c, sof_hv and sof_tq arrays */
 1703|  1.64k|	for (q=0; q<n; q++)
  ------------------
  |  Branch (1703:12): [True: 1.54k, False: 107]
  ------------------
 1704|  1.54k|	{
 1705|       |		/* C: Component identifier */
 1706|  1.54k|		if (OJPEGReadByte(sp,&o)==0)
  ------------------
  |  Branch (1706:7): [True: 17, False: 1.52k]
  ------------------
 1707|     17|			return(0);
 1708|  1.52k|		if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1708:7): [True: 149, False: 1.37k]
  ------------------
 1709|    149|			sp->sof_c[q]=o;
 1710|       |		/* H: Horizontal sampling factor, and V: Vertical sampling factor */
 1711|  1.52k|		if (OJPEGReadByte(sp,&o)==0)
  ------------------
  |  Branch (1711:7): [True: 18, False: 1.50k]
  ------------------
 1712|     18|			return(0);
 1713|  1.50k|		if (sp->subsamplingcorrect!=0)
  ------------------
  |  Branch (1713:7): [True: 1.36k, False: 145]
  ------------------
 1714|  1.36k|		{
 1715|  1.36k|			if (q==0)
  ------------------
  |  Branch (1715:8): [True: 105, False: 1.25k]
  ------------------
 1716|    105|			{
 1717|    105|				sp->subsampling_hor=(o>>4);
 1718|    105|				sp->subsampling_ver=(o&15);
 1719|    105|				if (((sp->subsampling_hor!=1) && (sp->subsampling_hor!=2) && (sp->subsampling_hor!=4)) ||
  ------------------
  |  Branch (1719:10): [True: 77, False: 28]
  |  Branch (1719:38): [True: 61, False: 16]
  |  Branch (1719:66): [True: 48, False: 13]
  ------------------
 1720|    105|					((sp->subsampling_ver!=1) && (sp->subsampling_ver!=2) && (sp->subsampling_ver!=4)))
  ------------------
  |  Branch (1720:7): [True: 46, False: 11]
  |  Branch (1720:35): [True: 25, False: 21]
  |  Branch (1720:63): [True: 20, False: 5]
  ------------------
 1721|     68|					sp->subsampling_force_desubsampling_inside_decompression=1;
 1722|    105|			}
 1723|  1.25k|			else
 1724|  1.25k|			{
 1725|  1.25k|				if (o!=17)
  ------------------
  |  Branch (1725:9): [True: 1.13k, False: 119]
  ------------------
 1726|  1.13k|					sp->subsampling_force_desubsampling_inside_decompression=1;
 1727|  1.25k|			}
 1728|  1.36k|		}
 1729|    145|		else
 1730|    145|		{
 1731|    145|			sp->sof_hv[q]=o;
 1732|    145|			if (sp->subsampling_force_desubsampling_inside_decompression==0)
  ------------------
  |  Branch (1732:8): [True: 17, False: 128]
  ------------------
 1733|     17|			{
 1734|     17|				if (q==0)
  ------------------
  |  Branch (1734:9): [True: 10, False: 7]
  ------------------
 1735|     10|				{
 1736|     10|					if (o!=((sp->subsampling_hor<<4)|sp->subsampling_ver))
  ------------------
  |  Branch (1736:10): [True: 3, False: 7]
  ------------------
 1737|      3|					{
 1738|      3|						TIFFErrorExtR(tif,module,"JPEG compressed data indicates unexpected subsampling values");
 1739|      3|						return(0);
 1740|      3|					}
 1741|     10|				}
 1742|      7|				else
 1743|      7|				{
 1744|      7|					if (o!=17)
  ------------------
  |  Branch (1744:10): [True: 2, False: 5]
  ------------------
 1745|      2|					{
 1746|      2|						TIFFErrorExtR(tif,module,"JPEG compressed data indicates unexpected subsampling values");
 1747|      2|						return(0);
 1748|      2|					}
 1749|      7|				}
 1750|     17|			}
 1751|    145|		}
 1752|       |		/* Tq: Quantization table destination selector */
 1753|  1.50k|		if (OJPEGReadByte(sp,&o)==0)
  ------------------
  |  Branch (1753:7): [True: 16, False: 1.48k]
  ------------------
 1754|     16|			return(0);
 1755|  1.48k|		if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1755:7): [True: 138, False: 1.34k]
  ------------------
 1756|    138|			sp->sof_tq[q]=o;
 1757|  1.48k|	}
 1758|    107|	if (sp->subsamplingcorrect==0)
  ------------------
  |  Branch (1758:6): [True: 43, False: 64]
  ------------------
 1759|     43|		sp->sof_log=1;
 1760|    107|	return(1);
 1761|    163|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamSos:
 1765|  6.74k|{
 1766|       |	/* this marker needs to be checked, and part of its data needs to be saved for regeneration later on */
 1767|  6.74k|	static const char module[]="OJPEGReadHeaderInfoSecStreamSos";
 1768|  6.74k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1769|  6.74k|	uint16_t m;
 1770|  6.74k|	uint8_t n;
 1771|  6.74k|	uint8_t o;
 1772|  6.74k|	assert(sp->subsamplingcorrect==0);
 1773|  6.74k|	if (sp->sof_log==0)
  ------------------
  |  Branch (1773:6): [True: 3, False: 6.74k]
  ------------------
 1774|      3|	{
 1775|      3|		TIFFErrorExtR(tif,module,"Corrupt SOS marker in JPEG data");
 1776|      3|		return(0);
 1777|      3|	}
 1778|       |	/* Ls */
 1779|  6.74k|	if (OJPEGReadWord(sp,&m)==0)
  ------------------
  |  Branch (1779:6): [True: 512, False: 6.23k]
  ------------------
 1780|    512|		return(0);
 1781|  6.23k|	if (m!=6+sp->samples_per_pixel_per_plane*2)
  ------------------
  |  Branch (1781:6): [True: 2.14k, False: 4.08k]
  ------------------
 1782|  2.14k|	{
 1783|  2.14k|		TIFFErrorExtR(tif,module,"Corrupt SOS marker in JPEG data");
 1784|  2.14k|		return(0);
 1785|  2.14k|	}
 1786|       |	/* Ns */
 1787|  4.08k|	if (OJPEGReadByte(sp,&n)==0)
  ------------------
  |  Branch (1787:6): [True: 218, False: 3.86k]
  ------------------
 1788|    218|		return(0);
 1789|  3.86k|	if (n!=sp->samples_per_pixel_per_plane)
  ------------------
  |  Branch (1789:6): [True: 1.30k, False: 2.56k]
  ------------------
 1790|  1.30k|	{
 1791|  1.30k|		TIFFErrorExtR(tif,module,"Corrupt SOS marker in JPEG data");
 1792|  1.30k|		return(0);
 1793|  1.30k|	}
 1794|       |	/* Cs, Td, and Ta */
 1795|  3.00k|	for (o=0; o<sp->samples_per_pixel_per_plane; o++)
  ------------------
  |  Branch (1795:12): [True: 2.57k, False: 434]
  ------------------
 1796|  2.57k|	{
 1797|       |		/* Cs */
 1798|  2.57k|		if (OJPEGReadByte(sp,&n)==0)
  ------------------
  |  Branch (1798:7): [True: 341, False: 2.23k]
  ------------------
 1799|    341|			return(0);
 1800|  2.23k|		sp->sos_cs[sp->plane_sample_offset+o]=n;
 1801|       |		/* Td and Ta */
 1802|  2.23k|		if (OJPEGReadByte(sp,&n)==0)
  ------------------
  |  Branch (1802:7): [True: 1.79k, False: 439]
  ------------------
 1803|  1.79k|			return(0);
 1804|    439|		sp->sos_tda[sp->plane_sample_offset+o]=n;
 1805|    439|	}
 1806|       |	/* skip Ss, Se, Ah, en Al -> no check, as per Tom Lane recommendation, as per LibJpeg source */
 1807|    434|	OJPEGReadSkip(sp,3);
 1808|    434|	return(1);
 1809|  2.56k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesQTable:
 1813|  1.51k|{
 1814|  1.51k|	static const char module[]="OJPEGReadHeaderInfoSecTablesQTable";
 1815|  1.51k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1816|  1.51k|	uint8_t m;
 1817|  1.51k|	uint8_t n;
 1818|  1.51k|	uint32_t oa;
 1819|  1.51k|	uint8_t* ob;
 1820|  1.51k|	uint32_t p;
 1821|  1.51k|	if (sp->qtable_offset[0]==0)
  ------------------
  |  Branch (1821:6): [True: 95, False: 1.41k]
  ------------------
 1822|     95|	{
 1823|     95|		TIFFErrorExtR(tif,module,"Missing JPEG tables");
 1824|     95|		return(0);
 1825|     95|	}
 1826|  1.41k|	sp->in_buffer_file_pos_log=0;
 1827|  5.14k|	for (m=0; m<sp->samples_per_pixel; m++)
  ------------------
  |  Branch (1827:12): [True: 3.95k, False: 1.18k]
  ------------------
 1828|  3.95k|	{
 1829|  3.95k|		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))
  ------------------
  |  Branch (1829:7): [True: 2.20k, False: 1.74k]
  |  Branch (1829:37): [True: 1.41k, False: 788]
  |  Branch (1829:47): [True: 776, False: 12]
  ------------------
 1830|  2.19k|		{
 1831|  2.43k|			for (n=0; n<m-1; n++)
  ------------------
  |  Branch (1831:14): [True: 239, False: 2.19k]
  ------------------
 1832|    239|			{
 1833|    239|				if (sp->qtable_offset[m]==sp->qtable_offset[n])
  ------------------
  |  Branch (1833:9): [True: 1, False: 238]
  ------------------
 1834|      1|				{
 1835|      1|					TIFFErrorExtR(tif,module,"Corrupt JpegQTables tag value");
 1836|      1|					return(0);
 1837|      1|				}
 1838|    239|			}
 1839|  2.19k|			oa= sizeof(uint32_t) + 69;
 1840|  2.19k|			ob=_TIFFmalloc(oa);
 1841|  2.19k|			if (ob==0)
  ------------------
  |  Branch (1841:8): [True: 0, False: 2.19k]
  ------------------
 1842|      0|			{
 1843|      0|				TIFFErrorExtR(tif,module,"Out of memory");
 1844|      0|				return(0);
 1845|      0|			}
 1846|  2.19k|			*(uint32_t*)ob=oa;
 1847|  2.19k|			ob[sizeof(uint32_t)]=255;
 1848|  2.19k|			ob[sizeof(uint32_t) + 1]=JPEG_MARKER_DQT;
  ------------------
  |  |  164|  2.19k|#define JPEG_MARKER_DQT 0xDB
  ------------------
 1849|  2.19k|			ob[sizeof(uint32_t) + 2]=0;
 1850|  2.19k|			ob[sizeof(uint32_t) + 3]=67;
 1851|  2.19k|			ob[sizeof(uint32_t) + 4]=m;
 1852|  2.19k|			TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET); 
  ------------------
  |  |  216|  2.19k|	((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))
  ------------------
 1853|  2.19k|			p=(uint32_t)TIFFReadFile(tif, &ob[sizeof(uint32_t) + 5], 64);
  ------------------
  |  |  212|  2.19k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  ------------------
 1854|  2.19k|			if (p!=64)
  ------------------
  |  Branch (1854:8): [True: 227, False: 1.96k]
  ------------------
 1855|    227|                        {
 1856|    227|                                _TIFFfree(ob);
 1857|    227|				return(0);
 1858|    227|                        }
 1859|  1.96k|			if (sp->qtable[m]!=0)
  ------------------
  |  Branch (1859:8): [True: 2, False: 1.96k]
  ------------------
 1860|      2|				_TIFFfree(sp->qtable[m]);
 1861|  1.96k|			sp->qtable[m]=ob;
 1862|  1.96k|			sp->sof_tq[m]=m;
 1863|  1.96k|		}
 1864|  1.76k|		else
 1865|  1.76k|			sp->sof_tq[m]=sp->sof_tq[m-1];
 1866|  3.95k|	}
 1867|  1.18k|	return(1);
 1868|  1.41k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesDcTable:
 1872|  1.18k|{
 1873|  1.18k|	static const char module[]="OJPEGReadHeaderInfoSecTablesDcTable";
 1874|  1.18k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1875|  1.18k|	uint8_t m;
 1876|  1.18k|	uint8_t n;
 1877|  1.18k|	uint8_t o[16];
 1878|  1.18k|	uint32_t p;
 1879|  1.18k|	uint32_t q;
 1880|  1.18k|	uint32_t ra;
 1881|  1.18k|	uint8_t* rb;
 1882|  1.18k|	if (sp->dctable_offset[0]==0)
  ------------------
  |  Branch (1882:6): [True: 4, False: 1.18k]
  ------------------
 1883|      4|	{
 1884|      4|		TIFFErrorExtR(tif,module,"Missing JPEG tables");
 1885|      4|		return(0);
 1886|      4|	}
 1887|  1.18k|	sp->in_buffer_file_pos_log=0;
 1888|  4.30k|	for (m=0; m<sp->samples_per_pixel; m++)
  ------------------
  |  Branch (1888:12): [True: 3.31k, False: 990]
  ------------------
 1889|  3.31k|	{
 1890|  3.31k|		if ((sp->dctable_offset[m]!=0) && ((m==0) || (sp->dctable_offset[m]!=sp->dctable_offset[m-1])))
  ------------------
  |  Branch (1890:7): [True: 2.10k, False: 1.21k]
  |  Branch (1890:38): [True: 1.18k, False: 921]
  |  Branch (1890:48): [True: 901, False: 20]
  ------------------
 1891|  2.08k|		{
 1892|  2.46k|			for (n=0; n<m-1; n++)
  ------------------
  |  Branch (1892:14): [True: 383, False: 2.08k]
  ------------------
 1893|    383|			{
 1894|    383|				if (sp->dctable_offset[m]==sp->dctable_offset[n])
  ------------------
  |  Branch (1894:9): [True: 1, False: 382]
  ------------------
 1895|      1|				{
 1896|      1|					TIFFErrorExtR(tif,module,"Corrupt JpegDcTables tag value");
 1897|      1|					return(0);
 1898|      1|				}
 1899|    383|			}
 1900|  2.08k|			TIFFSeekFile(tif,sp->dctable_offset[m],SEEK_SET);
  ------------------
  |  |  216|  2.08k|	((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))
  ------------------
 1901|  2.08k|			p=(uint32_t)TIFFReadFile(tif, o, 16);
  ------------------
  |  |  212|  2.08k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  ------------------
 1902|  2.08k|			if (p!=16)
  ------------------
  |  Branch (1902:8): [True: 188, False: 1.89k]
  ------------------
 1903|    188|				return(0);
 1904|  1.89k|			q=0;
 1905|  32.2k|			for (n=0; n<16; n++)
  ------------------
  |  Branch (1905:14): [True: 30.3k, False: 1.89k]
  ------------------
 1906|  30.3k|				q+=o[n];
 1907|  1.89k|			ra= sizeof(uint32_t) + 21 + q;
 1908|  1.89k|			rb=_TIFFmalloc(ra);
 1909|  1.89k|			if (rb==0)
  ------------------
  |  Branch (1909:8): [True: 0, False: 1.89k]
  ------------------
 1910|      0|			{
 1911|      0|				TIFFErrorExtR(tif,module,"Out of memory");
 1912|      0|				return(0);
 1913|      0|			}
 1914|  1.89k|			*(uint32_t*)rb=ra;
 1915|  1.89k|			rb[sizeof(uint32_t)]=255;
 1916|  1.89k|			rb[sizeof(uint32_t) + 1]=JPEG_MARKER_DHT;
  ------------------
  |  |  159|  1.89k|#define JPEG_MARKER_DHT 0xC4
  ------------------
 1917|  1.89k|			rb[sizeof(uint32_t) + 2]=(uint8_t)((19 + q) >> 8);
 1918|  1.89k|			rb[sizeof(uint32_t) + 3]=((19 + q) & 255);
 1919|  1.89k|			rb[sizeof(uint32_t) + 4]=m;
 1920|  32.2k|			for (n=0; n<16; n++)
  ------------------
  |  Branch (1920:14): [True: 30.3k, False: 1.89k]
  ------------------
 1921|  30.3k|				rb[sizeof(uint32_t) + 5 + n]=o[n];
 1922|  1.89k|			p=(uint32_t)TIFFReadFile(tif, &(rb[sizeof(uint32_t) + 21]), q);
  ------------------
  |  |  212|  1.89k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  ------------------
 1923|  1.89k|			if (p!=q)
  ------------------
  |  Branch (1923:8): [True: 5, False: 1.89k]
  ------------------
 1924|      5|                        {
 1925|      5|                                _TIFFfree(rb);
 1926|      5|				return(0);
 1927|      5|                        }
 1928|  1.89k|			if (sp->dctable[m]!=0)
  ------------------
  |  Branch (1928:8): [True: 3, False: 1.88k]
  ------------------
 1929|      3|				_TIFFfree(sp->dctable[m]);
 1930|  1.89k|			sp->dctable[m]=rb;
 1931|  1.89k|			sp->sos_tda[m]=(m<<4);
 1932|  1.89k|		}
 1933|  1.23k|		else
 1934|  1.23k|			sp->sos_tda[m]=sp->sos_tda[m-1];
 1935|  3.31k|	}
 1936|    990|	return(1);
 1937|  1.18k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesAcTable:
 1941|    990|{
 1942|    990|	static const char module[]="OJPEGReadHeaderInfoSecTablesAcTable";
 1943|    990|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1944|    990|	uint8_t m;
 1945|    990|	uint8_t n;
 1946|    990|	uint8_t o[16];
 1947|    990|	uint32_t p;
 1948|    990|	uint32_t q;
 1949|    990|	uint32_t ra;
 1950|    990|	uint8_t* rb;
 1951|    990|	if (sp->actable_offset[0]==0)
  ------------------
  |  Branch (1951:6): [True: 6, False: 984]
  ------------------
 1952|      6|	{
 1953|      6|		TIFFErrorExtR(tif,module,"Missing JPEG tables");
 1954|      6|		return(0);
 1955|      6|	}
 1956|    984|	sp->in_buffer_file_pos_log=0;
 1957|  3.48k|	for (m=0; m<sp->samples_per_pixel; m++)
  ------------------
  |  Branch (1957:12): [True: 2.69k, False: 795]
  ------------------
 1958|  2.69k|	{
 1959|  2.69k|		if ((sp->actable_offset[m]!=0) && ((m==0) || (sp->actable_offset[m]!=sp->actable_offset[m-1])))
  ------------------
  |  Branch (1959:7): [True: 2.32k, False: 365]
  |  Branch (1959:38): [True: 984, False: 1.34k]
  |  Branch (1959:48): [True: 1.24k, False: 100]
  ------------------
 1960|  2.22k|		{
 1961|  2.89k|			for (n=0; n<m-1; n++)
  ------------------
  |  Branch (1961:14): [True: 670, False: 2.22k]
  ------------------
 1962|    670|			{
 1963|    670|				if (sp->actable_offset[m]==sp->actable_offset[n])
  ------------------
  |  Branch (1963:9): [True: 1, False: 669]
  ------------------
 1964|      1|				{
 1965|      1|					TIFFErrorExtR(tif,module,"Corrupt JpegAcTables tag value");
 1966|      1|					return(0);
 1967|      1|				}
 1968|    670|			}
 1969|  2.22k|			TIFFSeekFile(tif,sp->actable_offset[m],SEEK_SET);  
  ------------------
  |  |  216|  2.22k|	((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))
  ------------------
 1970|  2.22k|			p=(uint32_t)TIFFReadFile(tif, o, 16);
  ------------------
  |  |  212|  2.22k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  ------------------
 1971|  2.22k|			if (p!=16)
  ------------------
  |  Branch (1971:8): [True: 173, False: 2.05k]
  ------------------
 1972|    173|				return(0);
 1973|  2.05k|			q=0;
 1974|  34.9k|			for (n=0; n<16; n++)
  ------------------
  |  Branch (1974:14): [True: 32.8k, False: 2.05k]
  ------------------
 1975|  32.8k|				q+=o[n];
 1976|  2.05k|			ra= sizeof(uint32_t) + 21 + q;
 1977|  2.05k|			rb=_TIFFmalloc(ra);
 1978|  2.05k|			if (rb==0)
  ------------------
  |  Branch (1978:8): [True: 0, False: 2.05k]
  ------------------
 1979|      0|			{
 1980|      0|				TIFFErrorExtR(tif,module,"Out of memory");
 1981|      0|				return(0);
 1982|      0|			}
 1983|  2.05k|			*(uint32_t*)rb=ra;
 1984|  2.05k|			rb[sizeof(uint32_t)]=255;
 1985|  2.05k|			rb[sizeof(uint32_t) + 1]=JPEG_MARKER_DHT;
  ------------------
  |  |  159|  2.05k|#define JPEG_MARKER_DHT 0xC4
  ------------------
 1986|  2.05k|			rb[sizeof(uint32_t) + 2]=(uint8_t)((19 + q) >> 8);
 1987|  2.05k|			rb[sizeof(uint32_t) + 3]=((19 + q) & 255);
 1988|  2.05k|			rb[sizeof(uint32_t) + 4]=(16 | m);
 1989|  34.9k|			for (n=0; n<16; n++)
  ------------------
  |  Branch (1989:14): [True: 32.8k, False: 2.05k]
  ------------------
 1990|  32.8k|				rb[sizeof(uint32_t) + 5 + n]=o[n];
 1991|  2.05k|			p=(uint32_t)TIFFReadFile(tif, &(rb[sizeof(uint32_t) + 21]), q);
  ------------------
  |  |  212|  2.05k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  ------------------
 1992|  2.05k|			if (p!=q)
  ------------------
  |  Branch (1992:8): [True: 15, False: 2.04k]
  ------------------
 1993|     15|                        {
 1994|     15|                                _TIFFfree(rb);
 1995|     15|				return(0);
 1996|     15|                        }
 1997|  2.04k|			if (sp->actable[m]!=0)
  ------------------
  |  Branch (1997:8): [True: 6, False: 2.03k]
  ------------------
 1998|      6|				_TIFFfree(sp->actable[m]);
 1999|  2.04k|			sp->actable[m]=rb;
 2000|  2.04k|			sp->sos_tda[m]=(sp->sos_tda[m]|m);
 2001|  2.04k|		}
 2002|    465|		else
 2003|    465|			sp->sos_tda[m]=(sp->sos_tda[m]|(sp->sos_tda[m-1]&15));
 2004|  2.69k|	}
 2005|    795|	return(1);
 2006|    984|}
tif_ojpeg.c:OJPEGVSetField:
  526|  27.0k|{
  527|  27.0k|	static const char module[]="OJPEGVSetField";
  528|  27.0k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
  529|  27.0k|	uint32_t ma;
  530|  27.0k|	uint64_t* mb;
  531|  27.0k|	uint32_t n;
  532|  27.0k|	const TIFFField* fip;
  533|       |
  534|  27.0k|	switch(tag)
  535|  27.0k|	{
  536|    649|		case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  377|    649|#define	TIFFTAG_JPEGIFOFFSET		513	/* !pointer to SOI marker */
  ------------------
  |  Branch (536:3): [True: 649, False: 26.3k]
  ------------------
  537|    649|			sp->jpeg_interchange_format=(uint64_t)va_arg(ap, uint64_t);
  538|    649|			break;
  539|    213|		case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  378|    213|#define	TIFFTAG_JPEGIFBYTECOUNT		514	/* !JFIF stream length */
  ------------------
  |  Branch (539:3): [True: 213, False: 26.8k]
  ------------------
  540|    213|			sp->jpeg_interchange_format_length=(uint64_t)va_arg(ap, uint64_t);
  541|    213|			break;
  542|    682|		case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  386|    682|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
  |  Branch (542:3): [True: 682, False: 26.3k]
  ------------------
  543|    682|			sp->subsampling_tag=1;
  544|    682|			sp->subsampling_hor=(uint8_t)va_arg(ap, uint16_vap);
  545|    682|			sp->subsampling_ver=(uint8_t)va_arg(ap, uint16_vap);
  546|    682|			tif->tif_dir.td_ycbcrsubsampling[0]=sp->subsampling_hor;
  547|    682|			tif->tif_dir.td_ycbcrsubsampling[1]=sp->subsampling_ver;
  548|    682|			break;
  549|  1.48k|		case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  382|  1.48k|#define	TIFFTAG_JPEGQTABLES		519	/* !Q matrix offsets */
  ------------------
  |  Branch (549:3): [True: 1.48k, False: 25.5k]
  ------------------
  550|  1.48k|			ma=(uint32_t)va_arg(ap, uint32_t);
  551|  1.48k|			if (ma!=0)
  ------------------
  |  Branch (551:8): [True: 1.48k, False: 2]
  ------------------
  552|  1.48k|			{
  553|  1.48k|				if (ma>3)
  ------------------
  |  Branch (553:9): [True: 12, False: 1.47k]
  ------------------
  554|     12|				{
  555|     12|					TIFFErrorExtR(tif,module,"JpegQTables tag has incorrect count");
  556|     12|					return(0);
  557|     12|				}
  558|  1.47k|				sp->qtable_offset_count=(uint8_t)ma;
  559|  1.47k|				mb=(uint64_t*)va_arg(ap, uint64_t*);
  560|  4.12k|				for (n=0; n<ma; n++)
  ------------------
  |  Branch (560:15): [True: 2.65k, False: 1.47k]
  ------------------
  561|  2.65k|					sp->qtable_offset[n]=mb[n];
  562|  1.47k|			}
  563|  1.47k|			break;
  564|  1.47k|		case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  383|  1.25k|#define	TIFFTAG_JPEGDCTABLES		520	/* !DCT table offsets */
  ------------------
  |  Branch (564:3): [True: 1.25k, False: 25.7k]
  ------------------
  565|  1.25k|			ma=(uint32_t)va_arg(ap, uint32_t);
  566|  1.25k|			if (ma!=0)
  ------------------
  |  Branch (566:8): [True: 1.24k, False: 3]
  ------------------
  567|  1.24k|			{
  568|  1.24k|				if (ma>3)
  ------------------
  |  Branch (568:9): [True: 5, False: 1.24k]
  ------------------
  569|      5|				{
  570|      5|					TIFFErrorExtR(tif,module,"JpegDcTables tag has incorrect count");
  571|      5|					return(0);
  572|      5|				}
  573|  1.24k|				sp->dctable_offset_count=(uint8_t)ma;
  574|  1.24k|				mb=(uint64_t*)va_arg(ap, uint64_t*);
  575|  4.33k|				for (n=0; n<ma; n++)
  ------------------
  |  Branch (575:15): [True: 3.08k, False: 1.24k]
  ------------------
  576|  3.08k|					sp->dctable_offset[n]=mb[n];
  577|  1.24k|			}
  578|  1.24k|			break;
  579|  1.24k|		case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  384|  1.03k|#define	TIFFTAG_JPEGACTABLES		521	/* !AC coefficient offsets */
  ------------------
  |  Branch (579:3): [True: 1.03k, False: 25.9k]
  ------------------
  580|  1.03k|			ma=(uint32_t)va_arg(ap, uint32_t);
  581|  1.03k|			if (ma!=0)
  ------------------
  |  Branch (581:8): [True: 1.03k, False: 1]
  ------------------
  582|  1.03k|			{
  583|  1.03k|				if (ma>3)
  ------------------
  |  Branch (583:9): [True: 4, False: 1.02k]
  ------------------
  584|      4|				{
  585|      4|					TIFFErrorExtR(tif,module,"JpegAcTables tag has incorrect count");
  586|      4|					return(0);
  587|      4|				}
  588|  1.02k|				sp->actable_offset_count=(uint8_t)ma;
  589|  1.02k|				mb=(uint64_t*)va_arg(ap, uint64_t*);
  590|  4.10k|				for (n=0; n<ma; n++)
  ------------------
  |  Branch (590:15): [True: 3.07k, False: 1.02k]
  ------------------
  591|  3.07k|					sp->actable_offset[n]=mb[n];
  592|  1.02k|			}
  593|  1.02k|			break;
  594|  1.02k|		case TIFFTAG_JPEGPROC:
  ------------------
  |  |  374|     27|#define	TIFFTAG_JPEGPROC		512	/* !JPEG processing algorithm */
  ------------------
  |  Branch (594:3): [True: 27, False: 27.0k]
  ------------------
  595|     27|			sp->jpeg_proc=(uint8_t)va_arg(ap, uint16_vap);
  596|     27|			break;
  597|      1|		case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  379|      1|#define	TIFFTAG_JPEGRESTARTINTERVAL	515	/* !restart interval length */
  ------------------
  |  Branch (597:3): [True: 1, False: 27.0k]
  ------------------
  598|      1|			sp->restart_interval=(uint16_t)va_arg(ap, uint16_vap);
  599|      1|			break;
  600|  21.6k|		default:
  ------------------
  |  Branch (600:3): [True: 21.6k, False: 5.34k]
  ------------------
  601|  21.6k|			return (*sp->vsetparent)(tif,tag,ap);
  602|  27.0k|	}
  603|  5.31k|	fip = TIFFFieldWithTag(tif,tag);
  604|  5.31k|	if( fip == NULL ) /* shouldn't happen */
  ------------------
  |  Branch (604:6): [True: 0, False: 5.31k]
  ------------------
  605|      0|	    return(0);
  606|  5.31k|	TIFFSetFieldBit(tif,fip->field_bit);
  ------------------
  |  |  199|  5.31k|#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  197|  5.31k|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  196|  5.31k|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  607|  5.31k|	tif->tif_flags|=TIFF_DIRTYDIRECT;
  ------------------
  |  |   94|  5.31k|	#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
  608|  5.31k|	return(1);
  609|  5.31k|}
tif_ojpeg.c:OJPEGFixupTags:
  653|  3.18k|{
  654|  3.18k|	(void) tif;
  655|  3.18k|	return(1);
  656|  3.18k|}
tif_ojpeg.c:OJPEGSetupDecode:
  660|  1.84k|{
  661|  1.84k|	static const char module[]="OJPEGSetupDecode";
  662|  1.84k|	TIFFWarningExtR(tif,module,"Deprecated and troublesome old-style JPEG compression mode, please convert to new-style JPEG compression and notify vendor of writing software");
  663|  1.84k|	return(1);
  664|  1.84k|}
tif_ojpeg.c:OJPEGPreDecode:
  668|  56.1k|{
  669|  56.1k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
  670|  56.1k|	uint32_t m;
  671|  56.1k|	if (sp->subsamplingcorrect_done==0)
  ------------------
  |  Branch (671:6): [True: 59, False: 56.0k]
  ------------------
  672|     59|		OJPEGSubsamplingCorrect(tif);
  673|  56.1k|	if (sp->readheader_done==0)
  ------------------
  |  Branch (673:6): [True: 1.84k, False: 54.2k]
  ------------------
  674|  1.84k|	{
  675|  1.84k|		if (OJPEGReadHeaderInfo(tif)==0)
  ------------------
  |  Branch (675:7): [True: 1.01k, False: 832]
  ------------------
  676|  1.01k|			return(0);
  677|  1.84k|	}
  678|  55.1k|	if (sp->sos_end[s].log==0)
  ------------------
  |  Branch (678:6): [True: 12.8k, False: 42.2k]
  ------------------
  679|  12.8k|	{
  680|  12.8k|		if (OJPEGReadSecondarySos(tif,s)==0)
  ------------------
  |  Branch (680:7): [True: 12.4k, False: 432]
  ------------------
  681|  12.4k|			return(0);
  682|  12.8k|	}
  683|  42.6k|	if (isTiled(tif))
  ------------------
  |  |  207|  42.6k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  42.6k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 42.6k, False: 0]
  |  |  ------------------
  ------------------
  684|  42.6k|		m=tif->tif_curtile;
  685|      0|	else
  686|      0|		m=tif->tif_curstrip;
  687|  42.6k|	if ((sp->writeheader_done!=0) && ((sp->write_cursample!=s) || (sp->write_curstrile>m)))
  ------------------
  |  Branch (687:6): [True: 38.3k, False: 4.34k]
  |  Branch (687:36): [True: 13.2k, False: 25.0k]
  |  Branch (687:64): [True: 0, False: 25.0k]
  ------------------
  688|  13.2k|	{
  689|  13.2k|		if (sp->libjpeg_session_active!=0)
  ------------------
  |  Branch (689:7): [True: 13.2k, False: 0]
  ------------------
  690|  13.2k|			OJPEGLibjpegSessionAbort(tif);
  691|  13.2k|		sp->writeheader_done=0;
  692|  13.2k|	}
  693|  42.6k|	if (sp->writeheader_done==0)
  ------------------
  |  Branch (693:6): [True: 17.5k, False: 25.0k]
  ------------------
  694|  17.5k|	{
  695|  17.5k|		sp->plane_sample_offset=(uint8_t)s;
  696|  17.5k|		sp->write_cursample=s;
  697|  17.5k|		sp->write_curstrile=s*tif->tif_dir.td_stripsperimage;
  698|  17.5k|		if ((sp->in_buffer_file_pos_log==0) ||
  ------------------
  |  Branch (698:7): [True: 8.76k, False: 8.83k]
  ------------------
  699|  17.5k|		    (sp->in_buffer_file_pos-sp->in_buffer_togo!=sp->sos_end[s].in_buffer_file_pos))
  ------------------
  |  Branch (699:7): [True: 7.88k, False: 948]
  ------------------
  700|  16.6k|		{
  701|  16.6k|			sp->in_buffer_source=sp->sos_end[s].in_buffer_source;
  702|  16.6k|			sp->in_buffer_next_strile=sp->sos_end[s].in_buffer_next_strile;
  703|  16.6k|			sp->in_buffer_file_pos=sp->sos_end[s].in_buffer_file_pos;
  704|  16.6k|			sp->in_buffer_file_pos_log=0;
  705|  16.6k|			sp->in_buffer_file_togo=sp->sos_end[s].in_buffer_file_togo;
  706|  16.6k|			sp->in_buffer_togo=0;
  707|  16.6k|			sp->in_buffer_cur=0;
  708|  16.6k|		}
  709|  17.5k|		if (OJPEGWriteHeaderInfo(tif)==0)
  ------------------
  |  Branch (709:7): [True: 3.38k, False: 14.2k]
  ------------------
  710|  3.38k|			return(0);
  711|  17.5k|	}
  712|   264k|	while (sp->write_curstrile<m)          
  ------------------
  |  Branch (712:9): [True: 238k, False: 25.4k]
  ------------------
  713|   238k|	{
  714|   238k|		if (sp->libjpeg_jpeg_query_style==0)
  ------------------
  |  Branch (714:7): [True: 8.56k, False: 230k]
  ------------------
  715|  8.56k|		{
  716|  8.56k|			if (OJPEGPreDecodeSkipRaw(tif)==0)
  ------------------
  |  Branch (716:8): [True: 7.76k, False: 802]
  ------------------
  717|  7.76k|				return(0);
  718|  8.56k|		}
  719|   230k|		else
  720|   230k|		{
  721|   230k|			if (OJPEGPreDecodeSkipScanlines(tif)==0)
  ------------------
  |  Branch (721:8): [True: 6.06k, False: 224k]
  ------------------
  722|  6.06k|				return(0);
  723|   230k|		}
  724|   224k|		sp->write_curstrile++;
  725|   224k|	}
  726|  25.4k|	sp->decoder_ok = 1;
  727|  25.4k|	return(1);
  728|  39.2k|}
tif_ojpeg.c:OJPEGReadHeaderInfo:
 1070|  1.84k|{
 1071|  1.84k|	static const char module[]="OJPEGReadHeaderInfo";
 1072|  1.84k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1073|  1.84k|	assert(sp->readheader_done==0);
 1074|  1.84k|	sp->image_width=tif->tif_dir.td_imagewidth;
 1075|  1.84k|	sp->image_length=tif->tif_dir.td_imagelength;
 1076|  1.84k|	if (isTiled(tif))
  ------------------
  |  |  207|  1.84k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  1.84k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 1.84k, False: 0]
  |  |  ------------------
  ------------------
 1077|  1.84k|	{
 1078|  1.84k|		sp->strile_width=tif->tif_dir.td_tilewidth;
 1079|  1.84k|		sp->strile_length=tif->tif_dir.td_tilelength;
 1080|  1.84k|		sp->strile_length_total=((sp->image_length+sp->strile_length-1)/sp->strile_length)*sp->strile_length;
 1081|  1.84k|	}
 1082|      0|	else
 1083|      0|	{
 1084|      0|		sp->strile_width=sp->image_width;
 1085|      0|		sp->strile_length=tif->tif_dir.td_rowsperstrip;
 1086|      0|                if( sp->strile_length == (uint32_t)-1 )
  ------------------
  |  Branch (1086:21): [True: 0, False: 0]
  ------------------
 1087|      0|                    sp->strile_length = sp->image_length;
 1088|      0|		sp->strile_length_total=sp->image_length;
 1089|      0|	}
 1090|  1.84k|	if (tif->tif_dir.td_samplesperpixel==1)
  ------------------
  |  Branch (1090:6): [True: 38, False: 1.80k]
  ------------------
 1091|     38|	{
 1092|     38|		sp->samples_per_pixel=1;
 1093|     38|		sp->plane_sample_offset=0;
 1094|     38|		sp->samples_per_pixel_per_plane=sp->samples_per_pixel;
 1095|     38|		sp->subsampling_hor=1;
 1096|     38|		sp->subsampling_ver=1;
 1097|     38|	}
 1098|  1.80k|	else
 1099|  1.80k|	{
 1100|  1.80k|		if (tif->tif_dir.td_samplesperpixel!=3)
  ------------------
  |  Branch (1100:7): [True: 2, False: 1.80k]
  ------------------
 1101|      2|		{
 1102|      2|			TIFFErrorExtR(tif,module,"SamplesPerPixel %"PRIu8" not supported for this compression scheme",sp->samples_per_pixel);
 1103|      2|			return(0);
 1104|      2|		}
 1105|  1.80k|		sp->samples_per_pixel=3;
 1106|  1.80k|		sp->plane_sample_offset=0;
 1107|  1.80k|		if (tif->tif_dir.td_planarconfig==PLANARCONFIG_CONTIG)
  ------------------
  |  |  259|  1.80k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (1107:7): [True: 1.19k, False: 614]
  ------------------
 1108|  1.19k|			sp->samples_per_pixel_per_plane=3;
 1109|    614|		else
 1110|    614|			sp->samples_per_pixel_per_plane=1;
 1111|  1.80k|	}
 1112|  1.84k|	if (sp->strile_length<sp->image_length)
  ------------------
  |  Branch (1112:6): [True: 367, False: 1.47k]
  ------------------
 1113|    367|	{
 1114|    367|		if (((sp->subsampling_hor!=1) && (sp->subsampling_hor!=2) && (sp->subsampling_hor!=4)) ||
  ------------------
  |  Branch (1114:8): [True: 218, False: 149]
  |  Branch (1114:36): [True: 3, False: 215]
  |  Branch (1114:64): [True: 1, False: 2]
  ------------------
 1115|    367|		    ((sp->subsampling_ver!=1) && (sp->subsampling_ver!=2) && (sp->subsampling_ver!=4)))
  ------------------
  |  Branch (1115:8): [True: 218, False: 148]
  |  Branch (1115:36): [True: 2, False: 216]
  |  Branch (1115:64): [True: 1, False: 1]
  ------------------
 1116|      2|		{
 1117|      2|			TIFFErrorExtR(tif,module,"Invalid subsampling values");
 1118|      2|			return(0);
 1119|      2|		}
 1120|    365|		if (sp->strile_length%(sp->subsampling_ver*8)!=0)
  ------------------
  |  Branch (1120:7): [True: 43, False: 322]
  ------------------
 1121|     43|		{
 1122|     43|			TIFFErrorExtR(tif,module,"Incompatible vertical subsampling and image strip/tile length");
 1123|     43|			return(0);
 1124|     43|		}
 1125|    322|		sp->restart_interval=(uint16_t)(((sp->strile_width + sp->subsampling_hor * 8 - 1) / (sp->subsampling_hor * 8)) * (sp->strile_length / (sp->subsampling_ver * 8)));
 1126|    322|	}
 1127|  1.79k|	if (OJPEGReadHeaderInfoSec(tif)==0)
  ------------------
  |  Branch (1127:6): [True: 965, False: 832]
  ------------------
 1128|    965|		return(0);
 1129|    832|	sp->sos_end[0].log=1;
 1130|    832|	sp->sos_end[0].in_buffer_source=sp->in_buffer_source;
 1131|    832|	sp->sos_end[0].in_buffer_next_strile=sp->in_buffer_next_strile;
 1132|    832|	sp->sos_end[0].in_buffer_file_pos=sp->in_buffer_file_pos-sp->in_buffer_togo;
 1133|    832|	sp->sos_end[0].in_buffer_file_togo=sp->in_buffer_file_togo+sp->in_buffer_togo; 
 1134|    832|	sp->readheader_done=1;
 1135|    832|	return(1);
 1136|  1.79k|}
tif_ojpeg.c:OJPEGReadSecondarySos:
 1140|  12.8k|{
 1141|  12.8k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1142|  12.8k|	uint8_t m;
 1143|  12.8k|	assert(s>0);
 1144|  12.8k|	assert(s<3);
 1145|  12.8k|	assert(sp->sos_end[0].log!=0);
 1146|  12.8k|	assert(sp->sos_end[s].log==0);
 1147|  12.8k|	sp->plane_sample_offset=(uint8_t)(s - 1);
 1148|  15.5k|	while(sp->sos_end[sp->plane_sample_offset].log==0)
  ------------------
  |  Branch (1148:8): [True: 2.64k, False: 12.8k]
  ------------------
 1149|  2.64k|		sp->plane_sample_offset--;
 1150|  12.8k|	sp->in_buffer_source=sp->sos_end[sp->plane_sample_offset].in_buffer_source;
 1151|  12.8k|	sp->in_buffer_next_strile=sp->sos_end[sp->plane_sample_offset].in_buffer_next_strile;
 1152|  12.8k|	sp->in_buffer_file_pos=sp->sos_end[sp->plane_sample_offset].in_buffer_file_pos;
 1153|  12.8k|	sp->in_buffer_file_pos_log=0;
 1154|  12.8k|	sp->in_buffer_file_togo=sp->sos_end[sp->plane_sample_offset].in_buffer_file_togo;
 1155|  12.8k|	sp->in_buffer_togo=0;
 1156|  12.8k|	sp->in_buffer_cur=0;
 1157|  13.2k|	while(sp->plane_sample_offset<s)
  ------------------
  |  Branch (1157:8): [True: 12.8k, False: 432]
  ------------------
 1158|  12.8k|	{
 1159|  12.8k|		do
 1160|  19.1M|		{
 1161|  19.1M|			if (OJPEGReadByte(sp,&m)==0)
  ------------------
  |  Branch (1161:8): [True: 5.23k, False: 19.1M]
  ------------------
 1162|  5.23k|				return(0);
 1163|  19.1M|			if (m==255)
  ------------------
  |  Branch (1163:8): [True: 526k, False: 18.5M]
  ------------------
 1164|   526k|			{
 1165|   526k|				do
 1166|  1.44M|				{
 1167|  1.44M|					if (OJPEGReadByte(sp,&m)==0)
  ------------------
  |  Branch (1167:10): [True: 883, False: 1.44M]
  ------------------
 1168|    883|						return(0);
 1169|  1.44M|					if (m!=255)
  ------------------
  |  Branch (1169:10): [True: 525k, False: 920k]
  ------------------
 1170|   525k|						break;
 1171|  1.44M|				} while(1);
  ------------------
  |  Branch (1171:13): [Folded - Ignored]
  ------------------
 1172|   525k|				if (m==JPEG_MARKER_SOS)
  ------------------
  |  |  163|   525k|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1172:9): [True: 6.73k, False: 519k]
  ------------------
 1173|  6.73k|					break;
 1174|   525k|			}
 1175|  19.1M|		} while(1);
  ------------------
  |  Branch (1175:11): [Folded - Ignored]
  ------------------
 1176|  6.73k|		sp->plane_sample_offset++;
 1177|  6.73k|		if (OJPEGReadHeaderInfoSecStreamSos(tif)==0)
  ------------------
  |  Branch (1177:7): [True: 6.30k, False: 432]
  ------------------
 1178|  6.30k|			return(0);
 1179|    432|		sp->sos_end[sp->plane_sample_offset].log=1;
 1180|    432|		sp->sos_end[sp->plane_sample_offset].in_buffer_source=sp->in_buffer_source;
 1181|    432|		sp->sos_end[sp->plane_sample_offset].in_buffer_next_strile=sp->in_buffer_next_strile;
 1182|    432|		sp->sos_end[sp->plane_sample_offset].in_buffer_file_pos=sp->in_buffer_file_pos-sp->in_buffer_togo;
 1183|    432|		sp->sos_end[sp->plane_sample_offset].in_buffer_file_togo=sp->in_buffer_file_togo+sp->in_buffer_togo;
 1184|    432|	}
 1185|    432|	return(1);
 1186|  12.8k|}
tif_ojpeg.c:OJPEGLibjpegSessionAbort:
 1311|  14.3k|{
 1312|  14.3k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1313|  14.3k|	assert(sp->libjpeg_session_active!=0);
 1314|  14.3k|	jpeg_destroy((jpeg_common_struct*)(&(sp->libjpeg_jpeg_decompress_struct)));
 1315|  14.3k|	sp->libjpeg_session_active=0;
 1316|  14.3k|}
tif_ojpeg.c:OJPEGWriteHeaderInfo:
 1190|  17.5k|{
 1191|  17.5k|	static const char module[]="OJPEGWriteHeaderInfo";
 1192|  17.5k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 1193|  17.5k|	uint8_t** m;
 1194|  17.5k|	uint32_t n;
 1195|       |	/* if a previous attempt failed, don't try again */
 1196|  17.5k|	if (sp->libjpeg_session_active != 0) 
  ------------------
  |  Branch (1196:6): [True: 3.22k, False: 14.3k]
  ------------------
 1197|  3.22k|		return 0;
 1198|  14.3k|	sp->out_state=ososSoi;
 1199|  14.3k|	sp->restart_index=0;
 1200|  14.3k|	jpeg_std_error(&(sp->libjpeg_jpeg_error_mgr));
 1201|  14.3k|	sp->libjpeg_jpeg_error_mgr.output_message=OJPEGLibjpegJpegErrorMgrOutputMessage;
 1202|  14.3k|	sp->libjpeg_jpeg_error_mgr.error_exit=OJPEGLibjpegJpegErrorMgrErrorExit;
 1203|  14.3k|	sp->libjpeg_jpeg_decompress_struct.err=&(sp->libjpeg_jpeg_error_mgr);
 1204|  14.3k|	sp->libjpeg_jpeg_decompress_struct.client_data=(void*)tif;
 1205|  14.3k|	if (jpeg_create_decompress_encap(sp,&(sp->libjpeg_jpeg_decompress_struct))==0)
  ------------------
  |  Branch (1205:6): [True: 0, False: 14.3k]
  ------------------
 1206|      0|		return(0);
 1207|  14.3k|	sp->libjpeg_session_active=1;
 1208|  14.3k|	sp->libjpeg_jpeg_source_mgr.bytes_in_buffer=0;
 1209|  14.3k|	sp->libjpeg_jpeg_source_mgr.init_source=OJPEGLibjpegJpegSourceMgrInitSource;
 1210|  14.3k|	sp->libjpeg_jpeg_source_mgr.fill_input_buffer=OJPEGLibjpegJpegSourceMgrFillInputBuffer;
 1211|  14.3k|	sp->libjpeg_jpeg_source_mgr.skip_input_data=OJPEGLibjpegJpegSourceMgrSkipInputData;
 1212|  14.3k|	sp->libjpeg_jpeg_source_mgr.resync_to_restart=OJPEGLibjpegJpegSourceMgrResyncToRestart;
 1213|  14.3k|	sp->libjpeg_jpeg_source_mgr.term_source=OJPEGLibjpegJpegSourceMgrTermSource;
 1214|  14.3k|	sp->libjpeg_jpeg_decompress_struct.src=&(sp->libjpeg_jpeg_source_mgr);
 1215|  14.3k|	if (jpeg_read_header_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),1)==0)
  ------------------
  |  Branch (1215:6): [True: 111, False: 14.2k]
  ------------------
 1216|    111|		return(0);
 1217|  14.2k|	if ((sp->subsampling_force_desubsampling_inside_decompression==0) && (sp->samples_per_pixel_per_plane>1))
  ------------------
  |  Branch (1217:6): [True: 14.2k, False: 18]
  |  Branch (1217:71): [True: 178, False: 14.0k]
  ------------------
 1218|    178|	{
 1219|    178|		sp->libjpeg_jpeg_decompress_struct.raw_data_out=1;
 1220|       |#if JPEG_LIB_VERSION >= 70
 1221|       |		sp->libjpeg_jpeg_decompress_struct.do_fancy_upsampling=FALSE;
 1222|       |#endif
 1223|    178|		sp->libjpeg_jpeg_query_style=0;
 1224|    178|		if (sp->subsampling_convert_log==0)
  ------------------
  |  Branch (1224:7): [True: 178, False: 0]
  ------------------
 1225|    178|		{
 1226|    178|			assert(sp->subsampling_convert_ycbcrbuf==0);
 1227|    178|			assert(sp->subsampling_convert_ycbcrimage==0);
 1228|    178|			sp->subsampling_convert_ylinelen=((sp->strile_width+sp->subsampling_hor*8-1)/(sp->subsampling_hor*8)*sp->subsampling_hor*8);
 1229|    178|			sp->subsampling_convert_ylines=sp->subsampling_ver*8;
 1230|    178|			sp->subsampling_convert_clinelen=sp->subsampling_convert_ylinelen/sp->subsampling_hor;
 1231|    178|			sp->subsampling_convert_clines=8;
 1232|    178|			sp->subsampling_convert_ybuflen=sp->subsampling_convert_ylinelen*sp->subsampling_convert_ylines;
 1233|    178|			sp->subsampling_convert_cbuflen=sp->subsampling_convert_clinelen*sp->subsampling_convert_clines;
 1234|    178|			sp->subsampling_convert_ycbcrbuflen=sp->subsampling_convert_ybuflen+2*sp->subsampling_convert_cbuflen;
 1235|       |                        /* The calloc is not normally necessary, except in some edge/broken cases */
 1236|       |                        /* for example for a tiled image of height 1 with a tile height of 1 and subsampling_hor=subsampling_ver=2 */
 1237|       |                        /* In that case, libjpeg will only fill the 8 first lines of the 16 lines */
 1238|       |                        /* See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16844 */
 1239|       |                        /* Even if this case is allowed (?), its handling is broken because OJPEGPreDecode() should also likely */
 1240|       |                        /* reset subsampling_convert_state to 0 when changing tile. */
 1241|    178|			sp->subsampling_convert_ycbcrbuf=_TIFFcalloc(1, sp->subsampling_convert_ycbcrbuflen);
 1242|    178|			if (sp->subsampling_convert_ycbcrbuf==0)
  ------------------
  |  Branch (1242:8): [True: 0, False: 178]
  ------------------
 1243|      0|			{
 1244|      0|				TIFFErrorExtR(tif,module,"Out of memory");
 1245|      0|				return(0);
 1246|      0|			}
 1247|    178|			sp->subsampling_convert_ybuf=sp->subsampling_convert_ycbcrbuf;
 1248|    178|			sp->subsampling_convert_cbbuf=sp->subsampling_convert_ybuf+sp->subsampling_convert_ybuflen;
 1249|    178|			sp->subsampling_convert_crbuf=sp->subsampling_convert_cbbuf+sp->subsampling_convert_cbuflen;
 1250|    178|			sp->subsampling_convert_ycbcrimagelen=3+sp->subsampling_convert_ylines+2*sp->subsampling_convert_clines;
 1251|    178|			sp->subsampling_convert_ycbcrimage=_TIFFmalloc(sp->subsampling_convert_ycbcrimagelen*sizeof(uint8_t*));
 1252|    178|			if (sp->subsampling_convert_ycbcrimage==0)
  ------------------
  |  Branch (1252:8): [True: 0, False: 178]
  ------------------
 1253|      0|			{
 1254|      0|				TIFFErrorExtR(tif,module,"Out of memory");
 1255|      0|				return(0);
 1256|      0|			}
 1257|    178|			m=sp->subsampling_convert_ycbcrimage;
 1258|    178|			*m++=(uint8_t*)(sp->subsampling_convert_ycbcrimage + 3);
 1259|    178|			*m++=(uint8_t*)(sp->subsampling_convert_ycbcrimage + 3 + sp->subsampling_convert_ylines);
 1260|    178|			*m++=(uint8_t*)(sp->subsampling_convert_ycbcrimage + 3 + sp->subsampling_convert_ylines + sp->subsampling_convert_clines);
 1261|  2.85k|			for (n=0; n<sp->subsampling_convert_ylines; n++)
  ------------------
  |  Branch (1261:14): [True: 2.67k, False: 178]
  ------------------
 1262|  2.67k|				*m++=sp->subsampling_convert_ybuf+n*sp->subsampling_convert_ylinelen;
 1263|  1.60k|			for (n=0; n<sp->subsampling_convert_clines; n++)
  ------------------
  |  Branch (1263:14): [True: 1.42k, False: 178]
  ------------------
 1264|  1.42k|				*m++=sp->subsampling_convert_cbbuf+n*sp->subsampling_convert_clinelen;
 1265|  1.60k|			for (n=0; n<sp->subsampling_convert_clines; n++)
  ------------------
  |  Branch (1265:14): [True: 1.42k, False: 178]
  ------------------
 1266|  1.42k|				*m++=sp->subsampling_convert_crbuf+n*sp->subsampling_convert_clinelen;
 1267|    178|			sp->subsampling_convert_clinelenout=sp->strile_width/sp->subsampling_hor + ((sp->strile_width % sp->subsampling_hor) != 0 ? 1 : 0);
  ------------------
  |  Branch (1267:80): [True: 127, False: 51]
  ------------------
 1268|    178|			sp->subsampling_convert_state=0;
 1269|    178|			sp->error_in_raw_data_decoding=0;
 1270|    178|			sp->bytes_per_line=sp->subsampling_convert_clinelenout*(sp->subsampling_ver*sp->subsampling_hor+2);
 1271|    178|			sp->lines_per_strile=sp->strile_length/sp->subsampling_ver + ((sp->strile_length % sp->subsampling_ver) != 0 ? 1 : 0);
  ------------------
  |  Branch (1271:66): [True: 14, False: 164]
  ------------------
 1272|    178|			sp->subsampling_convert_log=1;
 1273|    178|		}
 1274|    178|	}
 1275|  14.0k|	else
 1276|  14.0k|	{
 1277|  14.0k|		sp->libjpeg_jpeg_decompress_struct.jpeg_color_space=JCS_UNKNOWN;
 1278|  14.0k|		sp->libjpeg_jpeg_decompress_struct.out_color_space=JCS_UNKNOWN;
 1279|  14.0k|		sp->libjpeg_jpeg_query_style=1;
 1280|  14.0k|		sp->bytes_per_line=sp->samples_per_pixel_per_plane*sp->strile_width;
 1281|  14.0k|		sp->lines_per_strile=sp->strile_length;
 1282|  14.0k|	}
 1283|  14.2k|	if (jpeg_start_decompress_encap(sp,&(sp->libjpeg_jpeg_decompress_struct))==0)
  ------------------
  |  Branch (1283:6): [True: 43, False: 14.2k]
  ------------------
 1284|     43|		return(0);
 1285|  14.2k|        if(sp->libjpeg_jpeg_decompress_struct.image_width != sp->strile_width ) {
  ------------------
  |  Branch (1285:12): [True: 1, False: 14.2k]
  ------------------
 1286|      1|            TIFFErrorExtR(tif,module,
 1287|      1|                         "jpeg_start_decompress() returned image_width = %u, "
 1288|      1|                         "expected %"PRIu32,
 1289|      1|                         sp->libjpeg_jpeg_decompress_struct.image_width,
 1290|      1|                         sp->strile_width);
 1291|      1|            return 0;
 1292|      1|        }
 1293|  14.2k|        if(sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor != sp->subsampling_hor ||
  ------------------
  |  Branch (1293:12): [True: 1, False: 14.2k]
  ------------------
 1294|  14.2k|           sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor != sp->subsampling_ver) {
  ------------------
  |  Branch (1294:12): [True: 1, False: 14.2k]
  ------------------
 1295|      2|            TIFFErrorExtR(tif,module,
 1296|      2|                         "jpeg_start_decompress() returned max_h_samp_factor = %d "
 1297|      2|                         "and max_v_samp_factor = %d, expected %"PRIu8" and %"PRIu8,
 1298|      2|                         sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor,
 1299|      2|                         sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor,
 1300|      2|                         sp->subsampling_hor,
 1301|      2|                         sp->subsampling_ver);
 1302|      2|            return 0;
 1303|      2|        }
 1304|       |
 1305|  14.2k|	sp->writeheader_done=1;
 1306|  14.2k|	return(1);
 1307|  14.2k|}
tif_ojpeg.c:OJPEGLibjpegJpegErrorMgrOutputMessage:
 2544|  13.7k|{
 2545|  13.7k|	char buffer[JMSG_LENGTH_MAX];
 2546|  13.7k|	(*cinfo->err->format_message)(cinfo,buffer);
 2547|  13.7k|	TIFFWarningExtR(((TIFF*)(cinfo->client_data)),"LibJpeg","%s",buffer);
 2548|  13.7k|}
tif_ojpeg.c:OJPEGLibjpegJpegErrorMgrErrorExit:
 2552|    154|{
 2553|    154|	char buffer[JMSG_LENGTH_MAX];
 2554|    154|	(*cinfo->err->format_message)(cinfo,buffer);
 2555|    154|	TIFFErrorExtR(((TIFF*)(cinfo->client_data)),"LibJpeg","%s",buffer);
 2556|    154|	jpeg_encap_unwind((TIFF*)(cinfo->client_data));
 2557|    154|}
tif_ojpeg.c:jpeg_encap_unwind:
 2536|  14.2k|{
 2537|  14.2k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2538|  14.2k|	LONGJMP(sp->exit_jmpbuf,1);
  ------------------
  |  |  151|  14.2k|#define LONGJMP(jbuf,code) longjmp(jbuf,code)
  ------------------
 2539|  14.2k|}
tif_ojpeg.c:jpeg_create_decompress_encap:
 2471|  14.3k|{
 2472|  14.3k|	if( SETJMP(sp->exit_jmpbuf) )
  ------------------
  |  |  150|  14.3k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
 2473|      0|		return 0;
 2474|  14.3k|	else {
 2475|  14.3k|		jpeg_create_decompress(cinfo);
 2476|  14.3k|		return 1;
 2477|  14.3k|	}
 2478|  14.3k|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrInitSource:
 2561|  14.3k|{
 2562|  14.3k|	(void)cinfo;
 2563|  14.3k|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrFillInputBuffer:
 2567|   170k|{
 2568|   170k|	TIFF* tif=(TIFF*)cinfo->client_data;
 2569|   170k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2570|   170k|	void* mem=0;
 2571|   170k|	uint32_t len=0U;
 2572|   170k|	if (OJPEGWriteStream(tif,&mem,&len)==0)
  ------------------
  |  Branch (2572:6): [True: 6.85k, False: 163k]
  ------------------
 2573|  6.85k|	{
 2574|  6.85k|		TIFFErrorExtR(tif,"LibJpeg","Premature end of JPEG data");
 2575|  6.85k|		jpeg_encap_unwind(tif);
 2576|  6.85k|	}
 2577|   170k|	sp->libjpeg_jpeg_source_mgr.bytes_in_buffer=len;
 2578|   170k|	sp->libjpeg_jpeg_source_mgr.next_input_byte=mem;
 2579|   170k|	return(1);
 2580|   170k|}
tif_ojpeg.c:OJPEGWriteStream:
 2203|   170k|{
 2204|   170k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2205|   170k|	*len=0;
 2206|   170k|	do
 2207|   275k|	{
 2208|   275k|		assert(sp->out_state<=ososEoi);
 2209|   275k|		switch(sp->out_state)
  ------------------
  |  Branch (2209:10): [True: 0, False: 275k]
  ------------------
 2210|   275k|		{
 2211|  14.3k|			case ososSoi:
  ------------------
  |  Branch (2211:4): [True: 14.3k, False: 261k]
  ------------------
 2212|  14.3k|				OJPEGWriteStreamSoi(tif,mem,len);
 2213|  14.3k|				break;
 2214|  14.3k|			case ososQTable0:
  ------------------
  |  Branch (2214:4): [True: 14.3k, False: 261k]
  ------------------
 2215|  14.3k|				OJPEGWriteStreamQTable(tif,0,mem,len);
 2216|  14.3k|				break;
 2217|  14.3k|			case ososQTable1:
  ------------------
  |  Branch (2217:4): [True: 14.3k, False: 261k]
  ------------------
 2218|  14.3k|				OJPEGWriteStreamQTable(tif,1,mem,len);
 2219|  14.3k|				break;
 2220|  14.3k|			case ososQTable2:
  ------------------
  |  Branch (2220:4): [True: 14.3k, False: 261k]
  ------------------
 2221|  14.3k|				OJPEGWriteStreamQTable(tif,2,mem,len);
 2222|  14.3k|				break;
 2223|  14.3k|			case ososQTable3:
  ------------------
  |  Branch (2223:4): [True: 14.3k, False: 261k]
  ------------------
 2224|  14.3k|				OJPEGWriteStreamQTable(tif,3,mem,len);
 2225|  14.3k|				break;
 2226|  14.3k|			case ososDcTable0:
  ------------------
  |  Branch (2226:4): [True: 14.3k, False: 261k]
  ------------------
 2227|  14.3k|				OJPEGWriteStreamDcTable(tif,0,mem,len);
 2228|  14.3k|				break;
 2229|  14.3k|			case ososDcTable1:
  ------------------
  |  Branch (2229:4): [True: 14.3k, False: 261k]
  ------------------
 2230|  14.3k|				OJPEGWriteStreamDcTable(tif,1,mem,len);
 2231|  14.3k|				break;
 2232|  14.3k|			case ososDcTable2:
  ------------------
  |  Branch (2232:4): [True: 14.3k, False: 261k]
  ------------------
 2233|  14.3k|				OJPEGWriteStreamDcTable(tif,2,mem,len);
 2234|  14.3k|				break;
 2235|  14.3k|			case ososDcTable3:
  ------------------
  |  Branch (2235:4): [True: 14.3k, False: 261k]
  ------------------
 2236|  14.3k|				OJPEGWriteStreamDcTable(tif,3,mem,len);
 2237|  14.3k|				break;
 2238|  14.3k|			case ososAcTable0:
  ------------------
  |  Branch (2238:4): [True: 14.3k, False: 261k]
  ------------------
 2239|  14.3k|				OJPEGWriteStreamAcTable(tif,0,mem,len);
 2240|  14.3k|				break;
 2241|  14.3k|			case ososAcTable1:
  ------------------
  |  Branch (2241:4): [True: 14.3k, False: 261k]
  ------------------
 2242|  14.3k|				OJPEGWriteStreamAcTable(tif,1,mem,len);
 2243|  14.3k|				break;
 2244|  14.3k|			case ososAcTable2:
  ------------------
  |  Branch (2244:4): [True: 14.3k, False: 261k]
  ------------------
 2245|  14.3k|				OJPEGWriteStreamAcTable(tif,2,mem,len);
 2246|  14.3k|				break;
 2247|  14.3k|			case ososAcTable3:
  ------------------
  |  Branch (2247:4): [True: 14.3k, False: 261k]
  ------------------
 2248|  14.3k|				OJPEGWriteStreamAcTable(tif,3,mem,len);
 2249|  14.3k|				break;
 2250|  14.3k|			case ososDri:
  ------------------
  |  Branch (2250:4): [True: 14.3k, False: 261k]
  ------------------
 2251|  14.3k|				OJPEGWriteStreamDri(tif,mem,len);
 2252|  14.3k|				break;
 2253|  14.3k|			case ososSof:
  ------------------
  |  Branch (2253:4): [True: 14.3k, False: 261k]
  ------------------
 2254|  14.3k|				OJPEGWriteStreamSof(tif,mem,len);
 2255|  14.3k|				break;
 2256|  14.3k|			case ososSos:
  ------------------
  |  Branch (2256:4): [True: 14.3k, False: 261k]
  ------------------
 2257|  14.3k|				OJPEGWriteStreamSos(tif,mem,len);
 2258|  14.3k|				break;
 2259|  33.0k|			case ososCompressed:
  ------------------
  |  Branch (2259:4): [True: 33.0k, False: 242k]
  ------------------
 2260|  33.0k|				if (OJPEGWriteStreamCompressed(tif,mem,len)==0)
  ------------------
  |  Branch (2260:9): [True: 6.85k, False: 26.2k]
  ------------------
 2261|  6.85k|					return(0);
 2262|  26.2k|				break;
 2263|  26.2k|			case ososRst:
  ------------------
  |  Branch (2263:4): [True: 12.4k, False: 262k]
  ------------------
 2264|  12.4k|				OJPEGWriteStreamRst(tif,mem,len);
 2265|  12.4k|				break;
 2266|    146|			case ososEoi:
  ------------------
  |  Branch (2266:4): [True: 146, False: 275k]
  ------------------
 2267|    146|				OJPEGWriteStreamEoi(tif,mem,len);
 2268|    146|				break;
 2269|   275k|		}
 2270|   275k|	} while (*len==0);
  ------------------
  |  Branch (2270:11): [True: 105k, False: 163k]
  ------------------
 2271|   163k|	return(1);
 2272|   170k|}
tif_ojpeg.c:OJPEGWriteStreamSoi:
 2276|  14.3k|{
 2277|  14.3k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2278|  14.3k|	assert(OJPEG_BUFFER>=2);
 2279|  14.3k|	sp->out_buffer[0]=255;
 2280|  14.3k|	sp->out_buffer[1]=JPEG_MARKER_SOI;
  ------------------
  |  |  161|  14.3k|#define JPEG_MARKER_SOI 0xD8
  ------------------
 2281|  14.3k|	*len=2;
 2282|  14.3k|	*mem=(void*)sp->out_buffer;
 2283|  14.3k|	sp->out_state++;
 2284|  14.3k|}
tif_ojpeg.c:OJPEGWriteStreamQTable:
 2288|  57.4k|{
 2289|  57.4k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2290|  57.4k|	if (sp->qtable[table_index]!=0)
  ------------------
  |  Branch (2290:6): [True: 21.4k, False: 36.0k]
  ------------------
 2291|  21.4k|	{
 2292|  21.4k|		*mem=(void*)(sp->qtable[table_index]+sizeof(uint32_t));
 2293|  21.4k|		*len= *((uint32_t*)sp->qtable[table_index]) - sizeof(uint32_t);
 2294|  21.4k|	}
 2295|  57.4k|	sp->out_state++;
 2296|  57.4k|}
tif_ojpeg.c:OJPEGWriteStreamDcTable:
 2300|  57.4k|{
 2301|  57.4k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2302|  57.4k|	if (sp->dctable[table_index]!=0)
  ------------------
  |  Branch (2302:6): [True: 24.5k, False: 32.9k]
  ------------------
 2303|  24.5k|	{
 2304|  24.5k|		*mem=(void*)(sp->dctable[table_index]+sizeof(uint32_t));
 2305|  24.5k|		*len= *((uint32_t*)sp->dctable[table_index]) - sizeof(uint32_t);
 2306|  24.5k|	}
 2307|  57.4k|	sp->out_state++;
 2308|  57.4k|}
tif_ojpeg.c:OJPEGWriteStreamAcTable:
 2312|  57.4k|{
 2313|  57.4k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2314|  57.4k|	if (sp->actable[table_index]!=0)
  ------------------
  |  Branch (2314:6): [True: 33.3k, False: 24.1k]
  ------------------
 2315|  33.3k|	{
 2316|  33.3k|		*mem=(void*)(sp->actable[table_index]+sizeof(uint32_t));
 2317|  33.3k|		*len= *((uint32_t*)sp->actable[table_index]) - sizeof(uint32_t);
 2318|  33.3k|	}
 2319|  57.4k|	sp->out_state++;
 2320|  57.4k|}
tif_ojpeg.c:OJPEGWriteStreamDri:
 2324|  14.3k|{
 2325|  14.3k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2326|  14.3k|	assert(OJPEG_BUFFER>=6);
 2327|  14.3k|	if (sp->restart_interval!=0)
  ------------------
  |  Branch (2327:6): [True: 2.31k, False: 12.0k]
  ------------------
 2328|  2.31k|	{
 2329|  2.31k|		sp->out_buffer[0]=255;
 2330|  2.31k|		sp->out_buffer[1]=JPEG_MARKER_DRI;
  ------------------
  |  |  165|  2.31k|#define JPEG_MARKER_DRI 0xDD
  ------------------
 2331|  2.31k|		sp->out_buffer[2]=0;
 2332|  2.31k|		sp->out_buffer[3]=4;
 2333|  2.31k|		sp->out_buffer[4]=(sp->restart_interval>>8);
 2334|  2.31k|		sp->out_buffer[5]=(sp->restart_interval&255);
 2335|  2.31k|		*len=6;
 2336|  2.31k|		*mem=(void*)sp->out_buffer;
 2337|  2.31k|	}
 2338|  14.3k|	sp->out_state++;
 2339|  14.3k|}
tif_ojpeg.c:OJPEGWriteStreamSof:
 2343|  14.3k|{
 2344|  14.3k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2345|  14.3k|	uint8_t m;
 2346|  14.3k|	assert(OJPEG_BUFFER>=2+8+sp->samples_per_pixel_per_plane*3);
 2347|  14.3k|	assert(255>=8+sp->samples_per_pixel_per_plane*3);
 2348|  14.3k|	sp->out_buffer[0]=255;
 2349|  14.3k|	sp->out_buffer[1]=sp->sof_marker_id;
 2350|       |	/* Lf */
 2351|  14.3k|	sp->out_buffer[2]=0;
 2352|  14.3k|	sp->out_buffer[3]=8+sp->samples_per_pixel_per_plane*3;
 2353|       |	/* P */
 2354|  14.3k|	sp->out_buffer[4]=8;
 2355|       |	/* Y */
 2356|  14.3k|	sp->out_buffer[5]=(uint8_t)(sp->sof_y >> 8);
 2357|  14.3k|	sp->out_buffer[6]=(sp->sof_y&255);
 2358|       |	/* X */
 2359|  14.3k|	sp->out_buffer[7]=(uint8_t)(sp->sof_x >> 8);
 2360|  14.3k|	sp->out_buffer[8]=(sp->sof_x&255);
 2361|       |	/* Nf */
 2362|  14.3k|	sp->out_buffer[9]=sp->samples_per_pixel_per_plane;
 2363|  29.1k|	for (m=0; m<sp->samples_per_pixel_per_plane; m++)
  ------------------
  |  Branch (2363:12): [True: 14.7k, False: 14.3k]
  ------------------
 2364|  14.7k|	{
 2365|       |		/* C */
 2366|  14.7k|		sp->out_buffer[10+m*3]=sp->sof_c[sp->plane_sample_offset+m];
 2367|       |		/* H and V */
 2368|  14.7k|		sp->out_buffer[10+m*3+1]=sp->sof_hv[sp->plane_sample_offset+m];
 2369|       |		/* Tq */
 2370|  14.7k|		sp->out_buffer[10+m*3+2]=sp->sof_tq[sp->plane_sample_offset+m];
 2371|  14.7k|	}
 2372|  14.3k|	*len=10+sp->samples_per_pixel_per_plane*3;
 2373|  14.3k|	*mem=(void*)sp->out_buffer;
 2374|  14.3k|	sp->out_state++;
 2375|  14.3k|}
tif_ojpeg.c:OJPEGWriteStreamSos:
 2379|  14.3k|{
 2380|  14.3k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2381|  14.3k|	uint8_t m;
 2382|  14.3k|	assert(OJPEG_BUFFER>=2+6+sp->samples_per_pixel_per_plane*2);
 2383|  14.3k|	assert(255>=6+sp->samples_per_pixel_per_plane*2);
 2384|  14.3k|	sp->out_buffer[0]=255;
 2385|  14.3k|	sp->out_buffer[1]=JPEG_MARKER_SOS;
  ------------------
  |  |  163|  14.3k|#define JPEG_MARKER_SOS 0xDA
  ------------------
 2386|       |	/* Ls */
 2387|  14.3k|	sp->out_buffer[2]=0;
 2388|  14.3k|	sp->out_buffer[3]=6+sp->samples_per_pixel_per_plane*2;
 2389|       |	/* Ns */
 2390|  14.3k|	sp->out_buffer[4]=sp->samples_per_pixel_per_plane;
 2391|  29.1k|	for (m=0; m<sp->samples_per_pixel_per_plane; m++)
  ------------------
  |  Branch (2391:12): [True: 14.7k, False: 14.3k]
  ------------------
 2392|  14.7k|	{
 2393|       |		/* Cs */
 2394|  14.7k|		sp->out_buffer[5+m*2]=sp->sos_cs[sp->plane_sample_offset+m];
 2395|       |		/* Td and Ta */
 2396|  14.7k|		sp->out_buffer[5+m*2+1]=sp->sos_tda[sp->plane_sample_offset+m];
 2397|  14.7k|	}
 2398|       |	/* Ss */
 2399|  14.3k|	sp->out_buffer[5+sp->samples_per_pixel_per_plane*2]=0;
 2400|       |	/* Se */
 2401|  14.3k|	sp->out_buffer[5+sp->samples_per_pixel_per_plane*2+1]=63;
 2402|       |	/* Ah and Al */
 2403|  14.3k|	sp->out_buffer[5+sp->samples_per_pixel_per_plane*2+2]=0;
 2404|  14.3k|	*len=8+sp->samples_per_pixel_per_plane*2;
 2405|  14.3k|	*mem=(void*)sp->out_buffer;
 2406|  14.3k|	sp->out_state++;
 2407|  14.3k|}
tif_ojpeg.c:OJPEGWriteStreamCompressed:
 2411|  33.0k|{
 2412|  33.0k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2413|  33.0k|	if (sp->in_buffer_togo==0)
  ------------------
  |  Branch (2413:6): [True: 32.5k, False: 558]
  ------------------
 2414|  32.5k|	{
 2415|  32.5k|		if (OJPEGReadBufferFill(sp)==0)
  ------------------
  |  Branch (2415:7): [True: 6.85k, False: 25.6k]
  ------------------
 2416|  6.85k|			return(0);
 2417|  25.6k|		assert(sp->in_buffer_togo>0);
 2418|  25.6k|	}
 2419|  26.2k|	*len=sp->in_buffer_togo;
 2420|  26.2k|	*mem=(void*)sp->in_buffer_cur;
 2421|  26.2k|	sp->in_buffer_togo=0;
 2422|  26.2k|	if (sp->in_buffer_file_togo==0)
  ------------------
  |  Branch (2422:6): [True: 25.4k, False: 773]
  ------------------
 2423|  25.4k|	{
 2424|  25.4k|		switch(sp->in_buffer_source)
 2425|  25.4k|		{
 2426|  19.8k|			case osibsStrile:
  ------------------
  |  Branch (2426:4): [True: 19.8k, False: 5.59k]
  ------------------
 2427|  19.8k|				if (sp->in_buffer_next_strile<sp->in_buffer_strile_count)
  ------------------
  |  Branch (2427:9): [True: 19.4k, False: 386]
  ------------------
 2428|  19.4k|					sp->out_state=ososRst;
 2429|    386|				else
 2430|    386|					sp->out_state=ososEoi;
 2431|  19.8k|				break;
 2432|      0|			case osibsEof:
  ------------------
  |  Branch (2432:4): [True: 0, False: 25.4k]
  ------------------
 2433|      0|				sp->out_state=ososEoi;
 2434|      0|				break;
 2435|  5.59k|			default:
  ------------------
  |  Branch (2435:4): [True: 5.59k, False: 19.8k]
  ------------------
 2436|  5.59k|				break;
 2437|  25.4k|		}
 2438|  25.4k|	}
 2439|  26.2k|	return(1);
 2440|  26.2k|}
tif_ojpeg.c:OJPEGWriteStreamRst:
 2444|  12.4k|{
 2445|  12.4k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2446|  12.4k|	assert(OJPEG_BUFFER>=2);
 2447|  12.4k|	sp->out_buffer[0]=255;
 2448|  12.4k|	sp->out_buffer[1]=JPEG_MARKER_RST0+sp->restart_index;
  ------------------
  |  |  160|  12.4k|#define JPEG_MARKER_RST0 0XD0
  ------------------
 2449|  12.4k|	sp->restart_index++;
 2450|  12.4k|	if (sp->restart_index==8)
  ------------------
  |  Branch (2450:6): [True: 1.40k, False: 11.0k]
  ------------------
 2451|  1.40k|		sp->restart_index=0;
 2452|  12.4k|	*len=2;
 2453|  12.4k|	*mem=(void*)sp->out_buffer;
 2454|  12.4k|	sp->out_state=ososCompressed;
 2455|  12.4k|}
tif_ojpeg.c:OJPEGWriteStreamEoi:
 2459|    146|{
 2460|    146|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
 2461|    146|	assert(OJPEG_BUFFER>=2);
 2462|    146|	sp->out_buffer[0]=255;
 2463|    146|	sp->out_buffer[1]=JPEG_MARKER_EOI;
  ------------------
  |  |  162|    146|#define JPEG_MARKER_EOI 0xD9
  ------------------
 2464|    146|	*len=2;
 2465|    146|	*mem=(void*)sp->out_buffer;
 2466|    146|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrResyncToRestart:
 2597|  7.23k|{
 2598|  7.23k|	TIFF* tif=(TIFF*)cinfo->client_data;
 2599|  7.23k|	(void)desired;
 2600|  7.23k|	TIFFErrorExtR(tif,"LibJpeg","Unexpected error");
 2601|  7.23k|	jpeg_encap_unwind(tif);
 2602|  7.23k|	return(0);
 2603|  7.23k|}
tif_ojpeg.c:jpeg_read_header_encap:
 2484|  14.3k|{
 2485|  14.3k|	if( SETJMP(sp->exit_jmpbuf) )
  ------------------
  |  |  150|  14.3k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
 2486|    111|		return 0;
 2487|  14.2k|	else {
 2488|  14.2k|		jpeg_read_header(cinfo,require_image);
 2489|  14.2k|		return 1;
 2490|  14.2k|	}
 2491|  14.3k|}
tif_ojpeg.c:jpeg_start_decompress_encap:
 2497|  14.2k|{
 2498|  14.2k|	if( SETJMP(sp->exit_jmpbuf) )
  ------------------
  |  |  150|  14.2k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
 2499|     43|		return 0;
 2500|  14.2k|	else {
 2501|  14.2k|		jpeg_start_decompress(cinfo);
 2502|  14.2k|		return 1;
 2503|  14.2k|	}
 2504|  14.2k|}
tif_ojpeg.c:OJPEGPreDecodeSkipRaw:
  732|  8.56k|{
  733|  8.56k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
  734|  8.56k|	uint32_t m;
  735|  8.56k|	m=sp->lines_per_strile;
  736|  8.56k|	if (sp->subsampling_convert_state!=0)
  ------------------
  |  Branch (736:6): [True: 781, False: 7.78k]
  ------------------
  737|    781|	{
  738|    781|		if (sp->subsampling_convert_clines-sp->subsampling_convert_state>=m)
  ------------------
  |  Branch (738:7): [True: 0, False: 781]
  ------------------
  739|      0|		{
  740|      0|			sp->subsampling_convert_state+=m;
  741|      0|			if (sp->subsampling_convert_state==sp->subsampling_convert_clines)
  ------------------
  |  Branch (741:8): [True: 0, False: 0]
  ------------------
  742|      0|				sp->subsampling_convert_state=0;
  743|      0|			return(1);
  744|      0|		}
  745|    781|		m-=sp->subsampling_convert_clines-sp->subsampling_convert_state;
  746|    781|		sp->subsampling_convert_state=0;
  747|    781|                sp->error_in_raw_data_decoding=0;
  748|    781|	}
  749|  36.1k|	while (m>=sp->subsampling_convert_clines)
  ------------------
  |  Branch (749:9): [True: 35.3k, False: 802]
  ------------------
  750|  35.3k|	{
  751|  35.3k|		if (jpeg_read_raw_data_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),sp->subsampling_convert_ycbcrimage,sp->subsampling_ver*8)==0)
  ------------------
  |  Branch (751:7): [True: 7.76k, False: 27.5k]
  ------------------
  752|  7.76k|			return(0);
  753|  27.5k|		m-=sp->subsampling_convert_clines;
  754|  27.5k|	}
  755|    802|	if (m>0)
  ------------------
  |  Branch (755:6): [True: 522, False: 280]
  ------------------
  756|    522|	{
  757|    522|		if (jpeg_read_raw_data_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),sp->subsampling_convert_ycbcrimage,sp->subsampling_ver*8)==0)
  ------------------
  |  Branch (757:7): [True: 0, False: 522]
  ------------------
  758|      0|			return(0);
  759|    522|		sp->subsampling_convert_state=m;
  760|    522|	}
  761|    802|	return(1);
  762|    802|}
tif_ojpeg.c:jpeg_read_raw_data_encap:
 2523|   940k|{
 2524|   940k|	if( SETJMP(sp->exit_jmpbuf) )
  ------------------
  |  |  150|   940k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
 2525|  7.85k|		return 0;
 2526|   932k|	else {
 2527|   932k|		jpeg_read_raw_data(cinfo,data,max_lines);
 2528|   932k|		return 1;
 2529|   932k|	}
 2530|   940k|}
tif_ojpeg.c:OJPEGPreDecodeSkipScanlines:
  766|   230k|{
  767|   230k|	static const char module[]="OJPEGPreDecodeSkipScanlines";
  768|   230k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
  769|   230k|	uint32_t m;
  770|   230k|	if (sp->skip_buffer==NULL)
  ------------------
  |  Branch (770:6): [True: 355, False: 229k]
  ------------------
  771|    355|	{
  772|    355|		sp->skip_buffer=_TIFFmalloc(sp->bytes_per_line);
  773|    355|		if (sp->skip_buffer==NULL)
  ------------------
  |  Branch (773:7): [True: 0, False: 355]
  ------------------
  774|      0|		{
  775|      0|			TIFFErrorExtR(tif,module,"Out of memory");
  776|      0|			return(0);
  777|      0|		}
  778|    355|	}
  779|   205M|	for (m=0; m<sp->lines_per_strile; m++)
  ------------------
  |  Branch (779:12): [True: 205M, False: 224k]
  ------------------
  780|   205M|	{
  781|   205M|		if (jpeg_read_scanlines_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),&sp->skip_buffer,1)==0)
  ------------------
  |  Branch (781:7): [True: 6.06k, False: 205M]
  ------------------
  782|  6.06k|			return(0);
  783|   205M|	}
  784|   224k|	return(1);
  785|   230k|}
tif_ojpeg.c:jpeg_read_scanlines_encap:
 2510|   219M|{
 2511|   219M|	if( SETJMP(sp->exit_jmpbuf) )
  ------------------
  |  |  150|   219M|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
 2512|  6.23k|		return 0;
 2513|   219M|	else {
 2514|   219M|		jpeg_read_scanlines(cinfo,scanlines,max_lines);
 2515|   219M|		return 1;
 2516|   219M|	}
 2517|   219M|}
tif_ojpeg.c:OJPEGDecode:
  789|  25.4k|{
  790|  25.4k|        static const char module[]="OJPEGDecode";
  791|  25.4k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
  792|  25.4k|	(void)s;
  793|  25.4k|        if( !sp->decoder_ok )
  ------------------
  |  Branch (793:13): [True: 0, False: 25.4k]
  ------------------
  794|      0|        {
  795|      0|            TIFFErrorExtR(tif,module,"Cannot decode: decoder not correctly initialized");
  796|      0|            return 0;
  797|      0|        }
  798|  25.4k|        if( sp->libjpeg_session_active == 0 )
  ------------------
  |  Branch (798:13): [True: 0, False: 25.4k]
  ------------------
  799|      0|        {
  800|       |            /* This should normally not happen, except that it does when */
  801|       |            /* using TIFFReadScanline() which calls OJPEGPostDecode() for */
  802|       |            /* each scanline, which assumes that a whole strile was read */
  803|       |            /* and may thus incorrectly consider it has read the whole image, causing */
  804|       |            /* OJPEGLibjpegSessionAbort() to be called prematurely. */
  805|       |            /* Triggered by https://gitlab.com/libtiff/libtiff/-/issues/337 */
  806|      0|            TIFFErrorExtR(tif,module,"Cannot decode: libjpeg_session_active == 0");
  807|      0|            return 0;
  808|      0|        }
  809|  25.4k|        if( sp->error_in_raw_data_decoding )
  ------------------
  |  Branch (809:13): [True: 0, False: 25.4k]
  ------------------
  810|      0|        {
  811|      0|            return 0;
  812|      0|        }
  813|  25.4k|	if (sp->libjpeg_jpeg_query_style==0)
  ------------------
  |  Branch (813:6): [True: 10.9k, False: 14.4k]
  ------------------
  814|  10.9k|	{
  815|  10.9k|		if (OJPEGDecodeRaw(tif,buf,cc)==0)
  ------------------
  |  Branch (815:7): [True: 91, False: 10.9k]
  ------------------
  816|     91|			return(0);
  817|  10.9k|	}
  818|  14.4k|	else
  819|  14.4k|	{
  820|  14.4k|		if (OJPEGDecodeScanlines(tif,buf,cc)==0)
  ------------------
  |  Branch (820:7): [True: 2.30k, False: 12.1k]
  ------------------
  821|  2.30k|			return(0);
  822|  14.4k|	}
  823|  23.0k|	return(1);
  824|  25.4k|}
tif_ojpeg.c:OJPEGDecodeRaw:
  828|  10.9k|{
  829|  10.9k|	static const char module[]="OJPEGDecodeRaw";
  830|  10.9k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
  831|  10.9k|	uint8_t* m;
  832|  10.9k|	tmsize_t n;
  833|  10.9k|	uint8_t* oy;
  834|  10.9k|	uint8_t* ocb;
  835|  10.9k|	uint8_t* ocr;
  836|  10.9k|	uint8_t* p;
  837|  10.9k|	uint32_t q;
  838|  10.9k|	uint8_t* r;
  839|  10.9k|	uint8_t sx,sy;
  840|  10.9k|	if (cc%sp->bytes_per_line!=0)
  ------------------
  |  Branch (840:6): [True: 0, False: 10.9k]
  ------------------
  841|      0|	{
  842|      0|		TIFFErrorExtR(tif,module,"Fractional scanline not read");
  843|      0|		return(0);
  844|      0|	}
  845|  10.9k|	assert(cc>0);
  846|  10.9k|	m=buf;
  847|  10.9k|	n=cc;
  848|  10.9k|	do
  849|  7.23M|	{
  850|  7.23M|		if (sp->subsampling_convert_state==0)
  ------------------
  |  Branch (850:7): [True: 904k, False: 6.33M]
  ------------------
  851|   904k|		{
  852|   904k|			if (jpeg_read_raw_data_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),sp->subsampling_convert_ycbcrimage,sp->subsampling_ver*8)==0)
  ------------------
  |  Branch (852:8): [True: 91, False: 904k]
  ------------------
  853|     91|			{
  854|     91|				sp->error_in_raw_data_decoding = 1;
  855|     91|				return(0);
  856|     91|			}
  857|   904k|		}
  858|  7.23M|		oy=sp->subsampling_convert_ybuf+sp->subsampling_convert_state*sp->subsampling_ver*sp->subsampling_convert_ylinelen;
  859|  7.23M|		ocb=sp->subsampling_convert_cbbuf+sp->subsampling_convert_state*sp->subsampling_convert_clinelen;
  860|  7.23M|		ocr=sp->subsampling_convert_crbuf+sp->subsampling_convert_state*sp->subsampling_convert_clinelen;
  861|  7.23M|		p=m;
  862|   126M|		for (q=0; q<sp->subsampling_convert_clinelenout; q++)
  ------------------
  |  Branch (862:13): [True: 119M, False: 7.23M]
  ------------------
  863|   119M|		{
  864|   119M|			r=oy;
  865|   318M|			for (sy=0; sy<sp->subsampling_ver; sy++)
  ------------------
  |  Branch (865:15): [True: 199M, False: 119M]
  ------------------
  866|   199M|			{
  867|   556M|				for (sx=0; sx<sp->subsampling_hor; sx++)
  ------------------
  |  Branch (867:16): [True: 356M, False: 199M]
  ------------------
  868|   356M|					*p++=*r++;
  869|   199M|				r+=sp->subsampling_convert_ylinelen-sp->subsampling_hor;
  870|   199M|			}
  871|   119M|			oy+=sp->subsampling_hor;
  872|   119M|			*p++=*ocb++;
  873|   119M|			*p++=*ocr++;
  874|   119M|		}
  875|  7.23M|		sp->subsampling_convert_state++;
  876|  7.23M|		if (sp->subsampling_convert_state==sp->subsampling_convert_clines)
  ------------------
  |  Branch (876:7): [True: 904k, False: 6.33M]
  ------------------
  877|   904k|			sp->subsampling_convert_state=0;
  878|  7.23M|		m+=sp->bytes_per_line;
  879|  7.23M|		n-=sp->bytes_per_line;
  880|  7.23M|	} while(n>0);
  ------------------
  |  Branch (880:10): [True: 7.22M, False: 10.9k]
  ------------------
  881|  10.9k|	return(1);
  882|  10.9k|}
tif_ojpeg.c:OJPEGDecodeScanlines:
  886|  14.4k|{
  887|  14.4k|	static const char module[]="OJPEGDecodeScanlines";
  888|  14.4k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
  889|  14.4k|	uint8_t* m;
  890|  14.4k|	tmsize_t n;
  891|  14.4k|	if (cc%sp->bytes_per_line!=0)
  ------------------
  |  Branch (891:6): [True: 2.13k, False: 12.3k]
  ------------------
  892|  2.13k|	{
  893|  2.13k|		TIFFErrorExtR(tif,module,"Fractional scanline not read");
  894|  2.13k|		return(0);
  895|  2.13k|	}
  896|  12.3k|	assert(cc>0);
  897|  12.3k|	m=buf;
  898|  12.3k|	n=cc;
  899|  12.3k|	do
  900|  13.4M|	{
  901|  13.4M|		if (jpeg_read_scanlines_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),&m,1)==0)
  ------------------
  |  Branch (901:7): [True: 170, False: 13.4M]
  ------------------
  902|    170|			return(0);
  903|  13.4M|		m+=sp->bytes_per_line;
  904|  13.4M|		n-=sp->bytes_per_line;
  905|  13.4M|	} while(n>0);
  ------------------
  |  Branch (905:10): [True: 13.4M, False: 12.1k]
  ------------------
  906|  12.1k|	return(1);
  907|  12.3k|}
tif_ojpeg.c:OJPEGPostDecode:
  911|  22.2k|{
  912|  22.2k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
  913|  22.2k|	(void)buf;
  914|  22.2k|	(void)cc;
  915|       |	/* This function somehow incorrectly assumes that a whole strile was read, */
  916|       |	/* which is not true when TIFFReadScanline() is called, */
  917|       |	/* and may thus incorrectly consider it has read the whole image, causing */
  918|       |	/* OJPEGLibjpegSessionAbort() to be called prematurely. */
  919|       |	/* So this logic should be fixed to take into account cc, or disable */
  920|       |	/* the scan line reading interface. */
  921|       |	/* Triggered by https://gitlab.com/libtiff/libtiff/-/issues/337 */
  922|  22.2k|	sp->write_curstrile++;
  923|  22.2k|	if (sp->write_curstrile%tif->tif_dir.td_stripsperimage==0)  
  ------------------
  |  Branch (923:6): [True: 707, False: 21.5k]
  ------------------
  924|    707|	{
  925|    707|		assert(sp->libjpeg_session_active!=0);
  926|    707|		OJPEGLibjpegSessionAbort(tif);
  927|    707|		sp->writeheader_done=0;
  928|    707|	}
  929|  22.2k|}
tif_ojpeg.c:OJPEGCleanup:
  969|  3.33k|{
  970|  3.33k|	OJPEGState* sp=(OJPEGState*)tif->tif_data;
  971|  3.33k|	if (sp!=0)
  ------------------
  |  Branch (971:6): [True: 3.33k, False: 0]
  ------------------
  972|  3.33k|	{
  973|  3.33k|		tif->tif_tagmethods.vgetfield=sp->vgetparent;
  974|  3.33k|		tif->tif_tagmethods.vsetfield=sp->vsetparent;
  975|  3.33k|		tif->tif_tagmethods.printdir=sp->printdir;
  976|  3.33k|		if (sp->qtable[0]!=0)
  ------------------
  |  Branch (976:7): [True: 1.35k, False: 1.98k]
  ------------------
  977|  1.35k|			_TIFFfree(sp->qtable[0]);
  978|  3.33k|		if (sp->qtable[1]!=0)
  ------------------
  |  Branch (978:7): [True: 511, False: 2.82k]
  ------------------
  979|    511|			_TIFFfree(sp->qtable[1]);
  980|  3.33k|		if (sp->qtable[2]!=0)
  ------------------
  |  Branch (980:7): [True: 150, False: 3.18k]
  ------------------
  981|    150|			_TIFFfree(sp->qtable[2]);
  982|  3.33k|		if (sp->qtable[3]!=0)
  ------------------
  |  Branch (982:7): [True: 14, False: 3.32k]
  ------------------
  983|     14|			_TIFFfree(sp->qtable[3]);
  984|  3.33k|		if (sp->dctable[0]!=0)
  ------------------
  |  Branch (984:7): [True: 1.11k, False: 2.21k]
  ------------------
  985|  1.11k|			_TIFFfree(sp->dctable[0]);
  986|  3.33k|		if (sp->dctable[1]!=0)
  ------------------
  |  Branch (986:7): [True: 519, False: 2.81k]
  ------------------
  987|    519|			_TIFFfree(sp->dctable[1]);
  988|  3.33k|		if (sp->dctable[2]!=0)
  ------------------
  |  Branch (988:7): [True: 295, False: 3.04k]
  ------------------
  989|    295|			_TIFFfree(sp->dctable[2]);
  990|  3.33k|		if (sp->dctable[3]!=0)
  ------------------
  |  Branch (990:7): [True: 9, False: 3.32k]
  ------------------
  991|      9|			_TIFFfree(sp->dctable[3]);
  992|  3.33k|		if (sp->actable[0]!=0)
  ------------------
  |  Branch (992:7): [True: 909, False: 2.42k]
  ------------------
  993|    909|			_TIFFfree(sp->actable[0]);
  994|  3.33k|		if (sp->actable[1]!=0)
  ------------------
  |  Branch (994:7): [True: 540, False: 2.79k]
  ------------------
  995|    540|			_TIFFfree(sp->actable[1]);
  996|  3.33k|		if (sp->actable[2]!=0)
  ------------------
  |  Branch (996:7): [True: 603, False: 2.73k]
  ------------------
  997|    603|			_TIFFfree(sp->actable[2]);
  998|  3.33k|		if (sp->actable[3]!=0)
  ------------------
  |  Branch (998:7): [True: 46, False: 3.29k]
  ------------------
  999|     46|			_TIFFfree(sp->actable[3]);
 1000|  3.33k|		if (sp->libjpeg_session_active!=0)
  ------------------
  |  Branch (1000:7): [True: 407, False: 2.92k]
  ------------------
 1001|    407|			OJPEGLibjpegSessionAbort(tif);
 1002|  3.33k|		if (sp->subsampling_convert_ycbcrbuf!=0)
  ------------------
  |  Branch (1002:7): [True: 178, False: 3.15k]
  ------------------
 1003|    178|			_TIFFfree(sp->subsampling_convert_ycbcrbuf);
 1004|  3.33k|		if (sp->subsampling_convert_ycbcrimage!=0)
  ------------------
  |  Branch (1004:7): [True: 178, False: 3.15k]
  ------------------
 1005|    178|			_TIFFfree(sp->subsampling_convert_ycbcrimage);
 1006|  3.33k|		if (sp->skip_buffer!=0)
  ------------------
  |  Branch (1006:7): [True: 355, False: 2.98k]
  ------------------
 1007|    355|			_TIFFfree(sp->skip_buffer);
 1008|  3.33k|		_TIFFfree(sp);
 1009|  3.33k|		tif->tif_data=NULL;
 1010|  3.33k|		_TIFFSetDefaultCompressionState(tif);
 1011|  3.33k|	}
 1012|  3.33k|}

_TIFFgetMode:
   48|  23.5k|{
   49|  23.5k|	int m = -1;
   50|       |
   51|  23.5k|	switch (mode[0]) {
   52|  23.5k|	case 'r':
  ------------------
  |  Branch (52:2): [True: 23.5k, False: 0]
  ------------------
   53|  23.5k|		m = O_RDONLY;
   54|  23.5k|		if (mode[1] == '+')
  ------------------
  |  Branch (54:7): [True: 0, False: 23.5k]
  ------------------
   55|      0|			m = O_RDWR;
   56|  23.5k|		break;
   57|      0|	case 'w':
  ------------------
  |  Branch (57:2): [True: 0, False: 23.5k]
  ------------------
   58|      0|	case 'a':
  ------------------
  |  Branch (58:2): [True: 0, False: 23.5k]
  ------------------
   59|      0|		m = O_RDWR|O_CREAT;
   60|      0|		if (mode[0] == 'w')
  ------------------
  |  Branch (60:7): [True: 0, False: 0]
  ------------------
   61|      0|			m |= O_TRUNC;
   62|      0|		break;
   63|      0|	default:
  ------------------
  |  Branch (63:2): [True: 0, False: 23.5k]
  ------------------
   64|      0|		TIFFErrorExt(0, module, "\"%s\": Bad mode", mode);
   65|      0|		break;
   66|  23.5k|	}
   67|  23.5k|	return (m);
   68|  23.5k|}
TIFFClientOpen:
   81|  23.5k|) {
   82|  23.5k|  return TIFFClientOpenEx(name, mode, clientdata, readproc, writeproc, seekproc, closeproc,
   83|  23.5k|                          sizeproc, mapproc, unmapproc, NULL, NULL);
   84|  23.5k|}
TIFFClientOpenEx:
   99|  23.5k|{
  100|  23.5k|	static const char module[] = "TIFFClientOpenEx";
  101|  23.5k|	TIFF *tif;
  102|  23.5k|	int m;
  103|  23.5k|	const char* cp;
  104|       |
  105|       |	/* The following are configuration checks. They should be redundant, but should not
  106|       |	 * compile to any actual code in an optimised release build anyway. If any of them
  107|       |	 * fail, (makefile-based or other) configuration is not correct */
  108|  23.5k|	assert(sizeof(uint8_t) == 1);
  109|  23.5k|	assert(sizeof(int8_t) == 1);
  110|  23.5k|	assert(sizeof(uint16_t) == 2);
  111|  23.5k|	assert(sizeof(int16_t) == 2);
  112|  23.5k|	assert(sizeof(uint32_t) == 4);
  113|  23.5k|	assert(sizeof(int32_t) == 4);
  114|  23.5k|	assert(sizeof(uint64_t) == 8);
  115|  23.5k|	assert(sizeof(int64_t) == 8);
  116|  23.5k|	{
  117|  23.5k|		union{
  118|  23.5k|			uint8_t a8[2];
  119|  23.5k|			uint16_t a16;
  120|  23.5k|		} n;
  121|  23.5k|		n.a8[0]=1;
  122|  23.5k|		n.a8[1]=0;
  123|  23.5k|                (void)n;
  124|       |		#ifdef WORDS_BIGENDIAN
  125|       |		assert(n.a16==256);
  126|       |		#else
  127|  23.5k|		assert(n.a16==1);
  128|  23.5k|		#endif
  129|  23.5k|	}
  130|       |
  131|  23.5k|	m = _TIFFgetMode(mode, module);
  132|  23.5k|	if (m == -1)
  ------------------
  |  Branch (132:6): [True: 0, False: 23.5k]
  ------------------
  133|      0|		goto bad2;
  134|  23.5k|	tif = (TIFF *)_TIFFmalloc((tmsize_t)(sizeof (TIFF) + strlen(name) + 1));
  135|  23.5k|	if (tif == NULL) {
  ------------------
  |  Branch (135:6): [True: 0, False: 23.5k]
  ------------------
  136|      0|		TIFFErrorExt(clientdata, module, "%s: Out of memory (TIFF structure)", name);
  137|      0|		goto bad2;
  138|      0|	}
  139|  23.5k|	_TIFFmemset(tif, 0, sizeof (*tif));
  140|  23.5k|	tif->tif_name = (char *)tif + sizeof (TIFF);
  141|  23.5k|	strcpy(tif->tif_name, name);
  142|  23.5k|	tif->tif_mode = m &~ (O_CREAT|O_TRUNC);
  143|  23.5k|	tif->tif_curdir = (uint16_t) -1;		/* non-existent directory */
  144|  23.5k|	tif->tif_curoff = 0;
  145|  23.5k|	tif->tif_curstrip = (uint32_t) -1;	/* invalid strip */
  146|  23.5k|	tif->tif_row = (uint32_t) -1;		/* read/write pre-increment */
  147|  23.5k|	tif->tif_clientdata = clientdata;
  148|  23.5k|	tif->tif_readproc = readproc;
  149|  23.5k|	tif->tif_writeproc = writeproc;
  150|  23.5k|	tif->tif_seekproc = seekproc;
  151|  23.5k|	tif->tif_closeproc = closeproc;
  152|  23.5k|	tif->tif_sizeproc = sizeproc;
  153|  23.5k|	tif->tif_mapproc = mapproc ? mapproc : _tiffDummyMapProc;
  ------------------
  |  Branch (153:21): [True: 23.5k, False: 0]
  ------------------
  154|  23.5k|	tif->tif_unmapproc = unmapproc ? unmapproc : _tiffDummyUnmapProc;
  ------------------
  |  Branch (154:23): [True: 23.5k, False: 0]
  ------------------
  155|  23.5k|    tif->tif_errorhandler = errorhandler;
  156|  23.5k|    tif->tif_warnhandler = warnhandler;
  157|       |
  158|  23.5k|	if (!readproc || !writeproc || !seekproc || !closeproc || !sizeproc) {
  ------------------
  |  Branch (158:6): [True: 0, False: 23.5k]
  |  Branch (158:19): [True: 0, False: 23.5k]
  |  Branch (158:33): [True: 0, False: 23.5k]
  |  Branch (158:46): [True: 0, False: 23.5k]
  |  Branch (158:60): [True: 0, False: 23.5k]
  ------------------
  159|      0|		TIFFErrorExtR(tif, module,
  160|      0|		    "One of the client procedures is NULL pointer.");
  161|      0|		_TIFFfree(tif);
  162|      0|		goto bad2;
  163|      0|	}
  164|       |
  165|  23.5k|	_TIFFSetDefaultCompressionState(tif);    /* setup default state */
  166|       |	/*
  167|       |	 * Default is to return data MSB2LSB and enable the
  168|       |	 * use of memory-mapped files and strip chopping when
  169|       |	 * a file is opened read-only.
  170|       |	 */
  171|  23.5k|	tif->tif_flags = FILLORDER_MSB2LSB;
  ------------------
  |  |  235|  23.5k|#define	    FILLORDER_MSB2LSB		1	/* most significant -> least */
  ------------------
  172|  23.5k|	if (m == O_RDONLY )
  ------------------
  |  Branch (172:6): [True: 23.5k, False: 0]
  ------------------
  173|  23.5k|		tif->tif_flags |= TIFF_MAPPED;
  ------------------
  |  |  102|  23.5k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  ------------------
  174|       |
  175|  23.5k|	#ifdef STRIPCHOP_DEFAULT
  176|  23.5k|	if (m == O_RDONLY || m == O_RDWR)
  ------------------
  |  Branch (176:6): [True: 23.5k, False: 0]
  |  Branch (176:23): [True: 0, False: 0]
  ------------------
  177|  23.5k|		tif->tif_flags |= STRIPCHOP_DEFAULT;
  ------------------
  |  |   98|  23.5k|#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
  |  |  ------------------
  |  |  |  |  106|  23.5k|	#define TIFF_STRIPCHOP   0x08000U /* enable strip chopping support */
  |  |  ------------------
  ------------------
  178|  23.5k|	#endif
  179|       |
  180|       |	/*
  181|       |	 * Process library-specific flags in the open mode string.
  182|       |	 * The following flags may be used to control intrinsic library
  183|       |	 * behavior that may or may not be desirable (usually for
  184|       |	 * compatibility with some application that claims to support
  185|       |	 * TIFF but only supports some brain dead idea of what the
  186|       |	 * vendor thinks TIFF is):
  187|       |	 *
  188|       |	 * 'l' use little-endian byte order for creating a file
  189|       |	 * 'b' use big-endian byte order for creating a file
  190|       |	 * 'L' read/write information using LSB2MSB bit order
  191|       |	 * 'B' read/write information using MSB2LSB bit order
  192|       |	 * 'H' read/write information using host bit order
  193|       |	 * 'M' enable use of memory-mapped files when supported
  194|       |	 * 'm' disable use of memory-mapped files
  195|       |	 * 'C' enable strip chopping support when reading
  196|       |	 * 'c' disable strip chopping support
  197|       |	 * 'h' read TIFF header only, do not load the first IFD
  198|       |	 * '4' ClassicTIFF for creating a file (default)
  199|       |	 * '8' BigTIFF for creating a file
  200|       |         * 'D' enable use of deferred strip/tile offset/bytecount array loading.
  201|       |         * 'O' on-demand loading of values instead of whole array loading (implies D)
  202|       |	 *
  203|       |	 * The use of the 'l' and 'b' flags is strongly discouraged.
  204|       |	 * These flags are provided solely because numerous vendors,
  205|       |	 * typically on the PC, do not correctly support TIFF; they
  206|       |	 * only support the Intel little-endian byte order.  This
  207|       |	 * support is not configured by default because it supports
  208|       |	 * the violation of the TIFF spec that says that readers *MUST*
  209|       |	 * support both byte orders.  It is strongly recommended that
  210|       |	 * you not use this feature except to deal with busted apps
  211|       |	 * that write invalid TIFF.  And even in those cases you should
  212|       |	 * bang on the vendors to fix their software.
  213|       |	 *
  214|       |	 * The 'L', 'B', and 'H' flags are intended for applications
  215|       |	 * that can optimize operations on data by using a particular
  216|       |	 * bit order.  By default the library returns data in MSB2LSB
  217|       |	 * bit order for compatibility with older versions of this
  218|       |	 * library.  Returning data in the bit order of the native CPU
  219|       |	 * makes the most sense but also requires applications to check
  220|       |	 * the value of the FillOrder tag; something they probably do
  221|       |	 * not do right now.
  222|       |	 *
  223|       |	 * The 'M' and 'm' flags are provided because some virtual memory
  224|       |	 * systems exhibit poor behavior when large images are mapped.
  225|       |	 * These options permit clients to control the use of memory-mapped
  226|       |	 * files on a per-file basis.
  227|       |	 *
  228|       |	 * The 'C' and 'c' flags are provided because the library support
  229|       |	 * for chopping up large strips into multiple smaller strips is not
  230|       |	 * application-transparent and as such can cause problems.  The 'c'
  231|       |	 * option permits applications that only want to look at the tags,
  232|       |	 * for example, to get the unadulterated TIFF tag information.
  233|       |	 */
  234|  70.7k|	for (cp = mode; *cp; cp++)
  ------------------
  |  Branch (234:18): [True: 47.1k, False: 23.5k]
  ------------------
  235|  47.1k|		switch (*cp) {
  ------------------
  |  Branch (235:11): [True: 23.5k, False: 23.5k]
  ------------------
  236|      0|			case 'b':
  ------------------
  |  Branch (236:4): [True: 0, False: 47.1k]
  ------------------
  237|      0|				#ifndef WORDS_BIGENDIAN
  238|      0|				if (m&O_CREAT)
  ------------------
  |  Branch (238:9): [True: 0, False: 0]
  ------------------
  239|      0|					tif->tif_flags |= TIFF_SWAB;
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  240|      0|				#endif
  241|      0|				break;
  242|      0|			case 'l':
  ------------------
  |  Branch (242:4): [True: 0, False: 47.1k]
  ------------------
  243|       |				#ifdef WORDS_BIGENDIAN
  244|       |				if ((m&O_CREAT))
  245|       |					tif->tif_flags |= TIFF_SWAB;
  246|       |				#endif
  247|      0|				break;
  248|      0|			case 'B':
  ------------------
  |  Branch (248:4): [True: 0, False: 47.1k]
  ------------------
  249|      0|				tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
  ------------------
  |  |   92|      0|	#define TIFF_FILLORDER   0x00003U /* natural bit fill order for machine */
  ------------------
  250|      0|				    FILLORDER_MSB2LSB;
  ------------------
  |  |  235|      0|#define	    FILLORDER_MSB2LSB		1	/* most significant -> least */
  ------------------
  251|      0|				break;
  252|      0|			case 'L':
  ------------------
  |  Branch (252:4): [True: 0, False: 47.1k]
  ------------------
  253|      0|				tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
  ------------------
  |  |   92|      0|	#define TIFF_FILLORDER   0x00003U /* natural bit fill order for machine */
  ------------------
  254|      0|				    FILLORDER_LSB2MSB;
  ------------------
  |  |  236|      0|#define	    FILLORDER_LSB2MSB		2	/* least significant -> most */
  ------------------
  255|      0|				break;
  256|      0|			case 'H':
  ------------------
  |  Branch (256:4): [True: 0, False: 47.1k]
  ------------------
  257|      0|				tif->tif_flags = (tif->tif_flags &~ TIFF_FILLORDER) |
  ------------------
  |  |   92|      0|	#define TIFF_FILLORDER   0x00003U /* natural bit fill order for machine */
  ------------------
  258|      0|				    HOST_FILLORDER;
  ------------------
  |  |   50|      0|#define HOST_FILLORDER FILLORDER_LSB2MSB
  |  |  ------------------
  |  |  |  |  236|      0|#define	    FILLORDER_LSB2MSB		2	/* least significant -> most */
  |  |  ------------------
  ------------------
  259|      0|				break;
  260|      0|			case 'M':
  ------------------
  |  Branch (260:4): [True: 0, False: 47.1k]
  ------------------
  261|      0|				if (m == O_RDONLY)
  ------------------
  |  Branch (261:9): [True: 0, False: 0]
  ------------------
  262|      0|					tif->tif_flags |= TIFF_MAPPED;
  ------------------
  |  |  102|      0|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  ------------------
  263|      0|				break;
  264|  23.5k|			case 'm':
  ------------------
  |  Branch (264:4): [True: 23.5k, False: 23.5k]
  ------------------
  265|  23.5k|				if (m == O_RDONLY)
  ------------------
  |  Branch (265:9): [True: 23.5k, False: 0]
  ------------------
  266|  23.5k|					tif->tif_flags &= ~TIFF_MAPPED;
  ------------------
  |  |  102|  23.5k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  ------------------
  267|  23.5k|				break;
  268|      0|			case 'C':
  ------------------
  |  Branch (268:4): [True: 0, False: 47.1k]
  ------------------
  269|      0|				if (m == O_RDONLY)
  ------------------
  |  Branch (269:9): [True: 0, False: 0]
  ------------------
  270|      0|					tif->tif_flags |= TIFF_STRIPCHOP;
  ------------------
  |  |  106|      0|	#define TIFF_STRIPCHOP   0x08000U /* enable strip chopping support */
  ------------------
  271|      0|				break;
  272|      0|			case 'c':
  ------------------
  |  Branch (272:4): [True: 0, False: 47.1k]
  ------------------
  273|      0|				if (m == O_RDONLY)
  ------------------
  |  Branch (273:9): [True: 0, False: 0]
  ------------------
  274|      0|					tif->tif_flags &= ~TIFF_STRIPCHOP;
  ------------------
  |  |  106|      0|	#define TIFF_STRIPCHOP   0x08000U /* enable strip chopping support */
  ------------------
  275|      0|				break;
  276|      0|			case 'h':
  ------------------
  |  Branch (276:4): [True: 0, False: 47.1k]
  ------------------
  277|      0|				tif->tif_flags |= TIFF_HEADERONLY;
  ------------------
  |  |  107|      0|	#define TIFF_HEADERONLY  0x10000U /* read header only, do not process the first directory */
  ------------------
  278|      0|				break;
  279|      0|			case '8':
  ------------------
  |  Branch (279:4): [True: 0, False: 47.1k]
  ------------------
  280|      0|				if (m&O_CREAT)
  ------------------
  |  Branch (280:9): [True: 0, False: 0]
  ------------------
  281|      0|					tif->tif_flags |= TIFF_BIGTIFF;
  ------------------
  |  |  110|      0|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  282|      0|				break;
  283|      0|			case 'D':
  ------------------
  |  Branch (283:4): [True: 0, False: 47.1k]
  ------------------
  284|      0|			        tif->tif_flags |= TIFF_DEFERSTRILELOAD;
  ------------------
  |  |  115|      0|        #define TIFF_DEFERSTRILELOAD 0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  285|      0|				break;
  286|      0|			case 'O':
  ------------------
  |  Branch (286:4): [True: 0, False: 47.1k]
  ------------------
  287|      0|				if( m == O_RDONLY )
  ------------------
  |  Branch (287:9): [True: 0, False: 0]
  ------------------
  288|      0|					tif->tif_flags |= (TIFF_LAZYSTRILELOAD | TIFF_DEFERSTRILELOAD);
  ------------------
  |  |  116|      0|        #define TIFF_LAZYSTRILELOAD  0x2000000U /* lazy/ondemand loading of strip/tile offset/bytecount values. Only used if TIFF_DEFERSTRILELOAD is set and in read-only mode */
  ------------------
              					tif->tif_flags |= (TIFF_LAZYSTRILELOAD | TIFF_DEFERSTRILELOAD);
  ------------------
  |  |  115|      0|        #define TIFF_DEFERSTRILELOAD 0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  289|      0|				break;
  290|  47.1k|		}
  291|       |
  292|       |#ifdef DEFER_STRILE_LOAD
  293|       |        /* Compatibility with old DEFER_STRILE_LOAD compilation flag */
  294|       |        /* Probably unneeded, since to the best of my knowledge (E. Rouault) */
  295|       |        /* GDAL was the only user of this, and will now use the new 'D' flag */
  296|       |        tif->tif_flags |= TIFF_DEFERSTRILELOAD;
  297|       |#endif
  298|       |
  299|       |	/*
  300|       |	 * Read in TIFF header.
  301|       |	 */
  302|  23.5k|	if ((m & O_TRUNC) ||
  ------------------
  |  Branch (302:6): [True: 0, False: 23.5k]
  ------------------
  303|  23.5k|	    !ReadOK(tif, &tif->tif_header, sizeof (TIFFHeaderClassic))) {
  ------------------
  |  |  231|  23.5k|	(TIFFReadFile((tif),(buf),(size))==(size))
  |  |  ------------------
  |  |  |  |  212|  23.5k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  |  |  ------------------
  ------------------
  |  Branch (303:6): [True: 6, False: 23.5k]
  ------------------
  304|      6|		if (tif->tif_mode == O_RDONLY) {
  ------------------
  |  Branch (304:7): [True: 6, False: 0]
  ------------------
  305|      6|			TIFFErrorExtR(tif, name,
  306|      6|			    "Cannot read TIFF header");
  307|      6|			goto bad;
  308|      6|		}
  309|       |		/*
  310|       |		 * Setup header and write.
  311|       |		 */
  312|       |		#ifdef WORDS_BIGENDIAN
  313|       |		tif->tif_header.common.tiff_magic = (tif->tif_flags & TIFF_SWAB)
  314|       |		    ? TIFF_LITTLEENDIAN : TIFF_BIGENDIAN;
  315|       |		#else
  316|      0|		tif->tif_header.common.tiff_magic = (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (316:39): [True: 0, False: 0]
  ------------------
  317|      0|		    ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN;
  ------------------
  |  |   51|      0|#define TIFF_BIGENDIAN      0x4d4d
  ------------------
              		    ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN;
  ------------------
  |  |   52|      0|#define TIFF_LITTLEENDIAN   0x4949
  ------------------
  318|      0|		#endif
  319|      0|		if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|      0|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (319:7): [True: 0, False: 0]
  ------------------
  320|      0|		{
  321|      0|			tif->tif_header.common.tiff_version = TIFF_VERSION_CLASSIC;
  ------------------
  |  |   48|      0|#define TIFF_VERSION_CLASSIC 42
  ------------------
  322|      0|			tif->tif_header.classic.tiff_diroff = 0;
  323|      0|			if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (323:8): [True: 0, False: 0]
  ------------------
  324|      0|				TIFFSwabShort(&tif->tif_header.common.tiff_version);
  325|      0|			tif->tif_header_size = sizeof(TIFFHeaderClassic);
  326|      0|		}
  327|      0|		else
  328|      0|		{
  329|      0|			tif->tif_header.common.tiff_version = TIFF_VERSION_BIG;
  ------------------
  |  |   49|      0|#define TIFF_VERSION_BIG 43
  ------------------
  330|      0|			tif->tif_header.big.tiff_offsetsize = 8;
  331|      0|			tif->tif_header.big.tiff_unused = 0;
  332|      0|			tif->tif_header.big.tiff_diroff = 0;
  333|      0|			if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (333:8): [True: 0, False: 0]
  ------------------
  334|      0|			{
  335|      0|				TIFFSwabShort(&tif->tif_header.common.tiff_version);
  336|      0|				TIFFSwabShort(&tif->tif_header.big.tiff_offsetsize);
  337|      0|			}
  338|      0|			tif->tif_header_size = sizeof (TIFFHeaderBig);
  339|      0|		}
  340|       |		/*
  341|       |		 * The doc for "fopen" for some STD_C_LIBs says that if you
  342|       |		 * open a file for modify ("+"), then you must fseek (or
  343|       |		 * fflush?) between any freads and fwrites.  This is not
  344|       |		 * necessary on most systems, but has been shown to be needed
  345|       |		 * on Solaris.
  346|       |		 */
  347|      0|		TIFFSeekFile( tif, 0, SEEK_SET );
  ------------------
  |  |  216|      0|	((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))
  ------------------
  348|      0|		if (!WriteOK(tif, &tif->tif_header, (tmsize_t)(tif->tif_header_size))) {
  ------------------
  |  |  238|      0|	(TIFFWriteFile((tif),(buf),(size))==(size))
  |  |  ------------------
  |  |  |  |  214|      0|	((*(tif)->tif_writeproc)((tif)->tif_clientdata,(buf),(size)))
  |  |  ------------------
  ------------------
  |  Branch (348:7): [True: 0, False: 0]
  ------------------
  349|      0|			TIFFErrorExtR(tif, name,
  350|      0|			    "Error writing TIFF header");
  351|      0|			goto bad;
  352|      0|		}
  353|       |		/*
  354|       |		 * Setup the byte order handling.
  355|       |		 */
  356|      0|		if (tif->tif_header.common.tiff_magic == TIFF_BIGENDIAN) {
  ------------------
  |  |   51|      0|#define TIFF_BIGENDIAN      0x4d4d
  ------------------
  |  Branch (356:7): [True: 0, False: 0]
  ------------------
  357|      0|			#ifndef WORDS_BIGENDIAN
  358|      0|			tif->tif_flags |= TIFF_SWAB;
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  359|      0|			#endif
  360|      0|		} else {
  361|       |			#ifdef WORDS_BIGENDIAN
  362|       |			tif->tif_flags |= TIFF_SWAB;
  363|       |			#endif
  364|      0|		}
  365|       |		/*
  366|       |		 * Setup default directory.
  367|       |		 */
  368|      0|		if (!TIFFDefaultDirectory(tif))
  ------------------
  |  Branch (368:7): [True: 0, False: 0]
  ------------------
  369|      0|			goto bad;
  370|      0|		tif->tif_diroff = 0;
  371|      0|		tif->tif_lastdiroff = 0;
  372|      0|		tif->tif_dirlistoff = NULL;
  373|      0|		tif->tif_dirlistdirn = NULL;
  374|      0|		tif->tif_dirlistsize = 0;
  375|      0|		tif->tif_dirnumber = 0;
  376|      0|		return (tif);
  377|      0|	}
  378|       |	/*
  379|       |	 * Setup the byte order handling.
  380|       |	 */
  381|  23.5k|	if (tif->tif_header.common.tiff_magic != TIFF_BIGENDIAN &&
  ------------------
  |  |   51|  47.1k|#define TIFF_BIGENDIAN      0x4d4d
  ------------------
  |  Branch (381:6): [True: 22.1k, False: 1.44k]
  ------------------
  382|  23.5k|	    tif->tif_header.common.tiff_magic != TIFF_LITTLEENDIAN
  ------------------
  |  |   52|  45.6k|#define TIFF_LITTLEENDIAN   0x4949
  ------------------
  |  Branch (382:6): [True: 84, False: 22.0k]
  ------------------
  383|  23.5k|	    #if MDI_SUPPORT
  384|  23.5k|	    &&
  385|       |	    #if HOST_BIGENDIAN
  386|       |	    tif->tif_header.common.tiff_magic != MDI_BIGENDIAN
  387|       |	    #else
  388|  23.5k|	    tif->tif_header.common.tiff_magic != MDI_LITTLEENDIAN
  ------------------
  |  |   53|     84|#define MDI_LITTLEENDIAN    0x5045
  ------------------
  |  Branch (388:6): [True: 56, False: 28]
  ------------------
  389|  23.5k|	    #endif
  390|  23.5k|	    ) {
  391|     56|		TIFFErrorExtR(tif, name,
  392|     56|		    "Not a TIFF or MDI file, bad magic number %"PRIu16" (0x%"PRIx16")",
  393|       |	    #else
  394|       |	    ) {
  395|       |		TIFFErrorExtR(tif, name,
  396|       |		    "Not a TIFF file, bad magic number %"PRIu16" (0x%"PRIx16")",
  397|       |	    #endif
  398|     56|		    tif->tif_header.common.tiff_magic,
  399|     56|		    tif->tif_header.common.tiff_magic);
  400|     56|		goto bad;
  401|     56|	}
  402|  23.5k|	if (tif->tif_header.common.tiff_magic == TIFF_BIGENDIAN) {
  ------------------
  |  |   51|  23.5k|#define TIFF_BIGENDIAN      0x4d4d
  ------------------
  |  Branch (402:6): [True: 1.44k, False: 22.0k]
  ------------------
  403|  1.44k|		#ifndef WORDS_BIGENDIAN
  404|  1.44k|		tif->tif_flags |= TIFF_SWAB;
  ------------------
  |  |   98|  1.44k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  405|  1.44k|		#endif
  406|  22.0k|	} else {
  407|       |		#ifdef WORDS_BIGENDIAN
  408|       |		tif->tif_flags |= TIFF_SWAB;
  409|       |		#endif
  410|  22.0k|	}
  411|  23.5k|	if (tif->tif_flags & TIFF_SWAB) 
  ------------------
  |  |   98|  23.5k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (411:6): [True: 1.44k, False: 22.0k]
  ------------------
  412|  1.44k|		TIFFSwabShort(&tif->tif_header.common.tiff_version);
  413|  23.5k|	if ((tif->tif_header.common.tiff_version != TIFF_VERSION_CLASSIC)&&
  ------------------
  |  |   48|  23.5k|#define TIFF_VERSION_CLASSIC 42
  ------------------
  |  Branch (413:6): [True: 1.80k, False: 21.7k]
  ------------------
  414|  23.5k|	    (tif->tif_header.common.tiff_version != TIFF_VERSION_BIG)) {
  ------------------
  |  |   49|  1.80k|#define TIFF_VERSION_BIG 43
  ------------------
  |  Branch (414:6): [True: 26, False: 1.77k]
  ------------------
  415|     26|		TIFFErrorExtR(tif, name,
  416|     26|		    "Not a TIFF file, bad version number %"PRIu16" (0x%"PRIx16")",
  417|     26|		    tif->tif_header.common.tiff_version,
  418|     26|		    tif->tif_header.common.tiff_version);
  419|     26|		goto bad;
  420|     26|	}
  421|  23.4k|	if (tif->tif_header.common.tiff_version == TIFF_VERSION_CLASSIC)
  ------------------
  |  |   48|  23.4k|#define TIFF_VERSION_CLASSIC 42
  ------------------
  |  Branch (421:6): [True: 21.7k, False: 1.77k]
  ------------------
  422|  21.7k|	{
  423|  21.7k|		if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |   98|  21.7k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (423:7): [True: 1.37k, False: 20.3k]
  ------------------
  424|  1.37k|			TIFFSwabLong(&tif->tif_header.classic.tiff_diroff);
  425|  21.7k|		tif->tif_header_size = sizeof(TIFFHeaderClassic);
  426|  21.7k|	}
  427|  1.77k|	else
  428|  1.77k|	{
  429|  1.77k|		if (!ReadOK(tif, ((uint8_t*)(&tif->tif_header) + sizeof(TIFFHeaderClassic)), (sizeof(TIFFHeaderBig) - sizeof(TIFFHeaderClassic))))
  ------------------
  |  |  231|  1.77k|	(TIFFReadFile((tif),(buf),(size))==(size))
  |  |  ------------------
  |  |  |  |  212|  1.77k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  |  |  ------------------
  ------------------
  |  Branch (429:7): [True: 5, False: 1.77k]
  ------------------
  430|      5|		{
  431|      5|			TIFFErrorExtR(tif, name,
  432|      5|			    "Cannot read TIFF header");
  433|      5|			goto bad;
  434|      5|		}
  435|  1.77k|		if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |   98|  1.77k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (435:7): [True: 61, False: 1.71k]
  ------------------
  436|     61|		{
  437|     61|			TIFFSwabShort(&tif->tif_header.big.tiff_offsetsize);
  438|     61|			TIFFSwabLong8(&tif->tif_header.big.tiff_diroff);
  439|     61|		}
  440|  1.77k|		if (tif->tif_header.big.tiff_offsetsize != 8)
  ------------------
  |  Branch (440:7): [True: 18, False: 1.75k]
  ------------------
  441|     18|		{
  442|     18|			TIFFErrorExtR(tif, name,
  443|     18|			    "Not a TIFF file, bad BigTIFF offsetsize %"PRIu16" (0x%"PRIx16")",
  444|     18|			    tif->tif_header.big.tiff_offsetsize,
  445|     18|			    tif->tif_header.big.tiff_offsetsize);
  446|     18|			goto bad;
  447|     18|		}
  448|  1.75k|		if (tif->tif_header.big.tiff_unused != 0)
  ------------------
  |  Branch (448:7): [True: 13, False: 1.74k]
  ------------------
  449|     13|		{
  450|     13|			TIFFErrorExtR(tif, name,
  451|     13|			    "Not a TIFF file, bad BigTIFF unused %"PRIu16" (0x%"PRIx16")",
  452|     13|			    tif->tif_header.big.tiff_unused,
  453|     13|			    tif->tif_header.big.tiff_unused);
  454|     13|			goto bad;
  455|     13|		}
  456|  1.74k|		tif->tif_header_size = sizeof(TIFFHeaderBig);
  457|  1.74k|		tif->tif_flags |= TIFF_BIGTIFF;
  ------------------
  |  |  110|  1.74k|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  458|  1.74k|	}
  459|  23.4k|	tif->tif_flags |= TIFF_MYBUFFER;
  ------------------
  |  |  100|  23.4k|	#define TIFF_MYBUFFER    0x00200U /* my raw data buffer; free on close */
  ------------------
  460|  23.4k|	tif->tif_rawcp = tif->tif_rawdata = 0;
  461|  23.4k|	tif->tif_rawdatasize = 0;
  462|  23.4k|        tif->tif_rawdataoff = 0;
  463|  23.4k|        tif->tif_rawdataloaded = 0;
  464|       |
  465|  23.4k|	switch (mode[0]) {
  ------------------
  |  Branch (465:10): [True: 0, False: 23.4k]
  ------------------
  466|  23.4k|		case 'r':
  ------------------
  |  Branch (466:3): [True: 23.4k, False: 0]
  ------------------
  467|  23.4k|			if (!(tif->tif_flags&TIFF_BIGTIFF))
  ------------------
  |  |  110|  23.4k|	#define TIFF_BIGTIFF     0x80000U /* read/write bigtiff */
  ------------------
  |  Branch (467:8): [True: 21.7k, False: 1.74k]
  ------------------
  468|  21.7k|				tif->tif_nextdiroff = tif->tif_header.classic.tiff_diroff;
  469|  1.74k|			else
  470|  1.74k|				tif->tif_nextdiroff = tif->tif_header.big.tiff_diroff;
  471|       |			/*
  472|       |			 * Try to use a memory-mapped file if the client
  473|       |			 * has not explicitly suppressed usage with the
  474|       |			 * 'm' flag in the open mode (see above).
  475|       |			 */
  476|  23.4k|			if (tif->tif_flags & TIFF_MAPPED)
  ------------------
  |  |  102|  23.4k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  ------------------
  |  Branch (476:8): [True: 0, False: 23.4k]
  ------------------
  477|      0|			{
  478|      0|				toff_t n;
  479|      0|				if (TIFFMapFileContents(tif,(void**)(&tif->tif_base),&n))
  ------------------
  |  |  222|      0|	((*(tif)->tif_mapproc)((tif)->tif_clientdata,(paddr),(psize)))
  |  |  ------------------
  |  |  |  Branch (222:2): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  480|      0|				{
  481|      0|					tif->tif_size=(tmsize_t)n;
  482|      0|					assert((toff_t)tif->tif_size==n);
  483|      0|				}
  484|      0|				else
  485|      0|					tif->tif_flags &= ~TIFF_MAPPED;
  ------------------
  |  |  102|      0|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  ------------------
  486|      0|			}
  487|       |			/*
  488|       |			 * Sometimes we do not want to read the first directory (for example,
  489|       |			 * it may be broken) and want to proceed to other directories. I this
  490|       |			 * case we use the TIFF_HEADERONLY flag to open file and return
  491|       |			 * immediately after reading TIFF header.
  492|       |			 */
  493|  23.4k|			if (tif->tif_flags & TIFF_HEADERONLY)
  ------------------
  |  |  107|  23.4k|	#define TIFF_HEADERONLY  0x10000U /* read header only, do not process the first directory */
  ------------------
  |  Branch (493:8): [True: 0, False: 23.4k]
  ------------------
  494|      0|				return (tif);
  495|       |
  496|       |			/*
  497|       |			 * Setup initial directory.
  498|       |			 */
  499|  23.4k|			if (TIFFReadDirectory(tif)) {
  ------------------
  |  Branch (499:8): [True: 13.2k, False: 10.1k]
  ------------------
  500|  13.2k|				return (tif);
  501|  13.2k|			}
  502|  10.1k|			break;
  503|  10.1k|		case 'a':
  ------------------
  |  Branch (503:3): [True: 0, False: 23.4k]
  ------------------
  504|       |			/*
  505|       |			 * New directories are automatically append
  506|       |			 * to the end of the directory chain when they
  507|       |			 * are written out (see TIFFWriteDirectory).
  508|       |			 */
  509|      0|			if (!TIFFDefaultDirectory(tif))
  ------------------
  |  Branch (509:8): [True: 0, False: 0]
  ------------------
  510|      0|				goto bad;
  511|      0|			return (tif);
  512|  23.4k|	}
  513|  10.3k|bad:
  514|  10.3k|	tif->tif_mode = O_RDONLY;	/* XXX avoid flush */
  515|  10.3k|        TIFFCleanup(tif);
  516|  10.3k|bad2:
  517|  10.3k|	return ((TIFF*)0);
  518|  10.3k|}
TIFFFileName:
  529|  1.44k|{
  530|  1.44k|	return (tif->tif_name);
  531|  1.44k|}
TIFFIsTiled:
  610|  12.0k|{
  611|  12.0k|	return (isTiled(tif));
  ------------------
  |  |  207|  12.0k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  12.0k|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  612|  12.0k|}

TIFFInitPackBits:
  282|    200|{
  283|    200|	(void) scheme;
  284|    200|	tif->tif_decoderow = PackBitsDecode;
  285|    200|	tif->tif_decodestrip = PackBitsDecode;
  286|    200|	tif->tif_decodetile = PackBitsDecode;
  287|    200|	tif->tif_preencode = PackBitsPreEncode;
  288|    200|	tif->tif_postencode = PackBitsPostEncode;
  289|    200|	tif->tif_encoderow = PackBitsEncode;
  290|    200|	tif->tif_encodestrip = PackBitsEncodeChunk;
  291|    200|	tif->tif_encodetile = PackBitsEncodeChunk;
  292|    200|	return (1);
  293|    200|}
tif_packbits.c:PackBitsDecode:
  215|  2.34k|{
  216|  2.34k|	static const char module[] = "PackBitsDecode";
  217|  2.34k|	int8_t *bp;
  218|  2.34k|	tmsize_t cc;
  219|  2.34k|	long n;
  220|  2.34k|	int b;
  221|       |
  222|  2.34k|	(void) s;
  223|  2.34k|	bp = (int8_t*) tif->tif_rawcp;
  224|  2.34k|	cc = tif->tif_rawcc;
  225|   374k|	while (cc > 0 && occ > 0) {
  ------------------
  |  Branch (225:9): [True: 373k, False: 370]
  |  Branch (225:19): [True: 373k, False: 272]
  ------------------
  226|   373k|		n = (long) *bp++;
  227|   373k|		cc--;
  228|   373k|		if (n < 0) {		/* replicate next byte -n+1 times */
  ------------------
  |  Branch (228:7): [True: 100k, False: 272k]
  ------------------
  229|   100k|			if (n == -128)	/* nop */
  ------------------
  |  Branch (229:8): [True: 4.15k, False: 96.7k]
  ------------------
  230|  4.15k|				continue;
  231|  96.7k|			n = -n + 1;
  232|  96.7k|			if( occ < (tmsize_t)n )
  ------------------
  |  Branch (232:8): [True: 235, False: 96.5k]
  ------------------
  233|    235|			{
  234|    235|				TIFFWarningExtR(tif, module,
  235|    235|				    "Discarding %"TIFF_SSIZE_FORMAT" bytes to avoid buffer overrun",
  236|    235|				    (tmsize_t)n - occ);
  237|    235|				n = (long)occ;
  238|    235|			}
  239|  96.7k|			if( cc == 0 )
  ------------------
  |  Branch (239:8): [True: 377, False: 96.3k]
  ------------------
  240|    377|			{
  241|    377|				TIFFWarningExtR(tif, module,
  242|    377|					       "Terminating PackBitsDecode due to lack of data.");
  243|    377|				break;
  244|    377|			}
  245|  96.3k|			occ -= n;
  246|  96.3k|			b = *bp++;
  247|  96.3k|			cc--;
  248|  2.44M|			while (n-- > 0)
  ------------------
  |  Branch (248:11): [True: 2.34M, False: 96.3k]
  ------------------
  249|  2.34M|				*op++ = (uint8_t) b;
  250|   272k|		} else {		/* copy next n+1 bytes literally */
  251|   272k|			if (occ < (tmsize_t)(n + 1))
  ------------------
  |  Branch (251:8): [True: 253, False: 272k]
  ------------------
  252|    253|			{
  253|    253|				TIFFWarningExtR(tif, module,
  254|    253|				    "Discarding %"TIFF_SSIZE_FORMAT" bytes to avoid buffer overrun",
  255|    253|				    (tmsize_t)n - occ + 1);
  256|    253|				n = (long)occ - 1;
  257|    253|			}
  258|   272k|			if (cc < (tmsize_t) (n+1)) 
  ------------------
  |  Branch (258:8): [True: 1.32k, False: 271k]
  ------------------
  259|  1.32k|			{
  260|  1.32k|				TIFFWarningExtR(tif, module,
  261|  1.32k|					       "Terminating PackBitsDecode due to lack of data.");
  262|  1.32k|				break;
  263|  1.32k|			}
  264|   271k|			_TIFFmemcpy(op, bp, ++n);
  265|   271k|			op += n; occ -= n;
  266|   271k|			bp += n; cc -= n;
  267|   271k|		}
  268|   373k|	}
  269|  2.34k|	tif->tif_rawcp = (uint8_t*) bp;
  270|  2.34k|	tif->tif_rawcc = cc;
  271|  2.34k|	if (occ > 0) {
  ------------------
  |  Branch (271:6): [True: 1.97k, False: 375]
  ------------------
  272|  1.97k|		TIFFErrorExtR(tif, module,
  273|  1.97k|		    "Not enough data for scanline %"PRIu32,
  274|  1.97k|		    tif->tif_row);
  275|  1.97k|		return (0);
  276|  1.97k|	}
  277|    375|	return (1);
  278|  2.34k|}

TIFFInitPixarLog:
 1398|    582|{
 1399|    582|	static const char module[] = "TIFFInitPixarLog";
 1400|       |
 1401|    582|	PixarLogState* sp;
 1402|       |
 1403|    582|        (void)scheme;
 1404|    582|	assert(scheme == COMPRESSION_PIXARLOG);
 1405|       |
 1406|       |	/*
 1407|       |	 * Merge codec-specific tag information.
 1408|       |	 */
 1409|    582|	if (!_TIFFMergeFields(tif, pixarlogFields,
  ------------------
  |  Branch (1409:6): [True: 0, False: 582]
  ------------------
 1410|    582|			      TIFFArrayCount(pixarlogFields))) {
  ------------------
  |  |  261|    582|#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
  ------------------
 1411|      0|		TIFFErrorExtR(tif, module,
 1412|      0|			     "Merging PixarLog codec-specific tags failed");
 1413|      0|		return 0;
 1414|      0|	}
 1415|       |
 1416|       |	/*
 1417|       |	 * Allocate state block so tag methods have storage to record values.
 1418|       |	 */
 1419|    582|	tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof (PixarLogState));
 1420|    582|	if (tif->tif_data == NULL)
  ------------------
  |  Branch (1420:6): [True: 0, False: 582]
  ------------------
 1421|      0|		goto bad;
 1422|    582|	sp = (PixarLogState*) tif->tif_data;
 1423|    582|	_TIFFmemset(sp, 0, sizeof (*sp));
 1424|    582|	sp->stream.data_type = Z_BINARY;
 1425|    582|	sp->user_datafmt = PIXARLOGDATAFMT_UNKNOWN;
  ------------------
  |  |  600|    582|#define PIXARLOGDATAFMT_UNKNOWN	-1
  ------------------
 1426|       |
 1427|       |	/*
 1428|       |	 * Install codec methods.
 1429|       |	 */
 1430|    582|	tif->tif_fixuptags = PixarLogFixupTags; 
 1431|    582|	tif->tif_setupdecode = PixarLogSetupDecode;
 1432|    582|	tif->tif_predecode = PixarLogPreDecode;
 1433|    582|	tif->tif_decoderow = PixarLogDecode;
 1434|    582|	tif->tif_decodestrip = PixarLogDecode;  
 1435|    582|	tif->tif_decodetile = PixarLogDecode;
 1436|    582|	tif->tif_setupencode = PixarLogSetupEncode;
 1437|    582|	tif->tif_preencode = PixarLogPreEncode;
 1438|    582|	tif->tif_postencode = PixarLogPostEncode;
 1439|    582|	tif->tif_encoderow = PixarLogEncode;  
 1440|    582|	tif->tif_encodestrip = PixarLogEncode;
 1441|    582|	tif->tif_encodetile = PixarLogEncode;  
 1442|    582|	tif->tif_close = PixarLogClose;
 1443|    582|	tif->tif_cleanup = PixarLogCleanup;
 1444|       |
 1445|       |	/* Override SetField so we can handle our private pseudo-tag */
 1446|    582|	sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1447|    582|	tif->tif_tagmethods.vgetfield = PixarLogVGetField;   /* hook for codec tags */
 1448|    582|	sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1449|    582|	tif->tif_tagmethods.vsetfield = PixarLogVSetField;   /* hook for codec tags */
 1450|       |
 1451|       |	/* Default values for codec-specific fields */
 1452|    582|	sp->quality = Z_DEFAULT_COMPRESSION; /* default comp. level */
 1453|    582|	sp->state = 0;
 1454|       |
 1455|       |	/* we don't wish to use the predictor, 
 1456|       |	 * the default is none, which predictor value 1
 1457|       |	 */
 1458|    582|	(void) TIFFPredictorInit(tif);
 1459|       |
 1460|       |	/*
 1461|       |	 * build the companding tables 
 1462|       |	 */
 1463|    582|	PixarLogMakeTables(sp);
 1464|       |
 1465|    582|	return (1);
 1466|      0|bad:
 1467|      0|	TIFFErrorExtR(tif, module,
 1468|      0|		     "No space for PixarLog state block");
 1469|      0|	return (0);
 1470|    582|}
tif_pixarlog.c:PixarLogFixupTags:
  658|    525|{
  659|    525|	(void) tif;
  660|    525|	return (1);
  661|    525|}
tif_pixarlog.c:PixarLogSetupDecode:
  665|    518|{
  666|    518|	static const char module[] = "PixarLogSetupDecode";
  667|    518|	TIFFDirectory *td = &tif->tif_dir;
  668|    518|	PixarLogState* sp = DecoderState(tif);
  ------------------
  |  |  594|    518|#define DecoderState(tif)	((PixarLogState*) (tif)->tif_data)
  ------------------
  669|    518|	tmsize_t tbuf_size;
  670|    518|        uint32_t strip_height;
  671|       |
  672|    518|	assert(sp != NULL);
  673|       |
  674|       |	/* This function can possibly be called several times by */
  675|       |	/* PredictorSetupDecode() if this function succeeds but */
  676|       |	/* PredictorSetup() fails */
  677|    518|	if( (sp->state & PLSTATE_INIT) != 0 )
  ------------------
  |  |  466|    518|#define PLSTATE_INIT 1
  ------------------
  |  Branch (677:6): [True: 0, False: 518]
  ------------------
  678|      0|		return 1;
  679|       |
  680|    518|        strip_height = td->td_rowsperstrip;
  681|    518|        if( strip_height > td->td_imagelength )
  ------------------
  |  Branch (681:13): [True: 443, False: 75]
  ------------------
  682|    443|            strip_height = td->td_imagelength;
  683|       |
  684|       |	/* Make sure no byte swapping happens on the data
  685|       |	 * after decompression. */
  686|    518|	tif->tif_postdecode = _TIFFNoPostDecode;  
  687|       |
  688|       |	/* for some reason, we can't do this in TIFFInitPixarLog */
  689|       |
  690|    518|	sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?
  ------------------
  |  |  259|    518|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (690:16): [True: 451, False: 67]
  ------------------
  691|    451|	    td->td_samplesperpixel : 1);
  692|    518|	tbuf_size = multiply_ms(multiply_ms(multiply_ms(sp->stride, td->td_imagewidth),
  693|    518|				      strip_height), sizeof(uint16_t));
  694|       |	/* add one more stride in case input ends mid-stride */
  695|    518|	tbuf_size = add_ms(tbuf_size, sizeof(uint16_t) * sp->stride);
  696|    518|	if (tbuf_size == 0)
  ------------------
  |  Branch (696:6): [True: 0, False: 518]
  ------------------
  697|      0|		return (0);   /* TODO: this is an error return without error report through TIFFErrorExt */
  698|    518|	sp->tbuf = (uint16_t *) _TIFFmalloc(tbuf_size);
  699|    518|	if (sp->tbuf == NULL)
  ------------------
  |  Branch (699:6): [True: 0, False: 518]
  ------------------
  700|      0|		return (0);
  701|    518|	sp->tbuf_size = tbuf_size;
  702|    518|	if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
  ------------------
  |  |  600|    518|#define PIXARLOGDATAFMT_UNKNOWN	-1
  ------------------
  |  Branch (702:6): [True: 518, False: 0]
  ------------------
  703|    518|		sp->user_datafmt = PixarLogGuessDataFmt(td);
  704|    518|	if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN) {
  ------------------
  |  |  600|    518|#define PIXARLOGDATAFMT_UNKNOWN	-1
  ------------------
  |  Branch (704:6): [True: 10, False: 508]
  ------------------
  705|     10|                _TIFFfree(sp->tbuf);
  706|     10|                sp->tbuf = NULL;
  707|     10|                sp->tbuf_size = 0;
  708|     10|		TIFFErrorExtR(tif, module,
  709|     10|			"PixarLog compression can't handle bits depth/data format combination (depth: %"PRIu16")",
  710|     10|			td->td_bitspersample);
  711|     10|		return (0);
  712|     10|	}
  713|       |
  714|    508|	if (inflateInit(&sp->stream) != Z_OK) {
  ------------------
  |  Branch (714:6): [True: 0, False: 508]
  ------------------
  715|      0|                _TIFFfree(sp->tbuf);
  716|      0|                sp->tbuf = NULL;
  717|      0|                sp->tbuf_size = 0;
  718|      0|		TIFFErrorExtR(tif, module, "%s", sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (718:36): [True: 0, False: 0]
  ------------------
  719|      0|		return (0);
  720|    508|	} else {
  721|    508|		sp->state |= PLSTATE_INIT;
  ------------------
  |  |  466|    508|#define PLSTATE_INIT 1
  ------------------
  722|    508|		return (1);
  723|    508|	}
  724|    508|}
tif_pixarlog.c:multiply_ms:
  639|  1.55k|{
  640|  1.55k|        return _TIFFMultiplySSize(NULL, m1, m2, NULL);
  641|  1.55k|}
tif_pixarlog.c:add_ms:
  645|    518|{
  646|    518|        assert(m1 >= 0 && m2 >= 0);
  647|       |	/* if either input is zero, assume overflow already occurred */
  648|    518|	if (m1 == 0 || m2 == 0)
  ------------------
  |  Branch (648:6): [True: 0, False: 518]
  |  Branch (648:17): [True: 0, False: 518]
  ------------------
  649|      0|		return 0;
  650|    518|	else if (m1 > TIFF_TMSIZE_T_MAX - m2)
  ------------------
  |  |   66|    518|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (650:11): [True: 0, False: 518]
  ------------------
  651|      0|		return 0;
  652|       |
  653|    518|	return m1 + m2;
  654|    518|}
tif_pixarlog.c:PixarLogGuessDataFmt:
  604|    518|{
  605|    518|	int guess = PIXARLOGDATAFMT_UNKNOWN;
  ------------------
  |  |  600|    518|#define PIXARLOGDATAFMT_UNKNOWN	-1
  ------------------
  606|    518|	int format = td->td_sampleformat;
  607|       |
  608|       |	/* If the user didn't tell us his datafmt,
  609|       |	 * take our best guess from the bitspersample.
  610|       |	 */
  611|    518|	switch (td->td_bitspersample) {
  ------------------
  |  Branch (611:10): [True: 8, False: 510]
  ------------------
  612|      0|	 case 32:
  ------------------
  |  Branch (612:3): [True: 0, False: 518]
  ------------------
  613|      0|		if (format == SAMPLEFORMAT_IEEEFP)
  ------------------
  |  |  330|      0|#define	    SAMPLEFORMAT_IEEEFP		3	/* !IEEE floating point data */
  ------------------
  |  Branch (613:7): [True: 0, False: 0]
  ------------------
  614|      0|			guess = PIXARLOGDATAFMT_FLOAT;
  ------------------
  |  |  630|      0|#define	    PIXARLOGDATAFMT_FLOAT	5	/* IEEE float samples */
  ------------------
  615|      0|		break;
  616|    194|	 case 16:
  ------------------
  |  Branch (616:3): [True: 194, False: 324]
  ------------------
  617|    194|		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  331|    388|#define	    SAMPLEFORMAT_VOID		4	/* !untyped data */
  ------------------
              		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  328|    191|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
  |  Branch (617:7): [True: 3, False: 191]
  |  Branch (617:38): [True: 190, False: 1]
  ------------------
  618|    193|			guess = PIXARLOGDATAFMT_16BIT;
  ------------------
  |  |  629|    193|#define	    PIXARLOGDATAFMT_16BIT	4	/* signed short samples */
  ------------------
  619|    194|		break;
  620|      0|	 case 12:
  ------------------
  |  Branch (620:3): [True: 0, False: 518]
  ------------------
  621|      0|		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_INT)
  ------------------
  |  |  331|      0|#define	    SAMPLEFORMAT_VOID		4	/* !untyped data */
  ------------------
              		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_INT)
  ------------------
  |  |  329|      0|#define	    SAMPLEFORMAT_INT		2	/* !signed integer data */
  ------------------
  |  Branch (621:7): [True: 0, False: 0]
  |  Branch (621:38): [True: 0, False: 0]
  ------------------
  622|      0|			guess = PIXARLOGDATAFMT_12BITPICIO;
  ------------------
  |  |  628|      0|#define	    PIXARLOGDATAFMT_12BITPICIO	3	/* as per PICIO (1.0==2048) */
  ------------------
  623|      0|		break;
  624|      0|	 case 11:
  ------------------
  |  Branch (624:3): [True: 0, False: 518]
  ------------------
  625|      0|		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  331|      0|#define	    SAMPLEFORMAT_VOID		4	/* !untyped data */
  ------------------
              		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  328|      0|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
  |  Branch (625:7): [True: 0, False: 0]
  |  Branch (625:38): [True: 0, False: 0]
  ------------------
  626|      0|			guess = PIXARLOGDATAFMT_11BITLOG;
  ------------------
  |  |  627|      0|#define	    PIXARLOGDATAFMT_11BITLOG	2	/* 11-bit log-encoded (raw) */
  ------------------
  627|      0|		break;
  628|    316|	 case 8:
  ------------------
  |  Branch (628:3): [True: 316, False: 202]
  ------------------
  629|    316|		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  331|    632|#define	    SAMPLEFORMAT_VOID		4	/* !untyped data */
  ------------------
              		if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  328|    315|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
  |  Branch (629:7): [True: 1, False: 315]
  |  Branch (629:38): [True: 314, False: 1]
  ------------------
  630|    315|			guess = PIXARLOGDATAFMT_8BIT;
  ------------------
  |  |  625|    315|#define	    PIXARLOGDATAFMT_8BIT	0	/* regular u_char samples */
  ------------------
  631|    316|		break;
  632|    518|	}
  633|       |
  634|    518|	return guess;
  635|    518|}
tif_pixarlog.c:PixarLogPreDecode:
  731|  19.1k|{
  732|  19.1k|	static const char module[] = "PixarLogPreDecode";
  733|  19.1k|	PixarLogState* sp = DecoderState(tif);
  ------------------
  |  |  594|  19.1k|#define DecoderState(tif)	((PixarLogState*) (tif)->tif_data)
  ------------------
  734|       |
  735|  19.1k|	(void) s;
  736|  19.1k|	assert(sp != NULL);
  737|  19.1k|	sp->stream.next_in = tif->tif_rawdata;
  738|  19.1k|	assert(sizeof(sp->stream.avail_in)==4);  /* if this assert gets raised,
  739|       |	    we need to simplify this code to reflect a ZLib that is likely updated
  740|       |	    to deal with 8byte memory sizes, though this code will respond
  741|       |	    appropriately even before we simplify it */
  742|  19.1k|	sp->stream.avail_in = (uInt) tif->tif_rawcc;
  743|  19.1k|	if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc)
  ------------------
  |  Branch (743:6): [True: 0, False: 19.1k]
  ------------------
  744|      0|	{
  745|      0|		TIFFErrorExtR(tif, module, "ZLib cannot deal with buffers this size");
  746|      0|		return (0);
  747|      0|	}
  748|  19.1k|	return (inflateReset(&sp->stream) == Z_OK);
  749|  19.1k|}
tif_pixarlog.c:PixarLogDecode:
  753|  19.1k|{
  754|  19.1k|	static const char module[] = "PixarLogDecode";
  755|  19.1k|	TIFFDirectory *td = &tif->tif_dir;
  756|  19.1k|	PixarLogState* sp = DecoderState(tif);
  ------------------
  |  |  594|  19.1k|#define DecoderState(tif)	((PixarLogState*) (tif)->tif_data)
  ------------------
  757|  19.1k|	tmsize_t i;
  758|  19.1k|	tmsize_t nsamples;
  759|  19.1k|	int llen;
  760|  19.1k|	uint16_t *up;
  761|       |
  762|  19.1k|	switch (sp->user_datafmt) {
  763|      0|	case PIXARLOGDATAFMT_FLOAT:
  ------------------
  |  |  630|      0|#define	    PIXARLOGDATAFMT_FLOAT	5	/* IEEE float samples */
  ------------------
  |  Branch (763:2): [True: 0, False: 19.1k]
  ------------------
  764|      0|		nsamples = occ / sizeof(float);	/* XXX float == 32 bits */
  765|      0|		break;
  766|  10.3k|	case PIXARLOGDATAFMT_16BIT:
  ------------------
  |  |  629|  10.3k|#define	    PIXARLOGDATAFMT_16BIT	4	/* signed short samples */
  ------------------
  |  Branch (766:2): [True: 10.3k, False: 8.72k]
  ------------------
  767|  10.3k|	case PIXARLOGDATAFMT_12BITPICIO:
  ------------------
  |  |  628|  10.3k|#define	    PIXARLOGDATAFMT_12BITPICIO	3	/* as per PICIO (1.0==2048) */
  ------------------
  |  Branch (767:2): [True: 0, False: 19.1k]
  ------------------
  768|  10.3k|	case PIXARLOGDATAFMT_11BITLOG:
  ------------------
  |  |  627|  10.3k|#define	    PIXARLOGDATAFMT_11BITLOG	2	/* 11-bit log-encoded (raw) */
  ------------------
  |  Branch (768:2): [True: 0, False: 19.1k]
  ------------------
  769|  10.3k|		nsamples = occ / sizeof(uint16_t); /* XXX uint16_t == 16 bits */
  770|  10.3k|		break;
  771|  8.72k|	case PIXARLOGDATAFMT_8BIT:
  ------------------
  |  |  625|  8.72k|#define	    PIXARLOGDATAFMT_8BIT	0	/* regular u_char samples */
  ------------------
  |  Branch (771:2): [True: 8.72k, False: 10.3k]
  ------------------
  772|  8.72k|	case PIXARLOGDATAFMT_8BITABGR:
  ------------------
  |  |  626|  8.72k|#define	    PIXARLOGDATAFMT_8BITABGR	1	/* ABGR-order u_chars */
  ------------------
  |  Branch (772:2): [True: 0, False: 19.1k]
  ------------------
  773|  8.72k|		nsamples = occ;
  774|  8.72k|		break;
  775|      0|	default:
  ------------------
  |  Branch (775:2): [True: 0, False: 19.1k]
  ------------------
  776|      0|		TIFFErrorExtR(tif, module,
  777|      0|			"%"PRIu16" bit input not supported in PixarLog",
  778|      0|			td->td_bitspersample);
  779|      0|		return 0;
  780|  19.1k|	}
  781|       |
  782|  19.1k|	llen = sp->stride * td->td_imagewidth;
  783|       |
  784|  19.1k|	(void) s;
  785|  19.1k|	assert(sp != NULL);
  786|       |
  787|  19.1k|        sp->stream.next_in = tif->tif_rawcp;
  788|  19.1k|	sp->stream.avail_in = (uInt) tif->tif_rawcc;
  789|       |
  790|  19.1k|	sp->stream.next_out = (unsigned char *) sp->tbuf;
  791|  19.1k|	assert(sizeof(sp->stream.avail_out)==4);  /* if this assert gets raised,
  792|       |	    we need to simplify this code to reflect a ZLib that is likely updated
  793|       |	    to deal with 8byte memory sizes, though this code will respond
  794|       |	    appropriately even before we simplify it */
  795|  19.1k|	sp->stream.avail_out = (uInt) (nsamples * sizeof(uint16_t));
  796|  19.1k|	if (sp->stream.avail_out != nsamples * sizeof(uint16_t))
  ------------------
  |  Branch (796:6): [True: 0, False: 19.1k]
  ------------------
  797|      0|	{
  798|      0|		TIFFErrorExtR(tif, module, "ZLib cannot deal with buffers this size");
  799|      0|		return (0);
  800|      0|	}
  801|       |	/* Check that we will not fill more than what was allocated */
  802|  19.1k|	if ((tmsize_t)sp->stream.avail_out > sp->tbuf_size)
  ------------------
  |  Branch (802:6): [True: 724, False: 18.3k]
  ------------------
  803|    724|	{
  804|    724|		TIFFErrorExtR(tif, module, "sp->stream.avail_out > sp->tbuf_size");
  805|    724|		return (0);
  806|    724|	}
  807|  22.1k|	do {
  808|  22.1k|		int state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
  809|  22.1k|		if (state == Z_STREAM_END) {
  ------------------
  |  Branch (809:7): [True: 220, False: 21.9k]
  ------------------
  810|    220|			break;			/* XXX */
  811|    220|		}
  812|  21.9k|		if (state == Z_DATA_ERROR) {
  ------------------
  |  Branch (812:7): [True: 12.2k, False: 9.63k]
  ------------------
  813|  12.2k|			TIFFErrorExtR(tif, module,
  814|  12.2k|			    "Decoding error at scanline %"PRIu32", %s",
  815|  12.2k|			    tif->tif_row, sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (815:22): [True: 12.2k, False: 0]
  ------------------
  816|  12.2k|			return (0);
  817|  12.2k|		}
  818|  9.63k|		if (state != Z_OK) {
  ------------------
  |  Branch (818:7): [True: 3.73k, False: 5.90k]
  ------------------
  819|  3.73k|			TIFFErrorExtR(tif, module, "ZLib error: %s",
  820|  3.73k|			    sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (820:8): [True: 0, False: 3.73k]
  ------------------
  821|  3.73k|			return (0);
  822|  3.73k|		}
  823|  9.63k|	} while (sp->stream.avail_out > 0);
  ------------------
  |  Branch (823:11): [True: 3.72k, False: 2.18k]
  ------------------
  824|       |
  825|       |	/* hopefully, we got all the bytes we needed */
  826|  2.40k|	if (sp->stream.avail_out != 0) {
  ------------------
  |  Branch (826:6): [True: 220, False: 2.18k]
  ------------------
  827|    220|		TIFFErrorExtR(tif, module,
  828|    220|		    "Not enough data at scanline %"PRIu32" (short %u bytes)",
  829|    220|		    tif->tif_row, sp->stream.avail_out);
  830|    220|		return (0);
  831|    220|	}
  832|       |
  833|  2.18k|        tif->tif_rawcp = sp->stream.next_in;
  834|  2.18k|        tif->tif_rawcc = sp->stream.avail_in;
  835|       |
  836|  2.18k|	up = sp->tbuf;
  837|       |	/* Swap bytes in the data if from a different endian machine. */
  838|  2.18k|	if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |   98|  2.18k|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (838:6): [True: 0, False: 2.18k]
  ------------------
  839|      0|		TIFFSwabArrayOfShort(up, nsamples);
  840|       |
  841|       |	/*
  842|       |	 * if llen is not an exact multiple of nsamples, the decode operation
  843|       |	 * may overflow the output buffer, so truncate it enough to prevent
  844|       |	 * that but still salvage as much data as possible.
  845|       |	 */
  846|  2.18k|	if (nsamples % llen) { 
  ------------------
  |  Branch (846:6): [True: 277, False: 1.90k]
  ------------------
  847|    277|		TIFFWarningExtR(tif, module,
  848|    277|			"stride %d is not a multiple of sample count, "
  849|    277|            "%"TIFF_SSIZE_FORMAT", data truncated.", llen, nsamples);
  850|    277|		nsamples -= nsamples % llen;
  851|    277|	}
  852|       |
  853|  26.5k|	for (i = 0; i < nsamples; i += llen, up += llen) {
  ------------------
  |  Branch (853:14): [True: 24.3k, False: 2.18k]
  ------------------
  854|  24.3k|		switch (sp->user_datafmt)  {
  855|      0|		case PIXARLOGDATAFMT_FLOAT:
  ------------------
  |  |  630|      0|#define	    PIXARLOGDATAFMT_FLOAT	5	/* IEEE float samples */
  ------------------
  |  Branch (855:3): [True: 0, False: 24.3k]
  ------------------
  856|      0|			horizontalAccumulateF(up, llen, sp->stride,
  857|      0|					(float *)op, sp->ToLinearF);
  858|      0|			op += llen * sizeof(float);
  859|      0|			break;
  860|  5.48k|		case PIXARLOGDATAFMT_16BIT:
  ------------------
  |  |  629|  5.48k|#define	    PIXARLOGDATAFMT_16BIT	4	/* signed short samples */
  ------------------
  |  Branch (860:3): [True: 5.48k, False: 18.9k]
  ------------------
  861|  5.48k|			horizontalAccumulate16(up, llen, sp->stride,
  862|  5.48k|                                   (uint16_t *)op, sp->ToLinear16);
  863|  5.48k|			op += llen * sizeof(uint16_t);
  864|  5.48k|			break;
  865|      0|		case PIXARLOGDATAFMT_12BITPICIO:
  ------------------
  |  |  628|      0|#define	    PIXARLOGDATAFMT_12BITPICIO	3	/* as per PICIO (1.0==2048) */
  ------------------
  |  Branch (865:3): [True: 0, False: 24.3k]
  ------------------
  866|      0|			horizontalAccumulate12(up, llen, sp->stride,
  867|      0|                                   (int16_t *)op, sp->ToLinearF);
  868|      0|			op += llen * sizeof(int16_t);
  869|      0|			break;
  870|      0|		case PIXARLOGDATAFMT_11BITLOG:
  ------------------
  |  |  627|      0|#define	    PIXARLOGDATAFMT_11BITLOG	2	/* 11-bit log-encoded (raw) */
  ------------------
  |  Branch (870:3): [True: 0, False: 24.3k]
  ------------------
  871|      0|			horizontalAccumulate11(up, llen, sp->stride,
  872|      0|					(uint16_t *)op);
  873|      0|			op += llen * sizeof(uint16_t);
  874|      0|			break;
  875|  18.9k|		case PIXARLOGDATAFMT_8BIT:
  ------------------
  |  |  625|  18.9k|#define	    PIXARLOGDATAFMT_8BIT	0	/* regular u_char samples */
  ------------------
  |  Branch (875:3): [True: 18.9k, False: 5.48k]
  ------------------
  876|  18.9k|			horizontalAccumulate8(up, llen, sp->stride,
  877|  18.9k|					(unsigned char *)op, sp->ToLinear8);
  878|  18.9k|			op += llen * sizeof(unsigned char);
  879|  18.9k|			break;
  880|      0|		case PIXARLOGDATAFMT_8BITABGR:
  ------------------
  |  |  626|      0|#define	    PIXARLOGDATAFMT_8BITABGR	1	/* ABGR-order u_chars */
  ------------------
  |  Branch (880:3): [True: 0, False: 24.3k]
  ------------------
  881|      0|			horizontalAccumulate8abgr(up, llen, sp->stride,
  882|      0|					(unsigned char *)op, sp->ToLinear8);
  883|      0|			op += llen * sizeof(unsigned char);
  884|      0|			break;
  885|      0|		default:
  ------------------
  |  Branch (885:3): [True: 0, False: 24.3k]
  ------------------
  886|      0|			TIFFErrorExtR(tif, module,
  887|      0|				  "Unsupported bits/sample: %"PRIu16,
  888|      0|				  td->td_bitspersample);
  889|      0|			return (0);
  890|  24.3k|		}
  891|  24.3k|	}
  892|       |
  893|  2.18k|	return (1);
  894|  2.18k|}
tif_pixarlog.c:horizontalAccumulate16:
  245|  5.48k|{
  246|  5.48k|    register unsigned int  cr, cg, cb, ca, mask;
  247|       |
  248|  5.48k|    if (n >= stride) {
  ------------------
  |  Branch (248:9): [True: 5.48k, False: 0]
  ------------------
  249|  5.48k|	mask = CODE_MASK;
  ------------------
  |  |  104|  5.48k|#define CODE_MASK 0x7ff         /* 11 bits. */
  ------------------
  250|  5.48k|	if (stride == 3) {
  ------------------
  |  Branch (250:6): [True: 448, False: 5.03k]
  ------------------
  251|    448|	    op[0] = ToLinear16[cr = (wp[0] & mask)];
  252|    448|	    op[1] = ToLinear16[cg = (wp[1] & mask)];
  253|    448|	    op[2] = ToLinear16[cb = (wp[2] & mask)];
  254|    448|	    n -= 3;
  255|  1.29k|	    while (n > 0) {
  ------------------
  |  Branch (255:13): [True: 850, False: 448]
  ------------------
  256|    850|		wp += 3;
  257|    850|		op += 3;
  258|    850|		n -= 3;
  259|    850|		op[0] = ToLinear16[(cr += wp[0]) & mask];
  260|    850|		op[1] = ToLinear16[(cg += wp[1]) & mask];
  261|    850|		op[2] = ToLinear16[(cb += wp[2]) & mask];
  262|    850|	    }
  263|  5.03k|	} else if (stride == 4) {
  ------------------
  |  Branch (263:13): [True: 522, False: 4.51k]
  ------------------
  264|    522|	    op[0] = ToLinear16[cr = (wp[0] & mask)];
  265|    522|	    op[1] = ToLinear16[cg = (wp[1] & mask)];
  266|    522|	    op[2] = ToLinear16[cb = (wp[2] & mask)];
  267|    522|	    op[3] = ToLinear16[ca = (wp[3] & mask)];
  268|    522|	    n -= 4;
  269|  1.37k|	    while (n > 0) {
  ------------------
  |  Branch (269:13): [True: 855, False: 522]
  ------------------
  270|    855|		wp += 4;
  271|    855|		op += 4;
  272|    855|		n -= 4;
  273|    855|		op[0] = ToLinear16[(cr += wp[0]) & mask];
  274|    855|		op[1] = ToLinear16[(cg += wp[1]) & mask];
  275|    855|		op[2] = ToLinear16[(cb += wp[2]) & mask];
  276|    855|		op[3] = ToLinear16[(ca += wp[3]) & mask];
  277|    855|	    }
  278|  4.51k|	} else {
  279|  4.51k|	    REPEAT(stride, *op = ToLinear16[*wp&mask]; wp++; op++)
  ------------------
  |  |  109|  6.11k|#define REPEAT(n, op)   { int i; i=n; do { i--; op; } while (i>0); }
  |  |  ------------------
  |  |  |  Branch (109:62): [True: 1.60k, False: 4.51k]
  |  |  ------------------
  ------------------
  280|  4.51k|	    n -= stride;
  281|  10.6k|	    while (n > 0) {
  ------------------
  |  Branch (281:13): [True: 6.10k, False: 4.51k]
  ------------------
  282|  6.10k|		REPEAT(stride,
  ------------------
  |  |  109|  11.0k|#define REPEAT(n, op)   { int i; i=n; do { i--; op; } while (i>0); }
  |  |  ------------------
  |  |  |  Branch (109:62): [True: 4.89k, False: 6.10k]
  |  |  ------------------
  ------------------
  283|  6.10k|		    wp[stride] += *wp; *op = ToLinear16[*wp&mask]; wp++; op++)
  284|  6.10k|		n -= stride;
  285|  6.10k|	    }
  286|  4.51k|	}
  287|  5.48k|    }
  288|  5.48k|}
tif_pixarlog.c:horizontalAccumulate8:
  342|  18.9k|{
  343|  18.9k|    register unsigned int  cr, cg, cb, ca, mask;
  344|       |
  345|  18.9k|    if (n >= stride) {
  ------------------
  |  Branch (345:9): [True: 18.9k, False: 0]
  ------------------
  346|  18.9k|	mask = CODE_MASK;
  ------------------
  |  |  104|  18.9k|#define CODE_MASK 0x7ff         /* 11 bits. */
  ------------------
  347|  18.9k|	if (stride == 3) {
  ------------------
  |  Branch (347:6): [True: 504, False: 18.3k]
  ------------------
  348|    504|	    op[0] = ToLinear8[cr = (wp[0] & mask)];
  349|    504|	    op[1] = ToLinear8[cg = (wp[1] & mask)];
  350|    504|	    op[2] = ToLinear8[cb = (wp[2] & mask)];
  351|    504|	    n -= 3;
  352|  1.35k|	    while (n > 0) {
  ------------------
  |  Branch (352:13): [True: 852, False: 504]
  ------------------
  353|    852|		n -= 3;
  354|    852|		wp += 3;
  355|    852|		op += 3;
  356|    852|		op[0] = ToLinear8[(cr += wp[0]) & mask];
  357|    852|		op[1] = ToLinear8[(cg += wp[1]) & mask];
  358|    852|		op[2] = ToLinear8[(cb += wp[2]) & mask];
  359|    852|	    }
  360|  18.3k|	} else if (stride == 4) {
  ------------------
  |  Branch (360:13): [True: 599, False: 17.8k]
  ------------------
  361|    599|	    op[0] = ToLinear8[cr = (wp[0] & mask)];
  362|    599|	    op[1] = ToLinear8[cg = (wp[1] & mask)];
  363|    599|	    op[2] = ToLinear8[cb = (wp[2] & mask)];
  364|    599|	    op[3] = ToLinear8[ca = (wp[3] & mask)];
  365|    599|	    n -= 4;
  366|  4.60k|	    while (n > 0) {
  ------------------
  |  Branch (366:13): [True: 4.00k, False: 599]
  ------------------
  367|  4.00k|		n -= 4;
  368|  4.00k|		wp += 4;
  369|  4.00k|		op += 4;
  370|  4.00k|		op[0] = ToLinear8[(cr += wp[0]) & mask];
  371|  4.00k|		op[1] = ToLinear8[(cg += wp[1]) & mask];
  372|  4.00k|		op[2] = ToLinear8[(cb += wp[2]) & mask];
  373|  4.00k|		op[3] = ToLinear8[(ca += wp[3]) & mask];
  374|  4.00k|	    }
  375|  17.8k|	} else {
  376|  17.8k|	    REPEAT(stride, *op = ToLinear8[*wp&mask]; wp++; op++)
  ------------------
  |  |  109|  18.3k|#define REPEAT(n, op)   { int i; i=n; do { i--; op; } while (i>0); }
  |  |  ------------------
  |  |  |  Branch (109:62): [True: 524, False: 17.8k]
  |  |  ------------------
  ------------------
  377|  17.8k|	    n -= stride;
  378|  23.5k|	    while (n > 0) {
  ------------------
  |  Branch (378:13): [True: 5.79k, False: 17.8k]
  ------------------
  379|  5.79k|		REPEAT(stride,
  ------------------
  |  |  109|  6.58k|#define REPEAT(n, op)   { int i; i=n; do { i--; op; } while (i>0); }
  |  |  ------------------
  |  |  |  Branch (109:62): [True: 791, False: 5.79k]
  |  |  ------------------
  ------------------
  380|  5.79k|		    wp[stride] += *wp; *op = ToLinear8[*wp&mask]; wp++; op++)
  381|  5.79k|		n -= stride;
  382|  5.79k|	    }
  383|  17.8k|	}
  384|  18.9k|    }
  385|  18.9k|}
tif_pixarlog.c:PixarLogCleanup:
 1281|    582|{
 1282|    582|	PixarLogState* sp = (PixarLogState*) tif->tif_data;
 1283|       |
 1284|    582|	assert(sp != 0);
 1285|       |
 1286|    582|	(void)TIFFPredictorCleanup(tif);
 1287|       |
 1288|    582|	tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1289|    582|	tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1290|       |
 1291|    582|	if (sp->FromLT2) _TIFFfree(sp->FromLT2);
  ------------------
  |  Branch (1291:6): [True: 582, False: 0]
  ------------------
 1292|    582|	if (sp->From14) _TIFFfree(sp->From14);
  ------------------
  |  Branch (1292:6): [True: 582, False: 0]
  ------------------
 1293|    582|	if (sp->From8) _TIFFfree(sp->From8);
  ------------------
  |  Branch (1293:6): [True: 582, False: 0]
  ------------------
 1294|    582|	if (sp->ToLinearF) _TIFFfree(sp->ToLinearF);
  ------------------
  |  Branch (1294:6): [True: 582, False: 0]
  ------------------
 1295|    582|	if (sp->ToLinear16) _TIFFfree(sp->ToLinear16);
  ------------------
  |  Branch (1295:6): [True: 582, False: 0]
  ------------------
 1296|    582|	if (sp->ToLinear8) _TIFFfree(sp->ToLinear8);
  ------------------
  |  Branch (1296:6): [True: 582, False: 0]
  ------------------
 1297|    582|	if (sp->state&PLSTATE_INIT) {
  ------------------
  |  |  466|    582|#define PLSTATE_INIT 1
  ------------------
  |  Branch (1297:6): [True: 508, False: 74]
  ------------------
 1298|    508|		if (tif->tif_mode == O_RDONLY)
  ------------------
  |  Branch (1298:7): [True: 508, False: 0]
  ------------------
 1299|    508|			inflateEnd(&sp->stream);
 1300|      0|		else
 1301|      0|			deflateEnd(&sp->stream);
 1302|    508|	}
 1303|    582|	if (sp->tbuf)
  ------------------
  |  Branch (1303:6): [True: 508, False: 74]
  ------------------
 1304|    508|		_TIFFfree(sp->tbuf);
 1305|    582|	_TIFFfree(sp);
 1306|    582|	tif->tif_data = NULL;
 1307|       |
 1308|    582|	_TIFFSetDefaultCompressionState(tif);
 1309|    582|}
tif_pixarlog.c:PixarLogVGetField:
 1375|  7.98k|{
 1376|  7.98k|    PixarLogState *sp = (PixarLogState *)tif->tif_data;
 1377|       |
 1378|  7.98k|    switch (tag) {
 1379|      0|     case TIFFTAG_PIXARLOGQUALITY:
  ------------------
  |  |  650|      0|#define	TIFFTAG_PIXARLOGQUALITY		65558	/* PixarLog uses same scale */
  ------------------
  |  Branch (1379:6): [True: 0, False: 7.98k]
  ------------------
 1380|      0|	*va_arg(ap, int*) = sp->quality;
 1381|      0|	break;
 1382|      0|     case TIFFTAG_PIXARLOGDATAFMT:
  ------------------
  |  |  624|      0|#define	TIFFTAG_PIXARLOGDATAFMT		65549	/* PixarLogCodec I/O data sz */
  ------------------
  |  Branch (1382:6): [True: 0, False: 7.98k]
  ------------------
 1383|      0|	*va_arg(ap, int*) = sp->user_datafmt;
 1384|      0|	break;
 1385|  7.98k|     default:
  ------------------
  |  Branch (1385:6): [True: 7.98k, False: 0]
  ------------------
 1386|  7.98k|	return (*sp->vgetparent)(tif, tag, ap);
 1387|  7.98k|    }
 1388|      0|    return (1);
 1389|  7.98k|}
tif_pixarlog.c:PixarLogVSetField:
 1313|  5.57k|{
 1314|  5.57k|    static const char module[] = "PixarLogVSetField";
 1315|  5.57k|    PixarLogState *sp = (PixarLogState *)tif->tif_data;
 1316|  5.57k|    int result;
 1317|       |
 1318|  5.57k|    switch (tag) {
 1319|      0|     case TIFFTAG_PIXARLOGQUALITY:
  ------------------
  |  |  650|      0|#define	TIFFTAG_PIXARLOGQUALITY		65558	/* PixarLog uses same scale */
  ------------------
  |  Branch (1319:6): [True: 0, False: 5.57k]
  ------------------
 1320|      0|		sp->quality = (int) va_arg(ap, int);
 1321|      0|		if (tif->tif_mode != O_RDONLY && (sp->state&PLSTATE_INIT)) {
  ------------------
  |  |  466|      0|#define PLSTATE_INIT 1
  ------------------
  |  Branch (1321:7): [True: 0, False: 0]
  |  Branch (1321:36): [True: 0, False: 0]
  ------------------
 1322|      0|			if (deflateParams(&sp->stream,
  ------------------
  |  Branch (1322:8): [True: 0, False: 0]
  ------------------
 1323|      0|			    sp->quality, Z_DEFAULT_STRATEGY) != Z_OK) {
 1324|      0|				TIFFErrorExtR(tif, module, "ZLib error: %s",
 1325|      0|					sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (1325:6): [True: 0, False: 0]
  ------------------
 1326|      0|				return (0);
 1327|      0|			}
 1328|      0|		}
 1329|      0|		return (1);
 1330|      0|     case TIFFTAG_PIXARLOGDATAFMT:
  ------------------
  |  |  624|      0|#define	TIFFTAG_PIXARLOGDATAFMT		65549	/* PixarLogCodec I/O data sz */
  ------------------
  |  Branch (1330:6): [True: 0, False: 5.57k]
  ------------------
 1331|      0|	sp->user_datafmt = (int) va_arg(ap, int);
 1332|       |	/* Tweak the TIFF header so that the rest of libtiff knows what
 1333|       |	 * size of data will be passed between app and library, and
 1334|       |	 * assume that the app knows what it is doing and is not
 1335|       |	 * confused by these header manipulations...
 1336|       |	 */
 1337|      0|	switch (sp->user_datafmt) {
  ------------------
  |  Branch (1337:10): [True: 0, False: 0]
  ------------------
 1338|      0|	 case PIXARLOGDATAFMT_8BIT:
  ------------------
  |  |  625|      0|#define	    PIXARLOGDATAFMT_8BIT	0	/* regular u_char samples */
  ------------------
  |  Branch (1338:3): [True: 0, False: 0]
  ------------------
 1339|      0|	 case PIXARLOGDATAFMT_8BITABGR:
  ------------------
  |  |  626|      0|#define	    PIXARLOGDATAFMT_8BITABGR	1	/* ABGR-order u_chars */
  ------------------
  |  Branch (1339:3): [True: 0, False: 0]
  ------------------
 1340|      0|	    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
  ------------------
  |  |  174|      0|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
 1341|      0|	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  327|      0|#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
  ------------------
              	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  328|      0|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
 1342|      0|	    break;
 1343|      0|	 case PIXARLOGDATAFMT_11BITLOG:
  ------------------
  |  |  627|      0|#define	    PIXARLOGDATAFMT_11BITLOG	2	/* 11-bit log-encoded (raw) */
  ------------------
  |  Branch (1343:3): [True: 0, False: 0]
  ------------------
 1344|      0|	    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
  ------------------
  |  |  174|      0|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
 1345|      0|	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  327|      0|#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
  ------------------
              	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  328|      0|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
 1346|      0|	    break;
 1347|      0|	 case PIXARLOGDATAFMT_12BITPICIO:
  ------------------
  |  |  628|      0|#define	    PIXARLOGDATAFMT_12BITPICIO	3	/* as per PICIO (1.0==2048) */
  ------------------
  |  Branch (1347:3): [True: 0, False: 0]
  ------------------
 1348|      0|	    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
  ------------------
  |  |  174|      0|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
 1349|      0|	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
  ------------------
  |  |  327|      0|#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
  ------------------
              	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
  ------------------
  |  |  329|      0|#define	    SAMPLEFORMAT_INT		2	/* !signed integer data */
  ------------------
 1350|      0|	    break;
 1351|      0|	 case PIXARLOGDATAFMT_16BIT:
  ------------------
  |  |  629|      0|#define	    PIXARLOGDATAFMT_16BIT	4	/* signed short samples */
  ------------------
  |  Branch (1351:3): [True: 0, False: 0]
  ------------------
 1352|      0|	    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
  ------------------
  |  |  174|      0|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
 1353|      0|	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  327|      0|#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
  ------------------
              	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  328|      0|#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
  ------------------
 1354|      0|	    break;
 1355|      0|	 case PIXARLOGDATAFMT_FLOAT:
  ------------------
  |  |  630|      0|#define	    PIXARLOGDATAFMT_FLOAT	5	/* IEEE float samples */
  ------------------
  |  Branch (1355:3): [True: 0, False: 0]
  ------------------
 1356|      0|	    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 32);
  ------------------
  |  |  174|      0|#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
  ------------------
 1357|      0|	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
  ------------------
  |  |  327|      0|#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
  ------------------
              	    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
  ------------------
  |  |  330|      0|#define	    SAMPLEFORMAT_IEEEFP		3	/* !IEEE floating point data */
  ------------------
 1358|      0|	    break;
 1359|      0|	}
 1360|       |	/*
 1361|       |	 * Must recalculate sizes should bits/sample change.
 1362|       |	 */
 1363|      0|	tif->tif_tilesize = isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)(-1);
  ------------------
  |  |  207|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|      0|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1364|      0|	tif->tif_scanlinesize = TIFFScanlineSize(tif);
 1365|      0|	result = 1;		/* NB: pseudo tag */
 1366|      0|	break;
 1367|  5.57k|     default:
  ------------------
  |  Branch (1367:6): [True: 5.57k, False: 0]
  ------------------
 1368|  5.57k|	result = (*sp->vsetparent)(tif, tag, ap);
 1369|  5.57k|    }
 1370|  5.57k|    return (result);
 1371|  5.57k|}
tif_pixarlog.c:PixarLogMakeTables:
  482|    582|{
  483|       |
  484|       |/*
  485|       | *    We make several tables here to convert between various external
  486|       | *    representations (float, 16-bit, and 8-bit) and the internal
  487|       | *    11-bit companded representation.  The 11-bit representation has two
  488|       | *    distinct regions.  A linear bottom end up through .018316 in steps
  489|       | *    of about .000073, and a region of constant ratio up to about 25.
  490|       | *    These floating point numbers are stored in the main table ToLinearF. 
  491|       | *    All other tables are derived from this one.  The tables (and the
  492|       | *    ratios) are continuous at the internal seam.
  493|       | */
  494|       |
  495|    582|    int  nlin, lt2size;
  496|    582|    int  i, j;
  497|    582|    double  b, c, linstep, v;
  498|    582|    float *ToLinearF;
  499|    582|    uint16_t *ToLinear16;
  500|    582|    unsigned char *ToLinear8;
  501|    582|    uint16_t  *FromLT2;
  502|    582|    uint16_t  *From14; /* Really for 16-bit data, but we shift down 2 */
  503|    582|    uint16_t  *From8;
  504|       |
  505|    582|    c = log(RATIO);	
  ------------------
  |  |  102|    582|#define  RATIO	 1.004		/* nominal ratio for log part */
  ------------------
  506|    582|    nlin = (int)(1./c);	/* nlin must be an integer */
  507|    582|    c = 1./nlin;
  508|    582|    b = exp(-c*ONE);	/* multiplicative scale factor [b*exp(c*ONE) = 1] */
  ------------------
  |  |  101|    582|#define  ONE	 1250		/* token value of 1.0 exactly */
  ------------------
  509|    582|    linstep = b*c*exp(1.);
  510|       |
  511|    582|    LogK1 = (float)(1./c);	/* if (v >= 2)  token = k1*log(v*k2) */
  512|    582|    LogK2 = (float)(1./b);
  513|    582|    lt2size = (int)(2./linstep) + 1;
  514|    582|    FromLT2 = (uint16_t *)_TIFFmalloc(lt2size * sizeof(uint16_t));
  515|    582|    From14 = (uint16_t *)_TIFFmalloc(16384 * sizeof(uint16_t));
  516|    582|    From8 = (uint16_t *)_TIFFmalloc(256 * sizeof(uint16_t));
  517|    582|    ToLinearF = (float *)_TIFFmalloc(TSIZEP1 * sizeof(float));
  ------------------
  |  |  100|    582|#define  TSIZEP1 2049		/* Plus one for slop */
  ------------------
  518|    582|    ToLinear16 = (uint16_t *)_TIFFmalloc(TSIZEP1 * sizeof(uint16_t));
  ------------------
  |  |  100|    582|#define  TSIZEP1 2049		/* Plus one for slop */
  ------------------
  519|    582|    ToLinear8 = (unsigned char *)_TIFFmalloc(TSIZEP1 * sizeof(unsigned char));
  ------------------
  |  |  100|    582|#define  TSIZEP1 2049		/* Plus one for slop */
  ------------------
  520|    582|    if (FromLT2 == NULL || From14  == NULL || From8   == NULL ||
  ------------------
  |  Branch (520:9): [True: 0, False: 582]
  |  Branch (520:28): [True: 0, False: 582]
  |  Branch (520:47): [True: 0, False: 582]
  ------------------
  521|    582|	 ToLinearF == NULL || ToLinear16 == NULL || ToLinear8 == NULL) {
  ------------------
  |  Branch (521:3): [True: 0, False: 582]
  |  Branch (521:24): [True: 0, False: 582]
  |  Branch (521:46): [True: 0, False: 582]
  ------------------
  522|      0|	if (FromLT2) _TIFFfree(FromLT2);
  ------------------
  |  Branch (522:6): [True: 0, False: 0]
  ------------------
  523|      0|	if (From14) _TIFFfree(From14);
  ------------------
  |  Branch (523:6): [True: 0, False: 0]
  ------------------
  524|      0|	if (From8) _TIFFfree(From8);
  ------------------
  |  Branch (524:6): [True: 0, False: 0]
  ------------------
  525|      0|	if (ToLinearF) _TIFFfree(ToLinearF);
  ------------------
  |  Branch (525:6): [True: 0, False: 0]
  ------------------
  526|      0|	if (ToLinear16) _TIFFfree(ToLinear16);
  ------------------
  |  Branch (526:6): [True: 0, False: 0]
  ------------------
  527|      0|	if (ToLinear8) _TIFFfree(ToLinear8);
  ------------------
  |  Branch (527:6): [True: 0, False: 0]
  ------------------
  528|      0|	sp->FromLT2 = NULL;
  529|      0|	sp->From14 = NULL;
  530|      0|	sp->From8 = NULL;
  531|      0|	sp->ToLinearF = NULL;
  532|      0|	sp->ToLinear16 = NULL;
  533|      0|	sp->ToLinear8 = NULL;
  534|      0|	return 0;
  535|      0|    }
  536|       |
  537|    582|    j = 0;
  538|       |
  539|   146k|    for (i = 0; i < nlin; i++)  {
  ------------------
  |  Branch (539:17): [True: 145k, False: 582]
  ------------------
  540|   145k|	v = i * linstep;
  541|   145k|	ToLinearF[j++] = (float)v;
  542|   145k|    }
  543|       |
  544|  1.04M|    for (i = nlin; i < TSIZE; i++)
  ------------------
  |  |   99|  1.04M|#define  TSIZE	 2048		/* decode table size (11-bit tokens) */
  ------------------
  |  Branch (544:20): [True: 1.04M, False: 582]
  ------------------
  545|  1.04M|	ToLinearF[j++] = (float)(b*exp(c*i));
  546|       |
  547|    582|    ToLinearF[2048] = ToLinearF[2047];
  548|       |
  549|  1.19M|    for (i = 0; i < TSIZEP1; i++)  {
  ------------------
  |  |  100|  1.19M|#define  TSIZEP1 2049		/* Plus one for slop */
  ------------------
  |  Branch (549:17): [True: 1.19M, False: 582]
  ------------------
  550|  1.19M|	v = ToLinearF[i]*65535.0 + 0.5;
  551|  1.19M|	ToLinear16[i] = (v > 65535.0) ? 65535 : (uint16_t)v;
  ------------------
  |  Branch (551:18): [True: 465k, False: 727k]
  ------------------
  552|  1.19M|	v = ToLinearF[i]*255.0  + 0.5;
  553|  1.19M|	ToLinear8[i]  = (v > 255.0) ? 255 : (unsigned char)v;
  ------------------
  |  Branch (553:18): [True: 465k, False: 727k]
  ------------------
  554|  1.19M|    }
  555|       |
  556|    582|    j = 0;
  557|  15.8M|    for (i = 0; i < lt2size; i++)  {
  ------------------
  |  Branch (557:17): [True: 15.8M, False: 582]
  ------------------
  558|  15.8M|	if ((i*linstep)*(i*linstep) > ToLinearF[j]*ToLinearF[j+1])
  ------------------
  |  Branch (558:6): [True: 828k, False: 15.0M]
  ------------------
  559|   828k|	    j++;
  560|  15.8M|	FromLT2[i] = (uint16_t)j;
  561|  15.8M|    }
  562|       |
  563|       |    /*
  564|       |     * Since we lose info anyway on 16-bit data, we set up a 14-bit
  565|       |     * table and shift 16-bit values down two bits on input.
  566|       |     * saves a little table space.
  567|       |     */
  568|    582|    j = 0;
  569|  9.53M|    for (i = 0; i < 16384; i++)  {
  ------------------
  |  Branch (569:17): [True: 9.53M, False: 582]
  ------------------
  570|  10.2M|	while ((i/16383.)*(i/16383.) > ToLinearF[j]*ToLinearF[j+1])
  ------------------
  |  Branch (570:9): [True: 727k, False: 9.53M]
  ------------------
  571|   727k|	    j++;
  572|  9.53M|	From14[i] = (uint16_t)j;
  573|  9.53M|    }
  574|       |
  575|    582|    j = 0;
  576|   149k|    for (i = 0; i < 256; i++)  {
  ------------------
  |  Branch (576:17): [True: 148k, False: 582]
  ------------------
  577|   876k|	while ((i/255.)*(i/255.) > ToLinearF[j]*ToLinearF[j+1])
  ------------------
  |  Branch (577:9): [True: 727k, False: 148k]
  ------------------
  578|   727k|	    j++;
  579|   148k|	From8[i] = (uint16_t)j;
  580|   148k|    }
  581|       |
  582|    582|    Fltsize = (float)(lt2size/2);
  583|       |
  584|    582|    sp->ToLinearF = ToLinearF;
  585|    582|    sp->ToLinear16 = ToLinear16;
  586|    582|    sp->ToLinear8 = ToLinear8;
  587|    582|    sp->FromLT2 = FromLT2;
  588|    582|    sp->From14 = From14;
  589|    582|    sp->From8 = From8;
  590|       |
  591|    582|    return 1;
  592|    582|}

TIFFPredictorInit:
  899|  2.40k|{
  900|  2.40k|	TIFFPredictorState* sp = PredictorState(tif);
  ------------------
  |  |   33|  2.40k|#define	PredictorState(tif)	((TIFFPredictorState*) (tif)->tif_data)
  ------------------
  901|       |
  902|  2.40k|	assert(sp != 0);
  903|       |
  904|       |	/*
  905|       |	 * Merge codec-specific tag information.
  906|       |	 */
  907|  2.40k|	if (!_TIFFMergeFields(tif, predictFields,
  ------------------
  |  Branch (907:6): [True: 0, False: 2.40k]
  ------------------
  908|  2.40k|			      TIFFArrayCount(predictFields))) {
  ------------------
  |  |  261|  2.40k|#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
  ------------------
  909|      0|		TIFFErrorExtR(tif, "TIFFPredictorInit",
  910|      0|		    "Merging Predictor codec-specific tags failed");
  911|      0|		return 0;
  912|      0|	}
  913|       |
  914|       |	/*
  915|       |	 * Override parent get/set field methods.
  916|       |	 */
  917|  2.40k|	sp->vgetparent = tif->tif_tagmethods.vgetfield;
  918|  2.40k|	tif->tif_tagmethods.vgetfield =
  919|  2.40k|            PredictorVGetField;/* hook for predictor tag */
  920|  2.40k|	sp->vsetparent = tif->tif_tagmethods.vsetfield;
  921|  2.40k|	tif->tif_tagmethods.vsetfield =
  922|  2.40k|	    PredictorVSetField;/* hook for predictor tag */
  923|  2.40k|	sp->printdir = tif->tif_tagmethods.printdir;
  924|  2.40k|	tif->tif_tagmethods.printdir =
  925|  2.40k|            PredictorPrintDir;	/* hook for predictor tag */
  926|       |
  927|  2.40k|	sp->setupdecode = tif->tif_setupdecode;
  928|  2.40k|	tif->tif_setupdecode = PredictorSetupDecode;
  929|  2.40k|	sp->setupencode = tif->tif_setupencode;
  930|  2.40k|	tif->tif_setupencode = PredictorSetupEncode;
  931|       |
  932|  2.40k|	sp->predictor = 1;			/* default value */
  933|  2.40k|	sp->encodepfunc = NULL;			/* no predictor routine */
  934|  2.40k|	sp->decodepfunc = NULL;			/* no predictor routine */
  935|  2.40k|	return 1;
  936|  2.40k|}
TIFFPredictorCleanup:
  940|  2.40k|{
  941|  2.40k|	TIFFPredictorState* sp = PredictorState(tif);
  ------------------
  |  |   33|  2.40k|#define	PredictorState(tif)	((TIFFPredictorState*) (tif)->tif_data)
  ------------------
  942|       |
  943|  2.40k|	assert(sp != 0);
  944|       |
  945|  2.40k|	tif->tif_tagmethods.vgetfield = sp->vgetparent;
  946|  2.40k|	tif->tif_tagmethods.vsetfield = sp->vsetparent;
  947|  2.40k|	tif->tif_tagmethods.printdir = sp->printdir;
  948|  2.40k|	tif->tif_setupdecode = sp->setupdecode;
  949|  2.40k|	tif->tif_setupencode = sp->setupencode;
  950|       |
  951|  2.40k|	return 1;
  952|  2.40k|}
tif_predict.c:PredictorVGetField:
  862|  29.4k|{
  863|  29.4k|	TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   33|  29.4k|#define	PredictorState(tif)	((TIFFPredictorState*) (tif)->tif_data)
  ------------------
  864|       |
  865|  29.4k|	assert(sp != NULL);
  866|  29.4k|	assert(sp->vgetparent != NULL);
  867|       |
  868|  29.4k|	switch (tag) {
  869|      0|	case TIFFTAG_PREDICTOR:
  ------------------
  |  |  297|      0|#define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
  ------------------
  |  Branch (869:2): [True: 0, False: 29.4k]
  ------------------
  870|      0|		*va_arg(ap, uint16_t*) = (uint16_t)sp->predictor;
  871|      0|		break;
  872|  29.4k|	default:
  ------------------
  |  Branch (872:2): [True: 29.4k, False: 0]
  ------------------
  873|  29.4k|		return (*sp->vgetparent)(tif, tag, ap);
  874|  29.4k|	}
  875|      0|	return 1;
  876|  29.4k|}
tif_predict.c:PredictorVSetField:
  842|  17.0k|{
  843|  17.0k|	TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   33|  17.0k|#define	PredictorState(tif)	((TIFFPredictorState*) (tif)->tif_data)
  ------------------
  844|       |
  845|  17.0k|	assert(sp != NULL);
  846|  17.0k|	assert(sp->vsetparent != NULL);
  847|       |
  848|  17.0k|	switch (tag) {
  849|    313|	case TIFFTAG_PREDICTOR:
  ------------------
  |  |  297|    313|#define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
  ------------------
  |  Branch (849:2): [True: 313, False: 16.7k]
  ------------------
  850|    313|		sp->predictor = (uint16_t) va_arg(ap, uint16_vap);
  851|    313|		TIFFSetFieldBit(tif, FIELD_PREDICTOR);
  ------------------
  |  |  199|    313|#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  197|    313|#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  196|    313|#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f))
  |  |  ------------------
  ------------------
  852|    313|		break;
  853|  16.7k|	default:
  ------------------
  |  Branch (853:2): [True: 16.7k, False: 313]
  ------------------
  854|  16.7k|		return (*sp->vsetparent)(tif, tag, ap);
  855|  17.0k|	}
  856|    313|	tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |   94|    313|	#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
  857|    313|	return 1;
  858|  17.0k|}
tif_predict.c:PredictorSetupDecode:
  119|  2.29k|{
  120|  2.29k|	TIFFPredictorState* sp = PredictorState(tif);
  ------------------
  |  |   33|  2.29k|#define	PredictorState(tif)	((TIFFPredictorState*) (tif)->tif_data)
  ------------------
  121|  2.29k|	TIFFDirectory* td = &tif->tif_dir;
  122|       |
  123|       |	/* Note: when PredictorSetup() fails, the effets of setupdecode() */
  124|       |	/* will not be "canceled" so setupdecode() might be robust to */
  125|       |	/* be called several times. */
  126|  2.29k|	if (!(*sp->setupdecode)(tif) || !PredictorSetup(tif))
  ------------------
  |  Branch (126:6): [True: 10, False: 2.28k]
  |  Branch (126:34): [True: 3, False: 2.27k]
  ------------------
  127|     13|		return 0;
  128|       |
  129|  2.27k|	if (sp->predictor == 2) {
  ------------------
  |  Branch (129:6): [True: 246, False: 2.03k]
  ------------------
  130|    246|		switch (td->td_bitspersample) {
  ------------------
  |  Branch (130:11): [True: 0, False: 246]
  ------------------
  131|    140|			case 8:  sp->decodepfunc = horAcc8; break;
  ------------------
  |  Branch (131:4): [True: 140, False: 106]
  ------------------
  132|    106|			case 16: sp->decodepfunc = horAcc16; break;
  ------------------
  |  Branch (132:4): [True: 106, False: 140]
  ------------------
  133|      0|			case 32: sp->decodepfunc = horAcc32; break;
  ------------------
  |  Branch (133:4): [True: 0, False: 246]
  ------------------
  134|      0|			case 64: sp->decodepfunc = horAcc64; break;
  ------------------
  |  Branch (134:4): [True: 0, False: 246]
  ------------------
  135|    246|		}
  136|       |		/*
  137|       |		 * Override default decoding method with one that does the
  138|       |		 * predictor stuff.
  139|       |		 */
  140|    246|                if( tif->tif_decoderow != PredictorDecodeRow )
  ------------------
  |  Branch (140:21): [True: 246, False: 0]
  ------------------
  141|    246|                {
  142|    246|                    sp->decoderow = tif->tif_decoderow;
  143|    246|                    tif->tif_decoderow = PredictorDecodeRow;
  144|    246|                    sp->decodestrip = tif->tif_decodestrip;
  145|    246|                    tif->tif_decodestrip = PredictorDecodeTile;
  146|    246|                    sp->decodetile = tif->tif_decodetile;
  147|    246|                    tif->tif_decodetile = PredictorDecodeTile;
  148|    246|                }
  149|       |
  150|       |		/*
  151|       |		 * If the data is horizontally differenced 16-bit data that
  152|       |		 * requires byte-swapping, then it must be byte swapped before
  153|       |		 * the accumulation step.  We do this with a special-purpose
  154|       |		 * routine and override the normal post decoding logic that
  155|       |		 * the library setup when the directory was read.
  156|       |		 */
  157|    246|		if (tif->tif_flags & TIFF_SWAB) {
  ------------------
  |  |   98|    246|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (157:7): [True: 0, False: 246]
  ------------------
  158|      0|			if (sp->decodepfunc == horAcc16) {
  ------------------
  |  Branch (158:8): [True: 0, False: 0]
  ------------------
  159|      0|				sp->decodepfunc = swabHorAcc16;
  160|      0|				tif->tif_postdecode = _TIFFNoPostDecode;
  161|      0|            } else if (sp->decodepfunc == horAcc32) {
  ------------------
  |  Branch (161:24): [True: 0, False: 0]
  ------------------
  162|      0|				sp->decodepfunc = swabHorAcc32;
  163|      0|				tif->tif_postdecode = _TIFFNoPostDecode;
  164|      0|			} else if (sp->decodepfunc == horAcc64) {
  ------------------
  |  Branch (164:15): [True: 0, False: 0]
  ------------------
  165|      0|				sp->decodepfunc = swabHorAcc64;
  166|      0|				tif->tif_postdecode = _TIFFNoPostDecode;
  167|      0|            }
  168|      0|		}
  169|    246|	}
  170|       |
  171|  2.03k|	else if (sp->predictor == 3) {
  ------------------
  |  Branch (171:11): [True: 0, False: 2.03k]
  ------------------
  172|      0|		sp->decodepfunc = fpAcc;
  173|       |		/*
  174|       |		 * Override default decoding method with one that does the
  175|       |		 * predictor stuff.
  176|       |		 */
  177|      0|                if( tif->tif_decoderow != PredictorDecodeRow )
  ------------------
  |  Branch (177:21): [True: 0, False: 0]
  ------------------
  178|      0|                {
  179|      0|                    sp->decoderow = tif->tif_decoderow;
  180|      0|                    tif->tif_decoderow = PredictorDecodeRow;
  181|      0|                    sp->decodestrip = tif->tif_decodestrip;
  182|      0|                    tif->tif_decodestrip = PredictorDecodeTile;
  183|      0|                    sp->decodetile = tif->tif_decodetile;
  184|      0|                    tif->tif_decodetile = PredictorDecodeTile;
  185|      0|                }
  186|       |		/*
  187|       |		 * The data should not be swapped outside of the floating
  188|       |		 * point predictor, the accumulation routine should return
  189|       |		 * byres in the native order.
  190|       |		 */
  191|      0|		if (tif->tif_flags & TIFF_SWAB) {
  ------------------
  |  |   98|      0|	#define TIFF_SWAB        0x00080U /* byte swap file information */
  ------------------
  |  Branch (191:7): [True: 0, False: 0]
  ------------------
  192|      0|			tif->tif_postdecode = _TIFFNoPostDecode;
  193|      0|		}
  194|       |		/*
  195|       |		 * Allocate buffer to keep the decoded bytes before
  196|       |		 * rearranging in the right order
  197|       |		 */
  198|      0|	}
  199|       |
  200|  2.27k|	return 1;
  201|  2.27k|}
tif_predict.c:PredictorSetup:
   58|  2.28k|{
   59|  2.28k|	static const char module[] = "PredictorSetup";
   60|       |
   61|  2.28k|	TIFFPredictorState* sp = PredictorState(tif);
  ------------------
  |  |   33|  2.28k|#define	PredictorState(tif)	((TIFFPredictorState*) (tif)->tif_data)
  ------------------
   62|  2.28k|	TIFFDirectory* td = &tif->tif_dir;
   63|       |
   64|  2.28k|	switch (sp->predictor)		/* no differencing */
   65|  2.28k|	{
   66|  2.03k|		case PREDICTOR_NONE:
  ------------------
  |  |  298|  2.03k|#define     PREDICTOR_NONE		1	/* no prediction scheme used */
  ------------------
  |  Branch (66:3): [True: 2.03k, False: 249]
  ------------------
   67|  2.03k|			return 1;
   68|    247|		case PREDICTOR_HORIZONTAL:
  ------------------
  |  |  299|    247|#define     PREDICTOR_HORIZONTAL	2	/* horizontal differencing */
  ------------------
  |  Branch (68:3): [True: 247, False: 2.03k]
  ------------------
   69|    247|			if (td->td_bitspersample != 8
  ------------------
  |  Branch (69:8): [True: 107, False: 140]
  ------------------
   70|    247|			    && td->td_bitspersample != 16
  ------------------
  |  Branch (70:11): [True: 1, False: 106]
  ------------------
   71|    247|			    && td->td_bitspersample != 32
  ------------------
  |  Branch (71:11): [True: 1, False: 0]
  ------------------
   72|    247|			    && td->td_bitspersample != 64) {
  ------------------
  |  Branch (72:11): [True: 1, False: 0]
  ------------------
   73|      1|				TIFFErrorExtR(tif, module,
   74|      1|				    "Horizontal differencing \"Predictor\" not supported with %"PRIu16"-bit samples",
   75|      1|				    td->td_bitspersample);
   76|      1|				return 0;
   77|      1|			}
   78|    246|			break;
   79|    246|		case PREDICTOR_FLOATINGPOINT:
  ------------------
  |  |  300|      1|#define     PREDICTOR_FLOATINGPOINT	3	/* floating point predictor */
  ------------------
  |  Branch (79:3): [True: 1, False: 2.28k]
  ------------------
   80|      1|			if (td->td_sampleformat != SAMPLEFORMAT_IEEEFP) {
  ------------------
  |  |  330|      1|#define	    SAMPLEFORMAT_IEEEFP		3	/* !IEEE floating point data */
  ------------------
  |  Branch (80:8): [True: 1, False: 0]
  ------------------
   81|      1|				TIFFErrorExtR(tif, module,
   82|      1|				    "Floating point \"Predictor\" not supported with %"PRIu16" data format",
   83|      1|				    td->td_sampleformat);
   84|      1|				return 0;
   85|      1|			}
   86|      0|                        if (td->td_bitspersample != 16
  ------------------
  |  Branch (86:29): [True: 0, False: 0]
  ------------------
   87|      0|                            && td->td_bitspersample != 24
  ------------------
  |  Branch (87:32): [True: 0, False: 0]
  ------------------
   88|      0|                            && td->td_bitspersample != 32
  ------------------
  |  Branch (88:32): [True: 0, False: 0]
  ------------------
   89|      0|                            && td->td_bitspersample != 64) { /* Should 64 be allowed? */
  ------------------
  |  Branch (89:32): [True: 0, False: 0]
  ------------------
   90|      0|                                TIFFErrorExtR(tif, module,
   91|      0|                                             "Floating point \"Predictor\" not supported with %"PRIu16"-bit samples",
   92|      0|                                             td->td_bitspersample);
   93|      0|				return 0;
   94|      0|                            }
   95|      0|			break;
   96|      1|		default:
  ------------------
  |  Branch (96:3): [True: 1, False: 2.28k]
  ------------------
   97|      1|			TIFFErrorExtR(tif, module,
   98|      1|			    "\"Predictor\" value %d not supported",
   99|      1|			    sp->predictor);
  100|      1|			return 0;
  101|  2.28k|	}
  102|    246|	sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?
  ------------------
  |  |  259|    246|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (102:16): [True: 226, False: 20]
  ------------------
  103|    226|	    td->td_samplesperpixel : 1);
  104|       |	/*
  105|       |	 * Calculate the scanline/tile-width size in bytes.
  106|       |	 */
  107|    246|	if (isTiled(tif))
  ------------------
  |  |  207|    246|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|    246|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (207:22): [True: 246, False: 0]
  |  |  ------------------
  ------------------
  108|    246|		sp->rowsize = TIFFTileRowSize(tif);
  109|      0|	else
  110|      0|		sp->rowsize = TIFFScanlineSize(tif);
  111|    246|	if (sp->rowsize == 0)
  ------------------
  |  Branch (111:6): [True: 0, False: 246]
  ------------------
  112|      0|		return 0;
  113|       |
  114|    246|	return 1;
  115|    246|}
tif_predict.c:horAcc8:
  294|  1.35k|{
  295|  1.35k|	tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   33|  1.35k|#define	PredictorState(tif)	((TIFFPredictorState*) (tif)->tif_data)
  ------------------
  296|       |
  297|  1.35k|	unsigned char* cp = (unsigned char*) cp0;
  298|  1.35k|    if((cc%stride)!=0)
  ------------------
  |  Branch (298:8): [True: 0, False: 1.35k]
  ------------------
  299|      0|    {
  300|      0|        TIFFErrorExtR(tif, "horAcc8",
  301|      0|                     "%s", "(cc%stride)!=0");
  302|      0|        return 0;
  303|      0|    }
  304|       |
  305|  1.35k|	if (cc > stride) {
  ------------------
  |  Branch (305:6): [True: 1.06k, False: 283]
  ------------------
  306|       |		/*
  307|       |		 * Pipeline the most common cases.
  308|       |		 */
  309|  1.06k|		if (stride == 3)  {
  ------------------
  |  Branch (309:7): [True: 263, False: 805]
  ------------------
  310|    263|			unsigned int cr = cp[0];
  311|    263|			unsigned int cg = cp[1];
  312|    263|			unsigned int cb = cp[2];
  313|    263|			tmsize_t i = stride;
  314|  1.15k|			for ( ; i < cc; i += stride) {
  ------------------
  |  Branch (314:12): [True: 888, False: 263]
  ------------------
  315|    888|				cp[i+0] = (unsigned char) ((cr += cp[i+0]) & 0xff);
  316|    888|				cp[i+1] = (unsigned char) ((cg += cp[i+1]) & 0xff);
  317|    888|				cp[i+2] = (unsigned char) ((cb += cp[i+2]) & 0xff);
  318|    888|			}
  319|    805|		} else if (stride == 4)  {
  ------------------
  |  Branch (319:14): [True: 301, False: 504]
  ------------------
  320|    301|			unsigned int cr = cp[0];
  321|    301|			unsigned int cg = cp[1];
  322|    301|			unsigned int cb = cp[2];
  323|    301|			unsigned int ca = cp[3];
  324|    301|			tmsize_t i = stride;
  325|  4.30k|			for ( ; i < cc; i += stride) {
  ------------------
  |  Branch (325:12): [True: 4.00k, False: 301]
  ------------------
  326|  4.00k|				cp[i+0] = (unsigned char) ((cr += cp[i+0]) & 0xff);
  327|  4.00k|				cp[i+1] = (unsigned char) ((cg += cp[i+1]) & 0xff);
  328|  4.00k|				cp[i+2] = (unsigned char) ((cb += cp[i+2]) & 0xff);
  329|  4.00k|				cp[i+3] = (unsigned char) ((ca += cp[i+3]) & 0xff);
  330|  4.00k|			}
  331|    504|		} else  {
  332|    504|			cc -= stride;
  333|    977|			do {
  334|    977|				REPEAT4(stride, cp[stride] =
  ------------------
  |  |  275|    977|    switch (n) {		\
  |  |  276|    276|    default: { \
  |  |  ------------------
  |  |  |  Branch (276:5): [True: 276, False: 701]
  |  |  ------------------
  |  |  277|  15.6k|        tmsize_t i; for (i = n-4; i > 0; i--) { op; } }  /*-fallthrough*/  \
  |  |  ------------------
  |  |  |  Branch (277:35): [True: 15.4k, False: 276]
  |  |  ------------------
  |  |  278|    276|    case 4:  op; /*-fallthrough*/ \
  |  |  ------------------
  |  |  |  Branch (278:5): [True: 0, False: 977]
  |  |  ------------------
  |  |  279|    276|    case 3:  op; /*-fallthrough*/ \
  |  |  ------------------
  |  |  |  Branch (279:5): [True: 0, False: 977]
  |  |  ------------------
  |  |  280|    622|    case 2:  op; /*-fallthrough*/ \
  |  |  ------------------
  |  |  |  Branch (280:5): [True: 346, False: 631]
  |  |  ------------------
  |  |  281|    977|    case 1:  op; /*-fallthrough*/ \
  |  |  ------------------
  |  |  |  Branch (281:5): [True: 355, False: 622]
  |  |  ------------------
  |  |  282|    977|    case 0:  ;			\
  |  |  ------------------
  |  |  |  Branch (282:5): [True: 0, False: 977]
  |  |  ------------------
  |  |  283|    977|    }
  ------------------
  335|    977|					(unsigned char) ((cp[stride] + *cp) & 0xff); cp++)
  336|    977|				cc -= stride;
  337|    977|			} while (cc>0);
  ------------------
  |  Branch (337:13): [True: 473, False: 504]
  ------------------
  338|    504|		}
  339|  1.06k|	}
  340|  1.35k|	return 1;
  341|  1.35k|}
tif_predict.c:horAcc16:
  356|    938|{
  357|    938|	tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   33|    938|#define	PredictorState(tif)	((TIFFPredictorState*) (tif)->tif_data)
  ------------------
  358|    938|	uint16_t* wp = (uint16_t*) cp0;
  359|    938|	tmsize_t wc = cc / 2;
  360|       |
  361|    938|    if((cc%(2*stride))!=0)
  ------------------
  |  Branch (361:8): [True: 0, False: 938]
  ------------------
  362|      0|    {
  363|      0|        TIFFErrorExtR(tif, "horAcc16",
  364|      0|                     "%s", "cc%(2*stride))!=0");
  365|      0|        return 0;
  366|      0|    }
  367|       |
  368|    938|	if (wc > stride) {
  ------------------
  |  Branch (368:6): [True: 646, False: 292]
  ------------------
  369|    646|		wc -= stride;
  370|  2.68k|		do {
  371|  2.68k|			REPEAT4(stride, wp[stride] = (uint16_t)(((unsigned int)wp[stride] + (unsigned int)wp[0]) & 0xffff); wp++)
  ------------------
  |  |  275|  2.68k|    switch (n) {		\
  |  |  276|    358|    default: { \
  |  |  ------------------
  |  |  |  Branch (276:5): [True: 358, False: 2.32k]
  |  |  ------------------
  |  |  277|  3.97k|        tmsize_t i; for (i = n-4; i > 0; i--) { op; } }  /*-fallthrough*/  \
  |  |  ------------------
  |  |  |  Branch (277:35): [True: 3.61k, False: 358]
  |  |  ------------------
  |  |  278|    913|    case 4:  op; /*-fallthrough*/ \
  |  |  ------------------
  |  |  |  Branch (278:5): [True: 555, False: 2.12k]
  |  |  ------------------
  |  |  279|  1.72k|    case 3:  op; /*-fallthrough*/ \
  |  |  ------------------
  |  |  |  Branch (279:5): [True: 810, False: 1.87k]
  |  |  ------------------
  |  |  280|  1.94k|    case 2:  op; /*-fallthrough*/ \
  |  |  ------------------
  |  |  |  Branch (280:5): [True: 224, False: 2.45k]
  |  |  ------------------
  |  |  281|  2.68k|    case 1:  op; /*-fallthrough*/ \
  |  |  ------------------
  |  |  |  Branch (281:5): [True: 736, False: 1.94k]
  |  |  ------------------
  |  |  282|  2.68k|    case 0:  ;			\
  |  |  ------------------
  |  |  |  Branch (282:5): [True: 0, False: 2.68k]
  |  |  ------------------
  |  |  283|  2.68k|    }
  ------------------
  372|  2.68k|			wc -= stride;
  373|  2.68k|		} while (wc > 0);
  ------------------
  |  Branch (373:12): [True: 2.03k, False: 646]
  ------------------
  374|    646|	}
  375|    938|	return 1;
  376|    938|}
tif_predict.c:PredictorDecodeTile:
  522|  9.33k|{
  523|  9.33k|	TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   33|  9.33k|#define	PredictorState(tif)	((TIFFPredictorState*) (tif)->tif_data)
  ------------------
  524|       |
  525|  9.33k|	assert(sp != NULL);
  526|  9.33k|	assert(sp->decodetile != NULL);
  527|       |
  528|  9.33k|	if ((*sp->decodetile)(tif, op0, occ0, s)) {
  ------------------
  |  Branch (528:6): [True: 1.87k, False: 7.46k]
  ------------------
  529|  1.87k|		tmsize_t rowsize = sp->rowsize;
  530|  1.87k|		assert(rowsize > 0);
  531|  1.87k|		if((occ0%rowsize) !=0)
  ------------------
  |  Branch (531:6): [True: 216, False: 1.65k]
  ------------------
  532|    216|        {
  533|    216|            TIFFErrorExtR(tif, "PredictorDecodeTile",
  534|    216|                         "%s", "occ0%rowsize != 0");
  535|    216|            return 0;
  536|    216|        }
  537|  1.65k|		assert(sp->decodepfunc != NULL);
  538|  3.94k|		while (occ0 > 0) {
  ------------------
  |  Branch (538:10): [True: 2.28k, False: 1.65k]
  ------------------
  539|  2.28k|			if( !(*sp->decodepfunc)(tif, op0, rowsize) )
  ------------------
  |  Branch (539:8): [True: 0, False: 2.28k]
  ------------------
  540|      0|                return 0;
  541|  2.28k|			occ0 -= rowsize;
  542|  2.28k|			op0 += rowsize;
  543|  2.28k|		}
  544|  1.65k|		return 1;
  545|  1.65k|	} else
  546|  7.46k|		return 0;
  547|  9.33k|}

TIFFReadTile:
  898|   351k|{
  899|   351k|	if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
  ------------------
  |  Branch (899:6): [True: 0, False: 351k]
  |  Branch (899:32): [True: 198, False: 350k]
  ------------------
  900|    198|		return ((tmsize_t)(-1));
  901|   350k|	return (TIFFReadEncodedTile(tif,
  902|   350k|	    TIFFComputeTile(tif, x, y, z, s), buf, (tmsize_t)(-1)));
  903|   351k|}
TIFFReadEncodedTile:
  911|  1.46M|{
  912|  1.46M|	static const char module[] = "TIFFReadEncodedTile";
  913|  1.46M|	TIFFDirectory *td = &tif->tif_dir;
  914|  1.46M|	tmsize_t tilesize = tif->tif_tilesize;
  915|       |
  916|  1.46M|	if (!TIFFCheckRead(tif, 1))
  ------------------
  |  Branch (916:6): [True: 0, False: 1.46M]
  ------------------
  917|      0|		return ((tmsize_t)(-1));
  918|  1.46M|	if (tile >= td->td_nstrips) {
  ------------------
  |  Branch (918:6): [True: 0, False: 1.46M]
  ------------------
  919|      0|		TIFFErrorExtR(tif, module,
  920|      0|		    "%"PRIu32": Tile out of range, max %"PRIu32,
  921|      0|		    tile, td->td_nstrips);
  922|      0|		return ((tmsize_t)(-1));
  923|      0|	}
  924|       |
  925|       |    /* shortcut to avoid an extra memcpy() */
  926|  1.46M|    if( td->td_compression == COMPRESSION_NONE &&
  ------------------
  |  |  176|  2.93M|#define	    COMPRESSION_NONE		1	/* dump mode */
  ------------------
  |  Branch (926:9): [True: 33.4k, False: 1.43M]
  ------------------
  927|  1.46M|        size!=(tmsize_t)(-1) && size >= tilesize &&
  ------------------
  |  Branch (927:9): [True: 0, False: 33.4k]
  |  Branch (927:33): [True: 0, False: 0]
  ------------------
  928|  1.46M|        !isMapped(tif) &&
  ------------------
  |  |  208|  1.46M|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  102|      0|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (928:9): [True: 0, False: 0]
  ------------------
  929|  1.46M|        ((tif->tif_flags&TIFF_NOREADRAW)==0) )
  ------------------
  |  |  108|      0|	#define TIFF_NOREADRAW   0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (929:9): [True: 0, False: 0]
  ------------------
  930|      0|    {
  931|      0|        if (TIFFReadRawTile1(tif, tile, buf, tilesize, module) != tilesize)
  ------------------
  |  Branch (931:13): [True: 0, False: 0]
  ------------------
  932|      0|            return ((tmsize_t)(-1));
  933|       |
  934|      0|        if (!isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  209|      0|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (934:13): [True: 0, False: 0]
  ------------------
  935|      0|            (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |   99|      0|	#define TIFF_NOBITREV    0x00100U /* inhibit bit reversal logic */
  ------------------
  |  Branch (935:13): [True: 0, False: 0]
  ------------------
  936|      0|            TIFFReverseBits(buf,tilesize);
  937|       |
  938|      0|        (*tif->tif_postdecode)(tif,buf,tilesize);
  939|      0|        return (tilesize);
  940|      0|    }
  941|       |
  942|  1.46M|	if (size == (tmsize_t)(-1))
  ------------------
  |  Branch (942:6): [True: 1.46M, False: 0]
  ------------------
  943|  1.46M|		size = tilesize;
  944|      0|	else if (size > tilesize)
  ------------------
  |  Branch (944:11): [True: 0, False: 0]
  ------------------
  945|      0|		size = tilesize;
  946|  1.46M|	if (TIFFFillTile(tif, tile) && (*tif->tif_decodetile)(tif,
  ------------------
  |  Branch (946:6): [True: 226k, False: 1.24M]
  |  Branch (946:33): [True: 138k, False: 88.4k]
  ------------------
  947|   226k|                                                          (uint8_t*) buf, size, (uint16_t)(tile / td->td_stripsperimage))) {
  948|   138k|		(*tif->tif_postdecode)(tif, (uint8_t*) buf, size);
  949|   138k|		return (size);
  950|   138k|	} else
  951|  1.33M|		return ((tmsize_t)(-1));
  952|  1.46M|}
_TIFFReadTileAndAllocBuffer:
  964|  1.12M|{
  965|  1.12M|    if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
  ------------------
  |  Branch (965:9): [True: 0, False: 1.12M]
  |  Branch (965:35): [True: 0, False: 1.12M]
  ------------------
  966|      0|            return ((tmsize_t)(-1));
  967|  1.12M|    return (_TIFFReadEncodedTileAndAllocBuffer(tif,
  968|  1.12M|                                               TIFFComputeTile(tif, x, y, z, s),
  969|  1.12M|                                               buf, bufsizetoalloc,
  970|  1.12M|                                               (tmsize_t)(-1)));
  971|  1.12M|}
_TIFFReadEncodedTileAndAllocBuffer:
  983|  1.12M|{
  984|  1.12M|    static const char module[] = "_TIFFReadEncodedTileAndAllocBuffer";
  985|  1.12M|    TIFFDirectory *td = &tif->tif_dir;
  986|  1.12M|    tmsize_t tilesize = tif->tif_tilesize;
  987|       |
  988|  1.12M|    if( *buf != NULL )
  ------------------
  |  Branch (988:9): [True: 1.11M, False: 11.1k]
  ------------------
  989|  1.11M|    {
  990|  1.11M|        return TIFFReadEncodedTile(tif, tile, *buf, size_to_read);
  991|  1.11M|    }
  992|       |
  993|  11.1k|    if (!TIFFCheckRead(tif, 1))
  ------------------
  |  Branch (993:9): [True: 0, False: 11.1k]
  ------------------
  994|      0|            return ((tmsize_t)(-1));
  995|  11.1k|    if (tile >= td->td_nstrips) {
  ------------------
  |  Branch (995:9): [True: 0, False: 11.1k]
  ------------------
  996|      0|            TIFFErrorExtR(tif, module,
  997|      0|                "%"PRIu32": Tile out of range, max %"PRIu32,
  998|      0|                tile, td->td_nstrips);
  999|      0|            return ((tmsize_t)(-1));
 1000|      0|    }
 1001|       |
 1002|  11.1k|    if (!TIFFFillTile(tif,tile))
  ------------------
  |  Branch (1002:9): [True: 2.24k, False: 8.89k]
  ------------------
 1003|  2.24k|            return((tmsize_t)(-1));
 1004|       |
 1005|       |    /* Sanity checks to avoid excessive memory allocation */
 1006|       |    /* Cf https://gitlab.com/libtiff/libtiff/-/issues/479 */
 1007|  8.89k|    if (td->td_compression == COMPRESSION_NONE) {
  ------------------
  |  |  176|  8.89k|#define	    COMPRESSION_NONE		1	/* dump mode */
  ------------------
  |  Branch (1007:9): [True: 262, False: 8.63k]
  ------------------
 1008|    262|        if (tif->tif_rawdatasize != tilesize) {
  ------------------
  |  Branch (1008:13): [True: 220, False: 42]
  ------------------
 1009|    220|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1010|    220|                         "Invalid tile byte count for tile %u. "
 1011|    220|                         "Expected %"PRIu64", got %"PRIu64,
 1012|    220|                          tile,
 1013|    220|                          (uint64_t)tilesize,
 1014|    220|                          (uint64_t)tif->tif_rawdatasize);
 1015|    220|            return((tmsize_t)(-1));
 1016|    220|        }
 1017|    262|    }
 1018|  8.63k|    else {
 1019|       |        /* Max compression ratio experimentally determined. Might be fragile...
 1020|       |         * Only apply this heuristics to situations where the memory allocation
 1021|       |         * would be big, to avoid breaking nominal use cases.
 1022|       |         */
 1023|  8.63k|        const int maxCompressionRatio =
 1024|  8.63k|            td->td_compression == COMPRESSION_ZSTD ?
  ------------------
  |  |  211|  8.63k|#define	    COMPRESSION_ZSTD		50000	/* ZSTD: WARNING not registered in Adobe-maintained registry */
  ------------------
  |  Branch (1024:13): [True: 0, False: 8.63k]
  ------------------
 1025|      0|                33000 :
 1026|  8.63k|            td->td_compression == COMPRESSION_JXL ?
  ------------------
  |  |  213|  8.63k|#define	    COMPRESSION_JXL		50002	/* JPEGXL: WARNING not registered in Adobe-maintained registry */
  ------------------
  |  Branch (1026:13): [True: 0, False: 8.63k]
  ------------------
 1027|       |                /* Evaluated on a 8000x8000 tile */
 1028|      0|                25000 * (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel : 1) :
  ------------------
  |  |  259|      0|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (1028:26): [True: 0, False: 0]
  ------------------
 1029|  8.63k|            td->td_compression == COMPRESSION_LZMA ?
  ------------------
  |  |  210|  8.63k|#define	    COMPRESSION_LZMA		34925	/* LZMA2 */
  ------------------
  |  Branch (1029:13): [True: 88, False: 8.54k]
  ------------------
 1030|     88|                7000 :
 1031|  8.63k|                1000;
 1032|  8.63k|        if  (bufsizetoalloc > 100 * 1000 * 1000 &&
  ------------------
  |  Branch (1032:14): [True: 258, False: 8.37k]
  ------------------
 1033|  8.63k|             tif->tif_rawdatasize < tilesize / maxCompressionRatio) {
  ------------------
  |  Branch (1033:14): [True: 248, False: 10]
  ------------------
 1034|    248|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1035|    248|                         "Likely invalid tile byte count for tile %u. "
 1036|    248|                         "Uncompressed tile size is %"PRIu64", "
 1037|    248|                         "compressed one is %"PRIu64,
 1038|    248|                          tile,
 1039|    248|                          (uint64_t)tilesize,
 1040|    248|                          (uint64_t)tif->tif_rawdatasize);
 1041|    248|            return((tmsize_t)(-1));
 1042|    248|        }
 1043|  8.63k|    }
 1044|       |
 1045|  8.42k|    *buf = _TIFFmalloc(bufsizetoalloc);
 1046|  8.42k|    if (*buf == NULL) {
  ------------------
  |  Branch (1046:9): [True: 0, False: 8.42k]
  ------------------
 1047|      0|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1048|      0|                         "No space for tile buffer");
 1049|      0|            return((tmsize_t)(-1));
 1050|      0|    }
 1051|  8.42k|    _TIFFmemset(*buf, 0, bufsizetoalloc);
 1052|       |
 1053|  8.42k|    if (size_to_read == (tmsize_t)(-1))
  ------------------
  |  Branch (1053:9): [True: 8.42k, False: 0]
  ------------------
 1054|  8.42k|        size_to_read = tilesize;
 1055|      0|    else if (size_to_read > tilesize)
  ------------------
  |  Branch (1055:14): [True: 0, False: 0]
  ------------------
 1056|      0|        size_to_read = tilesize;
 1057|  8.42k|    if( (*tif->tif_decodetile)(tif,
  ------------------
  |  Branch (1057:9): [True: 5.65k, False: 2.76k]
  ------------------
 1058|  8.42k|                               (uint8_t*) *buf, size_to_read, (uint16_t)(tile / td->td_stripsperimage))) {
 1059|  5.65k|        (*tif->tif_postdecode)(tif, (uint8_t*) *buf, size_to_read);
 1060|  5.65k|        return (size_to_read);
 1061|  5.65k|    } else
 1062|  2.76k|        return ((tmsize_t)(-1));
 1063|  8.42k|}
TIFFFillTile:
 1158|  1.48M|{
 1159|  1.48M|	static const char module[] = "TIFFFillTile";
 1160|  1.48M|	TIFFDirectory *td = &tif->tif_dir;
 1161|       |
 1162|  1.48M|	if ((tif->tif_flags&TIFF_NOREADRAW)==0)
  ------------------
  |  |  108|  1.48M|	#define TIFF_NOREADRAW   0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1162:6): [True: 1.42M, False: 56.1k]
  ------------------
 1163|  1.42M|	{
 1164|  1.42M|		uint64_t bytecount = TIFFGetStrileByteCount(tif, tile);
 1165|  1.42M|		if( bytecount == 0 || bytecount > (uint64_t)TIFF_INT64_MAX ) {
  ------------------
  |  |   49|   423k|#define TIFF_INT64_MAX ((((int64_t)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
  ------------------
  |  Branch (1165:7): [True: 1.00M, False: 423k]
  |  Branch (1165:25): [True: 104, False: 423k]
  ------------------
 1166|  1.00M|			TIFFErrorExtR(tif, module,
 1167|  1.00M|				"%"PRIu64": Invalid tile byte count, tile %"PRIu32,
 1168|  1.00M|				     bytecount,
 1169|  1.00M|				     tile);
 1170|  1.00M|			return (0);
 1171|  1.00M|		}
 1172|       |
 1173|       |		/* To avoid excessive memory allocations: */
 1174|       |		/* Byte count should normally not be larger than a number of */
 1175|       |		/* times the uncompressed size plus some margin */
 1176|   423k|                if( bytecount > 1024 * 1024 )
  ------------------
  |  Branch (1176:21): [True: 10.4k, False: 412k]
  ------------------
 1177|  10.4k|                {
 1178|       |			/* 10 and 4096 are just values that could be adjusted. */
 1179|       |			/* Hopefully they are safe enough for all codecs */
 1180|  10.4k|			tmsize_t stripsize = TIFFTileSize(tif);
 1181|  10.4k|			if( stripsize != 0 &&
  ------------------
  |  Branch (1181:8): [True: 10.4k, False: 0]
  ------------------
 1182|  10.4k|			    (bytecount - 4096) / 10 > (uint64_t)stripsize  )
  ------------------
  |  Branch (1182:8): [True: 10.0k, False: 475]
  ------------------
 1183|  10.0k|			{
 1184|  10.0k|				uint64_t newbytecount = (uint64_t)stripsize * 10 + 4096;
 1185|  10.0k|				TIFFErrorExtR(tif, module,
 1186|  10.0k|				  "Too large tile byte count %"PRIu64", tile %"PRIu32". Limiting to %"PRIu64,
 1187|  10.0k|				     bytecount,
 1188|  10.0k|				     tile,
 1189|  10.0k|				     newbytecount);
 1190|  10.0k|				bytecount = newbytecount;
 1191|  10.0k|			}
 1192|  10.4k|		}
 1193|       |
 1194|   423k|		if (isMapped(tif)) {
  ------------------
  |  |  208|   423k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  102|   423k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (208:23): [True: 0, False: 423k]
  |  |  ------------------
  ------------------
 1195|       |			/*
 1196|       |			 * We must check for overflow, potentially causing
 1197|       |			 * an OOB read. Instead of simple
 1198|       |			 *
 1199|       |			 *  TIFFGetStrileOffset(tif, tile)+bytecount > tif->tif_size
 1200|       |			 *
 1201|       |			 * comparison (which can overflow) we do the following
 1202|       |			 * two comparisons:
 1203|       |			 */
 1204|      0|			if (bytecount > (uint64_t)tif->tif_size ||
  ------------------
  |  Branch (1204:8): [True: 0, False: 0]
  ------------------
 1205|      0|			    TIFFGetStrileOffset(tif, tile) > (uint64_t)tif->tif_size - bytecount) {
  ------------------
  |  Branch (1205:8): [True: 0, False: 0]
  ------------------
 1206|      0|				tif->tif_curtile = NOTILE;
  ------------------
  |  |   43|      0|#define NOTILE ((uint32_t)(-1))         /* undefined state */
  ------------------
 1207|      0|				return (0);
 1208|      0|			}
 1209|      0|		}
 1210|       |
 1211|   423k|		if (isMapped(tif) &&
  ------------------
  |  |  208|   846k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  102|   423k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (208:23): [True: 0, False: 423k]
  |  |  ------------------
  ------------------
 1212|   423k|		    (isFillOrder(tif, td->td_fillorder)
  ------------------
  |  |  209|      0|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  |  |  ------------------
  |  |  |  Branch (209:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1213|      0|		     || (tif->tif_flags & TIFF_NOBITREV))) {
  ------------------
  |  |   99|      0|	#define TIFF_NOBITREV    0x00100U /* inhibit bit reversal logic */
  ------------------
  |  Branch (1213:11): [True: 0, False: 0]
  ------------------
 1214|       |			/*
 1215|       |			 * The image is mapped into memory and we either don't
 1216|       |			 * need to flip bits or the compression routine is
 1217|       |			 * going to handle this operation itself.  In this
 1218|       |			 * case, avoid copying the raw data and instead just
 1219|       |			 * reference the data from the memory mapped file
 1220|       |			 * image.  This assumes that the decompression
 1221|       |			 * routines do not modify the contents of the raw data
 1222|       |			 * buffer (if they try to, the application will get a
 1223|       |			 * fault since the file is mapped read-only).
 1224|       |			 */
 1225|      0|			if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) {
  ------------------
  |  |  100|      0|	#define TIFF_MYBUFFER    0x00200U /* my raw data buffer; free on close */
  ------------------
  |  Branch (1225:8): [True: 0, False: 0]
  |  Branch (1225:44): [True: 0, False: 0]
  ------------------
 1226|      0|				_TIFFfree(tif->tif_rawdata);
 1227|      0|				tif->tif_rawdata = NULL;
 1228|      0|				tif->tif_rawdatasize = 0;
 1229|      0|			}
 1230|      0|			tif->tif_flags &= ~TIFF_MYBUFFER;
  ------------------
  |  |  100|      0|	#define TIFF_MYBUFFER    0x00200U /* my raw data buffer; free on close */
  ------------------
 1231|       |
 1232|      0|			tif->tif_rawdatasize = (tmsize_t)bytecount;
 1233|      0|			tif->tif_rawdata =
 1234|      0|				tif->tif_base + (tmsize_t)TIFFGetStrileOffset(tif, tile);
 1235|      0|                        tif->tif_rawdataoff = 0;
 1236|      0|                        tif->tif_rawdataloaded = (tmsize_t) bytecount;
 1237|      0|			tif->tif_flags |= TIFF_BUFFERMMAP;
  ------------------
  |  |  114|      0|        #define TIFF_BUFFERMMAP 0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
 1238|   423k|		} else {
 1239|       |			/*
 1240|       |			 * Expand raw data buffer, if needed, to hold data
 1241|       |			 * tile coming from file (perhaps should set upper
 1242|       |			 * bound on the size of a buffer we'll use?).
 1243|       |			 */
 1244|   423k|			tmsize_t bytecountm;
 1245|   423k|			bytecountm=(tmsize_t)bytecount;
 1246|   423k|			if ((uint64_t)bytecountm != bytecount)
  ------------------
  |  Branch (1246:8): [True: 0, False: 423k]
  ------------------
 1247|      0|			{
 1248|      0|				TIFFErrorExtR(tif,module,"Integer overflow");
 1249|      0|				return(0);
 1250|      0|			}
 1251|   423k|			if (bytecountm > tif->tif_rawdatasize) {
  ------------------
  |  Branch (1251:8): [True: 17.0k, False: 406k]
  ------------------
 1252|  17.0k|				tif->tif_curtile = NOTILE;
  ------------------
  |  |   43|  17.0k|#define NOTILE ((uint32_t)(-1))         /* undefined state */
  ------------------
 1253|  17.0k|				if ((tif->tif_flags & TIFF_MYBUFFER) == 0) {
  ------------------
  |  |  100|  17.0k|	#define TIFF_MYBUFFER    0x00200U /* my raw data buffer; free on close */
  ------------------
  |  Branch (1253:9): [True: 0, False: 17.0k]
  ------------------
 1254|      0|					TIFFErrorExtR(tif, module,
 1255|      0|					    "Data buffer too small to hold tile %"PRIu32,
 1256|      0|					    tile);
 1257|      0|					return (0);
 1258|      0|				}
 1259|  17.0k|			}
 1260|   423k|			if (tif->tif_flags&TIFF_BUFFERMMAP) {
  ------------------
  |  |  114|   423k|        #define TIFF_BUFFERMMAP 0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  |  Branch (1260:8): [True: 0, False: 423k]
  ------------------
 1261|      0|				tif->tif_curtile = NOTILE;
  ------------------
  |  |   43|      0|#define NOTILE ((uint32_t)(-1))         /* undefined state */
  ------------------
 1262|      0|				tif->tif_rawdata = NULL;
 1263|      0|				tif->tif_rawdatasize = 0;
 1264|      0|				tif->tif_flags &= ~TIFF_BUFFERMMAP;
  ------------------
  |  |  114|      0|        #define TIFF_BUFFERMMAP 0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
 1265|      0|			}
 1266|       |
 1267|   423k|			if( isMapped(tif) )
  ------------------
  |  |  208|   423k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  102|   423k|	#define TIFF_MAPPED      0x00800U /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (208:23): [True: 0, False: 423k]
  |  |  ------------------
  ------------------
 1268|      0|			{
 1269|      0|				if (bytecountm > tif->tif_rawdatasize &&
  ------------------
  |  Branch (1269:9): [True: 0, False: 0]
  ------------------
 1270|      0|				    !TIFFReadBufferSetup(tif, 0, bytecountm))
  ------------------
  |  Branch (1270:9): [True: 0, False: 0]
  ------------------
 1271|      0|				{
 1272|      0|					return (0);
 1273|      0|				}
 1274|      0|				if (TIFFReadRawTile1(tif, tile, tif->tif_rawdata,
  ------------------
  |  Branch (1274:9): [True: 0, False: 0]
  ------------------
 1275|      0|				    bytecountm, module) != bytecountm)
 1276|      0|				{
 1277|      0|					return (0);
 1278|      0|				}
 1279|      0|			}
 1280|   423k|			else
 1281|   423k|			{
 1282|   423k|				if (TIFFReadRawStripOrTile2(tif, tile, 0,
  ------------------
  |  Branch (1282:9): [True: 97.0k, False: 326k]
  ------------------
 1283|   423k|				    bytecountm, module) != bytecountm)
 1284|  97.0k|				{
 1285|  97.0k|					return (0);
 1286|  97.0k|				}
 1287|   423k|			}
 1288|       |
 1289|       |
 1290|   326k|                        tif->tif_rawdataoff = 0;
 1291|   326k|                        tif->tif_rawdataloaded = bytecountm;
 1292|       |                        
 1293|   326k|			if (tif->tif_rawdata != NULL &&
  ------------------
  |  Branch (1293:8): [True: 326k, False: 0]
  ------------------
 1294|   326k|                            !isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  209|   652k|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (1294:29): [True: 1.20k, False: 324k]
  ------------------
 1295|   326k|			    (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |   99|  1.20k|	#define TIFF_NOBITREV    0x00100U /* inhibit bit reversal logic */
  ------------------
  |  Branch (1295:8): [True: 980, False: 224]
  ------------------
 1296|    980|				TIFFReverseBits(tif->tif_rawdata,
 1297|    980|                                                tif->tif_rawdataloaded);
 1298|   326k|		}
 1299|   423k|	}
 1300|   382k|	return (TIFFStartTile(tif, tile));
 1301|  1.48M|}
_TIFFNoPostDecode:
 1548|   121k|{
 1549|   121k|    (void) tif; (void) buf; (void) cc;
 1550|   121k|}
tif_read.c:TIFFReadAndRealloc:
   57|   328k|{
   58|   328k|#if SIZEOF_SIZE_T == 8
   59|   328k|        tmsize_t threshold = INITIAL_THRESHOLD;
  ------------------
  |  |   45|   328k|#define INITIAL_THRESHOLD (1024 * 1024)
  ------------------
   60|   328k|#endif
   61|   328k|        tmsize_t already_read = 0;
   62|       |
   63|       |
   64|       |#if SIZEOF_SIZE_T != 8
   65|       |        /* On 32 bit processes, if the request is large enough, check against */
   66|       |        /* file size */
   67|       |        if( size > 1000 * 1000 * 1000 )
   68|       |        {
   69|       |            uint64_t filesize = TIFFGetFileSize(tif);
   70|       |            if((uint64_t)size >= filesize )
   71|       |            {
   72|       |                TIFFErrorExtR(tif, module,
   73|       |                             "Chunk size requested is larger than file size.");
   74|       |                return 0;
   75|       |            }
   76|       |        }
   77|       |#endif
   78|       |
   79|       |        /* On 64 bit processes, read first a maximum of 1 MB, then 10 MB, etc */
   80|       |        /* so as to avoid allocating too much memory in case the file is too */
   81|       |        /* short. We could ask for the file size, but this might be */
   82|       |        /* expensive with some I/O layers (think of reading a gzipped file) */
   83|       |        /* Restrict to 64 bit processes, so as to avoid reallocs() */
   84|       |        /* on 32 bit processes where virtual memory is scarce.  */
   85|   654k|        while( already_read < size )
  ------------------
  |  Branch (85:16): [True: 328k, False: 326k]
  ------------------
   86|   328k|        {
   87|   328k|            tmsize_t bytes_read;
   88|   328k|            tmsize_t to_read = size - already_read;
   89|   328k|#if SIZEOF_SIZE_T == 8
   90|   328k|            if( to_read >= threshold && threshold < MAX_THRESHOLD &&
  ------------------
  |  |   47|   328k|#define MAX_THRESHOLD (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  |   46|     95|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |               #define MAX_THRESHOLD (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  |   46|     95|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |               #define MAX_THRESHOLD (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  |   46|     95|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |               #define MAX_THRESHOLD (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  |   45|     95|#define INITIAL_THRESHOLD (1024 * 1024)
  |  |  ------------------
  ------------------
  |  Branch (90:17): [True: 95, False: 328k]
  |  Branch (90:41): [True: 95, False: 0]
  ------------------
   91|   328k|                already_read + to_read + rawdata_offset > tif->tif_rawdatasize )
  ------------------
  |  Branch (91:17): [True: 95, False: 0]
  ------------------
   92|     95|            {
   93|     95|                to_read = threshold;
   94|     95|                threshold *= THRESHOLD_MULTIPLIER;
  ------------------
  |  |   46|     95|#define THRESHOLD_MULTIPLIER 10
  ------------------
   95|     95|            }
   96|   328k|#endif
   97|   328k|            if (already_read + to_read + rawdata_offset > tif->tif_rawdatasize) {
  ------------------
  |  Branch (97:17): [True: 9.25k, False: 319k]
  ------------------
   98|  9.25k|                uint8_t* new_rawdata;
   99|  9.25k|                assert((tif->tif_flags & TIFF_MYBUFFER) != 0);
  100|  9.25k|                tif->tif_rawdatasize = (tmsize_t)TIFFroundup_64(
  ------------------
  |  |  253|  9.25k|#define TIFFroundup_64(x, y) (TIFFhowmany_64(x,y)*(y))
  |  |  ------------------
  |  |  |  |  251|  9.25k|#define TIFFhowmany_64(x, y) ((((uint64_t)(x))+(((uint64_t)(y))-1))/((uint64_t)(y)))
  |  |  ------------------
  ------------------
  101|  9.25k|                        (uint64_t)already_read + to_read + rawdata_offset, 1024);
  102|  9.25k|                if (tif->tif_rawdatasize==0) {
  ------------------
  |  Branch (102:21): [True: 0, False: 9.25k]
  ------------------
  103|      0|                    TIFFErrorExtR(tif, module,
  104|      0|                                "Invalid buffer size");
  105|      0|                    return 0;
  106|      0|                }
  107|  9.25k|                new_rawdata = (uint8_t*) _TIFFrealloc(
  108|  9.25k|                                tif->tif_rawdata, tif->tif_rawdatasize);
  109|  9.25k|                if( new_rawdata == 0 )
  ------------------
  |  Branch (109:21): [True: 0, False: 9.25k]
  ------------------
  110|      0|                {
  111|      0|                    TIFFErrorExtR(tif, module,
  112|      0|                        "No space for data buffer at scanline %"PRIu32,
  113|      0|                        tif->tif_row);
  114|      0|                    _TIFFfree(tif->tif_rawdata);
  115|      0|                    tif->tif_rawdata = 0;
  116|      0|                    tif->tif_rawdatasize = 0;
  117|      0|                    return 0;
  118|      0|                }
  119|  9.25k|                tif->tif_rawdata = new_rawdata;
  120|  9.25k|            }
  121|   328k|            if( tif->tif_rawdata == NULL )
  ------------------
  |  Branch (121:17): [True: 0, False: 328k]
  ------------------
  122|      0|            {
  123|       |                /* should not happen in practice but helps CoverityScan */
  124|      0|                return 0;
  125|      0|            }
  126|       |
  127|   328k|            bytes_read = TIFFReadFile(tif,
  ------------------
  |  |  212|   328k|	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
  ------------------
  128|   328k|                tif->tif_rawdata + rawdata_offset + already_read, to_read);
  129|   328k|            already_read += bytes_read;
  130|   328k|            if (bytes_read != to_read) {
  ------------------
  |  Branch (130:17): [True: 2.61k, False: 326k]
  ------------------
  131|  2.61k|                memset( tif->tif_rawdata + rawdata_offset + already_read, 0,
  132|  2.61k|                        tif->tif_rawdatasize - rawdata_offset - already_read );
  133|  2.61k|                if( is_strip )
  ------------------
  |  Branch (133:21): [True: 0, False: 2.61k]
  ------------------
  134|      0|                {
  135|      0|                    TIFFErrorExtR(tif, module,
  136|      0|                        "Read error at scanline %"PRIu32"; got %"TIFF_SSIZE_FORMAT" bytes, "
  137|      0|                        "expected %"TIFF_SSIZE_FORMAT,
  ------------------
  |  |  144|      0|#  define TIFF_SSIZE_FORMAT PRId64
  ------------------
  138|      0|                                        tif->tif_row,
  139|      0|                                        already_read,
  140|      0|                                        size);
  141|      0|                }
  142|  2.61k|                else
  143|  2.61k|                {
  144|  2.61k|                    TIFFErrorExtR(tif, module,
  145|  2.61k|                        "Read error at row %"PRIu32", col %"PRIu32", tile %"PRIu32"; "
  146|  2.61k|                        "got %"TIFF_SSIZE_FORMAT" bytes, expected %"TIFF_SSIZE_FORMAT"",
  147|  2.61k|                                        tif->tif_row,
  148|  2.61k|                                        tif->tif_col,
  149|  2.61k|                                        strip_or_tile,
  150|  2.61k|                                        already_read,
  151|  2.61k|                                        size);
  152|  2.61k|                }
  153|  2.61k|                return 0;
  154|  2.61k|            }
  155|   328k|        }
  156|   326k|        return 1;
  157|   328k|}
tif_read.c:TIFFReadRawStripOrTile2:
  646|   423k|{
  647|   423k|        assert( !isMapped(tif) );
  648|   423k|        assert((tif->tif_flags&TIFF_NOREADRAW)==0);
  649|       |
  650|   423k|        if (!SeekOK(tif, TIFFGetStrileOffset(tif, strip_or_tile))) {
  ------------------
  |  |  234|   423k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (650:13): [True: 94.4k, False: 328k]
  ------------------
  651|  94.4k|            if( is_strip )
  ------------------
  |  Branch (651:17): [True: 0, False: 94.4k]
  ------------------
  652|      0|            {
  653|      0|                TIFFErrorExtR(tif, module,
  654|      0|                    "Seek error at scanline %"PRIu32", strip %"PRIu32,
  655|      0|                    tif->tif_row,
  656|      0|                    strip_or_tile);
  657|      0|            }
  658|  94.4k|            else
  659|  94.4k|            {
  660|  94.4k|                TIFFErrorExtR(tif, module,
  661|  94.4k|                    "Seek error at row %"PRIu32", col %"PRIu32", tile %"PRIu32,
  662|  94.4k|                    tif->tif_row,
  663|  94.4k|                    tif->tif_col,
  664|  94.4k|                    strip_or_tile);
  665|  94.4k|            }
  666|  94.4k|            return ((tmsize_t)(-1));
  667|  94.4k|        }
  668|       |
  669|   328k|        if( !TIFFReadAndRealloc( tif, size, 0, is_strip,
  ------------------
  |  Branch (669:13): [True: 2.61k, False: 326k]
  ------------------
  670|   328k|                                 strip_or_tile, module ) )
  671|  2.61k|        {
  672|  2.61k|            return ((tmsize_t)(-1));
  673|  2.61k|        }
  674|       |
  675|   326k|        return (size);
  676|   328k|}
tif_read.c:TIFFStartTile:
 1401|   382k|{
 1402|   382k|        static const char module[] = "TIFFStartTile";
 1403|   382k|	TIFFDirectory *td = &tif->tif_dir;
 1404|   382k|        uint32_t howmany32;
 1405|       |
 1406|   382k|	if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {
  ------------------
  |  |   96|   382k|	#define TIFF_CODERSETUP  0x00020U /* encoder/decoder setup done */
  ------------------
  |  Branch (1406:6): [True: 10.7k, False: 371k]
  ------------------
 1407|  10.7k|		if (!(*tif->tif_setupdecode)(tif))
  ------------------
  |  Branch (1407:7): [True: 25, False: 10.7k]
  ------------------
 1408|     25|			return (0);
 1409|  10.7k|		tif->tif_flags |= TIFF_CODERSETUP;
  ------------------
  |  |   96|  10.7k|	#define TIFF_CODERSETUP  0x00020U /* encoder/decoder setup done */
  ------------------
 1410|  10.7k|	}
 1411|   382k|	tif->tif_curtile = tile;
 1412|   382k|        howmany32=TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth);
  ------------------
  |  |  242|   382k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 382k, False: 0]
  |  |  ------------------
  |  |  243|   382k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|   382k|			   0U)
  ------------------
 1413|   382k|        if (howmany32 == 0) {
  ------------------
  |  Branch (1413:13): [True: 0, False: 382k]
  ------------------
 1414|      0|                 TIFFErrorExtR(tif,module,"Zero tiles");
 1415|      0|                return 0;
 1416|      0|        }
 1417|   382k|	tif->tif_row = (tile % howmany32) * td->td_tilelength;
 1418|   382k|        howmany32=TIFFhowmany_32(td->td_imagelength, td->td_tilelength);
  ------------------
  |  |  242|   382k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 382k, False: 0]
  |  |  ------------------
  |  |  243|   382k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|   382k|			   0U)
  ------------------
 1419|   382k|        if (howmany32 == 0) {
  ------------------
  |  Branch (1419:13): [True: 0, False: 382k]
  ------------------
 1420|      0|                TIFFErrorExtR(tif,module,"Zero tiles");
 1421|      0|                return 0;
 1422|      0|        }
 1423|   382k|	tif->tif_col = (tile % howmany32) * td->td_tilewidth;
 1424|   382k|        tif->tif_flags &= ~TIFF_BUF4WRITE;
  ------------------
  |  |  111|   382k|        #define TIFF_BUF4WRITE  0x100000U /* rawcc bytes are for writing */
  ------------------
 1425|   382k|	if (tif->tif_flags&TIFF_NOREADRAW)
  ------------------
  |  |  108|   382k|	#define TIFF_NOREADRAW   0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1425:6): [True: 56.1k, False: 326k]
  ------------------
 1426|  56.1k|	{
 1427|  56.1k|		tif->tif_rawcp = NULL;
 1428|  56.1k|		tif->tif_rawcc = 0;
 1429|  56.1k|	}
 1430|   326k|	else
 1431|   326k|	{
 1432|   326k|		tif->tif_rawcp = tif->tif_rawdata;
 1433|   326k|		if( tif->tif_rawdataloaded > 0 )
  ------------------
  |  Branch (1433:7): [True: 326k, False: 0]
  ------------------
 1434|   326k|			tif->tif_rawcc = tif->tif_rawdataloaded;
 1435|      0|		else
 1436|      0|			tif->tif_rawcc = (tmsize_t)TIFFGetStrileByteCount(tif, tile);
 1437|   326k|	}
 1438|   382k|	return ((*tif->tif_predecode)(tif,
 1439|   382k|			(uint16_t)(tile / td->td_stripsperimage)));
 1440|   382k|}
tif_read.c:TIFFCheckRead:
 1444|  2.96M|{
 1445|  2.96M|	if (tif->tif_mode == O_WRONLY) {
  ------------------
  |  Branch (1445:6): [True: 0, False: 2.96M]
  ------------------
 1446|      0|		TIFFErrorExtR(tif, tif->tif_name, "File not open for reading");
 1447|      0|		return (0);
 1448|      0|	}
 1449|  2.96M|	if (tiles ^ isTiled(tif)) {
  ------------------
  |  |  207|  2.96M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  101|  2.96M|	#define TIFF_ISTILED     0x00400U /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (1449:6): [True: 0, False: 2.96M]
  ------------------
 1450|      0|		TIFFErrorExtR(tif, tif->tif_name, tiles ?
  ------------------
  |  Branch (1450:37): [True: 0, False: 0]
  ------------------
 1451|      0|		    "Can not read tiles from a striped image" :
 1452|      0|		    "Can not read scanlines from a tiled image");
 1453|      0|		return (0);
 1454|      0|	}
 1455|  2.96M|	return (1);
 1456|  2.96M|}

_Z14TIFFStreamOpenPKcPNSt3__113basic_istreamIcNS1_11char_traitsIcEEEE:
  415|  23.5k|{
  416|       |	// NB: We don't support mapped files with streams so add 'm'
  417|  23.5k|	return _tiffStreamOpen(name, "rm", is);
  418|  23.5k|}
tif_stream.cxx:_ZL15_tiffStreamOpenPKcS0_Pv:
  352|  23.5k|{
  353|  23.5k|	TIFF*	tif;
  354|       |
  355|  23.5k|	if( strchr(mode, 'w') ) {
  ------------------
  |  Branch (355:6): [True: 0, False: 23.5k]
  ------------------
  356|      0|		tiffos_data	*data = new tiffos_data;
  357|      0|		data->stream = reinterpret_cast<ostream *>(fd);
  358|      0|		data->start_pos = data->stream->tellp();
  359|       |
  360|       |		// Open for writing.
  361|      0|		tif = TIFFClientOpen(name, mode,
  362|      0|				reinterpret_cast<thandle_t>(data),
  363|      0|				_tiffosReadProc,
  364|      0|                                _tiffosWriteProc,
  365|      0|				_tiffosSeekProc,
  366|      0|                                _tiffosCloseProc,
  367|      0|				_tiffosSizeProc,
  368|      0|				_tiffDummyMapProc,
  369|      0|                                _tiffDummyUnmapProc);
  370|      0|		if (!tif) {
  ------------------
  |  Branch (370:7): [True: 0, False: 0]
  ------------------
  371|      0|			delete data;
  372|      0|		}
  373|  23.5k|	} else {
  374|  23.5k|		tiffis_data	*data = new tiffis_data;
  375|  23.5k|		data->stream = reinterpret_cast<istream *>(fd);
  376|  23.5k|		data->start_pos = data->stream->tellg();
  377|       |		// Open for reading.
  378|  23.5k|		tif = TIFFClientOpen(name, mode,
  379|  23.5k|				reinterpret_cast<thandle_t>(data),
  380|  23.5k|				_tiffisReadProc,
  381|  23.5k|                                _tiffisWriteProc,
  382|  23.5k|				_tiffisSeekProc,
  383|  23.5k|                                _tiffisCloseProc,
  384|  23.5k|				_tiffisSizeProc,
  385|  23.5k|				_tiffDummyMapProc,
  386|  23.5k|                                _tiffDummyUnmapProc);
  387|  23.5k|		if (!tif) {
  ------------------
  |  Branch (387:7): [True: 10.3k, False: 13.2k]
  ------------------
  388|  10.3k|			delete data;
  389|  10.3k|		}
  390|  23.5k|	}
  391|       |
  392|  23.5k|	return (tif);
  393|  23.5k|}
tif_stream.cxx:_ZL15_tiffisReadProcPvS_l:
  113|   549k|{
  114|   549k|        tiffis_data	*data = reinterpret_cast<tiffis_data *>(fd);
  115|       |
  116|       |        // Verify that type does not overflow.
  117|   549k|        streamsize request_size = size;
  118|   549k|        if (static_cast<tmsize_t>(request_size) != size)
  ------------------
  |  Branch (118:13): [True: 0, False: 549k]
  ------------------
  119|      0|          return static_cast<tmsize_t>(-1);
  120|       |
  121|   549k|        data->stream->read((char *) buf, request_size);
  122|       |
  123|   549k|        return static_cast<tmsize_t>(data->stream->gcount());
  124|   549k|}
tif_stream.cxx:_ZL15_tiffisSeekProcPvmi:
  245|   569k|{
  246|   569k|	tiffis_data	*data = reinterpret_cast<tiffis_data *>(fd);
  247|       |
  248|   569k|	switch(whence) {
  ------------------
  |  Branch (248:9): [True: 0, False: 569k]
  ------------------
  249|   569k|	case SEEK_SET:
  ------------------
  |  Branch (249:2): [True: 569k, False: 0]
  ------------------
  250|   569k|		{
  251|       |			// Compute 64-bit offset
  252|   569k|			uint64_t new_offset = static_cast<uint64_t>(data->start_pos) + off;
  253|       |			
  254|       |			// Verify that value does not overflow
  255|   569k|			ios::off_type offset = static_cast<ios::off_type>(new_offset);
  256|   569k|			if (static_cast<uint64_t>(offset) != new_offset)
  ------------------
  |  Branch (256:8): [True: 0, False: 569k]
  ------------------
  257|      0|				return static_cast<uint64_t>(-1);
  258|       |
  259|   569k|			data->stream->seekg(offset, ios::beg);
  260|   569k|			break;
  261|   569k|		}
  262|      0|	case SEEK_CUR:
  ------------------
  |  Branch (262:2): [True: 0, False: 569k]
  ------------------
  263|      0|		{
  264|       |			// Verify that value does not overflow
  265|      0|			ios::off_type offset = static_cast<ios::off_type>(off);
  266|      0|			if (static_cast<uint64_t>(offset) != off)
  ------------------
  |  Branch (266:8): [True: 0, False: 0]
  ------------------
  267|      0|				return static_cast<uint64_t>(-1);
  268|       |
  269|      0|			data->stream->seekg(offset, ios::cur);
  270|      0|			break;
  271|      0|		}
  272|      0|	case SEEK_END:
  ------------------
  |  Branch (272:2): [True: 0, False: 569k]
  ------------------
  273|      0|		{
  274|       |			// Verify that value does not overflow
  275|      0|			ios::off_type offset = static_cast<ios::off_type>(off);
  276|      0|			if (static_cast<uint64_t>(offset) != off)
  ------------------
  |  Branch (276:8): [True: 0, False: 0]
  ------------------
  277|      0|				return static_cast<uint64_t>(-1);
  278|       |
  279|      0|			data->stream->seekg(offset, ios::end);
  280|      0|			break;
  281|      0|		}
  282|   569k|	}
  283|       |
  284|   569k|	return (uint64_t) (data->stream->tellg() - data->start_pos);
  285|   569k|}
tif_stream.cxx:_ZL16_tiffisCloseProcPv:
  326|  13.2k|{
  327|       |	// Our stream was not allocated by us, so it shouldn't be closed by us.
  328|  13.2k|	delete reinterpret_cast<tiffis_data *>(fd);
  329|  13.2k|	return 0;
  330|  13.2k|}
tif_stream.cxx:_ZL15_tiffisSizeProcPv:
  304|  8.44k|{
  305|  8.44k|	tiffis_data	*data = reinterpret_cast<tiffis_data *>(fd);
  306|  8.44k|	ios::pos_type	pos = data->stream->tellg();
  307|  8.44k|	ios::pos_type	len;
  308|       |
  309|  8.44k|	data->stream->seekg(0, ios::end);
  310|  8.44k|	len = data->stream->tellg();
  311|  8.44k|	data->stream->seekg(pos);
  312|       |
  313|  8.44k|	return (uint64_t) len;
  314|  8.44k|}

TIFFNumberOfStrips:
   60|  8.40k|{
   61|  8.40k|	TIFFDirectory *td = &tif->tif_dir;
   62|  8.40k|	uint32_t nstrips;
   63|       |
   64|  8.40k|	nstrips = (td->td_rowsperstrip == (uint32_t) -1 ? 1 :
  ------------------
  |  Branch (64:13): [True: 7.40k, False: 999]
  ------------------
   65|  8.40k|               TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
  ------------------
  |  |  242|    999|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 973, False: 26]
  |  |  ------------------
  |  |  243|    999|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|    999|			   0U)
  ------------------
   66|  8.40k|	if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  260|  8.40k|#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  ------------------
  |  Branch (66:6): [True: 36, False: 8.36k]
  ------------------
   67|     36|		nstrips = _TIFFMultiply32(tif, nstrips, (uint32_t)td->td_samplesperpixel,
   68|     36|		    "TIFFNumberOfStrips");
   69|  8.40k|	return (nstrips);
   70|  8.40k|}
TIFFVStripSize64:
   77|  5.83k|{
   78|  5.83k|	static const char module[] = "TIFFVStripSize64";
   79|  5.83k|	TIFFDirectory *td = &tif->tif_dir;
   80|  5.83k|	if (nrows==(uint32_t)(-1))
  ------------------
  |  Branch (80:6): [True: 53, False: 5.78k]
  ------------------
   81|     53|		nrows=td->td_imagelength;
   82|  5.83k|	if ((td->td_planarconfig==PLANARCONFIG_CONTIG)&&
  ------------------
  |  |  259|  5.83k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (82:6): [True: 5.82k, False: 11]
  ------------------
   83|  5.83k|	    (td->td_photometric == PHOTOMETRIC_YCBCR)&&
  ------------------
  |  |  221|  5.82k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (83:6): [True: 1.25k, False: 4.56k]
  ------------------
   84|  5.83k|	    (!isUpSampled(tif)))
  ------------------
  |  |  210|  1.25k|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  105|  1.25k|	#define TIFF_UPSAMPLED   0x04000U /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (84:6): [True: 1.25k, False: 0]
  ------------------
   85|  1.25k|	{
   86|       |		/*
   87|       |		 * Packed YCbCr data contain one Cb+Cr for every
   88|       |		 * HorizontalSampling*VerticalSampling Y values.
   89|       |		 * Must also roundup width and height when calculating
   90|       |		 * since images that are not a multiple of the
   91|       |		 * horizontal/vertical subsampling area include
   92|       |		 * YCbCr data for the extended image.
   93|       |		 */
   94|  1.25k|		uint16_t ycbcrsubsampling[2];
   95|  1.25k|		uint16_t samplingblock_samples;
   96|  1.25k|		uint32_t samplingblocks_hor;
   97|  1.25k|		uint32_t samplingblocks_ver;
   98|  1.25k|		uint64_t samplingrow_samples;
   99|  1.25k|		uint64_t samplingrow_size;
  100|  1.25k|		if(td->td_samplesperpixel!=3)
  ------------------
  |  Branch (100:6): [True: 39, False: 1.21k]
  ------------------
  101|     39|		{
  102|     39|			TIFFErrorExtR(tif,module,
  103|     39|			    "Invalid td_samplesperpixel value");
  104|     39|			return 0;
  105|     39|		}
  106|  1.21k|		TIFFGetFieldDefaulted(tif,TIFFTAG_YCBCRSUBSAMPLING,ycbcrsubsampling+0,
  ------------------
  |  |  386|  1.21k|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
  107|  1.21k|		    ycbcrsubsampling+1);
  108|  1.21k|		if ((ycbcrsubsampling[0] != 1 && ycbcrsubsampling[0] != 2 && ycbcrsubsampling[0] != 4)
  ------------------
  |  Branch (108:8): [True: 1.16k, False: 46]
  |  Branch (108:36): [True: 35, False: 1.13k]
  |  Branch (108:64): [True: 11, False: 24]
  ------------------
  109|  1.21k|		    ||(ycbcrsubsampling[1] != 1 && ycbcrsubsampling[1] != 2 && ycbcrsubsampling[1] != 4))
  ------------------
  |  Branch (109:10): [True: 1.15k, False: 50]
  |  Branch (109:38): [True: 28, False: 1.12k]
  |  Branch (109:66): [True: 16, False: 12]
  ------------------
  110|     27|		{
  111|     27|			TIFFErrorExtR(tif,module,
  112|     27|				     "Invalid YCbCr subsampling (%dx%d)", 
  113|     27|				     ycbcrsubsampling[0], 
  114|     27|				     ycbcrsubsampling[1] );
  115|     27|			return 0;
  116|     27|		}
  117|  1.18k|		samplingblock_samples=ycbcrsubsampling[0]*ycbcrsubsampling[1]+2;
  118|  1.18k|		samplingblocks_hor=TIFFhowmany_32(td->td_imagewidth,ycbcrsubsampling[0]);
  ------------------
  |  |  242|  1.18k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 1.18k, False: 1]
  |  |  ------------------
  |  |  243|  1.18k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|  1.18k|			   0U)
  ------------------
  119|  1.18k|		samplingblocks_ver=TIFFhowmany_32(nrows,ycbcrsubsampling[1]);
  ------------------
  |  |  242|  1.18k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 1.18k, False: 3]
  |  |  ------------------
  |  |  243|  1.18k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|  1.18k|			   0U)
  ------------------
  120|  1.18k|		samplingrow_samples=_TIFFMultiply64(tif,samplingblocks_hor,samplingblock_samples,module);
  121|  1.18k|		samplingrow_size=TIFFhowmany8_64(_TIFFMultiply64(tif,samplingrow_samples,td->td_bitspersample,module));
  ------------------
  |  |  252|  1.18k|#define TIFFhowmany8_64(x) (((x)&0x07)?((uint64_t)(x)>>3)+1:(uint64_t)(x)>>3)
  |  |  ------------------
  |  |  |  Branch (252:29): [True: 138, False: 1.04k]
  |  |  ------------------
  ------------------
  122|  1.18k|		return(_TIFFMultiply64(tif,samplingrow_size,samplingblocks_ver,module));
  123|  1.21k|	}
  124|  4.58k|	else
  125|  4.58k|		return(_TIFFMultiply64(tif,nrows,TIFFScanlineSize64(tif),module));
  126|  5.83k|}
TIFFStripSize64:
  187|  4.69k|{
  188|  4.69k|	TIFFDirectory* td = &tif->tif_dir;
  189|  4.69k|	uint32_t rps = td->td_rowsperstrip;
  190|  4.69k|	if (rps > td->td_imagelength)
  ------------------
  |  Branch (190:6): [True: 1.95k, False: 2.73k]
  ------------------
  191|  1.95k|		rps = td->td_imagelength;
  192|  4.69k|	return (TIFFVStripSize64(tif, rps));
  193|  4.69k|}
TIFFStripSize:
  196|  2.47k|{
  197|  2.47k|	static const char module[] = "TIFFStripSize";
  198|  2.47k|	uint64_t m;
  199|  2.47k|	m=TIFFStripSize64(tif);
  200|  2.47k|	return _TIFFCastUInt64ToSSize(tif, m, module);
  201|  2.47k|}
TIFFScanlineSize64:
  251|  23.6k|{
  252|  23.6k|	static const char module[] = "TIFFScanlineSize64";
  253|  23.6k|	TIFFDirectory *td = &tif->tif_dir;
  254|  23.6k|	uint64_t scanline_size;
  255|  23.6k|	if (td->td_planarconfig==PLANARCONFIG_CONTIG)
  ------------------
  |  |  259|  23.6k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (255:6): [True: 22.6k, False: 1.03k]
  ------------------
  256|  22.6k|	{
  257|  22.6k|		if ((td->td_photometric==PHOTOMETRIC_YCBCR)&&
  ------------------
  |  |  221|  22.6k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (257:7): [True: 6.61k, False: 16.0k]
  ------------------
  258|  22.6k|		    (td->td_samplesperpixel==3)&&
  ------------------
  |  Branch (258:7): [True: 6.53k, False: 83]
  ------------------
  259|  22.6k|		    (!isUpSampled(tif)))
  ------------------
  |  |  210|  6.53k|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  105|  6.53k|	#define TIFF_UPSAMPLED   0x04000U /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (259:7): [True: 4.93k, False: 1.59k]
  ------------------
  260|  4.93k|		{
  261|  4.93k|			uint16_t ycbcrsubsampling[2];
  262|  4.93k|			uint16_t samplingblock_samples;
  263|  4.93k|			uint32_t samplingblocks_hor;
  264|  4.93k|			uint64_t samplingrow_samples;
  265|  4.93k|			uint64_t samplingrow_size;
  266|  4.93k|			if(td->td_samplesperpixel!=3)
  ------------------
  |  Branch (266:7): [True: 0, False: 4.93k]
  ------------------
  267|      0|			{
  268|      0|                            TIFFErrorExtR(tif,module,
  269|      0|                                         "Invalid td_samplesperpixel value");
  270|      0|                            return 0;
  271|      0|			}
  272|  4.93k|			TIFFGetFieldDefaulted(tif,TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  386|  4.93k|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
  273|  4.93k|                                              ycbcrsubsampling+0,
  274|  4.93k|                                              ycbcrsubsampling+1);
  275|  4.93k|			if (((ycbcrsubsampling[0]!=1)&&(ycbcrsubsampling[0]!=2)&&(ycbcrsubsampling[0]!=4)) ||
  ------------------
  |  Branch (275:9): [True: 4.62k, False: 306]
  |  Branch (275:35): [True: 369, False: 4.25k]
  |  Branch (275:61): [True: 36, False: 333]
  ------------------
  276|  4.93k|			    ((ycbcrsubsampling[1]!=1)&&(ycbcrsubsampling[1]!=2)&&(ycbcrsubsampling[1]!=4)))
  ------------------
  |  Branch (276:9): [True: 4.58k, False: 317]
  |  Branch (276:35): [True: 269, False: 4.31k]
  |  Branch (276:61): [True: 41, False: 228]
  ------------------
  277|     77|			{
  278|     77|                            TIFFErrorExtR(tif,module,
  279|     77|                                         "Invalid YCbCr subsampling");
  280|     77|                            return 0;
  281|     77|			}
  282|  4.85k|			samplingblock_samples = ycbcrsubsampling[0]*ycbcrsubsampling[1]+2;
  283|  4.85k|			samplingblocks_hor = TIFFhowmany_32(td->td_imagewidth,ycbcrsubsampling[0]);
  ------------------
  |  |  242|  4.85k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 4.84k, False: 8]
  |  |  ------------------
  |  |  243|  4.85k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|  4.85k|			   0U)
  ------------------
  284|  4.85k|			samplingrow_samples = _TIFFMultiply64(tif,samplingblocks_hor,samplingblock_samples,module);
  285|  4.85k|			samplingrow_size = TIFFhowmany_64(_TIFFMultiply64(tif,samplingrow_samples,td->td_bitspersample,module),8);
  ------------------
  |  |  251|  4.85k|#define TIFFhowmany_64(x, y) ((((uint64_t)(x))+(((uint64_t)(y))-1))/((uint64_t)(y)))
  ------------------
  286|  4.85k|			scanline_size = (samplingrow_size/ycbcrsubsampling[1]);
  287|  4.85k|		}
  288|  17.6k|		else
  289|  17.6k|		{
  290|  17.6k|			uint64_t scanline_samples;
  291|  17.6k|			scanline_samples=_TIFFMultiply64(tif,td->td_imagewidth,td->td_samplesperpixel,module);
  292|  17.6k|			scanline_size=TIFFhowmany_64(_TIFFMultiply64(tif,scanline_samples,td->td_bitspersample,module),8);
  ------------------
  |  |  251|  17.6k|#define TIFFhowmany_64(x, y) ((((uint64_t)(x))+(((uint64_t)(y))-1))/((uint64_t)(y)))
  ------------------
  293|  17.6k|		}
  294|  22.6k|	}
  295|  1.03k|	else
  296|  1.03k|        {
  297|  1.03k|		scanline_size=TIFFhowmany_64(_TIFFMultiply64(tif,td->td_imagewidth,td->td_bitspersample,module),8);
  ------------------
  |  |  251|  1.03k|#define TIFFhowmany_64(x, y) ((((uint64_t)(x))+(((uint64_t)(y))-1))/((uint64_t)(y)))
  ------------------
  298|  1.03k|        }
  299|  23.5k|        if (scanline_size == 0)
  ------------------
  |  Branch (299:13): [True: 1.93k, False: 21.6k]
  ------------------
  300|  1.93k|        {
  301|  1.93k|                TIFFErrorExtR(tif,module,"Computed scanline size is zero");
  302|  1.93k|                return 0;
  303|  1.93k|        }
  304|  21.6k|	return(scanline_size);
  305|  23.5k|}
TIFFScanlineSize:
  308|  17.7k|{
  309|  17.7k|	static const char module[] = "TIFFScanlineSize";
  310|  17.7k|	uint64_t m;
  311|  17.7k|	m=TIFFScanlineSize64(tif);
  312|  17.7k|	return _TIFFCastUInt64ToSSize(tif, m, module);
  313|  17.7k|}

TIFFSwabShort:
   35|  38.4k|{
   36|  38.4k|	register unsigned char* cp = (unsigned char*) wp;
   37|  38.4k|	unsigned char t;
   38|  38.4k|	assert(sizeof(uint16_t) == 2);
   39|  38.4k|	t = cp[1]; cp[1] = cp[0]; cp[0] = t;
   40|  38.4k|}
TIFFSwabLong:
   46|  36.3k|{
   47|  36.3k|	register unsigned char* cp = (unsigned char*) lp;
   48|  36.3k|	unsigned char t;
   49|  36.3k|	assert(sizeof(uint32_t) == 4);
   50|  36.3k|	t = cp[3]; cp[3] = cp[0]; cp[0] = t;
   51|  36.3k|	t = cp[2]; cp[2] = cp[1]; cp[1] = t;
   52|  36.3k|}
TIFFSwabLong8:
   58|  3.46k|{
   59|  3.46k|	register unsigned char* cp = (unsigned char*) lp;
   60|  3.46k|	unsigned char t;
   61|  3.46k|	assert(sizeof(uint64_t) == 8);
   62|  3.46k|	t = cp[7]; cp[7] = cp[0]; cp[0] = t;
   63|  3.46k|	t = cp[6]; cp[6] = cp[1]; cp[1] = t;
   64|  3.46k|	t = cp[5]; cp[5] = cp[2]; cp[2] = t;
   65|  3.46k|	t = cp[4]; cp[4] = cp[3]; cp[3] = t;
   66|  3.46k|}
TIFFSwabArrayOfShort:
   72|    488|{
   73|    488|	register unsigned char* cp;
   74|    488|	register unsigned char t;
   75|    488|	assert(sizeof(uint16_t) == 2);
   76|       |	/* XXX unroll loop some */
   77|  8.43k|	while (n-- > 0) {
  ------------------
  |  Branch (77:9): [True: 7.94k, False: 488]
  ------------------
   78|  7.94k|		cp = (unsigned char*) wp;
   79|  7.94k|		t = cp[1]; cp[1] = cp[0]; cp[0] = t;
   80|  7.94k|		wp++;
   81|  7.94k|	}
   82|    488|}
TIFFSwabArrayOfLong:
  104|    239|{
  105|    239|	register unsigned char *cp;
  106|    239|	register unsigned char t;
  107|    239|	assert(sizeof(uint32_t) == 4);
  108|       |	/* XXX unroll loop some */
  109|  1.68k|	while (n-- > 0) {
  ------------------
  |  Branch (109:9): [True: 1.44k, False: 239]
  ------------------
  110|  1.44k|		cp = (unsigned char *)lp;
  111|  1.44k|		t = cp[3]; cp[3] = cp[0]; cp[0] = t;
  112|  1.44k|		t = cp[2]; cp[2] = cp[1]; cp[1] = t;
  113|  1.44k|		lp++;
  114|  1.44k|	}
  115|    239|}
TIFFSwabArrayOfLong8:
  121|     92|{
  122|     92|	register unsigned char *cp;
  123|     92|	register unsigned char t;
  124|     92|	assert(sizeof(uint64_t) == 8);
  125|       |	/* XXX unroll loop some */
  126|    967|	while (n-- > 0) {
  ------------------
  |  Branch (126:9): [True: 875, False: 92]
  ------------------
  127|    875|		cp = (unsigned char *)lp;
  128|    875|		t = cp[7]; cp[7] = cp[0]; cp[0] = t;
  129|    875|		t = cp[6]; cp[6] = cp[1]; cp[1] = t;
  130|    875|		t = cp[5]; cp[5] = cp[2]; cp[2] = t;
  131|    875|		t = cp[4]; cp[4] = cp[3]; cp[3] = t;
  132|    875|		lp++;
  133|    875|	}
  134|     92|}
TIFFGetBitRevTable:
  279|  77.7k|{
  280|  77.7k|	return (reversed ? TIFFBitRevTable : TIFFNoBitRevTable);
  ------------------
  |  Branch (280:10): [True: 77.5k, False: 223]
  ------------------
  281|  77.7k|}
TIFFReverseBits:
  285|    980|{
  286|  73.6k|	for (; n > 8; n -= 8) {
  ------------------
  |  Branch (286:9): [True: 72.6k, False: 980]
  ------------------
  287|  72.6k|		cp[0] = TIFFBitRevTable[cp[0]];
  288|  72.6k|		cp[1] = TIFFBitRevTable[cp[1]];
  289|  72.6k|		cp[2] = TIFFBitRevTable[cp[2]];
  290|  72.6k|		cp[3] = TIFFBitRevTable[cp[3]];
  291|  72.6k|		cp[4] = TIFFBitRevTable[cp[4]];
  292|  72.6k|		cp[5] = TIFFBitRevTable[cp[5]];
  293|  72.6k|		cp[6] = TIFFBitRevTable[cp[6]];
  294|  72.6k|		cp[7] = TIFFBitRevTable[cp[7]];
  295|  72.6k|		cp += 8;
  296|  72.6k|	}
  297|  4.73k|	while (n-- > 0) {
  ------------------
  |  Branch (297:9): [True: 3.75k, False: 980]
  ------------------
  298|  3.75k|		*cp = TIFFBitRevTable[*cp];
  299|  3.75k|		cp++;
  300|  3.75k|	}
  301|    980|}

TIFFInitThunderScan:
  180|     21|{
  181|     21|	(void) scheme;
  182|       |
  183|     21|        tif->tif_setupdecode = ThunderSetupDecode;
  184|     21|	tif->tif_decoderow = ThunderDecodeRow;
  185|     21|	tif->tif_decodestrip = ThunderDecodeRow; 
  186|     21|	return (1);
  187|     21|}
tif_thunder.c:ThunderSetupDecode:
   70|     19|{
   71|     19|	static const char module[] = "ThunderSetupDecode";
   72|       |
   73|     19|        if( tif->tif_dir.td_bitspersample != 4 )
  ------------------
  |  Branch (73:13): [True: 1, False: 18]
  ------------------
   74|      1|        {
   75|      1|                TIFFErrorExtR(tif, module,
   76|      1|                             "Wrong bitspersample value (%d), Thunder decoder only supports 4bits per sample.",
   77|      1|                             (int) tif->tif_dir.td_bitspersample );
   78|      1|                return 0;
   79|      1|        }
   80|       |        
   81|       |
   82|     18|	return (1);
   83|     19|}

TIFFComputeTile:
   37|  1.48M|{
   38|  1.48M|	TIFFDirectory *td = &tif->tif_dir;
   39|  1.48M|	uint32_t dx = td->td_tilewidth;
   40|  1.48M|	uint32_t dy = td->td_tilelength;
   41|  1.48M|	uint32_t dz = td->td_tiledepth;
   42|  1.48M|	uint32_t tile = 1;
   43|       |
   44|  1.48M|	if (td->td_imagedepth == 1)
  ------------------
  |  Branch (44:6): [True: 1.48M, False: 321]
  ------------------
   45|  1.48M|		z = 0;
   46|  1.48M|	if (dx == (uint32_t) -1)
  ------------------
  |  Branch (46:6): [True: 0, False: 1.48M]
  ------------------
   47|      0|		dx = td->td_imagewidth;
   48|  1.48M|	if (dy == (uint32_t) -1)
  ------------------
  |  Branch (48:6): [True: 0, False: 1.48M]
  ------------------
   49|      0|		dy = td->td_imagelength;
   50|  1.48M|	if (dz == (uint32_t) -1)
  ------------------
  |  Branch (50:6): [True: 1.81k, False: 1.47M]
  ------------------
   51|  1.81k|		dz = td->td_imagedepth;
   52|  1.48M|	if (dx != 0 && dy != 0 && dz != 0) {
  ------------------
  |  Branch (52:6): [True: 1.48M, False: 0]
  |  Branch (52:17): [True: 1.48M, False: 0]
  |  Branch (52:28): [True: 1.48M, False: 0]
  ------------------
   53|  1.48M|		uint32_t xpt = TIFFhowmany_32(td->td_imagewidth, dx);
  ------------------
  |  |  242|  1.48M|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 1.48M, False: 0]
  |  |  ------------------
  |  |  243|  1.48M|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|  1.48M|			   0U)
  ------------------
   54|  1.48M|		uint32_t ypt = TIFFhowmany_32(td->td_imagelength, dy);
  ------------------
  |  |  242|  1.48M|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 1.48M, False: 0]
  |  |  ------------------
  |  |  243|  1.48M|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|  1.48M|			   0U)
  ------------------
   55|  1.48M|		uint32_t zpt = TIFFhowmany_32(td->td_imagedepth, dz);
  ------------------
  |  |  242|  1.48M|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 1.48M, False: 0]
  |  |  ------------------
  |  |  243|  1.48M|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|  1.48M|			   0U)
  ------------------
   56|       |
   57|  1.48M|		if (td->td_planarconfig == PLANARCONFIG_SEPARATE) 
  ------------------
  |  |  260|  1.48M|#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  ------------------
  |  Branch (57:7): [True: 355k, False: 1.12M]
  ------------------
   58|   355k|			tile = (xpt*ypt*zpt)*s +
   59|   355k|			     (xpt*ypt)*(z/dz) +
   60|   355k|			     xpt*(y/dy) +
   61|   355k|			     x/dx;
   62|  1.12M|		else
   63|  1.12M|			tile = (xpt*ypt)*(z/dz) + xpt*(y/dy) + x/dx;
   64|  1.48M|	}
   65|  1.48M|	return (tile);
   66|  1.48M|}
TIFFCheckTile:
   74|  1.48M|{
   75|  1.48M|	TIFFDirectory *td = &tif->tif_dir;
   76|       |
   77|  1.48M|	if (x >= td->td_imagewidth) {
  ------------------
  |  Branch (77:6): [True: 0, False: 1.48M]
  ------------------
   78|      0|		TIFFErrorExtR(tif, tif->tif_name,
   79|      0|			     "%lu: Col out of range, max %lu",
   80|      0|			     (unsigned long) x,
   81|      0|			     (unsigned long) (td->td_imagewidth - 1));
   82|      0|		return (0);
   83|      0|	}
   84|  1.48M|	if (y >= td->td_imagelength) {
  ------------------
  |  Branch (84:6): [True: 0, False: 1.48M]
  ------------------
   85|      0|		TIFFErrorExtR(tif, tif->tif_name,
   86|      0|			     "%lu: Row out of range, max %lu",
   87|      0|			     (unsigned long) y,
   88|      0|			     (unsigned long) (td->td_imagelength - 1));
   89|      0|		return (0);
   90|      0|	}
   91|  1.48M|	if (z >= td->td_imagedepth) {
  ------------------
  |  Branch (91:6): [True: 0, False: 1.48M]
  ------------------
   92|      0|		TIFFErrorExtR(tif, tif->tif_name,
   93|      0|			     "%lu: Depth out of range, max %lu",
   94|      0|			     (unsigned long) z,
   95|      0|			     (unsigned long) (td->td_imagedepth - 1));
   96|      0|		return (0);
   97|      0|	}
   98|  1.48M|	if (td->td_planarconfig == PLANARCONFIG_SEPARATE &&
  ------------------
  |  |  260|  2.96M|#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  ------------------
  |  Branch (98:6): [True: 355k, False: 1.12M]
  ------------------
   99|  1.48M|	    s >= td->td_samplesperpixel) {
  ------------------
  |  Branch (99:6): [True: 198, False: 355k]
  ------------------
  100|    198|		TIFFErrorExtR(tif, tif->tif_name,
  101|    198|			     "%lu: Sample out of range, max %lu",
  102|    198|			     (unsigned long) s,
  103|    198|			     (unsigned long) (td->td_samplesperpixel - 1));
  104|    198|		return (0);
  105|    198|	}
  106|  1.48M|	return (1);
  107|  1.48M|}
TIFFNumberOfTiles:
  114|  12.6k|{
  115|  12.6k|	TIFFDirectory *td = &tif->tif_dir;
  116|  12.6k|	uint32_t dx = td->td_tilewidth;
  117|  12.6k|	uint32_t dy = td->td_tilelength;
  118|  12.6k|	uint32_t dz = td->td_tiledepth;
  119|  12.6k|	uint32_t ntiles;
  120|       |
  121|  12.6k|	if (dx == (uint32_t) -1)
  ------------------
  |  Branch (121:6): [True: 6, False: 12.6k]
  ------------------
  122|      6|		dx = td->td_imagewidth;
  123|  12.6k|	if (dy == (uint32_t) -1)
  ------------------
  |  Branch (123:6): [True: 2, False: 12.6k]
  ------------------
  124|      2|		dy = td->td_imagelength;
  125|  12.6k|	if (dz == (uint32_t) -1)
  ------------------
  |  Branch (125:6): [True: 10, False: 12.6k]
  ------------------
  126|     10|		dz = td->td_imagedepth;
  127|  12.6k|	ntiles = (dx == 0 || dy == 0 || dz == 0) ? 0 :
  ------------------
  |  Branch (127:12): [True: 58, False: 12.6k]
  |  Branch (127:23): [True: 73, False: 12.5k]
  |  Branch (127:34): [True: 1, False: 12.5k]
  ------------------
  128|  12.6k|	    _TIFFMultiply32(tif, _TIFFMultiply32(tif, TIFFhowmany_32(td->td_imagewidth, dx),
  ------------------
  |  |  242|  12.5k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 12.5k, False: 7]
  |  |  ------------------
  |  |  243|  12.5k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|  12.5k|			   0U)
  ------------------
  129|  12.5k|	    TIFFhowmany_32(td->td_imagelength, dy),
  ------------------
  |  |  242|  12.5k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 12.5k, False: 4]
  |  |  ------------------
  |  |  243|  12.5k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|  12.5k|			   0U)
  ------------------
  130|  12.5k|	    "TIFFNumberOfTiles"),
  131|  12.5k|	    TIFFhowmany_32(td->td_imagedepth, dz), "TIFFNumberOfTiles");
  ------------------
  |  |  242|  12.5k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 12.5k, False: 1]
  |  |  ------------------
  |  |  243|  12.5k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|  12.5k|			   0U)
  ------------------
  132|  12.6k|	if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  260|  12.6k|#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
  ------------------
  |  Branch (132:6): [True: 1.02k, False: 11.6k]
  ------------------
  133|  1.02k|		ntiles = _TIFFMultiply32(tif, ntiles, td->td_samplesperpixel,
  134|  1.02k|		    "TIFFNumberOfTiles");
  135|  12.6k|	return (ntiles);
  136|  12.6k|}
TIFFTileRowSize64:
  143|  1.39M|{
  144|  1.39M|        static const char module[] = "TIFFTileRowSize64";
  145|  1.39M|	TIFFDirectory *td = &tif->tif_dir;
  146|  1.39M|	uint64_t rowsize;
  147|  1.39M|	uint64_t tilerowsize;
  148|       |
  149|  1.39M|	if (td->td_tilelength == 0)
  ------------------
  |  Branch (149:6): [True: 0, False: 1.39M]
  ------------------
  150|      0|        {
  151|      0|                TIFFErrorExtR(tif,module,"Tile length is zero");
  152|      0|                return 0;
  153|      0|        }
  154|  1.39M|        if (td->td_tilewidth == 0)
  ------------------
  |  Branch (154:13): [True: 0, False: 1.39M]
  ------------------
  155|      0|        {
  156|      0|                TIFFErrorExtR(tif,module,"Tile width is zero");
  157|      0|		return (0);
  158|      0|        }
  159|  1.39M|	rowsize = _TIFFMultiply64(tif, td->td_bitspersample, td->td_tilewidth,
  160|  1.39M|	    "TIFFTileRowSize");
  161|  1.39M|	if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  259|  1.39M|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (161:6): [True: 1.21M, False: 182k]
  ------------------
  162|  1.21M|        {
  163|  1.21M|                if (td->td_samplesperpixel == 0)
  ------------------
  |  Branch (163:21): [True: 0, False: 1.21M]
  ------------------
  164|      0|                {
  165|      0|                        TIFFErrorExtR(tif,module,"Samples per pixel is zero");
  166|      0|                        return 0;
  167|      0|                }
  168|  1.21M|		rowsize = _TIFFMultiply64(tif, rowsize, td->td_samplesperpixel,
  169|  1.21M|		    "TIFFTileRowSize");
  170|  1.21M|        }
  171|  1.39M|        tilerowsize=TIFFhowmany8_64(rowsize);
  ------------------
  |  |  252|  1.39M|#define TIFFhowmany8_64(x) (((x)&0x07)?((uint64_t)(x)>>3)+1:(uint64_t)(x)>>3)
  |  |  ------------------
  |  |  |  Branch (252:29): [True: 691k, False: 703k]
  |  |  ------------------
  ------------------
  172|  1.39M|        if (tilerowsize == 0)
  ------------------
  |  Branch (172:13): [True: 1, False: 1.39M]
  ------------------
  173|      1|        {
  174|      1|                TIFFErrorExtR(tif,module,"Computed tile row size is zero");
  175|      1|                return 0;
  176|      1|        }
  177|  1.39M|	return (tilerowsize);
  178|  1.39M|}
TIFFTileRowSize:
  181|  1.34M|{
  182|  1.34M|	static const char module[] = "TIFFTileRowSize";
  183|  1.34M|	uint64_t m;
  184|  1.34M|	m=TIFFTileRowSize64(tif);
  185|  1.34M|	return _TIFFCastUInt64ToSSize(tif, m, module);
  186|  1.34M|}
TIFFVTileSize64:
  193|  62.9k|{
  194|  62.9k|	static const char module[] = "TIFFVTileSize64";
  195|  62.9k|	TIFFDirectory *td = &tif->tif_dir;
  196|  62.9k|	if (td->td_tilelength == 0 || td->td_tilewidth == 0 ||
  ------------------
  |  Branch (196:6): [True: 0, False: 62.9k]
  |  Branch (196:32): [True: 247, False: 62.6k]
  ------------------
  197|  62.9k|	    td->td_tiledepth == 0)
  ------------------
  |  Branch (197:6): [True: 9, False: 62.6k]
  ------------------
  198|    256|		return (0);
  199|  62.6k|	if ((td->td_planarconfig==PLANARCONFIG_CONTIG)&&
  ------------------
  |  |  259|  62.6k|#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
  ------------------
  |  Branch (199:6): [True: 58.5k, False: 4.07k]
  ------------------
  200|  62.6k|	    (td->td_photometric==PHOTOMETRIC_YCBCR)&&
  ------------------
  |  |  221|  58.5k|#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
  ------------------
  |  Branch (200:6): [True: 23.6k, False: 34.9k]
  ------------------
  201|  62.6k|	    (td->td_samplesperpixel==3)&&
  ------------------
  |  Branch (201:6): [True: 23.5k, False: 103]
  ------------------
  202|  62.6k|	    (!isUpSampled(tif)))
  ------------------
  |  |  210|  23.5k|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  105|  23.5k|	#define TIFF_UPSAMPLED   0x04000U /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (202:6): [True: 17.2k, False: 6.28k]
  ------------------
  203|  17.2k|	{
  204|       |		/*
  205|       |		 * Packed YCbCr data contain one Cb+Cr for every
  206|       |		 * HorizontalSampling*VerticalSampling Y values.
  207|       |		 * Must also roundup width and height when calculating
  208|       |		 * since images that are not a multiple of the
  209|       |		 * horizontal/vertical subsampling area include
  210|       |		 * YCbCr data for the extended image.
  211|       |		 */
  212|  17.2k|		uint16_t ycbcrsubsampling[2];
  213|  17.2k|		uint16_t samplingblock_samples;
  214|  17.2k|		uint32_t samplingblocks_hor;
  215|  17.2k|		uint32_t samplingblocks_ver;
  216|  17.2k|		uint64_t samplingrow_samples;
  217|  17.2k|		uint64_t samplingrow_size;
  218|  17.2k|		TIFFGetFieldDefaulted(tif,TIFFTAG_YCBCRSUBSAMPLING,ycbcrsubsampling+0,
  ------------------
  |  |  386|  17.2k|#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
  ------------------
  219|  17.2k|		    ycbcrsubsampling+1);
  220|  17.2k|		if ((ycbcrsubsampling[0] != 1 && ycbcrsubsampling[0] != 2 && ycbcrsubsampling[0] != 4)
  ------------------
  |  Branch (220:8): [True: 13.4k, False: 3.80k]
  |  Branch (220:36): [True: 2.25k, False: 11.2k]
  |  Branch (220:64): [True: 15, False: 2.24k]
  ------------------
  221|  17.2k|		    ||(ycbcrsubsampling[1] != 1 && ycbcrsubsampling[1] != 2 && ycbcrsubsampling[1] != 4))
  ------------------
  |  Branch (221:10): [True: 13.3k, False: 3.88k]
  |  Branch (221:38): [True: 1.90k, False: 11.4k]
  |  Branch (221:66): [True: 19, False: 1.88k]
  ------------------
  222|     34|		{
  223|     34|			TIFFErrorExtR(tif,module,
  224|     34|				     "Invalid YCbCr subsampling (%dx%d)", 
  225|     34|				     ycbcrsubsampling[0], 
  226|     34|				     ycbcrsubsampling[1] );
  227|     34|			return 0;
  228|     34|		}
  229|  17.2k|		samplingblock_samples=ycbcrsubsampling[0]*ycbcrsubsampling[1]+2;
  230|  17.2k|		samplingblocks_hor=TIFFhowmany_32(td->td_tilewidth,ycbcrsubsampling[0]);
  ------------------
  |  |  242|  17.2k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 17.2k, False: 3]
  |  |  ------------------
  |  |  243|  17.2k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|  17.2k|			   0U)
  ------------------
  231|  17.2k|		samplingblocks_ver=TIFFhowmany_32(nrows,ycbcrsubsampling[1]);
  ------------------
  |  |  242|  17.2k|#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
  |  |  ------------------
  |  |  |  Branch (242:31): [True: 17.0k, False: 183]
  |  |  ------------------
  |  |  243|  17.2k|			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
  |  |  244|  17.2k|			   0U)
  ------------------
  232|  17.2k|		samplingrow_samples=_TIFFMultiply64(tif,samplingblocks_hor,samplingblock_samples,module);
  233|  17.2k|		samplingrow_size=TIFFhowmany8_64(_TIFFMultiply64(tif,samplingrow_samples,td->td_bitspersample,module));
  ------------------
  |  |  252|  17.2k|#define TIFFhowmany8_64(x) (((x)&0x07)?((uint64_t)(x)>>3)+1:(uint64_t)(x)>>3)
  |  |  ------------------
  |  |  |  Branch (252:29): [True: 324, False: 16.9k]
  |  |  ------------------
  ------------------
  234|  17.2k|		return(_TIFFMultiply64(tif,samplingrow_size,samplingblocks_ver,module));
  235|  17.2k|	}
  236|  45.3k|	else
  237|  45.3k|		return(_TIFFMultiply64(tif,nrows,TIFFTileRowSize64(tif),module));
  238|  62.6k|}
TIFFTileSize64:
  253|  61.6k|{
  254|  61.6k|	return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength));
  255|  61.6k|}
TIFFTileSize:
  258|  35.7k|{
  259|  35.7k|	static const char module[] = "TIFFTileSize";
  260|  35.7k|	uint64_t m;
  261|  35.7k|	m=TIFFTileSize64(tif);
  262|  35.7k|	return _TIFFCastUInt64ToSSize(tif, m, module);
  263|  35.7k|}

_TIFFmalloc:
  310|   437k|{
  311|   437k|        if (s == 0)
  ------------------
  |  Branch (311:13): [True: 0, False: 437k]
  ------------------
  312|      0|                return ((void *) NULL);
  313|       |
  314|   437k|	return (malloc((size_t) s));
  315|   437k|}
_TIFFcalloc:
  318|  2.14k|{
  319|  2.14k|    if( nmemb == 0 || siz == 0 )
  ------------------
  |  Branch (319:9): [True: 0, False: 2.14k]
  |  Branch (319:23): [True: 0, False: 2.14k]
  ------------------
  320|      0|        return ((void *) NULL);
  321|       |
  322|  2.14k|    return calloc((size_t) nmemb, (size_t)siz);
  323|  2.14k|}
_TIFFfree:
  327|   646k|{
  328|   646k|	free(p);
  329|   646k|}
_TIFFrealloc:
  333|   380k|{
  334|   380k|	return (realloc(p, (size_t) s));
  335|   380k|}
_TIFFmemset:
  339|   396k|{
  340|   396k|	memset(p, v, (size_t) c);
  341|   396k|}
_TIFFmemcpy:
  345|   631k|{
  346|   631k|	memcpy(d, s, (size_t) c);
  347|   631k|}

TIFFSetWarningHandler:
   34|  23.5k|{
   35|  23.5k|	TIFFErrorHandler prev = _TIFFwarningHandler;
   36|  23.5k|	_TIFFwarningHandler = handler;
   37|  23.5k|	return (prev);
   38|  23.5k|}
TIFFWarningExtR:
   85|  88.6M|{
   86|  88.6M|	va_list ap;
   87|  88.6M|	if (tif && tif->tif_warnhandler) {
  ------------------
  |  Branch (87:6): [True: 88.6M, False: 0]
  |  Branch (87:13): [True: 0, False: 88.6M]
  ------------------
   88|      0|		va_start(ap, fmt);
   89|      0|		int stop = (*tif->tif_warnhandler)(tif->tif_clientdata, module, fmt, ap);
   90|      0|		va_end(ap);
   91|      0|		if (stop) return;
  ------------------
  |  Branch (91:7): [True: 0, False: 0]
  ------------------
   92|      0|	}
   93|  88.6M|	if (_TIFFwarningHandler) {
  ------------------
  |  Branch (93:6): [True: 88.6M, False: 0]
  ------------------
   94|  88.6M|		va_start(ap, fmt);
   95|  88.6M|		(*_TIFFwarningHandler)(module, fmt, ap);
   96|  88.6M|		va_end(ap);
   97|  88.6M|	}
   98|  88.6M|	if (_TIFFwarningHandlerExt) {
  ------------------
  |  Branch (98:6): [True: 0, False: 88.6M]
  ------------------
   99|      0|		va_start(ap, fmt);
  100|      0|		(*_TIFFwarningHandlerExt)(tif ? tif->tif_clientdata : 0, module, fmt, ap);
  ------------------
  |  Branch (100:29): [True: 0, False: 0]
  ------------------
  101|      0|		va_end(ap);
  102|      0|	}
  103|  88.6M|}

TIFFInitZIP:
  619|  1.00k|{
  620|  1.00k|	static const char module[] = "TIFFInitZIP";
  621|  1.00k|	ZIPState* sp;
  622|       |
  623|  1.00k|	assert( (scheme == COMPRESSION_DEFLATE)
  624|  1.00k|		|| (scheme == COMPRESSION_ADOBE_DEFLATE));
  625|       |#ifdef NDEBUG
  626|       |	(void)scheme;
  627|       |#endif
  628|       |
  629|       |	/*
  630|       |	 * Merge codec-specific tag information.
  631|       |	 */
  632|  1.00k|	if (!_TIFFMergeFields(tif, zipFields, TIFFArrayCount(zipFields))) {
  ------------------
  |  |  261|  1.00k|#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
  ------------------
  |  Branch (632:6): [True: 0, False: 1.00k]
  ------------------
  633|      0|		TIFFErrorExtR(tif, module,
  634|      0|			     "Merging Deflate codec-specific tags failed");
  635|      0|		return 0;
  636|      0|	}
  637|       |
  638|       |	/*
  639|       |	 * Allocate state block so tag methods have storage to record values.
  640|       |	 */
  641|  1.00k|	tif->tif_data = (uint8_t*) _TIFFcalloc(sizeof (ZIPState), 1);
  642|  1.00k|	if (tif->tif_data == NULL)
  ------------------
  |  Branch (642:6): [True: 0, False: 1.00k]
  ------------------
  643|      0|		goto bad;
  644|  1.00k|	sp = ZState(tif);
  ------------------
  |  |   84|  1.00k|#define ZState(tif)             ((ZIPState*) (tif)->tif_data)
  ------------------
  645|  1.00k|	sp->stream.zalloc = NULL;
  646|  1.00k|	sp->stream.zfree = NULL;
  647|  1.00k|	sp->stream.opaque = NULL;
  648|  1.00k|	sp->stream.data_type = Z_BINARY;
  649|       |
  650|       |	/*
  651|       |	 * Override parent get/set field methods.
  652|       |	 */
  653|  1.00k|	sp->vgetparent = tif->tif_tagmethods.vgetfield;
  654|  1.00k|	tif->tif_tagmethods.vgetfield = ZIPVGetField; /* hook for codec tags */
  655|  1.00k|	sp->vsetparent = tif->tif_tagmethods.vsetfield;
  656|  1.00k|	tif->tif_tagmethods.vsetfield = ZIPVSetField; /* hook for codec tags */
  657|       |
  658|       |	/* Default values for codec-specific fields */
  659|  1.00k|	sp->zipquality = Z_DEFAULT_COMPRESSION;	/* default comp. level */
  660|  1.00k|	sp->state = 0;
  661|       |#if LIBDEFLATE_SUPPORT
  662|       |        sp->subcodec = DEFLATE_SUBCODEC_LIBDEFLATE;
  663|       |#else
  664|  1.00k|        sp->subcodec = DEFLATE_SUBCODEC_ZLIB;
  ------------------
  |  |  676|  1.00k|#define     DEFLATE_SUBCODEC_ZLIB       0
  ------------------
  665|  1.00k|#endif
  666|       |
  667|       |	/*
  668|       |	 * Install codec methods.
  669|       |	 */
  670|  1.00k|	tif->tif_fixuptags = ZIPFixupTags; 
  671|  1.00k|	tif->tif_setupdecode = ZIPSetupDecode;
  672|  1.00k|	tif->tif_predecode = ZIPPreDecode;
  673|  1.00k|	tif->tif_decoderow = ZIPDecode;
  674|  1.00k|	tif->tif_decodestrip = ZIPDecode;
  675|  1.00k|	tif->tif_decodetile = ZIPDecode;  
  676|  1.00k|	tif->tif_setupencode = ZIPSetupEncode;
  677|  1.00k|	tif->tif_preencode = ZIPPreEncode;
  678|  1.00k|	tif->tif_postencode = ZIPPostEncode;
  679|  1.00k|	tif->tif_encoderow = ZIPEncode;
  680|  1.00k|	tif->tif_encodestrip = ZIPEncode;
  681|  1.00k|	tif->tif_encodetile = ZIPEncode;
  682|  1.00k|	tif->tif_cleanup = ZIPCleanup;
  683|       |	/*
  684|       |	 * Setup predictor setup.
  685|       |	 */
  686|  1.00k|	(void) TIFFPredictorInit(tif);
  687|  1.00k|	return (1);
  688|      0|bad:
  689|      0|	TIFFErrorExtR(tif, module,
  690|      0|		     "No space for ZIP state block");
  691|      0|	return (0);
  692|  1.00k|}
tif_zip.c:ZIPVGetField:
  594|  11.3k|{
  595|  11.3k|	ZIPState* sp = ZState(tif);
  ------------------
  |  |   84|  11.3k|#define ZState(tif)             ((ZIPState*) (tif)->tif_data)
  ------------------
  596|       |
  597|  11.3k|	switch (tag) {
  598|      0|	case TIFFTAG_ZIPQUALITY:
  ------------------
  |  |  649|      0|#define	TIFFTAG_ZIPQUALITY		65557	/* compression quality level */
  ------------------
  |  Branch (598:2): [True: 0, False: 11.3k]
  ------------------
  599|      0|		*va_arg(ap, int*) = sp->zipquality;
  600|      0|		break;
  601|       |
  602|      0|        case TIFFTAG_DEFLATE_SUBCODEC:
  ------------------
  |  |  675|      0|#define	TIFFTAG_DEFLATE_SUBCODEC	65570	/* ZIP codec: to get/set the sub-codec to use. Will default to libdeflate when available */
  ------------------
  |  Branch (602:9): [True: 0, False: 11.3k]
  ------------------
  603|      0|		*va_arg(ap, int*) = sp->subcodec;
  604|      0|		break;
  605|       |
  606|  11.3k|	default:
  ------------------
  |  Branch (606:2): [True: 11.3k, False: 0]
  ------------------
  607|  11.3k|		return (*sp->vgetparent)(tif, tag, ap);
  608|  11.3k|	}
  609|      0|	return (1);
  610|  11.3k|}
tif_zip.c:ZIPVSetField:
  530|  5.00k|{
  531|  5.00k|	static const char module[] = "ZIPVSetField";
  532|  5.00k|	ZIPState* sp = ZState(tif);
  ------------------
  |  |   84|  5.00k|#define ZState(tif)             ((ZIPState*) (tif)->tif_data)
  ------------------
  533|       |
  534|  5.00k|	switch (tag) {
  535|      0|	case TIFFTAG_ZIPQUALITY:
  ------------------
  |  |  649|      0|#define	TIFFTAG_ZIPQUALITY		65557	/* compression quality level */
  ------------------
  |  Branch (535:2): [True: 0, False: 5.00k]
  ------------------
  536|      0|		sp->zipquality = (int) va_arg(ap, int);
  537|      0|                if( sp->zipquality < Z_DEFAULT_COMPRESSION ||
  ------------------
  |  Branch (537:21): [True: 0, False: 0]
  ------------------
  538|      0|                    sp->zipquality > LIBDEFLATE_MAX_COMPRESSION_LEVEL ) {
  ------------------
  |  |   46|      0|#define LIBDEFLATE_MAX_COMPRESSION_LEVEL 12
  ------------------
  |  Branch (538:21): [True: 0, False: 0]
  ------------------
  539|      0|                    TIFFErrorExtR(tif, module,
  540|      0|                                 "Invalid ZipQuality value. Should be in [-1,%d] range",
  541|      0|                                 LIBDEFLATE_MAX_COMPRESSION_LEVEL);
  ------------------
  |  |   46|      0|#define LIBDEFLATE_MAX_COMPRESSION_LEVEL 12
  ------------------
  542|      0|                    return 0;
  543|      0|                }
  544|       |
  545|      0|                if ( sp->state&ZSTATE_INIT_ENCODE ) {
  ------------------
  |  |   78|      0|#define ZSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (545:22): [True: 0, False: 0]
  ------------------
  546|      0|                        int cappedQuality = sp->zipquality;
  547|      0|                        if( cappedQuality > Z_BEST_COMPRESSION )
  ------------------
  |  Branch (547:29): [True: 0, False: 0]
  ------------------
  548|      0|                            cappedQuality = Z_BEST_COMPRESSION;
  549|      0|			if (deflateParams(&sp->stream,
  ------------------
  |  Branch (549:8): [True: 0, False: 0]
  ------------------
  550|      0|			    cappedQuality, Z_DEFAULT_STRATEGY) != Z_OK) {
  551|      0|				TIFFErrorExtR(tif, module, "ZLib error: %s",
  552|      0|					     SAFE_MSG(sp));
  ------------------
  |  |   60|      0|#define SAFE_MSG(sp)   ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:25): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  553|      0|				return (0);
  554|      0|			}
  555|      0|		}
  556|       |
  557|       |#if LIBDEFLATE_SUPPORT
  558|       |                if( sp->libdeflate_enc )
  559|       |                {
  560|       |                    libdeflate_free_compressor(sp->libdeflate_enc);
  561|       |                    sp->libdeflate_enc = NULL;
  562|       |                }
  563|       |#endif
  564|       |
  565|      0|		return (1);
  566|       |
  567|      0|        case TIFFTAG_DEFLATE_SUBCODEC:
  ------------------
  |  |  675|      0|#define	TIFFTAG_DEFLATE_SUBCODEC	65570	/* ZIP codec: to get/set the sub-codec to use. Will default to libdeflate when available */
  ------------------
  |  Branch (567:9): [True: 0, False: 5.00k]
  ------------------
  568|      0|                sp->subcodec = (int) va_arg(ap, int);
  569|      0|                if( sp->subcodec != DEFLATE_SUBCODEC_ZLIB &&
  ------------------
  |  |  676|      0|#define     DEFLATE_SUBCODEC_ZLIB       0
  ------------------
  |  Branch (569:21): [True: 0, False: 0]
  ------------------
  570|      0|                    sp->subcodec != DEFLATE_SUBCODEC_LIBDEFLATE )
  ------------------
  |  |  677|      0|#define     DEFLATE_SUBCODEC_LIBDEFLATE 1
  ------------------
  |  Branch (570:21): [True: 0, False: 0]
  ------------------
  571|      0|                {
  572|      0|                    TIFFErrorExtR(tif, module,
  573|      0|                                 "Invalid DeflateCodec value.");
  574|      0|                    return 0;
  575|      0|                }
  576|      0|#if !LIBDEFLATE_SUPPORT
  577|      0|                if( sp->subcodec == DEFLATE_SUBCODEC_LIBDEFLATE )
  ------------------
  |  |  677|      0|#define     DEFLATE_SUBCODEC_LIBDEFLATE 1
  ------------------
  |  Branch (577:21): [True: 0, False: 0]
  ------------------
  578|      0|                {
  579|      0|                    TIFFErrorExtR(tif, module,
  580|      0|                                 "DeflateCodec = DEFLATE_SUBCODEC_LIBDEFLATE unsupported in this build");
  581|      0|                    return 0;
  582|      0|                }
  583|      0|#endif
  584|      0|                return 1;
  585|       |
  586|  5.00k|	default:
  ------------------
  |  Branch (586:2): [True: 5.00k, False: 0]
  ------------------
  587|  5.00k|		return (*sp->vsetparent)(tif, tag, ap);
  588|  5.00k|	}
  589|       |	/*NOTREACHED*/
  590|  5.00k|}
tif_zip.c:ZIPFixupTags:
   93|    904|{
   94|    904|	(void) tif;
   95|    904|	return (1);
   96|    904|}
tif_zip.c:ZIPSetupDecode:
  100|    882|{
  101|    882|	static const char module[] = "ZIPSetupDecode";
  102|    882|	ZIPState* sp = DecoderState(tif);
  ------------------
  |  |   85|    882|#define DecoderState(tif)       ZState(tif)
  |  |  ------------------
  |  |  |  |   84|    882|#define ZState(tif)             ((ZIPState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  103|       |
  104|    882|	assert(sp != NULL);
  105|       |        
  106|       |        /* if we were last encoding, terminate this mode */
  107|    882|	if (sp->state & ZSTATE_INIT_ENCODE) {
  ------------------
  |  |   78|    882|#define ZSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (107:6): [True: 0, False: 882]
  ------------------
  108|      0|	    deflateEnd(&sp->stream);
  109|      0|	    sp->state = 0;
  110|      0|	}
  111|       |
  112|       |	/* This function can possibly be called several times by */
  113|       |	/* PredictorSetupDecode() if this function succeeds but */
  114|       |	/* PredictorSetup() fails */
  115|    882|	if ((sp->state & ZSTATE_INIT_DECODE) == 0 &&
  ------------------
  |  |   77|    882|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (115:6): [True: 882, False: 0]
  ------------------
  116|    882|	    inflateInit(&sp->stream) != Z_OK) {
  ------------------
  |  Branch (116:6): [True: 0, False: 882]
  ------------------
  117|      0|		TIFFErrorExtR(tif, module, "%s", SAFE_MSG(sp));
  ------------------
  |  |   60|      0|#define SAFE_MSG(sp)   ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:25): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  118|      0|		return (0);
  119|    882|	} else {
  120|    882|		sp->state |= ZSTATE_INIT_DECODE;
  ------------------
  |  |   77|    882|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  121|    882|		return (1);
  122|    882|	}
  123|    882|}
tif_zip.c:ZIPPreDecode:
  130|  45.4k|{
  131|  45.4k|	ZIPState* sp = DecoderState(tif);
  ------------------
  |  |   85|  45.4k|#define DecoderState(tif)       ZState(tif)
  |  |  ------------------
  |  |  |  |   84|  45.4k|#define ZState(tif)             ((ZIPState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  132|       |
  133|  45.4k|	(void) s;
  134|  45.4k|	assert(sp != NULL);
  135|       |
  136|  45.4k|	if( (sp->state & ZSTATE_INIT_DECODE) == 0 )
  ------------------
  |  |   77|  45.4k|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (136:6): [True: 0, False: 45.4k]
  ------------------
  137|      0|            tif->tif_setupdecode( tif );
  138|       |
  139|       |#if LIBDEFLATE_SUPPORT
  140|       |        sp->libdeflate_state = -1;
  141|       |#endif
  142|  45.4k|	sp->stream.next_in = tif->tif_rawdata;
  143|  45.4k|	assert(sizeof(sp->stream.avail_in)==4);  /* if this assert gets raised,
  144|       |	    we need to simplify this code to reflect a ZLib that is likely updated
  145|       |	    to deal with 8byte memory sizes, though this code will respond
  146|       |	    appropriately even before we simplify it */
  147|  45.4k|	sp->stream.avail_in = (uint64_t)tif->tif_rawcc < 0xFFFFFFFFU ? (uInt) tif->tif_rawcc : 0xFFFFFFFFU;
  ------------------
  |  Branch (147:24): [True: 45.4k, False: 0]
  ------------------
  148|  45.4k|	return (inflateReset(&sp->stream) == Z_OK);
  149|  45.4k|}
tif_zip.c:ZIPDecode:
  153|  45.4k|{
  154|  45.4k|	static const char module[] = "ZIPDecode";
  155|  45.4k|	ZIPState* sp = DecoderState(tif);
  ------------------
  |  |   85|  45.4k|#define DecoderState(tif)       ZState(tif)
  |  |  ------------------
  |  |  |  |   84|  45.4k|#define ZState(tif)             ((ZIPState*) (tif)->tif_data)
  |  |  ------------------
  ------------------
  156|       |
  157|  45.4k|	(void) s;
  158|  45.4k|	assert(sp != NULL);
  159|  45.4k|	assert(sp->state == ZSTATE_INIT_DECODE);
  160|       |
  161|       |#if LIBDEFLATE_SUPPORT
  162|       |        if( sp->libdeflate_state == 1 )
  163|       |            return 0;
  164|       |
  165|       |        /* If we have libdeflate support and we are asked to read a whole */
  166|       |        /* strip/tile, then go for using it */
  167|       |        do {
  168|       |            TIFFDirectory *td = &tif->tif_dir;
  169|       |
  170|       |            if( sp->libdeflate_state == 0 )
  171|       |                break;
  172|       |            if( sp->subcodec == DEFLATE_SUBCODEC_ZLIB )
  173|       |                break;
  174|       |
  175|       |            /* Check if we are in the situation where we can use libdeflate */
  176|       |            if (isTiled(tif)) {
  177|       |                if( TIFFTileSize64(tif) != (uint64_t)occ )
  178|       |                    break;
  179|       |            } else {
  180|       |                uint32_t strip_height = td->td_imagelength - tif->tif_row;
  181|       |                if (strip_height > td->td_rowsperstrip)
  182|       |                    strip_height = td->td_rowsperstrip;
  183|       |                if( TIFFVStripSize64(tif, strip_height) != (uint64_t)occ )
  184|       |                    break;
  185|       |            }
  186|       |
  187|       |            /* Check for overflow */
  188|       |            if( (size_t)tif->tif_rawcc != (uint64_t)tif->tif_rawcc )
  189|       |                break;
  190|       |            if( (size_t)occ != (uint64_t)occ )
  191|       |                break;
  192|       |
  193|       |            /* Go for decompression using libdeflate */
  194|       |            {
  195|       |                enum libdeflate_result res;
  196|       |                if( sp->libdeflate_dec == NULL )
  197|       |                {
  198|       |                    sp->libdeflate_dec = libdeflate_alloc_decompressor();
  199|       |                    if( sp->libdeflate_dec == NULL )
  200|       |                    {
  201|       |                        break;
  202|       |                    }
  203|       |                }
  204|       |
  205|       |                sp->libdeflate_state = 1;
  206|       |
  207|       |                res = libdeflate_zlib_decompress(
  208|       |                    sp->libdeflate_dec, tif->tif_rawcp, (size_t)tif->tif_rawcc, op, (size_t)occ, NULL);
  209|       |
  210|       |                tif->tif_rawcp += tif->tif_rawcc;
  211|       |                tif->tif_rawcc = 0;
  212|       |
  213|       |                /* We accept LIBDEFLATE_INSUFFICIENT_SPACE has a return */
  214|       |                /* There are odd files in the wild where the last strip, when */
  215|       |                /* it is smaller in height than td_rowsperstrip, actually contains */
  216|       |                /* data for td_rowsperstrip lines. Just ignore that silently. */
  217|       |                if( res != LIBDEFLATE_SUCCESS &&
  218|       |                    res != LIBDEFLATE_INSUFFICIENT_SPACE )
  219|       |                {
  220|       |                    TIFFErrorExtR(tif, module,
  221|       |                                 "Decoding error at scanline %lu",
  222|       |                                 (unsigned long) tif->tif_row);
  223|       |                    return 0;
  224|       |                }
  225|       |
  226|       |                return 1;
  227|       |            }
  228|       |        } while(0);
  229|       |        sp->libdeflate_state = 0;
  230|       |#endif /* LIBDEFLATE_SUPPORT */
  231|       |
  232|  45.4k|        sp->stream.next_in = tif->tif_rawcp;
  233|       |        
  234|  45.4k|	sp->stream.next_out = op;
  235|  45.4k|	assert(sizeof(sp->stream.avail_out)==4);  /* if this assert gets raised,
  236|       |	    we need to simplify this code to reflect a ZLib that is likely updated
  237|       |	    to deal with 8byte memory sizes, though this code will respond
  238|       |	    appropriately even before we simplify it */
  239|  57.8k|	do {
  240|  57.8k|                int state;
  241|  57.8k|                uInt avail_in_before = (uint64_t)tif->tif_rawcc <= 0xFFFFFFFFU ? (uInt)tif->tif_rawcc : 0xFFFFFFFFU;
  ------------------
  |  Branch (241:40): [True: 57.8k, False: 0]
  ------------------
  242|  57.8k|                uInt avail_out_before = (uint64_t)occ < 0xFFFFFFFFU ? (uInt) occ : 0xFFFFFFFFU;
  ------------------
  |  Branch (242:41): [True: 57.8k, False: 0]
  ------------------
  243|  57.8k|                sp->stream.avail_in = avail_in_before;
  244|  57.8k|                sp->stream.avail_out = avail_out_before;
  245|       |		/* coverity[overrun-buffer-arg] */
  246|  57.8k|		state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
  247|  57.8k|		tif->tif_rawcc -= (avail_in_before - sp->stream.avail_in);
  248|  57.8k|                occ -= (avail_out_before - sp->stream.avail_out);
  249|  57.8k|		if (state == Z_STREAM_END)
  ------------------
  |  Branch (249:7): [True: 219, False: 57.6k]
  ------------------
  250|    219|			break;
  251|  57.6k|		if (state == Z_DATA_ERROR) {
  ------------------
  |  Branch (251:7): [True: 30.7k, False: 26.8k]
  ------------------
  252|  30.7k|			TIFFErrorExtR(tif, module,
  253|  30.7k|			    "Decoding error at scanline %lu, %s",
  254|  30.7k|			     (unsigned long) tif->tif_row, SAFE_MSG(sp));
  ------------------
  |  |   60|  30.7k|#define SAFE_MSG(sp)   ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:25): [True: 0, False: 30.7k]
  |  |  ------------------
  ------------------
  255|  30.7k|			return (0);
  256|  30.7k|		}
  257|  26.8k|		if (state != Z_OK) {
  ------------------
  |  Branch (257:7): [True: 12.9k, False: 13.9k]
  ------------------
  258|  12.9k|			TIFFErrorExtR(tif, module, 
  259|  12.9k|				     "ZLib error: %s", SAFE_MSG(sp));
  ------------------
  |  |   60|  12.9k|#define SAFE_MSG(sp)   ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:25): [True: 12.9k, False: 0]
  |  |  ------------------
  ------------------
  260|  12.9k|			return (0);
  261|  12.9k|		}
  262|  26.8k|	} while (occ > 0);
  ------------------
  |  Branch (262:11): [True: 12.4k, False: 1.49k]
  ------------------
  263|  1.71k|	if (occ != 0) {
  ------------------
  |  Branch (263:6): [True: 219, False: 1.49k]
  ------------------
  264|    219|		TIFFErrorExtR(tif, module,
  265|    219|		    "Not enough data at scanline %lu (short %" PRIu64 " bytes)",
  266|    219|		    (unsigned long) tif->tif_row, (uint64_t) occ);
  267|    219|		return (0);
  268|    219|	}
  269|       |
  270|  1.49k|        tif->tif_rawcp = sp->stream.next_in;
  271|       |
  272|  1.49k|	return (1);
  273|  1.71k|}
tif_zip.c:ZIPCleanup:
  497|  1.00k|{
  498|  1.00k|	ZIPState* sp = ZState(tif);
  ------------------
  |  |   84|  1.00k|#define ZState(tif)             ((ZIPState*) (tif)->tif_data)
  ------------------
  499|       |
  500|  1.00k|	assert(sp != 0);
  501|       |
  502|  1.00k|	(void)TIFFPredictorCleanup(tif);
  503|       |
  504|  1.00k|	tif->tif_tagmethods.vgetfield = sp->vgetparent;
  505|  1.00k|	tif->tif_tagmethods.vsetfield = sp->vsetparent;
  506|       |
  507|  1.00k|	if (sp->state & ZSTATE_INIT_ENCODE) {
  ------------------
  |  |   78|  1.00k|#define ZSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (507:6): [True: 0, False: 1.00k]
  ------------------
  508|      0|		deflateEnd(&sp->stream);
  509|      0|		sp->state = 0;
  510|  1.00k|	} else if( sp->state & ZSTATE_INIT_DECODE) {
  ------------------
  |  |   77|  1.00k|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (510:13): [True: 882, False: 119]
  ------------------
  511|    882|		inflateEnd(&sp->stream);
  512|    882|		sp->state = 0;
  513|    882|	}
  514|       |
  515|       |#if LIBDEFLATE_SUPPORT
  516|       |        if( sp->libdeflate_dec )
  517|       |            libdeflate_free_decompressor(sp->libdeflate_dec);
  518|       |        if( sp->libdeflate_enc )
  519|       |            libdeflate_free_compressor(sp->libdeflate_enc);
  520|       |#endif
  521|       |
  522|  1.00k|	_TIFFfree(sp);
  523|  1.00k|	tif->tif_data = NULL;
  524|       |
  525|  1.00k|	_TIFFSetDefaultCompressionState(tif);
  526|  1.00k|}

adler32_z:
   67|  43.2k|{
   68|  43.2k|    unsigned long sum2;
   69|  43.2k|    unsigned n;
   70|       |
   71|       |    /* split Adler-32 into component sums */
   72|  43.2k|    sum2 = (adler >> 16) & 0xffff;
   73|  43.2k|    adler &= 0xffff;
   74|       |
   75|       |    /* in case user likes doing a byte at a time, keep it fast */
   76|  43.2k|    if (len == 1) {
  ------------------
  |  Branch (76:9): [True: 1.01k, False: 42.2k]
  ------------------
   77|  1.01k|        adler += buf[0];
   78|  1.01k|        if (adler >= BASE)
  ------------------
  |  |   12|  1.01k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (78:13): [True: 0, False: 1.01k]
  ------------------
   79|      0|            adler -= BASE;
  ------------------
  |  |   12|      0|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   80|  1.01k|        sum2 += adler;
   81|  1.01k|        if (sum2 >= BASE)
  ------------------
  |  |   12|  1.01k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (81:13): [True: 0, False: 1.01k]
  ------------------
   82|      0|            sum2 -= BASE;
  ------------------
  |  |   12|      0|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   83|  1.01k|        return adler | (sum2 << 16);
   84|  1.01k|    }
   85|       |
   86|       |    /* initial Adler-32 value (deferred check for len == 1 speed) */
   87|  42.2k|    if (buf == Z_NULL)
  ------------------
  |  |  212|  42.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (87:9): [True: 23.7k, False: 18.5k]
  ------------------
   88|  23.7k|        return 1L;
   89|       |
   90|       |    /* in case short lengths are provided, keep it somewhat fast */
   91|  18.5k|    if (len < 16) {
  ------------------
  |  Branch (91:9): [True: 5.31k, False: 13.2k]
  ------------------
   92|  57.4k|        while (len--) {
  ------------------
  |  Branch (92:16): [True: 52.1k, False: 5.31k]
  ------------------
   93|  52.1k|            adler += *buf++;
   94|  52.1k|            sum2 += adler;
   95|  52.1k|        }
   96|  5.31k|        if (adler >= BASE)
  ------------------
  |  |   12|  5.31k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (96:13): [True: 0, False: 5.31k]
  ------------------
   97|      0|            adler -= BASE;
  ------------------
  |  |   12|      0|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   98|  5.31k|        MOD28(sum2);            /* only added so many BASE's */
  ------------------
  |  |   58|  5.31k|#  define MOD28(a) a %= BASE
  |  |  ------------------
  |  |  |  |   12|  5.31k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
   99|  5.31k|        return adler | (sum2 << 16);
  100|  5.31k|    }
  101|       |
  102|       |    /* do length NMAX blocks -- requires just one modulo operation */
  103|  55.0k|    while (len >= NMAX) {
  ------------------
  |  |   13|  55.0k|#define NMAX 5552
  ------------------
  |  Branch (103:12): [True: 41.8k, False: 13.2k]
  ------------------
  104|  41.8k|        len -= NMAX;
  ------------------
  |  |   13|  41.8k|#define NMAX 5552
  ------------------
  105|  41.8k|        n = NMAX / 16;          /* NMAX is divisible by 16 */
  ------------------
  |  |   13|  41.8k|#define NMAX 5552
  ------------------
  106|  14.5M|        do {
  107|  14.5M|            DO16(buf);          /* 16 sums unrolled */
  ------------------
  |  |   20|  14.5M|#define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   19|  14.5M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  14.5M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|  14.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|  14.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  14.5M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|  14.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|  14.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   19|  14.5M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  14.5M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|  14.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|  14.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|  14.5M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|  14.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|  14.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  14.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  108|  14.5M|            buf += 16;
  109|  14.5M|        } while (--n);
  ------------------
  |  Branch (109:18): [True: 14.4M, False: 41.8k]
  ------------------
  110|  41.8k|        MOD(adler);
  ------------------
  |  |   57|  41.8k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   12|  41.8k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  111|  41.8k|        MOD(sum2);
  ------------------
  |  |   57|  41.8k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   12|  41.8k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  112|  41.8k|    }
  113|       |
  114|       |    /* do remaining bytes (less than NMAX, still just one modulo) */
  115|  13.2k|    if (len) {                  /* avoid modulos if none remaining */
  ------------------
  |  Branch (115:9): [True: 13.0k, False: 214]
  ------------------
  116|   451k|        while (len >= 16) {
  ------------------
  |  Branch (116:16): [True: 438k, False: 13.0k]
  ------------------
  117|   438k|            len -= 16;
  118|   438k|            DO16(buf);
  ------------------
  |  |   20|   438k|#define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   19|   438k|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|   438k|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|   438k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|   438k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|   438k|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|   438k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|   438k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   19|   438k|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|   438k|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|   438k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|   438k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   18|   438k|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|   438k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   17|   438k|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|   438k|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  119|   438k|            buf += 16;
  120|   438k|        }
  121|   112k|        while (len--) {
  ------------------
  |  Branch (121:16): [True: 99.3k, False: 13.0k]
  ------------------
  122|  99.3k|            adler += *buf++;
  123|  99.3k|            sum2 += adler;
  124|  99.3k|        }
  125|  13.0k|        MOD(adler);
  ------------------
  |  |   57|  13.0k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   12|  13.0k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  126|  13.0k|        MOD(sum2);
  ------------------
  |  |   57|  13.0k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   12|  13.0k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  127|  13.0k|    }
  128|       |
  129|       |    /* return recombined sums */
  130|  13.2k|    return adler | (sum2 << 16);
  131|  18.5k|}
adler32:
  138|  43.2k|{
  139|  43.2k|    return adler32_z(adler, buf, len);
  140|  43.2k|}

inflate_fast:
   53|  26.2k|{
   54|  26.2k|    struct inflate_state FAR *state;
   55|  26.2k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   56|  26.2k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   57|  26.2k|    unsigned char FAR *out;     /* local strm->next_out */
   58|  26.2k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   59|  26.2k|    unsigned char FAR *end;     /* while out < end, enough space available */
   60|       |#ifdef INFLATE_STRICT
   61|       |    unsigned dmax;              /* maximum distance from zlib header */
   62|       |#endif
   63|  26.2k|    unsigned wsize;             /* window size or zero if not using window */
   64|  26.2k|    unsigned whave;             /* valid bytes in the window */
   65|  26.2k|    unsigned wnext;             /* window write index */
   66|  26.2k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   67|  26.2k|    unsigned long hold;         /* local strm->hold */
   68|  26.2k|    unsigned bits;              /* local strm->bits */
   69|  26.2k|    code const FAR *lcode;      /* local strm->lencode */
   70|  26.2k|    code const FAR *dcode;      /* local strm->distcode */
   71|  26.2k|    unsigned lmask;             /* mask for first level of length codes */
   72|  26.2k|    unsigned dmask;             /* mask for first level of distance codes */
   73|  26.2k|    code const *here;           /* retrieved table entry */
   74|  26.2k|    unsigned op;                /* code bits, operation, extra bits, or */
   75|       |                                /*  window position, window bytes to copy */
   76|  26.2k|    unsigned len;               /* match length, unused bytes */
   77|  26.2k|    unsigned dist;              /* match distance */
   78|  26.2k|    unsigned char FAR *from;    /* where to copy match from */
   79|       |
   80|       |    /* copy state to local variables */
   81|  26.2k|    state = (struct inflate_state FAR *)strm->state;
   82|  26.2k|    in = strm->next_in;
   83|  26.2k|    last = in + (strm->avail_in - 5);
   84|  26.2k|    out = strm->next_out;
   85|  26.2k|    beg = out - (start - strm->avail_out);
   86|  26.2k|    end = out + (strm->avail_out - 257);
   87|       |#ifdef INFLATE_STRICT
   88|       |    dmax = state->dmax;
   89|       |#endif
   90|  26.2k|    wsize = state->wsize;
   91|  26.2k|    whave = state->whave;
   92|  26.2k|    wnext = state->wnext;
   93|  26.2k|    window = state->window;
   94|  26.2k|    hold = state->hold;
   95|  26.2k|    bits = state->bits;
   96|  26.2k|    lcode = state->lencode;
   97|  26.2k|    dcode = state->distcode;
   98|  26.2k|    lmask = (1U << state->lenbits) - 1;
   99|  26.2k|    dmask = (1U << state->distbits) - 1;
  100|       |
  101|       |    /* decode literals and length/distances until end-of-block or not enough
  102|       |       input data or output space */
  103|  4.37M|    do {
  104|  4.37M|        if (bits < 15) {
  ------------------
  |  Branch (104:13): [True: 2.37M, False: 1.99M]
  ------------------
  105|  2.37M|            hold += (unsigned long)(*in++) << bits;
  106|  2.37M|            bits += 8;
  107|  2.37M|            hold += (unsigned long)(*in++) << bits;
  108|  2.37M|            bits += 8;
  109|  2.37M|        }
  110|  4.37M|        here = lcode + (hold & lmask);
  111|  5.45M|      dolen:
  112|  5.45M|        op = (unsigned)(here->bits);
  113|  5.45M|        hold >>= op;
  114|  5.45M|        bits -= op;
  115|  5.45M|        op = (unsigned)(here->op);
  116|  5.45M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (116:13): [True: 2.94M, False: 2.50M]
  ------------------
  117|  2.94M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  118|  2.94M|                    "inflate:         literal '%c'\n" :
  119|  2.94M|                    "inflate:         literal 0x%02x\n", here->val));
  120|  2.94M|            *out++ = (unsigned char)(here->val);
  121|  2.94M|        }
  122|  2.50M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (122:18): [True: 1.42M, False: 1.08M]
  ------------------
  123|  1.42M|            len = (unsigned)(here->val);
  124|  1.42M|            op &= 15;                           /* number of extra bits */
  125|  1.42M|            if (op) {
  ------------------
  |  Branch (125:17): [True: 1.23M, False: 190k]
  ------------------
  126|  1.23M|                if (bits < op) {
  ------------------
  |  Branch (126:21): [True: 259k, False: 971k]
  ------------------
  127|   259k|                    hold += (unsigned long)(*in++) << bits;
  128|   259k|                    bits += 8;
  129|   259k|                }
  130|  1.23M|                len += (unsigned)hold & ((1U << op) - 1);
  131|  1.23M|                hold >>= op;
  132|  1.23M|                bits -= op;
  133|  1.23M|            }
  134|  1.42M|            Tracevv((stderr, "inflate:         length %u\n", len));
  135|  1.42M|            if (bits < 15) {
  ------------------
  |  Branch (135:17): [True: 1.18M, False: 237k]
  ------------------
  136|  1.18M|                hold += (unsigned long)(*in++) << bits;
  137|  1.18M|                bits += 8;
  138|  1.18M|                hold += (unsigned long)(*in++) << bits;
  139|  1.18M|                bits += 8;
  140|  1.18M|            }
  141|  1.42M|            here = dcode + (hold & dmask);
  142|  2.49M|          dodist:
  143|  2.49M|            op = (unsigned)(here->bits);
  144|  2.49M|            hold >>= op;
  145|  2.49M|            bits -= op;
  146|  2.49M|            op = (unsigned)(here->op);
  147|  2.49M|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (147:17): [True: 1.42M, False: 1.07M]
  ------------------
  148|  1.42M|                dist = (unsigned)(here->val);
  149|  1.42M|                op &= 15;                       /* number of extra bits */
  150|  1.42M|                if (bits < op) {
  ------------------
  |  Branch (150:21): [True: 384k, False: 1.03M]
  ------------------
  151|   384k|                    hold += (unsigned long)(*in++) << bits;
  152|   384k|                    bits += 8;
  153|   384k|                    if (bits < op) {
  ------------------
  |  Branch (153:25): [True: 0, False: 384k]
  ------------------
  154|      0|                        hold += (unsigned long)(*in++) << bits;
  155|      0|                        bits += 8;
  156|      0|                    }
  157|   384k|                }
  158|  1.42M|                dist += (unsigned)hold & ((1U << op) - 1);
  159|       |#ifdef INFLATE_STRICT
  160|       |                if (dist > dmax) {
  161|       |                    strm->msg = (char *)"invalid distance too far back";
  162|       |                    state->mode = BAD;
  163|       |                    break;
  164|       |                }
  165|       |#endif
  166|  1.42M|                hold >>= op;
  167|  1.42M|                bits -= op;
  168|  1.42M|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  169|  1.42M|                op = (unsigned)(out - beg);     /* max distance in output */
  170|  1.42M|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (170:21): [True: 1.17k, False: 1.41M]
  ------------------
  171|  1.17k|                    op = dist - op;             /* distance back in window */
  172|  1.17k|                    if (op > whave) {
  ------------------
  |  Branch (172:25): [True: 1.17k, False: 0]
  ------------------
  173|  1.17k|                        if (state->sane) {
  ------------------
  |  Branch (173:29): [True: 1.17k, False: 0]
  ------------------
  174|  1.17k|                            strm->msg =
  175|  1.17k|                                (char *)"invalid distance too far back";
  176|  1.17k|                            state->mode = BAD;
  177|  1.17k|                            break;
  178|  1.17k|                        }
  179|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  180|       |                        if (len <= op - whave) {
  181|       |                            do {
  182|       |                                *out++ = 0;
  183|       |                            } while (--len);
  184|       |                            continue;
  185|       |                        }
  186|       |                        len -= op - whave;
  187|       |                        do {
  188|       |                            *out++ = 0;
  189|       |                        } while (--op > whave);
  190|       |                        if (op == 0) {
  191|       |                            from = out - dist;
  192|       |                            do {
  193|       |                                *out++ = *from++;
  194|       |                            } while (--len);
  195|       |                            continue;
  196|       |                        }
  197|       |#endif
  198|  1.17k|                    }
  199|      0|                    from = window;
  200|      0|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (200:25): [True: 0, False: 0]
  ------------------
  201|      0|                        from += wsize - op;
  202|      0|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (202:29): [True: 0, False: 0]
  ------------------
  203|      0|                            len -= op;
  204|      0|                            do {
  205|      0|                                *out++ = *from++;
  206|      0|                            } while (--op);
  ------------------
  |  Branch (206:38): [True: 0, False: 0]
  ------------------
  207|      0|                            from = out - dist;  /* rest from output */
  208|      0|                        }
  209|      0|                    }
  210|      0|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (210:30): [True: 0, False: 0]
  ------------------
  211|      0|                        from += wsize + wnext - op;
  212|      0|                        op -= wnext;
  213|      0|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (213:29): [True: 0, False: 0]
  ------------------
  214|      0|                            len -= op;
  215|      0|                            do {
  216|      0|                                *out++ = *from++;
  217|      0|                            } while (--op);
  ------------------
  |  Branch (217:38): [True: 0, False: 0]
  ------------------
  218|      0|                            from = window;
  219|      0|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (219:33): [True: 0, False: 0]
  ------------------
  220|      0|                                op = wnext;
  221|      0|                                len -= op;
  222|      0|                                do {
  223|      0|                                    *out++ = *from++;
  224|      0|                                } while (--op);
  ------------------
  |  Branch (224:42): [True: 0, False: 0]
  ------------------
  225|      0|                                from = out - dist;      /* rest from output */
  226|      0|                            }
  227|      0|                        }
  228|      0|                    }
  229|      0|                    else {                      /* contiguous in window */
  230|      0|                        from += wnext - op;
  231|      0|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (231:29): [True: 0, False: 0]
  ------------------
  232|      0|                            len -= op;
  233|      0|                            do {
  234|      0|                                *out++ = *from++;
  235|      0|                            } while (--op);
  ------------------
  |  Branch (235:38): [True: 0, False: 0]
  ------------------
  236|      0|                            from = out - dist;  /* rest from output */
  237|      0|                        }
  238|      0|                    }
  239|      0|                    while (len > 2) {
  ------------------
  |  Branch (239:28): [True: 0, False: 0]
  ------------------
  240|      0|                        *out++ = *from++;
  241|      0|                        *out++ = *from++;
  242|      0|                        *out++ = *from++;
  243|      0|                        len -= 3;
  244|      0|                    }
  245|      0|                    if (len) {
  ------------------
  |  Branch (245:25): [True: 0, False: 0]
  ------------------
  246|      0|                        *out++ = *from++;
  247|      0|                        if (len > 1)
  ------------------
  |  Branch (247:29): [True: 0, False: 0]
  ------------------
  248|      0|                            *out++ = *from++;
  249|      0|                    }
  250|      0|                }
  251|  1.41M|                else {
  252|  1.41M|                    from = out - dist;          /* copy direct from output */
  253|  77.8M|                    do {                        /* minimum length is three */
  254|  77.8M|                        *out++ = *from++;
  255|  77.8M|                        *out++ = *from++;
  256|  77.8M|                        *out++ = *from++;
  257|  77.8M|                        len -= 3;
  258|  77.8M|                    } while (len > 2);
  ------------------
  |  Branch (258:30): [True: 76.4M, False: 1.41M]
  ------------------
  259|  1.41M|                    if (len) {
  ------------------
  |  Branch (259:25): [True: 229k, False: 1.19M]
  ------------------
  260|   229k|                        *out++ = *from++;
  261|   229k|                        if (len > 1)
  ------------------
  |  Branch (261:29): [True: 193k, False: 36.0k]
  ------------------
  262|   193k|                            *out++ = *from++;
  263|   229k|                    }
  264|  1.41M|                }
  265|  1.42M|            }
  266|  1.07M|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (266:22): [True: 1.07M, False: 503]
  ------------------
  267|  1.07M|                here = dcode + here->val + (hold & ((1U << op) - 1));
  268|  1.07M|                goto dodist;
  269|  1.07M|            }
  270|    503|            else {
  271|    503|                strm->msg = (char *)"invalid distance code";
  272|    503|                state->mode = BAD;
  273|    503|                break;
  274|    503|            }
  275|  2.49M|        }
  276|  1.08M|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (276:18): [True: 1.08M, False: 7.95k]
  ------------------
  277|  1.08M|            here = lcode + here->val + (hold & ((1U << op) - 1));
  278|  1.08M|            goto dolen;
  279|  1.08M|        }
  280|  7.95k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (280:18): [True: 7.70k, False: 249]
  ------------------
  281|  7.70k|            Tracevv((stderr, "inflate:         end of block\n"));
  282|  7.70k|            state->mode = TYPE;
  283|  7.70k|            break;
  284|  7.70k|        }
  285|    249|        else {
  286|    249|            strm->msg = (char *)"invalid literal/length code";
  287|    249|            state->mode = BAD;
  288|    249|            break;
  289|    249|        }
  290|  5.45M|    } while (in < last && out < end);
  ------------------
  |  Branch (290:14): [True: 4.35M, False: 14.3k]
  |  Branch (290:27): [True: 4.34M, False: 2.27k]
  ------------------
  291|       |
  292|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  293|  26.2k|    len = bits >> 3;
  294|  26.2k|    in -= len;
  295|  26.2k|    bits -= len << 3;
  296|  26.2k|    hold &= (1U << bits) - 1;
  297|       |
  298|       |    /* update state and return */
  299|  26.2k|    strm->next_in = in;
  300|  26.2k|    strm->next_out = out;
  301|  26.2k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (301:33): [True: 20.9k, False: 5.22k]
  ------------------
  302|  26.2k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (302:34): [True: 23.9k, False: 2.30k]
  ------------------
  303|  23.9k|                                 257 + (end - out) : 257 - (out - end));
  304|  26.2k|    state->hold = hold;
  305|  26.2k|    state->bits = bits;
  306|  26.2k|    return;
  307|  26.2k|}

inflateResetKeep:
  121|  65.9k|{
  122|  65.9k|    struct inflate_state FAR *state;
  123|       |
  124|  65.9k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (124:9): [True: 0, False: 65.9k]
  ------------------
  125|  65.9k|    state = (struct inflate_state FAR *)strm->state;
  126|  65.9k|    strm->total_in = strm->total_out = state->total = 0;
  127|  65.9k|    strm->msg = Z_NULL;
  ------------------
  |  |  212|  65.9k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  128|  65.9k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (128:9): [True: 65.9k, False: 0]
  ------------------
  129|  65.9k|        strm->adler = state->wrap & 1;
  130|  65.9k|    state->mode = HEAD;
  131|  65.9k|    state->last = 0;
  132|  65.9k|    state->havedict = 0;
  133|  65.9k|    state->flags = -1;
  134|  65.9k|    state->dmax = 32768U;
  135|  65.9k|    state->head = Z_NULL;
  ------------------
  |  |  212|  65.9k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  136|  65.9k|    state->hold = 0;
  137|  65.9k|    state->bits = 0;
  138|  65.9k|    state->lencode = state->distcode = state->next = state->codes;
  139|  65.9k|    state->sane = 1;
  140|  65.9k|    state->back = -1;
  141|  65.9k|    Tracev((stderr, "inflate: reset\n"));
  142|  65.9k|    return Z_OK;
  ------------------
  |  |  177|  65.9k|#define Z_OK            0
  ------------------
  143|  65.9k|}
inflateReset:
  147|  65.9k|{
  148|  65.9k|    struct inflate_state FAR *state;
  149|       |
  150|  65.9k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (150:9): [True: 0, False: 65.9k]
  ------------------
  151|  65.9k|    state = (struct inflate_state FAR *)strm->state;
  152|  65.9k|    state->wsize = 0;
  153|  65.9k|    state->whave = 0;
  154|  65.9k|    state->wnext = 0;
  155|  65.9k|    return inflateResetKeep(strm);
  156|  65.9k|}
inflateReset2:
  161|  1.39k|{
  162|  1.39k|    int wrap;
  163|  1.39k|    struct inflate_state FAR *state;
  164|       |
  165|       |    /* get the state */
  166|  1.39k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (166:9): [True: 0, False: 1.39k]
  ------------------
  167|  1.39k|    state = (struct inflate_state FAR *)strm->state;
  168|       |
  169|       |    /* extract wrap request from windowBits parameter */
  170|  1.39k|    if (windowBits < 0) {
  ------------------
  |  Branch (170:9): [True: 0, False: 1.39k]
  ------------------
  171|      0|        if (windowBits < -15)
  ------------------
  |  Branch (171:13): [True: 0, False: 0]
  ------------------
  172|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  173|      0|        wrap = 0;
  174|      0|        windowBits = -windowBits;
  175|      0|    }
  176|  1.39k|    else {
  177|  1.39k|        wrap = (windowBits >> 4) + 5;
  178|  1.39k|#ifdef GUNZIP
  179|  1.39k|        if (windowBits < 48)
  ------------------
  |  Branch (179:13): [True: 1.39k, False: 0]
  ------------------
  180|  1.39k|            windowBits &= 15;
  181|  1.39k|#endif
  182|  1.39k|    }
  183|       |
  184|       |    /* set number of window bits, free window if different */
  185|  1.39k|    if (windowBits && (windowBits < 8 || windowBits > 15))
  ------------------
  |  Branch (185:9): [True: 1.39k, False: 0]
  |  Branch (185:24): [True: 0, False: 1.39k]
  |  Branch (185:42): [True: 0, False: 1.39k]
  ------------------
  186|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  187|  1.39k|    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
  ------------------
  |  |  212|  2.78k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (187:9): [True: 0, False: 1.39k]
  |  Branch (187:36): [True: 0, False: 0]
  ------------------
  188|      0|        ZFREE(strm, state->window);
  ------------------
  |  |  268|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  189|      0|        state->window = Z_NULL;
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  190|      0|    }
  191|       |
  192|       |    /* update state and reset the rest of it */
  193|  1.39k|    state->wrap = wrap;
  194|  1.39k|    state->wbits = (unsigned)windowBits;
  195|  1.39k|    return inflateReset(strm);
  196|  1.39k|}
inflateInit2_:
  203|  1.39k|{
  204|  1.39k|    int ret;
  205|  1.39k|    struct inflate_state FAR *state;
  206|       |
  207|  1.39k|    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |  212|  2.78k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |   40|  1.39k|#define ZLIB_VERSION "1.2.13"
  ------------------
  |  Branch (207:9): [True: 0, False: 1.39k]
  |  Branch (207:30): [True: 0, False: 1.39k]
  ------------------
  208|  1.39k|        stream_size != (int)(sizeof(z_stream)))
  ------------------
  |  Branch (208:9): [True: 0, False: 1.39k]
  ------------------
  209|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  185|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  210|  1.39k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  212|  1.39k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (210:9): [True: 0, False: 1.39k]
  ------------------
  211|  1.39k|    strm->msg = Z_NULL;                 /* in case we return an error */
  ------------------
  |  |  212|  1.39k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  212|  1.39k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (212:9): [True: 1.39k, False: 0]
  ------------------
  213|       |#ifdef Z_SOLO
  214|       |        return Z_STREAM_ERROR;
  215|       |#else
  216|  1.39k|        strm->zalloc = zcalloc;
  217|  1.39k|        strm->opaque = (voidpf)0;
  218|  1.39k|#endif
  219|  1.39k|    }
  220|  1.39k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (220:9): [True: 1.39k, False: 0]
  ------------------
  221|       |#ifdef Z_SOLO
  222|       |        return Z_STREAM_ERROR;
  223|       |#else
  224|  1.39k|        strm->zfree = zcfree;
  225|  1.39k|#endif
  226|  1.39k|    state = (struct inflate_state FAR *)
  227|  1.39k|            ZALLOC(strm, 1, sizeof(struct inflate_state));
  ------------------
  |  |  267|  1.39k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  228|  1.39k|    if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  212|  1.39k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  183|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  |  Branch (228:9): [True: 0, False: 1.39k]
  ------------------
  229|  1.39k|    Tracev((stderr, "inflate: allocated\n"));
  230|  1.39k|    strm->state = (struct internal_state FAR *)state;
  231|  1.39k|    state->strm = strm;
  232|  1.39k|    state->window = Z_NULL;
  ------------------
  |  |  212|  1.39k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  233|  1.39k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  234|  1.39k|    ret = inflateReset2(strm, windowBits);
  235|  1.39k|    if (ret != Z_OK) {
  ------------------
  |  |  177|  1.39k|#define Z_OK            0
  ------------------
  |  Branch (235:9): [True: 0, False: 1.39k]
  ------------------
  236|      0|        ZFREE(strm, state);
  ------------------
  |  |  268|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  237|      0|        strm->state = Z_NULL;
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  238|      0|    }
  239|  1.39k|    return ret;
  240|  1.39k|}
inflateInit_:
  246|  1.39k|{
  247|  1.39k|    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
  ------------------
  |  |   68|  1.39k|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |  273|  1.39k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  248|  1.39k|}
inflate:
  628|  79.9k|{
  629|  79.9k|    struct inflate_state FAR *state;
  630|  79.9k|    z_const unsigned char FAR *next;    /* next input */
  631|  79.9k|    unsigned char FAR *put;     /* next output */
  632|  79.9k|    unsigned have, left;        /* available input and output */
  633|  79.9k|    unsigned long hold;         /* bit buffer */
  634|  79.9k|    unsigned bits;              /* bits in bit buffer */
  635|  79.9k|    unsigned in, out;           /* save starting available input and output */
  636|  79.9k|    unsigned copy;              /* number of stored or match bytes to copy */
  637|  79.9k|    unsigned char FAR *from;    /* where to copy match bytes from */
  638|  79.9k|    code here;                  /* current decoding table entry */
  639|  79.9k|    code last;                  /* parent table entry */
  640|  79.9k|    unsigned len;               /* length to copy for repeats, bits to drop */
  641|  79.9k|    int ret;                    /* return code */
  642|  79.9k|#ifdef GUNZIP
  643|  79.9k|    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  644|  79.9k|#endif
  645|  79.9k|    static const unsigned short order[19] = /* permutation of code lengths */
  646|  79.9k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  647|       |
  648|  79.9k|    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
  ------------------
  |  |  212|   159k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (648:9): [True: 0, False: 79.9k]
  |  Branch (648:36): [True: 0, False: 79.9k]
  ------------------
  649|  79.9k|        (strm->next_in == Z_NULL && strm->avail_in != 0))
  ------------------
  |  |  212|   159k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (649:10): [True: 0, False: 79.9k]
  |  Branch (649:37): [True: 0, False: 0]
  ------------------
  650|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  651|       |
  652|  79.9k|    state = (struct inflate_state FAR *)strm->state;
  653|  79.9k|    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
  ------------------
  |  Branch (653:9): [True: 477, False: 79.4k]
  ------------------
  654|  79.9k|    LOAD();
  ------------------
  |  |  480|  79.9k|    do { \
  |  |  481|  79.9k|        put = strm->next_out; \
  |  |  482|  79.9k|        left = strm->avail_out; \
  |  |  483|  79.9k|        next = strm->next_in; \
  |  |  484|  79.9k|        have = strm->avail_in; \
  |  |  485|  79.9k|        hold = state->hold; \
  |  |  486|  79.9k|        bits = state->bits; \
  |  |  487|  79.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (487:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  655|  79.9k|    in = have;
  656|  79.9k|    out = left;
  657|  79.9k|    ret = Z_OK;
  ------------------
  |  |  177|  79.9k|#define Z_OK            0
  ------------------
  658|  79.9k|    for (;;)
  659|   436k|        switch (state->mode) {
  660|  71.2k|        case HEAD:
  ------------------
  |  Branch (660:9): [True: 71.2k, False: 365k]
  ------------------
  661|  71.2k|            if (state->wrap == 0) {
  ------------------
  |  Branch (661:17): [True: 0, False: 71.2k]
  ------------------
  662|      0|                state->mode = TYPEDO;
  663|      0|                break;
  664|      0|            }
  665|  71.2k|            NEEDBITS(16);
  ------------------
  |  |  520|  71.2k|    do { \
  |  |  521|   191k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 135k, False: 56.3k]
  |  |  ------------------
  |  |  522|   135k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|   135k|    do { \
  |  |  |  |  511|   135k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 14.8k, False: 120k]
  |  |  |  |  ------------------
  |  |  |  |  512|   135k|        have--; \
  |  |  |  |  513|   120k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|   120k|        bits += 8; \
  |  |  |  |  515|   120k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  71.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  666|  56.3k|#ifdef GUNZIP
  667|  56.3k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (667:17): [True: 0, False: 56.3k]
  |  Branch (667:38): [True: 0, False: 0]
  ------------------
  668|      0|                if (state->wbits == 0)
  ------------------
  |  Branch (668:21): [True: 0, False: 0]
  ------------------
  669|      0|                    state->wbits = 15;
  670|      0|                state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  671|      0|                CRC2(state->check, hold);
  ------------------
  |  |  462|      0|    do { \
  |  |  463|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  464|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  465|      0|        check = crc32(check, hbuf, 2); \
  |  |  466|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (466:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  672|      0|                INITBITS();
  ------------------
  |  |  502|      0|    do { \
  |  |  503|      0|        hold = 0; \
  |  |  504|      0|        bits = 0; \
  |  |  505|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (505:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  673|      0|                state->mode = FLAGS;
  674|      0|                break;
  675|      0|            }
  676|  56.3k|            if (state->head != Z_NULL)
  ------------------
  |  |  212|  56.3k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (676:17): [True: 0, False: 56.3k]
  ------------------
  677|      0|                state->head->done = -1;
  678|  56.3k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (678:17): [True: 0, False: 56.3k]
  ------------------
  679|       |#else
  680|       |            if (
  681|       |#endif
  682|  56.3k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  527|  56.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  |  Branch (682:17): [True: 29.1k, False: 27.2k]
  ------------------
  683|  29.1k|                strm->msg = (char *)"incorrect header check";
  684|  29.1k|                state->mode = BAD;
  685|  29.1k|                break;
  686|  29.1k|            }
  687|  27.2k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  527|  27.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  209|  27.2k|#define Z_DEFLATED   8
  ------------------
  |  Branch (687:17): [True: 3.25k, False: 23.9k]
  ------------------
  688|  3.25k|                strm->msg = (char *)"unknown compression method";
  689|  3.25k|                state->mode = BAD;
  690|  3.25k|                break;
  691|  3.25k|            }
  692|  23.9k|            DROPBITS(4);
  ------------------
  |  |  531|  23.9k|    do { \
  |  |  532|  23.9k|        hold >>= (n); \
  |  |  533|  23.9k|        bits -= (unsigned)(n); \
  |  |  534|  23.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  693|  23.9k|            len = BITS(4) + 8;
  ------------------
  |  |  527|  23.9k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  694|  23.9k|            if (state->wbits == 0)
  ------------------
  |  Branch (694:17): [True: 0, False: 23.9k]
  ------------------
  695|      0|                state->wbits = len;
  696|  23.9k|            if (len > 15 || len > state->wbits) {
  ------------------
  |  Branch (696:17): [True: 234, False: 23.7k]
  |  Branch (696:29): [True: 0, False: 23.7k]
  ------------------
  697|    234|                strm->msg = (char *)"invalid window size";
  698|    234|                state->mode = BAD;
  699|    234|                break;
  700|    234|            }
  701|  23.7k|            state->dmax = 1U << len;
  702|  23.7k|            state->flags = 0;               /* indicate zlib header */
  703|  23.7k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  704|  23.7k|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  212|  23.7k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  705|  23.7k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (705:27): [True: 636, False: 23.0k]
  ------------------
  706|  23.7k|            INITBITS();
  ------------------
  |  |  502|  23.7k|    do { \
  |  |  503|  23.7k|        hold = 0; \
  |  |  504|  23.7k|        bits = 0; \
  |  |  505|  23.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (505:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  707|  23.7k|            break;
  708|      0|#ifdef GUNZIP
  709|      0|        case FLAGS:
  ------------------
  |  Branch (709:9): [True: 0, False: 436k]
  ------------------
  710|      0|            NEEDBITS(16);
  ------------------
  |  |  520|      0|    do { \
  |  |  521|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|      0|    do { \
  |  |  |  |  511|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  512|      0|        have--; \
  |  |  |  |  513|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|      0|        bits += 8; \
  |  |  |  |  515|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  711|      0|            state->flags = (int)(hold);
  712|      0|            if ((state->flags & 0xff) != Z_DEFLATED) {
  ------------------
  |  |  209|      0|#define Z_DEFLATED   8
  ------------------
  |  Branch (712:17): [True: 0, False: 0]
  ------------------
  713|      0|                strm->msg = (char *)"unknown compression method";
  714|      0|                state->mode = BAD;
  715|      0|                break;
  716|      0|            }
  717|      0|            if (state->flags & 0xe000) {
  ------------------
  |  Branch (717:17): [True: 0, False: 0]
  ------------------
  718|      0|                strm->msg = (char *)"unknown header flags set";
  719|      0|                state->mode = BAD;
  720|      0|                break;
  721|      0|            }
  722|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (722:17): [True: 0, False: 0]
  ------------------
  723|      0|                state->head->text = (int)((hold >> 8) & 1);
  724|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (724:17): [True: 0, False: 0]
  |  Branch (724:44): [True: 0, False: 0]
  ------------------
  725|      0|                CRC2(state->check, hold);
  ------------------
  |  |  462|      0|    do { \
  |  |  463|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  464|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  465|      0|        check = crc32(check, hbuf, 2); \
  |  |  466|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (466:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  726|      0|            INITBITS();
  ------------------
  |  |  502|      0|    do { \
  |  |  503|      0|        hold = 0; \
  |  |  504|      0|        bits = 0; \
  |  |  505|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (505:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  727|      0|            state->mode = TIME;
  728|       |                /* fallthrough */
  729|      0|        case TIME:
  ------------------
  |  Branch (729:9): [True: 0, False: 436k]
  ------------------
  730|      0|            NEEDBITS(32);
  ------------------
  |  |  520|      0|    do { \
  |  |  521|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|      0|    do { \
  |  |  |  |  511|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  512|      0|        have--; \
  |  |  |  |  513|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|      0|        bits += 8; \
  |  |  |  |  515|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  731|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (731:17): [True: 0, False: 0]
  ------------------
  732|      0|                state->head->time = hold;
  733|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (733:17): [True: 0, False: 0]
  |  Branch (733:44): [True: 0, False: 0]
  ------------------
  734|      0|                CRC4(state->check, hold);
  ------------------
  |  |  469|      0|    do { \
  |  |  470|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  471|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  472|      0|        hbuf[2] = (unsigned char)((word) >> 16); \
  |  |  473|      0|        hbuf[3] = (unsigned char)((word) >> 24); \
  |  |  474|      0|        check = crc32(check, hbuf, 4); \
  |  |  475|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (475:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  735|      0|            INITBITS();
  ------------------
  |  |  502|      0|    do { \
  |  |  503|      0|        hold = 0; \
  |  |  504|      0|        bits = 0; \
  |  |  505|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (505:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  736|      0|            state->mode = OS;
  737|       |                /* fallthrough */
  738|      0|        case OS:
  ------------------
  |  Branch (738:9): [True: 0, False: 436k]
  ------------------
  739|      0|            NEEDBITS(16);
  ------------------
  |  |  520|      0|    do { \
  |  |  521|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|      0|    do { \
  |  |  |  |  511|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  512|      0|        have--; \
  |  |  |  |  513|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|      0|        bits += 8; \
  |  |  |  |  515|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  740|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (740:17): [True: 0, False: 0]
  ------------------
  741|      0|                state->head->xflags = (int)(hold & 0xff);
  742|      0|                state->head->os = (int)(hold >> 8);
  743|      0|            }
  744|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (744:17): [True: 0, False: 0]
  |  Branch (744:44): [True: 0, False: 0]
  ------------------
  745|      0|                CRC2(state->check, hold);
  ------------------
  |  |  462|      0|    do { \
  |  |  463|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  464|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  465|      0|        check = crc32(check, hbuf, 2); \
  |  |  466|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (466:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  746|      0|            INITBITS();
  ------------------
  |  |  502|      0|    do { \
  |  |  503|      0|        hold = 0; \
  |  |  504|      0|        bits = 0; \
  |  |  505|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (505:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  747|      0|            state->mode = EXLEN;
  748|       |                /* fallthrough */
  749|      0|        case EXLEN:
  ------------------
  |  Branch (749:9): [True: 0, False: 436k]
  ------------------
  750|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (750:17): [True: 0, False: 0]
  ------------------
  751|      0|                NEEDBITS(16);
  ------------------
  |  |  520|      0|    do { \
  |  |  521|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|      0|    do { \
  |  |  |  |  511|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  512|      0|        have--; \
  |  |  |  |  513|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|      0|        bits += 8; \
  |  |  |  |  515|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  752|      0|                state->length = (unsigned)(hold);
  753|      0|                if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (753:21): [True: 0, False: 0]
  ------------------
  754|      0|                    state->head->extra_len = (unsigned)hold;
  755|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (755:21): [True: 0, False: 0]
  |  Branch (755:48): [True: 0, False: 0]
  ------------------
  756|      0|                    CRC2(state->check, hold);
  ------------------
  |  |  462|      0|    do { \
  |  |  463|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  464|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  465|      0|        check = crc32(check, hbuf, 2); \
  |  |  466|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (466:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  757|      0|                INITBITS();
  ------------------
  |  |  502|      0|    do { \
  |  |  503|      0|        hold = 0; \
  |  |  504|      0|        bits = 0; \
  |  |  505|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (505:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  758|      0|            }
  759|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (759:22): [True: 0, False: 0]
  ------------------
  760|      0|                state->head->extra = Z_NULL;
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  761|      0|            state->mode = EXTRA;
  762|       |                /* fallthrough */
  763|      0|        case EXTRA:
  ------------------
  |  Branch (763:9): [True: 0, False: 436k]
  ------------------
  764|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (764:17): [True: 0, False: 0]
  ------------------
  765|      0|                copy = state->length;
  766|      0|                if (copy > have) copy = have;
  ------------------
  |  Branch (766:21): [True: 0, False: 0]
  ------------------
  767|      0|                if (copy) {
  ------------------
  |  Branch (767:21): [True: 0, False: 0]
  ------------------
  768|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (768:25): [True: 0, False: 0]
  ------------------
  769|      0|                        state->head->extra != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (769:25): [True: 0, False: 0]
  ------------------
  770|      0|                        (len = state->head->extra_len - state->length) <
  ------------------
  |  Branch (770:25): [True: 0, False: 0]
  ------------------
  771|      0|                            state->head->extra_max) {
  772|      0|                        zmemcpy(state->head->extra + len, next,
  ------------------
  |  |  230|      0|#    define zmemcpy memcpy
  ------------------
  773|      0|                                len + copy > state->head->extra_max ?
  ------------------
  |  Branch (773:33): [True: 0, False: 0]
  ------------------
  774|      0|                                state->head->extra_max - len : copy);
  775|      0|                    }
  776|      0|                    if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (776:25): [True: 0, False: 0]
  |  Branch (776:52): [True: 0, False: 0]
  ------------------
  777|      0|                        state->check = crc32(state->check, next, copy);
  778|      0|                    have -= copy;
  779|      0|                    next += copy;
  780|      0|                    state->length -= copy;
  781|      0|                }
  782|      0|                if (state->length) goto inf_leave;
  ------------------
  |  Branch (782:21): [True: 0, False: 0]
  ------------------
  783|      0|            }
  784|      0|            state->length = 0;
  785|      0|            state->mode = NAME;
  786|       |                /* fallthrough */
  787|      0|        case NAME:
  ------------------
  |  Branch (787:9): [True: 0, False: 436k]
  ------------------
  788|      0|            if (state->flags & 0x0800) {
  ------------------
  |  Branch (788:17): [True: 0, False: 0]
  ------------------
  789|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (789:21): [True: 0, False: 0]
  ------------------
  790|      0|                copy = 0;
  791|      0|                do {
  792|      0|                    len = (unsigned)(next[copy++]);
  793|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (793:25): [True: 0, False: 0]
  ------------------
  794|      0|                            state->head->name != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (794:29): [True: 0, False: 0]
  ------------------
  795|      0|                            state->length < state->head->name_max)
  ------------------
  |  Branch (795:29): [True: 0, False: 0]
  ------------------
  796|      0|                        state->head->name[state->length++] = (Bytef)len;
  797|      0|                } while (len && copy < have);
  ------------------
  |  Branch (797:26): [True: 0, False: 0]
  |  Branch (797:33): [True: 0, False: 0]
  ------------------
  798|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (798:21): [True: 0, False: 0]
  |  Branch (798:48): [True: 0, False: 0]
  ------------------
  799|      0|                    state->check = crc32(state->check, next, copy);
  800|      0|                have -= copy;
  801|      0|                next += copy;
  802|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (802:21): [True: 0, False: 0]
  ------------------
  803|      0|            }
  804|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (804:22): [True: 0, False: 0]
  ------------------
  805|      0|                state->head->name = Z_NULL;
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  806|      0|            state->length = 0;
  807|      0|            state->mode = COMMENT;
  808|       |                /* fallthrough */
  809|      0|        case COMMENT:
  ------------------
  |  Branch (809:9): [True: 0, False: 436k]
  ------------------
  810|      0|            if (state->flags & 0x1000) {
  ------------------
  |  Branch (810:17): [True: 0, False: 0]
  ------------------
  811|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (811:21): [True: 0, False: 0]
  ------------------
  812|      0|                copy = 0;
  813|      0|                do {
  814|      0|                    len = (unsigned)(next[copy++]);
  815|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (815:25): [True: 0, False: 0]
  ------------------
  816|      0|                            state->head->comment != Z_NULL &&
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (816:29): [True: 0, False: 0]
  ------------------
  817|      0|                            state->length < state->head->comm_max)
  ------------------
  |  Branch (817:29): [True: 0, False: 0]
  ------------------
  818|      0|                        state->head->comment[state->length++] = (Bytef)len;
  819|      0|                } while (len && copy < have);
  ------------------
  |  Branch (819:26): [True: 0, False: 0]
  |  Branch (819:33): [True: 0, False: 0]
  ------------------
  820|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (820:21): [True: 0, False: 0]
  |  Branch (820:48): [True: 0, False: 0]
  ------------------
  821|      0|                    state->check = crc32(state->check, next, copy);
  822|      0|                have -= copy;
  823|      0|                next += copy;
  824|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (824:21): [True: 0, False: 0]
  ------------------
  825|      0|            }
  826|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (826:22): [True: 0, False: 0]
  ------------------
  827|      0|                state->head->comment = Z_NULL;
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  828|      0|            state->mode = HCRC;
  829|       |                /* fallthrough */
  830|      0|        case HCRC:
  ------------------
  |  Branch (830:9): [True: 0, False: 436k]
  ------------------
  831|      0|            if (state->flags & 0x0200) {
  ------------------
  |  Branch (831:17): [True: 0, False: 0]
  ------------------
  832|      0|                NEEDBITS(16);
  ------------------
  |  |  520|      0|    do { \
  |  |  521|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|      0|    do { \
  |  |  |  |  511|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  512|      0|        have--; \
  |  |  |  |  513|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|      0|        bits += 8; \
  |  |  |  |  515|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  833|      0|                if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
  ------------------
  |  Branch (833:21): [True: 0, False: 0]
  |  Branch (833:42): [True: 0, False: 0]
  ------------------
  834|      0|                    strm->msg = (char *)"header crc mismatch";
  835|      0|                    state->mode = BAD;
  836|      0|                    break;
  837|      0|                }
  838|      0|                INITBITS();
  ------------------
  |  |  502|      0|    do { \
  |  |  503|      0|        hold = 0; \
  |  |  504|      0|        bits = 0; \
  |  |  505|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (505:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  839|      0|            }
  840|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (840:17): [True: 0, False: 0]
  ------------------
  841|      0|                state->head->hcrc = (int)((state->flags >> 9) & 1);
  842|      0|                state->head->done = 1;
  843|      0|            }
  844|      0|            strm->adler = state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  845|      0|            state->mode = TYPE;
  846|      0|            break;
  847|      0|#endif
  848|    763|        case DICTID:
  ------------------
  |  Branch (848:9): [True: 763, False: 435k]
  ------------------
  849|    763|            NEEDBITS(32);
  ------------------
  |  |  520|    763|    do { \
  |  |  521|  3.04k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 2.53k, False: 509]
  |  |  ------------------
  |  |  522|  2.53k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|  2.53k|    do { \
  |  |  |  |  511|  2.53k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 254, False: 2.27k]
  |  |  |  |  ------------------
  |  |  |  |  512|  2.53k|        have--; \
  |  |  |  |  513|  2.27k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|  2.27k|        bits += 8; \
  |  |  |  |  515|  2.27k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|    763|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  850|    509|            strm->adler = state->check = ZSWAP32(hold);
  ------------------
  |  |  272|    509|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  273|    509|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
  851|    509|            INITBITS();
  ------------------
  |  |  502|    509|    do { \
  |  |  503|    509|        hold = 0; \
  |  |  504|    509|        bits = 0; \
  |  |  505|    509|    } while (0)
  |  |  ------------------
  |  |  |  Branch (505:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  852|    509|            state->mode = DICT;
  853|       |                /* fallthrough */
  854|    509|        case DICT:
  ------------------
  |  Branch (854:9): [True: 0, False: 436k]
  ------------------
  855|    509|            if (state->havedict == 0) {
  ------------------
  |  Branch (855:17): [True: 509, False: 0]
  ------------------
  856|    509|                RESTORE();
  ------------------
  |  |  491|    509|    do { \
  |  |  492|    509|        strm->next_out = put; \
  |  |  493|    509|        strm->avail_out = left; \
  |  |  494|    509|        strm->next_in = next; \
  |  |  495|    509|        strm->avail_in = have; \
  |  |  496|    509|        state->hold = hold; \
  |  |  497|    509|        state->bits = bits; \
  |  |  498|    509|    } while (0)
  |  |  ------------------
  |  |  |  Branch (498:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  857|    509|                return Z_NEED_DICT;
  ------------------
  |  |  179|    509|#define Z_NEED_DICT     2
  ------------------
  858|    509|            }
  859|      0|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  212|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  860|      0|            state->mode = TYPE;
  861|       |                /* fallthrough */
  862|  35.2k|        case TYPE:
  ------------------
  |  Branch (862:9): [True: 35.2k, False: 401k]
  ------------------
  863|  35.2k|            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  173|  70.4k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  174|  35.2k|#define Z_TREES         6
  ------------------
  |  Branch (863:17): [True: 0, False: 35.2k]
  |  Branch (863:37): [True: 0, False: 35.2k]
  ------------------
  864|       |                /* fallthrough */
  865|  35.7k|        case TYPEDO:
  ------------------
  |  Branch (865:9): [True: 477, False: 435k]
  ------------------
  866|  35.7k|            if (state->last) {
  ------------------
  |  Branch (866:17): [True: 2.47k, False: 33.2k]
  ------------------
  867|  2.47k|                BYTEBITS();
  ------------------
  |  |  538|  2.47k|    do { \
  |  |  539|  2.47k|        hold >>= bits & 7; \
  |  |  540|  2.47k|        bits -= bits & 7; \
  |  |  541|  2.47k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (541:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  868|  2.47k|                state->mode = CHECK;
  869|  2.47k|                break;
  870|  2.47k|            }
  871|  33.2k|            NEEDBITS(3);
  ------------------
  |  |  520|  33.2k|    do { \
  |  |  521|  62.5k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 30.2k, False: 32.2k]
  |  |  ------------------
  |  |  522|  33.2k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|  30.2k|    do { \
  |  |  |  |  511|  30.2k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 956, False: 29.2k]
  |  |  |  |  ------------------
  |  |  |  |  512|  30.2k|        have--; \
  |  |  |  |  513|  29.2k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|  29.2k|        bits += 8; \
  |  |  |  |  515|  29.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  33.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  872|  32.2k|            state->last = BITS(1);
  ------------------
  |  |  527|  32.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  873|  32.2k|            DROPBITS(1);
  ------------------
  |  |  531|  32.2k|    do { \
  |  |  532|  32.2k|        hold >>= (n); \
  |  |  533|  32.2k|        bits -= (unsigned)(n); \
  |  |  534|  32.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  874|  32.2k|            switch (BITS(2)) {
  ------------------
  |  |  527|  32.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (527:5): [True: 0, False: 32.2k]
  |  |  ------------------
  ------------------
  875|  2.65k|            case 0:                             /* stored block */
  ------------------
  |  Branch (875:13): [True: 2.65k, False: 29.6k]
  ------------------
  876|  2.65k|                Tracev((stderr, "inflate:     stored block%s\n",
  877|  2.65k|                        state->last ? " (last)" : ""));
  878|  2.65k|                state->mode = STORED;
  879|  2.65k|                break;
  880|  17.3k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (880:13): [True: 17.3k, False: 14.9k]
  ------------------
  881|  17.3k|                fixedtables(state);
  882|  17.3k|                Tracev((stderr, "inflate:     fixed codes block%s\n",
  883|  17.3k|                        state->last ? " (last)" : ""));
  884|  17.3k|                state->mode = LEN_;             /* decode codes */
  885|  17.3k|                if (flush == Z_TREES) {
  ------------------
  |  |  174|  17.3k|#define Z_TREES         6
  ------------------
  |  Branch (885:21): [True: 0, False: 17.3k]
  ------------------
  886|      0|                    DROPBITS(2);
  ------------------
  |  |  531|      0|    do { \
  |  |  532|      0|        hold >>= (n); \
  |  |  533|      0|        bits -= (unsigned)(n); \
  |  |  534|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  887|      0|                    goto inf_leave;
  888|      0|                }
  889|  17.3k|                break;
  890|  17.3k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (890:13): [True: 11.8k, False: 20.4k]
  ------------------
  891|  11.8k|                Tracev((stderr, "inflate:     dynamic codes block%s\n",
  892|  11.8k|                        state->last ? " (last)" : ""));
  893|  11.8k|                state->mode = TABLE;
  894|  11.8k|                break;
  895|    437|            case 3:
  ------------------
  |  Branch (895:13): [True: 437, False: 31.8k]
  ------------------
  896|    437|                strm->msg = (char *)"invalid block type";
  897|    437|                state->mode = BAD;
  898|  32.2k|            }
  899|  32.2k|            DROPBITS(2);
  ------------------
  |  |  531|  32.2k|    do { \
  |  |  532|  32.2k|        hold >>= (n); \
  |  |  533|  32.2k|        bits -= (unsigned)(n); \
  |  |  534|  32.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  900|  32.2k|            break;
  901|  3.29k|        case STORED:
  ------------------
  |  Branch (901:9): [True: 3.29k, False: 433k]
  ------------------
  902|  3.29k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  538|  3.29k|    do { \
  |  |  539|  3.29k|        hold >>= bits & 7; \
  |  |  540|  3.29k|        bits -= bits & 7; \
  |  |  541|  3.29k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (541:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  903|  3.29k|            NEEDBITS(32);
  ------------------
  |  |  520|  3.29k|    do { \
  |  |  521|  11.5k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 9.53k, False: 1.99k]
  |  |  ------------------
  |  |  522|  9.53k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|  9.53k|    do { \
  |  |  |  |  511|  9.53k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 1.30k, False: 8.23k]
  |  |  |  |  ------------------
  |  |  |  |  512|  9.53k|        have--; \
  |  |  |  |  513|  8.23k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|  8.23k|        bits += 8; \
  |  |  |  |  515|  8.23k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  3.29k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  904|  1.99k|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (904:17): [True: 568, False: 1.42k]
  ------------------
  905|    568|                strm->msg = (char *)"invalid stored block lengths";
  906|    568|                state->mode = BAD;
  907|    568|                break;
  908|    568|            }
  909|  1.42k|            state->length = (unsigned)hold & 0xffff;
  910|  1.42k|            Tracev((stderr, "inflate:       stored length %u\n",
  911|  1.42k|                    state->length));
  912|  1.42k|            INITBITS();
  ------------------
  |  |  502|  1.42k|    do { \
  |  |  503|  1.42k|        hold = 0; \
  |  |  504|  1.42k|        bits = 0; \
  |  |  505|  1.42k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (505:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  913|  1.42k|            state->mode = COPY_;
  914|  1.42k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  174|  1.42k|#define Z_TREES         6
  ------------------
  |  Branch (914:17): [True: 0, False: 1.42k]
  ------------------
  915|       |                /* fallthrough */
  916|  1.42k|        case COPY_:
  ------------------
  |  Branch (916:9): [True: 0, False: 436k]
  ------------------
  917|  1.42k|            state->mode = COPY;
  918|       |                /* fallthrough */
  919|  3.14k|        case COPY:
  ------------------
  |  Branch (919:9): [True: 1.71k, False: 434k]
  ------------------
  920|  3.14k|            copy = state->length;
  921|  3.14k|            if (copy) {
  ------------------
  |  Branch (921:17): [True: 2.63k, False: 507]
  ------------------
  922|  2.63k|                if (copy > have) copy = have;
  ------------------
  |  Branch (922:21): [True: 2.34k, False: 285]
  ------------------
  923|  2.63k|                if (copy > left) copy = left;
  ------------------
  |  Branch (923:21): [True: 767, False: 1.86k]
  ------------------
  924|  2.63k|                if (copy == 0) goto inf_leave;
  ------------------
  |  Branch (924:21): [True: 1.44k, False: 1.18k]
  ------------------
  925|  1.18k|                zmemcpy(put, next, copy);
  ------------------
  |  |  230|  1.18k|#    define zmemcpy memcpy
  ------------------
  926|  1.18k|                have -= copy;
  927|  1.18k|                next += copy;
  928|  1.18k|                left -= copy;
  929|  1.18k|                put += copy;
  930|  1.18k|                state->length -= copy;
  931|  1.18k|                break;
  932|  2.63k|            }
  933|    507|            Tracev((stderr, "inflate:       stored end\n"));
  934|    507|            state->mode = TYPE;
  935|    507|            break;
  936|  12.2k|        case TABLE:
  ------------------
  |  Branch (936:9): [True: 12.2k, False: 424k]
  ------------------
  937|  12.2k|            NEEDBITS(14);
  ------------------
  |  |  520|  12.2k|    do { \
  |  |  521|  31.3k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 19.9k, False: 11.4k]
  |  |  ------------------
  |  |  522|  19.9k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|  19.9k|    do { \
  |  |  |  |  511|  19.9k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 758, False: 19.1k]
  |  |  |  |  ------------------
  |  |  |  |  512|  19.9k|        have--; \
  |  |  |  |  513|  19.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|  19.1k|        bits += 8; \
  |  |  |  |  515|  19.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  12.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  938|  11.4k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  527|  11.4k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  939|  11.4k|            DROPBITS(5);
  ------------------
  |  |  531|  11.4k|    do { \
  |  |  532|  11.4k|        hold >>= (n); \
  |  |  533|  11.4k|        bits -= (unsigned)(n); \
  |  |  534|  11.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  940|  11.4k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  527|  11.4k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  941|  11.4k|            DROPBITS(5);
  ------------------
  |  |  531|  11.4k|    do { \
  |  |  532|  11.4k|        hold >>= (n); \
  |  |  533|  11.4k|        bits -= (unsigned)(n); \
  |  |  534|  11.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  942|  11.4k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  527|  11.4k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  943|  11.4k|            DROPBITS(4);
  ------------------
  |  |  531|  11.4k|    do { \
  |  |  532|  11.4k|        hold >>= (n); \
  |  |  533|  11.4k|        bits -= (unsigned)(n); \
  |  |  534|  11.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  944|  11.4k|#ifndef PKZIP_BUG_WORKAROUND
  945|  11.4k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (945:17): [True: 387, False: 11.0k]
  |  Branch (945:38): [True: 240, False: 10.8k]
  ------------------
  946|    627|                strm->msg = (char *)"too many length or distance symbols";
  947|    627|                state->mode = BAD;
  948|    627|                break;
  949|    627|            }
  950|  10.8k|#endif
  951|  10.8k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  952|  10.8k|            state->have = 0;
  953|  10.8k|            state->mode = LENLENS;
  954|       |                /* fallthrough */
  955|  11.2k|        case LENLENS:
  ------------------
  |  Branch (955:9): [True: 424, False: 435k]
  ------------------
  956|   175k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (956:20): [True: 165k, False: 10.3k]
  ------------------
  957|   165k|                NEEDBITS(3);
  ------------------
  |  |  520|   165k|    do { \
  |  |  521|   222k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 57.8k, False: 164k]
  |  |  ------------------
  |  |  522|   165k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|  57.8k|    do { \
  |  |  |  |  511|  57.8k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 854, False: 57.0k]
  |  |  |  |  ------------------
  |  |  |  |  512|  57.8k|        have--; \
  |  |  |  |  513|  57.0k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|  57.0k|        bits += 8; \
  |  |  |  |  515|  57.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|   165k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  958|   164k|                state->lens[order[state->have++]] = (unsigned short)BITS(3);
  ------------------
  |  |  527|   164k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  959|   164k|                DROPBITS(3);
  ------------------
  |  |  531|   164k|    do { \
  |  |  532|   164k|        hold >>= (n); \
  |  |  533|   164k|        bits -= (unsigned)(n); \
  |  |  534|   164k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  960|   164k|            }
  961|  45.6k|            while (state->have < 19)
  ------------------
  |  Branch (961:20): [True: 35.2k, False: 10.3k]
  ------------------
  962|  35.2k|                state->lens[order[state->have++]] = 0;
  963|  10.3k|            state->next = state->codes;
  964|  10.3k|            state->lencode = (const code FAR *)(state->next);
  965|  10.3k|            state->lenbits = 7;
  966|  10.3k|            ret = inflate_table(CODES, state->lens, 19, &(state->next),
  967|  10.3k|                                &(state->lenbits), state->work);
  968|  10.3k|            if (ret) {
  ------------------
  |  Branch (968:17): [True: 1.13k, False: 9.25k]
  ------------------
  969|  1.13k|                strm->msg = (char *)"invalid code lengths set";
  970|  1.13k|                state->mode = BAD;
  971|  1.13k|                break;
  972|  1.13k|            }
  973|  9.25k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  974|  9.25k|            state->have = 0;
  975|  9.25k|            state->mode = CODELENS;
  976|       |                /* fallthrough */
  977|  10.7k|        case CODELENS:
  ------------------
  |  Branch (977:9): [True: 1.51k, False: 434k]
  ------------------
  978|   978k|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (978:20): [True: 971k, False: 7.06k]
  ------------------
  979|  1.18M|                for (;;) {
  980|  1.18M|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  527|  1.18M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  981|  1.18M|                    if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (981:25): [True: 969k, False: 214k]
  ------------------
  982|   214k|                    PULLBYTE();
  ------------------
  |  |  510|   214k|    do { \
  |  |  511|   214k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (511:13): [True: 1.88k, False: 212k]
  |  |  ------------------
  |  |  512|   214k|        have--; \
  |  |  513|   212k|        hold += (unsigned long)(*next++) << bits; \
  |  |  514|   212k|        bits += 8; \
  |  |  515|   212k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  983|   214k|                }
  984|   969k|                if (here.val < 16) {
  ------------------
  |  Branch (984:21): [True: 889k, False: 79.6k]
  ------------------
  985|   889k|                    DROPBITS(here.bits);
  ------------------
  |  |  531|   889k|    do { \
  |  |  532|   889k|        hold >>= (n); \
  |  |  533|   889k|        bits -= (unsigned)(n); \
  |  |  534|   889k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  986|   889k|                    state->lens[state->have++] = here.val;
  987|   889k|                }
  988|  79.6k|                else {
  989|  79.6k|                    if (here.val == 16) {
  ------------------
  |  Branch (989:25): [True: 34.9k, False: 44.7k]
  ------------------
  990|  34.9k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  520|  34.9k|    do { \
  |  |  521|  42.5k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 7.93k, False: 34.5k]
  |  |  ------------------
  |  |  522|  34.9k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|  7.93k|    do { \
  |  |  |  |  511|  7.93k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 399, False: 7.53k]
  |  |  |  |  ------------------
  |  |  |  |  512|  7.93k|        have--; \
  |  |  |  |  513|  7.53k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|  7.53k|        bits += 8; \
  |  |  |  |  515|  7.53k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  34.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  991|  34.5k|                        DROPBITS(here.bits);
  ------------------
  |  |  531|  34.5k|    do { \
  |  |  532|  34.5k|        hold >>= (n); \
  |  |  533|  34.5k|        bits -= (unsigned)(n); \
  |  |  534|  34.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  992|  34.5k|                        if (state->have == 0) {
  ------------------
  |  Branch (992:29): [True: 212, False: 34.3k]
  ------------------
  993|    212|                            strm->msg = (char *)"invalid bit length repeat";
  994|    212|                            state->mode = BAD;
  995|    212|                            break;
  996|    212|                        }
  997|  34.3k|                        len = state->lens[state->have - 1];
  998|  34.3k|                        copy = 3 + BITS(2);
  ------------------
  |  |  527|  34.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  999|  34.3k|                        DROPBITS(2);
  ------------------
  |  |  531|  34.3k|    do { \
  |  |  532|  34.3k|        hold >>= (n); \
  |  |  533|  34.3k|        bits -= (unsigned)(n); \
  |  |  534|  34.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1000|  34.3k|                    }
 1001|  44.7k|                    else if (here.val == 17) {
  ------------------
  |  Branch (1001:30): [True: 20.6k, False: 24.0k]
  ------------------
 1002|  20.6k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  520|  20.6k|    do { \
  |  |  521|  29.9k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 9.66k, False: 20.2k]
  |  |  ------------------
  |  |  522|  20.6k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|  9.66k|    do { \
  |  |  |  |  511|  9.66k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 362, False: 9.30k]
  |  |  |  |  ------------------
  |  |  |  |  512|  9.66k|        have--; \
  |  |  |  |  513|  9.30k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|  9.30k|        bits += 8; \
  |  |  |  |  515|  9.30k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  20.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1003|  20.2k|                        DROPBITS(here.bits);
  ------------------
  |  |  531|  20.2k|    do { \
  |  |  532|  20.2k|        hold >>= (n); \
  |  |  533|  20.2k|        bits -= (unsigned)(n); \
  |  |  534|  20.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1004|  20.2k|                        len = 0;
 1005|  20.2k|                        copy = 3 + BITS(3);
  ------------------
  |  |  527|  20.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1006|  20.2k|                        DROPBITS(3);
  ------------------
  |  |  531|  20.2k|    do { \
  |  |  532|  20.2k|        hold >>= (n); \
  |  |  533|  20.2k|        bits -= (unsigned)(n); \
  |  |  534|  20.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1007|  20.2k|                    }
 1008|  24.0k|                    else {
 1009|  24.0k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  520|  24.0k|    do { \
  |  |  521|  45.8k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 22.1k, False: 23.6k]
  |  |  ------------------
  |  |  522|  24.0k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|  22.1k|    do { \
  |  |  |  |  511|  22.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 404, False: 21.7k]
  |  |  |  |  ------------------
  |  |  |  |  512|  22.1k|        have--; \
  |  |  |  |  513|  21.7k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|  21.7k|        bits += 8; \
  |  |  |  |  515|  21.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  24.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1010|  23.6k|                        DROPBITS(here.bits);
  ------------------
  |  |  531|  23.6k|    do { \
  |  |  532|  23.6k|        hold >>= (n); \
  |  |  533|  23.6k|        bits -= (unsigned)(n); \
  |  |  534|  23.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1011|  23.6k|                        len = 0;
 1012|  23.6k|                        copy = 11 + BITS(7);
  ------------------
  |  |  527|  23.6k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1013|  23.6k|                        DROPBITS(7);
  ------------------
  |  |  531|  23.6k|    do { \
  |  |  532|  23.6k|        hold >>= (n); \
  |  |  533|  23.6k|        bits -= (unsigned)(n); \
  |  |  534|  23.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1014|  23.6k|                    }
 1015|  78.3k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (1015:25): [True: 447, False: 77.8k]
  ------------------
 1016|    447|                        strm->msg = (char *)"invalid bit length repeat";
 1017|    447|                        state->mode = BAD;
 1018|    447|                        break;
 1019|    447|                    }
 1020|  1.66M|                    while (copy--)
  ------------------
  |  Branch (1020:28): [True: 1.58M, False: 77.8k]
  ------------------
 1021|  1.58M|                        state->lens[state->have++] = (unsigned short)len;
 1022|  77.8k|                }
 1023|   969k|            }
 1024|       |
 1025|       |            /* handle error breaks in while */
 1026|  7.71k|            if (state->mode == BAD) break;
  ------------------
  |  Branch (1026:17): [True: 659, False: 7.06k]
  ------------------
 1027|       |
 1028|       |            /* check for end-of-block code (better have one) */
 1029|  7.06k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (1029:17): [True: 306, False: 6.75k]
  ------------------
 1030|    306|                strm->msg = (char *)"invalid code -- missing end-of-block";
 1031|    306|                state->mode = BAD;
 1032|    306|                break;
 1033|    306|            }
 1034|       |
 1035|       |            /* build code tables -- note: do not change the lenbits or distbits
 1036|       |               values here (9 and 6) without reading the comments in inftrees.h
 1037|       |               concerning the ENOUGH constants, which depend on those values */
 1038|  6.75k|            state->next = state->codes;
 1039|  6.75k|            state->lencode = (const code FAR *)(state->next);
 1040|  6.75k|            state->lenbits = 9;
 1041|  6.75k|            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
 1042|  6.75k|                                &(state->lenbits), state->work);
 1043|  6.75k|            if (ret) {
  ------------------
  |  Branch (1043:17): [True: 832, False: 5.92k]
  ------------------
 1044|    832|                strm->msg = (char *)"invalid literal/lengths set";
 1045|    832|                state->mode = BAD;
 1046|    832|                break;
 1047|    832|            }
 1048|  5.92k|            state->distcode = (const code FAR *)(state->next);
 1049|  5.92k|            state->distbits = 6;
 1050|  5.92k|            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
 1051|  5.92k|                            &(state->next), &(state->distbits), state->work);
 1052|  5.92k|            if (ret) {
  ------------------
  |  Branch (1052:17): [True: 1.25k, False: 4.67k]
  ------------------
 1053|  1.25k|                strm->msg = (char *)"invalid distances set";
 1054|  1.25k|                state->mode = BAD;
 1055|  1.25k|                break;
 1056|  1.25k|            }
 1057|  4.67k|            Tracev((stderr, "inflate:       codes ok\n"));
 1058|  4.67k|            state->mode = LEN_;
 1059|  4.67k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  174|  4.67k|#define Z_TREES         6
  ------------------
  |  Branch (1059:17): [True: 0, False: 4.67k]
  ------------------
 1060|       |                /* fallthrough */
 1061|  22.0k|        case LEN_:
  ------------------
  |  Branch (1061:9): [True: 17.3k, False: 418k]
  ------------------
 1062|  22.0k|            state->mode = LEN;
 1063|       |                /* fallthrough */
 1064|   180k|        case LEN:
  ------------------
  |  Branch (1064:9): [True: 158k, False: 278k]
  ------------------
 1065|   180k|            if (have >= 6 && left >= 258) {
  ------------------
  |  Branch (1065:17): [True: 148k, False: 32.3k]
  |  Branch (1065:30): [True: 26.2k, False: 121k]
  ------------------
 1066|  26.2k|                RESTORE();
  ------------------
  |  |  491|  26.2k|    do { \
  |  |  492|  26.2k|        strm->next_out = put; \
  |  |  493|  26.2k|        strm->avail_out = left; \
  |  |  494|  26.2k|        strm->next_in = next; \
  |  |  495|  26.2k|        strm->avail_in = have; \
  |  |  496|  26.2k|        state->hold = hold; \
  |  |  497|  26.2k|        state->bits = bits; \
  |  |  498|  26.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (498:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1067|  26.2k|                inflate_fast(strm, out);
 1068|  26.2k|                LOAD();
  ------------------
  |  |  480|  26.2k|    do { \
  |  |  481|  26.2k|        put = strm->next_out; \
  |  |  482|  26.2k|        left = strm->avail_out; \
  |  |  483|  26.2k|        next = strm->next_in; \
  |  |  484|  26.2k|        have = strm->avail_in; \
  |  |  485|  26.2k|        hold = state->hold; \
  |  |  486|  26.2k|        bits = state->bits; \
  |  |  487|  26.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (487:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1069|  26.2k|                if (state->mode == TYPE)
  ------------------
  |  Branch (1069:21): [True: 7.70k, False: 18.5k]
  ------------------
 1070|  7.70k|                    state->back = -1;
 1071|  26.2k|                break;
 1072|  26.2k|            }
 1073|   154k|            state->back = 0;
 1074|   285k|            for (;;) {
 1075|   285k|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  527|   285k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1076|   285k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (1076:21): [True: 150k, False: 135k]
  ------------------
 1077|   135k|                PULLBYTE();
  ------------------
  |  |  510|   135k|    do { \
  |  |  511|   135k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (511:13): [True: 3.66k, False: 131k]
  |  |  ------------------
  |  |  512|   135k|        have--; \
  |  |  513|   131k|        hold += (unsigned long)(*next++) << bits; \
  |  |  514|   131k|        bits += 8; \
  |  |  515|   131k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1078|   135k|            }
 1079|   150k|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (1079:17): [True: 67.6k, False: 82.9k]
  |  Branch (1079:28): [True: 831, False: 66.7k]
  ------------------
 1080|    831|                last = here;
 1081|  1.13k|                for (;;) {
 1082|  1.13k|                    here = state->lencode[last.val +
 1083|  1.13k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  527|  1.13k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1084|  1.13k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (1084:25): [True: 738, False: 400]
  ------------------
 1085|    400|                    PULLBYTE();
  ------------------
  |  |  510|    400|    do { \
  |  |  511|    400|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (511:13): [True: 93, False: 307]
  |  |  ------------------
  |  |  512|    400|        have--; \
  |  |  513|    307|        hold += (unsigned long)(*next++) << bits; \
  |  |  514|    307|        bits += 8; \
  |  |  515|    307|    } while (0)
  |  |  ------------------
  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1086|    400|                }
 1087|    738|                DROPBITS(last.bits);
  ------------------
  |  |  531|    738|    do { \
  |  |  532|    738|        hold >>= (n); \
  |  |  533|    738|        bits -= (unsigned)(n); \
  |  |  534|    738|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1088|    738|                state->back += last.bits;
 1089|    738|            }
 1090|   150k|            DROPBITS(here.bits);
  ------------------
  |  |  531|   150k|    do { \
  |  |  532|   150k|        hold >>= (n); \
  |  |  533|   150k|        bits -= (unsigned)(n); \
  |  |  534|   150k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1091|   150k|            state->back += here.bits;
 1092|   150k|            state->length = (unsigned)here.val;
 1093|   150k|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (1093:17): [True: 83.2k, False: 67.1k]
  ------------------
 1094|  83.2k|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
 1095|  83.2k|                        "inflate:         literal '%c'\n" :
 1096|  83.2k|                        "inflate:         literal 0x%02x\n", here.val));
 1097|  83.2k|                state->mode = LIT;
 1098|  83.2k|                break;
 1099|  83.2k|            }
 1100|  67.1k|            if (here.op & 32) {
  ------------------
  |  Branch (1100:17): [True: 3.95k, False: 63.1k]
  ------------------
 1101|  3.95k|                Tracevv((stderr, "inflate:         end of block\n"));
 1102|  3.95k|                state->back = -1;
 1103|  3.95k|                state->mode = TYPE;
 1104|  3.95k|                break;
 1105|  3.95k|            }
 1106|  63.1k|            if (here.op & 64) {
  ------------------
  |  Branch (1106:17): [True: 198, False: 62.9k]
  ------------------
 1107|    198|                strm->msg = (char *)"invalid literal/length code";
 1108|    198|                state->mode = BAD;
 1109|    198|                break;
 1110|    198|            }
 1111|  62.9k|            state->extra = (unsigned)(here.op) & 15;
 1112|  62.9k|            state->mode = LENEXT;
 1113|       |                /* fallthrough */
 1114|  63.7k|        case LENEXT:
  ------------------
  |  Branch (1114:9): [True: 751, False: 435k]
  ------------------
 1115|  63.7k|            if (state->extra) {
  ------------------
  |  Branch (1115:17): [True: 15.0k, False: 48.7k]
  ------------------
 1116|  15.0k|                NEEDBITS(state->extra);
  ------------------
  |  |  520|  15.0k|    do { \
  |  |  521|  19.4k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 5.99k, False: 13.5k]
  |  |  ------------------
  |  |  522|  15.0k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|  5.99k|    do { \
  |  |  |  |  511|  5.99k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 1.50k, False: 4.48k]
  |  |  |  |  ------------------
  |  |  |  |  512|  5.99k|        have--; \
  |  |  |  |  513|  4.48k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|  4.48k|        bits += 8; \
  |  |  |  |  515|  4.48k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  15.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1117|  13.5k|                state->length += BITS(state->extra);
  ------------------
  |  |  527|  13.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1118|  13.5k|                DROPBITS(state->extra);
  ------------------
  |  |  531|  13.5k|    do { \
  |  |  532|  13.5k|        hold >>= (n); \
  |  |  533|  13.5k|        bits -= (unsigned)(n); \
  |  |  534|  13.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1119|  13.5k|                state->back += state->extra;
 1120|  13.5k|            }
 1121|  62.2k|            Tracevv((stderr, "inflate:         length %u\n", state->length));
 1122|  62.2k|            state->was = state->length;
 1123|  62.2k|            state->mode = DIST;
 1124|       |                /* fallthrough */
 1125|  63.1k|        case DIST:
  ------------------
  |  Branch (1125:9): [True: 957, False: 435k]
  ------------------
 1126|   101k|            for (;;) {
 1127|   101k|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  527|   101k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1128|   101k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (1128:21): [True: 61.6k, False: 39.7k]
  ------------------
 1129|  39.7k|                PULLBYTE();
  ------------------
  |  |  510|  39.7k|    do { \
  |  |  511|  39.7k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (511:13): [True: 1.53k, False: 38.1k]
  |  |  ------------------
  |  |  512|  39.7k|        have--; \
  |  |  513|  38.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  514|  38.1k|        bits += 8; \
  |  |  515|  38.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1130|  39.7k|            }
 1131|  61.6k|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (1131:17): [True: 42.0k, False: 19.6k]
  ------------------
 1132|  42.0k|                last = here;
 1133|  52.5k|                for (;;) {
 1134|  52.5k|                    here = state->distcode[last.val +
 1135|  52.5k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  527|  52.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1136|  52.5k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (1136:25): [True: 41.6k, False: 10.9k]
  ------------------
 1137|  10.9k|                    PULLBYTE();
  ------------------
  |  |  510|  10.9k|    do { \
  |  |  511|  10.9k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (511:13): [True: 382, False: 10.5k]
  |  |  ------------------
  |  |  512|  10.9k|        have--; \
  |  |  513|  10.5k|        hold += (unsigned long)(*next++) << bits; \
  |  |  514|  10.5k|        bits += 8; \
  |  |  515|  10.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1138|  10.9k|                }
 1139|  41.6k|                DROPBITS(last.bits);
  ------------------
  |  |  531|  41.6k|    do { \
  |  |  532|  41.6k|        hold >>= (n); \
  |  |  533|  41.6k|        bits -= (unsigned)(n); \
  |  |  534|  41.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1140|  41.6k|                state->back += last.bits;
 1141|  41.6k|            }
 1142|  61.2k|            DROPBITS(here.bits);
  ------------------
  |  |  531|  61.2k|    do { \
  |  |  532|  61.2k|        hold >>= (n); \
  |  |  533|  61.2k|        bits -= (unsigned)(n); \
  |  |  534|  61.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1143|  61.2k|            state->back += here.bits;
 1144|  61.2k|            if (here.op & 64) {
  ------------------
  |  Branch (1144:17): [True: 307, False: 60.9k]
  ------------------
 1145|    307|                strm->msg = (char *)"invalid distance code";
 1146|    307|                state->mode = BAD;
 1147|    307|                break;
 1148|    307|            }
 1149|  60.9k|            state->offset = (unsigned)here.val;
 1150|  60.9k|            state->extra = (unsigned)(here.op) & 15;
 1151|  60.9k|            state->mode = DISTEXT;
 1152|       |                /* fallthrough */
 1153|  61.4k|        case DISTEXT:
  ------------------
  |  Branch (1153:9): [True: 476, False: 435k]
  ------------------
 1154|  61.4k|            if (state->extra) {
  ------------------
  |  Branch (1154:17): [True: 46.2k, False: 15.2k]
  ------------------
 1155|  46.2k|                NEEDBITS(state->extra);
  ------------------
  |  |  520|  46.2k|    do { \
  |  |  521|  64.4k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 19.1k, False: 45.2k]
  |  |  ------------------
  |  |  522|  46.2k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|  19.1k|    do { \
  |  |  |  |  511|  19.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 957, False: 18.2k]
  |  |  |  |  ------------------
  |  |  |  |  512|  19.1k|        have--; \
  |  |  |  |  513|  18.2k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|  18.2k|        bits += 8; \
  |  |  |  |  515|  18.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  46.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1156|  45.2k|                state->offset += BITS(state->extra);
  ------------------
  |  |  527|  45.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1157|  45.2k|                DROPBITS(state->extra);
  ------------------
  |  |  531|  45.2k|    do { \
  |  |  532|  45.2k|        hold >>= (n); \
  |  |  533|  45.2k|        bits -= (unsigned)(n); \
  |  |  534|  45.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (534:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1158|  45.2k|                state->back += state->extra;
 1159|  45.2k|            }
 1160|       |#ifdef INFLATE_STRICT
 1161|       |            if (state->offset > state->dmax) {
 1162|       |                strm->msg = (char *)"invalid distance too far back";
 1163|       |                state->mode = BAD;
 1164|       |                break;
 1165|       |            }
 1166|       |#endif
 1167|  60.4k|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1168|  60.4k|            state->mode = MATCH;
 1169|       |                /* fallthrough */
 1170|  62.6k|        case MATCH:
  ------------------
  |  Branch (1170:9): [True: 2.21k, False: 434k]
  ------------------
 1171|  62.6k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1171:17): [True: 2.49k, False: 60.1k]
  ------------------
 1172|  60.1k|            copy = out - left;
 1173|  60.1k|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1173:17): [True: 678, False: 59.5k]
  ------------------
 1174|    678|                copy = state->offset - copy;
 1175|    678|                if (copy > state->whave) {
  ------------------
  |  Branch (1175:21): [True: 678, False: 0]
  ------------------
 1176|    678|                    if (state->sane) {
  ------------------
  |  Branch (1176:25): [True: 678, False: 0]
  ------------------
 1177|    678|                        strm->msg = (char *)"invalid distance too far back";
 1178|    678|                        state->mode = BAD;
 1179|    678|                        break;
 1180|    678|                    }
 1181|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 1182|       |                    Trace((stderr, "inflate.c too far\n"));
 1183|       |                    copy -= state->whave;
 1184|       |                    if (copy > state->length) copy = state->length;
 1185|       |                    if (copy > left) copy = left;
 1186|       |                    left -= copy;
 1187|       |                    state->length -= copy;
 1188|       |                    do {
 1189|       |                        *put++ = 0;
 1190|       |                    } while (--copy);
 1191|       |                    if (state->length == 0) state->mode = LEN;
 1192|       |                    break;
 1193|       |#endif
 1194|    678|                }
 1195|      0|                if (copy > state->wnext) {
  ------------------
  |  Branch (1195:21): [True: 0, False: 0]
  ------------------
 1196|      0|                    copy -= state->wnext;
 1197|      0|                    from = state->window + (state->wsize - copy);
 1198|      0|                }
 1199|      0|                else
 1200|      0|                    from = state->window + (state->wnext - copy);
 1201|      0|                if (copy > state->length) copy = state->length;
  ------------------
  |  Branch (1201:21): [True: 0, False: 0]
  ------------------
 1202|      0|            }
 1203|  59.5k|            else {                              /* copy from output */
 1204|  59.5k|                from = put - state->offset;
 1205|  59.5k|                copy = state->length;
 1206|  59.5k|            }
 1207|  59.5k|            if (copy > left) copy = left;
  ------------------
  |  Branch (1207:17): [True: 2.21k, False: 57.3k]
  ------------------
 1208|  59.5k|            left -= copy;
 1209|  59.5k|            state->length -= copy;
 1210|  2.08M|            do {
 1211|  2.08M|                *put++ = *from++;
 1212|  2.08M|            } while (--copy);
  ------------------
  |  Branch (1212:22): [True: 2.02M, False: 59.5k]
  ------------------
 1213|  59.5k|            if (state->length == 0) state->mode = LEN;
  ------------------
  |  Branch (1213:17): [True: 57.3k, False: 2.21k]
  ------------------
 1214|  59.5k|            break;
 1215|  83.2k|        case LIT:
  ------------------
  |  Branch (1215:9): [True: 83.2k, False: 353k]
  ------------------
 1216|  83.2k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1216:17): [True: 706, False: 82.5k]
  ------------------
 1217|  82.5k|            *put++ = (unsigned char)(state->length);
 1218|  82.5k|            left--;
 1219|  82.5k|            state->mode = LEN;
 1220|  82.5k|            break;
 1221|  3.06k|        case CHECK:
  ------------------
  |  Branch (1221:9): [True: 3.06k, False: 433k]
  ------------------
 1222|  3.06k|            if (state->wrap) {
  ------------------
  |  Branch (1222:17): [True: 3.06k, False: 0]
  ------------------
 1223|  3.06k|                NEEDBITS(32);
  ------------------
  |  |  520|  3.06k|    do { \
  |  |  521|  11.6k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 9.74k, False: 1.87k]
  |  |  ------------------
  |  |  522|  9.74k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|  9.74k|    do { \
  |  |  |  |  511|  9.74k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 1.19k, False: 8.54k]
  |  |  |  |  ------------------
  |  |  |  |  512|  9.74k|        have--; \
  |  |  |  |  513|  8.54k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|  8.54k|        bits += 8; \
  |  |  |  |  515|  8.54k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  3.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1224|  1.87k|                out -= left;
 1225|  1.87k|                strm->total_out += out;
 1226|  1.87k|                state->total += out;
 1227|  1.87k|                if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1227:21): [True: 1.87k, False: 0]
  |  Branch (1227:42): [True: 891, False: 979]
  ------------------
 1228|    891|                    strm->adler = state->check =
 1229|    891|                        UPDATE_CHECK(state->check, put - out, out);
  ------------------
  |  |  454|    891|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (454:6): [True: 0, False: 891]
  |  |  ------------------
  ------------------
 1230|  1.87k|                out = left;
 1231|  1.87k|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1231:21): [True: 1.87k, False: 0]
  |  Branch (1231:42): [True: 1.43k, False: 439]
  ------------------
 1232|  1.87k|#ifdef GUNZIP
 1233|  1.87k|                     state->flags ? hold :
  ------------------
  |  Branch (1233:22): [True: 0, False: 1.87k]
  ------------------
 1234|  1.87k|#endif
 1235|  1.87k|                     ZSWAP32(hold)) != state->check) {
  ------------------
  |  |  272|  1.87k|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  273|  1.87k|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
 1236|  1.43k|                    strm->msg = (char *)"incorrect data check";
 1237|  1.43k|                    state->mode = BAD;
 1238|  1.43k|                    break;
 1239|  1.43k|                }
 1240|    439|                INITBITS();
  ------------------
  |  |  502|    439|    do { \
  |  |  503|    439|        hold = 0; \
  |  |  504|    439|        bits = 0; \
  |  |  505|    439|    } while (0)
  |  |  ------------------
  |  |  |  Branch (505:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1241|    439|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1242|    439|            }
 1243|    439|#ifdef GUNZIP
 1244|    439|            state->mode = LENGTH;
 1245|       |                /* fallthrough */
 1246|    439|        case LENGTH:
  ------------------
  |  Branch (1246:9): [True: 0, False: 436k]
  ------------------
 1247|    439|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1247:17): [True: 439, False: 0]
  |  Branch (1247:32): [True: 0, False: 439]
  ------------------
 1248|      0|                NEEDBITS(32);
  ------------------
  |  |  520|      0|    do { \
  |  |  521|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (521:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  522|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  510|      0|    do { \
  |  |  |  |  511|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (511:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  512|      0|        have--; \
  |  |  |  |  513|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  514|      0|        bits += 8; \
  |  |  |  |  515|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (523:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1249|      0|                if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
  ------------------
  |  Branch (1249:21): [True: 0, False: 0]
  |  Branch (1249:42): [True: 0, False: 0]
  ------------------
 1250|      0|                    strm->msg = (char *)"incorrect length check";
 1251|      0|                    state->mode = BAD;
 1252|      0|                    break;
 1253|      0|                }
 1254|      0|                INITBITS();
  ------------------
  |  |  502|      0|    do { \
  |  |  503|      0|        hold = 0; \
  |  |  504|      0|        bits = 0; \
  |  |  505|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (505:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1255|      0|                Tracev((stderr, "inflate:   length matches trailer\n"));
 1256|      0|            }
 1257|    439|#endif
 1258|    439|            state->mode = DONE;
 1259|       |                /* fallthrough */
 1260|    439|        case DONE:
  ------------------
  |  Branch (1260:9): [True: 0, False: 436k]
  ------------------
 1261|    439|            ret = Z_STREAM_END;
  ------------------
  |  |  178|    439|#define Z_STREAM_END    1
  ------------------
 1262|    439|            goto inf_leave;
 1263|  43.0k|        case BAD:
  ------------------
  |  Branch (1263:9): [True: 43.0k, False: 393k]
  ------------------
 1264|  43.0k|            ret = Z_DATA_ERROR;
  ------------------
  |  |  182|  43.0k|#define Z_DATA_ERROR   (-3)
  ------------------
 1265|  43.0k|            goto inf_leave;
 1266|      0|        case MEM:
  ------------------
  |  Branch (1266:9): [True: 0, False: 436k]
  ------------------
 1267|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  183|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1268|      0|        case SYNC:
  ------------------
  |  Branch (1268:9): [True: 0, False: 436k]
  ------------------
 1269|       |                /* fallthrough */
 1270|      0|        default:
  ------------------
  |  Branch (1270:9): [True: 0, False: 436k]
  ------------------
 1271|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1272|   436k|        }
 1273|       |
 1274|       |    /*
 1275|       |       Return from inflate(), updating the total counts and the check value.
 1276|       |       If there was no progress during the inflate() call, return a buffer
 1277|       |       error.  Call updatewindow() to create and/or update the window state.
 1278|       |       Note: a memory error from inflate() is non-recoverable.
 1279|       |     */
 1280|  79.4k|  inf_leave:
 1281|  79.4k|    RESTORE();
  ------------------
  |  |  491|  79.4k|    do { \
  |  |  492|  79.4k|        strm->next_out = put; \
  |  |  493|  79.4k|        strm->avail_out = left; \
  |  |  494|  79.4k|        strm->next_in = next; \
  |  |  495|  79.4k|        strm->avail_in = have; \
  |  |  496|  79.4k|        state->hold = hold; \
  |  |  497|  79.4k|        state->bits = bits; \
  |  |  498|  79.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (498:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1282|  79.4k|    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1282:9): [True: 7.18k, False: 72.2k]
  |  Branch (1282:26): [True: 18.6k, False: 53.5k]
  |  Branch (1282:52): [True: 10.8k, False: 7.83k]
  ------------------
 1283|  72.2k|            (state->mode < CHECK || flush != Z_FINISH)))
  ------------------
  |  |  172|    556|#define Z_FINISH        4
  ------------------
  |  Branch (1283:14): [True: 10.2k, False: 556]
  |  Branch (1283:37): [True: 556, False: 0]
  ------------------
 1284|  18.0k|        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
  ------------------
  |  Branch (1284:13): [True: 0, False: 18.0k]
  ------------------
 1285|      0|            state->mode = MEM;
 1286|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  183|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1287|      0|        }
 1288|  79.4k|    in -= strm->avail_in;
 1289|  79.4k|    out -= strm->avail_out;
 1290|  79.4k|    strm->total_in += in;
 1291|  79.4k|    strm->total_out += out;
 1292|  79.4k|    state->total += out;
 1293|  79.4k|    if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1293:9): [True: 79.4k, False: 0]
  |  Branch (1293:30): [True: 18.6k, False: 60.7k]
  ------------------
 1294|  18.6k|        strm->adler = state->check =
 1295|  18.6k|            UPDATE_CHECK(state->check, strm->next_out - out, out);
  ------------------
  |  |  454|  18.6k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (454:6): [True: 0, False: 18.6k]
  |  |  ------------------
  ------------------
 1296|  79.4k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1296:43): [True: 12.7k, False: 66.6k]
  ------------------
 1297|  79.4k|                      (state->mode == TYPE ? 128 : 0) +
  ------------------
  |  Branch (1297:24): [True: 479, False: 78.9k]
  ------------------
 1298|  79.4k|                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1298:24): [True: 0, False: 79.4k]
  |  Branch (1298:47): [True: 0, False: 79.4k]
  ------------------
 1299|  79.4k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  172|  63.2k|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  177|  16.1k|#define Z_OK            0
  ------------------
  |  Branch (1299:11): [True: 16.1k, False: 63.2k]
  |  Branch (1299:22): [True: 16.1k, False: 0]
  |  Branch (1299:35): [True: 0, False: 63.2k]
  |  Branch (1299:57): [True: 16.1k, False: 0]
  ------------------
 1300|  16.1k|        ret = Z_BUF_ERROR;
  ------------------
  |  |  184|  16.1k|#define Z_BUF_ERROR    (-5)
  ------------------
 1301|  79.4k|    return ret;
 1302|  79.4k|}
inflateEnd:
 1306|  1.39k|{
 1307|  1.39k|    struct inflate_state FAR *state;
 1308|  1.39k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1308:9): [True: 0, False: 1.39k]
  ------------------
 1309|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  181|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1310|  1.39k|    state = (struct inflate_state FAR *)strm->state;
 1311|  1.39k|    if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  212|  1.39k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  268|    639|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  |  Branch (1311:9): [True: 639, False: 751]
  ------------------
 1312|  1.39k|    ZFREE(strm, strm->state);
  ------------------
  |  |  268|  1.39k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1313|  1.39k|    strm->state = Z_NULL;
  ------------------
  |  |  212|  1.39k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1314|  1.39k|    Tracev((stderr, "inflate: end\n"));
 1315|  1.39k|    return Z_OK;
  ------------------
  |  |  177|  1.39k|#define Z_OK            0
  ------------------
 1316|  1.39k|}
inflate.c:inflateStateCheck:
  107|   214k|{
  108|   214k|    struct inflate_state FAR *state;
  109|   214k|    if (strm == Z_NULL ||
  ------------------
  |  |  212|   429k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (109:9): [True: 0, False: 214k]
  ------------------
  110|   214k|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (110:9): [True: 0, False: 214k]
  |  Branch (110:42): [True: 0, False: 214k]
  ------------------
  111|      0|        return 1;
  112|   214k|    state = (struct inflate_state FAR *)strm->state;
  113|   214k|    if (state == Z_NULL || state->strm != strm ||
  ------------------
  |  |  212|   429k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (113:9): [True: 0, False: 214k]
  |  Branch (113:28): [True: 0, False: 214k]
  ------------------
  114|   214k|        state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (114:9): [True: 0, False: 214k]
  |  Branch (114:31): [True: 0, False: 214k]
  ------------------
  115|      0|        return 1;
  116|   214k|    return 0;
  117|   214k|}
inflate.c:fixedtables:
  283|  17.3k|{
  284|       |#ifdef BUILDFIXED
  285|       |    static int virgin = 1;
  286|       |    static code *lenfix, *distfix;
  287|       |    static code fixed[544];
  288|       |
  289|       |    /* build fixed huffman tables if first call (may not be thread safe) */
  290|       |    if (virgin) {
  291|       |        unsigned sym, bits;
  292|       |        static code *next;
  293|       |
  294|       |        /* literal/length table */
  295|       |        sym = 0;
  296|       |        while (sym < 144) state->lens[sym++] = 8;
  297|       |        while (sym < 256) state->lens[sym++] = 9;
  298|       |        while (sym < 280) state->lens[sym++] = 7;
  299|       |        while (sym < 288) state->lens[sym++] = 8;
  300|       |        next = fixed;
  301|       |        lenfix = next;
  302|       |        bits = 9;
  303|       |        inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
  304|       |
  305|       |        /* distance table */
  306|       |        sym = 0;
  307|       |        while (sym < 32) state->lens[sym++] = 5;
  308|       |        distfix = next;
  309|       |        bits = 5;
  310|       |        inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
  311|       |
  312|       |        /* do this just once */
  313|       |        virgin = 0;
  314|       |    }
  315|       |#else /* !BUILDFIXED */
  316|  17.3k|#   include "inffixed.h"
  ------------------
  |  |    1|       |    /* inffixed.h -- table for decoding fixed codes
  |  |    2|       |     * Generated automatically by makefixed().
  |  |    3|       |     */
  |  |    4|       |
  |  |    5|       |    /* WARNING: this file should *not* be used by applications.
  |  |    6|       |       It is part of the implementation of this library and is
  |  |    7|       |       subject to change. Applications should only use zlib.h.
  |  |    8|       |     */
  |  |    9|       |
  |  |   10|  17.3k|    static const code lenfix[512] = {
  |  |   11|  17.3k|        {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
  |  |   12|  17.3k|        {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
  |  |   13|  17.3k|        {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
  |  |   14|  17.3k|        {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
  |  |   15|  17.3k|        {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
  |  |   16|  17.3k|        {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
  |  |   17|  17.3k|        {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
  |  |   18|  17.3k|        {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
  |  |   19|  17.3k|        {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
  |  |   20|  17.3k|        {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
  |  |   21|  17.3k|        {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
  |  |   22|  17.3k|        {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
  |  |   23|  17.3k|        {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
  |  |   24|  17.3k|        {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
  |  |   25|  17.3k|        {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
  |  |   26|  17.3k|        {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
  |  |   27|  17.3k|        {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
  |  |   28|  17.3k|        {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
  |  |   29|  17.3k|        {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
  |  |   30|  17.3k|        {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
  |  |   31|  17.3k|        {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
  |  |   32|  17.3k|        {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
  |  |   33|  17.3k|        {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
  |  |   34|  17.3k|        {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
  |  |   35|  17.3k|        {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
  |  |   36|  17.3k|        {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
  |  |   37|  17.3k|        {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
  |  |   38|  17.3k|        {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
  |  |   39|  17.3k|        {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
  |  |   40|  17.3k|        {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
  |  |   41|  17.3k|        {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
  |  |   42|  17.3k|        {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
  |  |   43|  17.3k|        {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
  |  |   44|  17.3k|        {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
  |  |   45|  17.3k|        {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
  |  |   46|  17.3k|        {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
  |  |   47|  17.3k|        {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
  |  |   48|  17.3k|        {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
  |  |   49|  17.3k|        {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
  |  |   50|  17.3k|        {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
  |  |   51|  17.3k|        {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
  |  |   52|  17.3k|        {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
  |  |   53|  17.3k|        {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
  |  |   54|  17.3k|        {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
  |  |   55|  17.3k|        {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
  |  |   56|  17.3k|        {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
  |  |   57|  17.3k|        {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
  |  |   58|  17.3k|        {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
  |  |   59|  17.3k|        {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
  |  |   60|  17.3k|        {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
  |  |   61|  17.3k|        {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
  |  |   62|  17.3k|        {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
  |  |   63|  17.3k|        {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
  |  |   64|  17.3k|        {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
  |  |   65|  17.3k|        {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
  |  |   66|  17.3k|        {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
  |  |   67|  17.3k|        {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
  |  |   68|  17.3k|        {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
  |  |   69|  17.3k|        {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
  |  |   70|  17.3k|        {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
  |  |   71|  17.3k|        {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
  |  |   72|  17.3k|        {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
  |  |   73|  17.3k|        {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
  |  |   74|  17.3k|        {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
  |  |   75|  17.3k|        {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
  |  |   76|  17.3k|        {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
  |  |   77|  17.3k|        {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
  |  |   78|  17.3k|        {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
  |  |   79|  17.3k|        {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
  |  |   80|  17.3k|        {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
  |  |   81|  17.3k|        {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
  |  |   82|  17.3k|        {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
  |  |   83|  17.3k|        {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
  |  |   84|  17.3k|        {0,9,255}
  |  |   85|  17.3k|    };
  |  |   86|       |
  |  |   87|  17.3k|    static const code distfix[32] = {
  |  |   88|  17.3k|        {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
  |  |   89|  17.3k|        {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
  |  |   90|  17.3k|        {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
  |  |   91|  17.3k|        {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
  |  |   92|  17.3k|        {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
  |  |   93|  17.3k|        {22,5,193},{64,5,0}
  |  |   94|  17.3k|    };
  ------------------
  317|  17.3k|#endif /* BUILDFIXED */
  318|  17.3k|    state->lencode = lenfix;
  319|  17.3k|    state->lenbits = 9;
  320|  17.3k|    state->distcode = distfix;
  321|  17.3k|    state->distbits = 5;
  322|  17.3k|}
inflate.c:updatewindow:
  403|  18.0k|{
  404|  18.0k|    struct inflate_state FAR *state;
  405|  18.0k|    unsigned dist;
  406|       |
  407|  18.0k|    state = (struct inflate_state FAR *)strm->state;
  408|       |
  409|       |    /* if it hasn't been done already, allocate space for the window */
  410|  18.0k|    if (state->window == Z_NULL) {
  ------------------
  |  |  212|  18.0k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (410:9): [True: 639, False: 17.3k]
  ------------------
  411|    639|        state->window = (unsigned char FAR *)
  412|    639|                        ZALLOC(strm, 1U << state->wbits,
  ------------------
  |  |  267|    639|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  413|    639|                               sizeof(unsigned char));
  414|    639|        if (state->window == Z_NULL) return 1;
  ------------------
  |  |  212|    639|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (414:13): [True: 0, False: 639]
  ------------------
  415|    639|    }
  416|       |
  417|       |    /* if window not in use yet, initialize */
  418|  18.0k|    if (state->wsize == 0) {
  ------------------
  |  Branch (418:9): [True: 10.8k, False: 7.18k]
  ------------------
  419|  10.8k|        state->wsize = 1U << state->wbits;
  420|  10.8k|        state->wnext = 0;
  421|  10.8k|        state->whave = 0;
  422|  10.8k|    }
  423|       |
  424|       |    /* copy state->wsize or less output bytes into the circular window */
  425|  18.0k|    if (copy >= state->wsize) {
  ------------------
  |  Branch (425:9): [True: 599, False: 17.4k]
  ------------------
  426|    599|        zmemcpy(state->window, end - state->wsize, state->wsize);
  ------------------
  |  |  230|    599|#    define zmemcpy memcpy
  ------------------
  427|    599|        state->wnext = 0;
  428|    599|        state->whave = state->wsize;
  429|    599|    }
  430|  17.4k|    else {
  431|  17.4k|        dist = state->wsize - state->wnext;
  432|  17.4k|        if (dist > copy) dist = copy;
  ------------------
  |  Branch (432:13): [True: 17.4k, False: 0]
  ------------------
  433|  17.4k|        zmemcpy(state->window + state->wnext, end - copy, dist);
  ------------------
  |  |  230|  17.4k|#    define zmemcpy memcpy
  ------------------
  434|  17.4k|        copy -= dist;
  435|  17.4k|        if (copy) {
  ------------------
  |  Branch (435:13): [True: 0, False: 17.4k]
  ------------------
  436|      0|            zmemcpy(state->window, end - copy, copy);
  ------------------
  |  |  230|      0|#    define zmemcpy memcpy
  ------------------
  437|      0|            state->wnext = copy;
  438|      0|            state->whave = state->wsize;
  439|      0|        }
  440|  17.4k|        else {
  441|  17.4k|            state->wnext += dist;
  442|  17.4k|            if (state->wnext == state->wsize) state->wnext = 0;
  ------------------
  |  Branch (442:17): [True: 0, False: 17.4k]
  ------------------
  443|  17.4k|            if (state->whave < state->wsize) state->whave += dist;
  ------------------
  |  Branch (443:17): [True: 16.8k, False: 597]
  ------------------
  444|  17.4k|        }
  445|  17.4k|    }
  446|  18.0k|    return 0;
  447|  18.0k|}

inflate_table:
   39|  23.0k|{
   40|  23.0k|    unsigned len;               /* a code's length in bits */
   41|  23.0k|    unsigned sym;               /* index of code symbols */
   42|  23.0k|    unsigned min, max;          /* minimum and maximum code lengths */
   43|  23.0k|    unsigned root;              /* number of index bits for root table */
   44|  23.0k|    unsigned curr;              /* number of index bits for current table */
   45|  23.0k|    unsigned drop;              /* code bits to drop for sub-table */
   46|  23.0k|    int left;                   /* number of prefix codes available */
   47|  23.0k|    unsigned used;              /* code entries in table used */
   48|  23.0k|    unsigned huff;              /* Huffman code */
   49|  23.0k|    unsigned incr;              /* for incrementing code, index */
   50|  23.0k|    unsigned fill;              /* index for replicating entries */
   51|  23.0k|    unsigned low;               /* low bits for current root entry */
   52|  23.0k|    unsigned mask;              /* mask for low root bits */
   53|  23.0k|    code here;                  /* table entry for duplication */
   54|  23.0k|    code FAR *next;             /* next available space in table */
   55|  23.0k|    const unsigned short FAR *base;     /* base value table to use */
   56|  23.0k|    const unsigned short FAR *extra;    /* extra bits table to use */
   57|  23.0k|    unsigned match;             /* use base and extra for symbol >= match */
   58|  23.0k|    unsigned short count[MAXBITS+1];    /* number of codes of each length */
   59|  23.0k|    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
   60|  23.0k|    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
   61|  23.0k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   62|  23.0k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   63|  23.0k|    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
   64|  23.0k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   65|  23.0k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 194, 65};
   66|  23.0k|    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
   67|  23.0k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   68|  23.0k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   69|  23.0k|        8193, 12289, 16385, 24577, 0, 0};
   70|  23.0k|    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
   71|  23.0k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   72|  23.0k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   73|  23.0k|        28, 28, 29, 29, 64, 64};
   74|       |
   75|       |    /*
   76|       |       Process a set of code lengths to create a canonical Huffman code.  The
   77|       |       code lengths are lens[0..codes-1].  Each length corresponds to the
   78|       |       symbols 0..codes-1.  The Huffman code is generated by first sorting the
   79|       |       symbols by length from short to long, and retaining the symbol order
   80|       |       for codes with equal lengths.  Then the code starts with all zero bits
   81|       |       for the first code of the shortest length, and the codes are integer
   82|       |       increments for the same length, and zeros are appended as the length
   83|       |       increases.  For the deflate format, these bits are stored backwards
   84|       |       from their more natural integer increment ordering, and so when the
   85|       |       decoding tables are built in the large loop below, the integer codes
   86|       |       are incremented backwards.
   87|       |
   88|       |       This routine assumes, but does not check, that all of the entries in
   89|       |       lens[] are in the range 0..MAXBITS.  The caller must assure this.
   90|       |       1..MAXBITS is interpreted as that code length.  zero means that that
   91|       |       symbol does not occur in this code.
   92|       |
   93|       |       The codes are sorted by computing a count of codes for each length,
   94|       |       creating from that a table of starting indices for each length in the
   95|       |       sorted table, and then entering the symbols in order in the sorted
   96|       |       table.  The sorted table is work[], with that space being provided by
   97|       |       the caller.
   98|       |
   99|       |       The length counts are used for other purposes as well, i.e. finding
  100|       |       the minimum and maximum length codes, determining if there are any
  101|       |       codes at all, checking for a valid set of lengths, and looking ahead
  102|       |       at length counts to determine sub-table sizes when building the
  103|       |       decoding tables.
  104|       |     */
  105|       |
  106|       |    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
  107|   392k|    for (len = 0; len <= MAXBITS; len++)
  ------------------
  |  |    9|   392k|#define MAXBITS 15
  ------------------
  |  Branch (107:19): [True: 369k, False: 23.0k]
  ------------------
  108|   369k|        count[len] = 0;
  109|  2.22M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (109:19): [True: 2.20M, False: 23.0k]
  ------------------
  110|  2.20M|        count[lens[sym]]++;
  111|       |
  112|       |    /* bound code lengths, force root to be within code lengths */
  113|  23.0k|    root = *bits;
  114|   222k|    for (max = MAXBITS; max >= 1; max--)
  ------------------
  |  |    9|  23.0k|#define MAXBITS 15
  ------------------
  |  Branch (114:25): [True: 221k, False: 864]
  ------------------
  115|   221k|        if (count[max] != 0) break;
  ------------------
  |  Branch (115:13): [True: 22.2k, False: 199k]
  ------------------
  116|  23.0k|    if (root > max) root = max;
  ------------------
  |  Branch (116:9): [True: 12.8k, False: 10.2k]
  ------------------
  117|  23.0k|    if (max == 0) {                     /* no symbols to code at all */
  ------------------
  |  Branch (117:9): [True: 864, False: 22.2k]
  ------------------
  118|    864|        here.op = (unsigned char)64;    /* invalid code marker */
  119|    864|        here.bits = (unsigned char)1;
  120|    864|        here.val = (unsigned short)0;
  121|    864|        *(*table)++ = here;             /* make a table to force an error */
  122|    864|        *(*table)++ = here;
  123|    864|        *bits = 1;
  124|    864|        return 0;     /* no symbols, but wait for decoding to report error */
  125|    864|    }
  126|  48.7k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (126:19): [True: 43.7k, False: 4.95k]
  ------------------
  127|  43.7k|        if (count[min] != 0) break;
  ------------------
  |  Branch (127:13): [True: 17.2k, False: 26.5k]
  ------------------
  128|  22.2k|    if (root < min) root = min;
  ------------------
  |  Branch (128:9): [True: 1.06k, False: 21.1k]
  ------------------
  129|       |
  130|       |    /* check for an over-subscribed or incomplete set of lengths */
  131|  22.2k|    left = 1;
  132|   345k|    for (len = 1; len <= MAXBITS; len++) {
  ------------------
  |  |    9|   345k|#define MAXBITS 15
  ------------------
  |  Branch (132:19): [True: 324k, False: 21.2k]
  ------------------
  133|   324k|        left <<= 1;
  134|   324k|        left -= count[len];
  135|   324k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (135:13): [True: 987, False: 323k]
  ------------------
  136|   324k|    }
  137|  21.2k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (137:9): [True: 2.49k, False: 18.7k]
  |  Branch (137:22): [True: 664, False: 1.83k]
  |  Branch (137:39): [True: 1.56k, False: 272]
  ------------------
  138|  2.22k|        return -1;                      /* incomplete set */
  139|       |
  140|       |    /* generate offsets into symbol table for each length for sorting */
  141|  18.9k|    offs[1] = 0;
  142|   284k|    for (len = 1; len < MAXBITS; len++)
  ------------------
  |  |    9|   284k|#define MAXBITS 15
  ------------------
  |  Branch (142:19): [True: 265k, False: 18.9k]
  ------------------
  143|   265k|        offs[len + 1] = offs[len] + count[len];
  144|       |
  145|       |    /* sort symbols by length, by symbol order within each length */
  146|  1.93M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (146:19): [True: 1.92M, False: 18.9k]
  ------------------
  147|  1.92M|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
  ------------------
  |  Branch (147:13): [True: 583k, False: 1.33M]
  ------------------
  148|       |
  149|       |    /*
  150|       |       Create and fill in decoding tables.  In this loop, the table being
  151|       |       filled is at next and has curr index bits.  The code being used is huff
  152|       |       with length len.  That code is converted to an index by dropping drop
  153|       |       bits off of the bottom.  For codes where len is less than drop + curr,
  154|       |       those top drop + curr - len bits are incremented through all values to
  155|       |       fill the table with replicated entries.
  156|       |
  157|       |       root is the number of index bits for the root table.  When len exceeds
  158|       |       root, sub-tables are created pointed to by the root entry with an index
  159|       |       of the low root bits of huff.  This is saved in low to check for when a
  160|       |       new sub-table should be started.  drop is zero when the root table is
  161|       |       being filled, and drop is root when sub-tables are being filled.
  162|       |
  163|       |       When a new sub-table is needed, it is necessary to look ahead in the
  164|       |       code lengths to determine what size sub-table is needed.  The length
  165|       |       counts are used for this, and so count[] is decremented as codes are
  166|       |       entered in the tables.
  167|       |
  168|       |       used keeps track of how many table entries have been allocated from the
  169|       |       provided *table space.  It is checked for LENS and DIST tables against
  170|       |       the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
  171|       |       the initial root table size constants.  See the comments in inftrees.h
  172|       |       for more information.
  173|       |
  174|       |       sym increments through all symbols, and the loop terminates when
  175|       |       all codes of length max, i.e. all codes, have been processed.  This
  176|       |       routine permits incomplete codes, so another loop after this one fills
  177|       |       in the rest of the decoding tables with invalid code markers.
  178|       |     */
  179|       |
  180|       |    /* set up for code type */
  181|  18.9k|    switch (type) {
  182|  8.79k|    case CODES:
  ------------------
  |  Branch (182:5): [True: 8.79k, False: 10.1k]
  ------------------
  183|  8.79k|        base = extra = work;    /* dummy value--not used */
  184|  8.79k|        match = 20;
  185|  8.79k|        break;
  186|  5.92k|    case LENS:
  ------------------
  |  Branch (186:5): [True: 5.92k, False: 13.0k]
  ------------------
  187|  5.92k|        base = lbase;
  188|  5.92k|        extra = lext;
  189|  5.92k|        match = 257;
  190|  5.92k|        break;
  191|  4.27k|    default:    /* DISTS */
  ------------------
  |  Branch (191:5): [True: 4.27k, False: 14.7k]
  ------------------
  192|  4.27k|        base = dbase;
  193|  4.27k|        extra = dext;
  194|  4.27k|        match = 0;
  195|  18.9k|    }
  196|       |
  197|       |    /* initialize state for loop */
  198|  18.9k|    huff = 0;                   /* starting code */
  199|  18.9k|    sym = 0;                    /* starting code symbol */
  200|  18.9k|    len = min;                  /* starting code length */
  201|  18.9k|    next = *table;              /* current table to fill in */
  202|  18.9k|    curr = root;                /* current table index bits */
  203|  18.9k|    drop = 0;                   /* current bits to drop from code for index */
  204|  18.9k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  205|  18.9k|    used = 1U << root;          /* use root table entries */
  206|  18.9k|    mask = used - 1;            /* mask for comparing low */
  207|       |
  208|       |    /* check available table space */
  209|  18.9k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   49|  5.92k|#define ENOUGH_LENS 852
  ------------------
  |  Branch (209:10): [True: 5.92k, False: 13.0k]
  |  Branch (209:26): [True: 0, False: 5.92k]
  ------------------
  210|  18.9k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   50|  4.27k|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (210:10): [True: 4.27k, False: 14.7k]
  |  Branch (210:27): [True: 0, False: 4.27k]
  ------------------
  211|      0|        return 1;
  212|       |
  213|       |    /* process all codes and make table entries */
  214|   583k|    for (;;) {
  215|       |        /* create table entry */
  216|   583k|        here.bits = (unsigned char)(len - drop);
  217|   583k|        if (work[sym] + 1U < match) {
  ------------------
  |  Branch (217:13): [True: 461k, False: 122k]
  ------------------
  218|   461k|            here.op = (unsigned char)0;
  219|   461k|            here.val = work[sym];
  220|   461k|        }
  221|   122k|        else if (work[sym] >= match) {
  ------------------
  |  Branch (221:18): [True: 116k, False: 5.92k]
  ------------------
  222|   116k|            here.op = (unsigned char)(extra[work[sym] - match]);
  223|   116k|            here.val = base[work[sym] - match];
  224|   116k|        }
  225|  5.92k|        else {
  226|  5.92k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  227|  5.92k|            here.val = 0;
  228|  5.92k|        }
  229|       |
  230|       |        /* replicate for those indices with low len bits equal to huff */
  231|   583k|        incr = 1U << (len - drop);
  232|   583k|        fill = 1U << curr;
  233|   583k|        min = fill;                 /* save offset to next table */
  234|  2.50M|        do {
  235|  2.50M|            fill -= incr;
  236|  2.50M|            next[(huff >> drop) + fill] = here;
  237|  2.50M|        } while (fill != 0);
  ------------------
  |  Branch (237:18): [True: 1.92M, False: 583k]
  ------------------
  238|       |
  239|       |        /* backwards increment the len-bit code huff */
  240|   583k|        incr = 1U << (len - 1);
  241|  1.14M|        while (huff & incr)
  ------------------
  |  Branch (241:16): [True: 564k, False: 583k]
  ------------------
  242|   564k|            incr >>= 1;
  243|   583k|        if (incr != 0) {
  ------------------
  |  Branch (243:13): [True: 565k, False: 18.7k]
  ------------------
  244|   565k|            huff &= incr - 1;
  245|   565k|            huff += incr;
  246|   565k|        }
  247|  18.7k|        else
  248|  18.7k|            huff = 0;
  249|       |
  250|       |        /* go to next symbol, update count, len */
  251|   583k|        sym++;
  252|   583k|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (252:13): [True: 80.8k, False: 503k]
  ------------------
  253|  80.8k|            if (len == max) break;
  ------------------
  |  Branch (253:17): [True: 18.9k, False: 61.8k]
  ------------------
  254|  61.8k|            len = lens[work[sym]];
  255|  61.8k|        }
  256|       |
  257|       |        /* create new sub-table if needed */
  258|   564k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (258:13): [True: 229k, False: 334k]
  |  Branch (258:27): [True: 104k, False: 125k]
  ------------------
  259|       |            /* if first time, transition to sub-tables */
  260|   104k|            if (drop == 0)
  ------------------
  |  Branch (260:17): [True: 4.29k, False: 99.8k]
  ------------------
  261|  4.29k|                drop = root;
  262|       |
  263|       |            /* increment past last table */
  264|   104k|            next += min;            /* here min is 1 << curr */
  265|       |
  266|       |            /* determine length of next table */
  267|   104k|            curr = len - drop;
  268|   104k|            left = (int)(1 << curr);
  269|   110k|            while (curr + drop < max) {
  ------------------
  |  Branch (269:20): [True: 90.2k, False: 19.9k]
  ------------------
  270|  90.2k|                left -= count[curr + drop];
  271|  90.2k|                if (left <= 0) break;
  ------------------
  |  Branch (271:21): [True: 84.2k, False: 6.07k]
  ------------------
  272|  6.07k|                curr++;
  273|  6.07k|                left <<= 1;
  274|  6.07k|            }
  275|       |
  276|       |            /* check for enough space */
  277|   104k|            used += 1U << curr;
  278|   104k|            if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   49|  95.3k|#define ENOUGH_LENS 852
  ------------------
  |  Branch (278:18): [True: 95.3k, False: 8.75k]
  |  Branch (278:34): [True: 0, False: 95.3k]
  ------------------
  279|   104k|                (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   50|  8.75k|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (279:18): [True: 8.75k, False: 95.3k]
  |  Branch (279:35): [True: 0, False: 8.75k]
  ------------------
  280|      0|                return 1;
  281|       |
  282|       |            /* point entry in root table to sub-table */
  283|   104k|            low = huff & mask;
  284|   104k|            (*table)[low].op = (unsigned char)curr;
  285|   104k|            (*table)[low].bits = (unsigned char)root;
  286|   104k|            (*table)[low].val = (unsigned short)(next - *table);
  287|   104k|        }
  288|   564k|    }
  289|       |
  290|       |    /* fill in remaining table entry if code is incomplete (guaranteed to have
  291|       |       at most one remaining entry, since if the code is incomplete, the
  292|       |       maximum code length that was allowed to get this far is one bit) */
  293|  18.9k|    if (huff != 0) {
  ------------------
  |  Branch (293:9): [True: 272, False: 18.7k]
  ------------------
  294|    272|        here.op = (unsigned char)64;            /* invalid code marker */
  295|    272|        here.bits = (unsigned char)(len - drop);
  296|    272|        here.val = (unsigned short)0;
  297|    272|        next[huff] = here;
  298|    272|    }
  299|       |
  300|       |    /* set return parameters */
  301|  18.9k|    *table += used;
  302|  18.9k|    *bits = root;
  303|  18.9k|    return 0;
  304|  18.9k|}

zcalloc:
  311|  2.02k|{
  312|  2.02k|    (void)opaque;
  313|  2.02k|    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
  ------------------
  |  Branch (313:12): [Folded - Ignored]
  ------------------
  314|  2.02k|                              (voidpf)calloc(items, size);
  315|  2.02k|}
zcfree:
  320|  2.02k|{
  321|  2.02k|    (void)opaque;
  322|  2.02k|    free(ptr);
  323|  2.02k|}

