LLVMFuzzerTestOneInput:
   53|  7.33k|{
   54|  7.33k|  tjhandle handle = NULL;
   55|  7.33k|  unsigned char *imgBuf = NULL, *srcBuf, *dstBuf = NULL;
   56|  7.33k|  int width = 0, height = 0, ti;
   57|  7.33k|  FILE *file = NULL;
   58|  7.33k|  struct test tests[NUMTESTS] = {
   59|       |    /*
   60|       |      BU Pixel      Data PSV Pt No    Rst
   61|       |         Format     Prec        Realc Rows */
   62|  7.33k|    { 0, TJPF_RGB,  8,   1,  0, 1,    1    },
   63|  7.33k|    { 0, TJPF_BGR,  7,   2,  5, 1,    0    },
   64|  7.33k|    { 0, TJPF_RGBX, 6,   3,  4, 0,    0    },
   65|  7.33k|    { 0, TJPF_BGRA, 5,   4,  1, 1,    0    },
   66|  7.33k|    { 1, TJPF_XRGB, 4,   5,  3, 1,    0    },
   67|  7.33k|    { 0, TJPF_GRAY, 3,   6,  2, 1,    0    },
   68|  7.33k|    { 0, TJPF_CMYK, 2,   7,  0, 1,    1    }
   69|  7.33k|  };
   70|       |
   71|  7.33k|  if ((file = fmemopen((void *)data, size, "r")) == NULL)
  ------------------
  |  Branch (71:7): [True: 0, False: 7.33k]
  ------------------
   72|      0|    goto bailout;
   73|       |
   74|  7.33k|  if ((handle = tj3Init(TJINIT_COMPRESS)) == NULL)
  ------------------
  |  | 1284|  7.33k|#define tj3Init(initType)  tj3InitVersion(initType, TURBOJPEG_VERSION_NUMBER)
  |  |  ------------------
  |  |  |  |   34|  7.33k|#define TURBOJPEG_VERSION_NUMBER  3002000
  |  |  ------------------
  ------------------
  |  Branch (74:7): [True: 0, False: 7.33k]
  ------------------
   75|      0|    goto bailout;
   76|       |
   77|  58.6k|  for (ti = 0; ti < NUMTESTS; ti++) {
  ------------------
  |  |   42|  58.6k|#define NUMTESTS  7
  ------------------
  |  Branch (77:16): [True: 51.3k, False: 7.33k]
  ------------------
   78|  51.3k|    int pf = tests[ti].pf;
   79|  51.3k|    size_t dstSize = 0, maxBufSize, i, sum = 0;
   80|       |
   81|       |    /* Test non-default compression options on specific iterations. */
   82|  51.3k|    tj3Set(handle, TJPARAM_BOTTOMUP, tests[ti].bottomUp);
   83|  51.3k|    tj3Set(handle, TJPARAM_NOREALLOC, tests[ti].noRealloc);
   84|  51.3k|    tj3Set(handle, TJPARAM_PRECISION, tests[ti].precision);
   85|  51.3k|    tj3Set(handle, TJPARAM_RESTARTROWS, tests[ti].restartRows);
   86|       |
   87|  51.3k|    tj3Set(handle, TJPARAM_MAXPIXELS, 1048576);
   88|       |    /* tj3LoadImage8() will refuse to load images larger than 1 Megapixel, so
   89|       |       we don't need to check the width and height here. */
   90|  51.3k|    fseek(file, 0, SEEK_SET);
   91|  51.3k|    if ((imgBuf = _tj3LoadImageFromFileHandle8(handle, file, &width, 1,
  ------------------
  |  Branch (91:9): [True: 45.0k, False: 6.27k]
  ------------------
   92|  51.3k|                                               &height, &pf)) == NULL) {
   93|  45.0k|      if (size < 2)
  ------------------
  |  Branch (93:11): [True: 224, False: 44.8k]
  ------------------
   94|    224|        continue;
   95|       |
   96|       |      /* Derive image dimensions from input data.  Use first 2 bytes to
   97|       |         influence width/height. */
   98|  44.8k|      width = (data[0] % 64) + 8;   /* 8-71 */
   99|  44.8k|      height = (data[1] % 64) + 8;  /* 8-71 */
  100|       |
  101|  44.8k|      size_t required_size = 2 + (size_t)width * height *
  102|  44.8k|                             tjPixelSize[tests[ti].pf];
  103|  44.8k|      if (size < required_size) {
  ------------------
  |  Branch (103:11): [True: 38.3k, False: 6.47k]
  ------------------
  104|       |        /* Not enough data - try smaller dimensions */
  105|  38.3k|        width = 8;
  106|  38.3k|        height = 8;
  107|  38.3k|        required_size = 2 + (size_t)width * height *
  108|  38.3k|                        tjPixelSize[tests[ti].pf];
  109|  38.3k|        if (size < required_size)
  ------------------
  |  Branch (109:13): [True: 29.2k, False: 9.07k]
  ------------------
  110|  29.2k|          continue;
  111|  38.3k|      }
  112|       |
  113|       |      /* Skip header bytes. */
  114|  15.5k|      srcBuf = (unsigned char *)data + 2;
  115|  15.5k|    } else
  116|  6.27k|      srcBuf = imgBuf;
  117|       |
  118|  21.8k|    dstSize = maxBufSize = tj3JPEGBufSize(width, height, TJSAMP_444);
  119|  21.8k|    if (tj3Get(handle, TJPARAM_NOREALLOC)) {
  ------------------
  |  Branch (119:9): [True: 18.9k, False: 2.86k]
  ------------------
  120|  18.9k|      if ((dstBuf = (unsigned char *)tj3Alloc(dstSize)) == NULL)
  ------------------
  |  Branch (120:11): [True: 0, False: 18.9k]
  ------------------
  121|      0|        goto bailout;
  122|  18.9k|    } else
  123|  2.86k|      dstBuf = NULL;
  124|       |
  125|  21.8k|    if (size >= 34)
  ------------------
  |  Branch (125:9): [True: 19.9k, False: 1.82k]
  ------------------
  126|  19.9k|      tj3SetICCProfile(handle, (unsigned char *)&data[2], 32);
  127|       |
  128|  21.8k|    tj3Set(handle, TJPARAM_LOSSLESS, 1);
  129|  21.8k|    tj3Set(handle, TJPARAM_LOSSLESSPSV, tests[ti].psv);
  130|  21.8k|    tj3Set(handle, TJPARAM_LOSSLESSPT, tests[ti].pt);
  131|  21.8k|    if (tj3Compress8(handle, srcBuf, width, 0, height, pf, &dstBuf,
  ------------------
  |  Branch (131:9): [True: 21.8k, False: 0]
  ------------------
  132|  21.8k|                     &dstSize) == 0) {
  133|       |      /* Touch all of the output data in order to catch uninitialized reads
  134|       |         when using MemorySanitizer. */
  135|   113M|      for (i = 0; i < dstSize; i++)
  ------------------
  |  Branch (135:19): [True: 113M, False: 21.8k]
  ------------------
  136|   113M|        sum += dstBuf[i];
  137|  21.8k|    }
  138|       |
  139|  21.8k|    tj3Free(dstBuf);
  140|  21.8k|    dstBuf = NULL;
  141|  21.8k|    tj3Free(imgBuf);
  142|  21.8k|    imgBuf = NULL;
  143|       |
  144|       |    /* Prevent the sum above from being optimized out.  This test should never
  145|       |       be true, but the compiler doesn't know that. */
  146|  21.8k|    if (sum > 255 * maxBufSize)
  ------------------
  |  Branch (146:9): [True: 0, False: 21.8k]
  ------------------
  147|      0|      goto bailout;
  148|  21.8k|  }
  149|       |
  150|  7.33k|bailout:
  151|  7.33k|  tj3Free(dstBuf);
  152|  7.33k|  tj3Free(imgBuf);
  153|  7.33k|  if (file) fclose(file);
  ------------------
  |  Branch (153:7): [True: 7.33k, False: 0]
  ------------------
  154|  7.33k|  tj3Destroy(handle);
  155|  7.33k|  return 0;
  156|  7.33k|}

rdbmp.c:rgb_to_cmyk:
   29|  3.32M|{
   30|  3.32M|  double ctmp = 1.0 - ((double)r / (double)maxval);
   31|  3.32M|  double mtmp = 1.0 - ((double)g / (double)maxval);
   32|  3.32M|  double ytmp = 1.0 - ((double)b / (double)maxval);
   33|  3.32M|  double ktmp = MIN(MIN(ctmp, mtmp), ytmp);
  ------------------
  |  |  515|  6.65M|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 698k, False: 2.63M]
  |  |  |  Branch (515:27): [True: 526k, False: 2.80M]
  |  |  |  Branch (515:39): [True: 347k, False: 350k]
  |  |  ------------------
  ------------------
   34|       |
   35|  3.32M|  if (ktmp == 1.0) ctmp = mtmp = ytmp = 0.0;
  ------------------
  |  Branch (35:7): [True: 674k, False: 2.65M]
  ------------------
   36|  2.65M|  else {
   37|  2.65M|    ctmp = (ctmp - ktmp) / (1.0 - ktmp);
   38|  2.65M|    mtmp = (mtmp - ktmp) / (1.0 - ktmp);
   39|  2.65M|    ytmp = (ytmp - ktmp) / (1.0 - ktmp);
   40|  2.65M|  }
   41|  3.32M|  *c = (_JSAMPLE)((double)maxval - ctmp * (double)maxval + 0.5);
   42|  3.32M|  *m = (_JSAMPLE)((double)maxval - mtmp * (double)maxval + 0.5);
   43|  3.32M|  *y = (_JSAMPLE)((double)maxval - ytmp * (double)maxval + 0.5);
   44|  3.32M|  *k = (_JSAMPLE)((double)maxval - ktmp * (double)maxval + 0.5);
   45|  3.32M|}
rdpng-8.c:rgb_to_cmyk:
   29|  16.6M|{
   30|  16.6M|  double ctmp = 1.0 - ((double)r / (double)maxval);
   31|  16.6M|  double mtmp = 1.0 - ((double)g / (double)maxval);
   32|  16.6M|  double ytmp = 1.0 - ((double)b / (double)maxval);
   33|  16.6M|  double ktmp = MIN(MIN(ctmp, mtmp), ytmp);
  ------------------
  |  |  515|  33.3M|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 2.12M, False: 14.5M]
  |  |  |  Branch (515:27): [True: 1.41M, False: 15.2M]
  |  |  |  Branch (515:39): [True: 1.20M, False: 914k]
  |  |  ------------------
  ------------------
   34|       |
   35|  16.6M|  if (ktmp == 1.0) ctmp = mtmp = ytmp = 0.0;
  ------------------
  |  Branch (35:7): [True: 12.4M, False: 4.23M]
  ------------------
   36|  4.23M|  else {
   37|  4.23M|    ctmp = (ctmp - ktmp) / (1.0 - ktmp);
   38|  4.23M|    mtmp = (mtmp - ktmp) / (1.0 - ktmp);
   39|  4.23M|    ytmp = (ytmp - ktmp) / (1.0 - ktmp);
   40|  4.23M|  }
   41|  16.6M|  *c = (_JSAMPLE)((double)maxval - ctmp * (double)maxval + 0.5);
   42|  16.6M|  *m = (_JSAMPLE)((double)maxval - mtmp * (double)maxval + 0.5);
   43|  16.6M|  *y = (_JSAMPLE)((double)maxval - ytmp * (double)maxval + 0.5);
   44|  16.6M|  *k = (_JSAMPLE)((double)maxval - ktmp * (double)maxval + 0.5);
   45|  16.6M|}
rdppm-8.c:rgb_to_cmyk:
   29|  8.93M|{
   30|  8.93M|  double ctmp = 1.0 - ((double)r / (double)maxval);
   31|  8.93M|  double mtmp = 1.0 - ((double)g / (double)maxval);
   32|  8.93M|  double ytmp = 1.0 - ((double)b / (double)maxval);
   33|  8.93M|  double ktmp = MIN(MIN(ctmp, mtmp), ytmp);
  ------------------
  |  |  515|  17.8M|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 11.5k, False: 8.92M]
  |  |  |  Branch (515:27): [True: 6.75k, False: 8.93M]
  |  |  |  Branch (515:39): [True: 5.30k, False: 6.27k]
  |  |  ------------------
  ------------------
   34|       |
   35|  8.93M|  if (ktmp == 1.0) ctmp = mtmp = ytmp = 0.0;
  ------------------
  |  Branch (35:7): [True: 6.24M, False: 2.69M]
  ------------------
   36|  2.69M|  else {
   37|  2.69M|    ctmp = (ctmp - ktmp) / (1.0 - ktmp);
   38|  2.69M|    mtmp = (mtmp - ktmp) / (1.0 - ktmp);
   39|  2.69M|    ytmp = (ytmp - ktmp) / (1.0 - ktmp);
   40|  2.69M|  }
   41|  8.93M|  *c = (_JSAMPLE)((double)maxval - ctmp * (double)maxval + 0.5);
   42|  8.93M|  *m = (_JSAMPLE)((double)maxval - mtmp * (double)maxval + 0.5);
   43|  8.93M|  *y = (_JSAMPLE)((double)maxval - ytmp * (double)maxval + 0.5);
   44|  8.93M|  *k = (_JSAMPLE)((double)maxval - ktmp * (double)maxval + 0.5);
   45|  8.93M|}

jpeg_CreateCompress:
   39|  58.6k|{
   40|  58.6k|  int i;
   41|       |
   42|       |  /* Guard against version mismatches between library and caller. */
   43|  58.6k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   44|  58.6k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  58.6k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (44:7): [True: 0, False: 58.6k]
  ------------------
   45|      0|    ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   46|  58.6k|  if (structsize != sizeof(struct jpeg_compress_struct))
  ------------------
  |  Branch (46:7): [True: 0, False: 58.6k]
  ------------------
   47|      0|    ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   48|  58.6k|             (int)sizeof(struct jpeg_compress_struct), (int)structsize);
   49|       |
   50|       |  /* For debugging purposes, we zero the whole master structure.
   51|       |   * But the application has already set the err pointer, and may have set
   52|       |   * client_data, so we have to save and restore those fields.
   53|       |   * Note: if application hasn't set client_data, tools like Purify may
   54|       |   * complain here.
   55|       |   */
   56|  58.6k|  {
   57|  58.6k|    struct jpeg_error_mgr *err = cinfo->err;
   58|  58.6k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   59|  58.6k|    memset(cinfo, 0, sizeof(struct jpeg_compress_struct));
   60|  58.6k|    cinfo->err = err;
   61|  58.6k|    cinfo->client_data = client_data;
   62|  58.6k|  }
   63|  58.6k|  cinfo->is_decompressor = FALSE;
  ------------------
  |  |  207|  58.6k|#define FALSE   0               /* values of boolean */
  ------------------
   64|       |
   65|       |  /* Initialize a memory manager instance for this object */
   66|  58.6k|  jinit_memory_mgr((j_common_ptr)cinfo);
   67|       |
   68|       |  /* Zero out pointers to permanent structures. */
   69|  58.6k|  cinfo->progress = NULL;
   70|  58.6k|  cinfo->dest = NULL;
   71|       |
   72|  58.6k|  cinfo->comp_info = NULL;
   73|       |
   74|   293k|  for (i = 0; i < NUM_QUANT_TBLS; i++) {
  ------------------
  |  |   68|   293k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (74:15): [True: 234k, False: 58.6k]
  ------------------
   75|   234k|    cinfo->quant_tbl_ptrs[i] = NULL;
   76|       |#if JPEG_LIB_VERSION >= 70
   77|       |    cinfo->q_scale_factor[i] = 100;
   78|       |#endif
   79|   234k|  }
   80|       |
   81|   293k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|   293k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (81:15): [True: 234k, False: 58.6k]
  ------------------
   82|   234k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   83|   234k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   84|   234k|  }
   85|       |
   86|       |#if JPEG_LIB_VERSION >= 80
   87|       |  /* Must do it here for emit_dqt in case jpeg_write_tables is used */
   88|       |  cinfo->block_size = DCTSIZE;
   89|       |  cinfo->natural_order = jpeg_natural_order;
   90|       |  cinfo->lim_Se = DCTSIZE2 - 1;
   91|       |#endif
   92|       |
   93|  58.6k|  cinfo->script_space = NULL;
   94|       |
   95|  58.6k|  cinfo->input_gamma = 1.0;     /* in case application forgets */
   96|       |
   97|  58.6k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|  58.6k|#define BITS_IN_JSAMPLE  8
  ------------------
   98|       |
   99|       |  /* OK, I'm ready */
  100|  58.6k|  cinfo->global_state = CSTATE_START;
  ------------------
  |  |   44|  58.6k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  101|       |
  102|       |  /* The master struct is used to store extension parameters, so we allocate it
  103|       |   * here.
  104|       |   */
  105|  58.6k|  cinfo->master = (struct jpeg_comp_master *)
  106|  58.6k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  58.6k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  107|  58.6k|                                  sizeof(my_comp_master));
  108|  58.6k|  memset(cinfo->master, 0, sizeof(my_comp_master));
  109|  58.6k|#ifdef WITH_SIMD
  110|  58.6k|  cinfo->master->simd_support = JSIMD_UNDEFINED;
  ------------------
  |  |   49|  58.6k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|  58.6k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  111|  58.6k|  cinfo->master->simd_huffman = 1;
  112|  58.6k|#endif
  113|  58.6k|}
jpeg_destroy_compress:
  122|  58.6k|{
  123|  58.6k|  jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
  124|  58.6k|}
jpeg_suppress_tables:
  153|  21.8k|{
  154|  21.8k|  int i;
  155|  21.8k|  JQUANT_TBL *qtbl;
  156|  21.8k|  JHUFF_TBL *htbl;
  157|       |
  158|   109k|  for (i = 0; i < NUM_QUANT_TBLS; i++) {
  ------------------
  |  |   68|   109k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (158:15): [True: 87.2k, False: 21.8k]
  ------------------
  159|  87.2k|    if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL)
  ------------------
  |  Branch (159:9): [True: 43.6k, False: 43.6k]
  ------------------
  160|  43.6k|      qtbl->sent_table = suppress;
  161|  87.2k|  }
  162|       |
  163|   109k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|   109k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (163:15): [True: 87.2k, False: 21.8k]
  ------------------
  164|  87.2k|    if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL)
  ------------------
  |  Branch (164:9): [True: 43.6k, False: 43.6k]
  ------------------
  165|  43.6k|      htbl->sent_table = suppress;
  166|  87.2k|    if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL)
  ------------------
  |  Branch (166:9): [True: 43.6k, False: 43.6k]
  ------------------
  167|  43.6k|      htbl->sent_table = suppress;
  168|  87.2k|  }
  169|  21.8k|}
jpeg_finish_compress:
  181|  21.8k|{
  182|  21.8k|  JDIMENSION iMCU_row;
  183|       |
  184|  21.8k|  if (cinfo->global_state == CSTATE_SCANNING ||
  ------------------
  |  |   45|  43.6k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (184:7): [True: 21.8k, False: 0]
  ------------------
  185|  21.8k|      cinfo->global_state == CSTATE_RAW_OK) {
  ------------------
  |  |   46|      0|#define CSTATE_RAW_OK    102    /* start_compress done, write_raw_data OK */
  ------------------
  |  Branch (185:7): [True: 0, False: 0]
  ------------------
  186|       |    /* Terminate first pass */
  187|  21.8k|    if (cinfo->next_scanline < cinfo->image_height)
  ------------------
  |  Branch (187:9): [True: 0, False: 21.8k]
  ------------------
  188|      0|      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  189|  21.8k|    (*cinfo->master->finish_pass) (cinfo);
  190|  21.8k|  } else if (cinfo->global_state != CSTATE_WRCOEFS)
  ------------------
  |  |   47|      0|#define CSTATE_WRCOEFS   103    /* jpeg_write_coefficients done */
  ------------------
  |  Branch (190:14): [True: 0, False: 0]
  ------------------
  191|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  192|       |  /* Perform any remaining passes */
  193|  43.6k|  while (!cinfo->master->is_last_pass) {
  ------------------
  |  Branch (193:10): [True: 21.8k, False: 21.8k]
  ------------------
  194|  21.8k|    (*cinfo->master->prepare_for_pass) (cinfo);
  195|  15.3M|    for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
  ------------------
  |  Branch (195:24): [True: 15.3M, False: 21.8k]
  ------------------
  196|  15.3M|      if (cinfo->progress != NULL) {
  ------------------
  |  Branch (196:11): [True: 0, False: 15.3M]
  ------------------
  197|      0|        cinfo->progress->pass_counter = (long)iMCU_row;
  198|      0|        cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows;
  199|      0|        (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  200|      0|      }
  201|       |      /* We bypass the main controller and invoke coef controller directly;
  202|       |       * all work is being done from the coefficient buffer.
  203|       |       */
  204|  15.3M|      if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (204:11): [True: 15.3M, False: 0]
  ------------------
  205|  15.3M|        if (cinfo->coef->compress_data == NULL)
  ------------------
  |  Branch (205:13): [True: 0, False: 15.3M]
  ------------------
  206|      0|          ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  207|  15.3M|        if (!(*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE)NULL))
  ------------------
  |  Branch (207:13): [True: 0, False: 15.3M]
  ------------------
  208|      0|          ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  209|  15.3M|      } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (209:18): [True: 0, False: 0]
  ------------------
  210|      0|        if (cinfo->coef->compress_data_12 == NULL)
  ------------------
  |  Branch (210:13): [True: 0, False: 0]
  ------------------
  211|      0|          ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  212|      0|        if (!(*cinfo->coef->compress_data_12) (cinfo, (J12SAMPIMAGE)NULL))
  ------------------
  |  Branch (212:13): [True: 0, False: 0]
  ------------------
  213|      0|          ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  214|      0|      } else {
  215|      0|#ifdef C_LOSSLESS_SUPPORTED
  216|      0|        if (cinfo->coef->compress_data_16 == NULL)
  ------------------
  |  Branch (216:13): [True: 0, False: 0]
  ------------------
  217|      0|          ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  218|      0|        if (!(*cinfo->coef->compress_data_16) (cinfo, (J16SAMPIMAGE)NULL))
  ------------------
  |  Branch (218:13): [True: 0, False: 0]
  ------------------
  219|      0|          ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  220|       |#else
  221|       |        ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  222|       |#endif
  223|      0|      }
  224|  15.3M|    }
  225|  21.8k|    (*cinfo->master->finish_pass) (cinfo);
  226|  21.8k|  }
  227|       |  /* Write EOI, do final cleanup */
  228|  21.8k|  (*cinfo->marker->write_file_trailer) (cinfo);
  229|  21.8k|  (*cinfo->dest->term_destination) (cinfo);
  230|       |  /* We can use jpeg_abort to release memory and reset global_state */
  231|  21.8k|  jpeg_abort((j_common_ptr)cinfo);
  232|  21.8k|}
jpeg_write_m_header:
  266|  19.9k|{
  267|  19.9k|  if (cinfo->next_scanline != 0 ||
  ------------------
  |  Branch (267:7): [True: 0, False: 19.9k]
  ------------------
  268|  19.9k|      (cinfo->global_state != CSTATE_SCANNING &&
  ------------------
  |  |   45|  39.9k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (268:8): [True: 0, False: 19.9k]
  ------------------
  269|      0|       cinfo->global_state != CSTATE_RAW_OK &&
  ------------------
  |  |   46|  19.9k|#define CSTATE_RAW_OK    102    /* start_compress done, write_raw_data OK */
  ------------------
  |  Branch (269:8): [True: 0, False: 0]
  ------------------
  270|      0|       cinfo->global_state != CSTATE_WRCOEFS))
  ------------------
  |  |   47|      0|#define CSTATE_WRCOEFS   103    /* jpeg_write_coefficients done */
  ------------------
  |  Branch (270:8): [True: 0, False: 0]
  ------------------
  271|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  272|       |
  273|  19.9k|  (*cinfo->marker->write_marker_header) (cinfo, marker, datalen);
  274|  19.9k|}
jpeg_write_m_byte:
  278|   919k|{
  279|   919k|  (*cinfo->marker->write_marker_byte) (cinfo, val);
  280|   919k|}

jpeg_start_compress:
   45|  21.8k|{
   46|  21.8k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  21.8k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (46:7): [True: 0, False: 21.8k]
  ------------------
   47|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   48|       |
   49|  21.8k|  if (write_all_tables)
  ------------------
  |  Branch (49:7): [True: 21.8k, False: 0]
  ------------------
   50|  21.8k|    jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
   51|       |
   52|       |  /* (Re)initialize error mgr and destination modules */
   53|  21.8k|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
   54|  21.8k|  (*cinfo->dest->init_destination) (cinfo);
   55|       |  /* Perform master selection of active modules */
   56|  21.8k|  jinit_compress_master(cinfo);
   57|       |  /* Set up for the first pass */
   58|  21.8k|  (*cinfo->master->prepare_for_pass) (cinfo);
   59|       |  /* Ready for application to drive first pass through _jpeg_write_scanlines
   60|       |   * or _jpeg_write_raw_data.
   61|       |   */
   62|  21.8k|  cinfo->next_scanline = 0;
   63|  21.8k|  cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
  ------------------
  |  |   46|      0|#define CSTATE_RAW_OK    102    /* start_compress done, write_raw_data OK */
  ------------------
                cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
  ------------------
  |  |   45|  21.8k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (63:26): [True: 0, False: 21.8k]
  ------------------
   64|  21.8k|}
jpeg_write_scanlines:
   87|  21.8k|{
   88|  21.8k|#if BITS_IN_JSAMPLE != 16 || defined(C_LOSSLESS_SUPPORTED)
   89|  21.8k|  JDIMENSION row_ctr, rows_left;
   90|       |
   91|  21.8k|#ifdef C_LOSSLESS_SUPPORTED
   92|  21.8k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (92:7): [True: 21.8k, False: 0]
  ------------------
   93|  21.8k|#if BITS_IN_JSAMPLE == 8
   94|  21.8k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  43.6k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (94:9): [True: 0, False: 21.8k]
  |  Branch (94:52): [True: 0, False: 21.8k]
  ------------------
   95|       |#else
   96|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
   97|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
   98|       |#endif
   99|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  100|  21.8k|  } else
  101|      0|#endif
  102|      0|  {
  103|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (103:9): [True: 0, False: 0]
  ------------------
  104|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  105|      0|  }
  106|       |
  107|  21.8k|  if (cinfo->global_state != CSTATE_SCANNING)
  ------------------
  |  |   45|  21.8k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (107:7): [True: 0, False: 21.8k]
  ------------------
  108|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|  21.8k|  if (cinfo->next_scanline >= cinfo->image_height)
  ------------------
  |  Branch (109:7): [True: 0, False: 21.8k]
  ------------------
  110|      0|    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
  ------------------
  |  |  283|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  111|       |
  112|       |  /* Call progress monitor hook if present */
  113|  21.8k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (113:7): [True: 0, False: 21.8k]
  ------------------
  114|      0|    cinfo->progress->pass_counter = (long)cinfo->next_scanline;
  115|      0|    cinfo->progress->pass_limit = (long)cinfo->image_height;
  116|      0|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  117|      0|  }
  118|       |
  119|       |  /* Give master control module another chance if this is first call to
  120|       |   * _jpeg_write_scanlines.  This lets output of the frame/scan headers be
  121|       |   * delayed so that application can write COM, etc, markers between
  122|       |   * jpeg_start_compress and _jpeg_write_scanlines.
  123|       |   */
  124|  21.8k|  if (cinfo->master->call_pass_startup)
  ------------------
  |  Branch (124:7): [True: 0, False: 21.8k]
  ------------------
  125|      0|    (*cinfo->master->pass_startup) (cinfo);
  126|       |
  127|       |  /* Ignore any extra scanlines at bottom of image. */
  128|  21.8k|  rows_left = cinfo->image_height - cinfo->next_scanline;
  129|  21.8k|  if (num_lines > rows_left)
  ------------------
  |  Branch (129:7): [True: 0, False: 21.8k]
  ------------------
  130|      0|    num_lines = rows_left;
  131|       |
  132|  21.8k|  row_ctr = 0;
  133|  21.8k|  if (cinfo->main->_process_data == NULL)
  ------------------
  |  |  256|  21.8k|#define _process_data  process_data
  ------------------
  |  Branch (133:7): [True: 0, False: 21.8k]
  ------------------
  134|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  135|  21.8k|  (*cinfo->main->_process_data) (cinfo, scanlines, &row_ctr, num_lines);
  ------------------
  |  |  256|  21.8k|#define _process_data  process_data
  ------------------
  136|  21.8k|  cinfo->next_scanline += row_ctr;
  137|  21.8k|  return row_ctr;
  138|       |#else
  139|       |  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  140|       |  return 0;
  141|       |#endif
  142|  21.8k|}

jccolor-8.c:extrgbx_rgb_convert:
  130|  2.30M|{
  131|  2.30M|  register _JSAMPROW inptr;
  132|  2.30M|  register _JSAMPROW outptr0, outptr1, outptr2;
  133|  2.30M|  register JDIMENSION col;
  134|  2.30M|  JDIMENSION num_cols = cinfo->image_width;
  135|       |
  136|  4.60M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (136:10): [True: 2.30M, False: 2.30M]
  ------------------
  137|  2.30M|    inptr = *input_buf++;
  138|  2.30M|    outptr0 = output_buf[0][output_row];
  139|  2.30M|    outptr1 = output_buf[1][output_row];
  140|  2.30M|    outptr2 = output_buf[2][output_row];
  141|  2.30M|    output_row++;
  142|  16.3M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (142:19): [True: 14.0M, False: 2.30M]
  ------------------
  143|  14.0M|      outptr0[col] = inptr[RGB_RED];
  ------------------
  |  |  129|  14.0M|#define RGB_RED  EXT_RGBX_RED
  |  |  ------------------
  |  |  |  |  311|  14.0M|#define EXT_RGBX_RED        0
  |  |  ------------------
  ------------------
  144|  14.0M|      outptr1[col] = inptr[RGB_GREEN];
  ------------------
  |  |  130|  14.0M|#define RGB_GREEN  EXT_RGBX_GREEN
  |  |  ------------------
  |  |  |  |  312|  14.0M|#define EXT_RGBX_GREEN      1
  |  |  ------------------
  ------------------
  145|  14.0M|      outptr2[col] = inptr[RGB_BLUE];
  ------------------
  |  |  131|  14.0M|#define RGB_BLUE  EXT_RGBX_BLUE
  |  |  ------------------
  |  |  |  |  313|  14.0M|#define EXT_RGBX_BLUE       2
  |  |  ------------------
  ------------------
  146|  14.0M|      inptr += RGB_PIXELSIZE;
  ------------------
  |  |  132|  14.0M|#define RGB_PIXELSIZE  EXT_RGBX_PIXELSIZE
  |  |  ------------------
  |  |  |  |  314|  14.0M|#define EXT_RGBX_PIXELSIZE  4
  |  |  ------------------
  ------------------
  147|  14.0M|    }
  148|  2.30M|  }
  149|  2.30M|}
jccolor-8.c:extbgr_rgb_convert:
  130|  2.30M|{
  131|  2.30M|  register _JSAMPROW inptr;
  132|  2.30M|  register _JSAMPROW outptr0, outptr1, outptr2;
  133|  2.30M|  register JDIMENSION col;
  134|  2.30M|  JDIMENSION num_cols = cinfo->image_width;
  135|       |
  136|  4.61M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (136:10): [True: 2.30M, False: 2.30M]
  ------------------
  137|  2.30M|    inptr = *input_buf++;
  138|  2.30M|    outptr0 = output_buf[0][output_row];
  139|  2.30M|    outptr1 = output_buf[1][output_row];
  140|  2.30M|    outptr2 = output_buf[2][output_row];
  141|  2.30M|    output_row++;
  142|  16.3M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (142:19): [True: 14.0M, False: 2.30M]
  ------------------
  143|  14.0M|      outptr0[col] = inptr[RGB_RED];
  ------------------
  |  |  145|  14.0M|#define RGB_RED  EXT_BGR_RED
  |  |  ------------------
  |  |  |  |  316|  14.0M|#define EXT_BGR_RED         2
  |  |  ------------------
  ------------------
  144|  14.0M|      outptr1[col] = inptr[RGB_GREEN];
  ------------------
  |  |  146|  14.0M|#define RGB_GREEN  EXT_BGR_GREEN
  |  |  ------------------
  |  |  |  |  317|  14.0M|#define EXT_BGR_GREEN       1
  |  |  ------------------
  ------------------
  145|  14.0M|      outptr2[col] = inptr[RGB_BLUE];
  ------------------
  |  |  147|  14.0M|#define RGB_BLUE  EXT_BGR_BLUE
  |  |  ------------------
  |  |  |  |  318|  14.0M|#define EXT_BGR_BLUE        0
  |  |  ------------------
  ------------------
  146|  14.0M|      inptr += RGB_PIXELSIZE;
  ------------------
  |  |  148|  14.0M|#define RGB_PIXELSIZE  EXT_BGR_PIXELSIZE
  |  |  ------------------
  |  |  |  |  319|  14.0M|#define EXT_BGR_PIXELSIZE   3
  |  |  ------------------
  ------------------
  147|  14.0M|    }
  148|  2.30M|  }
  149|  2.30M|}
jccolor-8.c:extbgrx_rgb_convert:
  130|  2.30M|{
  131|  2.30M|  register _JSAMPROW inptr;
  132|  2.30M|  register _JSAMPROW outptr0, outptr1, outptr2;
  133|  2.30M|  register JDIMENSION col;
  134|  2.30M|  JDIMENSION num_cols = cinfo->image_width;
  135|       |
  136|  4.60M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (136:10): [True: 2.30M, False: 2.30M]
  ------------------
  137|  2.30M|    inptr = *input_buf++;
  138|  2.30M|    outptr0 = output_buf[0][output_row];
  139|  2.30M|    outptr1 = output_buf[1][output_row];
  140|  2.30M|    outptr2 = output_buf[2][output_row];
  141|  2.30M|    output_row++;
  142|  16.3M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (142:19): [True: 14.0M, False: 2.30M]
  ------------------
  143|  14.0M|      outptr0[col] = inptr[RGB_RED];
  ------------------
  |  |  161|  14.0M|#define RGB_RED  EXT_BGRX_RED
  |  |  ------------------
  |  |  |  |  321|  14.0M|#define EXT_BGRX_RED        2
  |  |  ------------------
  ------------------
  144|  14.0M|      outptr1[col] = inptr[RGB_GREEN];
  ------------------
  |  |  162|  14.0M|#define RGB_GREEN  EXT_BGRX_GREEN
  |  |  ------------------
  |  |  |  |  322|  14.0M|#define EXT_BGRX_GREEN      1
  |  |  ------------------
  ------------------
  145|  14.0M|      outptr2[col] = inptr[RGB_BLUE];
  ------------------
  |  |  163|  14.0M|#define RGB_BLUE  EXT_BGRX_BLUE
  |  |  ------------------
  |  |  |  |  323|  14.0M|#define EXT_BGRX_BLUE       0
  |  |  ------------------
  ------------------
  146|  14.0M|      inptr += RGB_PIXELSIZE;
  ------------------
  |  |  164|  14.0M|#define RGB_PIXELSIZE  EXT_BGRX_PIXELSIZE
  |  |  ------------------
  |  |  |  |  324|  14.0M|#define EXT_BGRX_PIXELSIZE  4
  |  |  ------------------
  ------------------
  147|  14.0M|    }
  148|  2.30M|  }
  149|  2.30M|}
jccolor-8.c:extxrgb_rgb_convert:
  130|  2.30M|{
  131|  2.30M|  register _JSAMPROW inptr;
  132|  2.30M|  register _JSAMPROW outptr0, outptr1, outptr2;
  133|  2.30M|  register JDIMENSION col;
  134|  2.30M|  JDIMENSION num_cols = cinfo->image_width;
  135|       |
  136|  4.60M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (136:10): [True: 2.30M, False: 2.30M]
  ------------------
  137|  2.30M|    inptr = *input_buf++;
  138|  2.30M|    outptr0 = output_buf[0][output_row];
  139|  2.30M|    outptr1 = output_buf[1][output_row];
  140|  2.30M|    outptr2 = output_buf[2][output_row];
  141|  2.30M|    output_row++;
  142|  16.3M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (142:19): [True: 14.0M, False: 2.30M]
  ------------------
  143|  14.0M|      outptr0[col] = inptr[RGB_RED];
  ------------------
  |  |  193|  14.0M|#define RGB_RED  EXT_XRGB_RED
  |  |  ------------------
  |  |  |  |  331|  14.0M|#define EXT_XRGB_RED        1
  |  |  ------------------
  ------------------
  144|  14.0M|      outptr1[col] = inptr[RGB_GREEN];
  ------------------
  |  |  194|  14.0M|#define RGB_GREEN  EXT_XRGB_GREEN
  |  |  ------------------
  |  |  |  |  332|  14.0M|#define EXT_XRGB_GREEN      2
  |  |  ------------------
  ------------------
  145|  14.0M|      outptr2[col] = inptr[RGB_BLUE];
  ------------------
  |  |  195|  14.0M|#define RGB_BLUE  EXT_XRGB_BLUE
  |  |  ------------------
  |  |  |  |  333|  14.0M|#define EXT_XRGB_BLUE       3
  |  |  ------------------
  ------------------
  146|  14.0M|      inptr += RGB_PIXELSIZE;
  ------------------
  |  |  196|  14.0M|#define RGB_PIXELSIZE  EXT_XRGB_PIXELSIZE
  |  |  ------------------
  |  |  |  |  334|  14.0M|#define EXT_XRGB_PIXELSIZE  4
  |  |  ------------------
  ------------------
  147|  14.0M|    }
  148|  2.30M|  }
  149|  2.30M|}

jinit_color_converter:
  418|  21.8k|{
  419|  21.8k|  my_cconvert_ptr cconvert;
  420|       |
  421|  21.8k|#ifdef C_LOSSLESS_SUPPORTED
  422|  21.8k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (422:7): [True: 21.8k, False: 0]
  ------------------
  423|  21.8k|#if BITS_IN_JSAMPLE == 8
  424|  21.8k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  43.6k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (424:9): [True: 0, False: 21.8k]
  |  Branch (424:52): [True: 0, False: 21.8k]
  ------------------
  425|       |#else
  426|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  427|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  428|       |#endif
  429|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  430|  21.8k|  } else
  431|      0|#endif
  432|      0|  {
  433|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (433:9): [True: 0, False: 0]
  ------------------
  434|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  435|      0|  }
  436|       |
  437|  21.8k|  cconvert = (my_cconvert_ptr)
  438|  21.8k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  21.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  439|  21.8k|                                sizeof(my_color_converter));
  440|  21.8k|  cinfo->cconvert = (struct jpeg_color_converter *)cconvert;
  441|       |  /* set start_pass to null method until we find out differently */
  442|  21.8k|  cconvert->pub.start_pass = null_method;
  443|       |
  444|       |  /* Make sure input_components agrees with in_color_space */
  445|  21.8k|  switch (cinfo->in_color_space) {
  446|  4.19k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (446:3): [True: 4.19k, False: 17.6k]
  ------------------
  447|  4.19k|    if (cinfo->input_components != 1)
  ------------------
  |  Branch (447:9): [True: 0, False: 4.19k]
  ------------------
  448|      0|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  449|  4.19k|    break;
  450|       |
  451|      0|  case JCS_RGB:
  ------------------
  |  Branch (451:3): [True: 0, False: 21.8k]
  ------------------
  452|  3.09k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (452:3): [True: 3.09k, False: 18.7k]
  ------------------
  453|  5.95k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (453:3): [True: 2.86k, False: 18.9k]
  ------------------
  454|  9.04k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (454:3): [True: 3.09k, False: 18.7k]
  ------------------
  455|  9.04k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (455:3): [True: 0, False: 21.8k]
  ------------------
  456|  9.04k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (456:3): [True: 0, False: 21.8k]
  ------------------
  457|  11.9k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (457:3): [True: 2.86k, False: 18.9k]
  ------------------
  458|  11.9k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (458:3): [True: 0, False: 21.8k]
  ------------------
  459|  14.7k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (459:3): [True: 2.86k, False: 18.9k]
  ------------------
  460|  14.7k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (460:3): [True: 0, False: 21.8k]
  ------------------
  461|  14.7k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (461:3): [True: 0, False: 21.8k]
  ------------------
  462|  14.7k|    if (cinfo->input_components != rgb_pixelsize[cinfo->in_color_space])
  ------------------
  |  Branch (462:9): [True: 0, False: 14.7k]
  ------------------
  463|      0|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  464|  14.7k|    break;
  465|       |
  466|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (466:3): [True: 0, False: 21.8k]
  ------------------
  467|      0|    if (cinfo->input_components != 3)
  ------------------
  |  Branch (467:9): [True: 0, False: 0]
  ------------------
  468|      0|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  469|      0|    break;
  470|       |
  471|  2.86k|  case JCS_CMYK:
  ------------------
  |  Branch (471:3): [True: 2.86k, False: 18.9k]
  ------------------
  472|  2.86k|  case JCS_YCCK:
  ------------------
  |  Branch (472:3): [True: 0, False: 21.8k]
  ------------------
  473|  2.86k|    if (cinfo->input_components != 4)
  ------------------
  |  Branch (473:9): [True: 0, False: 2.86k]
  ------------------
  474|      0|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  475|  2.86k|    break;
  476|       |
  477|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (477:3): [True: 0, False: 21.8k]
  ------------------
  478|      0|    if (cinfo->input_components < 1)
  ------------------
  |  Branch (478:9): [True: 0, False: 0]
  ------------------
  479|      0|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  480|      0|    break;
  481|  21.8k|  }
  482|       |
  483|       |  /* Check num_components, set conversion method based on requested space.
  484|       |   * NOTE: We do not allow any lossy color conversion algorithms in lossless
  485|       |   * mode.
  486|       |   */
  487|  21.8k|  switch (cinfo->jpeg_color_space) {
  488|  4.19k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (488:3): [True: 4.19k, False: 17.6k]
  ------------------
  489|  4.19k|#ifdef C_LOSSLESS_SUPPORTED
  490|  4.19k|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (490:9): [True: 4.19k, False: 0]
  ------------------
  491|  4.19k|        cinfo->in_color_space != cinfo->jpeg_color_space)
  ------------------
  |  Branch (491:9): [True: 0, False: 4.19k]
  ------------------
  492|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  493|  4.19k|#endif
  494|  4.19k|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (494:9): [True: 0, False: 4.19k]
  ------------------
  495|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  496|  4.19k|    if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (496:9): [True: 4.19k, False: 0]
  ------------------
  497|  4.19k|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  267|  4.19k|#define _color_convert  color_convert
  ------------------
  498|      0|    else if (IsExtRGB(cinfo->in_color_space)) {
  ------------------
  |  |   78|      0|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 0]
  |  |  |  Branch (78:22): [True: 0, False: 0]
  |  |  |  Branch (78:43): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  499|      0|#ifdef WITH_SIMD
  500|      0|      if (jsimd_set_rgb_gray(cinfo))
  ------------------
  |  Branch (500:11): [True: 0, False: 0]
  ------------------
  501|      0|        cconvert->pub._color_convert = jsimd_color_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  502|      0|      else
  503|      0|#endif
  504|      0|      {
  505|      0|        cconvert->pub.start_pass = rgb_ycc_start;
  506|      0|        switch (cinfo->in_color_space) {
  507|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (507:9): [True: 0, False: 0]
  ------------------
  508|      0|          cconvert->pub._color_convert = extrgb_gray_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  509|      0|          break;
  510|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (510:9): [True: 0, False: 0]
  ------------------
  511|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (511:9): [True: 0, False: 0]
  ------------------
  512|      0|          cconvert->pub._color_convert = extrgbx_gray_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  513|      0|          break;
  514|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (514:9): [True: 0, False: 0]
  ------------------
  515|      0|          cconvert->pub._color_convert = extbgr_gray_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  516|      0|          break;
  517|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (517:9): [True: 0, False: 0]
  ------------------
  518|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (518:9): [True: 0, False: 0]
  ------------------
  519|      0|          cconvert->pub._color_convert = extbgrx_gray_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  520|      0|          break;
  521|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (521:9): [True: 0, False: 0]
  ------------------
  522|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (522:9): [True: 0, False: 0]
  ------------------
  523|      0|          cconvert->pub._color_convert = extxbgr_gray_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  524|      0|          break;
  525|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (525:9): [True: 0, False: 0]
  ------------------
  526|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (526:9): [True: 0, False: 0]
  ------------------
  527|      0|          cconvert->pub._color_convert = extxrgb_gray_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  528|      0|          break;
  529|      0|        default:
  ------------------
  |  Branch (529:9): [True: 0, False: 0]
  ------------------
  530|      0|          cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  531|      0|        }
  532|      0|      }
  533|      0|    } else if (cinfo->in_color_space == JCS_YCbCr)
  ------------------
  |  Branch (533:16): [True: 0, False: 0]
  ------------------
  534|      0|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  535|      0|    else
  536|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  537|  4.19k|    break;
  538|       |
  539|  14.7k|  case JCS_RGB:
  ------------------
  |  Branch (539:3): [True: 14.7k, False: 7.05k]
  ------------------
  540|  14.7k|#ifdef C_LOSSLESS_SUPPORTED
  541|  14.7k|    if (cinfo->master->lossless && !IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  14.7k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 14.7k]
  |  |  |  Branch (78:22): [True: 14.7k, False: 0]
  |  |  |  Branch (78:43): [True: 14.7k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (541:9): [True: 14.7k, False: 0]
  ------------------
  542|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  543|  14.7k|#endif
  544|  14.7k|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (544:9): [True: 0, False: 14.7k]
  ------------------
  545|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  546|  14.7k|    if (rgb_red[cinfo->in_color_space] == 0 &&
  ------------------
  |  Branch (546:9): [True: 5.95k, False: 8.81k]
  ------------------
  547|  5.95k|        rgb_green[cinfo->in_color_space] == 1 &&
  ------------------
  |  Branch (547:9): [True: 5.95k, False: 0]
  ------------------
  548|  5.95k|        rgb_blue[cinfo->in_color_space] == 2 &&
  ------------------
  |  Branch (548:9): [True: 5.95k, False: 0]
  ------------------
  549|  5.95k|        rgb_pixelsize[cinfo->in_color_space] == 3) {
  ------------------
  |  Branch (549:9): [True: 3.09k, False: 2.86k]
  ------------------
  550|  3.09k|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|  3.09k|#define _color_convert  color_convert
  ------------------
  551|  11.6k|    } else if (IsExtRGB(cinfo->in_color_space)) {
  ------------------
  |  |   78|  11.6k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 11.6k]
  |  |  |  Branch (78:22): [True: 11.6k, False: 0]
  |  |  |  Branch (78:43): [True: 11.6k, False: 0]
  |  |  ------------------
  ------------------
  552|  11.6k|      switch (cinfo->in_color_space) {
  553|      0|      case JCS_EXT_RGB:
  ------------------
  |  Branch (553:7): [True: 0, False: 11.6k]
  ------------------
  554|      0|        cconvert->pub._color_convert = extrgb_rgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  555|      0|        break;
  556|  2.86k|      case JCS_EXT_RGBX:
  ------------------
  |  Branch (556:7): [True: 2.86k, False: 8.81k]
  ------------------
  557|  2.86k|      case JCS_EXT_RGBA:
  ------------------
  |  Branch (557:7): [True: 0, False: 11.6k]
  ------------------
  558|  2.86k|        cconvert->pub._color_convert = extrgbx_rgb_convert;
  ------------------
  |  |  267|  2.86k|#define _color_convert  color_convert
  ------------------
  559|  2.86k|        break;
  560|  3.09k|      case JCS_EXT_BGR:
  ------------------
  |  Branch (560:7): [True: 3.09k, False: 8.58k]
  ------------------
  561|  3.09k|        cconvert->pub._color_convert = extbgr_rgb_convert;
  ------------------
  |  |  267|  3.09k|#define _color_convert  color_convert
  ------------------
  562|  3.09k|        break;
  563|      0|      case JCS_EXT_BGRX:
  ------------------
  |  Branch (563:7): [True: 0, False: 11.6k]
  ------------------
  564|  2.86k|      case JCS_EXT_BGRA:
  ------------------
  |  Branch (564:7): [True: 2.86k, False: 8.81k]
  ------------------
  565|  2.86k|        cconvert->pub._color_convert = extbgrx_rgb_convert;
  ------------------
  |  |  267|  2.86k|#define _color_convert  color_convert
  ------------------
  566|  2.86k|        break;
  567|      0|      case JCS_EXT_XBGR:
  ------------------
  |  Branch (567:7): [True: 0, False: 11.6k]
  ------------------
  568|      0|      case JCS_EXT_ABGR:
  ------------------
  |  Branch (568:7): [True: 0, False: 11.6k]
  ------------------
  569|      0|        cconvert->pub._color_convert = extxbgr_rgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  570|      0|        break;
  571|  2.86k|      case JCS_EXT_XRGB:
  ------------------
  |  Branch (571:7): [True: 2.86k, False: 8.81k]
  ------------------
  572|  2.86k|      case JCS_EXT_ARGB:
  ------------------
  |  Branch (572:7): [True: 0, False: 11.6k]
  ------------------
  573|  2.86k|        cconvert->pub._color_convert = extxrgb_rgb_convert;
  ------------------
  |  |  267|  2.86k|#define _color_convert  color_convert
  ------------------
  574|  2.86k|        break;
  575|      0|      default:
  ------------------
  |  Branch (575:7): [True: 0, False: 11.6k]
  ------------------
  576|      0|        cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  577|  11.6k|      }
  578|  11.6k|    } else
  579|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  580|  14.7k|    break;
  581|       |
  582|  14.7k|  case JCS_YCbCr:
  ------------------
  |  Branch (582:3): [True: 0, False: 21.8k]
  ------------------
  583|      0|#ifdef C_LOSSLESS_SUPPORTED
  584|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (584:9): [True: 0, False: 0]
  ------------------
  585|      0|        cinfo->in_color_space != cinfo->jpeg_color_space)
  ------------------
  |  Branch (585:9): [True: 0, False: 0]
  ------------------
  586|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  587|      0|#endif
  588|      0|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (588:9): [True: 0, False: 0]
  ------------------
  589|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  590|      0|    if (IsExtRGB(cinfo->in_color_space)) {
  ------------------
  |  |   78|      0|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 0]
  |  |  |  Branch (78:22): [True: 0, False: 0]
  |  |  |  Branch (78:43): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  591|      0|#ifdef WITH_SIMD
  592|      0|      if (jsimd_set_rgb_ycc(cinfo))
  ------------------
  |  Branch (592:11): [True: 0, False: 0]
  ------------------
  593|      0|        cconvert->pub._color_convert = jsimd_color_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  594|      0|      else
  595|      0|#endif
  596|      0|      {
  597|      0|        cconvert->pub.start_pass = rgb_ycc_start;
  598|      0|        switch (cinfo->in_color_space) {
  599|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (599:9): [True: 0, False: 0]
  ------------------
  600|      0|          cconvert->pub._color_convert = extrgb_ycc_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  601|      0|          break;
  602|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (602:9): [True: 0, False: 0]
  ------------------
  603|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (603:9): [True: 0, False: 0]
  ------------------
  604|      0|          cconvert->pub._color_convert = extrgbx_ycc_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  605|      0|          break;
  606|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (606:9): [True: 0, False: 0]
  ------------------
  607|      0|          cconvert->pub._color_convert = extbgr_ycc_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  608|      0|          break;
  609|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (609:9): [True: 0, False: 0]
  ------------------
  610|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (610:9): [True: 0, False: 0]
  ------------------
  611|      0|          cconvert->pub._color_convert = extbgrx_ycc_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  612|      0|          break;
  613|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (613:9): [True: 0, False: 0]
  ------------------
  614|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (614:9): [True: 0, False: 0]
  ------------------
  615|      0|          cconvert->pub._color_convert = extxbgr_ycc_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  616|      0|          break;
  617|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (617:9): [True: 0, False: 0]
  ------------------
  618|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (618:9): [True: 0, False: 0]
  ------------------
  619|      0|          cconvert->pub._color_convert = extxrgb_ycc_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  620|      0|          break;
  621|      0|        default:
  ------------------
  |  Branch (621:9): [True: 0, False: 0]
  ------------------
  622|      0|          cconvert->pub._color_convert = rgb_ycc_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  623|      0|        }
  624|      0|      }
  625|      0|    } else if (cinfo->in_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (625:16): [True: 0, False: 0]
  ------------------
  626|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  627|      0|    } else
  628|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  629|      0|    break;
  630|       |
  631|  2.86k|  case JCS_CMYK:
  ------------------
  |  Branch (631:3): [True: 2.86k, False: 18.9k]
  ------------------
  632|  2.86k|#ifdef C_LOSSLESS_SUPPORTED
  633|  2.86k|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (633:9): [True: 2.86k, False: 0]
  ------------------
  634|  2.86k|        cinfo->in_color_space != cinfo->jpeg_color_space)
  ------------------
  |  Branch (634:9): [True: 0, False: 2.86k]
  ------------------
  635|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  636|  2.86k|#endif
  637|  2.86k|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (637:9): [True: 0, False: 2.86k]
  ------------------
  638|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  639|  2.86k|    if (cinfo->in_color_space == JCS_CMYK) {
  ------------------
  |  Branch (639:9): [True: 2.86k, False: 0]
  ------------------
  640|  2.86k|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|  2.86k|#define _color_convert  color_convert
  ------------------
  641|  2.86k|    } else
  642|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  643|  2.86k|    break;
  644|       |
  645|      0|  case JCS_YCCK:
  ------------------
  |  Branch (645:3): [True: 0, False: 21.8k]
  ------------------
  646|      0|#ifdef C_LOSSLESS_SUPPORTED
  647|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (647:9): [True: 0, False: 0]
  ------------------
  648|      0|        cinfo->in_color_space != cinfo->jpeg_color_space)
  ------------------
  |  Branch (648:9): [True: 0, False: 0]
  ------------------
  649|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  650|      0|#endif
  651|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (651:9): [True: 0, False: 0]
  ------------------
  652|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  653|      0|    if (cinfo->in_color_space == JCS_CMYK) {
  ------------------
  |  Branch (653:9): [True: 0, False: 0]
  ------------------
  654|      0|      cconvert->pub.start_pass = rgb_ycc_start;
  655|      0|      cconvert->pub._color_convert = cmyk_ycck_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  656|      0|    } else if (cinfo->in_color_space == JCS_YCCK) {
  ------------------
  |  Branch (656:16): [True: 0, False: 0]
  ------------------
  657|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  658|      0|    } else
  659|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  660|      0|    break;
  661|       |
  662|      0|  default:                      /* allow null conversion of JCS_UNKNOWN */
  ------------------
  |  Branch (662:3): [True: 0, False: 21.8k]
  ------------------
  663|      0|    if (cinfo->jpeg_color_space != cinfo->in_color_space ||
  ------------------
  |  Branch (663:9): [True: 0, False: 0]
  ------------------
  664|      0|        cinfo->num_components != cinfo->input_components)
  ------------------
  |  Branch (664:9): [True: 0, False: 0]
  ------------------
  665|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  666|      0|    cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  667|      0|    break;
  668|  21.8k|  }
  669|  21.8k|}
jccolor-8.c:null_method:
  407|  21.8k|{
  408|       |  /* no work needed */
  409|  21.8k|}
jccolor-8.c:grayscale_convert:
  319|  1.51M|{
  320|  1.51M|  register _JSAMPROW inptr;
  321|  1.51M|  register _JSAMPROW outptr;
  322|  1.51M|  register JDIMENSION col;
  323|  1.51M|  JDIMENSION num_cols = cinfo->image_width;
  324|  1.51M|  int instride = cinfo->input_components;
  325|       |
  326|  3.03M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (326:10): [True: 1.51M, False: 1.51M]
  ------------------
  327|  1.51M|    inptr = *input_buf++;
  328|  1.51M|    outptr = output_buf[0][output_row];
  329|  1.51M|    output_row++;
  330|  10.9M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (330:19): [True: 9.47M, False: 1.51M]
  ------------------
  331|  9.47M|      outptr[col] = inptr[0];
  332|  9.47M|      inptr += instride;
  333|  9.47M|    }
  334|  1.51M|  }
  335|  1.51M|}
jccolor-8.c:null_convert:
  347|  4.61M|{
  348|  4.61M|  register _JSAMPROW inptr;
  349|  4.61M|  register _JSAMPROW outptr, outptr0, outptr1, outptr2, outptr3;
  350|  4.61M|  register JDIMENSION col;
  351|  4.61M|  register int ci;
  352|  4.61M|  int nc = cinfo->num_components;
  353|  4.61M|  JDIMENSION num_cols = cinfo->image_width;
  354|       |
  355|  4.61M|  if (nc == 3) {
  ------------------
  |  Branch (355:7): [True: 2.30M, False: 2.30M]
  ------------------
  356|  4.61M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (356:12): [True: 2.30M, False: 2.30M]
  ------------------
  357|  2.30M|      inptr = *input_buf++;
  358|  2.30M|      outptr0 = output_buf[0][output_row];
  359|  2.30M|      outptr1 = output_buf[1][output_row];
  360|  2.30M|      outptr2 = output_buf[2][output_row];
  361|  2.30M|      output_row++;
  362|  16.3M|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (362:21): [True: 14.0M, False: 2.30M]
  ------------------
  363|  14.0M|        outptr0[col] = *inptr++;
  364|  14.0M|        outptr1[col] = *inptr++;
  365|  14.0M|        outptr2[col] = *inptr++;
  366|  14.0M|      }
  367|  2.30M|    }
  368|  2.30M|  } else if (nc == 4) {
  ------------------
  |  Branch (368:14): [True: 2.30M, False: 0]
  ------------------
  369|  4.60M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (369:12): [True: 2.30M, False: 2.30M]
  ------------------
  370|  2.30M|      inptr = *input_buf++;
  371|  2.30M|      outptr0 = output_buf[0][output_row];
  372|  2.30M|      outptr1 = output_buf[1][output_row];
  373|  2.30M|      outptr2 = output_buf[2][output_row];
  374|  2.30M|      outptr3 = output_buf[3][output_row];
  375|  2.30M|      output_row++;
  376|  16.3M|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (376:21): [True: 14.0M, False: 2.30M]
  ------------------
  377|  14.0M|        outptr0[col] = *inptr++;
  378|  14.0M|        outptr1[col] = *inptr++;
  379|  14.0M|        outptr2[col] = *inptr++;
  380|  14.0M|        outptr3[col] = *inptr++;
  381|  14.0M|      }
  382|  2.30M|    }
  383|  2.30M|  } else {
  384|      0|    while (--num_rows >= 0) {
  ------------------
  |  Branch (384:12): [True: 0, False: 0]
  ------------------
  385|       |      /* It seems fastest to make a separate pass for each component. */
  386|      0|      for (ci = 0; ci < nc; ci++) {
  ------------------
  |  Branch (386:20): [True: 0, False: 0]
  ------------------
  387|      0|        inptr = *input_buf;
  388|      0|        outptr = output_buf[ci][output_row];
  389|      0|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (389:23): [True: 0, False: 0]
  ------------------
  390|      0|          outptr[col] = inptr[ci];
  391|      0|          inptr += nc;
  392|      0|        }
  393|      0|      }
  394|      0|      input_buf++;
  395|      0|      output_row++;
  396|      0|    }
  397|      0|  }
  398|  4.61M|}

jinit_c_diff_controller:
  344|  21.8k|{
  345|  21.8k|  my_diff_ptr diff;
  346|  21.8k|  int ci, row;
  347|  21.8k|  jpeg_component_info *compptr;
  348|       |
  349|  21.8k|#if BITS_IN_JSAMPLE == 8
  350|  21.8k|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  43.6k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (350:7): [True: 0, False: 21.8k]
  |  Branch (350:50): [True: 0, False: 21.8k]
  ------------------
  351|       |#else
  352|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  353|       |      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  354|       |#endif
  355|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  356|       |
  357|  21.8k|  diff = (my_diff_ptr)
  358|  21.8k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  21.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  359|  21.8k|                                sizeof(my_diff_controller));
  360|  21.8k|  cinfo->coef = (struct jpeg_c_coef_controller *)diff;
  361|  21.8k|  diff->pub.start_pass = start_pass_diff;
  362|       |
  363|       |  /* Create the prediction row buffers. */
  364|  81.7k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (364:44): [True: 59.9k, False: 21.8k]
  ------------------
  365|  59.9k|       ci++, compptr++) {
  366|  59.9k|    diff->cur_row[ci] = *(_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  367|  59.9k|      ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  59.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  368|  59.9k|       (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  369|  59.9k|                             (long)compptr->h_samp_factor),
  370|  59.9k|       (JDIMENSION)1);
  371|  59.9k|    diff->prev_row[ci] = *(_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  372|  59.9k|      ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  59.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  373|  59.9k|       (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|  59.9k|                             (long)compptr->h_samp_factor),
  375|  59.9k|       (JDIMENSION)1);
  376|  59.9k|  }
  377|       |
  378|       |  /* Create the difference buffer. */
  379|  81.7k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (379:44): [True: 59.9k, False: 21.8k]
  ------------------
  380|  59.9k|       ci++, compptr++) {
  381|  59.9k|    diff->diff_buf[ci] =
  382|  59.9k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  59.9k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  59.9k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  59.9k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  383|  59.9k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  384|  59.9k|                                         (long)compptr->h_samp_factor),
  385|  59.9k|                   (JDIMENSION)compptr->v_samp_factor);
  386|       |    /* Prefill difference rows with zeros.  We do this because only actual
  387|       |     * data is placed in the buffers during prediction/differencing, leaving
  388|       |     * any dummy differences at the right edge as zeros, which will encode
  389|       |     * to the smallest amount of data.
  390|       |     */
  391|   119k|    for (row = 0; row < compptr->v_samp_factor; row++)
  ------------------
  |  Branch (391:19): [True: 59.9k, False: 59.9k]
  ------------------
  392|  59.9k|      memset(diff->diff_buf[ci][row], 0,
  393|  59.9k|             jround_up((long)compptr->width_in_blocks,
  394|  59.9k|                       (long)compptr->h_samp_factor) * sizeof(JDIFF));
  395|  59.9k|  }
  396|       |
  397|       |  /* Create the sample buffer. */
  398|  21.8k|  if (need_full_buffer) {
  ------------------
  |  Branch (398:7): [True: 21.8k, False: 0]
  ------------------
  399|  21.8k|#ifdef FULL_SAMP_BUFFER_SUPPORTED
  400|       |    /* Allocate a full-image virtual array for each component, */
  401|       |    /* padded to a multiple of samp_factor differences in each direction. */
  402|  81.7k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (402:46): [True: 59.9k, False: 21.8k]
  ------------------
  403|  59.9k|         ci++, compptr++) {
  404|  59.9k|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  405|  59.9k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|  59.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|  59.9k|#define FALSE   0               /* values of boolean */
  ------------------
  406|  59.9k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  407|  59.9k|                               (long)compptr->h_samp_factor),
  408|  59.9k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  409|  59.9k|                               (long)compptr->v_samp_factor),
  410|  59.9k|         (JDIMENSION)compptr->v_samp_factor);
  411|  59.9k|    }
  412|       |#else
  413|       |    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  414|       |#endif
  415|  21.8k|  } else
  416|      0|    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  417|  21.8k|}
jcdiffct-8.c:start_pass_diff:
  102|  43.6k|{
  103|  43.6k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  104|       |
  105|       |  /* Because it is hitching a ride on the jpeg_forward_dct struct,
  106|       |   * start_pass_lossless() will be called at the start of the initial pass.
  107|       |   * This ensures that it will be called at the start of the Huffman
  108|       |   * optimization and output passes as well.
  109|       |   */
  110|  43.6k|  if (pass_mode == JBUF_CRANK_DEST)
  ------------------
  |  Branch (110:7): [True: 21.8k, False: 21.8k]
  ------------------
  111|  21.8k|    (*cinfo->fdct->start_pass) (cinfo);
  112|       |
  113|  43.6k|  diff->iMCU_row_num = 0;
  114|  43.6k|  start_iMCU_row(cinfo);
  115|       |
  116|  43.6k|  switch (pass_mode) {
  117|      0|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (117:3): [True: 0, False: 43.6k]
  ------------------
  118|      0|    if (diff->whole_image[0] != NULL)
  ------------------
  |  Branch (118:9): [True: 0, False: 0]
  ------------------
  119|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  120|      0|    diff->pub._compress_data = compress_data;
  ------------------
  |  |  248|      0|#define _compress_data  compress_data
  ------------------
  121|      0|    break;
  122|      0|#ifdef FULL_SAMP_BUFFER_SUPPORTED
  123|  21.8k|  case JBUF_SAVE_AND_PASS:
  ------------------
  |  Branch (123:3): [True: 21.8k, False: 21.8k]
  ------------------
  124|  21.8k|    if (diff->whole_image[0] == NULL)
  ------------------
  |  Branch (124:9): [True: 0, False: 21.8k]
  ------------------
  125|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  126|  21.8k|    diff->pub._compress_data = compress_first_pass;
  ------------------
  |  |  248|  21.8k|#define _compress_data  compress_data
  ------------------
  127|  21.8k|    break;
  128|  21.8k|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (128:3): [True: 21.8k, False: 21.8k]
  ------------------
  129|  21.8k|    if (diff->whole_image[0] == NULL)
  ------------------
  |  Branch (129:9): [True: 0, False: 21.8k]
  ------------------
  130|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  131|  21.8k|    diff->pub._compress_data = compress_output;
  ------------------
  |  |  248|  21.8k|#define _compress_data  compress_data
  ------------------
  132|  21.8k|    break;
  133|      0|#endif
  134|      0|  default:
  ------------------
  |  Branch (134:3): [True: 0, False: 43.6k]
  ------------------
  135|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  136|      0|    break;
  137|  43.6k|  }
  138|  43.6k|}
jcdiffct-8.c:start_iMCU_row:
   75|  30.7M|{
   76|  30.7M|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   77|       |
   78|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   79|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   80|       |   * But at the bottom of the image, process only what's left.
   81|       |   */
   82|  30.7M|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (82:7): [True: 27.6M, False: 3.04M]
  ------------------
   83|  27.6M|    diff->MCU_rows_per_iMCU_row = 1;
   84|  27.6M|  } else {
   85|  3.04M|    if (diff->iMCU_row_num < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (85:9): [True: 3.02M, False: 16.7k]
  ------------------
   86|  3.02M|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   87|  16.7k|    else
   88|  16.7k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   89|  3.04M|  }
   90|       |
   91|  30.7M|  diff->mcu_ctr = 0;
   92|  30.7M|  diff->MCU_vert_offset = 0;
   93|  30.7M|}
jcdiffct-8.c:compress_data:
  158|  30.6M|{
  159|  30.6M|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  160|  30.6M|  lossless_comp_ptr losslessc = (lossless_comp_ptr)cinfo->fdct;
  161|  30.6M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  162|  30.6M|  JDIMENSION MCU_count;         /* number of MCUs encoded */
  163|  30.6M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  164|  30.6M|  int ci, compi, yoffset, samp_row, samp_rows, samps_across;
  165|  30.6M|  jpeg_component_info *compptr;
  166|       |
  167|       |  /* Loop to write as much as one whole iMCU row */
  168|  61.3M|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (168:41): [True: 30.6M, False: 30.6M]
  ------------------
  169|  30.6M|       yoffset++) {
  170|       |
  171|  30.6M|    MCU_col_num = diff->mcu_ctr;
  172|       |
  173|       |    /* Scale and predict each scanline of the MCU row separately.
  174|       |     *
  175|       |     * Note: We only do this if we are at the start of an MCU row, ie,
  176|       |     * we don't want to reprocess a row suspended by the output.
  177|       |     */
  178|  30.6M|    if (MCU_col_num == 0) {
  ------------------
  |  Branch (178:9): [True: 30.6M, False: 0]
  ------------------
  179|   121M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (179:20): [True: 90.6M, False: 30.6M]
  ------------------
  180|  90.6M|        compptr = cinfo->cur_comp_info[ci];
  181|  90.6M|        compi = compptr->component_index;
  182|  90.6M|        if (diff->iMCU_row_num < last_iMCU_row)
  ------------------
  |  Branch (182:13): [True: 90.4M, False: 119k]
  ------------------
  183|  90.4M|          samp_rows = compptr->v_samp_factor;
  184|   119k|        else {
  185|       |          /* NB: can't use last_row_height here, since may not be set! */
  186|   119k|          samp_rows =
  187|   119k|            (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  188|   119k|          if (samp_rows == 0) samp_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (188:15): [True: 119k, False: 0]
  ------------------
  189|      0|          else {
  190|       |            /* Fill dummy difference rows at the bottom edge with zeros, which
  191|       |             * will encode to the smallest amount of data.
  192|       |             */
  193|      0|            for (samp_row = samp_rows; samp_row < compptr->v_samp_factor;
  ------------------
  |  Branch (193:40): [True: 0, False: 0]
  ------------------
  194|      0|                 samp_row++)
  195|      0|              memset(diff->diff_buf[compi][samp_row], 0,
  196|      0|                     jround_up((long)compptr->width_in_blocks,
  197|      0|                               (long)compptr->h_samp_factor) * sizeof(JDIFF));
  198|      0|          }
  199|   119k|        }
  200|  90.6M|        samps_across = compptr->width_in_blocks;
  201|       |
  202|   181M|        for (samp_row = 0; samp_row < samp_rows; samp_row++) {
  ------------------
  |  Branch (202:28): [True: 90.6M, False: 90.6M]
  ------------------
  203|  90.6M|          (*losslessc->scaler_scale) (cinfo,
  204|  90.6M|                                      input_buf[compi][samp_row],
  205|  90.6M|                                      diff->cur_row[compi],
  206|  90.6M|                                      samps_across);
  207|  90.6M|          (*losslessc->predict_difference[compi])
  208|  90.6M|            (cinfo, compi, diff->cur_row[compi], diff->prev_row[compi],
  209|  90.6M|             diff->diff_buf[compi][samp_row], samps_across);
  210|  90.6M|          SWAP_ROWS(diff->cur_row[compi], diff->prev_row[compi]);
  ------------------
  |  |  141|  90.6M|#define SWAP_ROWS(rowa, rowb) { \
  |  |  142|  90.6M|  _JSAMPROW temp = rowa; \
  |  |  ------------------
  |  |  |  |  229|  90.6M|#define _JSAMPROW  JSAMPROW
  |  |  ------------------
  |  |  143|  90.6M|  rowa = rowb;  rowb = temp; \
  |  |  144|  90.6M|}
  ------------------
  211|  90.6M|        }
  212|  90.6M|      }
  213|  30.6M|    }
  214|       |    /* Try to write the MCU row (or remaining portion of suspended MCU row). */
  215|  30.6M|    MCU_count =
  216|  30.6M|      (*cinfo->entropy->encode_mcus) (cinfo,
  217|  30.6M|                                      diff->diff_buf, yoffset, MCU_col_num,
  218|  30.6M|                                      cinfo->MCUs_per_row - MCU_col_num);
  219|  30.6M|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (219:9): [True: 0, False: 30.6M]
  ------------------
  220|       |      /* Suspension forced; update state counters and exit */
  221|      0|      diff->MCU_vert_offset = yoffset;
  222|      0|      diff->mcu_ctr += MCU_col_num;
  223|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  224|      0|    }
  225|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  226|  30.6M|    diff->mcu_ctr = 0;
  227|  30.6M|  }
  228|       |  /* Completed the iMCU row, advance counters for next one */
  229|  30.6M|  diff->iMCU_row_num++;
  230|  30.6M|  start_iMCU_row(cinfo);
  231|  30.6M|  return TRUE;
  ------------------
  |  |  210|  30.6M|#define TRUE    1
  ------------------
  232|  30.6M|}
jcdiffct-8.c:compress_first_pass:
  257|  15.3M|{
  258|  15.3M|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  259|  15.3M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  260|  15.3M|  JDIMENSION samps_across;
  261|  15.3M|  int ci, samp_row, samp_rows;
  262|  15.3M|  _JSAMPARRAY buffer;
  ------------------
  |  |  230|  15.3M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  263|  15.3M|  jpeg_component_info *compptr;
  264|       |
  265|  60.6M|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (265:44): [True: 45.3M, False: 15.3M]
  ------------------
  266|  45.3M|       ci++, compptr++) {
  267|       |    /* Align the virtual buffer for this component. */
  268|  45.3M|    buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  269|  45.3M|      ((j_common_ptr)cinfo, diff->whole_image[ci],
  270|  45.3M|       diff->iMCU_row_num * compptr->v_samp_factor,
  271|  45.3M|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  45.3M|#define TRUE    1
  ------------------
  272|       |
  273|       |    /* Count non-dummy sample rows in this iMCU row. */
  274|  45.3M|    if (diff->iMCU_row_num < last_iMCU_row)
  ------------------
  |  Branch (274:9): [True: 45.2M, False: 59.9k]
  ------------------
  275|  45.2M|      samp_rows = compptr->v_samp_factor;
  276|  59.9k|    else {
  277|       |      /* NB: can't use last_row_height here, since may not be set! */
  278|  59.9k|      samp_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  279|  59.9k|      if (samp_rows == 0) samp_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (279:11): [True: 59.9k, False: 0]
  ------------------
  280|  59.9k|    }
  281|  45.3M|    samps_across = compptr->width_in_blocks;
  282|       |
  283|       |    /* Perform point transform scaling and prediction/differencing for all
  284|       |     * non-dummy rows in this iMCU row.  Each call on these functions
  285|       |     * processes a complete row of samples.
  286|       |     */
  287|  90.6M|    for (samp_row = 0; samp_row < samp_rows; samp_row++) {
  ------------------
  |  Branch (287:24): [True: 45.3M, False: 45.3M]
  ------------------
  288|  45.3M|      memcpy(buffer[samp_row], input_buf[ci][samp_row],
  289|  45.3M|             samps_across * sizeof(_JSAMPLE));
  290|  45.3M|    }
  291|  45.3M|  }
  292|       |  /* NB: compress_output will increment iMCU_row_num if successful.
  293|       |   * A suspension return will result in redoing all the work above next time.
  294|       |   */
  295|       |
  296|       |  /* Emit data to the compressor, sharing code with subsequent passes */
  297|  15.3M|  return compress_output(cinfo, input_buf);
  298|  15.3M|}
jcdiffct-8.c:compress_output:
  313|  30.6M|{
  314|  30.6M|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  315|  30.6M|  int ci, compi;
  316|  30.6M|  _JSAMPARRAY buffer[MAX_COMPS_IN_SCAN];
  ------------------
  |  |  230|  30.6M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  317|  30.6M|  jpeg_component_info *compptr;
  318|       |
  319|       |  /* Align the virtual buffers for the components used in this scan.
  320|       |   * NB: during first pass, this is safe only because the buffers will
  321|       |   * already be aligned properly, so jmemmgr.c won't need to do any I/O.
  322|       |   */
  323|   121M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (323:16): [True: 90.6M, False: 30.6M]
  ------------------
  324|  90.6M|    compptr = cinfo->cur_comp_info[ci];
  325|  90.6M|    compi = compptr->component_index;
  326|  90.6M|    buffer[compi] = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  327|  90.6M|      ((j_common_ptr)cinfo, diff->whole_image[compi],
  328|  90.6M|       diff->iMCU_row_num * compptr->v_samp_factor,
  329|  90.6M|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  90.6M|#define FALSE   0               /* values of boolean */
  ------------------
  330|  90.6M|  }
  331|       |
  332|  30.6M|  return compress_data(cinfo, buffer);
  333|  30.6M|}

jpeg_make_c_derived_tbl:
  224|  59.9k|{
  225|  59.9k|  JHUFF_TBL *htbl;
  226|  59.9k|  c_derived_tbl *dtbl;
  227|  59.9k|  int p, i, l, lastp, si, maxsymbol;
  228|  59.9k|  char huffsize[257];
  229|  59.9k|  unsigned int huffcode[257];
  230|  59.9k|  unsigned int code;
  231|       |
  232|       |  /* Note that huffsize[] and huffcode[] are filled in code-length order,
  233|       |   * paralleling the order of the symbols themselves in htbl->huffval[].
  234|       |   */
  235|       |
  236|       |  /* Find the input Huffman table */
  237|  59.9k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  59.9k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (237:7): [True: 0, False: 59.9k]
  |  Branch (237:20): [True: 0, False: 59.9k]
  ------------------
  238|      0|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  239|  59.9k|  htbl =
  240|  59.9k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (240:5): [True: 59.9k, False: 0]
  ------------------
  241|  59.9k|  if (htbl == NULL)
  ------------------
  |  Branch (241:7): [True: 0, False: 59.9k]
  ------------------
  242|      0|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  243|       |
  244|       |  /* Allocate a workspace if we haven't already done so. */
  245|  59.9k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (245:7): [True: 21.8k, False: 38.1k]
  ------------------
  246|  21.8k|    *pdtbl = (c_derived_tbl *)
  247|  21.8k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  21.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  248|  21.8k|                                  sizeof(c_derived_tbl));
  249|  59.9k|  dtbl = *pdtbl;
  250|       |
  251|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  252|       |
  253|  59.9k|  p = 0;
  254|  1.01M|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (254:15): [True: 959k, False: 59.9k]
  ------------------
  255|   959k|    i = (int)htbl->bits[l];
  256|   959k|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (256:9): [True: 0, False: 959k]
  |  Branch (256:18): [True: 0, False: 959k]
  ------------------
  257|      0|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  258|  1.30M|    while (i--)
  ------------------
  |  Branch (258:12): [True: 347k, False: 959k]
  ------------------
  259|   347k|      huffsize[p++] = (char)l;
  260|   959k|  }
  261|  59.9k|  huffsize[p] = 0;
  262|  59.9k|  lastp = p;
  263|       |
  264|       |  /* Figure C.2: generate the codes themselves */
  265|       |  /* We also validate that the counts represent a legal Huffman code tree. */
  266|       |
  267|  59.9k|  code = 0;
  268|  59.9k|  si = huffsize[0];
  269|  59.9k|  p = 0;
  270|   326k|  while (huffsize[p]) {
  ------------------
  |  Branch (270:10): [True: 266k, False: 59.9k]
  ------------------
  271|   613k|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (271:12): [True: 347k, False: 266k]
  ------------------
  272|   347k|      huffcode[p++] = code;
  273|   347k|      code++;
  274|   347k|    }
  275|       |    /* code is now 1 more than the last code used for codelength si; but
  276|       |     * it must still fit in si bits, since no code is allowed to be all ones.
  277|       |     */
  278|   266k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (278:9): [True: 0, False: 266k]
  ------------------
  279|      0|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  280|   266k|    code <<= 1;
  281|   266k|    si++;
  282|   266k|  }
  283|       |
  284|       |  /* Figure C.3: generate encoding tables */
  285|       |  /* These are code and size indexed by symbol value */
  286|       |
  287|       |  /* Set all codeless symbols to have code length 0;
  288|       |   * this lets us detect duplicate VAL entries here, and later
  289|       |   * allows emit_bits to detect any attempt to emit such symbols.
  290|       |   */
  291|  59.9k|  memset(dtbl->ehufco, 0, sizeof(dtbl->ehufco));
  292|  59.9k|  memset(dtbl->ehufsi, 0, sizeof(dtbl->ehufsi));
  293|       |
  294|       |  /* This is also a convenient place to check for out-of-range and duplicated
  295|       |   * VAL entries.  We allow 0..255 for AC symbols but only 0..15 for DC in
  296|       |   * lossy mode and 0..16 for DC in lossless mode.  (We could constrain them
  297|       |   * further based on data depth and mode, but this seems enough.)
  298|       |   */
  299|  59.9k|  maxsymbol = isDC ? (cinfo->master->lossless ? 16 : 15) : 255;
  ------------------
  |  Branch (299:15): [True: 59.9k, False: 0]
  |  Branch (299:23): [True: 59.9k, False: 0]
  ------------------
  300|       |
  301|   407k|  for (p = 0; p < lastp; p++) {
  ------------------
  |  Branch (301:15): [True: 347k, False: 59.9k]
  ------------------
  302|   347k|    i = htbl->huffval[p];
  303|   347k|    if (i < 0 || i > maxsymbol || dtbl->ehufsi[i])
  ------------------
  |  Branch (303:9): [True: 0, False: 347k]
  |  Branch (303:18): [True: 0, False: 347k]
  |  Branch (303:35): [True: 0, False: 347k]
  ------------------
  304|      0|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  305|   347k|    dtbl->ehufco[i] = huffcode[p];
  306|   347k|    dtbl->ehufsi[i] = huffsize[p];
  307|   347k|  }
  308|  59.9k|}
jpeg_gen_optimal_table:
  931|  21.8k|{
  932|  21.8k|#define MAX_CLEN  32            /* assumed maximum initial code length */
  933|       |  /* The array length is MAX_CLEN + 2 rather than MAX_CLEN + 1 to work around a
  934|       |   * -Wstringop-overflow false positive with GCC 12 and later.
  935|       |   */
  936|  21.8k|  UINT8 bits[MAX_CLEN + 2];     /* bits[k] = # of symbols with code length k */
  937|  21.8k|  int bit_pos[MAX_CLEN + 1];    /* # of symbols with smaller code length */
  938|  21.8k|  int codesize[257];            /* codesize[k] = code length of symbol k */
  939|  21.8k|  int nz_index[257];            /* index of nonzero symbol in the original freq
  940|       |                                   array */
  941|  21.8k|  int others[257];              /* next symbol in current branch of tree */
  942|  21.8k|  int c1, c2;
  943|  21.8k|  int p, i, j;
  944|  21.8k|  int num_nz_symbols;
  945|  21.8k|  long v, v2;
  946|       |
  947|       |  /* This algorithm is explained in section K.2 of the JPEG standard */
  948|       |
  949|  21.8k|  memset(bits, 0, sizeof(bits));
  950|  21.8k|  memset(codesize, 0, sizeof(codesize));
  951|  5.63M|  for (i = 0; i < 257; i++)
  ------------------
  |  Branch (951:15): [True: 5.60M, False: 21.8k]
  ------------------
  952|  5.60M|    others[i] = -1;             /* init links to empty */
  953|       |
  954|  21.8k|  freq[256] = 1;                /* make sure 256 has a nonzero count */
  955|       |  /* Including the pseudo-symbol 256 in the Huffman procedure guarantees
  956|       |   * that no real symbol is given code-value of all ones, because 256
  957|       |   * will be placed last in the largest codeword category.
  958|       |   */
  959|       |
  960|       |  /* Group nonzero frequencies together so we can more easily find the
  961|       |   * smallest.
  962|       |   */
  963|  21.8k|  num_nz_symbols = 0;
  964|  5.63M|  for (i = 0; i < 257; i++) {
  ------------------
  |  Branch (964:15): [True: 5.60M, False: 21.8k]
  ------------------
  965|  5.60M|    if (freq[i]) {
  ------------------
  |  Branch (965:9): [True: 148k, False: 5.46M]
  ------------------
  966|   148k|      nz_index[num_nz_symbols] = i;
  967|   148k|      freq[num_nz_symbols] = freq[i];
  968|   148k|      num_nz_symbols++;
  969|   148k|    }
  970|  5.60M|  }
  971|       |
  972|       |  /* Huffman's basic algorithm to assign optimal code lengths to symbols */
  973|       |
  974|   148k|  for (;;) {
  975|       |    /* Find the two smallest nonzero frequencies; set c1, c2 = their symbols */
  976|       |    /* In case of ties, take the larger symbol number.  Since we have grouped
  977|       |     * the nonzero symbols together, checking for zero symbols is not
  978|       |     * necessary.
  979|       |     */
  980|   148k|    c1 = -1;
  981|   148k|    c2 = -1;
  982|   148k|    v = 1000000000L;
  983|   148k|    v2 = 1000000000L;
  984|  1.31M|    for (i = 0; i < num_nz_symbols; i++) {
  ------------------
  |  Branch (984:17): [True: 1.16M, False: 148k]
  ------------------
  985|  1.16M|      if (freq[i] <= v2) {
  ------------------
  |  Branch (985:11): [True: 445k, False: 722k]
  ------------------
  986|   445k|        if (freq[i] <= v) {
  ------------------
  |  Branch (986:13): [True: 334k, False: 110k]
  ------------------
  987|   334k|          c2 = c1;
  988|   334k|          v2 = v;
  989|   334k|          v = freq[i];
  990|   334k|          c1 = i;
  991|   334k|        } else {
  992|   110k|          v2 = freq[i];
  993|   110k|          c2 = i;
  994|   110k|        }
  995|   445k|      }
  996|  1.16M|    }
  997|       |
  998|       |    /* Done if we've merged everything into one frequency */
  999|   148k|    if (c2 < 0)
  ------------------
  |  Branch (999:9): [True: 21.8k, False: 126k]
  ------------------
 1000|  21.8k|      break;
 1001|       |
 1002|       |    /* Else merge the two counts/trees */
 1003|   126k|    freq[c1] += freq[c2];
 1004|       |    /* Set the frequency to a very high value instead of zero, so we don't have
 1005|       |     * to check for zero values.
 1006|       |     */
 1007|   126k|    freq[c2] = 1000000001L;
 1008|       |
 1009|       |    /* Increment the codesize of everything in c1's tree branch */
 1010|   126k|    codesize[c1]++;
 1011|   272k|    while (others[c1] >= 0) {
  ------------------
  |  Branch (1011:12): [True: 145k, False: 126k]
  ------------------
 1012|   145k|      c1 = others[c1];
 1013|   145k|      codesize[c1]++;
 1014|   145k|    }
 1015|       |
 1016|   126k|    others[c1] = c2;            /* chain c2 onto c1's tree branch */
 1017|       |
 1018|       |    /* Increment the codesize of everything in c2's tree branch */
 1019|   126k|    codesize[c2]++;
 1020|   263k|    while (others[c2] >= 0) {
  ------------------
  |  Branch (1020:12): [True: 137k, False: 126k]
  ------------------
 1021|   137k|      c2 = others[c2];
 1022|   137k|      codesize[c2]++;
 1023|   137k|    }
 1024|   126k|  }
 1025|       |
 1026|       |  /* Now count the number of symbols of each code length */
 1027|   170k|  for (i = 0; i < num_nz_symbols; i++) {
  ------------------
  |  Branch (1027:15): [True: 148k, False: 21.8k]
  ------------------
 1028|       |    /* The JPEG standard seems to think that this can't happen, */
 1029|       |    /* but I'm paranoid... */
 1030|   148k|    if (codesize[i] > MAX_CLEN)
  ------------------
  |  |  932|   148k|#define MAX_CLEN  32            /* assumed maximum initial code length */
  ------------------
  |  Branch (1030:9): [True: 0, False: 148k]
  ------------------
 1031|      0|      ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1032|       |
 1033|   148k|    bits[codesize[i]]++;
 1034|   148k|  }
 1035|       |
 1036|       |  /* Count the number of symbols with a length smaller than i bits, so we can
 1037|       |   * construct the symbol table more efficiently.  Note that this includes the
 1038|       |   * pseudo-symbol 256, but since it is the last symbol, it will not affect the
 1039|       |   * table.
 1040|       |   */
 1041|  21.8k|  p = 0;
 1042|   720k|  for (i = 1; i <= MAX_CLEN; i++) {
  ------------------
  |  |  932|   720k|#define MAX_CLEN  32            /* assumed maximum initial code length */
  ------------------
  |  Branch (1042:15): [True: 698k, False: 21.8k]
  ------------------
 1043|   698k|    bit_pos[i] = p;
 1044|   698k|    p += bits[i];
 1045|   698k|  }
 1046|       |
 1047|       |  /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
 1048|       |   * Huffman procedure assigned any such lengths, we must adjust the coding.
 1049|       |   * Here is what Rec. ITU-T T.81 | ISO/IEC 10918-1 says about how this next
 1050|       |   * bit works: Since symbols are paired for the longest Huffman code, the
 1051|       |   * symbols are removed from this length category two at a time.  The prefix
 1052|       |   * for the pair (which is one bit shorter) is allocated to one of the pair;
 1053|       |   * then, skipping the BITS entry for that prefix length, a code word from the
 1054|       |   * next shortest nonzero BITS entry is converted into a prefix for two code
 1055|       |   * words one bit longer.
 1056|       |   */
 1057|       |
 1058|   371k|  for (i = MAX_CLEN; i > 16; i--) {
  ------------------
  |  |  932|  21.8k|#define MAX_CLEN  32            /* assumed maximum initial code length */
  ------------------
  |  Branch (1058:22): [True: 349k, False: 21.8k]
  ------------------
 1059|   349k|    while (bits[i] > 0) {
  ------------------
  |  Branch (1059:12): [True: 0, False: 349k]
  ------------------
 1060|      0|      j = i - 2;                /* find length of new prefix to be used */
 1061|      0|      while (bits[j] == 0)
  ------------------
  |  Branch (1061:14): [True: 0, False: 0]
  ------------------
 1062|      0|        j--;
 1063|       |
 1064|      0|      bits[i] -= 2;             /* remove two symbols */
 1065|      0|      bits[i - 1]++;            /* one goes in this length */
 1066|      0|      bits[j + 1] += 2;         /* two new symbols in this length */
 1067|      0|      bits[j]--;                /* symbol of this length is now a prefix */
 1068|      0|    }
 1069|   349k|  }
 1070|       |
 1071|       |  /* Remove the count for the pseudo-symbol 256 from the largest codelength */
 1072|   266k|  while (bits[i] == 0)          /* find largest codelength still in use */
  ------------------
  |  Branch (1072:10): [True: 244k, False: 21.8k]
  ------------------
 1073|   244k|    i--;
 1074|  21.8k|  bits[i]--;
 1075|       |
 1076|       |  /* Return final symbol counts (only for lengths 0..16) */
 1077|  21.8k|  memcpy(htbl->bits, bits, sizeof(htbl->bits));
 1078|       |
 1079|       |  /* Return a list of the symbols sorted by code length */
 1080|       |  /* It's not real clear to me why we don't need to consider the codelength
 1081|       |   * changes made above, but Rec. ITU-T T.81 | ISO/IEC 10918-1 seems to think
 1082|       |   * this works.
 1083|       |   */
 1084|   148k|  for (i = 0; i < num_nz_symbols - 1; i++) {
  ------------------
  |  Branch (1084:15): [True: 126k, False: 21.8k]
  ------------------
 1085|   126k|    htbl->huffval[bit_pos[codesize[i]]] = (UINT8)nz_index[i];
 1086|   126k|    bit_pos[codesize[i]]++;
 1087|   126k|  }
 1088|       |
 1089|       |  /* Set sent_table FALSE so updated table will be written to JPEG file. */
 1090|  21.8k|  htbl->sent_table = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
 1091|  21.8k|}

jpeg_write_icc_profile:
   51|  19.9k|{
   52|  19.9k|  unsigned int num_markers;     /* total number of markers we'll write */
   53|  19.9k|  int cur_marker = 1;           /* per spec, counting starts at 1 */
   54|  19.9k|  unsigned int length;          /* number of bytes to write in this marker */
   55|       |
   56|  19.9k|  if (icc_data_ptr == NULL || icc_data_len == 0)
  ------------------
  |  Branch (56:7): [True: 0, False: 19.9k]
  |  Branch (56:31): [True: 0, False: 19.9k]
  ------------------
   57|      0|    ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   58|  19.9k|  if (cinfo->global_state < CSTATE_SCANNING)
  ------------------
  |  |   45|  19.9k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (58:7): [True: 0, False: 19.9k]
  ------------------
   59|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   60|       |
   61|       |  /* Calculate the number of markers we'll need, rounding up of course */
   62|  19.9k|  num_markers = icc_data_len / MAX_DATA_BYTES_IN_MARKER;
  ------------------
  |  |   38|  19.9k|#define MAX_DATA_BYTES_IN_MARKER  (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
  |  |  ------------------
  |  |  |  |   37|  19.9k|#define MAX_BYTES_IN_MARKER  65533      /* maximum data len of a JPEG marker */
  |  |  ------------------
  |  |               #define MAX_DATA_BYTES_IN_MARKER  (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
  |  |  ------------------
  |  |  |  |   36|  19.9k|#define ICC_OVERHEAD_LEN  14            /* size of non-profile data in APP2 */
  |  |  ------------------
  ------------------
   63|  19.9k|  if (num_markers * MAX_DATA_BYTES_IN_MARKER != icc_data_len)
  ------------------
  |  |   38|  19.9k|#define MAX_DATA_BYTES_IN_MARKER  (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
  |  |  ------------------
  |  |  |  |   37|  19.9k|#define MAX_BYTES_IN_MARKER  65533      /* maximum data len of a JPEG marker */
  |  |  ------------------
  |  |               #define MAX_DATA_BYTES_IN_MARKER  (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
  |  |  ------------------
  |  |  |  |   36|  19.9k|#define ICC_OVERHEAD_LEN  14            /* size of non-profile data in APP2 */
  |  |  ------------------
  ------------------
  |  Branch (63:7): [True: 19.9k, False: 0]
  ------------------
   64|  19.9k|    num_markers++;
   65|       |
   66|  39.9k|  while (icc_data_len > 0) {
  ------------------
  |  Branch (66:10): [True: 19.9k, False: 19.9k]
  ------------------
   67|       |    /* length of profile to put in this marker */
   68|  19.9k|    length = icc_data_len;
   69|  19.9k|    if (length > MAX_DATA_BYTES_IN_MARKER)
  ------------------
  |  |   38|  19.9k|#define MAX_DATA_BYTES_IN_MARKER  (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
  |  |  ------------------
  |  |  |  |   37|  19.9k|#define MAX_BYTES_IN_MARKER  65533      /* maximum data len of a JPEG marker */
  |  |  ------------------
  |  |               #define MAX_DATA_BYTES_IN_MARKER  (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
  |  |  ------------------
  |  |  |  |   36|  19.9k|#define ICC_OVERHEAD_LEN  14            /* size of non-profile data in APP2 */
  |  |  ------------------
  ------------------
  |  Branch (69:9): [True: 0, False: 19.9k]
  ------------------
   70|      0|      length = MAX_DATA_BYTES_IN_MARKER;
  ------------------
  |  |   38|      0|#define MAX_DATA_BYTES_IN_MARKER  (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
  |  |  ------------------
  |  |  |  |   37|      0|#define MAX_BYTES_IN_MARKER  65533      /* maximum data len of a JPEG marker */
  |  |  ------------------
  |  |               #define MAX_DATA_BYTES_IN_MARKER  (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
  |  |  ------------------
  |  |  |  |   36|      0|#define ICC_OVERHEAD_LEN  14            /* size of non-profile data in APP2 */
  |  |  ------------------
  ------------------
   71|  19.9k|    icc_data_len -= length;
   72|       |
   73|       |    /* Write the JPEG marker header (APP2 code and marker length) */
   74|  19.9k|    jpeg_write_m_header(cinfo, ICC_MARKER,
  ------------------
  |  |   35|  19.9k|#define ICC_MARKER  (JPEG_APP0 + 2)     /* JPEG marker code for ICC */
  |  |  ------------------
  |  |  |  | 1168|  19.9k|#define JPEG_APP0       0xE0    /* APP0 marker code */
  |  |  ------------------
  ------------------
   75|  19.9k|                        (unsigned int)(length + ICC_OVERHEAD_LEN));
  ------------------
  |  |   36|  19.9k|#define ICC_OVERHEAD_LEN  14            /* size of non-profile data in APP2 */
  ------------------
   76|       |
   77|       |    /* Write the marker identifying string "ICC_PROFILE" (null-terminated).  We
   78|       |     * code it in this less-than-transparent way so that the code works even if
   79|       |     * the local character set is not ASCII.
   80|       |     */
   81|  19.9k|    jpeg_write_m_byte(cinfo, 0x49);
   82|  19.9k|    jpeg_write_m_byte(cinfo, 0x43);
   83|  19.9k|    jpeg_write_m_byte(cinfo, 0x43);
   84|  19.9k|    jpeg_write_m_byte(cinfo, 0x5F);
   85|  19.9k|    jpeg_write_m_byte(cinfo, 0x50);
   86|  19.9k|    jpeg_write_m_byte(cinfo, 0x52);
   87|  19.9k|    jpeg_write_m_byte(cinfo, 0x4F);
   88|  19.9k|    jpeg_write_m_byte(cinfo, 0x46);
   89|  19.9k|    jpeg_write_m_byte(cinfo, 0x49);
   90|  19.9k|    jpeg_write_m_byte(cinfo, 0x4C);
   91|  19.9k|    jpeg_write_m_byte(cinfo, 0x45);
   92|  19.9k|    jpeg_write_m_byte(cinfo, 0x0);
   93|       |
   94|       |    /* Add the sequencing info */
   95|  19.9k|    jpeg_write_m_byte(cinfo, cur_marker);
   96|  19.9k|    jpeg_write_m_byte(cinfo, (int)num_markers);
   97|       |
   98|       |    /* Add the profile data */
   99|   659k|    while (length--) {
  ------------------
  |  Branch (99:12): [True: 639k, False: 19.9k]
  ------------------
  100|   639k|      jpeg_write_m_byte(cinfo, *icc_data_ptr);
  101|   639k|      icc_data_ptr++;
  102|   639k|    }
  103|  19.9k|    cur_marker++;
  104|  19.9k|  }
  105|  19.9k|}

jinit_compress_master:
   37|  21.8k|{
   38|       |  /* Initialize master control (includes parameter checking/processing) */
   39|  21.8k|  jinit_c_master_control(cinfo, FALSE /* full compression */);
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
   40|       |
   41|       |  /* Preprocessing */
   42|  21.8k|  if (!cinfo->raw_data_in) {
  ------------------
  |  Branch (42:7): [True: 21.8k, False: 0]
  ------------------
   43|  21.8k|    if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (43:9): [True: 21.8k, False: 0]
  ------------------
   44|  21.8k|      jinit_color_converter(cinfo);
   45|  21.8k|      jinit_downsampler(cinfo);
   46|  21.8k|      jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
   47|  21.8k|    } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (47:16): [True: 0, False: 0]
  ------------------
   48|      0|      j12init_color_converter(cinfo);
   49|      0|      j12init_downsampler(cinfo);
   50|      0|      j12init_c_prep_controller(cinfo,
   51|      0|                                FALSE /* never need full buffer here */);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   52|      0|    } else {
   53|      0|#ifdef C_LOSSLESS_SUPPORTED
   54|      0|      j16init_color_converter(cinfo);
   55|      0|      j16init_downsampler(cinfo);
   56|      0|      j16init_c_prep_controller(cinfo,
   57|      0|                                FALSE /* never need full buffer here */);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   58|       |#else
   59|       |      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
   60|       |#endif
   61|      0|    }
   62|  21.8k|  }
   63|       |
   64|  21.8k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (64:7): [True: 21.8k, False: 0]
  ------------------
   65|  21.8k|#ifdef C_LOSSLESS_SUPPORTED
   66|       |    /* Prediction, sample differencing, and point transform */
   67|  21.8k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (67:9): [True: 21.8k, False: 0]
  ------------------
   68|  21.8k|      jinit_lossless_compressor(cinfo);
   69|      0|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (69:14): [True: 0, False: 0]
  ------------------
   70|      0|      j12init_lossless_compressor(cinfo);
   71|      0|    else
   72|      0|      j16init_lossless_compressor(cinfo);
   73|       |    /* Entropy encoding: either Huffman or arithmetic coding. */
   74|  21.8k|    if (cinfo->arith_code) {
  ------------------
  |  Branch (74:9): [True: 0, False: 21.8k]
  ------------------
   75|      0|      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   76|  21.8k|    } else {
   77|  21.8k|      jinit_lhuff_encoder(cinfo);
   78|  21.8k|    }
   79|       |
   80|       |    /* Need a full-image difference buffer in any multi-pass mode. */
   81|  21.8k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (81:9): [True: 21.8k, False: 0]
  ------------------
   82|  21.8k|      jinit_c_diff_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
  ------------------
  |  Branch (82:48): [True: 0, False: 21.8k]
  ------------------
   83|  21.8k|                                               cinfo->optimize_coding));
  ------------------
  |  Branch (83:48): [True: 21.8k, False: 0]
  ------------------
   84|      0|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (84:14): [True: 0, False: 0]
  ------------------
   85|      0|      j12init_c_diff_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
  ------------------
  |  Branch (85:50): [True: 0, False: 0]
  ------------------
   86|      0|                                                 cinfo->optimize_coding));
  ------------------
  |  Branch (86:50): [True: 0, False: 0]
  ------------------
   87|      0|    else
   88|      0|      j16init_c_diff_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
  ------------------
  |  Branch (88:50): [True: 0, False: 0]
  ------------------
   89|      0|                                                 cinfo->optimize_coding));
  ------------------
  |  Branch (89:50): [True: 0, False: 0]
  ------------------
   90|       |#else
   91|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
   92|       |#endif
   93|  21.8k|  } else {
   94|      0|#if defined(DCT_ISLOW_SUPPORTED) || defined(DCT_IFAST_SUPPORTED) || \
   95|      0|    defined(DCT_FLOAT_SUPPORTED)
   96|       |    /* Forward DCT */
   97|      0|    if (cinfo->data_precision == 8)
  ------------------
  |  Branch (97:9): [True: 0, False: 0]
  ------------------
   98|      0|      jinit_forward_dct(cinfo);
   99|      0|    else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (99:14): [True: 0, False: 0]
  ------------------
  100|      0|      j12init_forward_dct(cinfo);
  101|      0|    else
  102|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  103|       |    /* Entropy encoding: either Huffman or arithmetic coding. */
  104|      0|    if (cinfo->arith_code) {
  ------------------
  |  Branch (104:9): [True: 0, False: 0]
  ------------------
  105|      0|#ifdef C_ARITH_CODING_SUPPORTED
  106|      0|      jinit_arith_encoder(cinfo);
  107|       |#else
  108|       |      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  109|       |#endif
  110|      0|    } else {
  111|      0|      if (cinfo->progressive_mode) {
  ------------------
  |  Branch (111:11): [True: 0, False: 0]
  ------------------
  112|      0|#ifdef C_PROGRESSIVE_SUPPORTED
  113|      0|        jinit_phuff_encoder(cinfo);
  114|       |#else
  115|       |        ERREXIT(cinfo, JERR_NOT_COMPILED);
  116|       |#endif
  117|      0|      } else
  118|      0|        jinit_huff_encoder(cinfo);
  119|      0|    }
  120|       |
  121|       |    /* Need a full-image coefficient buffer in any multi-pass mode. */
  122|      0|    if (cinfo->data_precision == 12)
  ------------------
  |  Branch (122:9): [True: 0, False: 0]
  ------------------
  123|      0|      j12init_c_coef_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
  ------------------
  |  Branch (123:50): [True: 0, False: 0]
  ------------------
  124|      0|                                                 cinfo->optimize_coding));
  ------------------
  |  Branch (124:50): [True: 0, False: 0]
  ------------------
  125|      0|    else
  126|      0|      jinit_c_coef_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
  ------------------
  |  Branch (126:48): [True: 0, False: 0]
  ------------------
  127|      0|                                               cinfo->optimize_coding));
  ------------------
  |  Branch (127:48): [True: 0, False: 0]
  ------------------
  128|       |#else
  129|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  130|       |#endif
  131|      0|  }
  132|       |
  133|  21.8k|  if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (133:7): [True: 21.8k, False: 0]
  ------------------
  134|  21.8k|    jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  135|      0|  else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (135:12): [True: 0, False: 0]
  ------------------
  136|      0|    j12init_c_main_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  137|      0|  else
  138|      0|#ifdef C_LOSSLESS_SUPPORTED
  139|      0|    j16init_c_main_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  140|       |#else
  141|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  142|       |#endif
  143|       |
  144|  21.8k|  jinit_marker_writer(cinfo);
  145|       |
  146|       |  /* We can now tell the memory manager to allocate virtual arrays. */
  147|  21.8k|  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
  148|       |
  149|       |  /* Write the datastream header (SOI) immediately.
  150|       |   * Frame and scan headers are postponed till later.
  151|       |   * This lets application insert special markers after the SOI.
  152|       |   */
  153|  21.8k|  (*cinfo->marker->write_file_header) (cinfo);
  154|  21.8k|}

jinit_lhuff_encoder:
  570|  21.8k|{
  571|  21.8k|  lhuff_entropy_ptr entropy;
  572|  21.8k|  int i;
  573|       |
  574|  21.8k|  entropy = (lhuff_entropy_ptr)
  575|  21.8k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  21.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  576|  21.8k|                                sizeof(lhuff_entropy_encoder));
  577|  21.8k|  cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
  578|  21.8k|  entropy->pub.start_pass = start_pass_lhuff;
  579|       |
  580|       |  /* Mark tables unallocated */
  581|   109k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|   109k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (581:15): [True: 87.2k, False: 21.8k]
  ------------------
  582|  87.2k|    entropy->derived_tbls[i] = NULL;
  583|  87.2k|#ifdef ENTROPY_OPT_SUPPORTED
  584|       |    entropy->count_ptrs[i] = NULL;
  585|  87.2k|#endif
  586|  87.2k|  }
  587|  21.8k|}
jclhuff.c:start_pass_lhuff:
  137|  43.6k|{
  138|  43.6k|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
  139|  43.6k|  int ci, dctbl, sampn, ptrn, yoffset, xoffset;
  140|  43.6k|  jpeg_component_info *compptr;
  141|       |
  142|  43.6k|  if (gather_statistics) {
  ------------------
  |  Branch (142:7): [True: 21.8k, False: 21.8k]
  ------------------
  143|  21.8k|#ifdef ENTROPY_OPT_SUPPORTED
  144|  21.8k|    entropy->pub.encode_mcus = encode_mcus_gather;
  145|  21.8k|    entropy->pub.finish_pass = finish_pass_gather;
  146|       |#else
  147|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  148|       |#endif
  149|  21.8k|  } else {
  150|  21.8k|    entropy->pub.encode_mcus = encode_mcus_huff;
  151|  21.8k|    entropy->pub.finish_pass = finish_pass_huff;
  152|  21.8k|  }
  153|       |
  154|   163k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (154:16): [True: 119k, False: 43.6k]
  ------------------
  155|   119k|    compptr = cinfo->cur_comp_info[ci];
  156|   119k|    dctbl = compptr->dc_tbl_no;
  157|   119k|    if (gather_statistics) {
  ------------------
  |  Branch (157:9): [True: 59.9k, False: 59.9k]
  ------------------
  158|  59.9k|#ifdef ENTROPY_OPT_SUPPORTED
  159|       |      /* Check for invalid table indexes */
  160|       |      /* (make_c_derived_tbl does this in the other path) */
  161|  59.9k|      if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  59.9k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (161:11): [True: 0, False: 59.9k]
  |  Branch (161:24): [True: 0, False: 59.9k]
  ------------------
  162|      0|        ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  163|       |      /* Allocate and zero the statistics tables */
  164|       |      /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
  165|  59.9k|      if (entropy->count_ptrs[dctbl] == NULL)
  ------------------
  |  Branch (165:11): [True: 21.8k, False: 38.1k]
  ------------------
  166|  21.8k|        entropy->count_ptrs[dctbl] = (long *)
  167|  21.8k|          (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  21.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  168|  21.8k|                                      257 * sizeof(long));
  169|  59.9k|      memset(entropy->count_ptrs[dctbl], 0, 257 * sizeof(long));
  170|  59.9k|#endif
  171|  59.9k|    } else {
  172|       |      /* Compute derived values for Huffman tables */
  173|       |      /* We may do this more than once for a table, but it's not expensive */
  174|  59.9k|      jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,
  ------------------
  |  |  210|  59.9k|#define TRUE    1
  ------------------
  175|  59.9k|                              &entropy->derived_tbls[dctbl]);
  176|  59.9k|    }
  177|   119k|  }
  178|       |
  179|       |  /* Precalculate encoding info for each sample in an MCU of this scan */
  180|   163k|  for (sampn = 0, ptrn = 0; sampn < cinfo->blocks_in_MCU;) {
  ------------------
  |  Branch (180:29): [True: 119k, False: 43.6k]
  ------------------
  181|   119k|    compptr = cinfo->cur_comp_info[cinfo->MCU_membership[sampn]];
  182|   119k|    ci = compptr->component_index;
  183|   239k|    for (yoffset = 0; yoffset < compptr->MCU_height; yoffset++, ptrn++) {
  ------------------
  |  Branch (183:23): [True: 119k, False: 119k]
  ------------------
  184|       |      /* Precalculate the setup info for each input pointer */
  185|   119k|      entropy->input_ptr_info[ptrn].ci = ci;
  186|   119k|      entropy->input_ptr_info[ptrn].yoffset = yoffset;
  187|   119k|      entropy->input_ptr_info[ptrn].MCU_width = compptr->MCU_width;
  188|   239k|      for (xoffset = 0; xoffset < compptr->MCU_width; xoffset++, sampn++) {
  ------------------
  |  Branch (188:25): [True: 119k, False: 119k]
  ------------------
  189|       |        /* Precalculate the input pointer index for each sample */
  190|   119k|        entropy->input_ptr_index[sampn] = ptrn;
  191|       |        /* Precalculate which tables to use for each sample */
  192|   119k|        entropy->cur_tbls[sampn] = entropy->derived_tbls[compptr->dc_tbl_no];
  193|   119k|#ifdef ENTROPY_OPT_SUPPORTED
  194|   119k|        entropy->cur_counts[sampn] = entropy->count_ptrs[compptr->dc_tbl_no];
  195|   119k|#endif
  196|   119k|      }
  197|   119k|    }
  198|   119k|  }
  199|  43.6k|  entropy->num_input_ptrs = ptrn;
  200|       |
  201|       |  /* Initialize bit buffer to empty */
  202|  43.6k|  entropy->saved.put_buffer = 0;
  203|  43.6k|  entropy->saved.put_bits = 0;
  204|       |
  205|       |  /* Initialize restart stuff */
  206|  43.6k|  entropy->restarts_to_go = cinfo->restart_interval;
  207|  43.6k|  entropy->next_restart_num = 0;
  208|  43.6k|}
jclhuff.c:encode_mcus_gather:
  466|  15.3M|{
  467|  15.3M|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
  468|  15.3M|  int sampn, ci, yoffset, MCU_width, ptrn;
  469|  15.3M|  JDIMENSION mcu_num;
  470|       |
  471|       |  /* Take care of restart intervals if needed */
  472|  15.3M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (472:7): [True: 4.61M, False: 10.7M]
  ------------------
  473|  4.61M|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (473:9): [True: 3.87M, False: 738k]
  ------------------
  474|       |      /* Update restart state */
  475|  3.87M|      entropy->restarts_to_go = cinfo->restart_interval;
  476|  3.87M|    }
  477|  4.61M|    entropy->restarts_to_go--;
  478|  4.61M|  }
  479|       |
  480|       |  /* Set input pointer locations based on MCU_col_num */
  481|  60.6M|  for (ptrn = 0; ptrn < entropy->num_input_ptrs; ptrn++) {
  ------------------
  |  Branch (481:18): [True: 45.3M, False: 15.3M]
  ------------------
  482|  45.3M|    ci = entropy->input_ptr_info[ptrn].ci;
  483|  45.3M|    yoffset = entropy->input_ptr_info[ptrn].yoffset;
  484|  45.3M|    MCU_width = entropy->input_ptr_info[ptrn].MCU_width;
  485|  45.3M|    entropy->input_ptr[ptrn] =
  486|  45.3M|      diff_buf[ci][MCU_row_num + yoffset] + (MCU_col_num * MCU_width);
  487|  45.3M|  }
  488|       |
  489|   108M|  for (mcu_num = 0; mcu_num < nMCU; mcu_num++) {
  ------------------
  |  Branch (489:21): [True: 93.5M, False: 15.3M]
  ------------------
  490|       |
  491|       |    /* Inner loop handles the samples in the MCU */
  492|   369M|    for (sampn = 0; sampn < cinfo->blocks_in_MCU; sampn++) {
  ------------------
  |  Branch (492:21): [True: 275M, False: 93.5M]
  ------------------
  493|   275M|      register int temp;
  494|   275M|      register int nbits;
  495|   275M|      long *counts = entropy->cur_counts[sampn];
  496|       |
  497|       |      /* Encode the difference per section H.1.2.2 */
  498|       |
  499|       |      /* Input the sample difference */
  500|   275M|      temp = *entropy->input_ptr[entropy->input_ptr_index[sampn]]++;
  501|       |
  502|   275M|      if (temp & 0x8000) {      /* instead of temp < 0 */
  ------------------
  |  Branch (502:11): [True: 45.0M, False: 230M]
  ------------------
  503|  45.0M|        temp = (-temp) & 0x7FFF; /* absolute value, mod 2^16 */
  504|  45.0M|        if (temp == 0)          /* special case: magnitude = 32768 */
  ------------------
  |  Branch (504:13): [True: 0, False: 45.0M]
  ------------------
  505|      0|          temp = 0x8000;
  506|  45.0M|      } else
  507|   230M|        temp &= 0x7FFF;         /* abs value mod 2^16 */
  508|       |
  509|       |      /* Find the number of bits needed for the magnitude of the difference */
  510|   275M|      nbits = 0;
  511|   632M|      while (temp) {
  ------------------
  |  Branch (511:14): [True: 357M, False: 275M]
  ------------------
  512|   357M|        nbits++;
  513|   357M|        temp >>= 1;
  514|   357M|      }
  515|       |      /* Check for out-of-range difference values.
  516|       |       */
  517|   275M|      if (nbits > MAX_DIFF_BITS)
  ------------------
  |  |   36|   275M|#define MAX_DIFF_BITS  16
  ------------------
  |  Branch (517:11): [True: 0, False: 275M]
  ------------------
  518|      0|        ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  519|       |
  520|       |      /* Count the Huffman symbol for the number of bits */
  521|   275M|      counts[nbits]++;
  522|   275M|    }
  523|  93.5M|  }
  524|       |
  525|  15.3M|  return nMCU;
  526|  15.3M|}
jclhuff.c:finish_pass_gather:
  535|  21.8k|{
  536|  21.8k|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
  537|  21.8k|  int ci, dctbl;
  538|  21.8k|  jpeg_component_info *compptr;
  539|  21.8k|  JHUFF_TBL **htblptr;
  540|  21.8k|  boolean did_dc[NUM_HUFF_TBLS];
  541|       |
  542|       |  /* It's important not to apply jpeg_gen_optimal_table more than once
  543|       |   * per table, because it clobbers the input frequency counts!
  544|       |   */
  545|  21.8k|  memset(did_dc, 0, sizeof(did_dc));
  546|       |
  547|  81.7k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (547:16): [True: 59.9k, False: 21.8k]
  ------------------
  548|  59.9k|    compptr = cinfo->cur_comp_info[ci];
  549|  59.9k|    dctbl = compptr->dc_tbl_no;
  550|  59.9k|    if (!did_dc[dctbl]) {
  ------------------
  |  Branch (550:9): [True: 21.8k, False: 38.1k]
  ------------------
  551|  21.8k|      htblptr = &cinfo->dc_huff_tbl_ptrs[dctbl];
  552|  21.8k|      if (*htblptr == NULL)
  ------------------
  |  Branch (552:11): [True: 0, False: 21.8k]
  ------------------
  553|      0|        *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  554|  21.8k|      jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[dctbl]);
  555|  21.8k|      did_dc[dctbl] = TRUE;
  ------------------
  |  |  210|  21.8k|#define TRUE    1
  ------------------
  556|  21.8k|    }
  557|  59.9k|  }
  558|  21.8k|}
jclhuff.c:encode_mcus_huff:
  322|  15.3M|{
  323|  15.3M|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
  324|  15.3M|  working_state state;
  325|  15.3M|  int sampn, ci, yoffset, MCU_width, ptrn;
  326|  15.3M|  JDIMENSION mcu_num;
  327|       |
  328|       |  /* Load up working state */
  329|  15.3M|  state.next_output_byte = cinfo->dest->next_output_byte;
  330|  15.3M|  state.free_in_buffer = cinfo->dest->free_in_buffer;
  331|  15.3M|  state.cur = entropy->saved;
  332|  15.3M|  state.cinfo = cinfo;
  333|       |
  334|       |  /* Emit restart marker if needed */
  335|  15.3M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (335:7): [True: 4.61M, False: 10.7M]
  ------------------
  336|  4.61M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (336:9): [True: 4.60M, False: 5.95k]
  ------------------
  337|  4.60M|      if (!emit_restart(&state, entropy->next_restart_num))
  ------------------
  |  Branch (337:11): [True: 0, False: 4.60M]
  ------------------
  338|      0|        return 0;
  339|  4.61M|  }
  340|       |
  341|       |  /* Set input pointer locations based on MCU_col_num */
  342|  60.6M|  for (ptrn = 0; ptrn < entropy->num_input_ptrs; ptrn++) {
  ------------------
  |  Branch (342:18): [True: 45.3M, False: 15.3M]
  ------------------
  343|  45.3M|    ci = entropy->input_ptr_info[ptrn].ci;
  344|  45.3M|    yoffset = entropy->input_ptr_info[ptrn].yoffset;
  345|  45.3M|    MCU_width = entropy->input_ptr_info[ptrn].MCU_width;
  346|  45.3M|    entropy->input_ptr[ptrn] =
  347|  45.3M|      diff_buf[ci][MCU_row_num + yoffset] + (MCU_col_num * MCU_width);
  348|  45.3M|  }
  349|       |
  350|   108M|  for (mcu_num = 0; mcu_num < nMCU; mcu_num++) {
  ------------------
  |  Branch (350:21): [True: 93.5M, False: 15.3M]
  ------------------
  351|       |
  352|       |    /* Inner loop handles the samples in the MCU */
  353|   369M|    for (sampn = 0; sampn < cinfo->blocks_in_MCU; sampn++) {
  ------------------
  |  Branch (353:21): [True: 275M, False: 93.5M]
  ------------------
  354|   275M|      register int temp, temp2;
  355|   275M|      register int nbits;
  356|   275M|      c_derived_tbl *dctbl = entropy->cur_tbls[sampn];
  357|       |
  358|       |      /* Encode the difference per section H.1.2.2 */
  359|       |
  360|       |      /* Input the sample difference */
  361|   275M|      temp = *entropy->input_ptr[entropy->input_ptr_index[sampn]]++;
  362|       |
  363|   275M|      if (temp & 0x8000) {      /* instead of temp < 0 */
  ------------------
  |  Branch (363:11): [True: 45.0M, False: 230M]
  ------------------
  364|  45.0M|        temp = (-temp) & 0x7FFF; /* absolute value, mod 2^16 */
  365|  45.0M|        if (temp == 0)          /* special case: magnitude = 32768 */
  ------------------
  |  Branch (365:13): [True: 0, False: 45.0M]
  ------------------
  366|      0|          temp2 = temp = 0x8000;
  367|  45.0M|        temp2 = ~temp;          /* one's complement of magnitude */
  368|   230M|      } else {
  369|   230M|        temp &= 0x7FFF;         /* abs value mod 2^16 */
  370|   230M|        temp2 = temp;           /* magnitude */
  371|   230M|      }
  372|       |
  373|       |      /* Find the number of bits needed for the magnitude of the difference */
  374|   275M|      nbits = 0;
  375|   632M|      while (temp) {
  ------------------
  |  Branch (375:14): [True: 357M, False: 275M]
  ------------------
  376|   357M|        nbits++;
  377|   357M|        temp >>= 1;
  378|   357M|      }
  379|       |      /* Check for out-of-range difference values.
  380|       |       */
  381|   275M|      if (nbits > MAX_DIFF_BITS)
  ------------------
  |  |   36|   275M|#define MAX_DIFF_BITS  16
  ------------------
  |  Branch (381:11): [True: 0, False: 275M]
  ------------------
  382|      0|        ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  383|       |
  384|       |      /* Emit the Huffman-coded symbol for the number of bits */
  385|   275M|      if (!emit_bits(&state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits]))
  ------------------
  |  Branch (385:11): [True: 0, False: 275M]
  ------------------
  386|      0|        return mcu_num;
  387|       |
  388|       |      /* Emit that number of bits of the value, if positive, */
  389|       |      /* or the complement of its magnitude, if negative. */
  390|   275M|      if (nbits &&              /* emit_bits rejects calls with size 0 */
  ------------------
  |  Branch (390:11): [True: 97.0M, False: 178M]
  ------------------
  391|  97.0M|          nbits != 16)          /* special case: no bits should be emitted */
  ------------------
  |  Branch (391:11): [True: 97.0M, False: 0]
  ------------------
  392|  97.0M|        if (!emit_bits(&state, (unsigned int)temp2, nbits))
  ------------------
  |  Branch (392:13): [True: 0, False: 97.0M]
  ------------------
  393|      0|          return mcu_num;
  394|   275M|    }
  395|       |
  396|       |    /* Completed MCU, so update state */
  397|  93.5M|    cinfo->dest->next_output_byte = state.next_output_byte;
  398|  93.5M|    cinfo->dest->free_in_buffer = state.free_in_buffer;
  399|  93.5M|    entropy->saved = state.cur;
  400|       |
  401|       |    /* Update restart-interval state too */
  402|  93.5M|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (402:9): [True: 28.0M, False: 65.5M]
  ------------------
  403|  28.0M|      if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (403:11): [True: 4.60M, False: 23.4M]
  ------------------
  404|  4.60M|        entropy->restarts_to_go = cinfo->restart_interval;
  405|  4.60M|        entropy->next_restart_num++;
  406|  4.60M|        entropy->next_restart_num &= 7;
  407|  4.60M|      }
  408|  28.0M|      entropy->restarts_to_go--;
  409|  28.0M|    }
  410|       |
  411|  93.5M|  }
  412|       |
  413|  15.3M|  return nMCU;
  414|  15.3M|}
jclhuff.c:emit_restart:
  301|  4.60M|{
  302|  4.60M|  if (!flush_bits(state))
  ------------------
  |  Branch (302:7): [True: 0, False: 4.60M]
  ------------------
  303|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  304|       |
  305|  4.60M|  emit_byte(state, 0xFF, return FALSE);
  ------------------
  |  |  214|  4.60M|#define emit_byte(state, val, action) { \
  |  |  215|  4.60M|  *(state)->next_output_byte++ = (JOCTET)(val); \
  |  |  216|  4.60M|  if (--(state)->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (216:7): [True: 0, False: 4.60M]
  |  |  ------------------
  |  |  217|  4.60M|    if (!dump_buffer(state)) \
  |  |  ------------------
  |  |  |  Branch (217:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  218|      0|      { action; } \
  |  |  219|  4.60M|}
  ------------------
  306|  4.60M|  emit_byte(state, JPEG_RST0 + restart_num, return FALSE);
  ------------------
  |  |  214|  4.60M|#define emit_byte(state, val, action) { \
  |  |  215|  4.60M|  *(state)->next_output_byte++ = (JOCTET)(val); \
  |  |  216|  4.60M|  if (--(state)->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (216:7): [True: 0, False: 4.60M]
  |  |  ------------------
  |  |  217|  4.60M|    if (!dump_buffer(state)) \
  |  |  ------------------
  |  |  |  Branch (217:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  218|      0|      { action; } \
  |  |  219|  4.60M|}
  ------------------
  307|       |
  308|       |  /* The restart counter is not updated until we successfully write the MCU. */
  309|       |
  310|  4.60M|  return TRUE;
  ------------------
  |  |  210|  4.60M|#define TRUE    1
  ------------------
  311|  4.60M|}
jclhuff.c:flush_bits:
  286|  4.62M|{
  287|  4.62M|  if (!emit_bits(state, 0x7F, 7)) /* fill any partial byte with ones */
  ------------------
  |  Branch (287:7): [True: 0, False: 4.62M]
  ------------------
  288|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  289|  4.62M|  state->cur.put_buffer = 0;    /* and reset bit-buffer to empty */
  290|  4.62M|  state->cur.put_bits = 0;
  291|  4.62M|  return TRUE;
  ------------------
  |  |  210|  4.62M|#define TRUE    1
  ------------------
  292|  4.62M|}
jclhuff.c:dump_buffer:
  225|    440|{
  226|    440|  struct jpeg_destination_mgr *dest = state->cinfo->dest;
  227|       |
  228|    440|  if (!(*dest->empty_output_buffer) (state->cinfo))
  ------------------
  |  Branch (228:7): [True: 0, False: 440]
  ------------------
  229|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  230|       |  /* After a successful buffer dump, must reset buffer pointers */
  231|    440|  state->next_output_byte = dest->next_output_byte;
  232|    440|  state->free_in_buffer = dest->free_in_buffer;
  233|    440|  return TRUE;
  ------------------
  |  |  210|    440|#define TRUE    1
  ------------------
  234|    440|}
jclhuff.c:emit_bits:
  249|   377M|{
  250|       |  /* This routine is heavily used, so it's worth coding tightly. */
  251|   377M|  register size_t put_buffer = (size_t)code;
  252|   377M|  register int put_bits = state->cur.put_bits;
  253|       |
  254|       |  /* if size is 0, caller used an invalid Huffman table entry */
  255|   377M|  if (size == 0)
  ------------------
  |  Branch (255:7): [True: 0, False: 377M]
  ------------------
  256|      0|    ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  257|       |
  258|   377M|  put_buffer &= (((size_t)1) << size) - 1; /* mask off any extra bits in code */
  259|       |
  260|   377M|  put_bits += size;             /* new number of bits in buffer */
  261|       |
  262|   377M|  put_buffer <<= 24 - put_bits; /* align incoming bits */
  263|       |
  264|   377M|  put_buffer |= state->cur.put_buffer; /* and merge with old buffer contents */
  265|       |
  266|   477M|  while (put_bits >= 8) {
  ------------------
  |  Branch (266:10): [True: 100M, False: 377M]
  ------------------
  267|   100M|    int c = (int)((put_buffer >> 16) & 0xFF);
  268|       |
  269|   100M|    emit_byte(state, c, return FALSE);
  ------------------
  |  |  214|   100M|#define emit_byte(state, val, action) { \
  |  |  215|   100M|  *(state)->next_output_byte++ = (JOCTET)(val); \
  |  |  216|   100M|  if (--(state)->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (216:7): [True: 436, False: 100M]
  |  |  ------------------
  |  |  217|   100M|    if (!dump_buffer(state)) \
  |  |  ------------------
  |  |  |  Branch (217:9): [True: 0, False: 436]
  |  |  ------------------
  |  |  218|    436|      { action; } \
  |  |  219|   100M|}
  ------------------
  270|   100M|    if (c == 0xFF) {            /* need to stuff a zero byte? */
  ------------------
  |  Branch (270:9): [True: 1.70M, False: 98.3M]
  ------------------
  271|  1.70M|      emit_byte(state, 0, return FALSE);
  ------------------
  |  |  214|  1.70M|#define emit_byte(state, val, action) { \
  |  |  215|  1.70M|  *(state)->next_output_byte++ = (JOCTET)(val); \
  |  |  216|  1.70M|  if (--(state)->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (216:7): [True: 4, False: 1.70M]
  |  |  ------------------
  |  |  217|  1.70M|    if (!dump_buffer(state)) \
  |  |  ------------------
  |  |  |  Branch (217:9): [True: 0, False: 4]
  |  |  ------------------
  |  |  218|      4|      { action; } \
  |  |  219|  1.70M|}
  ------------------
  272|  1.70M|    }
  273|   100M|    put_buffer <<= 8;
  274|   100M|    put_bits -= 8;
  275|   100M|  }
  276|       |
  277|   377M|  state->cur.put_buffer = put_buffer; /* update state variables */
  278|   377M|  state->cur.put_bits = put_bits;
  279|       |
  280|   377M|  return TRUE;
  ------------------
  |  |  210|   377M|#define TRUE    1
  ------------------
  281|   377M|}
jclhuff.c:finish_pass_huff:
  423|  21.8k|{
  424|  21.8k|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
  425|  21.8k|  working_state state;
  426|       |
  427|       |  /* Load up working state ... flush_bits needs it */
  428|  21.8k|  state.next_output_byte = cinfo->dest->next_output_byte;
  429|  21.8k|  state.free_in_buffer = cinfo->dest->free_in_buffer;
  430|  21.8k|  state.cur = entropy->saved;
  431|  21.8k|  state.cinfo = cinfo;
  432|       |
  433|       |  /* Flush out the last data */
  434|  21.8k|  if (!flush_bits(&state))
  ------------------
  |  Branch (434:7): [True: 0, False: 21.8k]
  ------------------
  435|      0|    ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  436|       |
  437|       |  /* Update state */
  438|  21.8k|  cinfo->dest->next_output_byte = state.next_output_byte;
  439|  21.8k|  cinfo->dest->free_in_buffer = state.free_in_buffer;
  440|  21.8k|  entropy->saved = state.cur;
  441|  21.8k|}

jinit_lossless_compressor:
  311|  21.8k|{
  312|  21.8k|  lossless_comp_ptr losslessc;
  313|       |
  314|  21.8k|#if BITS_IN_JSAMPLE == 8
  315|  21.8k|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  43.6k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (315:7): [True: 0, False: 21.8k]
  |  Branch (315:50): [True: 0, False: 21.8k]
  ------------------
  316|       |#else
  317|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  318|       |      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  319|       |#endif
  320|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  321|       |
  322|       |  /* Create subobject in permanent pool */
  323|  21.8k|  losslessc = (lossless_comp_ptr)
  324|  21.8k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  21.8k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  325|  21.8k|                                sizeof(jpeg_lossless_compressor));
  326|  21.8k|  cinfo->fdct = (struct jpeg_forward_dct *)losslessc;
  327|  21.8k|  losslessc->pub.start_pass = start_pass_lossless;
  328|  21.8k|}
jclossls-8.c:start_pass_lossless:
  282|  43.6k|{
  283|  43.6k|  lossless_comp_ptr losslessc = (lossless_comp_ptr)cinfo->fdct;
  284|  43.6k|  int ci;
  285|       |
  286|       |  /* Set scaler function based on Pt */
  287|  43.6k|  if (cinfo->Al)
  ------------------
  |  Branch (287:7): [True: 31.7k, False: 11.9k]
  ------------------
  288|  31.7k|    losslessc->scaler_scale = simple_downscale;
  289|  11.9k|  else
  290|  11.9k|    losslessc->scaler_scale = noscale;
  291|       |
  292|       |  /* Check that the restart interval is an integer multiple of the number
  293|       |   * of MCUs in an MCU row.
  294|       |   */
  295|  43.6k|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (295:7): [True: 0, False: 43.6k]
  ------------------
  296|      0|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  297|  43.6k|             cinfo->restart_interval, cinfo->MCUs_per_row);
  298|       |
  299|       |  /* Set predictors for start of pass */
  300|   163k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (300:16): [True: 119k, False: 43.6k]
  ------------------
  301|   119k|    reset_predictor(cinfo, ci);
  302|  43.6k|}
jclossls-8.c:simple_downscale:
  261|  58.3M|{
  262|   355M|  do {
  263|   355M|    *output_buf++ = (_JSAMPLE)RIGHT_SHIFT(*input_buf++, cinfo->Al);
  ------------------
  |  |  542|   355M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  264|   355M|  } while (--width);
  ------------------
  |  Branch (264:12): [True: 297M, False: 58.3M]
  ------------------
  265|  58.3M|}
jclossls-8.c:noscale:
  271|  32.2M|{
  272|  32.2M|  memcpy(output_buf, input_buf, width * sizeof(_JSAMPLE));
  273|  32.2M|}
jclossls-8.c:reset_predictor:
  244|  32.3M|{
  245|  32.3M|  lossless_comp_ptr losslessc = (lossless_comp_ptr)cinfo->fdct;
  246|       |
  247|       |  /* Initialize restart counter */
  248|  32.3M|  losslessc->restart_rows_to_go[ci] =
  249|  32.3M|    cinfo->restart_interval / cinfo->MCUs_per_row;
  250|       |
  251|       |  /* Set difference function to first row function */
  252|  32.3M|  losslessc->predict_difference[ci] = jpeg_difference_first_row;
  253|  32.3M|}
jclossls-8.c:jpeg_difference_first_row:
  197|  32.3M|{
  198|  32.3M|  DIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   60|  32.3M|  lossless_comp_ptr losslessc = (lossless_comp_ptr)cinfo->fdct; \
  |  |   61|  32.3M|  boolean restart = FALSE; \
  |  |  ------------------
  |  |  |  |  207|  32.3M|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |   62|  32.3M|  int samp, Ra; \
  |  |   63|  32.3M|  \
  |  |   64|  32.3M|  samp = *input_buf++; \
  |  |   65|  32.3M|  *diff_buf++ = samp - INITIAL_PREDICTOR; \
  |  |   66|  32.3M|  \
  |  |   67|   266M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (67:10): [True: 233M, False: 32.3M]
  |  |  ------------------
  |  |   68|   233M|    Ra = samp; \
  |  |   69|   233M|    samp = *input_buf++; \
  |  |   70|   233M|    *diff_buf++ = samp - PREDICTOR1; \
  |  |  ------------------
  |  |  |  |   37|   233M|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   71|   233M|  } \
  |  |   72|  32.3M|  \
  |  |   73|  32.3M|  /* Account for restart interval (no-op if not using restarts) */ \
  |  |   74|  32.3M|  if (cinfo->restart_interval) { \
  |  |  ------------------
  |  |  |  Branch (74:7): [True: 32.2M, False: 78.4k]
  |  |  ------------------
  |  |   75|  32.2M|    if (--(losslessc->restart_rows_to_go[ci]) == 0) { \
  |  |  ------------------
  |  |  |  Branch (75:9): [True: 32.2M, False: 0]
  |  |  ------------------
  |  |   76|  32.2M|      reset_predictor(cinfo, ci); \
  |  |   77|  32.2M|      restart = TRUE; \
  |  |  ------------------
  |  |  |  |  210|  32.2M|#define TRUE    1
  |  |  ------------------
  |  |   78|  32.2M|    } \
  |  |   79|  32.2M|  }
  ------------------
  199|       |
  200|       |  /*
  201|       |   * Now that we have differenced the first row, we want to use the
  202|       |   * differencer that corresponds to the predictor specified in the
  203|       |   * scan header.
  204|       |   *
  205|       |   * Note that we don't do this if we have just reset the predictor
  206|       |   * for a new restart interval.
  207|       |   */
  208|  32.3M|  if (!restart) {
  ------------------
  |  Branch (208:7): [True: 78.4k, False: 32.2M]
  ------------------
  209|  78.4k|    switch (cinfo->Ss) {
  210|      0|    case 1:
  ------------------
  |  Branch (210:5): [True: 0, False: 78.4k]
  ------------------
  211|      0|      losslessc->predict_difference[ci] = jpeg_difference1;
  212|      0|      break;
  213|  18.5k|    case 2:
  ------------------
  |  Branch (213:5): [True: 18.5k, False: 59.8k]
  ------------------
  214|  18.5k|      losslessc->predict_difference[ci] = jpeg_difference2;
  215|  18.5k|      break;
  216|  17.1k|    case 3:
  ------------------
  |  Branch (216:5): [True: 17.1k, False: 61.2k]
  ------------------
  217|  17.1k|      losslessc->predict_difference[ci] = jpeg_difference3;
  218|  17.1k|      break;
  219|  17.1k|    case 4:
  ------------------
  |  Branch (219:5): [True: 17.1k, False: 61.2k]
  ------------------
  220|  17.1k|      losslessc->predict_difference[ci] = jpeg_difference4;
  221|  17.1k|      break;
  222|  17.1k|    case 5:
  ------------------
  |  Branch (222:5): [True: 17.1k, False: 61.2k]
  ------------------
  223|  17.1k|      losslessc->predict_difference[ci] = jpeg_difference5;
  224|  17.1k|      break;
  225|  8.39k|    case 6:
  ------------------
  |  Branch (225:5): [True: 8.39k, False: 70.0k]
  ------------------
  226|  8.39k|      losslessc->predict_difference[ci] = jpeg_difference6;
  227|  8.39k|      break;
  228|      0|    case 7:
  ------------------
  |  Branch (228:5): [True: 0, False: 78.4k]
  ------------------
  229|      0|      losslessc->predict_difference[ci] = jpeg_difference7;
  230|      0|      break;
  231|      0|    default:
  ------------------
  |  Branch (231:5): [True: 0, False: 78.4k]
  ------------------
  232|      0|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      0|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      0|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  233|  78.4k|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  234|  78.4k|    }
  235|  78.4k|  }
  236|  32.3M|}
jclossls-8.c:jpeg_difference2:
  137|  13.8M|{
  138|  13.8M|  DIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   95|  13.8M|  lossless_comp_ptr losslessc = (lossless_comp_ptr)cinfo->fdct; \
  |  |   96|  13.8M|  int samp, Ra, Rb, Rc; \
  |  |   97|  13.8M|  \
  |  |   98|  13.8M|  Rb = *prev_row++; \
  |  |   99|  13.8M|  samp = *input_buf++; \
  |  |  100|  13.8M|  *diff_buf++ = samp - PREDICTOR2; \
  |  |  ------------------
  |  |  |  |   38|  13.8M|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |  101|  13.8M|  \
  |  |  102|  67.7M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (102:10): [True: 53.9M, False: 13.8M]
  |  |  ------------------
  |  |  103|  53.9M|    Rc = Rb; \
  |  |  104|  53.9M|    Rb = *prev_row++; \
  |  |  105|  53.9M|    Ra = samp; \
  |  |  106|  53.9M|    samp = *input_buf++; \
  |  |  107|  53.9M|    *diff_buf++ = samp - PREDICTOR; \
  |  |  108|  53.9M|  } \
  |  |  109|  13.8M|  \
  |  |  110|  13.8M|  /* Account for restart interval (no-op if not using restarts) */ \
  |  |  111|  13.8M|  if (cinfo->restart_interval) { \
  |  |  ------------------
  |  |  |  Branch (111:7): [True: 0, False: 13.8M]
  |  |  ------------------
  |  |  112|      0|    if (--losslessc->restart_rows_to_go[ci] == 0) \
  |  |  ------------------
  |  |  |  Branch (112:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  113|      0|      reset_predictor(cinfo, ci); \
  |  |  114|      0|  }
  ------------------
  139|  13.8M|  (void)(Ra);
  140|  13.8M|  (void)(Rc);
  141|  13.8M|}
jclossls-8.c:jpeg_difference3:
  147|  13.8M|{
  148|  13.8M|  DIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   95|  13.8M|  lossless_comp_ptr losslessc = (lossless_comp_ptr)cinfo->fdct; \
  |  |   96|  13.8M|  int samp, Ra, Rb, Rc; \
  |  |   97|  13.8M|  \
  |  |   98|  13.8M|  Rb = *prev_row++; \
  |  |   99|  13.8M|  samp = *input_buf++; \
  |  |  100|  13.8M|  *diff_buf++ = samp - PREDICTOR2; \
  |  |  ------------------
  |  |  |  |   38|  13.8M|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |  101|  13.8M|  \
  |  |  102|  67.5M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (102:10): [True: 53.7M, False: 13.8M]
  |  |  ------------------
  |  |  103|  53.7M|    Rc = Rb; \
  |  |  104|  53.7M|    Rb = *prev_row++; \
  |  |  105|  53.7M|    Ra = samp; \
  |  |  106|  53.7M|    samp = *input_buf++; \
  |  |  107|  53.7M|    *diff_buf++ = samp - PREDICTOR; \
  |  |  108|  53.7M|  } \
  |  |  109|  13.8M|  \
  |  |  110|  13.8M|  /* Account for restart interval (no-op if not using restarts) */ \
  |  |  111|  13.8M|  if (cinfo->restart_interval) { \
  |  |  ------------------
  |  |  |  Branch (111:7): [True: 0, False: 13.8M]
  |  |  ------------------
  |  |  112|      0|    if (--losslessc->restart_rows_to_go[ci] == 0) \
  |  |  ------------------
  |  |  |  Branch (112:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  113|      0|      reset_predictor(cinfo, ci); \
  |  |  114|      0|  }
  ------------------
  149|  13.8M|  (void)(Ra);
  150|  13.8M|}
jclossls-8.c:jpeg_difference4:
  156|  13.8M|{
  157|  13.8M|  DIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   95|  13.8M|  lossless_comp_ptr losslessc = (lossless_comp_ptr)cinfo->fdct; \
  |  |   96|  13.8M|  int samp, Ra, Rb, Rc; \
  |  |   97|  13.8M|  \
  |  |   98|  13.8M|  Rb = *prev_row++; \
  |  |   99|  13.8M|  samp = *input_buf++; \
  |  |  100|  13.8M|  *diff_buf++ = samp - PREDICTOR2; \
  |  |  ------------------
  |  |  |  |   38|  13.8M|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |  101|  13.8M|  \
  |  |  102|  67.5M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (102:10): [True: 53.7M, False: 13.8M]
  |  |  ------------------
  |  |  103|  53.7M|    Rc = Rb; \
  |  |  104|  53.7M|    Rb = *prev_row++; \
  |  |  105|  53.7M|    Ra = samp; \
  |  |  106|  53.7M|    samp = *input_buf++; \
  |  |  107|  53.7M|    *diff_buf++ = samp - PREDICTOR; \
  |  |  108|  53.7M|  } \
  |  |  109|  13.8M|  \
  |  |  110|  13.8M|  /* Account for restart interval (no-op if not using restarts) */ \
  |  |  111|  13.8M|  if (cinfo->restart_interval) { \
  |  |  ------------------
  |  |  |  Branch (111:7): [True: 0, False: 13.8M]
  |  |  ------------------
  |  |  112|      0|    if (--losslessc->restart_rows_to_go[ci] == 0) \
  |  |  ------------------
  |  |  |  Branch (112:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  113|      0|      reset_predictor(cinfo, ci); \
  |  |  114|      0|  }
  ------------------
  158|  13.8M|}
jclossls-8.c:jpeg_difference5:
  164|  13.8M|{
  165|  13.8M|  DIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   95|  13.8M|  lossless_comp_ptr losslessc = (lossless_comp_ptr)cinfo->fdct; \
  |  |   96|  13.8M|  int samp, Ra, Rb, Rc; \
  |  |   97|  13.8M|  \
  |  |   98|  13.8M|  Rb = *prev_row++; \
  |  |   99|  13.8M|  samp = *input_buf++; \
  |  |  100|  13.8M|  *diff_buf++ = samp - PREDICTOR2; \
  |  |  ------------------
  |  |  |  |   38|  13.8M|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |  101|  13.8M|  \
  |  |  102|  67.5M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (102:10): [True: 53.7M, False: 13.8M]
  |  |  ------------------
  |  |  103|  53.7M|    Rc = Rb; \
  |  |  104|  53.7M|    Rb = *prev_row++; \
  |  |  105|  53.7M|    Ra = samp; \
  |  |  106|  53.7M|    samp = *input_buf++; \
  |  |  107|  53.7M|    *diff_buf++ = samp - PREDICTOR; \
  |  |  108|  53.7M|  } \
  |  |  109|  13.8M|  \
  |  |  110|  13.8M|  /* Account for restart interval (no-op if not using restarts) */ \
  |  |  111|  13.8M|  if (cinfo->restart_interval) { \
  |  |  ------------------
  |  |  |  Branch (111:7): [True: 0, False: 13.8M]
  |  |  ------------------
  |  |  112|      0|    if (--losslessc->restart_rows_to_go[ci] == 0) \
  |  |  ------------------
  |  |  |  Branch (112:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  113|      0|      reset_predictor(cinfo, ci); \
  |  |  114|      0|  }
  ------------------
  166|  13.8M|}
jclossls-8.c:jpeg_difference6:
  172|  3.02M|{
  173|  3.02M|  DIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   95|  3.02M|  lossless_comp_ptr losslessc = (lossless_comp_ptr)cinfo->fdct; \
  |  |   96|  3.02M|  int samp, Ra, Rb, Rc; \
  |  |   97|  3.02M|  \
  |  |   98|  3.02M|  Rb = *prev_row++; \
  |  |   99|  3.02M|  samp = *input_buf++; \
  |  |  100|  3.02M|  *diff_buf++ = samp - PREDICTOR2; \
  |  |  ------------------
  |  |  |  |   38|  3.02M|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |  101|  3.02M|  \
  |  |  102|  14.9M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (102:10): [True: 11.9M, False: 3.02M]
  |  |  ------------------
  |  |  103|  11.9M|    Rc = Rb; \
  |  |  104|  11.9M|    Rb = *prev_row++; \
  |  |  105|  11.9M|    Ra = samp; \
  |  |  106|  11.9M|    samp = *input_buf++; \
  |  |  107|  11.9M|    *diff_buf++ = samp - PREDICTOR; \
  |  |  108|  11.9M|  } \
  |  |  109|  3.02M|  \
  |  |  110|  3.02M|  /* Account for restart interval (no-op if not using restarts) */ \
  |  |  111|  3.02M|  if (cinfo->restart_interval) { \
  |  |  ------------------
  |  |  |  Branch (111:7): [True: 0, False: 3.02M]
  |  |  ------------------
  |  |  112|      0|    if (--losslessc->restart_rows_to_go[ci] == 0) \
  |  |  ------------------
  |  |  |  Branch (112:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  113|      0|      reset_predictor(cinfo, ci); \
  |  |  114|      0|  }
  ------------------
  174|  3.02M|}

jinit_c_main_controller:
  137|  21.8k|{
  138|  21.8k|  my_main_ptr main_ptr;
  139|  21.8k|  int ci;
  140|  21.8k|  jpeg_component_info *compptr;
  141|  21.8k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (141:19): [True: 21.8k, False: 0]
  ------------------
  142|       |
  143|  21.8k|#ifdef C_LOSSLESS_SUPPORTED
  144|  21.8k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (144:7): [True: 21.8k, False: 0]
  ------------------
  145|  21.8k|#if BITS_IN_JSAMPLE == 8
  146|  21.8k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  43.6k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (146:9): [True: 0, False: 21.8k]
  |  Branch (146:52): [True: 0, False: 21.8k]
  ------------------
  147|       |#else
  148|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  149|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  150|       |#endif
  151|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  152|  21.8k|  } else
  153|      0|#endif
  154|      0|  {
  155|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (155:9): [True: 0, False: 0]
  ------------------
  156|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  157|      0|  }
  158|       |
  159|  21.8k|  main_ptr = (my_main_ptr)
  160|  21.8k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  21.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  161|  21.8k|                                sizeof(my_main_controller));
  162|  21.8k|  memset(main_ptr, 0, sizeof(my_main_controller));
  163|  21.8k|  cinfo->main = (struct jpeg_c_main_controller *)main_ptr;
  164|  21.8k|  main_ptr->pub.start_pass = start_pass_main;
  165|       |
  166|       |  /* We don't need to create a buffer in raw-data mode. */
  167|  21.8k|  if (cinfo->raw_data_in)
  ------------------
  |  Branch (167:7): [True: 0, False: 21.8k]
  ------------------
  168|      0|    return;
  169|       |
  170|       |  /* Create the buffer.  It holds downsampled data, so each component
  171|       |   * may be of a different size.
  172|       |   */
  173|  21.8k|  if (need_full_buffer) {
  ------------------
  |  Branch (173:7): [True: 0, False: 21.8k]
  ------------------
  174|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  175|  21.8k|  } else {
  176|       |    /* Allocate a strip buffer for each component */
  177|  81.7k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (177:46): [True: 59.9k, False: 21.8k]
  ------------------
  178|  59.9k|         ci++, compptr++) {
  179|  59.9k|      main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  180|  59.9k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  59.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  181|  59.9k|         compptr->width_in_blocks * data_unit,
  182|  59.9k|         (JDIMENSION)(compptr->v_samp_factor * data_unit));
  183|  59.9k|    }
  184|  21.8k|  }
  185|  21.8k|}
jcmainct-8.c:start_pass_main:
   59|  21.8k|{
   60|  21.8k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
   61|       |
   62|       |  /* Do nothing in raw-data mode. */
   63|  21.8k|  if (cinfo->raw_data_in)
  ------------------
  |  Branch (63:7): [True: 0, False: 21.8k]
  ------------------
   64|      0|    return;
   65|       |
   66|  21.8k|  if (pass_mode != JBUF_PASS_THRU)
  ------------------
  |  Branch (66:7): [True: 0, False: 21.8k]
  ------------------
   67|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   68|       |
   69|  21.8k|  main_ptr->cur_iMCU_row = 0;   /* initialize counters */
   70|  21.8k|  main_ptr->rowgroup_ctr = 0;
   71|  21.8k|  main_ptr->suspended = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
   72|  21.8k|  main_ptr->pass_mode = pass_mode;      /* save mode for use by process_data */
   73|  21.8k|  main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  256|  21.8k|#define _process_data  process_data
  ------------------
   74|  21.8k|}
jcmainct-8.c:process_data_simple_main:
   86|  21.8k|{
   87|  21.8k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
   88|  21.8k|  JDIMENSION data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  21.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (88:26): [True: 21.8k, False: 0]
  ------------------
   89|       |
   90|  15.3M|  while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (90:10): [True: 15.3M, False: 21.8k]
  ------------------
   91|       |    /* Read input data if we haven't filled the main buffer yet */
   92|  15.3M|    if (main_ptr->rowgroup_ctr < data_unit)
  ------------------
  |  Branch (92:9): [True: 15.3M, False: 0]
  ------------------
   93|  15.3M|      (*cinfo->prep->_pre_process_data) (cinfo, input_buf, in_row_ctr,
  ------------------
  |  |  246|  15.3M|#define _pre_process_data  pre_process_data
  ------------------
   94|  15.3M|                                         in_rows_avail, main_ptr->buffer,
   95|  15.3M|                                         &main_ptr->rowgroup_ctr, data_unit);
   96|       |
   97|       |    /* If we don't have a full iMCU row buffered, return to application for
   98|       |     * more data.  Note that preprocessor will always pad to fill the iMCU row
   99|       |     * at the bottom of the image.
  100|       |     */
  101|  15.3M|    if (main_ptr->rowgroup_ctr != data_unit)
  ------------------
  |  Branch (101:9): [True: 0, False: 15.3M]
  ------------------
  102|      0|      return;
  103|       |
  104|       |    /* Send the completed row to the compressor */
  105|  15.3M|    if (!(*cinfo->coef->_compress_data) (cinfo, main_ptr->buffer)) {
  ------------------
  |  |  248|  15.3M|#define _compress_data  compress_data
  ------------------
  |  Branch (105:9): [True: 0, False: 15.3M]
  ------------------
  106|       |      /* If compressor did not consume the whole row, then we must need to
  107|       |       * suspend processing and return to the application.  In this situation
  108|       |       * we pretend we didn't yet consume the last input row; otherwise, if
  109|       |       * it happened to be the last row of the image, the application would
  110|       |       * think we were done.
  111|       |       */
  112|      0|      if (!main_ptr->suspended) {
  ------------------
  |  Branch (112:11): [True: 0, False: 0]
  ------------------
  113|      0|        (*in_row_ctr)--;
  114|      0|        main_ptr->suspended = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  115|      0|      }
  116|      0|      return;
  117|      0|    }
  118|       |    /* We did finish the row.  Undo our little suspension hack if a previous
  119|       |     * call suspended; then mark the main buffer empty.
  120|       |     */
  121|  15.3M|    if (main_ptr->suspended) {
  ------------------
  |  Branch (121:9): [True: 0, False: 15.3M]
  ------------------
  122|      0|      (*in_row_ctr)++;
  123|      0|      main_ptr->suspended = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  124|      0|    }
  125|  15.3M|    main_ptr->rowgroup_ctr = 0;
  126|  15.3M|    main_ptr->cur_iMCU_row++;
  127|  15.3M|  }
  128|  21.8k|}

jinit_marker_writer:
  652|  21.8k|{
  653|  21.8k|  my_marker_ptr marker;
  654|       |
  655|       |  /* Create the subobject */
  656|  21.8k|  marker = (my_marker_ptr)
  657|  21.8k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  21.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  658|  21.8k|                                sizeof(my_marker_writer));
  659|  21.8k|  cinfo->marker = (struct jpeg_marker_writer *)marker;
  660|       |  /* Initialize method pointers */
  661|  21.8k|  marker->pub.write_file_header = write_file_header;
  662|  21.8k|  marker->pub.write_frame_header = write_frame_header;
  663|  21.8k|  marker->pub.write_scan_header = write_scan_header;
  664|  21.8k|  marker->pub.write_file_trailer = write_file_trailer;
  665|  21.8k|  marker->pub.write_tables_only = write_tables_only;
  666|  21.8k|  marker->pub.write_marker_header = write_marker_header;
  667|  21.8k|  marker->pub.write_marker_byte = write_marker_byte;
  668|       |  /* Initialize private state */
  669|  21.8k|  marker->last_restart_interval = 0;
  670|  21.8k|}
jcmarker.c:write_file_header:
  476|  21.8k|{
  477|  21.8k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
  478|       |
  479|  21.8k|  emit_marker(cinfo, M_SOI);    /* first the SOI */
  480|       |
  481|       |  /* SOI is defined to reset restart interval to 0 */
  482|  21.8k|  marker->last_restart_interval = 0;
  483|       |
  484|  21.8k|  if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */
  ------------------
  |  Branch (484:7): [True: 4.19k, False: 17.6k]
  ------------------
  485|  4.19k|    emit_jfif_app0(cinfo);
  486|  21.8k|  if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */
  ------------------
  |  Branch (486:7): [True: 17.6k, False: 4.19k]
  ------------------
  487|  17.6k|    emit_adobe_app14(cinfo);
  488|  21.8k|}
jcmarker.c:emit_marker:
  131|   156k|{
  132|   156k|  emit_byte(cinfo, 0xFF);
  133|   156k|  emit_byte(cinfo, (int)mark);
  134|   156k|}
jcmarker.c:emit_byte:
  117|  2.75M|{
  118|  2.75M|  struct jpeg_destination_mgr *dest = cinfo->dest;
  119|       |
  120|  2.75M|  *(dest->next_output_byte)++ = (JOCTET)val;
  121|  2.75M|  if (--dest->free_in_buffer == 0) {
  ------------------
  |  Branch (121:7): [True: 2, False: 2.75M]
  ------------------
  122|      2|    if (!(*dest->empty_output_buffer) (cinfo))
  ------------------
  |  Branch (122:9): [True: 0, False: 2]
  ------------------
  123|      0|      ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  124|      2|  }
  125|  2.75M|}
jcmarker.c:emit_jfif_app0:
  357|  4.19k|{
  358|       |  /*
  359|       |   * Length of APP0 block       (2 bytes)
  360|       |   * Block ID                   (4 bytes - ASCII "JFIF")
  361|       |   * Zero byte                  (1 byte to terminate the ID string)
  362|       |   * Version Major, Minor       (2 bytes - major first)
  363|       |   * Units                      (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm)
  364|       |   * Xdpu                       (2 bytes - dots per unit horizontal)
  365|       |   * Ydpu                       (2 bytes - dots per unit vertical)
  366|       |   * Thumbnail X size           (1 byte)
  367|       |   * Thumbnail Y size           (1 byte)
  368|       |   */
  369|       |
  370|  4.19k|  emit_marker(cinfo, M_APP0);
  371|       |
  372|  4.19k|  emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
  373|       |
  374|  4.19k|  emit_byte(cinfo, 0x4A);       /* Identifier: ASCII "JFIF" */
  375|  4.19k|  emit_byte(cinfo, 0x46);
  376|  4.19k|  emit_byte(cinfo, 0x49);
  377|  4.19k|  emit_byte(cinfo, 0x46);
  378|  4.19k|  emit_byte(cinfo, 0);
  379|  4.19k|  emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */
  380|  4.19k|  emit_byte(cinfo, cinfo->JFIF_minor_version);
  381|  4.19k|  emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
  382|  4.19k|  emit_2bytes(cinfo, (int)cinfo->X_density);
  383|  4.19k|  emit_2bytes(cinfo, (int)cinfo->Y_density);
  384|  4.19k|  emit_byte(cinfo, 0);          /* No thumbnail image */
  385|  4.19k|  emit_byte(cinfo, 0);
  386|  4.19k|}
jcmarker.c:emit_2bytes:
  140|   224k|{
  141|   224k|  emit_byte(cinfo, (value >> 8) & 0xFF);
  142|   224k|  emit_byte(cinfo, value & 0xFF);
  143|   224k|}
jcmarker.c:emit_adobe_app14:
  392|  17.6k|{
  393|       |  /*
  394|       |   * Length of APP14 block      (2 bytes)
  395|       |   * Block ID                   (5 bytes - ASCII "Adobe")
  396|       |   * Version Number             (2 bytes - currently 100)
  397|       |   * Flags0                     (2 bytes - currently 0)
  398|       |   * Flags1                     (2 bytes - currently 0)
  399|       |   * Color transform            (1 byte)
  400|       |   *
  401|       |   * Although Adobe TN 5116 mentions Version = 101, all the Adobe files
  402|       |   * now in circulation seem to use Version = 100, so that's what we write.
  403|       |   *
  404|       |   * We write the color transform byte as 1 if the JPEG color space is
  405|       |   * YCbCr, 2 if it's YCCK, 0 otherwise.  Adobe's definition has to do with
  406|       |   * whether the encoder performed a transformation, which is pretty useless.
  407|       |   */
  408|       |
  409|  17.6k|  emit_marker(cinfo, M_APP14);
  410|       |
  411|  17.6k|  emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
  412|       |
  413|  17.6k|  emit_byte(cinfo, 0x41);       /* Identifier: ASCII "Adobe" */
  414|  17.6k|  emit_byte(cinfo, 0x64);
  415|  17.6k|  emit_byte(cinfo, 0x6F);
  416|  17.6k|  emit_byte(cinfo, 0x62);
  417|  17.6k|  emit_byte(cinfo, 0x65);
  418|  17.6k|  emit_2bytes(cinfo, 100);      /* Version */
  419|  17.6k|  emit_2bytes(cinfo, 0);        /* Flags0 */
  420|  17.6k|  emit_2bytes(cinfo, 0);        /* Flags1 */
  421|  17.6k|  switch (cinfo->jpeg_color_space) {
  422|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (422:3): [True: 0, False: 17.6k]
  ------------------
  423|      0|    emit_byte(cinfo, 1);        /* Color transform = 1 */
  424|      0|    break;
  425|      0|  case JCS_YCCK:
  ------------------
  |  Branch (425:3): [True: 0, False: 17.6k]
  ------------------
  426|      0|    emit_byte(cinfo, 2);        /* Color transform = 2 */
  427|      0|    break;
  428|  17.6k|  default:
  ------------------
  |  Branch (428:3): [True: 17.6k, False: 0]
  ------------------
  429|  17.6k|    emit_byte(cinfo, 0);        /* Color transform = 0 */
  430|  17.6k|    break;
  431|  17.6k|  }
  432|  17.6k|}
jcmarker.c:write_frame_header:
  501|  21.8k|{
  502|  21.8k|  int ci, prec = 0;
  503|  21.8k|  boolean is_baseline;
  504|  21.8k|  jpeg_component_info *compptr;
  505|       |
  506|  21.8k|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (506:7): [True: 0, False: 21.8k]
  ------------------
  507|       |    /* Emit DQT for each quantization table.
  508|       |     * Note that emit_dqt() suppresses any duplicate tables.
  509|       |     */
  510|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (510:46): [True: 0, False: 0]
  ------------------
  511|      0|         ci++, compptr++) {
  512|      0|      prec += emit_dqt(cinfo, compptr->quant_tbl_no);
  513|      0|    }
  514|       |    /* now prec is nonzero iff there are any 16-bit quant tables. */
  515|      0|  }
  516|       |
  517|       |  /* Check for a non-baseline specification.
  518|       |   * Note we assume that Huffman table numbers won't be changed later.
  519|       |   */
  520|  21.8k|  if (cinfo->arith_code || cinfo->progressive_mode ||
  ------------------
  |  Branch (520:7): [True: 0, False: 21.8k]
  |  Branch (520:28): [True: 0, False: 21.8k]
  ------------------
  521|  21.8k|      cinfo->master->lossless || cinfo->data_precision != 8) {
  ------------------
  |  Branch (521:7): [True: 21.8k, False: 0]
  |  Branch (521:34): [True: 0, False: 0]
  ------------------
  522|  21.8k|    is_baseline = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  523|  21.8k|  } else {
  524|      0|    is_baseline = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  525|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (525:46): [True: 0, False: 0]
  ------------------
  526|      0|         ci++, compptr++) {
  527|      0|      if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1)
  ------------------
  |  Branch (527:11): [True: 0, False: 0]
  |  Branch (527:37): [True: 0, False: 0]
  ------------------
  528|      0|        is_baseline = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  529|      0|    }
  530|      0|    if (prec && is_baseline) {
  ------------------
  |  Branch (530:9): [True: 0, False: 0]
  |  Branch (530:17): [True: 0, False: 0]
  ------------------
  531|      0|      is_baseline = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  532|       |      /* If it's baseline except for quantizer size, warn the user */
  533|      0|      TRACEMS(cinfo, 0, JTRC_16BIT_TABLES);
  ------------------
  |  |  297|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  298|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  534|      0|    }
  535|      0|  }
  536|       |
  537|       |  /* Emit the proper SOF marker */
  538|  21.8k|  if (cinfo->arith_code) {
  ------------------
  |  Branch (538:7): [True: 0, False: 21.8k]
  ------------------
  539|      0|    if (cinfo->progressive_mode)
  ------------------
  |  Branch (539:9): [True: 0, False: 0]
  ------------------
  540|      0|      emit_sof(cinfo, M_SOF10); /* SOF code for progressive arithmetic */
  541|      0|    else
  542|      0|      emit_sof(cinfo, M_SOF9);  /* SOF code for sequential arithmetic */
  543|  21.8k|  } else {
  544|  21.8k|    if (cinfo->progressive_mode)
  ------------------
  |  Branch (544:9): [True: 0, False: 21.8k]
  ------------------
  545|      0|      emit_sof(cinfo, M_SOF2);  /* SOF code for progressive Huffman */
  546|  21.8k|    else if (cinfo->master->lossless)
  ------------------
  |  Branch (546:14): [True: 21.8k, False: 0]
  ------------------
  547|  21.8k|      emit_sof(cinfo, M_SOF3);  /* SOF code for lossless Huffman */
  548|      0|    else if (is_baseline)
  ------------------
  |  Branch (548:14): [True: 0, False: 0]
  ------------------
  549|      0|      emit_sof(cinfo, M_SOF0);  /* SOF code for baseline implementation */
  550|      0|    else
  551|      0|      emit_sof(cinfo, M_SOF1);  /* SOF code for non-baseline Huffman file */
  552|  21.8k|  }
  553|  21.8k|}
jcmarker.c:emit_sof:
  292|  21.8k|{
  293|  21.8k|  int ci;
  294|  21.8k|  jpeg_component_info *compptr;
  295|       |
  296|  21.8k|  emit_marker(cinfo, code);
  297|       |
  298|  21.8k|  emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
  299|       |
  300|       |  /* Make sure image isn't bigger than SOF field can handle */
  301|  21.8k|  if ((long)cinfo->_jpeg_height > 65535L || (long)cinfo->_jpeg_width > 65535L)
  ------------------
  |  |   31|  21.8k|#define _jpeg_height  image_height
  ------------------
                if ((long)cinfo->_jpeg_height > 65535L || (long)cinfo->_jpeg_width > 65535L)
  ------------------
  |  |   30|  21.8k|#define _jpeg_width  image_width
  ------------------
  |  Branch (301:7): [True: 0, False: 21.8k]
  |  Branch (301:45): [True: 0, False: 21.8k]
  ------------------
  302|      0|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)65535);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  303|       |
  304|  21.8k|  emit_byte(cinfo, cinfo->data_precision);
  305|  21.8k|  emit_2bytes(cinfo, (int)cinfo->_jpeg_height);
  ------------------
  |  |   31|  21.8k|#define _jpeg_height  image_height
  ------------------
  306|  21.8k|  emit_2bytes(cinfo, (int)cinfo->_jpeg_width);
  ------------------
  |  |   30|  21.8k|#define _jpeg_width  image_width
  ------------------
  307|       |
  308|  21.8k|  emit_byte(cinfo, cinfo->num_components);
  309|       |
  310|  81.7k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (310:44): [True: 59.9k, False: 21.8k]
  ------------------
  311|  59.9k|       ci++, compptr++) {
  312|  59.9k|    emit_byte(cinfo, compptr->component_id);
  313|  59.9k|    emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor);
  314|  59.9k|    emit_byte(cinfo, compptr->quant_tbl_no);
  315|  59.9k|  }
  316|  21.8k|}
jcmarker.c:write_scan_header:
  564|  21.8k|{
  565|  21.8k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
  566|  21.8k|  int i;
  567|  21.8k|  jpeg_component_info *compptr;
  568|       |
  569|  21.8k|  if (cinfo->arith_code) {
  ------------------
  |  Branch (569:7): [True: 0, False: 21.8k]
  ------------------
  570|       |    /* Emit arith conditioning info.  We may have some duplication
  571|       |     * if the file has multiple scans, but it's so small it's hardly
  572|       |     * worth worrying about.
  573|       |     */
  574|      0|    emit_dac(cinfo);
  575|  21.8k|  } else {
  576|       |    /* Emit Huffman tables.
  577|       |     * Note that emit_dht() suppresses any duplicate tables.
  578|       |     */
  579|  81.7k|    for (i = 0; i < cinfo->comps_in_scan; i++) {
  ------------------
  |  Branch (579:17): [True: 59.9k, False: 21.8k]
  ------------------
  580|  59.9k|      compptr = cinfo->cur_comp_info[i];
  581|       |      /* DC needs no table for refinement scan */
  582|  59.9k|      if ((cinfo->Ss == 0 && cinfo->Ah == 0) || cinfo->master->lossless)
  ------------------
  |  Branch (582:12): [True: 0, False: 59.9k]
  |  Branch (582:30): [True: 0, False: 0]
  |  Branch (582:49): [True: 59.9k, False: 0]
  ------------------
  583|  59.9k|        emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
  ------------------
  |  |  207|  59.9k|#define FALSE   0               /* values of boolean */
  ------------------
  584|       |      /* AC needs no table when not present, and lossless mode uses only DC
  585|       |         tables. */
  586|  59.9k|      if (cinfo->Se && !cinfo->master->lossless)
  ------------------
  |  Branch (586:11): [True: 0, False: 59.9k]
  |  Branch (586:24): [True: 0, False: 0]
  ------------------
  587|      0|        emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  588|  59.9k|    }
  589|  21.8k|  }
  590|       |
  591|       |  /* Emit DRI if required --- note that DRI value could change for each scan.
  592|       |   * We avoid wasting space with unnecessary DRIs, however.
  593|       |   */
  594|  21.8k|  if (cinfo->restart_interval != marker->last_restart_interval) {
  ------------------
  |  Branch (594:7): [True: 5.95k, False: 15.8k]
  ------------------
  595|  5.95k|    emit_dri(cinfo);
  596|  5.95k|    marker->last_restart_interval = cinfo->restart_interval;
  597|  5.95k|  }
  598|       |
  599|  21.8k|  emit_sos(cinfo);
  600|  21.8k|}
jcmarker.c:emit_dht:
  193|  59.9k|{
  194|  59.9k|  JHUFF_TBL *htbl;
  195|  59.9k|  int length, i;
  196|       |
  197|  59.9k|  if (is_ac) {
  ------------------
  |  Branch (197:7): [True: 0, False: 59.9k]
  ------------------
  198|      0|    htbl = cinfo->ac_huff_tbl_ptrs[index];
  199|      0|    index += 0x10;              /* output index has AC bit set */
  200|  59.9k|  } else {
  201|  59.9k|    htbl = cinfo->dc_huff_tbl_ptrs[index];
  202|  59.9k|  }
  203|       |
  204|  59.9k|  if (htbl == NULL)
  ------------------
  |  Branch (204:7): [True: 0, False: 59.9k]
  ------------------
  205|      0|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  206|       |
  207|  59.9k|  if (!htbl->sent_table) {
  ------------------
  |  Branch (207:7): [True: 21.8k, False: 38.1k]
  ------------------
  208|  21.8k|    emit_marker(cinfo, M_DHT);
  209|       |
  210|  21.8k|    length = 0;
  211|   371k|    for (i = 1; i <= 16; i++)
  ------------------
  |  Branch (211:17): [True: 349k, False: 21.8k]
  ------------------
  212|   349k|      length += htbl->bits[i];
  213|       |
  214|  21.8k|    emit_2bytes(cinfo, length + 2 + 1 + 16);
  215|  21.8k|    emit_byte(cinfo, index);
  216|       |
  217|   371k|    for (i = 1; i <= 16; i++)
  ------------------
  |  Branch (217:17): [True: 349k, False: 21.8k]
  ------------------
  218|   349k|      emit_byte(cinfo, htbl->bits[i]);
  219|       |
  220|   148k|    for (i = 0; i < length; i++)
  ------------------
  |  Branch (220:17): [True: 126k, False: 21.8k]
  ------------------
  221|   126k|      emit_byte(cinfo, htbl->huffval[i]);
  222|       |
  223|  21.8k|    htbl->sent_table = TRUE;
  ------------------
  |  |  210|  21.8k|#define TRUE    1
  ------------------
  224|  21.8k|  }
  225|  59.9k|}
jcmarker.c:emit_dri:
  280|  5.95k|{
  281|  5.95k|  emit_marker(cinfo, M_DRI);
  282|       |
  283|  5.95k|  emit_2bytes(cinfo, 4);        /* fixed length */
  284|       |
  285|  5.95k|  emit_2bytes(cinfo, (int)cinfo->restart_interval);
  286|  5.95k|}
jcmarker.c:emit_sos:
  322|  21.8k|{
  323|  21.8k|  int i, td, ta;
  324|  21.8k|  jpeg_component_info *compptr;
  325|       |
  326|  21.8k|  emit_marker(cinfo, M_SOS);
  327|       |
  328|  21.8k|  emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
  329|       |
  330|  21.8k|  emit_byte(cinfo, cinfo->comps_in_scan);
  331|       |
  332|  81.7k|  for (i = 0; i < cinfo->comps_in_scan; i++) {
  ------------------
  |  Branch (332:15): [True: 59.9k, False: 21.8k]
  ------------------
  333|  59.9k|    compptr = cinfo->cur_comp_info[i];
  334|  59.9k|    emit_byte(cinfo, compptr->component_id);
  335|       |
  336|       |    /* We emit 0 for unused field(s); this is recommended by the P&M text
  337|       |     * but does not seem to be specified in the standard.
  338|       |     */
  339|       |
  340|       |    /* DC needs no table for refinement scan */
  341|  59.9k|    td = cinfo->Ss == 0 && cinfo->Ah == 0 ? compptr->dc_tbl_no : 0;
  ------------------
  |  Branch (341:10): [True: 0, False: 59.9k]
  |  Branch (341:28): [True: 0, False: 0]
  ------------------
  342|       |    /* AC needs no table when not present */
  343|  59.9k|    ta = cinfo->Se ? compptr->ac_tbl_no : 0;
  ------------------
  |  Branch (343:10): [True: 0, False: 59.9k]
  ------------------
  344|       |
  345|  59.9k|    emit_byte(cinfo, (td << 4) + ta);
  346|  59.9k|  }
  347|       |
  348|  21.8k|  emit_byte(cinfo, cinfo->Ss);
  349|  21.8k|  emit_byte(cinfo, cinfo->Se);
  350|  21.8k|  emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al);
  351|  21.8k|}
jcmarker.c:write_file_trailer:
  609|  21.8k|{
  610|  21.8k|  emit_marker(cinfo, M_EOI);
  611|  21.8k|}
jcmarker.c:write_marker_header:
  446|  19.9k|{
  447|  19.9k|  if (datalen > (unsigned int)65533)            /* safety check */
  ------------------
  |  Branch (447:7): [True: 0, False: 19.9k]
  ------------------
  448|      0|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  449|       |
  450|  19.9k|  emit_marker(cinfo, (JPEG_MARKER)marker);
  451|       |
  452|  19.9k|  emit_2bytes(cinfo, (int)(datalen + 2));       /* total length */
  453|  19.9k|}
jcmarker.c:write_marker_byte:
  458|   919k|{
  459|   919k|  emit_byte(cinfo, val);
  460|   919k|}

jinit_c_master_control:
  722|  21.8k|{
  723|  21.8k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  724|  21.8k|  boolean empty_huff_tables = TRUE;
  ------------------
  |  |  210|  21.8k|#define TRUE    1
  ------------------
  725|  21.8k|  int i;
  726|       |
  727|       |#ifdef WITH_PROFILE
  728|       |  master->pub.total_start = getTime();
  729|       |#endif
  730|       |
  731|  21.8k|  master->pub.prepare_for_pass = prepare_for_pass;
  732|  21.8k|  master->pub.pass_startup = pass_startup;
  733|  21.8k|  master->pub.finish_pass = finish_pass_master;
  734|  21.8k|  master->pub.is_last_pass = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  735|       |
  736|  21.8k|  if (cinfo->scan_info != NULL) {
  ------------------
  |  Branch (736:7): [True: 0, False: 21.8k]
  ------------------
  737|      0|#ifdef NEED_SCAN_SCRIPT
  738|      0|    validate_script(cinfo);
  739|       |#else
  740|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  741|       |#endif
  742|  21.8k|  } else {
  743|  21.8k|    cinfo->progressive_mode = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  744|  21.8k|    cinfo->num_scans = 1;
  745|  21.8k|  }
  746|       |
  747|  21.8k|#ifdef C_LOSSLESS_SUPPORTED
  748|       |  /* Disable smoothing and subsampling in lossless mode, since those are lossy
  749|       |   * algorithms.  Set the JPEG colorspace to the input colorspace.  Disable raw
  750|       |   * (downsampled) data input, because it isn't particularly useful without
  751|       |   * subsampling and has not been tested in lossless mode.
  752|       |   */
  753|  21.8k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (753:7): [True: 21.8k, False: 0]
  ------------------
  754|  21.8k|    int ci;
  755|  21.8k|    jpeg_component_info *compptr;
  756|       |
  757|  21.8k|    cinfo->raw_data_in = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  758|  21.8k|    cinfo->smoothing_factor = 0;
  759|  21.8k|    jpeg_default_colorspace(cinfo);
  760|  81.7k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (760:46): [True: 59.9k, False: 21.8k]
  ------------------
  761|  59.9k|         ci++, compptr++)
  762|  59.9k|      compptr->h_samp_factor = compptr->v_samp_factor = 1;
  763|  21.8k|  }
  764|  21.8k|#endif
  765|       |
  766|       |  /* Validate parameters, determine derived values */
  767|  21.8k|  initial_setup(cinfo, transcode_only);
  768|       |
  769|  21.8k|  if (cinfo->arith_code)
  ------------------
  |  Branch (769:7): [True: 0, False: 21.8k]
  ------------------
  770|      0|    cinfo->optimize_coding = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  771|  21.8k|  else {
  772|  21.8k|    if (cinfo->master->lossless ||      /*  TEMPORARY HACK ??? */
  ------------------
  |  Branch (772:9): [True: 21.8k, False: 0]
  ------------------
  773|      0|        cinfo->progressive_mode)
  ------------------
  |  Branch (773:9): [True: 0, False: 0]
  ------------------
  774|  21.8k|      cinfo->optimize_coding = TRUE; /* assume default tables no good for
  ------------------
  |  |  210|  21.8k|#define TRUE    1
  ------------------
  775|       |                                        progressive mode or lossless mode */
  776|  21.8k|    for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  21.8k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (776:17): [True: 21.8k, False: 0]
  ------------------
  777|  21.8k|      if (cinfo->dc_huff_tbl_ptrs[i] != NULL ||
  ------------------
  |  Branch (777:11): [True: 21.8k, False: 0]
  ------------------
  778|  21.8k|          cinfo->ac_huff_tbl_ptrs[i] != NULL) {
  ------------------
  |  Branch (778:11): [True: 0, False: 0]
  ------------------
  779|  21.8k|        empty_huff_tables = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  780|  21.8k|        break;
  781|  21.8k|      }
  782|  21.8k|    }
  783|  21.8k|    if (cinfo->data_precision == 12 && !cinfo->optimize_coding &&
  ------------------
  |  Branch (783:9): [True: 0, False: 21.8k]
  |  Branch (783:40): [True: 0, False: 0]
  ------------------
  784|      0|        (empty_huff_tables || using_std_huff_tables(cinfo)))
  ------------------
  |  Branch (784:10): [True: 0, False: 0]
  |  Branch (784:31): [True: 0, False: 0]
  ------------------
  785|      0|      cinfo->optimize_coding = TRUE; /* assume default tables no good for
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  786|       |                                        12-bit data precision */
  787|  21.8k|  }
  788|       |
  789|       |  /* Initialize my private state */
  790|  21.8k|  if (transcode_only) {
  ------------------
  |  Branch (790:7): [True: 0, False: 21.8k]
  ------------------
  791|       |    /* no main pass in transcoding */
  792|      0|    if (cinfo->optimize_coding)
  ------------------
  |  Branch (792:9): [True: 0, False: 0]
  ------------------
  793|      0|      master->pass_type = huff_opt_pass;
  794|      0|    else
  795|      0|      master->pass_type = output_pass;
  796|  21.8k|  } else {
  797|       |    /* for normal compression, first pass is always this type: */
  798|  21.8k|    master->pass_type = main_pass;
  799|  21.8k|  }
  800|  21.8k|  master->scan_number = 0;
  801|  21.8k|  master->pass_number = 0;
  802|  21.8k|  if (cinfo->optimize_coding)
  ------------------
  |  Branch (802:7): [True: 21.8k, False: 0]
  ------------------
  803|  21.8k|    master->total_passes = cinfo->num_scans * 2;
  804|      0|  else
  805|      0|    master->total_passes = cinfo->num_scans;
  806|       |
  807|  21.8k|  master->jpeg_version = PACKAGE_NAME " version " VERSION " (build " BUILD ")";
  ------------------
  |  |   17|  21.8k|#define PACKAGE_NAME  "libjpeg-turbo"
  ------------------
  808|  21.8k|}
jcmaster.c:prepare_for_pass:
  579|  43.6k|{
  580|  43.6k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  581|       |
  582|  43.6k|  switch (master->pass_type) {
  583|  21.8k|  case main_pass:
  ------------------
  |  Branch (583:3): [True: 21.8k, False: 21.8k]
  ------------------
  584|       |    /* Initial pass: will collect input data, and do either Huffman
  585|       |     * optimization or data output for the first scan.
  586|       |     */
  587|  21.8k|    select_scan_parameters(cinfo);
  588|  21.8k|    per_scan_setup(cinfo);
  589|  21.8k|    if (!cinfo->raw_data_in) {
  ------------------
  |  Branch (589:9): [True: 21.8k, False: 0]
  ------------------
  590|  21.8k|      (*cinfo->cconvert->start_pass) (cinfo);
  591|  21.8k|      (*cinfo->downsample->start_pass) (cinfo);
  592|  21.8k|      (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU);
  593|  21.8k|    }
  594|  21.8k|    (*cinfo->fdct->start_pass) (cinfo);
  595|  21.8k|    (*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding);
  596|  21.8k|    (*cinfo->coef->start_pass) (cinfo,
  597|  21.8k|                                (master->total_passes > 1 ?
  ------------------
  |  Branch (597:34): [True: 21.8k, False: 0]
  ------------------
  598|  21.8k|                                 JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
  599|  21.8k|    (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
  600|  21.8k|    if (cinfo->optimize_coding) {
  ------------------
  |  Branch (600:9): [True: 21.8k, False: 0]
  ------------------
  601|       |      /* No immediate data output; postpone writing frame/scan headers */
  602|  21.8k|      master->pub.call_pass_startup = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  603|  21.8k|    } else {
  604|       |      /* Will write frame/scan headers at first jpeg_write_scanlines call */
  605|      0|      master->pub.call_pass_startup = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  606|      0|    }
  607|  21.8k|    break;
  608|      0|#ifdef ENTROPY_OPT_SUPPORTED
  609|      0|  case huff_opt_pass:
  ------------------
  |  Branch (609:3): [True: 0, False: 43.6k]
  ------------------
  610|       |    /* Do Huffman optimization for a scan after the first one. */
  611|      0|    select_scan_parameters(cinfo);
  612|      0|    per_scan_setup(cinfo);
  613|      0|    if (cinfo->Ss != 0 || cinfo->Ah == 0 || cinfo->arith_code ||
  ------------------
  |  Branch (613:9): [True: 0, False: 0]
  |  Branch (613:27): [True: 0, False: 0]
  |  Branch (613:45): [True: 0, False: 0]
  ------------------
  614|      0|        cinfo->master->lossless) {
  ------------------
  |  Branch (614:9): [True: 0, False: 0]
  ------------------
  615|      0|      (*cinfo->entropy->start_pass) (cinfo, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  616|      0|      (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
  617|      0|      master->pub.call_pass_startup = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  618|      0|      break;
  619|      0|    }
  620|       |    /* Special case: Huffman DC refinement scans need no Huffman table
  621|       |     * and therefore we can skip the optimization pass for them.
  622|       |     */
  623|      0|    master->pass_type = output_pass;
  624|      0|    master->pass_number++;
  625|      0|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|      0|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  626|      0|#endif
  627|  21.8k|  case output_pass:
  ------------------
  |  Branch (627:3): [True: 21.8k, False: 21.8k]
  ------------------
  628|       |    /* Do a data-output pass. */
  629|       |    /* We need not repeat per-scan setup if prior optimization pass did it. */
  630|  21.8k|    if (!cinfo->optimize_coding) {
  ------------------
  |  Branch (630:9): [True: 0, False: 21.8k]
  ------------------
  631|      0|      select_scan_parameters(cinfo);
  632|      0|      per_scan_setup(cinfo);
  633|      0|    }
  634|  21.8k|    (*cinfo->entropy->start_pass) (cinfo, FALSE);
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  635|  21.8k|    (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
  636|       |    /* We emit frame/scan headers now */
  637|  21.8k|    if (master->scan_number == 0)
  ------------------
  |  Branch (637:9): [True: 21.8k, False: 0]
  ------------------
  638|  21.8k|      (*cinfo->marker->write_frame_header) (cinfo);
  639|  21.8k|    (*cinfo->marker->write_scan_header) (cinfo);
  640|  21.8k|    master->pub.call_pass_startup = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  641|  21.8k|    break;
  642|      0|  default:
  ------------------
  |  Branch (642:3): [True: 0, False: 43.6k]
  ------------------
  643|      0|    ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  644|  43.6k|  }
  645|       |
  646|  43.6k|  master->pub.is_last_pass = (master->pass_number == master->total_passes - 1);
  647|       |
  648|       |  /* Set up progress monitor's pass info if present */
  649|  43.6k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (649:7): [True: 0, False: 43.6k]
  ------------------
  650|      0|    cinfo->progress->completed_passes = master->pass_number;
  651|      0|    cinfo->progress->total_passes = master->total_passes;
  652|      0|  }
  653|  43.6k|}
jcmaster.c:select_scan_parameters:
  444|  21.8k|{
  445|  21.8k|  int ci;
  446|       |
  447|  21.8k|#ifdef NEED_SCAN_SCRIPT
  448|  21.8k|  if (cinfo->scan_info != NULL) {
  ------------------
  |  Branch (448:7): [True: 0, False: 21.8k]
  ------------------
  449|       |    /* Prepare for current scan --- the script is already validated */
  450|      0|    my_master_ptr master = (my_master_ptr)cinfo->master;
  451|      0|    const jpeg_scan_info *scanptr = cinfo->scan_info + master->scan_number;
  452|       |
  453|      0|    cinfo->comps_in_scan = scanptr->comps_in_scan;
  454|      0|    for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
  ------------------
  |  Branch (454:18): [True: 0, False: 0]
  ------------------
  455|      0|      cinfo->cur_comp_info[ci] =
  456|      0|        &cinfo->comp_info[scanptr->component_index[ci]];
  457|      0|    }
  458|      0|    cinfo->Ss = scanptr->Ss;
  459|      0|    cinfo->Se = scanptr->Se;
  460|      0|    cinfo->Ah = scanptr->Ah;
  461|      0|    cinfo->Al = scanptr->Al;
  462|      0|  } else
  463|  21.8k|#endif
  464|  21.8k|  {
  465|       |    /* Prepare for single sequential-JPEG scan containing all components */
  466|  21.8k|    if (cinfo->num_components > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  21.8k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (466:9): [True: 0, False: 21.8k]
  ------------------
  467|      0|      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  468|  21.8k|               MAX_COMPS_IN_SCAN);
  469|  21.8k|    cinfo->comps_in_scan = cinfo->num_components;
  470|  81.7k|    for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (470:18): [True: 59.9k, False: 21.8k]
  ------------------
  471|  59.9k|      cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
  472|  59.9k|    }
  473|  21.8k|    if (!cinfo->master->lossless) {
  ------------------
  |  Branch (473:9): [True: 0, False: 21.8k]
  ------------------
  474|      0|      cinfo->Ss = 0;
  475|      0|      cinfo->Se = DCTSIZE2 - 1;
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  476|      0|      cinfo->Ah = 0;
  477|      0|      cinfo->Al = 0;
  478|      0|    }
  479|  21.8k|  }
  480|  21.8k|}
jcmaster.c:per_scan_setup:
  487|  21.8k|{
  488|  21.8k|  int ci, mcublks, tmp;
  489|  21.8k|  jpeg_component_info *compptr;
  490|  21.8k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (490:19): [True: 21.8k, False: 0]
  ------------------
  491|       |
  492|  21.8k|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (492:7): [True: 4.19k, False: 17.6k]
  ------------------
  493|       |
  494|       |    /* Noninterleaved (single-component) scan */
  495|  4.19k|    compptr = cinfo->cur_comp_info[0];
  496|       |
  497|       |    /* Overall image size in MCUs */
  498|  4.19k|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  499|  4.19k|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  500|       |
  501|       |    /* For noninterleaved scan, always one block per MCU */
  502|  4.19k|    compptr->MCU_width = 1;
  503|  4.19k|    compptr->MCU_height = 1;
  504|  4.19k|    compptr->MCU_blocks = 1;
  505|  4.19k|    compptr->MCU_sample_width = data_unit;
  506|  4.19k|    compptr->last_col_width = 1;
  507|       |    /* For noninterleaved scans, it is convenient to define last_row_height
  508|       |     * as the number of block rows present in the last iMCU row.
  509|       |     */
  510|  4.19k|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  511|  4.19k|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (511:9): [True: 4.19k, False: 0]
  ------------------
  512|  4.19k|    compptr->last_row_height = tmp;
  513|       |
  514|       |    /* Prepare array describing MCU composition */
  515|  4.19k|    cinfo->blocks_in_MCU = 1;
  516|  4.19k|    cinfo->MCU_membership[0] = 0;
  517|       |
  518|  17.6k|  } else {
  519|       |
  520|       |    /* Interleaved (multi-component) scan */
  521|  17.6k|    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  17.6k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (521:9): [True: 0, False: 17.6k]
  |  Branch (521:38): [True: 0, False: 17.6k]
  ------------------
  522|      0|      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  523|  17.6k|               MAX_COMPS_IN_SCAN);
  524|       |
  525|       |    /* Overall image size in MCUs */
  526|  17.6k|    cinfo->MCUs_per_row = (JDIMENSION)
  527|  17.6k|      jdiv_round_up((long)cinfo->_jpeg_width,
  ------------------
  |  |   30|  17.6k|#define _jpeg_width  image_width
  ------------------
  528|  17.6k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  529|  17.6k|    cinfo->MCU_rows_in_scan = (JDIMENSION)
  530|  17.6k|      jdiv_round_up((long)cinfo->_jpeg_height,
  ------------------
  |  |   31|  17.6k|#define _jpeg_height  image_height
  ------------------
  531|  17.6k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  532|       |
  533|  17.6k|    cinfo->blocks_in_MCU = 0;
  534|       |
  535|  73.3k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (535:18): [True: 55.7k, False: 17.6k]
  ------------------
  536|  55.7k|      compptr = cinfo->cur_comp_info[ci];
  537|       |      /* Sampling factors give # of blocks of component in each MCU */
  538|  55.7k|      compptr->MCU_width = compptr->h_samp_factor;
  539|  55.7k|      compptr->MCU_height = compptr->v_samp_factor;
  540|  55.7k|      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
  541|  55.7k|      compptr->MCU_sample_width = compptr->MCU_width * data_unit;
  542|       |      /* Figure number of non-dummy blocks in last MCU column & row */
  543|  55.7k|      tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
  544|  55.7k|      if (tmp == 0) tmp = compptr->MCU_width;
  ------------------
  |  Branch (544:11): [True: 55.7k, False: 0]
  ------------------
  545|  55.7k|      compptr->last_col_width = tmp;
  546|  55.7k|      tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
  547|  55.7k|      if (tmp == 0) tmp = compptr->MCU_height;
  ------------------
  |  Branch (547:11): [True: 55.7k, False: 0]
  ------------------
  548|  55.7k|      compptr->last_row_height = tmp;
  549|       |      /* Prepare array describing MCU composition */
  550|  55.7k|      mcublks = compptr->MCU_blocks;
  551|  55.7k|      if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU)
  ------------------
  |  |   80|  55.7k|#define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on data units/MCU */
  ------------------
  |  Branch (551:11): [True: 0, False: 55.7k]
  ------------------
  552|      0|        ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  553|   111k|      while (mcublks-- > 0) {
  ------------------
  |  Branch (553:14): [True: 55.7k, False: 55.7k]
  ------------------
  554|  55.7k|        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
  555|  55.7k|      }
  556|  55.7k|    }
  557|       |
  558|  17.6k|  }
  559|       |
  560|       |  /* Convert restart specified in rows to actual MCU count. */
  561|       |  /* Note that count must fit in 16 bits, so we provide limiting. */
  562|  21.8k|  if (cinfo->restart_in_rows > 0) {
  ------------------
  |  Branch (562:7): [True: 5.95k, False: 15.8k]
  ------------------
  563|  5.95k|    long nominal = (long)cinfo->restart_in_rows * (long)cinfo->MCUs_per_row;
  564|  5.95k|    cinfo->restart_interval = (unsigned int)MIN(nominal, 65535L);
  ------------------
  |  |  515|  5.95k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 5.95k, False: 0]
  |  |  ------------------
  ------------------
  565|  5.95k|  }
  566|  21.8k|}
jcmaster.c:finish_pass_master:
  682|  43.6k|{
  683|  43.6k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  684|       |
  685|       |  /* The entropy coder always needs an end-of-pass call,
  686|       |   * either to analyze statistics or to flush its output buffer.
  687|       |   */
  688|  43.6k|  (*cinfo->entropy->finish_pass) (cinfo);
  689|       |
  690|       |  /* Update state for next pass */
  691|  43.6k|  switch (master->pass_type) {
  ------------------
  |  Branch (691:11): [True: 43.6k, False: 0]
  ------------------
  692|  21.8k|  case main_pass:
  ------------------
  |  Branch (692:3): [True: 21.8k, False: 21.8k]
  ------------------
  693|       |    /* next pass is either output of scan 0 (after optimization)
  694|       |     * or output of scan 1 (if no optimization).
  695|       |     */
  696|  21.8k|    master->pass_type = output_pass;
  697|  21.8k|    if (!cinfo->optimize_coding)
  ------------------
  |  Branch (697:9): [True: 0, False: 21.8k]
  ------------------
  698|      0|      master->scan_number++;
  699|  21.8k|    break;
  700|      0|  case huff_opt_pass:
  ------------------
  |  Branch (700:3): [True: 0, False: 43.6k]
  ------------------
  701|       |    /* next pass is always output of current scan */
  702|      0|    master->pass_type = output_pass;
  703|      0|    break;
  704|  21.8k|  case output_pass:
  ------------------
  |  Branch (704:3): [True: 21.8k, False: 21.8k]
  ------------------
  705|       |    /* next pass is either optimization or output of next scan */
  706|  21.8k|    if (cinfo->optimize_coding)
  ------------------
  |  Branch (706:9): [True: 21.8k, False: 0]
  ------------------
  707|  21.8k|      master->pass_type = huff_opt_pass;
  708|  21.8k|    master->scan_number++;
  709|  21.8k|    break;
  710|  43.6k|  }
  711|       |
  712|  43.6k|  master->pass_number++;
  713|  43.6k|}
jcmaster.c:initial_setup:
  166|  21.8k|{
  167|  21.8k|  int ci;
  168|  21.8k|  jpeg_component_info *compptr;
  169|  21.8k|  long samplesperrow;
  170|  21.8k|  JDIMENSION jd_samplesperrow;
  171|  21.8k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (171:19): [True: 21.8k, False: 0]
  ------------------
  172|       |
  173|       |#if JPEG_LIB_VERSION >= 70
  174|       |#if JPEG_LIB_VERSION >= 80
  175|       |  if (!transcode_only)
  176|       |#endif
  177|       |    jpeg_calc_jpeg_dimensions(cinfo);
  178|       |#endif
  179|       |
  180|       |  /* Sanity check on image dimensions */
  181|  21.8k|  if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 ||
  ------------------
  |  |   31|  21.8k|#define _jpeg_height  image_height
  ------------------
                if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 ||
  ------------------
  |  |   30|  21.8k|#define _jpeg_width  image_width
  ------------------
  |  Branch (181:7): [True: 0, False: 21.8k]
  |  Branch (181:35): [True: 0, False: 21.8k]
  ------------------
  182|  21.8k|      cinfo->num_components <= 0 || cinfo->input_components <= 0)
  ------------------
  |  Branch (182:7): [True: 0, False: 21.8k]
  |  Branch (182:37): [True: 0, False: 21.8k]
  ------------------
  183|      0|    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  184|       |
  185|       |  /* Make sure image isn't bigger than I can handle */
  186|  21.8k|  if ((long)cinfo->_jpeg_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |   31|  21.8k|#define _jpeg_height  image_height
  ------------------
                if ((long)cinfo->_jpeg_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  158|  43.6k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (186:7): [True: 0, False: 21.8k]
  ------------------
  187|  21.8k|      (long)cinfo->_jpeg_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |   30|  21.8k|#define _jpeg_width  image_width
  ------------------
                    (long)cinfo->_jpeg_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  21.8k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (187:7): [True: 0, False: 21.8k]
  ------------------
  188|      0|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  189|       |
  190|       |  /* Width of an input scanline must be representable as JDIMENSION. */
  191|  21.8k|  samplesperrow = (long)cinfo->image_width * (long)cinfo->input_components;
  192|  21.8k|  jd_samplesperrow = (JDIMENSION)samplesperrow;
  193|  21.8k|  if ((long)jd_samplesperrow != samplesperrow)
  ------------------
  |  Branch (193:7): [True: 0, False: 21.8k]
  ------------------
  194|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  195|       |
  196|       |  /* Lossy JPEG images must have 8 or 12 bits per sample.  Lossless JPEG images
  197|       |   * can have 2 to 16 bits per sample.
  198|       |   */
  199|  21.8k|#ifdef C_LOSSLESS_SUPPORTED
  200|  21.8k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (200:7): [True: 21.8k, False: 0]
  ------------------
  201|  21.8k|    if (cinfo->data_precision < 2 || cinfo->data_precision > 16)
  ------------------
  |  Branch (201:9): [True: 0, False: 21.8k]
  |  Branch (201:38): [True: 0, False: 21.8k]
  ------------------
  202|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|  21.8k|  } else
  204|      0|#endif
  205|      0|  {
  206|      0|    if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
  ------------------
  |  Branch (206:9): [True: 0, False: 0]
  |  Branch (206:39): [True: 0, False: 0]
  ------------------
  207|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  208|      0|  }
  209|       |
  210|       |  /* Check that number of components won't exceed internal array sizes */
  211|  21.8k|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   30|  21.8k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (211:7): [True: 0, False: 21.8k]
  ------------------
  212|      0|    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  213|  21.8k|             MAX_COMPONENTS);
  214|       |
  215|       |  /* Compute maximum sampling factors; check factor validity */
  216|  21.8k|  cinfo->max_h_samp_factor = 1;
  217|  21.8k|  cinfo->max_v_samp_factor = 1;
  218|  81.7k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (218:44): [True: 59.9k, False: 21.8k]
  ------------------
  219|  59.9k|       ci++, compptr++) {
  220|  59.9k|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (220:9): [True: 0, False: 59.9k]
  ------------------
  221|  59.9k|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   72|   119k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (221:9): [True: 0, False: 59.9k]
  ------------------
  222|  59.9k|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (222:9): [True: 0, False: 59.9k]
  ------------------
  223|  59.9k|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   72|  59.9k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (223:9): [True: 0, False: 59.9k]
  ------------------
  224|      0|      ERREXIT(cinfo, JERR_BAD_SAMPLING);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  225|  59.9k|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  513|  59.9k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 0, False: 59.9k]
  |  |  ------------------
  ------------------
  226|  59.9k|                                   compptr->h_samp_factor);
  227|  59.9k|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  513|  59.9k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 0, False: 59.9k]
  |  |  ------------------
  ------------------
  228|  59.9k|                                   compptr->v_samp_factor);
  229|  59.9k|  }
  230|       |
  231|       |  /* Compute dimensions of components */
  232|  81.7k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (232:44): [True: 59.9k, False: 21.8k]
  ------------------
  233|  59.9k|       ci++, compptr++) {
  234|       |    /* Fill in the correct component_index value; don't rely on application */
  235|  59.9k|    compptr->component_index = ci;
  236|       |    /* For compression, we never do DCT scaling. */
  237|       |#if JPEG_LIB_VERSION >= 70
  238|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = data_unit;
  239|       |#else
  240|  59.9k|    compptr->DCT_scaled_size = data_unit;
  241|  59.9k|#endif
  242|       |    /* Size in data units */
  243|  59.9k|    compptr->width_in_blocks = (JDIMENSION)
  244|  59.9k|      jdiv_round_up((long)cinfo->_jpeg_width * (long)compptr->h_samp_factor,
  ------------------
  |  |   30|  59.9k|#define _jpeg_width  image_width
  ------------------
  245|  59.9k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  246|  59.9k|    compptr->height_in_blocks = (JDIMENSION)
  247|  59.9k|      jdiv_round_up((long)cinfo->_jpeg_height * (long)compptr->v_samp_factor,
  ------------------
  |  |   31|  59.9k|#define _jpeg_height  image_height
  ------------------
  248|  59.9k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  249|       |    /* Size in samples */
  250|  59.9k|    compptr->downsampled_width = (JDIMENSION)
  251|  59.9k|      jdiv_round_up((long)cinfo->_jpeg_width * (long)compptr->h_samp_factor,
  ------------------
  |  |   30|  59.9k|#define _jpeg_width  image_width
  ------------------
  252|  59.9k|                    (long)cinfo->max_h_samp_factor);
  253|  59.9k|    compptr->downsampled_height = (JDIMENSION)
  254|  59.9k|      jdiv_round_up((long)cinfo->_jpeg_height * (long)compptr->v_samp_factor,
  ------------------
  |  |   31|  59.9k|#define _jpeg_height  image_height
  ------------------
  255|  59.9k|                    (long)cinfo->max_v_samp_factor);
  256|       |    /* Mark component needed (this flag isn't actually used for compression) */
  257|  59.9k|    compptr->component_needed = TRUE;
  ------------------
  |  |  210|  59.9k|#define TRUE    1
  ------------------
  258|  59.9k|  }
  259|       |
  260|       |  /* Compute number of fully interleaved MCU rows (number of times that
  261|       |   * main controller will call coefficient or difference controller).
  262|       |   */
  263|  21.8k|  cinfo->total_iMCU_rows = (JDIMENSION)
  264|  21.8k|    jdiv_round_up((long)cinfo->_jpeg_height,
  ------------------
  |  |   31|  21.8k|#define _jpeg_height  image_height
  ------------------
  265|  21.8k|                  (long)(cinfo->max_v_samp_factor * data_unit));
  266|  21.8k|}

jpeg_abort:
   37|  21.8k|{
   38|  21.8k|  int pool;
   39|       |
   40|       |  /* Do nothing if called on a not-initialized or destroyed JPEG object. */
   41|  21.8k|  if (cinfo->mem == NULL)
  ------------------
  |  Branch (41:7): [True: 0, False: 21.8k]
  ------------------
   42|      0|    return;
   43|       |
   44|       |  /* Releasing pools in reverse order might help avoid fragmentation
   45|       |   * with some (brain-damaged) malloc libraries.
   46|       |   */
   47|  43.6k|  for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  21.8k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  43.6k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (47:35): [True: 21.8k, False: 21.8k]
  ------------------
   48|  21.8k|    (*cinfo->mem->free_pool) (cinfo, pool);
   49|  21.8k|  }
   50|       |
   51|       |  /* Reset overall state for possible reuse of object */
   52|  21.8k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (52:7): [True: 0, False: 21.8k]
  ------------------
   53|      0|    cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|      0|#define DSTATE_START     200    /* after create_decompress */
  ------------------
   54|       |    /* Try to keep application from accessing now-deleted marker list.
   55|       |     * A bit kludgy to do it here, but this is the most central place.
   56|       |     */
   57|      0|    ((j_decompress_ptr)cinfo)->marker_list = NULL;
   58|      0|    ((j_decompress_ptr)cinfo)->master->marker_list_end = NULL;
   59|  21.8k|  } else {
   60|  21.8k|    cinfo->global_state = CSTATE_START;
  ------------------
  |  |   44|  21.8k|#define CSTATE_START     100    /* after create_compress */
  ------------------
   61|  21.8k|  }
   62|       |
   63|       |#ifdef WITH_PROFILE
   64|       |  if (cinfo->is_decompressor) {
   65|       |    if (((j_decompress_ptr)cinfo)->master->total_start > 0.0)
   66|       |      ((j_decompress_ptr)cinfo)->master->total_elapsed +=
   67|       |        getTime() - ((j_decompress_ptr)cinfo)->master->total_start;
   68|       |  } else {
   69|       |    if (((j_compress_ptr)cinfo)->master->total_start > 0.0)
   70|       |      ((j_compress_ptr)cinfo)->master->total_elapsed +=
   71|       |        getTime() - ((j_compress_ptr)cinfo)->master->total_start;
   72|       |  }
   73|       |#endif
   74|  21.8k|}
jpeg_destroy:
   90|  58.6k|{
   91|       |#ifdef WITH_PROFILE
   92|       |  if (cinfo->is_decompressor) {
   93|       |    j_decompress_ptr dinfo = (j_decompress_ptr)cinfo;
   94|       |
   95|       |    if (dinfo->master->entropy_mcoeffs > 0.0) {
   96|       |      fprintf(stderr, "Entropy decoding:    %14.6f Mcoefficients/sec",
   97|       |              dinfo->master->entropy_mcoeffs / dinfo->master->entropy_elapsed);
   98|       |      if (dinfo->master->total_elapsed > 0.0)
   99|       |        fprintf(stderr, "  (%5.2f%% of total time)",
  100|       |                dinfo->master->entropy_elapsed * 100.0 /
  101|       |                  dinfo->master->total_elapsed);
  102|       |      fprintf(stderr, "\n");
  103|       |    }
  104|       |    if (dinfo->master->idct_mcoeffs > 0.0) {
  105|       |      fprintf(stderr, "Inverse DCT:         %14.6f Mcoefficients/sec",
  106|       |              dinfo->master->idct_mcoeffs / dinfo->master->idct_elapsed);
  107|       |      if (dinfo->master->total_elapsed > 0.0)
  108|       |        fprintf(stderr, "  (%5.2f%% of total time)",
  109|       |                dinfo->master->idct_elapsed * 100.0 /
  110|       |                  dinfo->master->total_elapsed);
  111|       |      fprintf(stderr, "\n");
  112|       |    }
  113|       |    if (dinfo->master->merged_upsample_mpixels > 0.0) {
  114|       |      fprintf(stderr, "Merged upsampling:   %14.6f Mpixels/sec",
  115|       |              dinfo->master->merged_upsample_mpixels /
  116|       |                dinfo->master->merged_upsample_elapsed);
  117|       |      if (dinfo->master->total_elapsed > 0.0)
  118|       |        fprintf(stderr, "        (%5.2f%% of total time)",
  119|       |                dinfo->master->merged_upsample_elapsed * 100.0 /
  120|       |                  dinfo->master->total_elapsed);
  121|       |      fprintf(stderr, "\n");
  122|       |    }
  123|       |    if (dinfo->master->upsample_msamples > 0.0) {
  124|       |      fprintf(stderr, "Upsampling:          %14.6f Msamples/sec",
  125|       |              dinfo->master->upsample_msamples /
  126|       |                dinfo->master->upsample_elapsed);
  127|       |      if (dinfo->master->total_elapsed > 0.0)
  128|       |        fprintf(stderr, "       (%5.2f%% of total time)",
  129|       |                dinfo->master->upsample_elapsed * 100.0 /
  130|       |                  dinfo->master->total_elapsed);
  131|       |      fprintf(stderr, "\n");
  132|       |    }
  133|       |    if (dinfo->master->cconvert_mpixels > 0.0) {
  134|       |      fprintf(stderr, "Color deconversion:  %14.6f Mpixels/sec",
  135|       |              dinfo->master->cconvert_mpixels /
  136|       |                dinfo->master->cconvert_elapsed);
  137|       |      if (dinfo->master->total_elapsed > 0.0)
  138|       |        fprintf(stderr, "        (%5.2f%% of total time)",
  139|       |                dinfo->master->cconvert_elapsed * 100.0 /
  140|       |                  dinfo->master->total_elapsed);
  141|       |      fprintf(stderr, "\n");
  142|       |    }
  143|       |  } else {
  144|       |    j_compress_ptr _cinfo = (j_compress_ptr)cinfo;
  145|       |
  146|       |    if (_cinfo->master->cconvert_mpixels > 0.0) {
  147|       |      fprintf(stderr, "Color conversion:    %14.6f Mpixels/sec",
  148|       |              _cinfo->master->cconvert_mpixels /
  149|       |                _cinfo->master->cconvert_elapsed);
  150|       |      if (_cinfo->master->total_elapsed > 0.0)
  151|       |        fprintf(stderr, "        (%5.2f%% of total time)",
  152|       |                _cinfo->master->cconvert_elapsed * 100.0 /
  153|       |                  _cinfo->master->total_elapsed);
  154|       |      fprintf(stderr, "\n");
  155|       |    }
  156|       |    if (_cinfo->master->downsample_msamples > 0.0) {
  157|       |      fprintf(stderr, "Downsampling:        %14.6f Msamples/sec",
  158|       |              _cinfo->master->downsample_msamples /
  159|       |                _cinfo->master->downsample_elapsed);
  160|       |      if (_cinfo->master->total_elapsed > 0.0)
  161|       |        fprintf(stderr, "       (%5.2f%% of total time)",
  162|       |                _cinfo->master->downsample_elapsed * 100.0 /
  163|       |                  _cinfo->master->total_elapsed);
  164|       |      fprintf(stderr, "\n");
  165|       |    }
  166|       |    if (_cinfo->master->convsamp_msamples > 0.0) {
  167|       |      fprintf(stderr, "Sample conversion:   %14.6f Msamples/sec",
  168|       |              _cinfo->master->convsamp_msamples /
  169|       |                _cinfo->master->convsamp_elapsed);
  170|       |      if (_cinfo->master->total_elapsed > 0.0)
  171|       |        fprintf(stderr, "       (%5.2f%% of total time)",
  172|       |                _cinfo->master->convsamp_elapsed * 100.0 /
  173|       |                  _cinfo->master->total_elapsed);
  174|       |      fprintf(stderr, "\n");
  175|       |    }
  176|       |    if (_cinfo->master->fdct_mcoeffs > 0.0) {
  177|       |      fprintf(stderr, "Forward DCT:         %14.6f Mcoefficients/sec",
  178|       |              _cinfo->master->fdct_mcoeffs / _cinfo->master->fdct_elapsed);
  179|       |      if (_cinfo->master->total_elapsed > 0.0)
  180|       |        fprintf(stderr, "  (%5.2f%% of total time)",
  181|       |                _cinfo->master->fdct_elapsed * 100.0 /
  182|       |                  _cinfo->master->total_elapsed);
  183|       |      fprintf(stderr, "\n");
  184|       |    }
  185|       |    if (_cinfo->master->quantize_mcoeffs > 0.0) {
  186|       |      fprintf(stderr, "Quantization:        %14.6f Mcoefficients/sec",
  187|       |              _cinfo->master->quantize_mcoeffs /
  188|       |                _cinfo->master->quantize_elapsed);
  189|       |      if (_cinfo->master->total_elapsed > 0.0)
  190|       |        fprintf(stderr, "  (%5.2f%% of total time)",
  191|       |                _cinfo->master->quantize_elapsed * 100.0 /
  192|       |                  _cinfo->master->total_elapsed);
  193|       |      fprintf(stderr, "\n");
  194|       |    }
  195|       |    if (_cinfo->master->entropy_mcoeffs > 0.0) {
  196|       |      fprintf(stderr, "Entropy encoding:    %14.6f Mcoefficients/sec",
  197|       |              _cinfo->master->entropy_mcoeffs /
  198|       |                _cinfo->master->entropy_elapsed);
  199|       |      if (_cinfo->master->total_elapsed > 0.0)
  200|       |        fprintf(stderr, "  (%5.2f%% of total time)",
  201|       |                _cinfo->master->entropy_elapsed * 100.0 /
  202|       |                  _cinfo->master->total_elapsed);
  203|       |      fprintf(stderr, "\n");
  204|       |    }
  205|       |  }
  206|       |#endif
  207|       |
  208|       |  /* We need only tell the memory manager to release everything. */
  209|       |  /* NB: mem pointer is NULL if memory mgr failed to initialize. */
  210|  58.6k|  if (cinfo->mem != NULL)
  ------------------
  |  Branch (210:7): [True: 58.6k, False: 0]
  ------------------
  211|  58.6k|    (*cinfo->mem->self_destruct) (cinfo);
  212|       |  cinfo->mem = NULL;            /* be safe if jpeg_destroy is called twice */
  213|  58.6k|  cinfo->global_state = 0;      /* mark it destroyed */
  214|  58.6k|}
jpeg_alloc_quant_table:
  224|  8.55k|{
  225|  8.55k|  JQUANT_TBL *tbl;
  226|       |
  227|  8.55k|  tbl = (JQUANT_TBL *)
  228|  8.55k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JQUANT_TBL));
  ------------------
  |  |  888|  8.55k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  229|  8.55k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  207|  8.55k|#define FALSE   0               /* values of boolean */
  ------------------
  230|  8.55k|  return tbl;
  231|  8.55k|}
jpeg_alloc_huff_table:
  236|  17.1k|{
  237|  17.1k|  JHUFF_TBL *tbl;
  238|       |
  239|  17.1k|  tbl = (JHUFF_TBL *)
  240|  17.1k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JHUFF_TBL));
  ------------------
  |  |  888|  17.1k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  241|  17.1k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  207|  17.1k|#define FALSE   0               /* values of boolean */
  ------------------
  242|  17.1k|  return tbl;
  243|  17.1k|}

jpeg_add_quant_table:
   38|  43.6k|{
   39|  43.6k|  JQUANT_TBL **qtblptr;
   40|  43.6k|  int i;
   41|  43.6k|  long temp;
   42|       |
   43|       |  /* Safety check to ensure start_compress not called yet. */
   44|  43.6k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  43.6k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (44:7): [True: 0, False: 43.6k]
  ------------------
   45|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   46|       |
   47|  43.6k|  if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS)
  ------------------
  |  |   68|  43.6k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (47:7): [True: 0, False: 43.6k]
  |  Branch (47:24): [True: 0, False: 43.6k]
  ------------------
   48|      0|    ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   49|       |
   50|  43.6k|  qtblptr = &cinfo->quant_tbl_ptrs[which_tbl];
   51|       |
   52|  43.6k|  if (*qtblptr == NULL)
  ------------------
  |  Branch (52:7): [True: 8.55k, False: 35.0k]
  ------------------
   53|  8.55k|    *qtblptr = jpeg_alloc_quant_table((j_common_ptr)cinfo);
   54|       |
   55|  2.83M|  for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  2.83M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (55:15): [True: 2.79M, False: 43.6k]
  ------------------
   56|  2.79M|    temp = ((long)basic_table[i] * scale_factor + 50L) / 100L;
   57|       |    /* limit the values to the valid range */
   58|  2.79M|    if (temp <= 0L) temp = 1L;
  ------------------
  |  Branch (58:9): [True: 0, False: 2.79M]
  ------------------
   59|  2.79M|    if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
  ------------------
  |  Branch (59:9): [True: 0, False: 2.79M]
  ------------------
   60|  2.79M|    if (force_baseline && temp > 255L)
  ------------------
  |  Branch (60:9): [True: 2.79M, False: 0]
  |  Branch (60:27): [True: 0, False: 2.79M]
  ------------------
   61|      0|      temp = 255L;              /* limit to baseline range if requested */
   62|  2.79M|    (*qtblptr)->quantval[i] = (UINT16)temp;
   63|  2.79M|  }
   64|       |
   65|       |  /* Initialize sent_table FALSE so table will be written to JPEG file. */
   66|  43.6k|  (*qtblptr)->sent_table = FALSE;
  ------------------
  |  |  207|  43.6k|#define FALSE   0               /* values of boolean */
  ------------------
   67|  43.6k|}
jpeg_set_linear_quality:
  122|  21.8k|{
  123|       |  /* Set up two quantization tables using the specified scaling */
  124|  21.8k|  jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
  125|  21.8k|                       scale_factor, force_baseline);
  126|  21.8k|  jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
  127|  21.8k|                       scale_factor, force_baseline);
  128|  21.8k|}
jpeg_quality_scaling:
  137|  21.8k|{
  138|       |  /* Safety limit on quality factor.  Convert 0 to 1 to avoid zero divide. */
  139|  21.8k|  if (quality <= 0) quality = 1;
  ------------------
  |  Branch (139:7): [True: 0, False: 21.8k]
  ------------------
  140|  21.8k|  if (quality > 100) quality = 100;
  ------------------
  |  Branch (140:7): [True: 0, False: 21.8k]
  ------------------
  141|       |
  142|       |  /* The basic table is used as-is (scaling 100) for a quality of 50.
  143|       |   * Qualities 50..100 are converted to scaling percentage 200 - 2*Q;
  144|       |   * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table
  145|       |   * to make all the table entries 1 (hence, minimum quantization loss).
  146|       |   * Qualities 1..50 are converted to scaling percentage 5000/Q.
  147|       |   */
  148|  21.8k|  if (quality < 50)
  ------------------
  |  Branch (148:7): [True: 0, False: 21.8k]
  ------------------
  149|      0|    quality = 5000 / quality;
  150|  21.8k|  else
  151|  21.8k|    quality = 200 - quality * 2;
  152|       |
  153|  21.8k|  return quality;
  154|  21.8k|}
jpeg_set_quality:
  164|  21.8k|{
  165|       |  /* Convert user 0-100 rating to percentage scaling */
  166|  21.8k|  quality = jpeg_quality_scaling(quality);
  167|       |
  168|       |  /* Set up standard quality tables */
  169|  21.8k|  jpeg_set_linear_quality(cinfo, quality, force_baseline);
  170|  21.8k|}
jpeg_set_defaults:
  185|  21.8k|{
  186|  21.8k|  int i;
  187|       |
  188|       |  /* Safety check to ensure start_compress not called yet. */
  189|  21.8k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  21.8k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (189:7): [True: 0, False: 21.8k]
  ------------------
  190|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  191|       |
  192|       |  /* Allocate comp_info array large enough for maximum component count.
  193|       |   * Array is made permanent in case application wants to compress
  194|       |   * multiple images at same param settings.
  195|       |   */
  196|  21.8k|  if (cinfo->comp_info == NULL)
  ------------------
  |  Branch (196:7): [True: 4.27k, False: 17.5k]
  ------------------
  197|  4.27k|    cinfo->comp_info = (jpeg_component_info *)
  198|  4.27k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  4.27k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  199|  4.27k|                                  MAX_COMPONENTS * sizeof(jpeg_component_info));
  ------------------
  |  |   30|  4.27k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  200|       |
  201|       |  /* Initialize everything not dependent on the color space */
  202|       |
  203|       |#if JPEG_LIB_VERSION >= 70
  204|       |  cinfo->scale_num = 1;         /* 1:1 scaling */
  205|       |  cinfo->scale_denom = 1;
  206|       |#endif
  207|       |  /* Set up two quantization tables using default quality of 75 */
  208|  21.8k|  jpeg_set_quality(cinfo, 75, TRUE);
  ------------------
  |  |  210|  21.8k|#define TRUE    1
  ------------------
  209|       |  /* Set up two Huffman tables */
  210|  21.8k|  std_huff_tables((j_common_ptr)cinfo);
  211|       |
  212|       |  /* Initialize default arithmetic coding conditioning */
  213|   371k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|   371k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (213:15): [True: 349k, False: 21.8k]
  ------------------
  214|   349k|    cinfo->arith_dc_L[i] = 0;
  215|   349k|    cinfo->arith_dc_U[i] = 1;
  216|   349k|    cinfo->arith_ac_K[i] = 5;
  217|   349k|  }
  218|       |
  219|       |  /* Default is no multiple-scan output */
  220|  21.8k|  cinfo->scan_info = NULL;
  221|  21.8k|  cinfo->num_scans = 0;
  222|       |
  223|       |  /* Default is lossy output */
  224|  21.8k|  cinfo->master->lossless = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|       |  /* Expect normal source image, not raw downsampled data */
  227|  21.8k|  cinfo->raw_data_in = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  228|       |
  229|       |  /* Use Huffman coding, not arithmetic coding, by default */
  230|  21.8k|  cinfo->arith_code = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  231|       |
  232|       |  /* By default, don't do extra passes to optimize entropy coding */
  233|  21.8k|  cinfo->optimize_coding = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  234|       |  /* The standard Huffman tables are only valid for 8-bit data precision.
  235|       |   * If the precision is higher, force optimization on so that usable
  236|       |   * tables will be computed.  This test can be removed if default tables
  237|       |   * are supplied that are valid for the desired precision.
  238|       |   */
  239|  21.8k|  if (cinfo->data_precision == 12)
  ------------------
  |  Branch (239:7): [True: 0, False: 21.8k]
  ------------------
  240|      0|    cinfo->optimize_coding = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  241|       |
  242|       |  /* By default, use the simpler non-cosited sampling alignment */
  243|  21.8k|  cinfo->CCIR601_sampling = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  244|       |
  245|       |#if JPEG_LIB_VERSION >= 70
  246|       |  /* By default, apply fancy downsampling */
  247|       |  cinfo->do_fancy_downsampling = TRUE;
  248|       |#endif
  249|       |
  250|       |  /* No input smoothing */
  251|  21.8k|  cinfo->smoothing_factor = 0;
  252|       |
  253|       |  /* DCT algorithm preference */
  254|  21.8k|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  301|  21.8k|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  255|       |
  256|       |  /* No restart markers */
  257|  21.8k|  cinfo->restart_interval = 0;
  258|  21.8k|  cinfo->restart_in_rows = 0;
  259|       |
  260|       |  /* Fill in default JFIF marker parameters.  Note that whether the marker
  261|       |   * will actually be written is determined by jpeg_set_colorspace.
  262|       |   *
  263|       |   * By default, the library emits JFIF version code 1.01.
  264|       |   * An application that wants to emit JFIF 1.02 extension markers should set
  265|       |   * JFIF_minor_version to 2.  We could probably get away with just defaulting
  266|       |   * to 1.02, but there may still be some decoders in use that will complain
  267|       |   * about that; saying 1.01 should minimize compatibility problems.
  268|       |   */
  269|  21.8k|  cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */
  270|  21.8k|  cinfo->JFIF_minor_version = 1;
  271|  21.8k|  cinfo->density_unit = 0;      /* Pixel size is unknown by default */
  272|  21.8k|  cinfo->X_density = 1;         /* Pixel aspect ratio is square by default */
  273|  21.8k|  cinfo->Y_density = 1;
  274|       |
  275|       |  /* Choose JPEG colorspace based on input space, set defaults accordingly */
  276|       |
  277|  21.8k|  jpeg_default_colorspace(cinfo);
  278|  21.8k|}
jpeg_default_colorspace:
  287|  43.6k|{
  288|  43.6k|  switch (cinfo->in_color_space) {
  289|  8.39k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (289:3): [True: 8.39k, False: 35.2k]
  ------------------
  290|  8.39k|    jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
  291|  8.39k|    break;
  292|      0|  case JCS_RGB:
  ------------------
  |  Branch (292:3): [True: 0, False: 43.6k]
  ------------------
  293|  6.18k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (293:3): [True: 6.18k, False: 37.4k]
  ------------------
  294|  11.9k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (294:3): [True: 5.72k, False: 37.9k]
  ------------------
  295|  18.0k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (295:3): [True: 6.18k, False: 37.4k]
  ------------------
  296|  18.0k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (296:3): [True: 0, False: 43.6k]
  ------------------
  297|  18.0k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (297:3): [True: 0, False: 43.6k]
  ------------------
  298|  23.8k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (298:3): [True: 5.72k, False: 37.9k]
  ------------------
  299|  23.8k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (299:3): [True: 0, False: 43.6k]
  ------------------
  300|  29.5k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (300:3): [True: 5.72k, False: 37.9k]
  ------------------
  301|  29.5k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (301:3): [True: 0, False: 43.6k]
  ------------------
  302|  29.5k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (302:3): [True: 0, False: 43.6k]
  ------------------
  303|  29.5k|#ifdef C_LOSSLESS_SUPPORTED
  304|  29.5k|    if (cinfo->master->lossless)
  ------------------
  |  Branch (304:9): [True: 14.7k, False: 14.7k]
  ------------------
  305|  14.7k|      jpeg_set_colorspace(cinfo, JCS_RGB);
  306|  14.7k|    else
  307|  14.7k|#endif
  308|  14.7k|      jpeg_set_colorspace(cinfo, JCS_YCbCr);
  309|  29.5k|    break;
  310|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (310:3): [True: 0, False: 43.6k]
  ------------------
  311|      0|    jpeg_set_colorspace(cinfo, JCS_YCbCr);
  312|      0|    break;
  313|  5.72k|  case JCS_CMYK:
  ------------------
  |  Branch (313:3): [True: 5.72k, False: 37.9k]
  ------------------
  314|  5.72k|    jpeg_set_colorspace(cinfo, JCS_CMYK); /* By default, no translation */
  315|  5.72k|    break;
  316|      0|  case JCS_YCCK:
  ------------------
  |  Branch (316:3): [True: 0, False: 43.6k]
  ------------------
  317|      0|    jpeg_set_colorspace(cinfo, JCS_YCCK);
  318|      0|    break;
  319|      0|  case JCS_UNKNOWN:
  ------------------
  |  Branch (319:3): [True: 0, False: 43.6k]
  ------------------
  320|      0|    jpeg_set_colorspace(cinfo, JCS_UNKNOWN);
  321|      0|    break;
  322|      0|  default:
  ------------------
  |  Branch (322:3): [True: 0, False: 43.6k]
  ------------------
  323|      0|    ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  324|  43.6k|  }
  325|  43.6k|}
jpeg_set_colorspace:
  334|  43.6k|{
  335|  43.6k|  jpeg_component_info *compptr;
  336|  43.6k|  int ci;
  337|       |
  338|  43.6k|#define SET_COMP(index, id, hsamp, vsamp, quant, dctbl, actbl) \
  339|  43.6k|  (compptr = &cinfo->comp_info[index], \
  340|  43.6k|   compptr->component_id = (id), \
  341|  43.6k|   compptr->h_samp_factor = (hsamp), \
  342|  43.6k|   compptr->v_samp_factor = (vsamp), \
  343|  43.6k|   compptr->quant_tbl_no = (quant), \
  344|  43.6k|   compptr->dc_tbl_no = (dctbl), \
  345|  43.6k|   compptr->ac_tbl_no = (actbl) )
  346|       |
  347|       |  /* Safety check to ensure start_compress not called yet. */
  348|  43.6k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  43.6k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (348:7): [True: 0, False: 43.6k]
  ------------------
  349|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  350|       |
  351|       |  /* For all colorspaces, we use Q and Huff tables 0 for luminance components,
  352|       |   * tables 1 for chrominance components.
  353|       |   */
  354|       |
  355|  43.6k|  cinfo->jpeg_color_space = colorspace;
  356|       |
  357|  43.6k|  cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */
  ------------------
  |  |  207|  43.6k|#define FALSE   0               /* values of boolean */
  ------------------
  358|  43.6k|  cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */
  ------------------
  |  |  207|  43.6k|#define FALSE   0               /* values of boolean */
  ------------------
  359|       |
  360|  43.6k|  switch (colorspace) {
  361|  8.39k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (361:3): [True: 8.39k, False: 35.2k]
  ------------------
  362|  8.39k|    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
  ------------------
  |  |  210|  8.39k|#define TRUE    1
  ------------------
  363|  8.39k|    cinfo->num_components = 1;
  364|       |    /* JFIF specifies component ID 1 */
  365|  8.39k|    SET_COMP(0, 1, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  8.39k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  8.39k|   compptr->component_id = (id), \
  |  |  341|  8.39k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  8.39k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  8.39k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  8.39k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  8.39k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  366|  8.39k|    break;
  367|  14.7k|  case JCS_RGB:
  ------------------
  |  Branch (367:3): [True: 14.7k, False: 28.8k]
  ------------------
  368|  14.7k|    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */
  ------------------
  |  |  210|  14.7k|#define TRUE    1
  ------------------
  369|  14.7k|    cinfo->num_components = 3;
  370|  14.7k|    SET_COMP(0, 0x52 /* 'R' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  14.7k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  14.7k|   compptr->component_id = (id), \
  |  |  341|  14.7k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  14.7k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  14.7k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  14.7k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  14.7k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  371|  14.7k|    SET_COMP(1, 0x47 /* 'G' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  14.7k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  14.7k|   compptr->component_id = (id), \
  |  |  341|  14.7k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  14.7k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  14.7k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  14.7k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  14.7k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  372|  14.7k|    SET_COMP(2, 0x42 /* 'B' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  14.7k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  14.7k|   compptr->component_id = (id), \
  |  |  341|  14.7k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  14.7k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  14.7k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  14.7k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  14.7k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  373|  14.7k|    break;
  374|  14.7k|  case JCS_YCbCr:
  ------------------
  |  Branch (374:3): [True: 14.7k, False: 28.8k]
  ------------------
  375|  14.7k|    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
  ------------------
  |  |  210|  14.7k|#define TRUE    1
  ------------------
  376|  14.7k|    cinfo->num_components = 3;
  377|       |    /* JFIF specifies component IDs 1,2,3 */
  378|       |    /* We default to 2x2 subsamples of chrominance */
  379|  14.7k|    SET_COMP(0, 1, 2, 2, 0, 0, 0);
  ------------------
  |  |  339|  14.7k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  14.7k|   compptr->component_id = (id), \
  |  |  341|  14.7k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  14.7k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  14.7k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  14.7k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  14.7k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  380|  14.7k|    SET_COMP(1, 2, 1, 1, 1, 1, 1);
  ------------------
  |  |  339|  14.7k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  14.7k|   compptr->component_id = (id), \
  |  |  341|  14.7k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  14.7k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  14.7k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  14.7k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  14.7k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  381|  14.7k|    SET_COMP(2, 3, 1, 1, 1, 1, 1);
  ------------------
  |  |  339|  14.7k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  14.7k|   compptr->component_id = (id), \
  |  |  341|  14.7k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  14.7k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  14.7k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  14.7k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  14.7k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  382|  14.7k|    break;
  383|  5.72k|  case JCS_CMYK:
  ------------------
  |  Branch (383:3): [True: 5.72k, False: 37.9k]
  ------------------
  384|  5.72k|    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */
  ------------------
  |  |  210|  5.72k|#define TRUE    1
  ------------------
  385|  5.72k|    cinfo->num_components = 4;
  386|  5.72k|    SET_COMP(0, 0x43 /* 'C' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  5.72k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  5.72k|   compptr->component_id = (id), \
  |  |  341|  5.72k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  5.72k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  5.72k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  5.72k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  5.72k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  387|  5.72k|    SET_COMP(1, 0x4D /* 'M' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  5.72k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  5.72k|   compptr->component_id = (id), \
  |  |  341|  5.72k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  5.72k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  5.72k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  5.72k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  5.72k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  388|  5.72k|    SET_COMP(2, 0x59 /* 'Y' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  5.72k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  5.72k|   compptr->component_id = (id), \
  |  |  341|  5.72k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  5.72k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  5.72k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  5.72k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  5.72k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  389|  5.72k|    SET_COMP(3, 0x4B /* 'K' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  5.72k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  5.72k|   compptr->component_id = (id), \
  |  |  341|  5.72k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  5.72k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  5.72k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  5.72k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  5.72k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  390|  5.72k|    break;
  391|      0|  case JCS_YCCK:
  ------------------
  |  Branch (391:3): [True: 0, False: 43.6k]
  ------------------
  392|      0|    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  393|      0|    cinfo->num_components = 4;
  394|      0|    SET_COMP(0, 1, 2, 2, 0, 0, 0);
  ------------------
  |  |  339|      0|  (compptr = &cinfo->comp_info[index], \
  |  |  340|      0|   compptr->component_id = (id), \
  |  |  341|      0|   compptr->h_samp_factor = (hsamp), \
  |  |  342|      0|   compptr->v_samp_factor = (vsamp), \
  |  |  343|      0|   compptr->quant_tbl_no = (quant), \
  |  |  344|      0|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|      0|   compptr->ac_tbl_no = (actbl) )
  ------------------
  395|      0|    SET_COMP(1, 2, 1, 1, 1, 1, 1);
  ------------------
  |  |  339|      0|  (compptr = &cinfo->comp_info[index], \
  |  |  340|      0|   compptr->component_id = (id), \
  |  |  341|      0|   compptr->h_samp_factor = (hsamp), \
  |  |  342|      0|   compptr->v_samp_factor = (vsamp), \
  |  |  343|      0|   compptr->quant_tbl_no = (quant), \
  |  |  344|      0|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|      0|   compptr->ac_tbl_no = (actbl) )
  ------------------
  396|      0|    SET_COMP(2, 3, 1, 1, 1, 1, 1);
  ------------------
  |  |  339|      0|  (compptr = &cinfo->comp_info[index], \
  |  |  340|      0|   compptr->component_id = (id), \
  |  |  341|      0|   compptr->h_samp_factor = (hsamp), \
  |  |  342|      0|   compptr->v_samp_factor = (vsamp), \
  |  |  343|      0|   compptr->quant_tbl_no = (quant), \
  |  |  344|      0|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|      0|   compptr->ac_tbl_no = (actbl) )
  ------------------
  397|      0|    SET_COMP(3, 4, 2, 2, 0, 0, 0);
  ------------------
  |  |  339|      0|  (compptr = &cinfo->comp_info[index], \
  |  |  340|      0|   compptr->component_id = (id), \
  |  |  341|      0|   compptr->h_samp_factor = (hsamp), \
  |  |  342|      0|   compptr->v_samp_factor = (vsamp), \
  |  |  343|      0|   compptr->quant_tbl_no = (quant), \
  |  |  344|      0|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|      0|   compptr->ac_tbl_no = (actbl) )
  ------------------
  398|      0|    break;
  399|      0|  case JCS_UNKNOWN:
  ------------------
  |  Branch (399:3): [True: 0, False: 43.6k]
  ------------------
  400|      0|    cinfo->num_components = cinfo->input_components;
  401|      0|    if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   30|      0|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (401:9): [True: 0, False: 0]
  |  Branch (401:38): [True: 0, False: 0]
  ------------------
  402|      0|      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  403|      0|               MAX_COMPONENTS);
  404|      0|    for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (404:18): [True: 0, False: 0]
  ------------------
  405|      0|      SET_COMP(ci, ci, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|      0|  (compptr = &cinfo->comp_info[index], \
  |  |  340|      0|   compptr->component_id = (id), \
  |  |  341|      0|   compptr->h_samp_factor = (hsamp), \
  |  |  342|      0|   compptr->v_samp_factor = (vsamp), \
  |  |  343|      0|   compptr->quant_tbl_no = (quant), \
  |  |  344|      0|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|      0|   compptr->ac_tbl_no = (actbl) )
  ------------------
  406|      0|    }
  407|      0|    break;
  408|      0|  default:
  ------------------
  |  Branch (408:3): [True: 0, False: 43.6k]
  ------------------
  409|      0|    ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  410|  43.6k|  }
  411|  43.6k|}
jpeg_enable_lossless:
  569|  21.8k|{
  570|       |  /* Safety check to ensure start_compress not called yet. */
  571|  21.8k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  21.8k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (571:7): [True: 0, False: 21.8k]
  ------------------
  572|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  573|       |
  574|  21.8k|  cinfo->master->lossless = TRUE;
  ------------------
  |  |  210|  21.8k|#define TRUE    1
  ------------------
  575|  21.8k|  cinfo->Ss = predictor_selection_value;
  576|  21.8k|  cinfo->Se = 0;
  577|  21.8k|  cinfo->Ah = 0;
  578|  21.8k|  cinfo->Al = point_transform;
  579|       |
  580|       |  /* The JPEG spec simply gives the range 0..15 for Al (Pt), but that seems
  581|       |   * wrong: the upper bound ought to depend on data precision.  Perhaps they
  582|       |   * really meant 0..N-1 for N-bit precision, which is what we allow here.
  583|       |   * Values greater than or equal to the data precision will result in a blank
  584|       |   * image.
  585|       |   */
  586|  21.8k|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (586:7): [True: 0, False: 21.8k]
  |  Branch (586:24): [True: 0, False: 21.8k]
  ------------------
  587|  21.8k|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (587:7): [True: 0, False: 21.8k]
  |  Branch (587:24): [True: 0, False: 21.8k]
  ------------------
  588|      0|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      0|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      0|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  589|  21.8k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  590|  21.8k|}

jinit_c_prep_controller:
  356|  21.8k|{
  357|  21.8k|  my_prep_ptr prep;
  358|  21.8k|  int ci;
  359|  21.8k|  jpeg_component_info *compptr;
  360|  21.8k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (360:19): [True: 21.8k, False: 0]
  ------------------
  361|       |
  362|  21.8k|#ifdef C_LOSSLESS_SUPPORTED
  363|  21.8k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (363:7): [True: 21.8k, False: 0]
  ------------------
  364|  21.8k|#if BITS_IN_JSAMPLE == 8
  365|  21.8k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  43.6k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (365:9): [True: 0, False: 21.8k]
  |  Branch (365:52): [True: 0, False: 21.8k]
  ------------------
  366|       |#else
  367|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  368|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  369|       |#endif
  370|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  371|  21.8k|  } else
  372|      0|#endif
  373|      0|  {
  374|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (374:9): [True: 0, False: 0]
  ------------------
  375|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  376|      0|  }
  377|       |
  378|  21.8k|  if (need_full_buffer)         /* safety check */
  ------------------
  |  Branch (378:7): [True: 0, False: 21.8k]
  ------------------
  379|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  380|       |
  381|  21.8k|  prep = (my_prep_ptr)
  382|  21.8k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  21.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  383|  21.8k|                                sizeof(my_prep_controller));
  384|  21.8k|  cinfo->prep = (struct jpeg_c_prep_controller *)prep;
  385|  21.8k|  prep->pub.start_pass = start_pass_prep;
  386|       |
  387|       |  /* Allocate the color conversion buffer.
  388|       |   * We make the buffer wide enough to allow the downsampler to edge-expand
  389|       |   * horizontally within the buffer, if it so chooses.
  390|       |   */
  391|  21.8k|  if (cinfo->downsample->need_context_rows) {
  ------------------
  |  Branch (391:7): [True: 0, False: 21.8k]
  ------------------
  392|       |    /* Set up to provide context rows */
  393|      0|#ifdef CONTEXT_ROWS_SUPPORTED
  394|      0|    prep->pub._pre_process_data = pre_process_context;
  ------------------
  |  |  246|      0|#define _pre_process_data  pre_process_data
  ------------------
  395|      0|    create_context_buffer(cinfo);
  396|       |#else
  397|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  398|       |#endif
  399|  21.8k|  } else {
  400|       |    /* No context, just make it tall enough for one row group */
  401|  21.8k|    prep->pub._pre_process_data = pre_process_data;
  ------------------
  |  |  246|  21.8k|#define _pre_process_data  pre_process_data
  ------------------
  402|  81.7k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (402:46): [True: 59.9k, False: 21.8k]
  ------------------
  403|  59.9k|         ci++, compptr++) {
  404|  59.9k|      prep->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  405|  59.9k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  59.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  406|  59.9k|         (JDIMENSION)(((long)compptr->width_in_blocks * data_unit *
  407|  59.9k|                       cinfo->max_h_samp_factor) / compptr->h_samp_factor),
  408|  59.9k|         (JDIMENSION)cinfo->max_v_samp_factor);
  409|  59.9k|    }
  410|  21.8k|  }
  411|  21.8k|}
jcprepct-8.c:start_pass_prep:
   90|  21.8k|{
   91|  21.8k|  my_prep_ptr prep = (my_prep_ptr)cinfo->prep;
   92|       |
   93|  21.8k|  if (pass_mode != JBUF_PASS_THRU)
  ------------------
  |  Branch (93:7): [True: 0, False: 21.8k]
  ------------------
   94|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   95|       |
   96|       |  /* Initialize total-height counter for detecting bottom of image */
   97|  21.8k|  prep->rows_to_go = cinfo->image_height;
   98|       |  /* Mark the conversion buffer empty */
   99|  21.8k|  prep->next_buf_row = 0;
  100|  21.8k|#ifdef CONTEXT_ROWS_SUPPORTED
  101|       |  /* Preset additional state variables for context mode.
  102|       |   * These aren't used in non-context mode, so we needn't test which mode.
  103|       |   */
  104|  21.8k|  prep->this_row_group = 0;
  105|       |  /* Set next_buf_stop to stop after two row groups have been read in. */
  106|  21.8k|  prep->next_buf_stop = 2 * cinfo->max_v_samp_factor;
  107|  21.8k|#endif
  108|  21.8k|}
jcprepct-8.c:pre_process_data:
  143|  15.3M|{
  144|  15.3M|  my_prep_ptr prep = (my_prep_ptr)cinfo->prep;
  145|  15.3M|  int numrows, ci;
  146|  15.3M|  JDIMENSION inrows;
  147|  15.3M|  jpeg_component_info *compptr;
  148|  15.3M|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (148:19): [True: 15.3M, False: 0]
  ------------------
  149|       |
  150|  30.6M|  while (*in_row_ctr < in_rows_avail &&
  ------------------
  |  Branch (150:10): [True: 30.6M, False: 21.8k]
  ------------------
  151|  30.6M|         *out_row_group_ctr < out_row_groups_avail) {
  ------------------
  |  Branch (151:10): [True: 15.3M, False: 15.3M]
  ------------------
  152|       |    /* Do color conversion to fill the conversion buffer. */
  153|  15.3M|    inrows = in_rows_avail - *in_row_ctr;
  154|  15.3M|    numrows = cinfo->max_v_samp_factor - prep->next_buf_row;
  155|  15.3M|    numrows = (int)MIN((JDIMENSION)numrows, inrows);
  ------------------
  |  |  515|  15.3M|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 15.3M, False: 21.8k]
  |  |  ------------------
  ------------------
  156|       |#ifdef WITH_PROFILE
  157|       |    cinfo->master->start = getTime();
  158|       |#endif
  159|  15.3M|    (*cinfo->cconvert->_color_convert) (cinfo, input_buf + *in_row_ctr,
  ------------------
  |  |  267|  15.3M|#define _color_convert  color_convert
  ------------------
  160|  15.3M|                                        prep->color_buf,
  161|  15.3M|                                        (JDIMENSION)prep->next_buf_row,
  162|  15.3M|                                        numrows);
  163|       |#ifdef WITH_PROFILE
  164|       |    cinfo->master->cconvert_elapsed += getTime() - cinfo->master->start;
  165|       |    cinfo->master->cconvert_mpixels +=
  166|       |      (double)cinfo->image_width * numrows / 1000000.;
  167|       |#endif
  168|  15.3M|    *in_row_ctr += numrows;
  169|  15.3M|    prep->next_buf_row += numrows;
  170|  15.3M|    prep->rows_to_go -= numrows;
  171|       |    /* If at bottom of image, pad to fill the conversion buffer. */
  172|  15.3M|    if (prep->rows_to_go == 0 &&
  ------------------
  |  Branch (172:9): [True: 21.8k, False: 15.3M]
  ------------------
  173|  21.8k|        prep->next_buf_row < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (173:9): [True: 0, False: 21.8k]
  ------------------
  174|      0|      for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (174:20): [True: 0, False: 0]
  ------------------
  175|      0|        expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
  176|      0|                           prep->next_buf_row, cinfo->max_v_samp_factor);
  177|      0|      }
  178|      0|      prep->next_buf_row = cinfo->max_v_samp_factor;
  179|      0|    }
  180|       |    /* If we've filled the conversion buffer, empty it. */
  181|  15.3M|    if (prep->next_buf_row == cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (181:9): [True: 15.3M, False: 0]
  ------------------
  182|       |#ifdef WITH_PROFILE
  183|       |      cinfo->master->start = getTime();
  184|       |#endif
  185|  15.3M|      (*cinfo->downsample->_downsample) (cinfo,
  ------------------
  |  |  252|  15.3M|#define _downsample  downsample
  ------------------
  186|  15.3M|                                         prep->color_buf, (JDIMENSION)0,
  187|  15.3M|                                         output_buf, *out_row_group_ctr);
  188|       |#ifdef WITH_PROFILE
  189|       |      cinfo->master->downsample_elapsed += getTime() - cinfo->master->start;
  190|       |      cinfo->master->downsample_msamples +=
  191|       |        (double)cinfo->image_width * cinfo->max_v_samp_factor / 1000000.;
  192|       |#endif
  193|  15.3M|      prep->next_buf_row = 0;
  194|  15.3M|      (*out_row_group_ctr)++;
  195|  15.3M|    }
  196|       |    /* If at bottom of image, pad the output to a full iMCU height.
  197|       |     * Note we assume the caller is providing a one-iMCU-height output buffer!
  198|       |     */
  199|  15.3M|    if (prep->rows_to_go == 0 && *out_row_group_ctr < out_row_groups_avail) {
  ------------------
  |  Branch (199:9): [True: 21.8k, False: 15.3M]
  |  Branch (199:34): [True: 0, False: 21.8k]
  ------------------
  200|      0|      for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (200:48): [True: 0, False: 0]
  ------------------
  201|      0|           ci++, compptr++) {
  202|      0|        expand_bottom_edge(output_buf[ci],
  203|      0|                           compptr->width_in_blocks * data_unit,
  204|      0|                           (int)(*out_row_group_ctr * compptr->v_samp_factor),
  205|      0|                           (int)(out_row_groups_avail * compptr->v_samp_factor));
  206|      0|      }
  207|      0|      *out_row_group_ctr = out_row_groups_avail;
  208|      0|      break;                    /* can exit outer loop without test */
  209|      0|    }
  210|  15.3M|  }
  211|  15.3M|}

jinit_downsampler:
  468|  21.8k|{
  469|  21.8k|  my_downsample_ptr downsample;
  470|  21.8k|  int ci;
  471|  21.8k|  jpeg_component_info *compptr;
  472|  21.8k|#ifdef INPUT_SMOOTHING_SUPPORTED
  473|  21.8k|  boolean smoothok = TRUE;
  ------------------
  |  |  210|  21.8k|#define TRUE    1
  ------------------
  474|  21.8k|#endif
  475|       |
  476|  21.8k|#ifdef C_LOSSLESS_SUPPORTED
  477|  21.8k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (477:7): [True: 21.8k, False: 0]
  ------------------
  478|  21.8k|#if BITS_IN_JSAMPLE == 8
  479|  21.8k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  43.6k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (479:9): [True: 0, False: 21.8k]
  |  Branch (479:52): [True: 0, False: 21.8k]
  ------------------
  480|       |#else
  481|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  482|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  483|       |#endif
  484|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  485|  21.8k|  } else
  486|      0|#endif
  487|      0|  {
  488|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (488:9): [True: 0, False: 0]
  ------------------
  489|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  490|      0|  }
  491|       |
  492|  21.8k|  downsample = (my_downsample_ptr)
  493|  21.8k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  21.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  494|  21.8k|                                sizeof(my_downsampler));
  495|  21.8k|  cinfo->downsample = (struct jpeg_downsampler *)downsample;
  496|  21.8k|  downsample->pub.start_pass = start_pass_downsample;
  497|  21.8k|  downsample->pub._downsample = sep_downsample;
  ------------------
  |  |  252|  21.8k|#define _downsample  downsample
  ------------------
  498|  21.8k|  downsample->pub.need_context_rows = FALSE;
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  499|       |
  500|  21.8k|  if (cinfo->CCIR601_sampling)
  ------------------
  |  Branch (500:7): [True: 0, False: 21.8k]
  ------------------
  501|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  502|       |
  503|       |  /* Verify we can handle the sampling factors, and set up method pointers */
  504|  81.7k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (504:44): [True: 59.9k, False: 21.8k]
  ------------------
  505|  59.9k|       ci++, compptr++) {
  506|  59.9k|    if (compptr->h_samp_factor == cinfo->max_h_samp_factor &&
  ------------------
  |  Branch (506:9): [True: 59.9k, False: 0]
  ------------------
  507|  59.9k|        compptr->v_samp_factor == cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (507:9): [True: 59.9k, False: 0]
  ------------------
  508|  59.9k|#ifdef INPUT_SMOOTHING_SUPPORTED
  509|  59.9k|      if (cinfo->smoothing_factor) {
  ------------------
  |  Branch (509:11): [True: 0, False: 59.9k]
  ------------------
  510|      0|        downsample->methods[ci] = fullsize_smooth_downsample;
  511|      0|        downsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  512|      0|      } else
  513|  59.9k|#endif
  514|  59.9k|        downsample->methods[ci] = fullsize_downsample;
  515|  59.9k|    } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
  ------------------
  |  Branch (515:16): [True: 0, False: 0]
  ------------------
  516|      0|               compptr->v_samp_factor == cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (516:16): [True: 0, False: 0]
  ------------------
  517|      0|#ifdef INPUT_SMOOTHING_SUPPORTED
  518|      0|      smoothok = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  519|      0|#endif
  520|      0|#ifdef WITH_SIMD
  521|      0|      if (jsimd_set_h2v1_downsample(cinfo))
  ------------------
  |  Branch (521:11): [True: 0, False: 0]
  ------------------
  522|      0|        downsample->methods[ci] = jsimd_h2v1_downsample;
  523|      0|      else
  524|      0|#endif
  525|      0|        downsample->methods[ci] = h2v1_downsample;
  526|      0|    } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
  ------------------
  |  Branch (526:16): [True: 0, False: 0]
  ------------------
  527|      0|               compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (527:16): [True: 0, False: 0]
  ------------------
  528|      0|#ifdef INPUT_SMOOTHING_SUPPORTED
  529|      0|      if (cinfo->smoothing_factor) {
  ------------------
  |  Branch (529:11): [True: 0, False: 0]
  ------------------
  530|      0|        downsample->methods[ci] = h2v2_smooth_downsample;
  531|      0|        downsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  532|      0|      } else
  533|      0|#endif
  534|      0|      {
  535|      0|#ifdef WITH_SIMD
  536|      0|        if (jsimd_set_h2v2_downsample(cinfo))
  ------------------
  |  Branch (536:13): [True: 0, False: 0]
  ------------------
  537|      0|          downsample->methods[ci] = jsimd_h2v2_downsample;
  538|      0|        else
  539|      0|#endif
  540|      0|          downsample->methods[ci] = h2v2_downsample;
  541|      0|      }
  542|      0|    } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&
  ------------------
  |  Branch (542:16): [True: 0, False: 0]
  ------------------
  543|      0|               (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) {
  ------------------
  |  Branch (543:16): [True: 0, False: 0]
  ------------------
  544|      0|#ifdef INPUT_SMOOTHING_SUPPORTED
  545|      0|      smoothok = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  546|      0|#endif
  547|      0|      downsample->methods[ci] = int_downsample;
  548|      0|    } else
  549|      0|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  550|  59.9k|  }
  551|       |
  552|  21.8k|#ifdef INPUT_SMOOTHING_SUPPORTED
  553|  21.8k|  if (cinfo->smoothing_factor && !smoothok)
  ------------------
  |  Branch (553:7): [True: 0, False: 21.8k]
  |  Branch (553:34): [True: 0, False: 0]
  ------------------
  554|      0|    TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL);
  ------------------
  |  |  297|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  298|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  555|  21.8k|#endif
  556|  21.8k|}
jcsample-8.c:start_pass_downsample:
   89|  21.8k|{
   90|       |  /* no work for now */
   91|  21.8k|}
jcsample-8.c:sep_downsample:
  130|  15.3M|{
  131|  15.3M|  my_downsample_ptr downsample = (my_downsample_ptr)cinfo->downsample;
  132|  15.3M|  int ci;
  133|  15.3M|  jpeg_component_info *compptr;
  134|  15.3M|  _JSAMPARRAY in_ptr, out_ptr;
  ------------------
  |  |  230|  15.3M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  135|       |
  136|  60.6M|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (136:44): [True: 45.3M, False: 15.3M]
  ------------------
  137|  45.3M|       ci++, compptr++) {
  138|  45.3M|    in_ptr = input_buf[ci] + in_row_index;
  139|  45.3M|    out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor);
  140|  45.3M|    (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr);
  141|  45.3M|  }
  142|  15.3M|}
jcsample-8.c:expand_right_edge:
  102|  45.3M|{
  103|  45.3M|  register _JSAMPROW ptr;
  104|  45.3M|  register _JSAMPLE pixval;
  105|  45.3M|  register int count;
  106|  45.3M|  int row;
  107|  45.3M|  int numcols = (int)(output_cols - input_cols);
  108|       |
  109|  45.3M|  if (numcols > 0) {
  ------------------
  |  Branch (109:7): [True: 0, False: 45.3M]
  ------------------
  110|      0|    for (row = 0; row < num_rows; row++) {
  ------------------
  |  Branch (110:19): [True: 0, False: 0]
  ------------------
  111|      0|      ptr = image_data[row] + input_cols;
  112|      0|      pixval = ptr[-1];
  113|      0|      for (count = numcols; count > 0; count--)
  ------------------
  |  Branch (113:29): [True: 0, False: 0]
  ------------------
  114|      0|        *ptr++ = pixval;
  115|      0|    }
  116|      0|  }
  117|  45.3M|}
jcsample-8.c:fullsize_downsample:
  203|  45.3M|{
  204|  45.3M|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (204:19): [True: 45.3M, False: 0]
  ------------------
  205|       |
  206|       |  /* Copy the data */
  207|  45.3M|  _jcopy_sample_rows(input_data, 0, output_data, 0, cinfo->max_v_samp_factor,
  ------------------
  |  |  297|  45.3M|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  208|  45.3M|                     cinfo->image_width);
  209|       |  /* Edge-expand */
  210|  45.3M|  expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width,
  211|  45.3M|                    compptr->width_in_blocks * data_unit);
  212|  45.3M|}

jpeg_mem_dest_tj:
  164|  80.4k|{
  165|  80.4k|  boolean reused = FALSE;
  ------------------
  |  |  207|  80.4k|#define FALSE   0               /* values of boolean */
  ------------------
  166|  80.4k|  my_mem_dest_ptr dest;
  167|       |
  168|  80.4k|  if (outbuffer == NULL || outsize == NULL)     /* sanity check */
  ------------------
  |  Branch (168:7): [True: 0, False: 80.4k]
  |  Branch (168:28): [True: 0, False: 80.4k]
  ------------------
  169|      0|    ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  170|       |
  171|       |  /* The destination object is made permanent so that multiple JPEG images
  172|       |   * can be written to the same buffer without re-executing jpeg_mem_dest.
  173|       |   */
  174|  80.4k|  if (cinfo->dest == NULL) {    /* first time for this JPEG object? */
  ------------------
  |  Branch (174:7): [True: 58.6k, False: 21.8k]
  ------------------
  175|  58.6k|    cinfo->dest = (struct jpeg_destination_mgr *)
  176|  58.6k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  58.6k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  177|  58.6k|                                  sizeof(my_mem_destination_mgr));
  178|  58.6k|    dest = (my_mem_dest_ptr)cinfo->dest;
  179|  58.6k|    dest->newbuffer = NULL;
  180|  58.6k|    dest->buffer = NULL;
  181|  58.6k|  } else if (cinfo->dest->init_destination != init_mem_destination) {
  ------------------
  |  Branch (181:14): [True: 0, False: 21.8k]
  ------------------
  182|       |    /* It is unsafe to reuse the existing destination manager unless it was
  183|       |     * created by this function.
  184|       |     */
  185|      0|    ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  186|      0|  }
  187|       |
  188|  80.4k|  dest = (my_mem_dest_ptr)cinfo->dest;
  189|  80.4k|  dest->pub.init_destination = init_mem_destination;
  190|  80.4k|  dest->pub.empty_output_buffer = empty_mem_output_buffer;
  191|  80.4k|  dest->pub.term_destination = term_mem_destination;
  192|  80.4k|  if (dest->buffer == *outbuffer && *outbuffer != NULL && alloc)
  ------------------
  |  Branch (192:7): [True: 11.9k, False: 68.5k]
  |  Branch (192:37): [True: 11.9k, False: 0]
  |  Branch (192:59): [True: 0, False: 11.9k]
  ------------------
  193|      0|    reused = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  194|  80.4k|  dest->outbuffer = outbuffer;
  195|  80.4k|  dest->outsize = outsize;
  196|  80.4k|  dest->alloc = alloc;
  197|       |
  198|  80.4k|  if (*outbuffer == NULL || (*outsize == 0 && !reused)) {
  ------------------
  |  Branch (198:7): [True: 2.86k, False: 77.6k]
  |  Branch (198:30): [True: 0, False: 77.6k]
  |  Branch (198:47): [True: 0, False: 0]
  ------------------
  199|  2.86k|    if (alloc) {
  ------------------
  |  Branch (199:9): [True: 2.86k, False: 0]
  ------------------
  200|       |      /* Allocate initial buffer */
  201|  2.86k|      dest->newbuffer = *outbuffer = (unsigned char *)MALLOC(OUTPUT_BUF_SIZE);
  ------------------
  |  |  520|  2.86k|#define MALLOC(size)  malloc(size)
  ------------------
  202|  2.86k|      if (dest->newbuffer == NULL)
  ------------------
  |  Branch (202:11): [True: 0, False: 2.86k]
  ------------------
  203|      0|        ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  204|  2.86k|      *outsize = OUTPUT_BUF_SIZE;
  ------------------
  |  |   34|  2.86k|#define OUTPUT_BUF_SIZE  4096   /* choose an efficiently fwrite'able size */
  ------------------
  205|  2.86k|    } else
  206|      0|      ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  207|  2.86k|  } else
  208|  77.6k|    dest->newbuffer = *outbuffer;
  209|       |
  210|  80.4k|  dest->pub.next_output_byte = dest->buffer = *outbuffer;
  211|  80.4k|  if (!reused)
  ------------------
  |  Branch (211:7): [True: 80.4k, False: 0]
  ------------------
  212|  80.4k|    dest->bufsize = *outsize;
  213|  80.4k|  dest->pub.free_in_buffer = dest->bufsize;
  214|  80.4k|}
jdatadst-tj.c:init_mem_destination:
   60|  21.8k|{
   61|       |  /* no work necessary here */
   62|  21.8k|}
jdatadst-tj.c:empty_mem_output_buffer:
   90|    442|{
   91|    442|  size_t nextsize;
   92|    442|  JOCTET *nextbuffer;
   93|    442|  my_mem_dest_ptr dest = (my_mem_dest_ptr)cinfo->dest;
   94|       |
   95|    442|  if (!dest->alloc) ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  |  Branch (95:7): [True: 0, False: 442]
  ------------------
   96|       |
   97|       |  /* Try to allocate new buffer with double size
   98|       |   *
   99|       |   * NOTE: The following check isn't actually necessary.  On 64-bit systems,
  100|       |   * the maximum theoretical JPEG size is
  101|       |   * 65500 * 65500 * cinfo->num_components * sizeof(DCTELEM) bytes, which is of
  102|       |   * course much less than 8 exabytes (SIZE_MAX / 2).  On 32-bit systems,
  103|       |   * malloc() will never return a buffer >= 2 GB, so the malloc() call will
  104|       |   * fail before 32-bit integer overflow/wraparound can occur.  The sole
  105|       |   * purpose of this code is to shut up automated code analysis tools.
  106|       |   */
  107|    442|  if (dest->bufsize > SIZE_MAX / 2)
  ------------------
  |  Branch (107:7): [True: 0, False: 442]
  ------------------
  108|      0|    ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 13);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|    442|  nextsize = dest->bufsize * 2;
  110|    442|  nextbuffer = (JOCTET *)MALLOC(nextsize);
  ------------------
  |  |  520|    442|#define MALLOC(size)  malloc(size)
  ------------------
  111|       |
  112|    442|  if (nextbuffer == NULL)
  ------------------
  |  Branch (112:7): [True: 0, False: 442]
  ------------------
  113|      0|    ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 12);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  114|       |
  115|    442|  memcpy(nextbuffer, dest->buffer, dest->bufsize);
  116|       |
  117|    442|  free(dest->newbuffer);
  118|       |
  119|    442|  dest->newbuffer = nextbuffer;
  120|       |
  121|    442|  dest->pub.next_output_byte = nextbuffer + dest->bufsize;
  122|    442|  dest->pub.free_in_buffer = dest->bufsize;
  123|       |
  124|    442|  dest->buffer = nextbuffer;
  125|    442|  dest->bufsize = nextsize;
  126|       |
  127|    442|  return TRUE;
  ------------------
  |  |  210|    442|#define TRUE    1
  ------------------
  128|    442|}
jdatadst-tj.c:term_mem_destination:
  142|  21.8k|{
  143|  21.8k|  my_mem_dest_ptr dest = (my_mem_dest_ptr)cinfo->dest;
  144|       |
  145|  21.8k|  if (dest->alloc) *dest->outbuffer = dest->buffer;
  ------------------
  |  Branch (145:7): [True: 2.86k, False: 18.9k]
  ------------------
  146|  21.8k|  *dest->outsize = dest->bufsize - dest->pub.free_in_buffer;
  147|  21.8k|}

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

jmemmgr.c:GETENV_S:
   80|  58.6k|{
   81|  58.6k|  char *env;
   82|       |
   83|  58.6k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 58.6k]
  ------------------
   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|  58.6k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 58.6k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|  58.6k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 58.6k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|  58.6k|  env = getenv(name);
   97|  58.6k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 58.6k, False: 0]
  ------------------
   98|  58.6k|  {
   99|  58.6k|    *buffer = 0;
  100|  58.6k|    return 0;
  101|  58.6k|  }
  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:
 1196|  58.6k|{
 1197|  58.6k|  my_mem_ptr mem;
 1198|  58.6k|  long max_to_use;
 1199|  58.6k|  int pool;
 1200|  58.6k|  size_t test_mac;
 1201|       |
 1202|  58.6k|  cinfo->mem = NULL;            /* for safety if init fails */
 1203|       |
 1204|       |  /* Check for configuration errors.
 1205|       |   * sizeof(ALIGN_TYPE) should be a power of 2; otherwise, it probably
 1206|       |   * doesn't reflect any real hardware alignment requirement.
 1207|       |   * The test is a little tricky: for X>0, X and X-1 have no one-bits
 1208|       |   * in common if and only if X is a power of 2, ie has only one one-bit.
 1209|       |   * Some compilers may give an "unreachable code" warning here; ignore it.
 1210|       |   */
 1211|  58.6k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  58.6k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  58.6k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1211:7): [Folded, False: 58.6k]
  ------------------
 1212|      0|    ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1213|       |  /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be
 1214|       |   * a multiple of ALIGN_SIZE.
 1215|       |   * Again, an "unreachable code" warning may be ignored here.
 1216|       |   * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK.
 1217|       |   */
 1218|  58.6k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  58.6k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1219|  58.6k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|   117k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1219:7): [True: 0, False: 58.6k]
  ------------------
 1220|  58.6k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  58.6k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  58.6k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1220:7): [Folded, False: 0]
  ------------------
 1221|      0|    ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1222|       |
 1223|  58.6k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1224|       |
 1225|       |  /* Attempt to allocate memory manager's control block */
 1226|  58.6k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1227|       |
 1228|  58.6k|  if (mem == NULL) {
  ------------------
  |  Branch (1228:7): [True: 0, False: 58.6k]
  ------------------
 1229|      0|    jpeg_mem_term(cinfo);       /* system-dependent cleanup */
 1230|      0|    ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1231|      0|  }
 1232|       |
 1233|       |  /* OK, fill in the method pointers */
 1234|  58.6k|  mem->pub.alloc_small = alloc_small;
 1235|  58.6k|  mem->pub.alloc_large = alloc_large;
 1236|  58.6k|  mem->pub.alloc_sarray = alloc_sarray;
 1237|  58.6k|  mem->pub.alloc_barray = alloc_barray;
 1238|  58.6k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1239|  58.6k|  mem->pub.request_virt_barray = request_virt_barray;
 1240|  58.6k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1241|  58.6k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1242|  58.6k|  mem->pub.access_virt_barray = access_virt_barray;
 1243|  58.6k|  mem->pub.free_pool = free_pool;
 1244|  58.6k|  mem->pub.self_destruct = self_destruct;
 1245|       |
 1246|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1247|  58.6k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  58.6k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1248|       |
 1249|       |  /* Initialize working state */
 1250|  58.6k|  mem->pub.max_memory_to_use = max_to_use;
 1251|       |
 1252|   175k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  58.6k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|   175k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1252:35): [True: 117k, False: 58.6k]
  ------------------
 1253|   117k|    mem->small_list[pool] = NULL;
 1254|   117k|    mem->large_list[pool] = NULL;
 1255|   117k|  }
 1256|  58.6k|  mem->virt_sarray_list = NULL;
 1257|  58.6k|  mem->virt_barray_list = NULL;
 1258|       |
 1259|  58.6k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1260|       |
 1261|       |  /* Declare ourselves open for business */
 1262|  58.6k|  cinfo->mem = &mem->pub;
 1263|       |
 1264|       |  /* Check for an environment variable JPEGMEM; if found, override the
 1265|       |   * default max_memory setting from jpeg_mem_init.  Note that the
 1266|       |   * surrounding application may again override this value.
 1267|       |   * If your system doesn't support getenv(), define NO_GETENV to disable
 1268|       |   * this feature.
 1269|       |   */
 1270|  58.6k|#ifndef NO_GETENV
 1271|  58.6k|  {
 1272|  58.6k|    char memenv[30] = { 0 };
 1273|       |
 1274|  58.6k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1274:9): [True: 58.6k, False: 0]
  |  Branch (1274:45): [True: 0, False: 58.6k]
  ------------------
 1275|      0|      char ch = 'x';
 1276|       |
 1277|       |#ifdef _MSC_VER
 1278|       |      if (sscanf_s(memenv, "%ld%c", &max_to_use, &ch, 1) > 0) {
 1279|       |#else
 1280|      0|      if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {
  ------------------
  |  Branch (1280:11): [True: 0, False: 0]
  ------------------
 1281|      0|#endif
 1282|      0|        if (ch == 'm' || ch == 'M')
  ------------------
  |  Branch (1282:13): [True: 0, False: 0]
  |  Branch (1282:26): [True: 0, False: 0]
  ------------------
 1283|      0|          max_to_use *= 1000L;
 1284|      0|        mem->pub.max_memory_to_use = max_to_use * 1000L;
 1285|      0|      }
 1286|      0|    }
 1287|  58.6k|  }
 1288|  58.6k|#endif
 1289|       |
 1290|  58.6k|}
jmemmgr.c:alloc_small:
  269|   905k|{
  270|   905k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  271|   905k|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  272|   905k|  char *data_ptr;
  273|   905k|  size_t min_request, slop;
  274|       |
  275|       |  /*
  276|       |   * Round up the requested size to a multiple of ALIGN_SIZE in order
  277|       |   * to assure alignment for the next object allocated in the same pool
  278|       |   * and so that algorithms can straddle outside the proper area up
  279|       |   * to the next alignment.
  280|       |   */
  281|   905k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   905k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (281:7): [True: 0, False: 905k]
  ------------------
  282|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  283|       |       is close to SIZE_MAX. */
  284|      0|    out_of_memory(cinfo, 7);
  285|      0|  }
  286|   905k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|   905k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  287|       |
  288|       |  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  289|   905k|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|   905k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (289:7): [True: 0, False: 905k]
  ------------------
  290|   905k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|   905k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  291|      0|    out_of_memory(cinfo, 1);    /* request exceeds malloc's ability */
  292|       |
  293|       |  /* See if space is available in any existing pool */
  294|   905k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|   905k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (294:7): [True: 0, False: 905k]
  |  Branch (294:22): [True: 0, False: 905k]
  ------------------
  295|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  296|   905k|  prev_hdr_ptr = NULL;
  297|   905k|  hdr_ptr = mem->small_list[pool_id];
  298|  1.08M|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (298:10): [True: 914k, False: 171k]
  ------------------
  299|   914k|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (299:9): [True: 733k, False: 180k]
  ------------------
  300|   733k|      break;                    /* found pool with enough space */
  301|   180k|    prev_hdr_ptr = hdr_ptr;
  302|   180k|    hdr_ptr = hdr_ptr->next;
  303|   180k|  }
  304|       |
  305|       |  /* Time to make a new pool? */
  306|   905k|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (306:7): [True: 171k, False: 733k]
  ------------------
  307|       |    /* min_request is what we need now, slop is what will be leftover */
  308|   171k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   171k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  309|   171k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (309:9): [True: 131k, False: 40.2k]
  ------------------
  310|   131k|      slop = first_pool_slop[pool_id];
  311|  40.2k|    else
  312|  40.2k|      slop = extra_pool_slop[pool_id];
  313|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  314|   171k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|   171k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (314:9): [True: 0, False: 171k]
  ------------------
  315|      0|      slop = (size_t)(MAX_ALLOC_CHUNK - min_request);
  ------------------
  |  |   62|      0|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  316|       |    /* Try to get space, if fail reduce slop and try again */
  317|   171k|    for (;;) {
  318|   171k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  319|   171k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (319:11): [True: 171k, False: 0]
  ------------------
  320|   171k|        break;
  321|      0|      slop /= 2;
  322|      0|      if (slop < MIN_SLOP)      /* give up when it gets real small */
  ------------------
  |  |  263|      0|#define MIN_SLOP  50            /* greater than 0 to avoid futile looping */
  ------------------
  |  Branch (322:11): [True: 0, False: 0]
  ------------------
  323|      0|        out_of_memory(cinfo, 2); /* jpeg_get_small failed */
  324|      0|    }
  325|   171k|    mem->total_space_allocated += min_request + slop;
  326|       |    /* Success, initialize the new pool header and add to end of list */
  327|   171k|    hdr_ptr->next = NULL;
  328|   171k|    hdr_ptr->bytes_used = 0;
  329|   171k|    hdr_ptr->bytes_left = sizeofobject + slop;
  330|   171k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (330:9): [True: 131k, False: 40.2k]
  ------------------
  331|   131k|      mem->small_list[pool_id] = hdr_ptr;
  332|  40.2k|    else
  333|  40.2k|      prev_hdr_ptr->next = hdr_ptr;
  334|   171k|  }
  335|       |
  336|       |  /* OK, allocate the object from the current pool */
  337|   905k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  338|   905k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  339|   905k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|   905k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (339:7): [True: 905k, False: 0]
  ------------------
  340|   905k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   905k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   905k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  341|   905k|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  342|   905k|  hdr_ptr->bytes_used += sizeofobject;
  343|   905k|  hdr_ptr->bytes_left -= sizeofobject;
  344|       |
  345|   905k|  return (void *)data_ptr;
  346|   905k|}
jmemmgr.c:round_up_pow2:
   45|  1.67M|{
   46|  1.67M|  return ((a + b - 1) & (~(b - 1)));
   47|  1.67M|}
jmemmgr.c:alloc_large:
  366|   385k|{
  367|   385k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  368|   385k|  large_pool_ptr hdr_ptr;
  369|   385k|  char *data_ptr;
  370|       |
  371|       |  /*
  372|       |   * Round up the requested size to a multiple of ALIGN_SIZE so that
  373|       |   * algorithms can straddle outside the proper area up to the next
  374|       |   * alignment.
  375|       |   */
  376|   385k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   385k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (376:7): [True: 0, False: 385k]
  ------------------
  377|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  378|       |       is close to SIZE_MAX. */
  379|      0|    out_of_memory(cinfo, 8);
  380|      0|  }
  381|   385k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|   385k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  382|       |
  383|       |  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  384|   385k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|   385k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (384:7): [True: 0, False: 385k]
  ------------------
  385|   385k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|   385k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  386|      0|    out_of_memory(cinfo, 3);    /* request exceeds malloc's ability */
  387|       |
  388|       |  /* Always make a new pool */
  389|   385k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|   385k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (389:7): [True: 0, False: 385k]
  |  Branch (389:22): [True: 0, False: 385k]
  ------------------
  390|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  391|       |
  392|   385k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  393|   385k|                                           sizeof(large_pool_hdr) +
  394|   385k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|   385k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  395|   385k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (395:7): [True: 0, False: 385k]
  ------------------
  396|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  397|   385k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  398|   385k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|   385k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  399|       |
  400|       |  /* Success, initialize the new pool header and add to list */
  401|   385k|  hdr_ptr->next = mem->large_list[pool_id];
  402|       |  /* We maintain space counts in each pool header for statistical purposes,
  403|       |   * even though they are not needed for allocation.
  404|       |   */
  405|   385k|  hdr_ptr->bytes_used = sizeofobject;
  406|   385k|  hdr_ptr->bytes_left = 0;
  407|   385k|  mem->large_list[pool_id] = hdr_ptr;
  408|       |
  409|   385k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  410|   385k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  411|   385k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|   385k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (411:7): [True: 385k, False: 0]
  ------------------
  412|   385k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   385k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   385k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  413|       |
  414|   385k|  return (void *)data_ptr;
  415|   385k|}
jmemmgr.c:alloc_sarray:
  438|   385k|{
  439|   385k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  440|   385k|  JSAMPARRAY result;
  441|   385k|  JSAMPROW workspace;
  442|   385k|  JDIMENSION rowsperchunk, currow, i;
  443|   385k|  long ltemp;
  444|   385k|  J12SAMPARRAY result12;
  445|   385k|  J12SAMPROW workspace12;
  446|   385k|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  447|   385k|  J16SAMPARRAY result16;
  448|   385k|  J16SAMPROW workspace16;
  449|   385k|#endif
  450|   385k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (450:24): [True: 0, False: 385k]
  ------------------
  451|      0|                        ((j_decompress_ptr)cinfo)->data_precision :
  452|   385k|                        ((j_compress_ptr)cinfo)->data_precision;
  453|   385k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (453:24): [True: 0, False: 385k]
  ------------------
  454|   385k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (454:45): [True: 0, False: 385k]
  ------------------
  455|      0|                                            sizeof(J12SAMPLE) :
  456|   385k|                                            sizeof(JSAMPLE));
  457|       |
  458|       |  /* Make sure each row is properly aligned */
  459|   385k|  if ((ALIGN_SIZE % sample_size) != 0)
  ------------------
  |  |   89|   385k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (459:7): [True: 0, False: 385k]
  ------------------
  460|      0|    out_of_memory(cinfo, 5);    /* safety check */
  461|       |
  462|   385k|  if (samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   385k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (462:7): [True: 0, False: 385k]
  ------------------
  463|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  464|       |       is close to SIZE_MAX. */
  465|      0|    out_of_memory(cinfo, 9);
  466|      0|  }
  467|   385k|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|   385k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  468|   385k|                                                           sample_size);
  469|       |
  470|       |  /* Calculate max # of rows allowed in one allocation chunk */
  471|   385k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|   385k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  472|   385k|          ((long)samplesperrow * (long)sample_size);
  473|   385k|  if (ltemp <= 0)
  ------------------
  |  Branch (473:7): [True: 0, False: 385k]
  ------------------
  474|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  475|   385k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (475:7): [True: 0, False: 385k]
  ------------------
  476|      0|    rowsperchunk = (JDIMENSION)ltemp;
  477|   385k|  else
  478|   385k|    rowsperchunk = numrows;
  479|   385k|  mem->last_rowsperchunk = rowsperchunk;
  480|       |
  481|   385k|  if (data_precision <= 8) {
  ------------------
  |  Branch (481:7): [True: 385k, False: 0]
  ------------------
  482|       |    /* Get space for row pointers (small object) */
  483|   385k|    result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  484|   385k|                                     (size_t)(numrows * sizeof(JSAMPROW)));
  485|       |
  486|       |    /* Get the rows themselves (large objects) */
  487|   385k|    currow = 0;
  488|   771k|    while (currow < numrows) {
  ------------------
  |  Branch (488:12): [True: 385k, False: 385k]
  ------------------
  489|   385k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|   385k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 385k]
  |  |  ------------------
  ------------------
  490|   385k|      workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  491|   385k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  492|  46.0M|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (492:30): [True: 45.6M, False: 385k]
  ------------------
  493|  45.6M|        result[currow++] = workspace;
  494|  45.6M|        workspace += samplesperrow;
  495|  45.6M|      }
  496|   385k|    }
  497|       |
  498|   385k|    return result;
  499|   385k|  } else if (data_precision <= 12) {
  ------------------
  |  Branch (499:14): [True: 0, False: 0]
  ------------------
  500|       |    /* Get space for row pointers (small object) */
  501|      0|    result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
  502|      0|                                         (size_t)(numrows *
  503|      0|                                                  sizeof(J12SAMPROW)));
  504|       |
  505|       |    /* Get the rows themselves (large objects) */
  506|      0|    currow = 0;
  507|      0|    while (currow < numrows) {
  ------------------
  |  Branch (507:12): [True: 0, False: 0]
  ------------------
  508|      0|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|      0|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  509|      0|      workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
  510|      0|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  511|      0|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (511:30): [True: 0, False: 0]
  ------------------
  512|      0|        result12[currow++] = workspace12;
  513|      0|        workspace12 += samplesperrow;
  514|      0|      }
  515|      0|    }
  516|       |
  517|      0|    return (JSAMPARRAY)result12;
  518|      0|  } else {
  519|      0|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  520|       |    /* Get space for row pointers (small object) */
  521|      0|    result16 = (J16SAMPARRAY)alloc_small(cinfo, pool_id,
  522|      0|                                         (size_t)(numrows *
  523|      0|                                                  sizeof(J16SAMPROW)));
  524|       |
  525|       |    /* Get the rows themselves (large objects) */
  526|      0|    currow = 0;
  527|      0|    while (currow < numrows) {
  ------------------
  |  Branch (527:12): [True: 0, False: 0]
  ------------------
  528|      0|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|      0|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  529|      0|      workspace16 = (J16SAMPROW)alloc_large(cinfo, pool_id,
  530|      0|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  531|      0|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (531:30): [True: 0, False: 0]
  ------------------
  532|      0|        result16[currow++] = workspace16;
  533|      0|        workspace16 += samplesperrow;
  534|      0|      }
  535|      0|    }
  536|       |
  537|      0|    return (JSAMPARRAY)result16;
  538|       |#else
  539|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, data_precision);
  540|       |    return NULL;
  541|       |#endif
  542|      0|  }
  543|   385k|}
jmemmgr.c:request_virt_sarray:
  640|  59.9k|{
  641|  59.9k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  642|  59.9k|  jvirt_sarray_ptr result;
  643|       |
  644|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  645|  59.9k|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|  59.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (645:7): [True: 0, False: 59.9k]
  ------------------
  646|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  647|       |
  648|       |  /* get control block */
  649|  59.9k|  result = (jvirt_sarray_ptr)alloc_small(cinfo, pool_id,
  650|  59.9k|                                         sizeof(struct jvirt_sarray_control));
  651|       |
  652|  59.9k|  result->mem_buffer = NULL;    /* marks array not yet realized */
  653|  59.9k|  result->rows_in_array = numrows;
  654|  59.9k|  result->samplesperrow = samplesperrow;
  655|  59.9k|  result->maxaccess = maxaccess;
  656|  59.9k|  result->pre_zero = pre_zero;
  657|  59.9k|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|  59.9k|#define FALSE   0               /* values of boolean */
  ------------------
  658|  59.9k|  result->next = mem->virt_sarray_list; /* add to list of virtual arrays */
  659|  59.9k|  mem->virt_sarray_list = result;
  660|       |
  661|  59.9k|  return result;
  662|  59.9k|}
jmemmgr.c:realize_virt_arrays:
  698|  40.2k|{
  699|  40.2k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  700|  40.2k|  size_t space_per_minheight, maximum_space, avail_mem;
  701|  40.2k|  size_t minheights, max_minheights;
  702|  40.2k|  jvirt_sarray_ptr sptr;
  703|  40.2k|  jvirt_barray_ptr bptr;
  704|  40.2k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (704:24): [True: 0, False: 40.2k]
  ------------------
  705|      0|                        ((j_decompress_ptr)cinfo)->data_precision :
  706|  40.2k|                        ((j_compress_ptr)cinfo)->data_precision;
  707|  40.2k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (707:24): [True: 0, False: 40.2k]
  ------------------
  708|  40.2k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (708:45): [True: 0, False: 40.2k]
  ------------------
  709|      0|                                            sizeof(J12SAMPLE) :
  710|  40.2k|                                            sizeof(JSAMPLE));
  711|       |
  712|       |  /* Compute the minimum space needed (maxaccess rows in each buffer)
  713|       |   * and the maximum space needed (full image height in each buffer).
  714|       |   * These may be of use to the system-dependent jpeg_mem_available routine.
  715|       |   */
  716|  40.2k|  space_per_minheight = 0;
  717|  40.2k|  maximum_space = 0;
  718|   100k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (718:38): [True: 59.9k, False: 40.2k]
  ------------------
  719|  59.9k|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (719:9): [True: 59.9k, False: 0]
  ------------------
  720|  59.9k|      size_t new_space = (size_t)sptr->rows_in_array *
  721|  59.9k|                         (size_t)sptr->samplesperrow * sample_size;
  722|       |
  723|  59.9k|      space_per_minheight += (size_t)sptr->maxaccess *
  724|  59.9k|                             (size_t)sptr->samplesperrow * sample_size;
  725|  59.9k|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (725:11): [True: 0, False: 59.9k]
  ------------------
  726|      0|        out_of_memory(cinfo, 10);
  727|  59.9k|      maximum_space += new_space;
  728|  59.9k|    }
  729|  59.9k|  }
  730|  40.2k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (730:38): [True: 0, False: 40.2k]
  ------------------
  731|      0|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (731:9): [True: 0, False: 0]
  ------------------
  732|      0|      size_t new_space = (size_t)bptr->rows_in_array *
  733|      0|                         (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  734|       |
  735|      0|      space_per_minheight += (size_t)bptr->maxaccess *
  736|      0|                             (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  737|      0|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (737:11): [True: 0, False: 0]
  ------------------
  738|      0|        out_of_memory(cinfo, 11);
  739|      0|      maximum_space += new_space;
  740|      0|    }
  741|      0|  }
  742|       |
  743|  40.2k|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (743:7): [True: 18.4k, False: 21.8k]
  ------------------
  744|  18.4k|    return;                     /* no unrealized arrays, no work */
  745|       |
  746|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  747|  21.8k|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  748|  21.8k|                                 mem->total_space_allocated);
  749|       |
  750|       |  /* If the maximum space needed is available, make all the buffers full
  751|       |   * height; otherwise parcel it out with the same number of minheights
  752|       |   * in each buffer.
  753|       |   */
  754|  21.8k|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (754:7): [True: 21.8k, False: 0]
  ------------------
  755|  21.8k|    max_minheights = 1000000000L;
  756|      0|  else {
  757|      0|    max_minheights = avail_mem / space_per_minheight;
  758|       |    /* If there doesn't seem to be enough space, try to get the minimum
  759|       |     * anyway.  This allows a "stub" implementation of jpeg_mem_available().
  760|       |     */
  761|      0|    if (max_minheights <= 0)
  ------------------
  |  Branch (761:9): [True: 0, False: 0]
  ------------------
  762|      0|      max_minheights = 1;
  763|      0|  }
  764|       |
  765|       |  /* Allocate the in-memory buffers and initialize backing store as needed. */
  766|       |
  767|  81.7k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (767:38): [True: 59.9k, False: 21.8k]
  ------------------
  768|  59.9k|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (768:9): [True: 59.9k, False: 0]
  ------------------
  769|  59.9k|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  770|  59.9k|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (770:11): [True: 59.9k, False: 0]
  ------------------
  771|       |        /* This buffer fits in memory */
  772|  59.9k|        sptr->rows_in_mem = sptr->rows_in_array;
  773|  59.9k|      } else {
  774|       |        /* It doesn't fit in memory, create backing store. */
  775|      0|        sptr->rows_in_mem = (JDIMENSION)(max_minheights * sptr->maxaccess);
  776|      0|        jpeg_open_backing_store(cinfo, &sptr->b_s_info,
  777|      0|                                (long)((size_t)sptr->rows_in_array *
  778|      0|                                       (size_t)sptr->samplesperrow *
  779|      0|                                       sample_size));
  780|      0|        sptr->b_s_open = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  781|      0|      }
  782|  59.9k|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  59.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  783|  59.9k|                                      sptr->samplesperrow, sptr->rows_in_mem);
  784|  59.9k|      sptr->rowsperchunk = mem->last_rowsperchunk;
  785|  59.9k|      sptr->cur_start_row = 0;
  786|  59.9k|      sptr->first_undef_row = 0;
  787|  59.9k|      sptr->dirty = FALSE;
  ------------------
  |  |  207|  59.9k|#define FALSE   0               /* values of boolean */
  ------------------
  788|  59.9k|    }
  789|  59.9k|  }
  790|       |
  791|  21.8k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (791:38): [True: 0, False: 21.8k]
  ------------------
  792|      0|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (792:9): [True: 0, False: 0]
  ------------------
  793|      0|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  794|      0|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (794:11): [True: 0, False: 0]
  ------------------
  795|       |        /* This buffer fits in memory */
  796|      0|        bptr->rows_in_mem = bptr->rows_in_array;
  797|      0|      } else {
  798|       |        /* It doesn't fit in memory, create backing store. */
  799|      0|        bptr->rows_in_mem = (JDIMENSION)(max_minheights * bptr->maxaccess);
  800|      0|        jpeg_open_backing_store(cinfo, &bptr->b_s_info,
  801|      0|                                (long)((size_t)bptr->rows_in_array *
  802|      0|                                       (size_t)bptr->blocksperrow *
  803|      0|                                       sizeof(JBLOCK)));
  804|      0|        bptr->b_s_open = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  805|      0|      }
  806|      0|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  807|      0|                                      bptr->blocksperrow, bptr->rows_in_mem);
  808|      0|      bptr->rowsperchunk = mem->last_rowsperchunk;
  809|      0|      bptr->cur_start_row = 0;
  810|      0|      bptr->first_undef_row = 0;
  811|      0|      bptr->dirty = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  812|      0|    }
  813|      0|  }
  814|  21.8k|}
jmemmgr.c:access_virt_sarray:
  924|   135M|{
  925|   135M|  JDIMENSION end_row = start_row + num_rows;
  926|   135M|  JDIMENSION undef_row;
  927|   135M|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (927:24): [True: 0, False: 135M]
  ------------------
  928|      0|                        ((j_decompress_ptr)cinfo)->data_precision :
  929|   135M|                        ((j_compress_ptr)cinfo)->data_precision;
  930|   135M|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (930:24): [True: 0, False: 135M]
  ------------------
  931|   135M|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (931:45): [True: 0, False: 135M]
  ------------------
  932|      0|                                            sizeof(J12SAMPLE) :
  933|   135M|                                            sizeof(JSAMPLE));
  934|       |
  935|       |  /* debugging check */
  936|   135M|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (936:7): [True: 0, False: 135M]
  |  Branch (936:39): [True: 0, False: 135M]
  ------------------
  937|   135M|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (937:7): [True: 0, False: 135M]
  ------------------
  938|      0|    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  939|       |
  940|       |  /* Make the desired part of the virtual array accessible */
  941|   135M|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (941:7): [True: 0, False: 135M]
  ------------------
  942|   135M|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (942:7): [True: 0, False: 135M]
  ------------------
  943|      0|    if (!ptr->b_s_open)
  ------------------
  |  Branch (943:9): [True: 0, False: 0]
  ------------------
  944|      0|      ERREXIT(cinfo, JERR_VIRTUAL_BUG);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  945|       |    /* Flush old buffer contents if necessary */
  946|      0|    if (ptr->dirty) {
  ------------------
  |  Branch (946:9): [True: 0, False: 0]
  ------------------
  947|      0|      do_sarray_io(cinfo, ptr, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  948|      0|      ptr->dirty = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  949|      0|    }
  950|       |    /* Decide what part of virtual array to access.
  951|       |     * Algorithm: if target address > current window, assume forward scan,
  952|       |     * load starting at target address.  If target address < current window,
  953|       |     * assume backward scan, load so that target area is top of window.
  954|       |     * Note that when switching from forward write to forward read, will have
  955|       |     * start_row = 0, so the limiting case applies and we load from 0 anyway.
  956|       |     */
  957|      0|    if (start_row > ptr->cur_start_row) {
  ------------------
  |  Branch (957:9): [True: 0, False: 0]
  ------------------
  958|      0|      ptr->cur_start_row = start_row;
  959|      0|    } else {
  960|       |      /* use long arithmetic here to avoid overflow & unsigned problems */
  961|      0|      long ltemp;
  962|       |
  963|      0|      ltemp = (long)end_row - (long)ptr->rows_in_mem;
  964|      0|      if (ltemp < 0)
  ------------------
  |  Branch (964:11): [True: 0, False: 0]
  ------------------
  965|      0|        ltemp = 0;              /* don't fall off front end of file */
  966|      0|      ptr->cur_start_row = (JDIMENSION)ltemp;
  967|      0|    }
  968|       |    /* Read in the selected part of the array.
  969|       |     * During the initial write pass, we will do no actual read
  970|       |     * because the selected part is all undefined.
  971|       |     */
  972|      0|    do_sarray_io(cinfo, ptr, FALSE);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  973|      0|  }
  974|       |  /* Ensure the accessed part of the array is defined; prezero if needed.
  975|       |   * To improve locality of access, we only prezero the part of the array
  976|       |   * that the caller is about to access, not the entire in-memory array.
  977|       |   */
  978|   135M|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (978:7): [True: 45.3M, False: 90.6M]
  ------------------
  979|  45.3M|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (979:9): [True: 0, False: 45.3M]
  ------------------
  980|      0|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (980:11): [True: 0, False: 0]
  ------------------
  981|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  982|      0|      undef_row = start_row;    /* but reader is allowed to read ahead */
  983|  45.3M|    } else {
  984|  45.3M|      undef_row = ptr->first_undef_row;
  985|  45.3M|    }
  986|  45.3M|    if (writable)
  ------------------
  |  Branch (986:9): [True: 45.3M, False: 0]
  ------------------
  987|  45.3M|      ptr->first_undef_row = end_row;
  988|  45.3M|    if (ptr->pre_zero) {
  ------------------
  |  Branch (988:9): [True: 0, False: 45.3M]
  ------------------
  989|      0|      size_t bytesperrow = (size_t)ptr->samplesperrow * sample_size;
  990|      0|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
  991|      0|      end_row -= ptr->cur_start_row;
  992|      0|      while (undef_row < end_row) {
  ------------------
  |  Branch (992:14): [True: 0, False: 0]
  ------------------
  993|      0|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
  994|      0|        undef_row++;
  995|      0|      }
  996|  45.3M|    } else {
  997|  45.3M|      if (!writable)            /* reader looking at undefined data */
  ------------------
  |  Branch (997:11): [True: 0, False: 45.3M]
  ------------------
  998|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  999|  45.3M|    }
 1000|  45.3M|  }
 1001|       |  /* Flag the buffer dirty if caller will write in it */
 1002|   135M|  if (writable)
  ------------------
  |  Branch (1002:7): [True: 45.3M, False: 90.6M]
  ------------------
 1003|  45.3M|    ptr->dirty = TRUE;
  ------------------
  |  |  210|  45.3M|#define TRUE    1
  ------------------
 1004|       |  /* Return address of proper part of the buffer */
 1005|   135M|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1006|   135M|}
jmemmgr.c:free_pool:
 1099|   139k|{
 1100|   139k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1101|   139k|  small_pool_ptr shdr_ptr;
 1102|   139k|  large_pool_ptr lhdr_ptr;
 1103|   139k|  size_t space_freed;
 1104|       |
 1105|   139k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|   139k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1105:7): [True: 0, False: 139k]
  |  Branch (1105:22): [True: 0, False: 139k]
  ------------------
 1106|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1107|       |
 1108|       |#ifdef MEM_STATS
 1109|       |  if (cinfo->err->trace_level > 1)
 1110|       |    print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */
 1111|       |#endif
 1112|       |
 1113|       |  /* If freeing IMAGE pool, close any virtual arrays first */
 1114|   139k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  889|   139k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1114:7): [True: 80.4k, False: 58.6k]
  ------------------
 1115|  80.4k|    jvirt_sarray_ptr sptr;
 1116|  80.4k|    jvirt_barray_ptr bptr;
 1117|       |
 1118|   140k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1118:40): [True: 59.9k, False: 80.4k]
  ------------------
 1119|  59.9k|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1119:11): [True: 0, False: 59.9k]
  ------------------
 1120|      0|        sptr->b_s_open = FALSE; /* prevent recursive close if error */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1121|      0|        (*sptr->b_s_info.close_backing_store) (cinfo, &sptr->b_s_info);
 1122|      0|      }
 1123|  59.9k|    }
 1124|  80.4k|    mem->virt_sarray_list = NULL;
 1125|  80.4k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1125:40): [True: 0, False: 80.4k]
  ------------------
 1126|      0|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1126:11): [True: 0, False: 0]
  ------------------
 1127|      0|        bptr->b_s_open = FALSE; /* prevent recursive close if error */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1128|      0|        (*bptr->b_s_info.close_backing_store) (cinfo, &bptr->b_s_info);
 1129|      0|      }
 1130|      0|    }
 1131|  80.4k|    mem->virt_barray_list = NULL;
 1132|  80.4k|  }
 1133|       |
 1134|       |  /* Release large objects */
 1135|   139k|  lhdr_ptr = mem->large_list[pool_id];
 1136|   139k|  mem->large_list[pool_id] = NULL;
 1137|       |
 1138|   524k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1138:10): [True: 385k, False: 139k]
  ------------------
 1139|   385k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1140|   385k|    space_freed = lhdr_ptr->bytes_used +
 1141|   385k|                  lhdr_ptr->bytes_left +
 1142|   385k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   385k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1143|   385k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1144|   385k|    mem->total_space_allocated -= space_freed;
 1145|   385k|    lhdr_ptr = next_lhdr_ptr;
 1146|   385k|  }
 1147|       |
 1148|       |  /* Release small objects */
 1149|   139k|  shdr_ptr = mem->small_list[pool_id];
 1150|   139k|  mem->small_list[pool_id] = NULL;
 1151|       |
 1152|   310k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1152:10): [True: 171k, False: 139k]
  ------------------
 1153|   171k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1154|   171k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1155|   171k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   171k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1156|   171k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1157|   171k|    mem->total_space_allocated -= space_freed;
 1158|   171k|    shdr_ptr = next_shdr_ptr;
 1159|   171k|  }
 1160|   139k|}
jmemmgr.c:self_destruct:
 1170|  58.6k|{
 1171|  58.6k|  int pool;
 1172|       |
 1173|       |  /* Close all backing store, release all memory.
 1174|       |   * Releasing pools in reverse order might help avoid fragmentation
 1175|       |   * with some (brain-damaged) malloc libraries.
 1176|       |   */
 1177|   175k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  58.6k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|   175k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1177:35): [True: 117k, False: 58.6k]
  ------------------
 1178|   117k|    free_pool(cinfo, pool);
 1179|   117k|  }
 1180|       |
 1181|       |  /* Release the memory manager control block too. */
 1182|  58.6k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1183|  58.6k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1184|       |
 1185|  58.6k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1186|  58.6k|}

jpeg_get_small:
   33|   230k|{
   34|   230k|  return (void *)MALLOC(sizeofobject);
  ------------------
  |  |  520|   230k|#define MALLOC(size)  malloc(size)
  ------------------
   35|   230k|}
jpeg_free_small:
   39|   230k|{
   40|   230k|  free(object);
   41|   230k|}
jpeg_get_large:
   50|   385k|{
   51|   385k|  return (void *)MALLOC(sizeofobject);
  ------------------
  |  |  520|   385k|#define MALLOC(size)  malloc(size)
  ------------------
   52|   385k|}
jpeg_free_large:
   56|   385k|{
   57|   385k|  free(object);
   58|   385k|}
jpeg_mem_available:
   68|  21.8k|{
   69|  21.8k|  if (cinfo->mem->max_memory_to_use) {
  ------------------
  |  Branch (69:7): [True: 0, False: 21.8k]
  ------------------
   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|  21.8k|  } else {
   75|       |    /* Here we always say, "we got all you want bud!" */
   76|  21.8k|    return max_bytes_needed;
   77|  21.8k|  }
   78|  21.8k|}
jpeg_mem_init:
  102|  58.6k|{
  103|  58.6k|  return 0;                     /* just set max_memory_to_use to 0 */
  104|  58.6k|}
jpeg_mem_term:
  108|  58.6k|{
  109|       |  /* no work */
  110|  58.6k|}

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

jdiv_round_up:
   81|   296k|{
   82|   296k|  return (a + b - 1L) / b;
   83|   296k|}
jround_up:
   90|   359k|{
   91|   359k|  a += b - 1L;
   92|   359k|  return a - (a % b);
   93|   359k|}
jcopy_sample_rows:
  110|  45.3M|{
  111|  45.3M|  register _JSAMPROW inptr, outptr;
  112|  45.3M|  register size_t count = (size_t)(num_cols * sizeof(_JSAMPLE));
  113|  45.3M|  register int row;
  114|       |
  115|  45.3M|  input_array += source_row;
  116|  45.3M|  output_array += dest_row;
  117|       |
  118|  90.6M|  for (row = num_rows; row > 0; row--) {
  ------------------
  |  Branch (118:24): [True: 45.3M, False: 45.3M]
  ------------------
  119|  45.3M|    inptr = *input_array++;
  120|  45.3M|    outptr = *output_array++;
  121|  45.3M|    memcpy(outptr, inptr, count);
  122|  45.3M|  }
  123|  45.3M|}

jinit_read_bmp:
  662|  6.76k|{
  663|  6.76k|  bmp_source_ptr source;
  664|       |
  665|  6.76k|  if (cinfo->data_precision != 8)
  ------------------
  |  Branch (665:7): [True: 0, False: 6.76k]
  ------------------
  666|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  667|       |
  668|       |  /* Create module interface object */
  669|  6.76k|  source = (bmp_source_ptr)
  670|  6.76k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  6.76k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  671|  6.76k|                                sizeof(bmp_source_struct));
  672|  6.76k|  source->cinfo = cinfo;        /* make back link for subroutines */
  673|       |  /* Fill in method ptrs, except get_pixel_rows which start_input sets */
  674|  6.76k|  source->pub.start_input = start_input_bmp;
  675|  6.76k|  source->pub.read_icc_profile = read_icc_profile_bmp;
  676|  6.76k|  source->pub.finish_input = finish_input_bmp;
  677|  6.76k|  source->pub.max_pixels = 0;
  678|       |
  679|  6.76k|  source->use_inversion_array = use_inversion_array;
  680|       |
  681|  6.76k|  return (cjpeg_source_ptr)source;
  682|  6.76k|}
rdbmp.c:start_input_bmp:
  408|  6.76k|{
  409|  6.76k|  bmp_source_ptr source = (bmp_source_ptr)sinfo;
  410|  6.76k|  unsigned char bmpfileheader[14];
  411|  6.76k|  unsigned char bmpinfoheader[64];
  412|       |
  413|  6.76k|#define GET_2B(array, offset) \
  414|  6.76k|  ((unsigned short)array[offset] + \
  415|  6.76k|   (((unsigned short)array[offset + 1]) << 8))
  416|  6.76k|#define GET_4B(array, offset) \
  417|  6.76k|  ((unsigned int)array[offset] + \
  418|  6.76k|   (((unsigned int)array[offset + 1]) << 8) + \
  419|  6.76k|   (((unsigned int)array[offset + 2]) << 16) + \
  420|  6.76k|   (((unsigned int)array[offset + 3]) << 24))
  421|       |
  422|  6.76k|  int bfOffBits;
  423|  6.76k|  int headerSize;
  424|  6.76k|  int biWidth;
  425|  6.76k|  int biHeight;
  426|  6.76k|  unsigned short biPlanes;
  427|  6.76k|  unsigned int biCompression;
  428|  6.76k|  int biXPelsPerMeter, biYPelsPerMeter;
  429|  6.76k|  int biClrUsed = 0;
  430|  6.76k|  int mapentrysize = 0;         /* 0 indicates no colormap */
  431|  6.76k|  int bPad;
  432|  6.76k|  JDIMENSION row_width = 0;
  433|       |
  434|       |  /* Read and verify the bitmap file header */
  435|  6.76k|  if (!ReadOK(source->pub.input_file, bmpfileheader, 14))
  ------------------
  |  |   36|  6.76k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (435:7): [True: 49, False: 6.72k]
  ------------------
  436|     49|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     49|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     49|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  437|  6.76k|  if (GET_2B(bmpfileheader, 0) != 0x4D42) /* 'BM' */
  ------------------
  |  |  414|  6.76k|  ((unsigned short)array[offset] + \
  |  |  415|  6.76k|   (((unsigned short)array[offset + 1]) << 8))
  ------------------
  |  Branch (437:7): [True: 98, False: 6.67k]
  ------------------
  438|     98|    ERREXIT(cinfo, JERR_BMP_NOT);
  ------------------
  |  |  240|     98|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     98|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  439|  6.76k|  bfOffBits = GET_4B(bmpfileheader, 10);
  ------------------
  |  |  417|  6.76k|  ((unsigned int)array[offset] + \
  |  |  418|  6.76k|   (((unsigned int)array[offset + 1]) << 8) + \
  |  |  419|  6.76k|   (((unsigned int)array[offset + 2]) << 16) + \
  |  |  420|  6.76k|   (((unsigned int)array[offset + 3]) << 24))
  ------------------
  440|       |  /* We ignore the remaining fileheader fields */
  441|       |
  442|       |  /* The infoheader might be 12 bytes (OS/2 1.x), 40 bytes (Windows),
  443|       |   * or 64 bytes (OS/2 2.x).  Check the first 4 bytes to find out which.
  444|       |   */
  445|  6.76k|  if (!ReadOK(source->pub.input_file, bmpinfoheader, 4))
  ------------------
  |  |   36|  6.76k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (445:7): [True: 21, False: 6.74k]
  ------------------
  446|     21|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     21|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     21|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  447|  6.76k|  headerSize = GET_4B(bmpinfoheader, 0);
  ------------------
  |  |  417|  6.76k|  ((unsigned int)array[offset] + \
  |  |  418|  6.76k|   (((unsigned int)array[offset + 1]) << 8) + \
  |  |  419|  6.76k|   (((unsigned int)array[offset + 2]) << 16) + \
  |  |  420|  6.76k|   (((unsigned int)array[offset + 3]) << 24))
  ------------------
  448|  6.76k|  if (headerSize < 12 || headerSize > 64 || (headerSize + 14) > bfOffBits)
  ------------------
  |  Branch (448:7): [True: 413, False: 6.35k]
  |  Branch (448:26): [True: 210, False: 6.14k]
  |  Branch (448:45): [True: 273, False: 5.87k]
  ------------------
  449|    728|    ERREXIT(cinfo, JERR_BMP_BADHEADER);
  ------------------
  |  |  240|    728|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    728|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  450|  6.76k|  if (!ReadOK(source->pub.input_file, bmpinfoheader + 4, headerSize - 4))
  ------------------
  |  |   36|  6.76k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (450:7): [True: 91, False: 6.67k]
  ------------------
  451|     91|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     91|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     91|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  452|       |
  453|  6.76k|  switch (headerSize) {
  454|  2.53k|  case 12:
  ------------------
  |  Branch (454:3): [True: 2.53k, False: 4.23k]
  ------------------
  455|       |    /* Decode OS/2 1.x header (Microsoft calls this a BITMAPCOREHEADER) */
  456|  2.53k|    biWidth = (int)GET_2B(bmpinfoheader, 4);
  ------------------
  |  |  414|  2.53k|  ((unsigned short)array[offset] + \
  |  |  415|  2.53k|   (((unsigned short)array[offset + 1]) << 8))
  ------------------
  457|  2.53k|    biHeight = (int)GET_2B(bmpinfoheader, 6);
  ------------------
  |  |  414|  2.53k|  ((unsigned short)array[offset] + \
  |  |  415|  2.53k|   (((unsigned short)array[offset + 1]) << 8))
  ------------------
  458|  2.53k|    biPlanes = GET_2B(bmpinfoheader, 8);
  ------------------
  |  |  414|  2.53k|  ((unsigned short)array[offset] + \
  |  |  415|  2.53k|   (((unsigned short)array[offset + 1]) << 8))
  ------------------
  459|  2.53k|    source->bits_per_pixel = (int)GET_2B(bmpinfoheader, 10);
  ------------------
  |  |  414|  2.53k|  ((unsigned short)array[offset] + \
  |  |  415|  2.53k|   (((unsigned short)array[offset + 1]) << 8))
  ------------------
  460|       |
  461|  2.53k|    switch (source->bits_per_pixel) {
  462|    700|    case 8:                     /* colormapped image */
  ------------------
  |  Branch (462:5): [True: 700, False: 1.83k]
  ------------------
  463|    700|      mapentrysize = 3;         /* OS/2 uses RGBTRIPLE colormap */
  464|    700|      TRACEMS2(cinfo, 1, JTRC_BMP_OS2_MAPPED, biWidth, biHeight);
  ------------------
  |  |  304|    700|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    700|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    700|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    700|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  465|    700|      break;
  466|    994|    case 24:                    /* RGB image */
  ------------------
  |  Branch (466:5): [True: 994, False: 1.54k]
  ------------------
  467|  1.82k|    case 32:                    /* RGB image + Alpha channel */
  ------------------
  |  Branch (467:5): [True: 833, False: 1.70k]
  ------------------
  468|  1.82k|      TRACEMS3(cinfo, 1, JTRC_BMP_OS2, biWidth, biHeight,
  ------------------
  |  |  309|  1.82k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.82k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.82k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  1.82k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  1.82k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  1.82k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  469|  1.82k|               source->bits_per_pixel);
  470|  1.82k|      break;
  471|      7|    default:
  ------------------
  |  Branch (471:5): [True: 7, False: 2.52k]
  ------------------
  472|      7|      ERREXIT(cinfo, JERR_BMP_BADDEPTH);
  ------------------
  |  |  240|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  473|      7|      break;
  474|  2.53k|    }
  475|  2.52k|    break;
  476|  3.23k|  case 40:
  ------------------
  |  Branch (476:3): [True: 3.23k, False: 3.53k]
  ------------------
  477|  3.24k|  case 64:
  ------------------
  |  Branch (477:3): [True: 7, False: 6.76k]
  ------------------
  478|       |    /* Decode Windows 3.x header (Microsoft calls this a BITMAPINFOHEADER) */
  479|       |    /* or OS/2 2.x header, which has additional fields that we ignore */
  480|  3.24k|    biWidth = (int)GET_4B(bmpinfoheader, 4);
  ------------------
  |  |  417|  3.24k|  ((unsigned int)array[offset] + \
  |  |  418|  3.24k|   (((unsigned int)array[offset + 1]) << 8) + \
  |  |  419|  3.24k|   (((unsigned int)array[offset + 2]) << 16) + \
  |  |  420|  3.24k|   (((unsigned int)array[offset + 3]) << 24))
  ------------------
  481|  3.24k|    biHeight = (int)GET_4B(bmpinfoheader, 8);
  ------------------
  |  |  417|  3.24k|  ((unsigned int)array[offset] + \
  |  |  418|  3.24k|   (((unsigned int)array[offset + 1]) << 8) + \
  |  |  419|  3.24k|   (((unsigned int)array[offset + 2]) << 16) + \
  |  |  420|  3.24k|   (((unsigned int)array[offset + 3]) << 24))
  ------------------
  482|  3.24k|    biPlanes = GET_2B(bmpinfoheader, 12);
  ------------------
  |  |  414|  3.24k|  ((unsigned short)array[offset] + \
  |  |  415|  3.24k|   (((unsigned short)array[offset + 1]) << 8))
  ------------------
  483|  3.24k|    source->bits_per_pixel = (int)GET_2B(bmpinfoheader, 14);
  ------------------
  |  |  414|  3.24k|  ((unsigned short)array[offset] + \
  |  |  415|  3.24k|   (((unsigned short)array[offset + 1]) << 8))
  ------------------
  484|  3.24k|    biCompression = GET_4B(bmpinfoheader, 16);
  ------------------
  |  |  417|  3.24k|  ((unsigned int)array[offset] + \
  |  |  418|  3.24k|   (((unsigned int)array[offset + 1]) << 8) + \
  |  |  419|  3.24k|   (((unsigned int)array[offset + 2]) << 16) + \
  |  |  420|  3.24k|   (((unsigned int)array[offset + 3]) << 24))
  ------------------
  485|  3.24k|    biXPelsPerMeter = (int)GET_4B(bmpinfoheader, 24);
  ------------------
  |  |  417|  3.24k|  ((unsigned int)array[offset] + \
  |  |  418|  3.24k|   (((unsigned int)array[offset + 1]) << 8) + \
  |  |  419|  3.24k|   (((unsigned int)array[offset + 2]) << 16) + \
  |  |  420|  3.24k|   (((unsigned int)array[offset + 3]) << 24))
  ------------------
  486|  3.24k|    biYPelsPerMeter = (int)GET_4B(bmpinfoheader, 28);
  ------------------
  |  |  417|  3.24k|  ((unsigned int)array[offset] + \
  |  |  418|  3.24k|   (((unsigned int)array[offset + 1]) << 8) + \
  |  |  419|  3.24k|   (((unsigned int)array[offset + 2]) << 16) + \
  |  |  420|  3.24k|   (((unsigned int)array[offset + 3]) << 24))
  ------------------
  487|  3.24k|    biClrUsed = GET_4B(bmpinfoheader, 32);
  ------------------
  |  |  417|  3.24k|  ((unsigned int)array[offset] + \
  |  |  418|  3.24k|   (((unsigned int)array[offset + 1]) << 8) + \
  |  |  419|  3.24k|   (((unsigned int)array[offset + 2]) << 16) + \
  |  |  420|  3.24k|   (((unsigned int)array[offset + 3]) << 24))
  ------------------
  488|       |    /* biSizeImage, biClrImportant fields are ignored */
  489|       |
  490|  3.24k|    switch (source->bits_per_pixel) {
  491|  2.82k|    case 8:                     /* colormapped image */
  ------------------
  |  Branch (491:5): [True: 2.82k, False: 413]
  ------------------
  492|  2.82k|      mapentrysize = 4;         /* Windows uses RGBQUAD colormap */
  493|  2.82k|      TRACEMS2(cinfo, 1, JTRC_BMP_MAPPED, biWidth, biHeight);
  ------------------
  |  |  304|  2.82k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  2.82k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  2.82k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  2.82k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  494|  2.82k|      break;
  495|    238|    case 24:                    /* RGB image */
  ------------------
  |  Branch (495:5): [True: 238, False: 3.00k]
  ------------------
  496|    406|    case 32:                    /* RGB image + Alpha channel */
  ------------------
  |  Branch (496:5): [True: 168, False: 3.07k]
  ------------------
  497|    406|      TRACEMS3(cinfo, 1, JTRC_BMP, biWidth, biHeight, source->bits_per_pixel);
  ------------------
  |  |  309|    406|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    406|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 406]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|    406|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|    406|           (cinfo)->err->msg_code = (code); \
  |  |  312|    406|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  498|    406|      break;
  499|      7|    default:
  ------------------
  |  Branch (499:5): [True: 7, False: 3.23k]
  ------------------
  500|      7|      ERREXIT(cinfo, JERR_BMP_BADDEPTH);
  ------------------
  |  |  240|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  501|      7|      break;
  502|  3.24k|    }
  503|  3.23k|    if (biCompression != 0)
  ------------------
  |  Branch (503:9): [True: 301, False: 2.93k]
  ------------------
  504|    301|      ERREXIT(cinfo, JERR_BMP_COMPRESSED);
  ------------------
  |  |  240|    301|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    301|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  505|       |
  506|  3.23k|    if (biXPelsPerMeter > 0 && biYPelsPerMeter > 0) {
  ------------------
  |  Branch (506:9): [True: 1.75k, False: 1.48k]
  |  Branch (506:32): [True: 959, False: 791]
  ------------------
  507|       |      /* Set JFIF density parameters from the BMP data */
  508|    959|      cinfo->X_density = (UINT16)(biXPelsPerMeter / 100); /* 100 cm per meter */
  509|    959|      cinfo->Y_density = (UINT16)(biYPelsPerMeter / 100);
  510|    959|      cinfo->density_unit = 2;  /* dots/cm */
  511|    959|    }
  512|  3.23k|    break;
  513|      7|  default:
  ------------------
  |  Branch (513:3): [True: 7, False: 6.76k]
  ------------------
  514|      7|    ERREXIT(cinfo, JERR_BMP_BADHEADER);
  ------------------
  |  |  240|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  515|      7|    return;
  516|  6.76k|  }
  517|       |
  518|  5.46k|  if (biWidth <= 0 || biHeight <= 0)
  ------------------
  |  Branch (518:7): [True: 280, False: 5.18k]
  |  Branch (518:23): [True: 266, False: 4.91k]
  ------------------
  519|    546|    ERREXIT(cinfo, JERR_BMP_EMPTY);
  ------------------
  |  |  240|    546|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    546|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  520|  5.46k|  if (biWidth > JPEG_MAX_DIMENSION || biHeight > JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  10.9k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
                if (biWidth > JPEG_MAX_DIMENSION || biHeight > JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  4.79k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (520:7): [True: 665, False: 4.79k]
  |  Branch (520:39): [True: 154, False: 4.64k]
  ------------------
  521|    273|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|    273|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    273|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    273|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  522|  5.46k|  if (sinfo->max_pixels &&
  ------------------
  |  Branch (522:7): [True: 4.64k, False: 819]
  ------------------
  523|  4.64k|      (unsigned long long)biWidth * biHeight > sinfo->max_pixels)
  ------------------
  |  Branch (523:7): [True: 427, False: 4.21k]
  ------------------
  524|    427|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, sinfo->max_pixels);
  ------------------
  |  |  243|    427|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    427|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    427|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  525|  5.46k|  if (biPlanes != 1)
  ------------------
  |  Branch (525:7): [True: 105, False: 5.35k]
  ------------------
  526|    105|    ERREXIT(cinfo, JERR_BMP_BADPLANES);
  ------------------
  |  |  240|    105|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    105|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  527|       |
  528|       |  /* Compute distance to bitmap data --- will adjust for colormap below */
  529|  5.46k|  bPad = bfOffBits - (headerSize + 14);
  530|       |
  531|       |  /* Read the colormap, if any */
  532|  5.46k|  if (mapentrysize > 0) {
  ------------------
  |  Branch (532:7): [True: 2.55k, False: 2.90k]
  ------------------
  533|  2.55k|    if (biClrUsed <= 0)
  ------------------
  |  Branch (533:9): [True: 1.42k, False: 1.13k]
  ------------------
  534|  1.42k|      biClrUsed = 256;          /* assume it's 256 */
  535|  1.13k|    else if (biClrUsed > 256)
  ------------------
  |  Branch (535:14): [True: 245, False: 889]
  ------------------
  536|    245|      ERREXIT(cinfo, JERR_BMP_BADCMAP);
  ------------------
  |  |  240|    245|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    245|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  537|       |    /* Allocate space to store the colormap */
  538|  2.55k|    source->colormap = (*cinfo->mem->alloc_sarray)
  539|  2.55k|      ((j_common_ptr)cinfo, JPOOL_IMAGE, (JDIMENSION)biClrUsed, (JDIMENSION)3);
  ------------------
  |  |  889|  2.55k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  540|  2.55k|    source->cmap_length = (int)biClrUsed;
  541|       |    /* and read it from the file */
  542|  2.55k|    read_colormap(source, (int)biClrUsed, mapentrysize);
  543|       |    /* account for size of colormap */
  544|  2.55k|    bPad -= biClrUsed * mapentrysize;
  545|  2.55k|  }
  546|       |
  547|       |  /* Skip any remaining pad bytes */
  548|  5.46k|  if (bPad < 0)                 /* incorrect bfOffBits value? */
  ------------------
  |  Branch (548:7): [True: 73, False: 5.38k]
  ------------------
  549|     73|    ERREXIT(cinfo, JERR_BMP_BADHEADER);
  ------------------
  |  |  240|     73|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     73|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  550|  1.30M|  while (--bPad >= 0) {
  ------------------
  |  Branch (550:10): [True: 1.29M, False: 5.46k]
  ------------------
  551|  1.29M|    (void)read_byte(source);
  552|  1.29M|  }
  553|       |
  554|       |  /* Compute row width in file, including padding to 4-byte boundary */
  555|  5.46k|  switch (source->bits_per_pixel) {
  556|    740|  case 8:
  ------------------
  |  Branch (556:3): [True: 740, False: 4.72k]
  ------------------
  557|    740|    if (cinfo->in_color_space == JCS_UNKNOWN)
  ------------------
  |  Branch (557:9): [True: 0, False: 740]
  ------------------
  558|      0|      cinfo->in_color_space = JCS_EXT_RGB;
  559|    740|    if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|    740|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 740]
  |  |  |  Branch (78:22): [True: 575, False: 165]
  |  |  |  Branch (78:43): [True: 575, False: 0]
  |  |  ------------------
  ------------------
  560|    575|      cinfo->input_components = rgb_pixelsize[cinfo->in_color_space];
  561|    165|    else if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (561:14): [True: 50, False: 115]
  ------------------
  562|     50|      cinfo->input_components = 1;
  563|    115|    else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (563:14): [True: 115, False: 0]
  ------------------
  564|    115|      cinfo->input_components = 4;
  565|      0|    else
  566|      0|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  567|    740|    row_width = (JDIMENSION)biWidth;
  568|    740|    break;
  569|    742|  case 24:
  ------------------
  |  Branch (569:3): [True: 742, False: 4.71k]
  ------------------
  570|    742|    if (cinfo->in_color_space == JCS_UNKNOWN)
  ------------------
  |  Branch (570:9): [True: 0, False: 742]
  ------------------
  571|      0|      cinfo->in_color_space = JCS_EXT_BGR;
  572|    742|    if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|    742|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 742]
  |  |  |  Branch (78:22): [True: 530, False: 212]
  |  |  |  Branch (78:43): [True: 530, False: 0]
  |  |  ------------------
  ------------------
  573|    530|      cinfo->input_components = rgb_pixelsize[cinfo->in_color_space];
  574|    212|    else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (574:14): [True: 106, False: 106]
  ------------------
  575|    106|      cinfo->input_components = 4;
  576|    106|    else
  577|    106|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|    106|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    106|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  578|    742|    row_width = (JDIMENSION)biWidth * 3;
  579|    742|    break;
  580|    504|  case 32:
  ------------------
  |  Branch (580:3): [True: 504, False: 4.95k]
  ------------------
  581|    504|    if (cinfo->in_color_space == JCS_UNKNOWN)
  ------------------
  |  Branch (581:9): [True: 0, False: 504]
  ------------------
  582|      0|      cinfo->in_color_space = JCS_EXT_BGRA;
  583|    504|    if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|    504|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 504]
  |  |  |  Branch (78:22): [True: 360, False: 144]
  |  |  |  Branch (78:43): [True: 360, False: 0]
  |  |  ------------------
  ------------------
  584|    360|      cinfo->input_components = rgb_pixelsize[cinfo->in_color_space];
  585|    144|    else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (585:14): [True: 72, False: 72]
  ------------------
  586|     72|      cinfo->input_components = 4;
  587|     72|    else
  588|     72|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|     72|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     72|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  589|    504|    row_width = (JDIMENSION)biWidth * 4;
  590|    504|    break;
  591|      0|  default:
  ------------------
  |  Branch (591:3): [True: 0, False: 5.46k]
  ------------------
  592|      0|    ERREXIT(cinfo, JERR_BMP_BADDEPTH);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  593|  5.46k|  }
  594|  3.07k|  while ((row_width & 3) != 0) row_width++;
  ------------------
  |  Branch (594:10): [True: 1.26k, False: 1.80k]
  ------------------
  595|  1.80k|  source->row_width = row_width;
  596|       |
  597|  1.80k|  if (source->use_inversion_array) {
  ------------------
  |  Branch (597:7): [True: 0, False: 1.80k]
  ------------------
  598|       |    /* Allocate space for inversion array, prepare for preload pass */
  599|      0|    source->whole_image = (*cinfo->mem->request_virt_sarray)
  600|      0|      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                    ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  601|      0|       row_width, (JDIMENSION)biHeight, (JDIMENSION)1);
  602|      0|    source->pub.get_pixel_rows = preload_image;
  603|      0|    if (cinfo->progress != NULL) {
  ------------------
  |  Branch (603:9): [True: 0, False: 0]
  ------------------
  604|      0|      cd_progress_ptr progress = (cd_progress_ptr)cinfo->progress;
  605|      0|      progress->total_extra_passes++; /* count file input as separate pass */
  606|      0|    }
  607|  1.80k|  } else {
  608|  1.80k|    source->iobuffer = (unsigned char *)
  609|  1.80k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, row_width);
  ------------------
  |  |  889|  1.80k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  610|  1.80k|    switch (source->bits_per_pixel) {
  611|    740|    case 8:
  ------------------
  |  Branch (611:5): [True: 740, False: 1.06k]
  ------------------
  612|    740|      source->pub.get_pixel_rows = get_8bit_row;
  613|    740|      break;
  614|    636|    case 24:
  ------------------
  |  Branch (614:5): [True: 636, False: 1.17k]
  ------------------
  615|    636|      source->pub.get_pixel_rows = get_24bit_row;
  616|    636|      break;
  617|    432|    case 32:
  ------------------
  |  Branch (617:5): [True: 432, False: 1.37k]
  ------------------
  618|    432|      source->pub.get_pixel_rows = get_32bit_row;
  619|    432|      break;
  620|      0|    default:
  ------------------
  |  Branch (620:5): [True: 0, False: 1.80k]
  ------------------
  621|      0|      ERREXIT(cinfo, JERR_BMP_BADDEPTH);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  622|  1.80k|    }
  623|  1.80k|  }
  624|       |
  625|       |  /* Allocate one-row buffer for returned data */
  626|  1.80k|  source->pub.buffer = (*cinfo->mem->alloc_sarray)
  627|  1.80k|    ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.80k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  628|  1.80k|     (JDIMENSION)biWidth * (JDIMENSION)cinfo->input_components, (JDIMENSION)1);
  629|  1.80k|  source->pub.buffer_height = 1;
  630|       |
  631|  1.80k|  cinfo->data_precision = 8;
  632|  1.80k|  cinfo->image_width = (JDIMENSION)biWidth;
  633|  1.80k|  cinfo->image_height = (JDIMENSION)biHeight;
  634|  1.80k|}
rdbmp.c:read_colormap:
   90|  2.31k|{
   91|  2.31k|  int i, gray = 1;
   92|       |
   93|  2.31k|  switch (mapentrysize) {
   94|    616|  case 3:
  ------------------
  |  Branch (94:3): [True: 616, False: 1.69k]
  ------------------
   95|       |    /* BGR format (occurs in OS/2 files) */
   96|  37.3k|    for (i = 0; i < cmaplen; i++) {
  ------------------
  |  Branch (96:17): [True: 36.7k, False: 616]
  ------------------
   97|  36.7k|      sinfo->colormap[2][i] = (JSAMPLE)read_byte(sinfo);
   98|  36.7k|      sinfo->colormap[1][i] = (JSAMPLE)read_byte(sinfo);
   99|  36.7k|      sinfo->colormap[0][i] = (JSAMPLE)read_byte(sinfo);
  100|  36.7k|      if (sinfo->colormap[2][i] != sinfo->colormap[1][i] ||
  ------------------
  |  Branch (100:11): [True: 13.4k, False: 23.2k]
  ------------------
  101|  23.2k|          sinfo->colormap[1][i] != sinfo->colormap[0][i])
  ------------------
  |  Branch (101:11): [True: 4.64k, False: 18.6k]
  ------------------
  102|  17.5k|        gray = 0;
  103|  36.7k|    }
  104|    616|    break;
  105|  1.69k|  case 4:
  ------------------
  |  Branch (105:3): [True: 1.69k, False: 616]
  ------------------
  106|       |    /* BGR0 format (occurs in MS Windows files) */
  107|  52.5k|    for (i = 0; i < cmaplen; i++) {
  ------------------
  |  Branch (107:17): [True: 50.8k, False: 1.69k]
  ------------------
  108|  50.8k|      sinfo->colormap[2][i] = (JSAMPLE)read_byte(sinfo);
  109|  50.8k|      sinfo->colormap[1][i] = (JSAMPLE)read_byte(sinfo);
  110|  50.8k|      sinfo->colormap[0][i] = (JSAMPLE)read_byte(sinfo);
  111|  50.8k|      (void)read_byte(sinfo);
  112|  50.8k|      if (sinfo->colormap[2][i] != sinfo->colormap[1][i] ||
  ------------------
  |  Branch (112:11): [True: 18.6k, False: 32.2k]
  ------------------
  113|  32.2k|          sinfo->colormap[1][i] != sinfo->colormap[0][i])
  ------------------
  |  Branch (113:11): [True: 4.62k, False: 27.5k]
  ------------------
  114|  22.4k|        gray = 0;
  115|  50.8k|    }
  116|  1.69k|    break;
  117|      0|  default:
  ------------------
  |  Branch (117:3): [True: 0, False: 2.31k]
  ------------------
  118|      0|    ERREXIT(sinfo->cinfo, JERR_BMP_BADCMAP);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  119|      0|    break;
  120|  2.31k|  }
  121|       |
  122|    917|  if ((sinfo->cinfo->in_color_space == JCS_UNKNOWN ||
  ------------------
  |  Branch (122:8): [True: 0, False: 917]
  ------------------
  123|    917|       sinfo->cinfo->in_color_space == JCS_RGB) && gray)
  ------------------
  |  Branch (123:8): [True: 0, False: 917]
  |  Branch (123:52): [True: 0, False: 0]
  ------------------
  124|      0|    sinfo->cinfo->in_color_space = JCS_GRAYSCALE;
  125|       |
  126|    917|  if (sinfo->cinfo->in_color_space == JCS_GRAYSCALE && !gray)
  ------------------
  |  Branch (126:7): [True: 131, False: 786]
  |  Branch (126:56): [True: 80, False: 51]
  ------------------
  127|     80|    ERREXIT(sinfo->cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|     80|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     80|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  128|    917|}
rdbmp.c:read_byte:
   77|  1.60M|{
   78|  1.60M|  register FILE *infile = sinfo->pub.input_file;
   79|  1.60M|  register int c;
   80|       |
   81|  1.60M|  if ((c = getc(infile)) == EOF)
  ------------------
  |  Branch (81:7): [True: 1.72k, False: 1.60M]
  ------------------
   82|  1.72k|    ERREXIT(sinfo->cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|  1.72k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.72k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   83|  1.60M|  return c;
   84|  1.60M|}
rdbmp.c:get_8bit_row:
  141|  2.44M|{
  142|  2.44M|  bmp_source_ptr source = (bmp_source_ptr)sinfo;
  143|  2.44M|  register JSAMPARRAY colormap = source->colormap;
  144|  2.44M|  int cmaplen = source->cmap_length;
  145|  2.44M|  JSAMPARRAY image_ptr;
  146|  2.44M|  register int t;
  147|  2.44M|  register JSAMPROW inptr, outptr;
  148|  2.44M|  register JDIMENSION col;
  149|       |
  150|  2.44M|  if (source->use_inversion_array) {
  ------------------
  |  Branch (150:7): [True: 0, False: 2.44M]
  ------------------
  151|       |    /* Fetch next row from virtual array */
  152|      0|    source->source_row--;
  153|      0|    image_ptr = (*cinfo->mem->access_virt_sarray)
  154|      0|      ((j_common_ptr)cinfo, source->whole_image,
  155|      0|       source->source_row, (JDIMENSION)1, FALSE);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  156|      0|    inptr = image_ptr[0];
  157|  2.44M|  } else {
  158|  2.44M|    if (!ReadOK(source->pub.input_file, source->iobuffer, source->row_width))
  ------------------
  |  |   36|  2.44M|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (158:9): [True: 320, False: 2.44M]
  ------------------
  159|    320|      ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    320|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    320|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  160|  2.44M|    inptr = source->iobuffer;
  161|  2.44M|  }
  162|       |
  163|       |  /* Expand the colormap indexes to real data */
  164|  2.44M|  outptr = source->pub.buffer[0];
  165|  2.44M|  if (cinfo->in_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (165:7): [True: 733, False: 2.44M]
  ------------------
  166|  69.1k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (166:36): [True: 68.4k, False: 733]
  ------------------
  167|  68.4k|      t = *inptr++;
  168|  68.4k|      if (t >= cmaplen)
  ------------------
  |  Branch (168:11): [True: 26, False: 68.3k]
  ------------------
  169|     26|        ERREXIT(cinfo, JERR_BMP_OUTOFRANGE);
  ------------------
  |  |  240|     26|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     26|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  170|  68.4k|      *outptr++ = colormap[0][t];
  171|  68.4k|    }
  172|  2.44M|  } else if (cinfo->in_color_space == JCS_CMYK) {
  ------------------
  |  Branch (172:14): [True: 407k, False: 2.04M]
  ------------------
  173|  2.94M|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (173:36): [True: 2.54M, False: 407k]
  ------------------
  174|  2.54M|      t = *inptr++;
  175|  2.54M|      if (t >= cmaplen)
  ------------------
  |  Branch (175:11): [True: 38, False: 2.54M]
  ------------------
  176|     38|        ERREXIT(cinfo, JERR_BMP_OUTOFRANGE);
  ------------------
  |  |  240|     38|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     38|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  177|  2.54M|      rgb_to_cmyk(255, colormap[0][t], colormap[1][t], colormap[2][t], outptr,
  178|  2.54M|                  outptr + 1, outptr + 2, outptr + 3);
  179|  2.54M|      outptr += 4;
  180|  2.54M|    }
  181|  2.04M|  } else {
  182|  2.04M|    register int rindex = rgb_red[cinfo->in_color_space];
  183|  2.04M|    register int gindex = rgb_green[cinfo->in_color_space];
  184|  2.04M|    register int bindex = rgb_blue[cinfo->in_color_space];
  185|  2.04M|    register int aindex = alpha_index[cinfo->in_color_space];
  186|  2.04M|    register int ps = rgb_pixelsize[cinfo->in_color_space];
  187|       |
  188|  2.04M|    if (aindex >= 0) {
  ------------------
  |  Branch (188:9): [True: 407k, False: 1.63M]
  ------------------
  189|  2.94M|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (189:38): [True: 2.54M, False: 407k]
  ------------------
  190|  2.54M|        t = *inptr++;
  191|  2.54M|        if (t >= cmaplen)
  ------------------
  |  Branch (191:13): [True: 38, False: 2.54M]
  ------------------
  192|     38|          ERREXIT(cinfo, JERR_BMP_OUTOFRANGE);
  ------------------
  |  |  240|     38|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     38|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  193|  2.54M|        outptr[rindex] = colormap[0][t];
  194|  2.54M|        outptr[gindex] = colormap[1][t];
  195|  2.54M|        outptr[bindex] = colormap[2][t];
  196|  2.54M|        outptr[aindex] = 0xFF;
  197|  2.54M|        outptr += ps;
  198|  2.54M|      }
  199|  1.63M|    } else {
  200|  11.7M|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (200:38): [True: 10.1M, False: 1.63M]
  ------------------
  201|  10.1M|        t = *inptr++;
  202|  10.1M|        if (t >= cmaplen)
  ------------------
  |  Branch (202:13): [True: 152, False: 10.1M]
  ------------------
  203|    152|          ERREXIT(cinfo, JERR_BMP_OUTOFRANGE);
  ------------------
  |  |  240|    152|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    152|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  204|  10.1M|        outptr[rindex] = colormap[0][t];
  205|  10.1M|        outptr[gindex] = colormap[1][t];
  206|  10.1M|        outptr[bindex] = colormap[2][t];
  207|  10.1M|        outptr += ps;
  208|  10.1M|      }
  209|  1.63M|    }
  210|  2.04M|  }
  211|       |
  212|  2.44M|  return 1;
  213|  2.44M|}
rdbmp.c:get_24bit_row:
  219|  1.61M|{
  220|  1.61M|  bmp_source_ptr source = (bmp_source_ptr)sinfo;
  221|  1.61M|  JSAMPARRAY image_ptr;
  222|  1.61M|  register JSAMPROW inptr, outptr;
  223|  1.61M|  register JDIMENSION col;
  224|       |
  225|  1.61M|  if (source->use_inversion_array) {
  ------------------
  |  Branch (225:7): [True: 0, False: 1.61M]
  ------------------
  226|       |    /* Fetch next row from virtual array */
  227|      0|    source->source_row--;
  228|      0|    image_ptr = (*cinfo->mem->access_virt_sarray)
  229|      0|      ((j_common_ptr)cinfo, source->whole_image,
  230|      0|       source->source_row, (JDIMENSION)1, FALSE);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  231|      0|    inptr = image_ptr[0];
  232|  1.61M|  } else {
  233|  1.61M|    if (!ReadOK(source->pub.input_file, source->iobuffer, source->row_width))
  ------------------
  |  |   36|  1.61M|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (233:9): [True: 498, False: 1.61M]
  ------------------
  234|    498|      ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    498|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    498|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  235|  1.61M|    inptr = source->iobuffer;
  236|  1.61M|  }
  237|       |
  238|       |  /* Transfer data.  Note source values are in BGR order
  239|       |   * (even though Microsoft's own documents say the opposite).
  240|       |   */
  241|  1.61M|  outptr = source->pub.buffer[0];
  242|  1.61M|  if (cinfo->in_color_space == JCS_EXT_BGR) {
  ------------------
  |  Branch (242:7): [True: 269k, False: 1.34M]
  ------------------
  243|   269k|    memcpy(outptr, inptr, source->row_width);
  244|  1.34M|  } else if (cinfo->in_color_space == JCS_CMYK) {
  ------------------
  |  Branch (244:14): [True: 269k, False: 1.07M]
  ------------------
  245|   808k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (245:36): [True: 539k, False: 269k]
  ------------------
  246|   539k|      JSAMPLE b = *inptr++, g = *inptr++, r = *inptr++;
  247|   539k|      rgb_to_cmyk(255, r, g, b, outptr, outptr + 1, outptr + 2, outptr + 3);
  248|   539k|      outptr += 4;
  249|   539k|    }
  250|  1.07M|  } else {
  251|  1.07M|    register int rindex = rgb_red[cinfo->in_color_space];
  252|  1.07M|    register int gindex = rgb_green[cinfo->in_color_space];
  253|  1.07M|    register int bindex = rgb_blue[cinfo->in_color_space];
  254|  1.07M|    register int aindex = alpha_index[cinfo->in_color_space];
  255|  1.07M|    register int ps = rgb_pixelsize[cinfo->in_color_space];
  256|       |
  257|  1.07M|    if (aindex >= 0) {
  ------------------
  |  Branch (257:9): [True: 269k, False: 808k]
  ------------------
  258|   808k|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (258:38): [True: 539k, False: 269k]
  ------------------
  259|   539k|        outptr[bindex] = *inptr++;
  260|   539k|        outptr[gindex] = *inptr++;
  261|   539k|        outptr[rindex] = *inptr++;
  262|   539k|        outptr[aindex] = 0xFF;
  263|   539k|        outptr += ps;
  264|   539k|      }
  265|   808k|    } else {
  266|  2.42M|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (266:38): [True: 1.61M, False: 808k]
  ------------------
  267|  1.61M|        outptr[bindex] = *inptr++;
  268|  1.61M|        outptr[gindex] = *inptr++;
  269|  1.61M|        outptr[rindex] = *inptr++;
  270|  1.61M|        outptr += ps;
  271|  1.61M|      }
  272|   808k|    }
  273|  1.07M|  }
  274|       |
  275|  1.61M|  return 1;
  276|  1.61M|}
rdbmp.c:get_32bit_row:
  282|   393k|{
  283|   393k|  bmp_source_ptr source = (bmp_source_ptr)sinfo;
  284|   393k|  JSAMPARRAY image_ptr;
  285|   393k|  register JSAMPROW inptr, outptr;
  286|   393k|  register JDIMENSION col;
  287|       |
  288|   393k|  if (source->use_inversion_array) {
  ------------------
  |  Branch (288:7): [True: 0, False: 393k]
  ------------------
  289|       |    /* Fetch next row from virtual array */
  290|      0|    source->source_row--;
  291|      0|    image_ptr = (*cinfo->mem->access_virt_sarray)
  292|      0|      ((j_common_ptr)cinfo, source->whole_image,
  293|      0|       source->source_row, (JDIMENSION)1, FALSE);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  294|      0|    inptr = image_ptr[0];
  295|   393k|  } else {
  296|   393k|    if (!ReadOK(source->pub.input_file, source->iobuffer, source->row_width))
  ------------------
  |  |   36|   393k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (296:9): [True: 414, False: 393k]
  ------------------
  297|    414|      ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    414|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    414|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  298|   393k|    inptr = source->iobuffer;
  299|   393k|  }
  300|       |
  301|       |  /* Transfer data.  Note source values are in BGR order
  302|       |   * (even though Microsoft's own documents say the opposite).
  303|       |   */
  304|   393k|  outptr = source->pub.buffer[0];
  305|   393k|  if (cinfo->in_color_space == JCS_EXT_BGRX ||
  ------------------
  |  Branch (305:7): [True: 414, False: 393k]
  ------------------
  306|   393k|      cinfo->in_color_space == JCS_EXT_BGRA) {
  ------------------
  |  Branch (306:7): [True: 65.5k, False: 327k]
  ------------------
  307|  65.5k|    memcpy(outptr, inptr, source->row_width);
  308|   328k|  } else if (cinfo->in_color_space == JCS_CMYK) {
  ------------------
  |  Branch (308:14): [True: 65.5k, False: 262k]
  ------------------
  309|   314k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (309:36): [True: 248k, False: 65.5k]
  ------------------
  310|   248k|      JSAMPLE b = *inptr++, g = *inptr++, r = *inptr++;
  311|   248k|      rgb_to_cmyk(255, r, g, b, outptr, outptr + 1, outptr + 2, outptr + 3);
  312|   248k|      inptr++;                          /* skip the 4th byte (Alpha channel) */
  313|   248k|      outptr += 4;
  314|   248k|    }
  315|   262k|  } else {
  316|   262k|    register int rindex = rgb_red[cinfo->in_color_space];
  317|   262k|    register int gindex = rgb_green[cinfo->in_color_space];
  318|   262k|    register int bindex = rgb_blue[cinfo->in_color_space];
  319|   262k|    register int aindex = alpha_index[cinfo->in_color_space];
  320|   262k|    register int ps = rgb_pixelsize[cinfo->in_color_space];
  321|       |
  322|   262k|    if (aindex >= 0) {
  ------------------
  |  Branch (322:9): [True: 0, False: 262k]
  ------------------
  323|      0|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (323:38): [True: 0, False: 0]
  ------------------
  324|      0|        outptr[bindex] = *inptr++;
  325|      0|        outptr[gindex] = *inptr++;
  326|      0|        outptr[rindex] = *inptr++;
  327|      0|        outptr[aindex] = *inptr++;
  328|      0|        outptr += ps;
  329|      0|      }
  330|   262k|    } else {
  331|  1.25M|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (331:38): [True: 995k, False: 262k]
  ------------------
  332|   995k|        outptr[bindex] = *inptr++;
  333|   995k|        outptr[gindex] = *inptr++;
  334|   995k|        outptr[rindex] = *inptr++;
  335|   995k|        inptr++;                        /* skip the 4th byte (Alpha channel) */
  336|   995k|        outptr += ps;
  337|   995k|      }
  338|   262k|    }
  339|   262k|  }
  340|       |
  341|   393k|  return 1;
  342|   393k|}
rdbmp.c:finish_input_bmp:
  651|  6.76k|{
  652|       |  /* no work */
  653|  6.76k|}

jinit_read_png:
  703|  30.7k|{
  704|  30.7k|  png_source_ptr source;
  705|       |
  706|  30.7k|#if BITS_IN_JSAMPLE == 8
  707|  30.7k|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  61.4k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (707:7): [True: 0, False: 30.7k]
  |  Branch (707:50): [True: 0, False: 30.7k]
  ------------------
  708|       |#else
  709|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  710|       |      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  711|       |#endif
  712|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  713|       |
  714|       |  /* Create module interface object */
  715|  30.7k|  source = (png_source_ptr)
  716|  30.7k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  30.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  717|  30.7k|                                sizeof(png_source_struct));
  718|       |  /* Fill in method ptrs, except get_pixel_rows which start_input sets */
  719|  30.7k|  source->pub.start_input = start_input_png;
  720|  30.7k|  source->pub.read_icc_profile = read_icc_profile_png;
  721|  30.7k|  source->pub.finish_input = finish_input_png;
  722|  30.7k|  source->pub.max_pixels = 0;
  723|       |
  724|  30.7k|  return (cjpeg_source_ptr)source;
  725|  30.7k|}
rdpng-8.c:start_input_png:
  472|  30.7k|{
  473|  30.7k|  png_source_ptr source = (png_source_ptr)sinfo;
  474|  30.7k|  struct spng_ihdr ihdr;
  475|  30.7k|  int png_components = 3;
  476|  30.7k|  boolean use_raw_buffer;
  477|       |#ifdef ZERO_BUFFERS
  478|       |  struct spng_alloc alloc;
  479|       |
  480|       |  alloc.malloc_fn = spng_malloc;
  481|       |  alloc.realloc_fn = realloc;
  482|       |  alloc.calloc_fn = calloc;
  483|       |  alloc.free_fn = free;
  484|       |  source->ctx = spng_ctx_new2(&alloc, 0);
  485|       |#else
  486|  30.7k|  source->ctx = spng_ctx_new(0);
  487|  30.7k|#endif
  488|  30.7k|  if (!source->ctx)
  ------------------
  |  Branch (488:7): [True: 0, False: 30.7k]
  ------------------
  489|      0|    ERREXITS(cinfo, JERR_PNG_LIBSPNG, "Could not create context");
  ------------------
  |  |  274|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  275|      0|   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX - 1), \
  |  |  ------------------
  |  |  |  |  800|      0|#define JMSG_STR_PARM_MAX  80
  |  |  ------------------
  |  |  276|      0|   (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
  |  |  ------------------
  |  |  |  |  800|      0|#define JMSG_STR_PARM_MAX  80
  |  |  ------------------
  |  |  277|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  490|       |
  491|  30.7k|  TRY_SPNG(spng_set_png_file(source->ctx, sinfo->input_file));
  ------------------
  |  |   33|  30.7k|#define TRY_SPNG(f) { \
  |  |   34|  30.7k|  int __spng_error = (f); \
  |  |   35|  30.7k|  if (__spng_error) \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 0, False: 30.7k]
  |  |  ------------------
  |  |   36|  30.7k|    ERREXITS(cinfo, JERR_PNG_LIBSPNG, spng_strerror(__spng_error)); \
  |  |  ------------------
  |  |  |  |  274|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  |  |  275|      0|   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX - 1), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|      0|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  276|      0|   (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|      0|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  277|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  |  |  ------------------
  |  |   37|  30.7k|}
  ------------------
  492|       |
  493|  30.7k|  TRY_SPNG(spng_get_ihdr(source->ctx, &ihdr));
  ------------------
  |  |   33|  30.7k|#define TRY_SPNG(f) { \
  |  |   34|  30.7k|  int __spng_error = (f); \
  |  |   35|  30.7k|  if (__spng_error) \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 1.65k, False: 29.0k]
  |  |  ------------------
  |  |   36|  30.7k|    ERREXITS(cinfo, JERR_PNG_LIBSPNG, spng_strerror(__spng_error)); \
  |  |  ------------------
  |  |  |  |  274|  1.65k|  ((cinfo)->err->msg_code = (code), \
  |  |  |  |  275|  1.65k|   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX - 1), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|  1.65k|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  276|  1.65k|   (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|  1.65k|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  277|  1.65k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  |  |  ------------------
  |  |   37|  30.7k|}
  ------------------
  494|       |
  495|  30.7k|  if (ihdr.width > JPEG_MAX_DIMENSION || ihdr.height > JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  61.4k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
                if (ihdr.width > JPEG_MAX_DIMENSION || ihdr.height > JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  14.0k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (495:7): [True: 16.7k, False: 14.0k]
  |  Branch (495:42): [True: 168, False: 13.8k]
  ------------------
  496|  15.2k|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|  15.2k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  15.2k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  15.2k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  497|  30.7k|  if (ihdr.bit_depth != 8 && ihdr.bit_depth != 16)
  ------------------
  |  Branch (497:7): [True: 2.89k, False: 27.8k]
  |  Branch (497:30): [True: 427, False: 2.46k]
  ------------------
  498|    427|    ERREXIT(cinfo, JERR_PNG_BADDEPTH);
  ------------------
  |  |  240|    427|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    427|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  499|  30.7k|  if (sinfo->max_pixels &&
  ------------------
  |  Branch (499:7): [True: 13.4k, False: 17.3k]
  ------------------
  500|  13.4k|      (unsigned long long)ihdr.width * ihdr.height > sinfo->max_pixels)
  ------------------
  |  Branch (500:7): [True: 343, False: 13.0k]
  ------------------
  501|    343|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, sinfo->max_pixels);
  ------------------
  |  |  243|    343|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    343|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    343|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  502|       |
  503|  30.7k|  cinfo->image_width = (JDIMENSION)ihdr.width;
  504|  30.7k|  cinfo->image_height = (JDIMENSION)ihdr.height;
  505|  30.7k|  source->png_bit_depth = ihdr.bit_depth;
  506|  30.7k|  source->png_color_type = ihdr.color_type;
  507|       |
  508|       |  /* initialize flags to most common settings */
  509|  30.7k|  use_raw_buffer = FALSE;       /* do we map input buffer onto I/O buffer? */
  ------------------
  |  |  207|  30.7k|#define FALSE   0               /* values of boolean */
  ------------------
  510|       |
  511|  30.7k|  switch (ihdr.color_type) {
  512|     14|  case SPNG_COLOR_TYPE_GRAYSCALE_ALPHA:
  ------------------
  |  Branch (512:3): [True: 14, False: 30.7k]
  ------------------
  513|  5.89k|  case SPNG_COLOR_TYPE_GRAYSCALE:
  ------------------
  |  Branch (513:3): [True: 5.88k, False: 24.8k]
  ------------------
  514|  5.89k|    if (cinfo->in_color_space == JCS_UNKNOWN ||
  ------------------
  |  Branch (514:9): [True: 0, False: 5.89k]
  ------------------
  515|  5.89k|        cinfo->in_color_space == JCS_RGB)
  ------------------
  |  Branch (515:9): [True: 0, False: 5.89k]
  ------------------
  516|      0|      cinfo->in_color_space = JCS_GRAYSCALE;
  517|  5.89k|    TRACEMS3(cinfo, 1, JTRC_PNG_GRAYSCALE, ihdr.width, ihdr.height,
  ------------------
  |  |  309|  5.89k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  5.89k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.89k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  5.89k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  5.89k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  5.89k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  518|  5.89k|             ihdr.bit_depth);
  519|  5.89k|    if (cinfo->in_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (519:9): [True: 842, False: 5.05k]
  ------------------
  520|    842|      if (ihdr.color_type == SPNG_COLOR_TYPE_GRAYSCALE &&
  ------------------
  |  Branch (520:11): [True: 840, False: 2]
  ------------------
  521|    840|          cinfo->data_precision == ihdr.bit_depth) {
  ------------------
  |  Branch (521:11): [True: 0, False: 840]
  ------------------
  522|      0|        source->pub.get_pixel_rows = get_raw_row;
  523|      0|        use_raw_buffer = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  524|      0|      } else
  525|    842|        source->pub.get_pixel_rows = get_gray_row;
  526|  5.05k|    } else if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  5.05k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 5.05k]
  |  |  |  Branch (78:22): [True: 4.21k, False: 842]
  |  |  |  Branch (78:43): [True: 4.21k, False: 0]
  |  |  ------------------
  ------------------
  527|  4.21k|      source->pub.get_pixel_rows = get_gray_rgb_row;
  528|    842|    else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (528:14): [True: 842, False: 0]
  ------------------
  529|    842|        source->pub.get_pixel_rows = get_gray_cmyk_row;
  530|      0|    else
  531|      0|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  532|  5.89k|    if (ihdr.color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA) {
  ------------------
  |  Branch (532:9): [True: 14, False: 5.88k]
  ------------------
  533|     14|      png_components = 2;
  534|     14|      source->png_alpha = 1;
  535|  5.88k|    } else {
  536|  5.88k|      png_components = 1;
  537|  5.88k|      source->png_alpha = 0;
  538|  5.88k|    }
  539|  5.89k|    break;
  540|       |
  541|  6.13k|  case SPNG_COLOR_TYPE_TRUECOLOR:
  ------------------
  |  Branch (541:3): [True: 6.13k, False: 24.5k]
  ------------------
  542|  6.15k|  case SPNG_COLOR_TYPE_TRUECOLOR_ALPHA:
  ------------------
  |  Branch (542:3): [True: 14, False: 30.7k]
  ------------------
  543|  6.15k|    if (cinfo->in_color_space == JCS_UNKNOWN)
  ------------------
  |  Branch (543:9): [True: 0, False: 6.15k]
  ------------------
  544|      0|      cinfo->in_color_space = JCS_EXT_RGB;
  545|  6.15k|    TRACEMS3(cinfo, 1, JTRC_PNG_TRUECOLOR, ihdr.width, ihdr.height,
  ------------------
  |  |  309|  6.15k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  6.15k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 6.15k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  6.15k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  6.15k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  6.15k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  546|  6.15k|             ihdr.bit_depth);
  547|  6.15k|    if (ihdr.color_type == SPNG_COLOR_TYPE_TRUECOLOR &&
  ------------------
  |  Branch (547:9): [True: 6.13k, False: 14]
  ------------------
  548|  6.13k|        cinfo->data_precision == ihdr.bit_depth &&
  ------------------
  |  Branch (548:9): [True: 609, False: 5.53k]
  ------------------
  549|    609|#if RGB_RED == 0 && RGB_GREEN == 1 && RGB_BLUE == 2 && RGB_PIXELSIZE == 3
  550|    609|        (cinfo->in_color_space == JCS_EXT_RGB ||
  ------------------
  |  Branch (550:10): [True: 609, False: 0]
  ------------------
  551|    609|         cinfo->in_color_space == JCS_RGB)) {
  ------------------
  |  Branch (551:10): [True: 0, False: 0]
  ------------------
  552|       |#else
  553|       |        cinfo->in_color_space == JCS_EXT_RGB) {
  554|       |#endif
  555|    609|      source->pub.get_pixel_rows = get_raw_row;
  556|    609|      use_raw_buffer = TRUE;
  ------------------
  |  |  210|    609|#define TRUE    1
  ------------------
  557|  5.54k|    } else if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  5.54k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 5.54k]
  |  |  |  Branch (78:22): [True: 3.78k, False: 1.75k]
  |  |  |  Branch (78:43): [True: 3.78k, False: 0]
  |  |  ------------------
  ------------------
  558|  3.78k|      source->pub.get_pixel_rows = get_rgb_row;
  559|  1.75k|    else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (559:14): [True: 879, False: 879]
  ------------------
  560|    879|      source->pub.get_pixel_rows = get_rgb_cmyk_row;
  561|    879|    else
  562|    879|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|    879|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    879|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  563|  6.15k|    if (ihdr.color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA) {
  ------------------
  |  Branch (563:9): [True: 12, False: 6.14k]
  ------------------
  564|     12|      png_components = 4;
  565|     12|      source->png_alpha = 1;
  566|  6.14k|    } else {
  567|  6.14k|      png_components = 3;
  568|  6.14k|      source->png_alpha = 0;
  569|  6.14k|    }
  570|  6.15k|    break;
  571|       |
  572|  1.02k|  case SPNG_COLOR_TYPE_INDEXED:
  ------------------
  |  Branch (572:3): [True: 1.02k, False: 29.7k]
  ------------------
  573|  1.02k|  {
  574|  1.02k|    int i, gray = 1;
  575|       |
  576|  1.02k|    TRACEMS3(cinfo, 1, JTRC_PNG_INDEXED, ihdr.width, ihdr.height,
  ------------------
  |  |  309|  1.02k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.02k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  1.02k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  1.02k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  1.02k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  577|  1.02k|             ihdr.bit_depth);
  578|  1.02k|    TRY_SPNG(spng_get_plte(source->ctx, &source->colormap));
  ------------------
  |  |   33|  1.02k|#define TRY_SPNG(f) { \
  |  |   34|  1.02k|  int __spng_error = (f); \
  |  |   35|  1.02k|  if (__spng_error) \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 763, False: 266]
  |  |  ------------------
  |  |   36|  1.02k|    ERREXITS(cinfo, JERR_PNG_LIBSPNG, spng_strerror(__spng_error)); \
  |  |  ------------------
  |  |  |  |  274|    763|  ((cinfo)->err->msg_code = (code), \
  |  |  |  |  275|    763|   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX - 1), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|    763|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  276|    763|   (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|    763|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  277|    763|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  |  |  ------------------
  |  |   37|  1.02k|}
  ------------------
  579|  1.02k|    if (source->png_bit_depth != 8 || source->colormap.n_entries > 256)
  ------------------
  |  Branch (579:9): [True: 763, False: 266]
  |  Branch (579:39): [True: 0, False: 266]
  ------------------
  580|      0|      ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  581|       |
  582|  17.5k|    for (i = 0; i < (int)source->colormap.n_entries; i++) {
  ------------------
  |  Branch (582:17): [True: 16.5k, False: 1.02k]
  ------------------
  583|  16.5k|      if (source->colormap.entries[i].red !=
  ------------------
  |  Branch (583:11): [True: 9.85k, False: 6.65k]
  ------------------
  584|  16.5k|          source->colormap.entries[i].green ||
  585|  6.65k|          source->colormap.entries[i].green !=
  ------------------
  |  Branch (585:11): [True: 0, False: 6.65k]
  ------------------
  586|  6.65k|          source->colormap.entries[i].blue)
  587|  9.85k|        gray = 0;
  588|  16.5k|    }
  589|       |
  590|  1.02k|    if ((cinfo->in_color_space == JCS_UNKNOWN ||
  ------------------
  |  Branch (590:10): [True: 763, False: 266]
  ------------------
  591|    266|         cinfo->in_color_space == JCS_RGB) && gray)
  ------------------
  |  Branch (591:10): [True: 0, False: 266]
  |  Branch (591:47): [True: 0, False: 0]
  ------------------
  592|      0|      cinfo->in_color_space = JCS_GRAYSCALE;
  593|  1.02k|    if (cinfo->in_color_space == JCS_GRAYSCALE && !gray)
  ------------------
  |  Branch (593:9): [True: 38, False: 991]
  |  Branch (593:51): [True: 22, False: 16]
  ------------------
  594|     22|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|     22|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     22|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  595|       |
  596|  1.02k|    source->pub.get_pixel_rows = get_indexed_row;
  597|  1.02k|    png_components = 1;
  598|  1.02k|    source->png_alpha = 0;
  599|  1.02k|    break;
  600|  6.13k|  }
  601|       |
  602|      0|  default:
  ------------------
  |  Branch (602:3): [True: 0, False: 30.7k]
  ------------------
  603|      0|    ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  604|  30.7k|  }
  605|       |
  606|  11.4k|  if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  11.4k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 11.4k]
  |  |  |  Branch (78:22): [True: 8.79k, False: 2.61k]
  |  |  |  Branch (78:43): [True: 8.79k, False: 0]
  |  |  ------------------
  ------------------
  607|  8.79k|    cinfo->input_components = rgb_pixelsize[cinfo->in_color_space];
  608|  2.61k|  else if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (608:12): [True: 858, False: 1.75k]
  ------------------
  609|    858|    cinfo->input_components = 1;
  610|  1.75k|  else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (610:12): [True: 1.75k, False: 0]
  ------------------
  611|  1.75k|    cinfo->input_components = 4;
  612|       |
  613|       |  /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */
  614|  11.4k|  source->buffer_width =
  615|  11.4k|    (size_t)ihdr.width * png_components * source->png_bit_depth / 8;
  616|  11.4k|  source->iobuffer = (unsigned char *)
  617|  11.4k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  11.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  618|  11.4k|                                source->buffer_width);
  619|       |
  620|       |  /* Create compressor input buffer. */
  621|  11.4k|  if (use_raw_buffer) {
  ------------------
  |  Branch (621:7): [True: 609, False: 10.8k]
  ------------------
  622|       |    /* For unscaled raw-input case, we can just map it onto the I/O buffer. */
  623|       |    /* Synthesize a _JSAMPARRAY pointer structure */
  624|    609|    source->pixrow = (_JSAMPROW)source->iobuffer;
  625|    609|    source->pub._buffer = &source->pixrow;
  ------------------
  |  |  326|    609|#define _buffer  buffer
  ------------------
  626|    609|    source->pub.buffer_height = 1;
  627|  10.8k|  } else {
  628|  10.8k|    unsigned int maxval = source->png_bit_depth == 16 ? 65535 : 255;
  ------------------
  |  Branch (628:27): [True: 2.16k, False: 8.64k]
  ------------------
  629|  10.8k|    size_t val, half_maxval;
  630|       |
  631|       |    /* Need to translate anyway, so make a separate sample buffer. */
  632|  10.8k|    source->pub._buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  ------------------
  |  |  326|  10.8k|#define _buffer  buffer
  ------------------
  633|  10.8k|      ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  10.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  634|  10.8k|       (JDIMENSION)ihdr.width * cinfo->input_components, (JDIMENSION)1);
  635|  10.8k|    source->pub.buffer_height = 1;
  636|       |
  637|       |    /* Compute the rescaling array. */
  638|  10.8k|    source->rescale = (_JSAMPLE *)
  639|  10.8k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  10.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  640|  10.8k|                                  (maxval + 1L) * sizeof(_JSAMPLE));
  641|  10.8k|    memset(source->rescale, 0, (maxval + 1L) * sizeof(_JSAMPLE));
  642|  10.8k|    half_maxval = maxval / 2;
  643|   143M|    for (val = 0; val <= maxval; val++) {
  ------------------
  |  Branch (643:19): [True: 143M, False: 10.8k]
  ------------------
  644|       |      /* The multiplication here must be done in 32 bits to avoid overflow */
  645|   143M|      source->rescale[val] =
  646|   143M|        (_JSAMPLE)((val * ((1 << cinfo->data_precision) - 1) + half_maxval) /
  647|   143M|                   maxval);
  648|   143M|    }
  649|  10.8k|  }
  650|       |
  651|  11.4k|  TRY_SPNG(spng_decode_image(source->ctx, NULL, 0, SPNG_FMT_PNG,
  ------------------
  |  |   33|  11.4k|#define TRY_SPNG(f) { \
  |  |   34|  11.4k|  int __spng_error = (f); \
  |  |   35|  11.4k|  if (__spng_error) \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 5.96k, False: 5.44k]
  |  |  ------------------
  |  |   36|  11.4k|    ERREXITS(cinfo, JERR_PNG_LIBSPNG, spng_strerror(__spng_error)); \
  |  |  ------------------
  |  |  |  |  274|  5.96k|  ((cinfo)->err->msg_code = (code), \
  |  |  |  |  275|  5.96k|   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX - 1), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|  5.96k|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  276|  5.96k|   (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|  5.96k|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  277|  5.96k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  |  |  ------------------
  |  |   37|  11.4k|}
  ------------------
  652|  11.4k|                             SPNG_DECODE_PROGRESSIVE));
  653|  11.4k|}
rdpng-8.c:get_raw_row:
   75|   153k|{
   76|   153k|  png_source_ptr source = (png_source_ptr)sinfo;
   77|   153k|  int spng_error;
   78|       |
   79|   153k|  spng_error = spng_decode_row(source->ctx, source->iobuffer,
   80|   153k|                               source->buffer_width);
   81|   153k|  if (spng_error && spng_error != SPNG_EOI)
  ------------------
  |  Branch (81:7): [True: 5.33k, False: 148k]
  |  Branch (81:21): [True: 3.68k, False: 1.64k]
  ------------------
   82|  3.68k|    ERREXITS(cinfo, JERR_PNG_LIBSPNG, spng_strerror(spng_error)); \
  ------------------
  |  |  274|  3.68k|  ((cinfo)->err->msg_code = (code), \
  |  |  275|  3.68k|   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX - 1), \
  |  |  ------------------
  |  |  |  |  800|  3.68k|#define JMSG_STR_PARM_MAX  80
  |  |  ------------------
  |  |  276|  3.68k|   (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
  |  |  ------------------
  |  |  |  |  800|  3.68k|#define JMSG_STR_PARM_MAX  80
  |  |  ------------------
  |  |  277|  3.68k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   83|   153k|  return 1;
   84|   153k|}
rdpng-8.c:get_gray_row:
  102|  6.27k|{
  103|  6.27k|  png_source_ptr source = (png_source_ptr)sinfo;
  104|  6.27k|  register _JSAMPROW ptr;
  105|  6.27k|  register _JSAMPLE *rescale = source->rescale;
  106|  6.27k|  JDIMENSION col;
  107|       |
  108|  6.27k|  get_raw_row(cinfo, sinfo);
  109|  6.27k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  6.27k|#define _buffer  buffer
  ------------------
  110|  6.27k|#if BITS_IN_JSAMPLE != 12
  111|  6.27k|  if (source->png_bit_depth == cinfo->data_precision) {
  ------------------
  |  Branch (111:7): [True: 0, False: 6.27k]
  ------------------
  112|      0|    _JSAMPLE *bufferptr = (_JSAMPLE *)source->iobuffer;
  ------------------
  |  |  224|      0|#define _JSAMPLE  JSAMPLE
  ------------------
  113|      0|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (113:36): [True: 0, False: 0]
  ------------------
  114|      0|      *ptr++ = *bufferptr++;
  115|      0|      bufferptr += source->png_alpha;
  116|      0|    }
  117|      0|  } else
  118|  6.27k|#endif
  119|  6.27k|  if (source->png_bit_depth == 16) {
  ------------------
  |  Branch (119:7): [True: 1.51k, False: 4.75k]
  ------------------
  120|  1.51k|    register unsigned short *bufferptr = (unsigned short *)source->iobuffer;
  121|   148k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (121:36): [True: 146k, False: 1.51k]
  ------------------
  122|   146k|      *ptr++ = rescale[*bufferptr++];
  123|   146k|      bufferptr += source->png_alpha;
  124|   146k|    }
  125|  4.75k|  } else {
  126|  4.75k|    register unsigned char *bufferptr = source->iobuffer;
  127|   363k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (127:36): [True: 358k, False: 4.75k]
  ------------------
  128|   358k|      *ptr++ = rescale[*bufferptr++];
  129|   358k|      bufferptr += source->png_alpha;
  130|   358k|    }
  131|  4.75k|  }
  132|  6.27k|  return 1;
  133|  6.27k|}
rdpng-8.c:get_gray_rgb_row:
  141|  31.3k|{
  142|  31.3k|  png_source_ptr source = (png_source_ptr)sinfo;
  143|  31.3k|  register _JSAMPROW ptr;
  144|  31.3k|  register _JSAMPLE *rescale = source->rescale;
  145|  31.3k|  JDIMENSION col;
  146|  31.3k|  register int rindex = rgb_red[cinfo->in_color_space];
  147|  31.3k|  register int gindex = rgb_green[cinfo->in_color_space];
  148|  31.3k|  register int bindex = rgb_blue[cinfo->in_color_space];
  149|  31.3k|  register int aindex = alpha_index[cinfo->in_color_space];
  150|  31.3k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  151|       |
  152|  31.3k|  get_raw_row(cinfo, sinfo);
  153|  31.3k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  31.3k|#define _buffer  buffer
  ------------------
  154|  31.3k|#if BITS_IN_JSAMPLE != 12
  155|  31.3k|  if (source->png_bit_depth == cinfo->data_precision) {
  ------------------
  |  Branch (155:7): [True: 4.52k, False: 26.8k]
  ------------------
  156|  4.52k|    _JSAMPLE *bufferptr = (_JSAMPLE *)source->iobuffer;
  ------------------
  |  |  224|  4.52k|#define _JSAMPLE  JSAMPLE
  ------------------
  157|  4.52k|    if (aindex >= 0)
  ------------------
  |  Branch (157:9): [True: 0, False: 4.52k]
  ------------------
  158|      0|      GRAY_RGB_READ_LOOP(*bufferptr++, ptr[aindex] = _MAXJSAMPLE;,
  ------------------
  |  |   87|      0|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |   88|      0|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (88:34): [True: 0, False: 0]
  |  |  ------------------
  |  |   89|      0|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |   90|      0|    alpha_set_op \
  |  |   91|      0|    ptr += ps; \
  |  |   92|      0|    pointer_op \
  |  |   93|      0|  } \
  |  |   94|      0|}
  ------------------
  159|  4.52k|                         bufferptr += source->png_alpha;)
  160|  4.52k|    else
  161|  4.52k|      GRAY_RGB_READ_LOOP(*bufferptr++, {}, bufferptr += source->png_alpha;)
  ------------------
  |  |   87|  4.52k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |   88|   363k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (88:34): [True: 358k, False: 4.52k]
  |  |  ------------------
  |  |   89|   358k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |   90|   358k|    alpha_set_op \
  |  |   91|   358k|    ptr += ps; \
  |  |   92|   358k|    pointer_op \
  |  |   93|   358k|  } \
  |  |   94|  4.52k|}
  ------------------
  162|  4.52k|  } else
  163|  26.8k|#endif
  164|  26.8k|  if (source->png_bit_depth == 16) {
  ------------------
  |  Branch (164:7): [True: 7.59k, False: 19.2k]
  ------------------
  165|  7.59k|    register unsigned short *bufferptr = (unsigned short *)source->iobuffer;
  166|  7.59k|    if (aindex >= 0)
  ------------------
  |  Branch (166:9): [True: 1.51k, False: 6.07k]
  ------------------
  167|  1.51k|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |   87|  1.51k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |   88|   148k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (88:34): [True: 146k, False: 1.51k]
  |  |  ------------------
  |  |   89|   146k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |   90|   146k|    alpha_set_op \
  |  |   91|   146k|    ptr += ps; \
  |  |   92|   146k|    pointer_op \
  |  |   93|   146k|  } \
  |  |   94|  1.51k|}
  ------------------
  168|  7.59k|                         ptr[aindex] = (1 << cinfo->data_precision) - 1;,
  169|  7.59k|                         bufferptr += source->png_alpha;)
  170|  6.07k|    else
  171|  6.07k|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++], {},
  ------------------
  |  |   87|  6.07k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |   88|   592k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (88:34): [True: 586k, False: 6.07k]
  |  |  ------------------
  |  |   89|   586k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |   90|   586k|    alpha_set_op \
  |  |   91|   586k|    ptr += ps; \
  |  |   92|   586k|    pointer_op \
  |  |   93|   586k|  } \
  |  |   94|  6.07k|}
  ------------------
  172|  7.59k|                         bufferptr += source->png_alpha;)
  173|  19.2k|  } else {
  174|  19.2k|    register unsigned char *bufferptr = source->iobuffer;
  175|  19.2k|    if (aindex >= 0)
  ------------------
  |  Branch (175:9): [True: 4.52k, False: 14.7k]
  ------------------
  176|  4.52k|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |   87|  4.52k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |   88|   363k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (88:34): [True: 358k, False: 4.52k]
  |  |  ------------------
  |  |   89|   358k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |   90|   358k|    alpha_set_op \
  |  |   91|   358k|    ptr += ps; \
  |  |   92|   358k|    pointer_op \
  |  |   93|   358k|  } \
  |  |   94|  4.52k|}
  ------------------
  177|  19.2k|                         ptr[aindex] = (1 << cinfo->data_precision) - 1;,
  178|  19.2k|                         bufferptr += source->png_alpha;)
  179|  14.7k|    else
  180|  14.7k|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++], {},
  ------------------
  |  |   87|  14.7k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |   88|  1.09M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (88:34): [True: 1.07M, False: 14.7k]
  |  |  ------------------
  |  |   89|  1.07M|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |   90|  1.07M|    alpha_set_op \
  |  |   91|  1.07M|    ptr += ps; \
  |  |   92|  1.07M|    pointer_op \
  |  |   93|  1.07M|  } \
  |  |   94|  14.7k|}
  ------------------
  181|  19.2k|                         bufferptr += source->png_alpha;)
  182|  19.2k|  }
  183|  31.3k|  return 1;
  184|  31.3k|}
rdpng-8.c:get_gray_cmyk_row:
  192|  6.27k|{
  193|  6.27k|  png_source_ptr source = (png_source_ptr)sinfo;
  194|  6.27k|  register _JSAMPROW ptr;
  195|  6.27k|  register _JSAMPLE *rescale = source->rescale;
  196|  6.27k|  JDIMENSION col;
  197|       |
  198|  6.27k|  get_raw_row(cinfo, sinfo);
  199|  6.27k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  6.27k|#define _buffer  buffer
  ------------------
  200|  6.27k|#if BITS_IN_JSAMPLE != 12
  201|  6.27k|  if (source->png_bit_depth == cinfo->data_precision) {
  ------------------
  |  Branch (201:7): [True: 0, False: 6.27k]
  ------------------
  202|      0|    register _JSAMPLE *bufferptr = (_JSAMPLE *)source->iobuffer;
  203|      0|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (203:36): [True: 0, False: 0]
  ------------------
  204|      0|      _JSAMPLE gray = *bufferptr++;
  ------------------
  |  |  224|      0|#define _JSAMPLE  JSAMPLE
  ------------------
  205|      0|      bufferptr += source->png_alpha;
  206|      0|      rgb_to_cmyk(_MAXJSAMPLE, gray, gray, gray, ptr, ptr + 1, ptr + 2,
  ------------------
  |  |  226|      0|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|      0|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  207|      0|                  ptr + 3);
  208|      0|      ptr += 4;
  209|      0|    }
  210|      0|  } else
  211|  6.27k|#endif
  212|  6.27k|  if (source->png_bit_depth == 16) {
  ------------------
  |  Branch (212:7): [True: 1.51k, False: 4.75k]
  ------------------
  213|  1.51k|    unsigned short *bufferptr = (unsigned short *)source->iobuffer;
  214|   148k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (214:36): [True: 146k, False: 1.51k]
  ------------------
  215|   146k|      _JSAMPLE gray = rescale[*bufferptr++];
  ------------------
  |  |  224|   146k|#define _JSAMPLE  JSAMPLE
  ------------------
  216|   146k|      bufferptr += source->png_alpha;
  217|   146k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, gray, gray, gray, ptr,
  218|   146k|                  ptr + 1, ptr + 2, ptr + 3);
  219|   146k|      ptr += 4;
  220|   146k|    }
  221|  4.75k|  } else {
  222|  4.75k|    register unsigned char *bufferptr = source->iobuffer;
  223|   363k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (223:36): [True: 358k, False: 4.75k]
  ------------------
  224|   358k|      _JSAMPLE gray = rescale[*bufferptr++];
  ------------------
  |  |  224|   358k|#define _JSAMPLE  JSAMPLE
  ------------------
  225|   358k|      bufferptr += source->png_alpha;
  226|   358k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, gray, gray, gray, ptr,
  227|   358k|                  ptr + 1, ptr + 2, ptr + 3);
  228|   358k|      ptr += 4;
  229|   358k|    }
  230|  4.75k|  }
  231|  6.27k|  return 1;
  232|  6.27k|}
rdpng-8.c:get_rgb_row:
  252|  74.2k|{
  253|  74.2k|  png_source_ptr source = (png_source_ptr)sinfo;
  254|  74.2k|  register _JSAMPROW ptr;
  255|  74.2k|  register _JSAMPLE *rescale = source->rescale;
  256|  74.2k|  JDIMENSION col;
  257|  74.2k|  register int rindex = rgb_red[cinfo->in_color_space];
  258|  74.2k|  register int gindex = rgb_green[cinfo->in_color_space];
  259|  74.2k|  register int bindex = rgb_blue[cinfo->in_color_space];
  260|  74.2k|  register int aindex = alpha_index[cinfo->in_color_space];
  261|  74.2k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  262|       |
  263|  74.2k|  get_raw_row(cinfo, sinfo);
  264|  74.2k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  74.2k|#define _buffer  buffer
  ------------------
  265|  74.2k|#if BITS_IN_JSAMPLE != 12
  266|  74.2k|  if (source->png_bit_depth == cinfo->data_precision) {
  ------------------
  |  Branch (266:7): [True: 0, False: 74.2k]
  ------------------
  267|      0|    register _JSAMPLE *bufferptr = (_JSAMPLE *)source->iobuffer;
  268|      0|    if (aindex >= 0)
  ------------------
  |  Branch (268:9): [True: 0, False: 0]
  ------------------
  269|      0|      RGB_READ_LOOP(*bufferptr++, ptr[aindex] = _MAXJSAMPLE;,
  ------------------
  |  |  235|      0|#define RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |  236|      0|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (236:34): [True: 0, False: 0]
  |  |  ------------------
  |  |  237|      0|    ptr[rindex] = read_op; \
  |  |  238|      0|    ptr[gindex] = read_op; \
  |  |  239|      0|    ptr[bindex] = read_op; \
  |  |  240|      0|    alpha_set_op \
  |  |  241|      0|    pointer_op \
  |  |  242|      0|    ptr += ps; \
  |  |  243|      0|  } \
  |  |  244|      0|}
  ------------------
  270|      0|                    bufferptr += source->png_alpha;)
  271|      0|    else
  272|      0|      RGB_READ_LOOP(*bufferptr++, {}, bufferptr += source->png_alpha;)
  ------------------
  |  |  235|      0|#define RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |  236|      0|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (236:34): [True: 0, False: 0]
  |  |  ------------------
  |  |  237|      0|    ptr[rindex] = read_op; \
  |  |  238|      0|    ptr[gindex] = read_op; \
  |  |  239|      0|    ptr[bindex] = read_op; \
  |  |  240|      0|    alpha_set_op \
  |  |  241|      0|    pointer_op \
  |  |  242|      0|    ptr += ps; \
  |  |  243|      0|  } \
  |  |  244|      0|}
  ------------------
  273|      0|  } else
  274|  74.2k|#endif
  275|  74.2k|  if (source->png_bit_depth == 16) {
  ------------------
  |  Branch (275:7): [True: 6.80k, False: 67.4k]
  ------------------
  276|  6.80k|    unsigned short *bufferptr = (unsigned short *)source->iobuffer;
  277|  6.80k|    if (aindex >= 0)
  ------------------
  |  Branch (277:9): [True: 1.36k, False: 5.44k]
  ------------------
  278|  1.36k|      RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |  235|  1.36k|#define RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |  236|   130k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (236:34): [True: 129k, False: 1.36k]
  |  |  ------------------
  |  |  237|   129k|    ptr[rindex] = read_op; \
  |  |  238|   129k|    ptr[gindex] = read_op; \
  |  |  239|   129k|    ptr[bindex] = read_op; \
  |  |  240|   129k|    alpha_set_op \
  |  |  241|   129k|    pointer_op \
  |  |  242|   129k|    ptr += ps; \
  |  |  243|   129k|  } \
  |  |  244|  1.36k|}
  ------------------
  279|  6.80k|                    ptr[aindex] = (1 << cinfo->data_precision) - 1;,
  280|  6.80k|                    bufferptr += source->png_alpha;)
  281|  5.44k|    else
  282|  5.44k|      RGB_READ_LOOP(rescale[*bufferptr++], {},
  ------------------
  |  |  235|  5.44k|#define RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |  236|   522k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (236:34): [True: 517k, False: 5.44k]
  |  |  ------------------
  |  |  237|   517k|    ptr[rindex] = read_op; \
  |  |  238|   517k|    ptr[gindex] = read_op; \
  |  |  239|   517k|    ptr[bindex] = read_op; \
  |  |  240|   517k|    alpha_set_op \
  |  |  241|   517k|    pointer_op \
  |  |  242|   517k|    ptr += ps; \
  |  |  243|   517k|  } \
  |  |  244|  5.44k|}
  ------------------
  283|  6.80k|                    bufferptr += source->png_alpha;)
  284|  67.4k|  } else {
  285|  67.4k|    register unsigned char *bufferptr = source->iobuffer;
  286|  67.4k|    if (aindex >= 0)
  ------------------
  |  Branch (286:9): [True: 16.5k, False: 50.9k]
  ------------------
  287|  16.5k|      RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |  235|  16.5k|#define RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |  236|  16.0M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (236:34): [True: 16.0M, False: 16.5k]
  |  |  ------------------
  |  |  237|  16.0M|    ptr[rindex] = read_op; \
  |  |  238|  16.0M|    ptr[gindex] = read_op; \
  |  |  239|  16.0M|    ptr[bindex] = read_op; \
  |  |  240|  16.0M|    alpha_set_op \
  |  |  241|  16.0M|    pointer_op \
  |  |  242|  16.0M|    ptr += ps; \
  |  |  243|  16.0M|  } \
  |  |  244|  16.5k|}
  ------------------
  288|  67.4k|                    ptr[aindex] = (1 << cinfo->data_precision) - 1;,
  289|  67.4k|                    bufferptr += source->png_alpha;)
  290|  50.9k|    else
  291|  50.9k|      RGB_READ_LOOP(rescale[*bufferptr++], {},
  ------------------
  |  |  235|  50.9k|#define RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |  236|  48.1M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (236:34): [True: 48.1M, False: 50.9k]
  |  |  ------------------
  |  |  237|  48.1M|    ptr[rindex] = read_op; \
  |  |  238|  48.1M|    ptr[gindex] = read_op; \
  |  |  239|  48.1M|    ptr[bindex] = read_op; \
  |  |  240|  48.1M|    alpha_set_op \
  |  |  241|  48.1M|    pointer_op \
  |  |  242|  48.1M|    ptr += ps; \
  |  |  243|  48.1M|  } \
  |  |  244|  50.9k|}
  ------------------
  292|  67.4k|                    bufferptr += source->png_alpha;)
  293|  67.4k|  }
  294|  74.2k|  return 1;
  295|  74.2k|}
rdpng-8.c:get_rgb_cmyk_row:
  303|  18.2k|{
  304|  18.2k|  png_source_ptr source = (png_source_ptr)sinfo;
  305|  18.2k|  register _JSAMPROW ptr;
  306|  18.2k|  register _JSAMPLE *rescale = source->rescale;
  307|  18.2k|  JDIMENSION col;
  308|       |
  309|  18.2k|  get_raw_row(cinfo, sinfo);
  310|  18.2k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  18.2k|#define _buffer  buffer
  ------------------
  311|  18.2k|#if BITS_IN_JSAMPLE != 12
  312|  18.2k|  if (source->png_bit_depth == cinfo->data_precision) {
  ------------------
  |  Branch (312:7): [True: 0, False: 18.2k]
  ------------------
  313|      0|    register _JSAMPLE *bufferptr = (_JSAMPLE *)source->iobuffer;
  314|      0|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (314:36): [True: 0, False: 0]
  ------------------
  315|      0|      _JSAMPLE r = *bufferptr++;
  ------------------
  |  |  224|      0|#define _JSAMPLE  JSAMPLE
  ------------------
  316|      0|      _JSAMPLE g = *bufferptr++;
  ------------------
  |  |  224|      0|#define _JSAMPLE  JSAMPLE
  ------------------
  317|      0|      _JSAMPLE b = *bufferptr++;
  ------------------
  |  |  224|      0|#define _JSAMPLE  JSAMPLE
  ------------------
  318|      0|      bufferptr += source->png_alpha;
  319|      0|      rgb_to_cmyk(_MAXJSAMPLE, r, g, b, ptr, ptr + 1, ptr + 2, ptr + 3);
  ------------------
  |  |  226|      0|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|      0|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  320|      0|      ptr += 4;
  321|      0|    }
  322|      0|  } else
  323|  18.2k|#endif
  324|  18.2k|  if (source->png_bit_depth == 16) {
  ------------------
  |  Branch (324:7): [True: 1.36k, False: 16.8k]
  ------------------
  325|  1.36k|    unsigned short *bufferptr = (unsigned short *)source->iobuffer;
  326|   130k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (326:36): [True: 129k, False: 1.36k]
  ------------------
  327|   129k|      _JSAMPLE r = rescale[*bufferptr++];
  ------------------
  |  |  224|   129k|#define _JSAMPLE  JSAMPLE
  ------------------
  328|   129k|      _JSAMPLE g = rescale[*bufferptr++];
  ------------------
  |  |  224|   129k|#define _JSAMPLE  JSAMPLE
  ------------------
  329|   129k|      _JSAMPLE b = rescale[*bufferptr++];
  ------------------
  |  |  224|   129k|#define _JSAMPLE  JSAMPLE
  ------------------
  330|   129k|      bufferptr += source->png_alpha;
  331|   129k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, r, g, b, ptr, ptr + 1,
  332|   129k|                  ptr + 2, ptr + 3);
  333|   129k|      ptr += 4;
  334|   129k|    }
  335|  16.8k|  } else {
  336|  16.8k|    register unsigned char *bufferptr = source->iobuffer;
  337|  16.0M|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (337:36): [True: 16.0M, False: 16.8k]
  ------------------
  338|  16.0M|      _JSAMPLE r = rescale[*bufferptr++];
  ------------------
  |  |  224|  16.0M|#define _JSAMPLE  JSAMPLE
  ------------------
  339|  16.0M|      _JSAMPLE g = rescale[*bufferptr++];
  ------------------
  |  |  224|  16.0M|#define _JSAMPLE  JSAMPLE
  ------------------
  340|  16.0M|      _JSAMPLE b = rescale[*bufferptr++];
  ------------------
  |  |  224|  16.0M|#define _JSAMPLE  JSAMPLE
  ------------------
  341|  16.0M|      bufferptr += source->png_alpha;
  342|  16.0M|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, r, g, b, ptr, ptr + 1,
  343|  16.0M|                  ptr + 2, ptr + 3);
  344|  16.0M|      ptr += 4;
  345|  16.0M|    }
  346|  16.8k|  }
  347|  18.2k|  return 1;
  348|  18.2k|}
rdpng-8.c:get_indexed_row:
  353|    792|{
  354|       |/* This version is for reading 8-bit-per-channel indexed-color PNG files and
  355|       | * converting to extended RGB or CMYK.
  356|       | */
  357|    792|  png_source_ptr source = (png_source_ptr)sinfo;
  358|    792|  register _JSAMPROW ptr;
  359|    792|  register JSAMPLE *bufferptr = (JSAMPLE *)source->iobuffer;
  360|    792|  register _JSAMPLE *rescale = source->rescale;
  361|    792|  JDIMENSION col;
  362|       |
  363|    792|  get_raw_row(cinfo, sinfo);
  364|    792|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|    792|#define _buffer  buffer
  ------------------
  365|    792|#if BITS_IN_JSAMPLE == 8
  366|    792|  if (source->png_bit_depth == cinfo->data_precision) {
  ------------------
  |  Branch (366:7): [True: 110, False: 682]
  ------------------
  367|    110|    if (cinfo->in_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (367:9): [True: 0, False: 110]
  ------------------
  368|      0|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (368:38): [True: 0, False: 0]
  ------------------
  369|      0|        JSAMPLE index = *bufferptr++;
  370|       |
  371|      0|        if (index >= source->colormap.n_entries)
  ------------------
  |  Branch (371:13): [True: 0, False: 0]
  ------------------
  372|      0|          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  373|      0|        *ptr++ = source->colormap.entries[index].red;
  374|      0|      }
  375|    110|    } else if (cinfo->in_color_space == JCS_CMYK) {
  ------------------
  |  Branch (375:16): [True: 0, False: 110]
  ------------------
  376|      0|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (376:38): [True: 0, False: 0]
  ------------------
  377|      0|        JSAMPLE index = *bufferptr++;
  378|       |
  379|      0|        if (index >= source->colormap.n_entries)
  ------------------
  |  Branch (379:13): [True: 0, False: 0]
  ------------------
  380|      0|          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  381|      0|        rgb_to_cmyk(_MAXJSAMPLE, source->colormap.entries[index].red,
  ------------------
  |  |  226|      0|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|      0|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  382|      0|                    source->colormap.entries[index].green,
  383|      0|                    source->colormap.entries[index].blue, ptr, ptr + 1,
  384|      0|                    ptr + 2, ptr + 3);
  385|      0|        ptr += 4;
  386|      0|      }
  387|    110|    } else {
  388|    110|      register int rindex = rgb_red[cinfo->in_color_space];
  389|    110|      register int gindex = rgb_green[cinfo->in_color_space];
  390|    110|      register int bindex = rgb_blue[cinfo->in_color_space];
  391|    110|      register int aindex = alpha_index[cinfo->in_color_space];
  392|    110|      register int ps = rgb_pixelsize[cinfo->in_color_space];
  393|       |
  394|    927|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (394:38): [True: 817, False: 110]
  ------------------
  395|    817|        JSAMPLE index = *bufferptr++;
  396|       |
  397|    817|        if (index >= source->colormap.n_entries)
  ------------------
  |  Branch (397:13): [True: 20, False: 797]
  ------------------
  398|     20|          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  ------------------
  |  |  240|     20|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     20|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  399|    817|        ptr[rindex] = source->colormap.entries[index].red;
  400|    817|        ptr[gindex] = source->colormap.entries[index].green;
  401|    817|        ptr[bindex] = source->colormap.entries[index].blue;
  402|    817|        if (aindex >= 0)
  ------------------
  |  Branch (402:13): [True: 0, False: 817]
  ------------------
  403|      0|          ptr[aindex] = _MAXJSAMPLE;
  ------------------
  |  |  226|      0|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|      0|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  404|    817|        ptr += ps;
  405|    817|      }
  406|    110|    }
  407|    110|  } else
  408|    682|#endif
  409|    682|  {
  410|    682|    if (cinfo->in_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (410:9): [True: 47, False: 635]
  ------------------
  411|    397|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (411:38): [True: 350, False: 47]
  ------------------
  412|    350|        JSAMPLE index = *bufferptr++;
  413|       |
  414|    350|        if (index >= source->colormap.n_entries)
  ------------------
  |  Branch (414:13): [True: 7, False: 343]
  ------------------
  415|      7|          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  ------------------
  |  |  240|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  416|    350|        *ptr++ = rescale[source->colormap.entries[index].red];
  417|    350|      }
  418|    635|    } else if (cinfo->in_color_space == JCS_CMYK) {
  ------------------
  |  Branch (418:16): [True: 110, False: 525]
  ------------------
  419|    927|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (419:38): [True: 817, False: 110]
  ------------------
  420|    817|        JSAMPLE index = *bufferptr++;
  421|       |
  422|    817|        if (index >= source->colormap.n_entries)
  ------------------
  |  Branch (422:13): [True: 20, False: 797]
  ------------------
  423|     20|          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  ------------------
  |  |  240|     20|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     20|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  424|    817|        rgb_to_cmyk((1 << cinfo->data_precision) - 1,
  425|    817|                    rescale[source->colormap.entries[index].red],
  426|    817|                    rescale[source->colormap.entries[index].green],
  427|    817|                    rescale[source->colormap.entries[index].blue], ptr,
  428|    817|                    ptr + 1, ptr + 2, ptr + 3);
  429|    817|        ptr += 4;
  430|    817|      }
  431|    525|    } else {
  432|    525|      register int rindex = rgb_red[cinfo->in_color_space];
  433|    525|      register int gindex = rgb_green[cinfo->in_color_space];
  434|    525|      register int bindex = rgb_blue[cinfo->in_color_space];
  435|    525|      register int aindex = alpha_index[cinfo->in_color_space];
  436|    525|      register int ps = rgb_pixelsize[cinfo->in_color_space];
  437|       |
  438|  3.79k|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (438:38): [True: 3.26k, False: 525]
  ------------------
  439|  3.26k|        JSAMPLE index = *bufferptr++;
  440|       |
  441|  3.26k|        if (index >= source->colormap.n_entries)
  ------------------
  |  Branch (441:13): [True: 80, False: 3.18k]
  ------------------
  442|     80|          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  ------------------
  |  |  240|     80|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     80|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  443|  3.26k|        ptr[rindex] = rescale[source->colormap.entries[index].red];
  444|  3.26k|        ptr[gindex] = rescale[source->colormap.entries[index].green];
  445|  3.26k|        ptr[bindex] = rescale[source->colormap.entries[index].blue];
  446|  3.26k|        if (aindex >= 0)
  ------------------
  |  Branch (446:13): [True: 797, False: 2.47k]
  ------------------
  447|    797|          ptr[aindex] = (1 << cinfo->data_precision) - 1;
  448|  3.26k|        ptr += ps;
  449|  3.26k|      }
  450|    525|    }
  451|    682|  }
  452|    792|  return 1;
  453|    792|}
rdpng-8.c:read_icc_profile_png:
  663|  5.44k|{
  664|  5.44k|  png_source_ptr source = (png_source_ptr)sinfo;
  665|  5.44k|  struct spng_iccp iccp;
  666|       |
  667|  5.44k|  if (!icc_data_ptr || !icc_data_len)
  ------------------
  |  Branch (667:7): [True: 0, False: 5.44k]
  |  Branch (667:24): [True: 0, False: 5.44k]
  ------------------
  668|      0|    ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  669|       |
  670|  5.44k|  if (source->ctx && spng_get_iccp(source->ctx, &iccp) == 0) {
  ------------------
  |  Branch (670:7): [True: 5.44k, False: 0]
  |  Branch (670:22): [True: 6, False: 5.44k]
  ------------------
  671|      6|    *icc_data_ptr = (JOCTET *)iccp.profile;
  672|      6|    *icc_data_len = (unsigned int)iccp.profile_len;
  673|      6|    return TRUE;
  ------------------
  |  |  210|      6|#define TRUE    1
  ------------------
  674|      6|  }
  675|       |
  676|  5.44k|  return FALSE;
  ------------------
  |  |  207|  5.44k|#define FALSE   0               /* values of boolean */
  ------------------
  677|  5.44k|}
rdpng-8.c:finish_input_png:
  686|  30.7k|{
  687|  30.7k|  png_source_ptr source = (png_source_ptr)sinfo;
  688|       |
  689|  30.7k|  if (source->ctx) {
  ------------------
  |  Branch (689:7): [True: 30.7k, False: 0]
  ------------------
  690|  30.7k|    spng_decode_chunks(source->ctx);
  691|  30.7k|    spng_ctx_free(source->ctx);
  692|       |    source->ctx = NULL;
  693|  30.7k|  }
  694|  30.7k|}

jinit_read_ppm:
  924|  13.4k|{
  925|  13.4k|  ppm_source_ptr source;
  926|       |
  927|  13.4k|#if BITS_IN_JSAMPLE == 8
  928|  13.4k|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  26.8k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (928:7): [True: 0, False: 13.4k]
  |  Branch (928:50): [True: 0, False: 13.4k]
  ------------------
  929|       |#else
  930|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  931|       |      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  932|       |#endif
  933|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  934|       |
  935|       |  /* Create module interface object */
  936|  13.4k|  source = (ppm_source_ptr)
  937|  13.4k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  13.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  938|  13.4k|                                sizeof(ppm_source_struct));
  939|       |  /* Fill in method ptrs, except get_pixel_rows which start_input sets */
  940|  13.4k|  source->pub.start_input = start_input_ppm;
  941|  13.4k|  source->pub.read_icc_profile = read_icc_profile_ppm;
  942|  13.4k|  source->pub.finish_input = finish_input_ppm;
  943|  13.4k|  source->pub.max_pixels = 0;
  944|       |
  945|  13.4k|  return (cjpeg_source_ptr)source;
  946|  13.4k|}
rdppm-8.c:start_input_ppm:
  703|  13.4k|{
  704|  13.4k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  705|  13.4k|  int c;
  706|  13.4k|  unsigned int w, h, maxval;
  707|  13.4k|  boolean need_iobuffer, use_raw_buffer, need_rescale;
  708|       |
  709|  13.4k|  if (getc(source->pub.input_file) != 'P')
  ------------------
  |  Branch (709:7): [True: 0, False: 13.4k]
  ------------------
  710|      0|    ERREXIT(cinfo, JERR_PPM_NOT);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  711|       |
  712|  13.4k|  c = getc(source->pub.input_file); /* subformat discriminator character */
  713|       |
  714|       |  /* detect unsupported variants (ie, PBM) before trying to read header */
  715|  13.4k|  switch (c) {
  716|  1.82k|  case '2':                     /* it's a text-format PGM file */
  ------------------
  |  Branch (716:3): [True: 1.82k, False: 11.6k]
  ------------------
  717|  3.88k|  case '3':                     /* it's a text-format PPM file */
  ------------------
  |  Branch (717:3): [True: 2.06k, False: 11.3k]
  ------------------
  718|  9.91k|  case '5':                     /* it's a raw-format PGM file */
  ------------------
  |  Branch (718:3): [True: 6.02k, False: 7.40k]
  ------------------
  719|  13.3k|  case '6':                     /* it's a raw-format PPM file */
  ------------------
  |  Branch (719:3): [True: 3.47k, False: 9.95k]
  ------------------
  720|  13.3k|    break;
  721|     42|  default:
  ------------------
  |  Branch (721:3): [True: 42, False: 13.3k]
  ------------------
  722|     42|    ERREXIT(cinfo, JERR_PPM_NOT);
  ------------------
  |  |  240|     42|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     42|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  723|     42|    break;
  724|  13.4k|  }
  725|       |
  726|       |  /* fetch the remaining header info */
  727|  13.3k|  w = read_pbm_integer(cinfo, source->pub.input_file, 65535);
  728|  13.3k|  h = read_pbm_integer(cinfo, source->pub.input_file, 65535);
  729|  13.3k|  maxval = read_pbm_integer(cinfo, source->pub.input_file, 65535);
  730|       |
  731|  13.3k|  if (w <= 0 || h <= 0 || maxval <= 0) /* error check */
  ------------------
  |  Branch (731:7): [True: 1.23k, False: 12.1k]
  |  Branch (731:17): [True: 7, False: 12.1k]
  |  Branch (731:27): [True: 14, False: 12.1k]
  ------------------
  732|     28|    ERREXIT(cinfo, JERR_PPM_NOT);
  ------------------
  |  |  240|     28|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     28|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  733|  13.3k|  if (w > JPEG_MAX_DIMENSION || h > JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  26.7k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
                if (w > JPEG_MAX_DIMENSION || h > JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  12.1k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (733:7): [True: 1.26k, False: 12.1k]
  |  Branch (733:33): [True: 7, False: 12.1k]
  ------------------
  734|     21|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|     21|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     21|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     21|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  735|  13.3k|  if (sinfo->max_pixels && (unsigned long long)w * h > sinfo->max_pixels)
  ------------------
  |  Branch (735:7): [True: 12.1k, False: 1.27k]
  |  Branch (735:28): [True: 231, False: 11.8k]
  ------------------
  736|    231|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, sinfo->max_pixels);
  ------------------
  |  |  243|    231|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    231|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    231|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  737|       |
  738|  13.3k|  cinfo->image_width = (JDIMENSION)w;
  739|  13.3k|  cinfo->image_height = (JDIMENSION)h;
  740|  13.3k|  source->maxval = maxval;
  741|       |
  742|       |  /* initialize flags to most common settings */
  743|  13.3k|  need_iobuffer = TRUE;         /* do we need an I/O buffer? */
  ------------------
  |  |  210|  13.3k|#define TRUE    1
  ------------------
  744|  13.3k|  use_raw_buffer = FALSE;       /* do we map input buffer onto I/O buffer? */
  ------------------
  |  |  207|  13.3k|#define FALSE   0               /* values of boolean */
  ------------------
  745|  13.3k|  need_rescale = TRUE;          /* do we need a rescale array? */
  ------------------
  |  |  210|  13.3k|#define TRUE    1
  ------------------
  746|       |
  747|  13.3k|  switch (c) {
  ------------------
  |  Branch (747:11): [True: 11.8k, False: 1.50k]
  ------------------
  748|  1.46k|  case '2':                     /* it's a text-format PGM file */
  ------------------
  |  Branch (748:3): [True: 1.46k, False: 11.9k]
  ------------------
  749|  1.46k|    if (cinfo->in_color_space == JCS_UNKNOWN ||
  ------------------
  |  Branch (749:9): [True: 0, False: 1.46k]
  ------------------
  750|  1.46k|        cinfo->in_color_space == JCS_RGB)
  ------------------
  |  Branch (750:9): [True: 0, False: 1.46k]
  ------------------
  751|      0|      cinfo->in_color_space = JCS_GRAYSCALE;
  752|  1.46k|    TRACEMS3(cinfo, 1, JTRC_PGM_TEXT, w, h, maxval);
  ------------------
  |  |  309|  1.46k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.46k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.46k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  1.46k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  1.46k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  1.46k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  753|  1.46k|    if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (753:9): [True: 209, False: 1.25k]
  ------------------
  754|    209|      source->pub.get_pixel_rows = get_text_gray_row;
  755|  1.25k|    else if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  1.25k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 1.25k]
  |  |  |  Branch (78:22): [True: 1.04k, False: 209]
  |  |  |  Branch (78:43): [True: 1.04k, False: 0]
  |  |  ------------------
  ------------------
  756|  1.04k|      source->pub.get_pixel_rows = get_text_gray_rgb_row;
  757|    209|    else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (757:14): [True: 209, False: 0]
  ------------------
  758|    209|      source->pub.get_pixel_rows = get_text_gray_cmyk_row;
  759|      0|    else
  760|      0|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  761|  1.46k|    need_iobuffer = FALSE;
  ------------------
  |  |  207|  1.46k|#define FALSE   0               /* values of boolean */
  ------------------
  762|  1.46k|    break;
  763|       |
  764|  1.70k|  case '3':                     /* it's a text-format PPM file */
  ------------------
  |  Branch (764:3): [True: 1.70k, False: 11.6k]
  ------------------
  765|  1.70k|    if (cinfo->in_color_space == JCS_UNKNOWN)
  ------------------
  |  Branch (765:9): [True: 0, False: 1.70k]
  ------------------
  766|      0|      cinfo->in_color_space = JCS_EXT_RGB;
  767|  1.70k|    TRACEMS3(cinfo, 1, JTRC_PPM_TEXT, w, h, maxval);
  ------------------
  |  |  309|  1.70k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.70k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.70k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  1.70k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  1.70k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  1.70k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  768|  1.70k|    if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  1.70k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 1.70k]
  |  |  |  Branch (78:22): [True: 1.22k, False: 488]
  |  |  |  Branch (78:43): [True: 1.22k, False: 0]
  |  |  ------------------
  ------------------
  769|  1.22k|      source->pub.get_pixel_rows = get_text_rgb_row;
  770|    488|    else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (770:14): [True: 244, False: 244]
  ------------------
  771|    244|      source->pub.get_pixel_rows = get_text_rgb_cmyk_row;
  772|    244|    else
  773|    244|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|    244|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    244|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  774|  1.70k|    need_iobuffer = FALSE;
  ------------------
  |  |  207|  1.70k|#define FALSE   0               /* values of boolean */
  ------------------
  775|  1.70k|    break;
  776|       |
  777|  5.64k|  case '5':                     /* it's a raw-format PGM file */
  ------------------
  |  Branch (777:3): [True: 5.64k, False: 7.74k]
  ------------------
  778|  5.64k|    if (cinfo->in_color_space == JCS_UNKNOWN ||
  ------------------
  |  Branch (778:9): [True: 0, False: 5.64k]
  ------------------
  779|  5.64k|        cinfo->in_color_space == JCS_RGB)
  ------------------
  |  Branch (779:9): [True: 0, False: 5.64k]
  ------------------
  780|      0|      cinfo->in_color_space = JCS_GRAYSCALE;
  781|  5.64k|    TRACEMS3(cinfo, 1, JTRC_PGM, w, h, maxval);
  ------------------
  |  |  309|  5.64k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  5.64k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.64k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  5.64k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  5.64k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  5.64k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  782|  5.64k|    if (maxval > 255) {
  ------------------
  |  Branch (782:9): [True: 875, False: 4.77k]
  ------------------
  783|    875|      if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (783:11): [True: 125, False: 750]
  ------------------
  784|    125|        source->pub.get_pixel_rows = get_word_gray_row;
  785|    750|      else if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|    750|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 750]
  |  |  |  Branch (78:22): [True: 625, False: 125]
  |  |  |  Branch (78:43): [True: 625, False: 0]
  |  |  ------------------
  ------------------
  786|    625|        source->pub.get_pixel_rows = get_word_gray_rgb_row;
  787|    125|      else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (787:16): [True: 125, False: 0]
  ------------------
  788|    125|        source->pub.get_pixel_rows = get_word_gray_cmyk_row;
  789|      0|      else
  790|      0|        ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  791|    875|#if BITS_IN_JSAMPLE == 8
  792|  4.77k|    } else if (maxval <= _MAXJSAMPLE &&
  ------------------
  |  |  226|  4.77k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  9.54k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  |  Branch (792:16): [True: 4.77k, False: 0]
  ------------------
  793|  4.77k|               maxval == ((1U << cinfo->data_precision) - 1U) &&
  ------------------
  |  Branch (793:16): [True: 360, False: 4.41k]
  ------------------
  794|    360|               cinfo->in_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (794:16): [True: 86, False: 274]
  ------------------
  795|     86|      source->pub.get_pixel_rows = get_raw_row;
  796|     86|      use_raw_buffer = TRUE;
  ------------------
  |  |  210|     86|#define TRUE    1
  ------------------
  797|     86|      need_rescale = FALSE;
  ------------------
  |  |  207|     86|#define FALSE   0               /* values of boolean */
  ------------------
  798|     86|#endif
  799|  4.68k|    } else {
  800|  4.68k|      if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (800:11): [True: 596, False: 4.09k]
  ------------------
  801|    596|        source->pub.get_pixel_rows = get_scaled_gray_row;
  802|  4.09k|      else if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  4.09k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 4.09k]
  |  |  |  Branch (78:22): [True: 3.41k, False: 682]
  |  |  |  Branch (78:43): [True: 3.41k, False: 0]
  |  |  ------------------
  ------------------
  803|  3.41k|        source->pub.get_pixel_rows = get_gray_rgb_row;
  804|    682|      else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (804:16): [True: 682, False: 0]
  ------------------
  805|    682|        source->pub.get_pixel_rows = get_gray_cmyk_row;
  806|      0|      else
  807|      0|        ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  808|  4.68k|    }
  809|  5.64k|    break;
  810|       |
  811|  3.06k|  case '6':                     /* it's a raw-format PPM file */
  ------------------
  |  Branch (811:3): [True: 3.06k, False: 10.3k]
  ------------------
  812|  3.06k|    if (cinfo->in_color_space == JCS_UNKNOWN)
  ------------------
  |  Branch (812:9): [True: 0, False: 3.06k]
  ------------------
  813|      0|      cinfo->in_color_space = JCS_EXT_RGB;
  814|  3.06k|    TRACEMS3(cinfo, 1, JTRC_PPM, w, h, maxval);
  ------------------
  |  |  309|  3.06k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  3.06k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  3.06k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  3.06k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  3.06k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  815|  3.06k|    if (maxval > 255) {
  ------------------
  |  Branch (815:9): [True: 1.22k, False: 1.84k]
  ------------------
  816|  1.22k|      if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  1.22k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 1.22k]
  |  |  |  Branch (78:22): [True: 875, False: 350]
  |  |  |  Branch (78:43): [True: 875, False: 0]
  |  |  ------------------
  ------------------
  817|    875|        source->pub.get_pixel_rows = get_word_rgb_row;
  818|    350|      else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (818:16): [True: 175, False: 175]
  ------------------
  819|    175|        source->pub.get_pixel_rows = get_word_rgb_cmyk_row;
  820|    175|      else
  821|    175|        ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|    175|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    175|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  822|  1.22k|#if BITS_IN_JSAMPLE == 8
  823|  1.84k|    } else if (maxval <= _MAXJSAMPLE &&
  ------------------
  |  |  226|  1.84k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  3.68k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  |  Branch (823:16): [True: 1.84k, False: 0]
  ------------------
  824|  1.84k|               maxval == ((1U << cinfo->data_precision) - 1U) &&
  ------------------
  |  Branch (824:16): [True: 135, False: 1.70k]
  ------------------
  825|    135|#if RGB_RED == 0 && RGB_GREEN == 1 && RGB_BLUE == 2 && RGB_PIXELSIZE == 3
  826|    135|               (cinfo->in_color_space == JCS_EXT_RGB ||
  ------------------
  |  Branch (826:17): [True: 4, False: 131]
  ------------------
  827|    131|                cinfo->in_color_space == JCS_RGB)) {
  ------------------
  |  Branch (827:17): [True: 0, False: 131]
  ------------------
  828|       |#else
  829|       |               cinfo->in_color_space == JCS_EXT_RGB) {
  830|       |#endif
  831|      4|      source->pub.get_pixel_rows = get_raw_row;
  832|      4|      use_raw_buffer = TRUE;
  ------------------
  |  |  210|      4|#define TRUE    1
  ------------------
  833|      4|      need_rescale = FALSE;
  ------------------
  |  |  207|      4|#define FALSE   0               /* values of boolean */
  ------------------
  834|      4|#endif
  835|  1.83k|    } else {
  836|  1.83k|      if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  1.83k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 1.83k]
  |  |  |  Branch (78:22): [True: 1.31k, False: 526]
  |  |  |  Branch (78:43): [True: 1.31k, False: 0]
  |  |  ------------------
  ------------------
  837|  1.31k|        source->pub.get_pixel_rows = get_rgb_row;
  838|    526|      else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (838:16): [True: 263, False: 263]
  ------------------
  839|    263|        source->pub.get_pixel_rows = get_rgb_cmyk_row;
  840|    263|      else
  841|    263|        ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|    263|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    263|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  842|  1.83k|    }
  843|  3.06k|    break;
  844|  13.3k|  }
  845|       |
  846|  11.2k|  if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  11.2k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 11.2k]
  |  |  |  Branch (78:22): [True: 8.49k, False: 2.71k]
  |  |  |  Branch (78:43): [True: 8.49k, False: 0]
  |  |  ------------------
  ------------------
  847|  8.49k|    cinfo->input_components = rgb_pixelsize[cinfo->in_color_space];
  848|  2.71k|  else if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (848:12): [True: 1.01k, False: 1.69k]
  ------------------
  849|  1.01k|    cinfo->input_components = 1;
  850|  1.69k|  else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (850:12): [True: 1.69k, False: 0]
  ------------------
  851|  1.69k|    cinfo->input_components = 4;
  852|       |
  853|       |  /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */
  854|  11.2k|  if (need_iobuffer) {
  ------------------
  |  Branch (854:7): [True: 8.27k, False: 2.92k]
  ------------------
  855|  8.27k|    if (c == '6')
  ------------------
  |  Branch (855:9): [True: 2.62k, False: 5.64k]
  ------------------
  856|  2.62k|      source->buffer_width = (size_t)w * 3 * (maxval <= 255 ? 1 : 2);
  ------------------
  |  Branch (856:47): [True: 1.57k, False: 1.05k]
  ------------------
  857|  5.64k|    else
  858|  5.64k|      source->buffer_width = (size_t)w * (maxval <= 255 ? 1 : 2);
  ------------------
  |  Branch (858:43): [True: 4.77k, False: 875]
  ------------------
  859|  8.27k|    source->iobuffer = (unsigned char *)
  860|  8.27k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  8.27k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  861|  8.27k|                                  source->buffer_width);
  862|  8.27k|  }
  863|       |
  864|       |  /* Create compressor input buffer. */
  865|  11.2k|  if (use_raw_buffer) {
  ------------------
  |  Branch (865:7): [True: 90, False: 11.1k]
  ------------------
  866|       |    /* For unscaled raw-input case, we can just map it onto the I/O buffer. */
  867|       |    /* Synthesize a _JSAMPARRAY pointer structure */
  868|     90|    source->pixrow = (_JSAMPROW)source->iobuffer;
  869|     90|    source->pub._buffer = &source->pixrow;
  ------------------
  |  |  326|     90|#define _buffer  buffer
  ------------------
  870|     90|    source->pub.buffer_height = 1;
  871|  11.1k|  } else {
  872|       |    /* Need to translate anyway, so make a separate sample buffer. */
  873|  11.1k|    source->pub._buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  ------------------
  |  |  326|  11.1k|#define _buffer  buffer
  ------------------
  874|  11.1k|      ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  11.1k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  875|  11.1k|       (JDIMENSION)w * cinfo->input_components, (JDIMENSION)1);
  876|  11.1k|    source->pub.buffer_height = 1;
  877|  11.1k|  }
  878|       |
  879|       |  /* Compute the rescaling array if required. */
  880|  11.2k|  if (need_rescale) {
  ------------------
  |  Branch (880:7): [True: 11.1k, False: 90]
  ------------------
  881|  11.1k|    size_t val, half_maxval;
  882|       |
  883|       |    /* On 16-bit-int machines we have to be careful of maxval = 65535 */
  884|  11.1k|    source->rescale = (_JSAMPLE *)
  885|  11.1k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  11.1k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  886|  11.1k|                                  (MAX(maxval, 255) + 1L) * sizeof(_JSAMPLE));
  ------------------
  |  |  513|  11.1k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 2.19k, False: 8.92k]
  |  |  ------------------
  ------------------
  887|  11.1k|    memset(source->rescale, 0, (MAX(maxval, 255) + 1L) * sizeof(_JSAMPLE));
  ------------------
  |  |  513|  11.1k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 2.19k, False: 8.92k]
  |  |  ------------------
  ------------------
  888|  11.1k|    half_maxval = (size_t)maxval / 2;
  889|  22.8M|    for (val = 0; val <= (size_t)maxval; val++) {
  ------------------
  |  Branch (889:19): [True: 22.8M, False: 11.1k]
  ------------------
  890|       |      /* The multiplication here must be done in 32 bits to avoid overflow */
  891|  22.8M|      source->rescale[val] =
  892|  22.8M|        (_JSAMPLE)((val * ((1 << cinfo->data_precision) - 1) + half_maxval) /
  893|  22.8M|                   maxval);
  894|  22.8M|    }
  895|  11.1k|  }
  896|  11.2k|}
rdppm-8.c:read_pbm_integer:
   92|   141k|{
   93|   141k|  register int ch;
   94|   141k|  register unsigned int val;
   95|       |
   96|       |  /* Skip any leading whitespace */
   97|   149k|  do {
   98|   149k|    ch = pbm_getc(infile);
   99|   149k|    if (ch == EOF)
  ------------------
  |  Branch (99:9): [True: 3.62k, False: 145k]
  ------------------
  100|  3.62k|      ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|  3.62k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  3.62k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  101|   149k|  } while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
  ------------------
  |  Branch (101:12): [True: 4.86k, False: 144k]
  |  Branch (101:25): [True: 1.20k, False: 143k]
  |  Branch (101:39): [True: 3.56k, False: 139k]
  |  Branch (101:53): [True: 1.29k, False: 138k]
  ------------------
  102|       |
  103|   141k|  if (ch < '0' || ch > '9')
  ------------------
  |  Branch (103:7): [True: 3.77k, False: 138k]
  |  Branch (103:19): [True: 123, False: 137k]
  ------------------
  104|    268|    ERREXIT(cinfo, JERR_PPM_NONNUMERIC);
  ------------------
  |  |  240|    268|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    268|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  105|       |
  106|   141k|  val = ch - '0';
  107|   169k|  while ((ch = pbm_getc(infile)) >= '0' && ch <= '9') {
  ------------------
  |  Branch (107:10): [True: 109k, False: 60.1k]
  |  Branch (107:44): [True: 27.5k, False: 81.6k]
  ------------------
  108|  27.5k|    val *= 10;
  109|  27.5k|    val += ch - '0';
  110|  27.5k|    if (val > maxval)
  ------------------
  |  Branch (110:9): [True: 132, False: 27.3k]
  ------------------
  111|    132|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|    132|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    132|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  112|  27.5k|  }
  113|       |
  114|   141k|  return val;
  115|   141k|}
rdppm-8.c:pbm_getc:
   73|   314k|{
   74|   314k|  register int ch;
   75|       |
   76|   314k|  ch = getc(infile);
   77|   314k|  if (ch == '#') {
  ------------------
  |  Branch (77:7): [True: 3.01k, False: 311k]
  ------------------
   78|  44.7k|    do {
   79|  44.7k|      ch = getc(infile);
   80|  44.7k|    } while (ch != '\n' && ch != EOF);
  ------------------
  |  Branch (80:14): [True: 42.1k, False: 2.63k]
  |  Branch (80:28): [True: 41.7k, False: 384]
  ------------------
   81|  3.01k|  }
   82|   314k|  return ch;
   83|   314k|}
rdppm-8.c:get_text_gray_row:
  133|  2.04k|{
  134|  2.04k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  135|  2.04k|  FILE *infile = source->pub.input_file;
  136|  2.04k|  register _JSAMPROW ptr;
  137|  2.04k|  register _JSAMPLE *rescale = source->rescale;
  138|  2.04k|  JDIMENSION col;
  139|  2.04k|  unsigned int maxval = source->maxval;
  140|       |
  141|  2.04k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  2.04k|#define _buffer  buffer
  ------------------
  142|  5.82k|  for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (142:34): [True: 3.78k, False: 2.04k]
  ------------------
  143|  3.78k|    *ptr++ = rescale[read_pbm_integer(cinfo, infile, maxval)];
  144|  3.78k|  }
  145|  2.04k|  return 1;
  146|  2.04k|}
rdppm-8.c:get_text_gray_rgb_row:
  161|  10.2k|{
  162|  10.2k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  163|  10.2k|  FILE *infile = source->pub.input_file;
  164|  10.2k|  register _JSAMPROW ptr;
  165|  10.2k|  register _JSAMPLE *rescale = source->rescale;
  166|  10.2k|  JDIMENSION col;
  167|  10.2k|  unsigned int maxval = source->maxval;
  168|  10.2k|  register int rindex = rgb_red[cinfo->in_color_space];
  169|  10.2k|  register int gindex = rgb_green[cinfo->in_color_space];
  170|  10.2k|  register int bindex = rgb_blue[cinfo->in_color_space];
  171|  10.2k|  register int aindex = alpha_index[cinfo->in_color_space];
  172|  10.2k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  173|       |
  174|  10.2k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  10.2k|#define _buffer  buffer
  ------------------
  175|  10.2k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (175:7): [True: 705, False: 9.49k]
  ------------------
  176|    705|    if (aindex >= 0)
  ------------------
  |  Branch (176:9): [True: 220, False: 485]
  ------------------
  177|    220|      GRAY_RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval),
  ------------------
  |  |  149|    220|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|    634|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 414, False: 220]
  |  |  ------------------
  |  |  151|    414|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|    414|    alpha_set_op \
  |  |  153|    414|    ptr += ps; \
  |  |  154|    414|  } \
  |  |  155|    220|}
  ------------------
  178|    705|                         ptr[aindex] = (_JSAMPLE)maxval;)
  179|    485|    else
  180|    485|      GRAY_RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval), {})
  ------------------
  |  |  149|    485|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|  1.42k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 936, False: 485]
  |  |  ------------------
  |  |  151|    936|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|    936|    alpha_set_op \
  |  |  153|    936|    ptr += ps; \
  |  |  154|    936|  } \
  |  |  155|    485|}
  ------------------
  181|  9.49k|  } else {
  182|  9.49k|    if (aindex >= 0)
  ------------------
  |  Branch (182:9): [True: 1.82k, False: 7.67k]
  ------------------
  183|  1.82k|      GRAY_RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)],
  ------------------
  |  |  149|  1.82k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|  5.19k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 3.37k, False: 1.82k]
  |  |  ------------------
  |  |  151|  3.37k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|  3.37k|    alpha_set_op \
  |  |  153|  3.37k|    ptr += ps; \
  |  |  154|  3.37k|  } \
  |  |  155|  1.82k|}
  ------------------
  184|  9.49k|                         ptr[aindex] = (1 << cinfo->data_precision) - 1;)
  185|  7.67k|    else
  186|  7.67k|      GRAY_RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)], {})
  ------------------
  |  |  149|  7.67k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|  21.8k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 14.2k, False: 7.67k]
  |  |  ------------------
  |  |  151|  14.2k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|  14.2k|    alpha_set_op \
  |  |  153|  14.2k|    ptr += ps; \
  |  |  154|  14.2k|  } \
  |  |  155|  7.67k|}
  ------------------
  187|  9.49k|  }
  188|  10.2k|  return 1;
  189|  10.2k|}
rdppm-8.c:get_text_gray_cmyk_row:
  196|  2.04k|{
  197|  2.04k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  198|  2.04k|  FILE *infile = source->pub.input_file;
  199|  2.04k|  register _JSAMPROW ptr;
  200|  2.04k|  register _JSAMPLE *rescale = source->rescale;
  201|  2.04k|  JDIMENSION col;
  202|  2.04k|  unsigned int maxval = source->maxval;
  203|       |
  204|  2.04k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  2.04k|#define _buffer  buffer
  ------------------
  205|  2.04k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (205:7): [True: 759, False: 1.28k]
  ------------------
  206|  1.91k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (206:36): [True: 1.15k, False: 759]
  ------------------
  207|  1.15k|      _JSAMPLE gray = (_JSAMPLE)read_pbm_integer(cinfo, infile, maxval);
  ------------------
  |  |  224|  1.15k|#define _JSAMPLE  JSAMPLE
  ------------------
  208|  1.15k|      rgb_to_cmyk(maxval, gray, gray, gray, ptr, ptr + 1, ptr + 2, ptr + 3);
  209|  1.15k|      ptr += 4;
  210|  1.15k|    }
  211|  1.28k|  } else {
  212|  3.90k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (212:36): [True: 2.62k, False: 1.28k]
  ------------------
  213|  2.62k|      _JSAMPLE gray = rescale[read_pbm_integer(cinfo, infile, maxval)];
  ------------------
  |  |  224|  2.62k|#define _JSAMPLE  JSAMPLE
  ------------------
  214|  2.62k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, gray, gray, gray, ptr,
  215|  2.62k|                  ptr + 1, ptr + 2, ptr + 3);
  216|  2.62k|      ptr += 4;
  217|  2.62k|    }
  218|  1.28k|  }
  219|  2.04k|  return 1;
  220|  2.04k|}
rdppm-8.c:get_text_rgb_row:
  236|  11.6k|{
  237|  11.6k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  238|  11.6k|  FILE *infile = source->pub.input_file;
  239|  11.6k|  register _JSAMPROW ptr;
  240|  11.6k|  register _JSAMPLE *rescale = source->rescale;
  241|  11.6k|  JDIMENSION col;
  242|  11.6k|  unsigned int maxval = source->maxval;
  243|  11.6k|  register int rindex = rgb_red[cinfo->in_color_space];
  244|  11.6k|  register int gindex = rgb_green[cinfo->in_color_space];
  245|  11.6k|  register int bindex = rgb_blue[cinfo->in_color_space];
  246|  11.6k|  register int aindex = alpha_index[cinfo->in_color_space];
  247|  11.6k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  248|       |
  249|  11.6k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  11.6k|#define _buffer  buffer
  ------------------
  250|  11.6k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (250:7): [True: 712, False: 10.9k]
  ------------------
  251|    712|    if (aindex >= 0)
  ------------------
  |  Branch (251:9): [True: 226, False: 486]
  ------------------
  252|    226|      RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval),
  ------------------
  |  |  223|    226|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|    646|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 420, False: 226]
  |  |  ------------------
  |  |  225|    420|    ptr[rindex] = read_op; \
  |  |  226|    420|    ptr[gindex] = read_op; \
  |  |  227|    420|    ptr[bindex] = read_op; \
  |  |  228|    420|    alpha_set_op \
  |  |  229|    420|    ptr += ps; \
  |  |  230|    420|  } \
  |  |  231|    226|}
  ------------------
  253|    712|                    ptr[aindex] = (_JSAMPLE)maxval;)
  254|    486|    else
  255|    486|      RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval), {})
  ------------------
  |  |  223|    486|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  1.42k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 937, False: 486]
  |  |  ------------------
  |  |  225|    937|    ptr[rindex] = read_op; \
  |  |  226|    937|    ptr[gindex] = read_op; \
  |  |  227|    937|    ptr[bindex] = read_op; \
  |  |  228|    937|    alpha_set_op \
  |  |  229|    937|    ptr += ps; \
  |  |  230|    937|  } \
  |  |  231|    486|}
  ------------------
  256|  10.9k|  } else {
  257|  10.9k|    if (aindex >= 0)
  ------------------
  |  Branch (257:9): [True: 2.10k, False: 8.85k]
  ------------------
  258|  2.10k|      RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)],
  ------------------
  |  |  223|  2.10k|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  6.12k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 4.02k, False: 2.10k]
  |  |  ------------------
  |  |  225|  4.02k|    ptr[rindex] = read_op; \
  |  |  226|  4.02k|    ptr[gindex] = read_op; \
  |  |  227|  4.02k|    ptr[bindex] = read_op; \
  |  |  228|  4.02k|    alpha_set_op \
  |  |  229|  4.02k|    ptr += ps; \
  |  |  230|  4.02k|  } \
  |  |  231|  2.10k|}
  ------------------
  259|  10.9k|                    ptr[aindex] = (1 << cinfo->data_precision) - 1;)
  260|  8.85k|    else
  261|  8.85k|      RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)], {})
  ------------------
  |  |  223|  8.85k|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  25.6k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 16.8k, False: 8.85k]
  |  |  ------------------
  |  |  225|  16.8k|    ptr[rindex] = read_op; \
  |  |  226|  16.8k|    ptr[gindex] = read_op; \
  |  |  227|  16.8k|    ptr[bindex] = read_op; \
  |  |  228|  16.8k|    alpha_set_op \
  |  |  229|  16.8k|    ptr += ps; \
  |  |  230|  16.8k|  } \
  |  |  231|  8.85k|}
  ------------------
  262|  10.9k|  }
  263|  11.6k|  return 1;
  264|  11.6k|}
rdppm-8.c:get_text_rgb_cmyk_row:
  271|  2.33k|{
  272|  2.33k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  273|  2.33k|  FILE *infile = source->pub.input_file;
  274|  2.33k|  register _JSAMPROW ptr;
  275|  2.33k|  register _JSAMPLE *rescale = source->rescale;
  276|  2.33k|  JDIMENSION col;
  277|  2.33k|  unsigned int maxval = source->maxval;
  278|       |
  279|  2.33k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  2.33k|#define _buffer  buffer
  ------------------
  280|  2.33k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (280:7): [True: 783, False: 1.55k]
  ------------------
  281|  2.10k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (281:36): [True: 1.32k, False: 783]
  ------------------
  282|  1.32k|      _JSAMPLE r = (_JSAMPLE)read_pbm_integer(cinfo, infile, maxval);
  ------------------
  |  |  224|  1.32k|#define _JSAMPLE  JSAMPLE
  ------------------
  283|  1.32k|      _JSAMPLE g = (_JSAMPLE)read_pbm_integer(cinfo, infile, maxval);
  ------------------
  |  |  224|  1.32k|#define _JSAMPLE  JSAMPLE
  ------------------
  284|  1.32k|      _JSAMPLE b = (_JSAMPLE)read_pbm_integer(cinfo, infile, maxval);
  ------------------
  |  |  224|  1.32k|#define _JSAMPLE  JSAMPLE
  ------------------
  285|  1.32k|      rgb_to_cmyk(maxval, r, g, b, ptr, ptr + 1, ptr + 2, ptr + 3);
  286|  1.32k|      ptr += 4;
  287|  1.32k|    }
  288|  1.55k|  } else {
  289|  4.66k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (289:36): [True: 3.11k, False: 1.55k]
  ------------------
  290|  3.11k|      _JSAMPLE r = rescale[read_pbm_integer(cinfo, infile, maxval)];
  ------------------
  |  |  224|  3.11k|#define _JSAMPLE  JSAMPLE
  ------------------
  291|  3.11k|      _JSAMPLE g = rescale[read_pbm_integer(cinfo, infile, maxval)];
  ------------------
  |  |  224|  3.11k|#define _JSAMPLE  JSAMPLE
  ------------------
  292|  3.11k|      _JSAMPLE b = rescale[read_pbm_integer(cinfo, infile, maxval)];
  ------------------
  |  |  224|  3.11k|#define _JSAMPLE  JSAMPLE
  ------------------
  293|  3.11k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, r, g, b, ptr, ptr + 1,
  294|  3.11k|                  ptr + 2, ptr + 3);
  295|  3.11k|      ptr += 4;
  296|  3.11k|    }
  297|  1.55k|  }
  298|  2.33k|  return 1;
  299|  2.33k|}
rdppm-8.c:get_word_gray_row:
  491|  3.41k|{
  492|  3.41k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  493|  3.41k|  register _JSAMPROW ptr;
  494|  3.41k|  register unsigned char *bufferptr;
  495|  3.41k|  register _JSAMPLE *rescale = source->rescale;
  496|  3.41k|  JDIMENSION col;
  497|  3.41k|  unsigned int maxval = source->maxval;
  498|       |
  499|  3.41k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  3.41k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (499:7): [True: 72, False: 3.34k]
  ------------------
  500|     72|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     72|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     72|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  501|  3.41k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  3.41k|#define _buffer  buffer
  ------------------
  502|  3.41k|  bufferptr = source->iobuffer;
  503|  7.87k|  for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (503:34): [True: 4.46k, False: 3.41k]
  ------------------
  504|  4.46k|    register unsigned int temp;
  505|  4.46k|    temp  = (*bufferptr++) << 8;
  506|  4.46k|    temp |= (*bufferptr++);
  507|  4.46k|    if (temp > maxval)
  ------------------
  |  Branch (507:9): [True: 45, False: 4.41k]
  ------------------
  508|     45|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     45|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     45|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  509|  4.46k|    *ptr++ = rescale[temp];
  510|  4.46k|  }
  511|  3.41k|  return 1;
  512|  3.41k|}
rdppm-8.c:get_word_gray_rgb_row:
  518|  17.0k|{
  519|  17.0k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  520|  17.0k|  register _JSAMPROW ptr;
  521|  17.0k|  register unsigned char *bufferptr;
  522|  17.0k|  register _JSAMPLE *rescale = source->rescale;
  523|  17.0k|  JDIMENSION col;
  524|  17.0k|  unsigned int maxval = source->maxval;
  525|  17.0k|  register int rindex = rgb_red[cinfo->in_color_space];
  526|  17.0k|  register int gindex = rgb_green[cinfo->in_color_space];
  527|  17.0k|  register int bindex = rgb_blue[cinfo->in_color_space];
  528|  17.0k|  register int aindex = alpha_index[cinfo->in_color_space];
  529|  17.0k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  530|       |
  531|  17.0k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  17.0k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (531:7): [True: 360, False: 16.7k]
  ------------------
  532|    360|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    360|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    360|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  533|  17.0k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  17.0k|#define _buffer  buffer
  ------------------
  534|  17.0k|  bufferptr = source->iobuffer;
  535|  39.3k|  for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (535:34): [True: 22.3k, False: 17.0k]
  ------------------
  536|  22.3k|    register unsigned int temp;
  537|  22.3k|    temp  = (*bufferptr++) << 8;
  538|  22.3k|    temp |= (*bufferptr++);
  539|  22.3k|    if (temp > maxval)
  ------------------
  |  Branch (539:9): [True: 225, False: 22.0k]
  ------------------
  540|    225|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|    225|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    225|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  541|  22.3k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = rescale[temp];
  542|  22.3k|    if (aindex >= 0)
  ------------------
  |  Branch (542:9): [True: 4.41k, False: 17.9k]
  ------------------
  543|  4.41k|      ptr[aindex] = (1 << cinfo->data_precision) - 1;
  544|  22.3k|    ptr += ps;
  545|  22.3k|  }
  546|  17.0k|  return 1;
  547|  17.0k|}
rdppm-8.c:get_word_gray_cmyk_row:
  553|  3.41k|{
  554|  3.41k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  555|  3.41k|  register _JSAMPROW ptr;
  556|  3.41k|  register unsigned char *bufferptr;
  557|  3.41k|  register _JSAMPLE *rescale = source->rescale;
  558|  3.41k|  JDIMENSION col;
  559|  3.41k|  unsigned int maxval = source->maxval;
  560|       |
  561|  3.41k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  3.41k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (561:7): [True: 72, False: 3.34k]
  ------------------
  562|     72|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     72|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     72|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  563|  3.41k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  3.41k|#define _buffer  buffer
  ------------------
  564|  3.41k|  bufferptr = source->iobuffer;
  565|  3.41k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (565:7): [True: 0, False: 3.41k]
  ------------------
  566|      0|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (566:36): [True: 0, False: 0]
  ------------------
  567|      0|      register unsigned int gray;
  568|      0|      gray  = (*bufferptr++) << 8;
  569|      0|      gray |= (*bufferptr++);
  570|      0|      if (gray > maxval)
  ------------------
  |  Branch (570:11): [True: 0, False: 0]
  ------------------
  571|      0|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  572|      0|      rgb_to_cmyk(maxval, (_JSAMPLE)gray, (_JSAMPLE)gray, (_JSAMPLE)gray, ptr,
  573|      0|                  ptr + 1, ptr + 2, ptr + 3);
  574|      0|      ptr += 4;
  575|      0|    }
  576|  3.41k|  } else {
  577|  7.87k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (577:36): [True: 4.46k, False: 3.41k]
  ------------------
  578|  4.46k|      register unsigned int temp;
  579|  4.46k|      _JSAMPLE gray;
  ------------------
  |  |  224|  4.46k|#define _JSAMPLE  JSAMPLE
  ------------------
  580|  4.46k|      temp  = (*bufferptr++) << 8;
  581|  4.46k|      temp |= (*bufferptr++);
  582|  4.46k|      if (temp > maxval)
  ------------------
  |  Branch (582:11): [True: 45, False: 4.41k]
  ------------------
  583|     45|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     45|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     45|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  584|  4.46k|      gray = rescale[temp];
  585|  4.46k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, gray, gray, gray, ptr,
  586|  4.46k|                  ptr + 1, ptr + 2, ptr + 3);
  587|  4.46k|      ptr += 4;
  588|  4.46k|    }
  589|  3.41k|  }
  590|  3.41k|  return 1;
  591|  3.41k|}
rdppm-8.c:get_raw_row:
  477|  7.00k|{
  478|  7.00k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  479|       |
  480|  7.00k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  7.00k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (480:7): [True: 37, False: 6.96k]
  ------------------
  481|     37|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     37|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     37|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  482|  7.00k|  return 1;
  483|  7.00k|}
rdppm-8.c:get_scaled_gray_row:
  305|  1.45M|{
  306|  1.45M|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  307|  1.45M|  register _JSAMPROW ptr;
  308|  1.45M|  register unsigned char *bufferptr;
  309|  1.45M|  register _JSAMPLE *rescale = source->rescale;
  310|  1.45M|  JDIMENSION col;
  311|       |
  312|  1.45M|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  1.45M|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (312:7): [True: 134, False: 1.45M]
  ------------------
  313|    134|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    134|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    134|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  314|  1.45M|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  1.45M|#define _buffer  buffer
  ------------------
  315|  1.45M|  bufferptr = source->iobuffer;
  316|  10.0M|  for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (316:34): [True: 8.56M, False: 1.45M]
  ------------------
  317|  8.56M|    *ptr++ = rescale[*bufferptr++];
  318|  8.56M|  }
  319|  1.45M|  return 1;
  320|  1.45M|}
rdppm-8.c:get_gray_rgb_row:
  327|  7.32M|{
  328|  7.32M|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  329|  7.32M|  register _JSAMPROW ptr;
  330|  7.32M|  register unsigned char *bufferptr;
  331|  7.32M|  register _JSAMPLE *rescale = source->rescale;
  332|  7.32M|  JDIMENSION col;
  333|  7.32M|  unsigned int maxval = source->maxval;
  334|  7.32M|  register int rindex = rgb_red[cinfo->in_color_space];
  335|  7.32M|  register int gindex = rgb_green[cinfo->in_color_space];
  336|  7.32M|  register int bindex = rgb_blue[cinfo->in_color_space];
  337|  7.32M|  register int aindex = alpha_index[cinfo->in_color_space];
  338|  7.32M|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  339|       |
  340|  7.32M|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  7.32M|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (340:7): [True: 835, False: 7.32M]
  ------------------
  341|    835|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    835|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    835|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  342|  7.32M|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  7.32M|#define _buffer  buffer
  ------------------
  343|  7.32M|  bufferptr = source->iobuffer;
  344|  7.32M|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (344:7): [True: 120k, False: 7.20M]
  ------------------
  345|   120k|    if (aindex >= 0)
  ------------------
  |  Branch (345:9): [True: 1.54k, False: 119k]
  ------------------
  346|  1.54k|      GRAY_RGB_READ_LOOP(*bufferptr++, ptr[aindex] = (_JSAMPLE)maxval;)
  ------------------
  |  |  149|  1.54k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|  3.57k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 2.02k, False: 1.54k]
  |  |  ------------------
  |  |  151|  2.02k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|  2.02k|    alpha_set_op \
  |  |  153|  2.02k|    ptr += ps; \
  |  |  154|  2.02k|  } \
  |  |  155|  1.54k|}
  ------------------
  347|   119k|    else
  348|   119k|      GRAY_RGB_READ_LOOP(*bufferptr++, {})
  ------------------
  |  |  149|   119k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|   480k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 361k, False: 119k]
  |  |  ------------------
  |  |  151|   361k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|   361k|    alpha_set_op \
  |  |  153|   361k|    ptr += ps; \
  |  |  154|   361k|  } \
  |  |  155|   119k|}
  ------------------
  349|  7.20M|  } else {
  350|  7.20M|    if (aindex >= 0)
  ------------------
  |  Branch (350:9): [True: 1.46M, False: 5.74M]
  ------------------
  351|  1.46M|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |  149|  1.46M|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|  10.1M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 8.69M, False: 1.46M]
  |  |  ------------------
  |  |  151|  8.69M|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|  8.69M|    alpha_set_op \
  |  |  153|  8.69M|    ptr += ps; \
  |  |  154|  8.69M|  } \
  |  |  155|  1.46M|}
  ------------------
  352|  7.20M|                         ptr[aindex] = (1 << cinfo->data_precision) - 1;)
  353|  5.74M|    else
  354|  5.74M|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++], {})
  ------------------
  |  |  149|  5.74M|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|  40.1M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 34.4M, False: 5.74M]
  |  |  ------------------
  |  |  151|  34.4M|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|  34.4M|    alpha_set_op \
  |  |  153|  34.4M|    ptr += ps; \
  |  |  154|  34.4M|  } \
  |  |  155|  5.74M|}
  ------------------
  355|  7.20M|  }
  356|  7.32M|  return 1;
  357|  7.32M|}
rdppm-8.c:get_gray_cmyk_row:
  364|  1.46M|{
  365|  1.46M|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  366|  1.46M|  register _JSAMPROW ptr;
  367|  1.46M|  register unsigned char *bufferptr;
  368|  1.46M|  register _JSAMPLE *rescale = source->rescale;
  369|  1.46M|  JDIMENSION col;
  370|  1.46M|  unsigned int maxval = source->maxval;
  371|       |
  372|  1.46M|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  1.46M|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (372:7): [True: 167, False: 1.46M]
  ------------------
  373|    167|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    167|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    167|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  374|  1.46M|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  1.46M|#define _buffer  buffer
  ------------------
  375|  1.46M|  bufferptr = source->iobuffer;
  376|  1.46M|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (376:7): [True: 62.9k, False: 1.40M]
  ------------------
  377|   641k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (377:36): [True: 578k, False: 62.9k]
  ------------------
  378|   578k|      _JSAMPLE gray = *bufferptr++;
  ------------------
  |  |  224|   578k|#define _JSAMPLE  JSAMPLE
  ------------------
  379|   578k|      rgb_to_cmyk(maxval, gray, gray, gray, ptr, ptr + 1, ptr + 2, ptr + 3);
  380|   578k|      ptr += 4;
  381|   578k|    }
  382|  1.40M|  } else {
  383|  9.51M|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (383:36): [True: 8.11M, False: 1.40M]
  ------------------
  384|  8.11M|      _JSAMPLE gray = rescale[*bufferptr++];
  ------------------
  |  |  224|  8.11M|#define _JSAMPLE  JSAMPLE
  ------------------
  385|  8.11M|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, gray, gray, gray, ptr,
  386|  8.11M|                  ptr + 1, ptr + 2, ptr + 3);
  387|  8.11M|      ptr += 4;
  388|  8.11M|    }
  389|  1.40M|  }
  390|  1.46M|  return 1;
  391|  1.46M|}
rdppm-8.c:get_word_rgb_row:
  597|  9.32k|{
  598|  9.32k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  599|  9.32k|  register _JSAMPROW ptr;
  600|  9.32k|  register unsigned char *bufferptr;
  601|  9.32k|  register _JSAMPLE *rescale = source->rescale;
  602|  9.32k|  JDIMENSION col;
  603|  9.32k|  unsigned int maxval = source->maxval;
  604|  9.32k|  register int rindex = rgb_red[cinfo->in_color_space];
  605|  9.32k|  register int gindex = rgb_green[cinfo->in_color_space];
  606|  9.32k|  register int bindex = rgb_blue[cinfo->in_color_space];
  607|  9.32k|  register int aindex = alpha_index[cinfo->in_color_space];
  608|  9.32k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  609|       |
  610|  9.32k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  9.32k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (610:7): [True: 380, False: 8.94k]
  ------------------
  611|    380|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    380|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    380|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  612|  9.32k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  9.32k|#define _buffer  buffer
  ------------------
  613|  9.32k|  bufferptr = source->iobuffer;
  614|  24.7k|  for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (614:34): [True: 15.4k, False: 9.32k]
  ------------------
  615|  15.4k|    register unsigned int temp;
  616|  15.4k|    temp  = (*bufferptr++) << 8;
  617|  15.4k|    temp |= (*bufferptr++);
  618|  15.4k|    if (temp > maxval)
  ------------------
  |  Branch (618:9): [True: 150, False: 15.2k]
  ------------------
  619|    150|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|    150|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    150|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  620|  15.4k|    ptr[rindex] = rescale[temp];
  621|  15.4k|    temp  = (*bufferptr++) << 8;
  622|  15.4k|    temp |= (*bufferptr++);
  623|  15.4k|    if (temp > maxval)
  ------------------
  |  Branch (623:9): [True: 140, False: 15.2k]
  ------------------
  624|    140|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|    140|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    140|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  625|  15.4k|    ptr[gindex] = rescale[temp];
  626|  15.4k|    temp  = (*bufferptr++) << 8;
  627|  15.4k|    temp |= (*bufferptr++);
  628|  15.4k|    if (temp > maxval)
  ------------------
  |  Branch (628:9): [True: 125, False: 15.2k]
  ------------------
  629|    125|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|    125|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    125|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  630|  15.4k|    ptr[bindex] = rescale[temp];
  631|  15.4k|    if (aindex >= 0)
  ------------------
  |  Branch (631:9): [True: 2.99k, False: 12.4k]
  ------------------
  632|  2.99k|      ptr[aindex] = (1 << cinfo->data_precision) - 1;
  633|  15.4k|    ptr += ps;
  634|  15.4k|  }
  635|  9.32k|  return 1;
  636|  9.32k|}
rdppm-8.c:get_word_rgb_cmyk_row:
  642|  1.86k|{
  643|  1.86k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  644|  1.86k|  register _JSAMPROW ptr;
  645|  1.86k|  register unsigned char *bufferptr;
  646|  1.86k|  register _JSAMPLE *rescale = source->rescale;
  647|  1.86k|  JDIMENSION col;
  648|  1.86k|  unsigned int maxval = source->maxval;
  649|       |
  650|  1.86k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  1.86k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (650:7): [True: 76, False: 1.78k]
  ------------------
  651|     76|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     76|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     76|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  652|  1.86k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  1.86k|#define _buffer  buffer
  ------------------
  653|  1.86k|  bufferptr = source->iobuffer;
  654|  1.86k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (654:7): [True: 0, False: 1.86k]
  ------------------
  655|      0|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (655:36): [True: 0, False: 0]
  ------------------
  656|      0|      register unsigned int r, g, b;
  657|      0|      r  = (*bufferptr++) << 8;
  658|      0|      r |= (*bufferptr++);
  659|      0|      if (r > maxval)
  ------------------
  |  Branch (659:11): [True: 0, False: 0]
  ------------------
  660|      0|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  661|      0|      g  = (*bufferptr++) << 8;
  662|      0|      g |= (*bufferptr++);
  663|      0|      if (g > maxval)
  ------------------
  |  Branch (663:11): [True: 0, False: 0]
  ------------------
  664|      0|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  665|      0|      b  = (*bufferptr++) << 8;
  666|      0|      b |= (*bufferptr++);
  667|      0|      if (b > maxval)
  ------------------
  |  Branch (667:11): [True: 0, False: 0]
  ------------------
  668|      0|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  669|      0|      rgb_to_cmyk(maxval, (_JSAMPLE)r, (_JSAMPLE)g, (_JSAMPLE)b, ptr, ptr + 1,
  670|      0|                  ptr + 2, ptr + 3);
  671|      0|      ptr += 4;
  672|      0|    }
  673|  1.86k|  } else {
  674|  4.94k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (674:36): [True: 3.08k, False: 1.86k]
  ------------------
  675|  3.08k|      register unsigned int r, g, b;
  676|  3.08k|      r  = (*bufferptr++) << 8;
  677|  3.08k|      r |= (*bufferptr++);
  678|  3.08k|      if (r > maxval)
  ------------------
  |  Branch (678:11): [True: 30, False: 3.05k]
  ------------------
  679|     30|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     30|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     30|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  680|  3.08k|      g  = (*bufferptr++) << 8;
  681|  3.08k|      g |= (*bufferptr++);
  682|  3.08k|      if (g > maxval)
  ------------------
  |  Branch (682:11): [True: 28, False: 3.05k]
  ------------------
  683|     28|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     28|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     28|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  684|  3.08k|      b  = (*bufferptr++) << 8;
  685|  3.08k|      b |= (*bufferptr++);
  686|  3.08k|      if (b > maxval)
  ------------------
  |  Branch (686:11): [True: 25, False: 3.05k]
  ------------------
  687|     25|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     25|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     25|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  688|  3.08k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, rescale[r], rescale[g],
  689|  3.08k|                  rescale[b], ptr, ptr + 1, ptr + 2, ptr + 3);
  690|  3.08k|      ptr += 4;
  691|  3.08k|    }
  692|  1.86k|  }
  693|  1.86k|  return 1;
  694|  1.86k|}
rdppm-8.c:get_rgb_row:
  397|   348k|{
  398|   348k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  399|   348k|  register _JSAMPROW ptr;
  400|   348k|  register unsigned char *bufferptr;
  401|   348k|  register _JSAMPLE *rescale = source->rescale;
  402|   348k|  JDIMENSION col;
  403|   348k|  unsigned int maxval = source->maxval;
  404|   348k|  register int rindex = rgb_red[cinfo->in_color_space];
  405|   348k|  register int gindex = rgb_green[cinfo->in_color_space];
  406|   348k|  register int bindex = rgb_blue[cinfo->in_color_space];
  407|   348k|  register int aindex = alpha_index[cinfo->in_color_space];
  408|   348k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  409|       |
  410|   348k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|   348k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (410:7): [True: 951, False: 347k]
  ------------------
  411|    951|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    951|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    951|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  412|   348k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|   348k|#define _buffer  buffer
  ------------------
  413|   348k|  bufferptr = source->iobuffer;
  414|   348k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (414:7): [True: 672, False: 348k]
  ------------------
  415|    672|    if (aindex >= 0)
  ------------------
  |  Branch (415:9): [True: 204, False: 468]
  ------------------
  416|    204|      RGB_READ_LOOP(*bufferptr++, ptr[aindex] = (_JSAMPLE)maxval;)
  ------------------
  |  |  223|    204|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  15.9k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 15.7k, False: 204]
  |  |  ------------------
  |  |  225|  15.7k|    ptr[rindex] = read_op; \
  |  |  226|  15.7k|    ptr[gindex] = read_op; \
  |  |  227|  15.7k|    ptr[bindex] = read_op; \
  |  |  228|  15.7k|    alpha_set_op \
  |  |  229|  15.7k|    ptr += ps; \
  |  |  230|  15.7k|  } \
  |  |  231|    204|}
  ------------------
  417|    468|    else
  418|    468|      RGB_READ_LOOP(*bufferptr++, {})
  ------------------
  |  |  223|    468|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  1.22k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 755, False: 468]
  |  |  ------------------
  |  |  225|    755|    ptr[rindex] = read_op; \
  |  |  226|    755|    ptr[gindex] = read_op; \
  |  |  227|    755|    ptr[bindex] = read_op; \
  |  |  228|    755|    alpha_set_op \
  |  |  229|    755|    ptr += ps; \
  |  |  230|    755|  } \
  |  |  231|    468|}
  ------------------
  419|   348k|  } else {
  420|   348k|    if (aindex >= 0)
  ------------------
  |  Branch (420:9): [True: 69.3k, False: 278k]
  ------------------
  421|  69.3k|      RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |  223|  69.3k|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|   282k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 213k, False: 69.3k]
  |  |  ------------------
  |  |  225|   213k|    ptr[rindex] = read_op; \
  |  |  226|   213k|    ptr[gindex] = read_op; \
  |  |  227|   213k|    ptr[bindex] = read_op; \
  |  |  228|   213k|    alpha_set_op \
  |  |  229|   213k|    ptr += ps; \
  |  |  230|   213k|  } \
  |  |  231|  69.3k|}
  ------------------
  422|   348k|                    ptr[aindex] = (1 << cinfo->data_precision) - 1;)
  423|   278k|    else
  424|   278k|      RGB_READ_LOOP(rescale[*bufferptr++], {})
  ------------------
  |  |  223|   278k|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  1.19M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 915k, False: 278k]
  |  |  ------------------
  |  |  225|   915k|    ptr[rindex] = read_op; \
  |  |  226|   915k|    ptr[gindex] = read_op; \
  |  |  227|   915k|    ptr[bindex] = read_op; \
  |  |  228|   915k|    alpha_set_op \
  |  |  229|   915k|    ptr += ps; \
  |  |  230|   915k|  } \
  |  |  231|   278k|}
  ------------------
  425|   348k|  }
  426|   348k|  return 1;
  427|   348k|}
rdppm-8.c:get_rgb_cmyk_row:
  434|  69.7k|{
  435|  69.7k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  436|  69.7k|  register _JSAMPROW ptr;
  437|  69.7k|  register unsigned char *bufferptr;
  438|  69.7k|  register _JSAMPLE *rescale = source->rescale;
  439|  69.7k|  JDIMENSION col;
  440|  69.7k|  unsigned int maxval = source->maxval;
  441|       |
  442|  69.7k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  69.7k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (442:7): [True: 191, False: 69.5k]
  ------------------
  443|    191|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    191|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    191|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  444|  69.7k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  326|  69.7k|#define _buffer  buffer
  ------------------
  445|  69.7k|  bufferptr = source->iobuffer;
  446|  69.7k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (446:7): [True: 2.01k, False: 67.7k]
  ------------------
  447|  19.9k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (447:36): [True: 17.9k, False: 2.01k]
  ------------------
  448|  17.9k|      _JSAMPLE r = *bufferptr++;
  ------------------
  |  |  224|  17.9k|#define _JSAMPLE  JSAMPLE
  ------------------
  449|  17.9k|      _JSAMPLE g = *bufferptr++;
  ------------------
  |  |  224|  17.9k|#define _JSAMPLE  JSAMPLE
  ------------------
  450|  17.9k|      _JSAMPLE b = *bufferptr++;
  ------------------
  |  |  224|  17.9k|#define _JSAMPLE  JSAMPLE
  ------------------
  451|  17.9k|      rgb_to_cmyk(maxval, r, g, b, ptr, ptr + 1, ptr + 2, ptr + 3);
  452|  17.9k|      ptr += 4;
  453|  17.9k|    }
  454|  67.7k|  } else {
  455|   278k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (455:36): [True: 211k, False: 67.7k]
  ------------------
  456|   211k|      _JSAMPLE r = rescale[*bufferptr++];
  ------------------
  |  |  224|   211k|#define _JSAMPLE  JSAMPLE
  ------------------
  457|   211k|      _JSAMPLE g = rescale[*bufferptr++];
  ------------------
  |  |  224|   211k|#define _JSAMPLE  JSAMPLE
  ------------------
  458|   211k|      _JSAMPLE b = rescale[*bufferptr++];
  ------------------
  |  |  224|   211k|#define _JSAMPLE  JSAMPLE
  ------------------
  459|   211k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, r, g, b, ptr, ptr + 1,
  460|   211k|                  ptr + 2, ptr + 3);
  461|   211k|      ptr += 4;
  462|   211k|    }
  463|  67.7k|  }
  464|  69.7k|  return 1;
  465|  69.7k|}
rdppm-8.c:finish_input_ppm:
  913|  13.4k|{
  914|       |  /* no work */
  915|  13.4k|}

spng_decode_scanline:
 3302|   153k|{
 3303|   153k|    if(ctx == NULL || out == NULL) return 1;
  ------------------
  |  Branch (3303:8): [True: 0, False: 153k]
  |  Branch (3303:23): [True: 0, False: 153k]
  ------------------
 3304|       |
 3305|   153k|    if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI;
  ------------------
  |  Branch (3305:8): [True: 0, False: 153k]
  ------------------
 3306|       |
 3307|   153k|    struct decode_flags f = ctx->decode_flags;
 3308|       |
 3309|   153k|    struct spng_row_info *ri = &ctx->row_info;
 3310|   153k|    const struct spng_subimage *sub = ctx->subimage;
 3311|       |
 3312|   153k|    const struct spng_ihdr *ihdr = &ctx->ihdr;
 3313|       |#if 0 /* libjpeg-turbo: Eliminate unused gamma correction code, which
 3314|       |         introduces an unwanted libm dependency */
 3315|       |    const uint16_t *gamma_lut = ctx->gamma_lut;
 3316|       |#endif
 3317|   153k|    unsigned char *trns_px = ctx->trns_px;
 3318|   153k|    const struct spng_sbit *sb = &ctx->decode_sb;
 3319|   153k|    const struct spng_plte_entry *plte = ctx->decode_plte.rgba;
 3320|   153k|    struct spng__iter iter = spng__iter_init(ihdr->bit_depth, ctx->scanline);
 3321|       |
 3322|   153k|    const unsigned char *scanline;
 3323|       |
 3324|   153k|    const int pass = ri->pass;
 3325|   153k|    const int fmt = ctx->fmt;
 3326|   153k|    const size_t scanline_width = sub[pass].scanline_width;
 3327|   153k|    const uint32_t width = sub[pass].width;
 3328|   153k|    uint32_t k;
 3329|   153k|    uint8_t r_8, g_8, b_8, a_8, gray_8;
 3330|   153k|    uint16_t r_16, g_16, b_16, a_16, gray_16;
 3331|   153k|    r_8=0; g_8=0; b_8=0; a_8=0; gray_8=0;
 3332|   153k|    r_16=0; g_16=0; b_16=0; a_16=0; gray_16=0;
 3333|   153k|    size_t pixel_size = 4; /* SPNG_FMT_RGBA8 */
 3334|   153k|    size_t pixel_offset = 0;
 3335|   153k|    unsigned char *pixel;
 3336|   153k|    unsigned processing_depth = ihdr->bit_depth;
 3337|       |
 3338|   153k|    if(f.indexed) processing_depth = 8;
  ------------------
  |  Branch (3338:8): [True: 792, False: 153k]
  ------------------
 3339|       |
 3340|   153k|    if(fmt == SPNG_FMT_RGBA16) pixel_size = 8;
  ------------------
  |  Branch (3340:8): [True: 0, False: 153k]
  ------------------
 3341|   153k|    else if(fmt == SPNG_FMT_RGB8) pixel_size = 3;
  ------------------
  |  Branch (3341:13): [True: 0, False: 153k]
  ------------------
 3342|       |
 3343|   153k|    if(len < sub[pass].out_width) return SPNG_EBUFSIZ;
  ------------------
  |  Branch (3343:8): [True: 0, False: 153k]
  ------------------
 3344|       |
 3345|   153k|    int ret = read_scanline(ctx);
 3346|       |
 3347|   153k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3347:8): [True: 3.61k, False: 150k]
  ------------------
 3348|       |
 3349|   150k|    scanline = ctx->scanline;
 3350|       |
 3351|   150k|    for(k=0; k < width; k++)
  ------------------
  |  Branch (3351:14): [True: 150k, False: 0]
  ------------------
 3352|   150k|    {
 3353|   150k|        pixel = (unsigned char*)out + pixel_offset;
 3354|   150k|        pixel_offset += pixel_size;
 3355|       |
 3356|   150k|        if(f.same_layout)
  ------------------
  |  Branch (3356:12): [True: 150k, False: 0]
  ------------------
 3357|   150k|        {
 3358|   150k|            if(f.zerocopy) break;
  ------------------
  |  Branch (3358:16): [True: 0, False: 150k]
  ------------------
 3359|       |
 3360|   150k|            memcpy(out, scanline, scanline_width - 1);
 3361|   150k|            break;
 3362|   150k|        }
 3363|       |
 3364|      0|        if(f.unpack)
  ------------------
  |  Branch (3364:12): [True: 0, False: 0]
  ------------------
 3365|      0|        {
 3366|      0|            unpack_scanline(out, scanline, width, ihdr->bit_depth, fmt);
 3367|      0|            break;
 3368|      0|        }
 3369|       |
 3370|      0|        if(ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR)
  ------------------
  |  Branch (3370:12): [True: 0, False: 0]
  ------------------
 3371|      0|        {
 3372|      0|            if(ihdr->bit_depth == 16)
  ------------------
  |  Branch (3372:16): [True: 0, False: 0]
  ------------------
 3373|      0|            {
 3374|      0|                memcpy(&r_16, scanline + (k * 6), 2);
 3375|      0|                memcpy(&g_16, scanline + (k * 6) + 2, 2);
 3376|      0|                memcpy(&b_16, scanline + (k * 6) + 4, 2);
 3377|       |
 3378|      0|                a_16 = 65535;
 3379|      0|            }
 3380|      0|            else /* == 8 */
 3381|      0|            {
 3382|      0|                if(fmt == SPNG_FMT_RGBA8)
  ------------------
  |  Branch (3382:20): [True: 0, False: 0]
  ------------------
 3383|      0|                {
 3384|      0|                    rgb8_row_to_rgba8(scanline, out, width);
 3385|      0|                    break;
 3386|      0|                }
 3387|       |
 3388|      0|                r_8 = scanline[k * 3];
 3389|      0|                g_8 = scanline[k * 3 + 1];
 3390|      0|                b_8 = scanline[k * 3 + 2];
 3391|       |
 3392|      0|                a_8 = 255;
 3393|      0|            }
 3394|      0|        }
 3395|      0|        else if(ihdr->color_type == SPNG_COLOR_TYPE_INDEXED)
  ------------------
  |  Branch (3395:17): [True: 0, False: 0]
  ------------------
 3396|      0|        {
 3397|      0|            uint8_t entry = 0;
 3398|       |
 3399|      0|            if(ihdr->bit_depth == 8)
  ------------------
  |  Branch (3399:16): [True: 0, False: 0]
  ------------------
 3400|      0|            {
 3401|      0|                if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGB8))
  ------------------
  |  Branch (3401:20): [True: 0, False: 0]
  ------------------
 3402|      0|                {
 3403|      0|                    expand_row(out, scanline, &ctx->decode_plte, width, fmt);
 3404|      0|                    break;
 3405|      0|                }
 3406|       |
 3407|      0|                entry = scanline[k];
 3408|      0|            }
 3409|      0|            else /* < 8 */
 3410|      0|            {
 3411|      0|                entry = get_sample(&iter);
 3412|      0|            }
 3413|       |
 3414|      0|            if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGB8))
  ------------------
  |  Branch (3414:16): [True: 0, False: 0]
  ------------------
 3415|      0|            {
 3416|      0|                pixel[0] = plte[entry].red;
 3417|      0|                pixel[1] = plte[entry].green;
 3418|      0|                pixel[2] = plte[entry].blue;
 3419|      0|                if(fmt == SPNG_FMT_RGBA8) pixel[3] = plte[entry].alpha;
  ------------------
  |  Branch (3419:20): [True: 0, False: 0]
  ------------------
 3420|       |
 3421|      0|                continue;
 3422|      0|            }
 3423|      0|            else /* RGBA16 */
 3424|      0|            {
 3425|      0|                r_16 = plte[entry].red;
 3426|      0|                g_16 = plte[entry].green;
 3427|      0|                b_16 = plte[entry].blue;
 3428|      0|                a_16 = plte[entry].alpha;
 3429|       |
 3430|      0|                r_16 = (r_16 << 8) | r_16;
 3431|      0|                g_16 = (g_16 << 8) | g_16;
 3432|      0|                b_16 = (b_16 << 8) | b_16;
 3433|      0|                a_16 = (a_16 << 8) | a_16;
 3434|       |
 3435|      0|                memcpy(pixel, &r_16, 2);
 3436|      0|                memcpy(pixel + 2, &g_16, 2);
 3437|      0|                memcpy(pixel + 4, &b_16, 2);
 3438|      0|                memcpy(pixel + 6, &a_16, 2);
 3439|       |
 3440|      0|                continue;
 3441|      0|            }
 3442|      0|        }
 3443|      0|        else if(ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA)
  ------------------
  |  Branch (3443:17): [True: 0, False: 0]
  ------------------
 3444|      0|        {
 3445|      0|            if(ihdr->bit_depth == 16)
  ------------------
  |  Branch (3445:16): [True: 0, False: 0]
  ------------------
 3446|      0|            {
 3447|      0|                memcpy(&r_16, scanline + (k * 8), 2);
 3448|      0|                memcpy(&g_16, scanline + (k * 8) + 2, 2);
 3449|      0|                memcpy(&b_16, scanline + (k * 8) + 4, 2);
 3450|      0|                memcpy(&a_16, scanline + (k * 8) + 6, 2);
 3451|      0|            }
 3452|      0|            else /* == 8 */
 3453|      0|            {
 3454|      0|                r_8 = scanline[k * 4];
 3455|      0|                g_8 = scanline[k * 4 + 1];
 3456|      0|                b_8 = scanline[k * 4 + 2];
 3457|      0|                a_8 = scanline[k * 4 + 3];
 3458|      0|            }
 3459|      0|        }
 3460|      0|        else if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE)
  ------------------
  |  Branch (3460:17): [True: 0, False: 0]
  ------------------
 3461|      0|        {
 3462|      0|            if(ihdr->bit_depth == 16)
  ------------------
  |  Branch (3462:16): [True: 0, False: 0]
  ------------------
 3463|      0|            {
 3464|      0|                memcpy(&gray_16, scanline + k * 2, 2);
 3465|       |
 3466|      0|                if(f.apply_trns && ctx->trns.gray == gray_16) a_16 = 0;
  ------------------
  |  Branch (3466:20): [True: 0, False: 0]
  |  Branch (3466:36): [True: 0, False: 0]
  ------------------
 3467|      0|                else a_16 = 65535;
 3468|       |
 3469|      0|                r_16 = gray_16;
 3470|      0|                g_16 = gray_16;
 3471|      0|                b_16 = gray_16;
 3472|      0|            }
 3473|      0|            else /* <= 8 */
 3474|      0|            {
 3475|      0|                gray_8 = get_sample(&iter);
 3476|       |
 3477|      0|                if(f.apply_trns && ctx->trns.gray == gray_8) a_8 = 0;
  ------------------
  |  Branch (3477:20): [True: 0, False: 0]
  |  Branch (3477:36): [True: 0, False: 0]
  ------------------
 3478|      0|                else a_8 = 255;
 3479|       |
 3480|      0|                r_8 = gray_8; g_8 = gray_8; b_8 = gray_8;
 3481|      0|            }
 3482|      0|        }
 3483|      0|        else if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA)
  ------------------
  |  Branch (3483:17): [True: 0, False: 0]
  ------------------
 3484|      0|        {
 3485|      0|            if(ihdr->bit_depth == 16)
  ------------------
  |  Branch (3485:16): [True: 0, False: 0]
  ------------------
 3486|      0|            {
 3487|      0|                memcpy(&gray_16, scanline + (k * 4), 2);
 3488|      0|                memcpy(&a_16, scanline + (k * 4) + 2, 2);
 3489|       |
 3490|      0|                r_16 = gray_16;
 3491|      0|                g_16 = gray_16;
 3492|      0|                b_16 = gray_16;
 3493|      0|            }
 3494|      0|            else /* == 8 */
 3495|      0|            {
 3496|      0|                gray_8 = scanline[k * 2];
 3497|      0|                a_8 = scanline[k * 2 + 1];
 3498|       |
 3499|      0|                r_8 = gray_8;
 3500|      0|                g_8 = gray_8;
 3501|      0|                b_8 = gray_8;
 3502|      0|            }
 3503|      0|        }
 3504|       |
 3505|       |
 3506|      0|        if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGB8))
  ------------------
  |  Branch (3506:12): [True: 0, False: 0]
  ------------------
 3507|      0|        {
 3508|      0|            if(ihdr->bit_depth == 16)
  ------------------
  |  Branch (3508:16): [True: 0, False: 0]
  ------------------
 3509|      0|            {
 3510|      0|                r_8 = r_16 >> 8;
 3511|      0|                g_8 = g_16 >> 8;
 3512|      0|                b_8 = b_16 >> 8;
 3513|      0|                a_8 = a_16 >> 8;
 3514|      0|            }
 3515|       |
 3516|      0|            pixel[0] = r_8;
 3517|      0|            pixel[1] = g_8;
 3518|      0|            pixel[2] = b_8;
 3519|       |
 3520|      0|            if(fmt == SPNG_FMT_RGBA8) pixel[3] = a_8;
  ------------------
  |  Branch (3520:16): [True: 0, False: 0]
  ------------------
 3521|      0|        }
 3522|      0|        else if(fmt == SPNG_FMT_RGBA16)
  ------------------
  |  Branch (3522:17): [True: 0, False: 0]
  ------------------
 3523|      0|        {
 3524|      0|            if(ihdr->bit_depth != 16)
  ------------------
  |  Branch (3524:16): [True: 0, False: 0]
  ------------------
 3525|      0|            {
 3526|      0|                r_16 = r_8;
 3527|      0|                g_16 = g_8;
 3528|      0|                b_16 = b_8;
 3529|      0|                a_16 = a_8;
 3530|      0|            }
 3531|       |
 3532|      0|            memcpy(pixel, &r_16, 2);
 3533|      0|            memcpy(pixel + 2, &g_16, 2);
 3534|      0|            memcpy(pixel + 4, &b_16, 2);
 3535|      0|            memcpy(pixel + 6, &a_16, 2);
 3536|      0|        }
 3537|      0|    }/* for(k=0; k < width; k++) */
 3538|       |
 3539|   150k|    if(f.apply_trns) trns_row(out, scanline, trns_px, ctx->bytes_per_pixel, &ctx->ihdr, width, fmt);
  ------------------
  |  Branch (3539:8): [True: 0, False: 150k]
  ------------------
 3540|       |
 3541|   150k|    if(f.do_scaling) scale_row(out, width, fmt, processing_depth, sb);
  ------------------
  |  Branch (3541:8): [True: 0, False: 150k]
  ------------------
 3542|       |
 3543|       |#if 0 /* libjpeg-turbo: Eliminate unused gamma correction code, which
 3544|       |         introduces an unwanted libm dependency */
 3545|       |    if(f.apply_gamma) gamma_correct_row(out, width, fmt, gamma_lut);
 3546|       |#endif
 3547|       |
 3548|       |    /* The previous scanline is always defiltered */
 3549|   150k|    void *t = ctx->prev_scanline;
 3550|   150k|    ctx->prev_scanline = ctx->scanline;
 3551|   150k|    ctx->scanline = t;
 3552|       |
 3553|   150k|    ret = update_row_info(ctx);
 3554|       |
 3555|   150k|    if(ret == SPNG_EOI)
  ------------------
  |  Branch (3555:8): [True: 1.71k, False: 148k]
  ------------------
 3556|  1.71k|    {
 3557|  1.71k|        if(ctx->cur_chunk_bytes_left) /* zlib stream ended before an IDAT chunk boundary */
  ------------------
  |  Branch (3557:12): [True: 76, False: 1.63k]
  ------------------
 3558|     76|        {/* Discard the rest of the chunk */
 3559|     76|            int error = discard_chunk_bytes(ctx, ctx->cur_chunk_bytes_left);
 3560|     76|            if(error) return decode_err(ctx, error);
  ------------------
  |  Branch (3560:16): [True: 69, False: 7]
  ------------------
 3561|     76|        }
 3562|       |
 3563|  1.64k|        ctx->last_idat = ctx->current_chunk;
 3564|  1.64k|    }
 3565|       |
 3566|   150k|    return ret;
 3567|   150k|}
spng_decode_row:
 3570|   153k|{
 3571|   153k|    if(ctx == NULL || out == NULL) return 1;
  ------------------
  |  Branch (3571:8): [True: 0, False: 153k]
  |  Branch (3571:23): [True: 0, False: 153k]
  ------------------
 3572|   153k|    if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI;
  ------------------
  |  Branch (3572:8): [True: 0, False: 153k]
  ------------------
 3573|   153k|    if(len < ctx->image_width) return SPNG_EBUFSIZ;
  ------------------
  |  Branch (3573:8): [True: 0, False: 153k]
  ------------------
 3574|       |
 3575|   153k|    const struct spng_ihdr *ihdr = &ctx->ihdr;
 3576|   153k|    int ret, pass = ctx->row_info.pass;
 3577|   153k|    unsigned char *outptr = out;
 3578|       |
 3579|   153k|    if(!ihdr->interlace_method || pass == 6) return spng_decode_scanline(ctx, out, len);
  ------------------
  |  Branch (3579:8): [True: 59.2k, False: 94.6k]
  |  Branch (3579:35): [True: 0, False: 94.6k]
  ------------------
 3580|       |
 3581|  94.6k|    ret = spng_decode_scanline(ctx, ctx->row, ctx->image_width);
 3582|  94.6k|    if(ret && ret != SPNG_EOI) return ret;
  ------------------
  |  Branch (3582:8): [True: 1.15k, False: 93.5k]
  |  Branch (3582:15): [True: 1.15k, False: 0]
  ------------------
 3583|       |
 3584|  93.5k|    uint32_t k;
 3585|  93.5k|    unsigned pixel_size = 4; /* RGBA8 */
 3586|  93.5k|    if(ctx->fmt == SPNG_FMT_RGBA16) pixel_size = 8;
  ------------------
  |  Branch (3586:8): [True: 0, False: 93.5k]
  ------------------
 3587|  93.5k|    else if(ctx->fmt == SPNG_FMT_RGB8) pixel_size = 3;
  ------------------
  |  Branch (3587:13): [True: 0, False: 93.5k]
  ------------------
 3588|  93.5k|    else if(ctx->fmt == SPNG_FMT_G8) pixel_size = 1;
  ------------------
  |  Branch (3588:13): [True: 0, False: 93.5k]
  ------------------
 3589|  93.5k|    else if(ctx->fmt == SPNG_FMT_GA8) pixel_size = 2;
  ------------------
  |  Branch (3589:13): [True: 0, False: 93.5k]
  ------------------
 3590|  93.5k|    else if(ctx->fmt & (SPNG_FMT_PNG | SPNG_FMT_RAW))
  ------------------
  |  Branch (3590:13): [True: 93.5k, False: 0]
  ------------------
 3591|  93.5k|    {
 3592|  93.5k|        if(ihdr->bit_depth < 8)
  ------------------
  |  Branch (3592:12): [True: 0, False: 93.5k]
  ------------------
 3593|      0|        {
 3594|      0|            struct spng__iter iter = spng__iter_init(ihdr->bit_depth, ctx->row);
 3595|      0|            const uint8_t samples_per_byte = 8 / ihdr->bit_depth;
 3596|      0|            uint8_t sample;
 3597|       |
 3598|      0|            for(k=0; k < ctx->subimage[pass].width; k++)
  ------------------
  |  Branch (3598:22): [True: 0, False: 0]
  ------------------
 3599|      0|            {
 3600|      0|                sample = get_sample(&iter);
 3601|       |
 3602|      0|                size_t ioffset = adam7_x_start[pass] + k * adam7_x_delta[pass];
 3603|       |
 3604|      0|                sample = sample << (iter.initial_shift - ioffset * ihdr->bit_depth % 8);
 3605|       |
 3606|      0|                ioffset /= samples_per_byte;
 3607|       |
 3608|      0|                outptr[ioffset] |= sample;
 3609|      0|            }
 3610|       |
 3611|      0|            return 0;
 3612|      0|        }
 3613|  93.5k|        else pixel_size = ctx->bytes_per_pixel;
 3614|  93.5k|    }
 3615|       |
 3616|  17.2M|    for(k=0; k < ctx->subimage[pass].width; k++)
  ------------------
  |  Branch (3616:14): [True: 17.1M, False: 93.5k]
  ------------------
 3617|  17.1M|    {
 3618|  17.1M|        size_t ioffset = (adam7_x_start[pass] + (size_t) k * adam7_x_delta[pass]) * pixel_size;
 3619|       |
 3620|  17.1M|        memcpy(outptr + ioffset, ctx->row + k * pixel_size, pixel_size);
 3621|  17.1M|    }
 3622|       |
 3623|  93.5k|    return 0;
 3624|  93.5k|}
spng_decode_chunks:
 3627|  30.7k|{
 3628|  30.7k|    if(ctx == NULL) return 1;
  ------------------
  |  Branch (3628:8): [True: 0, False: 30.7k]
  ------------------
 3629|  30.7k|    if(ctx->encode_only) return SPNG_ECTXTYPE;
  ------------------
  |  Branch (3629:8): [True: 0, False: 30.7k]
  ------------------
 3630|  30.7k|    if(ctx->state < SPNG_STATE_INPUT) return SPNG_ENOSRC;
  ------------------
  |  Branch (3630:8): [True: 12.0k, False: 18.6k]
  ------------------
 3631|  18.6k|    if(ctx->state == SPNG_STATE_IEND) return 0;
  ------------------
  |  Branch (3631:8): [True: 0, False: 18.6k]
  ------------------
 3632|       |
 3633|  18.6k|    return read_chunks(ctx, 0);
 3634|  18.6k|}
spng_decode_image:
 3637|  11.4k|{
 3638|  11.4k|    if(ctx == NULL) return 1;
  ------------------
  |  Branch (3638:8): [True: 0, False: 11.4k]
  ------------------
 3639|  11.4k|    if(ctx->encode_only) return SPNG_ECTXTYPE;
  ------------------
  |  Branch (3639:8): [True: 0, False: 11.4k]
  ------------------
 3640|  11.4k|    if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI;
  ------------------
  |  Branch (3640:8): [True: 0, False: 11.4k]
  ------------------
 3641|       |
 3642|  11.4k|    const struct spng_ihdr *ihdr = &ctx->ihdr;
 3643|       |
 3644|  11.4k|    int ret = read_chunks(ctx, 0);
 3645|  11.4k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3645:8): [True: 4.23k, False: 7.17k]
  ------------------
 3646|       |
 3647|  7.17k|    ret = check_decode_fmt(ihdr, fmt);
 3648|  7.17k|    if(ret) return ret;
  ------------------
  |  Branch (3648:8): [True: 0, False: 7.17k]
  ------------------
 3649|       |
 3650|  7.17k|    ret = calculate_image_width(ihdr, fmt, &ctx->image_width);
 3651|  7.17k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3651:8): [True: 0, False: 7.17k]
  ------------------
 3652|       |
 3653|  7.17k|    if(ctx->image_width > SIZE_MAX / ihdr->height) ctx->image_size = 0; /* overflow */
  ------------------
  |  Branch (3653:8): [True: 0, False: 7.17k]
  ------------------
 3654|  7.17k|    else ctx->image_size = ctx->image_width * ihdr->height;
 3655|       |
 3656|  7.17k|    if( !(flags & SPNG_DECODE_PROGRESSIVE) )
  ------------------
  |  Branch (3656:9): [True: 0, False: 7.17k]
  ------------------
 3657|      0|    {
 3658|      0|        if(out == NULL) return 1;
  ------------------
  |  Branch (3658:12): [True: 0, False: 0]
  ------------------
 3659|      0|        if(!ctx->image_size) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (3659:12): [True: 0, False: 0]
  ------------------
 3660|      0|        if(len < ctx->image_size) return SPNG_EBUFSIZ;
  ------------------
  |  Branch (3660:12): [True: 0, False: 0]
  ------------------
 3661|      0|    }
 3662|       |
 3663|  7.17k|    uint32_t bytes_read = 0;
 3664|       |
 3665|  7.17k|    ret = read_idat_bytes(ctx, &bytes_read);
 3666|  7.17k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3666:8): [True: 275, False: 6.89k]
  ------------------
 3667|       |
 3668|  6.89k|    if(bytes_read > 1)
  ------------------
  |  Branch (3668:8): [True: 6.86k, False: 33]
  ------------------
 3669|  6.86k|    {
 3670|  6.86k|        int valid = read_u16(ctx->data) % 31 ? 0 : 1;
  ------------------
  |  Branch (3670:21): [True: 61, False: 6.80k]
  ------------------
 3671|       |
 3672|  6.86k|        unsigned flg = ctx->data[1];
 3673|  6.86k|        unsigned flevel = flg >> 6;
 3674|  6.86k|        int compression_level = Z_DEFAULT_COMPRESSION;
  ------------------
  |  |  197|  6.86k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
 3675|       |
 3676|  6.86k|        if(flevel == 0) compression_level = 0; /* fastest */
  ------------------
  |  Branch (3676:12): [True: 48, False: 6.81k]
  ------------------
 3677|  6.81k|        else if(flevel == 1) compression_level = 1; /* fast */
  ------------------
  |  Branch (3677:17): [True: 46, False: 6.77k]
  ------------------
 3678|  6.77k|        else if(flevel == 2) compression_level = 6; /* default */
  ------------------
  |  Branch (3678:17): [True: 21, False: 6.75k]
  ------------------
 3679|  6.75k|        else if(flevel == 3) compression_level = 9; /* slowest, max compression */
  ------------------
  |  Branch (3679:17): [True: 6.75k, False: 0]
  ------------------
 3680|       |
 3681|  6.86k|        if(valid) ctx->image_options.compression_level = compression_level;
  ------------------
  |  Branch (3681:12): [True: 6.80k, False: 61]
  ------------------
 3682|  6.86k|    }
 3683|       |
 3684|  6.89k|    ret = spng__inflate_init(ctx, ctx->image_options.window_bits);
 3685|  6.89k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3685:8): [True: 0, False: 6.89k]
  ------------------
 3686|       |
 3687|  6.89k|    ctx->zstream.avail_in = bytes_read;
 3688|  6.89k|    ctx->zstream.next_in = ctx->data;
 3689|       |
 3690|  6.89k|    size_t scanline_buf_size = ctx->subimage[ctx->widest_pass].scanline_width;
 3691|       |
 3692|  6.89k|    scanline_buf_size += 32;
 3693|       |
 3694|  6.89k|    if(scanline_buf_size < 32) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (3694:8): [True: 0, False: 6.89k]
  ------------------
 3695|       |
 3696|  6.89k|    ctx->scanline_buf = spng__malloc(ctx, scanline_buf_size);
 3697|  6.89k|    ctx->prev_scanline_buf = spng__malloc(ctx, scanline_buf_size);
 3698|       |
 3699|  6.89k|    ctx->scanline = ctx->scanline_buf;
 3700|  6.89k|    ctx->prev_scanline = ctx->prev_scanline_buf;
 3701|       |
 3702|  6.89k|    struct decode_flags f = {0};
 3703|       |
 3704|  6.89k|    ctx->fmt = fmt;
 3705|       |
 3706|  6.89k|    if(ihdr->color_type == SPNG_COLOR_TYPE_INDEXED) f.indexed = 1;
  ------------------
  |  Branch (3706:8): [True: 238, False: 6.66k]
  ------------------
 3707|       |
 3708|  6.89k|    unsigned processing_depth = ihdr->bit_depth;
 3709|       |
 3710|  6.89k|    if(f.indexed) processing_depth = 8;
  ------------------
  |  Branch (3710:8): [True: 238, False: 6.66k]
  ------------------
 3711|       |
 3712|  6.89k|    if(ihdr->interlace_method)
  ------------------
  |  Branch (3712:8): [True: 1.26k, False: 5.63k]
  ------------------
 3713|  1.26k|    {
 3714|  1.26k|        f.interlaced = 1;
 3715|  1.26k|        ctx->row_buf = spng__malloc(ctx, ctx->image_width);
 3716|  1.26k|        ctx->row = ctx->row_buf;
 3717|       |
 3718|  1.26k|        if(ctx->row == NULL) return decode_err(ctx, SPNG_EMEM);
  ------------------
  |  Branch (3718:12): [True: 0, False: 1.26k]
  ------------------
 3719|  1.26k|    }
 3720|       |
 3721|  6.89k|    if(ctx->scanline == NULL || ctx->prev_scanline == NULL)
  ------------------
  |  Branch (3721:8): [True: 0, False: 6.89k]
  |  Branch (3721:33): [True: 0, False: 6.89k]
  ------------------
 3722|      0|    {
 3723|      0|        return decode_err(ctx, SPNG_EMEM);
 3724|      0|    }
 3725|       |
 3726|  6.89k|    f.do_scaling = 1;
 3727|  6.89k|    if(f.indexed) f.do_scaling = 0;
  ------------------
  |  Branch (3727:8): [True: 238, False: 6.66k]
  ------------------
 3728|       |
 3729|  6.89k|    unsigned depth_target = 8; /* FMT_RGBA8, G8 */
 3730|  6.89k|    if(fmt == SPNG_FMT_RGBA16) depth_target = 16;
  ------------------
  |  Branch (3730:8): [True: 0, False: 6.89k]
  ------------------
 3731|       |
 3732|  6.89k|    if(flags & SPNG_DECODE_TRNS && ctx->stored.trns) f.apply_trns = 1;
  ------------------
  |  Branch (3732:8): [True: 0, False: 6.89k]
  |  Branch (3732:36): [True: 0, False: 0]
  ------------------
 3733|  6.89k|    else flags &= ~SPNG_DECODE_TRNS;
 3734|       |
 3735|  6.89k|    if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA ||
  ------------------
  |  Branch (3735:8): [True: 0, False: 6.89k]
  ------------------
 3736|  6.89k|       ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA) flags &= ~SPNG_DECODE_TRNS;
  ------------------
  |  Branch (3736:8): [True: 0, False: 6.89k]
  ------------------
 3737|       |
 3738|  6.89k|    if(flags & SPNG_DECODE_GAMMA && ctx->stored.gama) f.apply_gamma = 1;
  ------------------
  |  Branch (3738:8): [True: 0, False: 6.89k]
  |  Branch (3738:37): [True: 0, False: 0]
  ------------------
 3739|  6.89k|    else flags &= ~SPNG_DECODE_GAMMA;
 3740|       |
 3741|  6.89k|    if(flags & SPNG_DECODE_USE_SBIT && ctx->stored.sbit) f.use_sbit = 1;
  ------------------
  |  Branch (3741:8): [True: 0, False: 6.89k]
  |  Branch (3741:40): [True: 0, False: 0]
  ------------------
 3742|  6.89k|    else flags &= ~SPNG_DECODE_USE_SBIT;
 3743|       |
 3744|  6.89k|    if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGBA16))
  ------------------
  |  Branch (3744:8): [True: 0, False: 6.89k]
  ------------------
 3745|      0|    {
 3746|      0|        if(ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA &&
  ------------------
  |  Branch (3746:12): [True: 0, False: 0]
  ------------------
 3747|      0|           ihdr->bit_depth == depth_target) f.same_layout = 1;
  ------------------
  |  Branch (3747:12): [True: 0, False: 0]
  ------------------
 3748|      0|    }
 3749|  6.89k|    else if(fmt == SPNG_FMT_RGB8)
  ------------------
  |  Branch (3749:13): [True: 0, False: 6.89k]
  ------------------
 3750|      0|    {
 3751|      0|        if(ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR &&
  ------------------
  |  Branch (3751:12): [True: 0, False: 0]
  ------------------
 3752|      0|           ihdr->bit_depth == depth_target) f.same_layout = 1;
  ------------------
  |  Branch (3752:12): [True: 0, False: 0]
  ------------------
 3753|       |
 3754|      0|        f.apply_trns = 0; /* not applicable */
 3755|      0|    }
 3756|  6.89k|    else if(fmt & (SPNG_FMT_PNG | SPNG_FMT_RAW))
  ------------------
  |  Branch (3756:13): [True: 6.89k, False: 0]
  ------------------
 3757|  6.89k|    {
 3758|  6.89k|        f.same_layout = 1;
 3759|  6.89k|        f.do_scaling = 0;
 3760|  6.89k|        f.apply_gamma = 0; /* for now */
 3761|  6.89k|        f.apply_trns = 0;
 3762|  6.89k|    }
 3763|      0|    else if(fmt == SPNG_FMT_G8 && ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth <= 8)
  ------------------
  |  Branch (3763:13): [True: 0, False: 0]
  |  Branch (3763:35): [True: 0, False: 0]
  |  Branch (3763:84): [True: 0, False: 0]
  ------------------
 3764|      0|    {
 3765|      0|        if(ihdr->bit_depth == depth_target) f.same_layout = 1;
  ------------------
  |  Branch (3765:12): [True: 0, False: 0]
  ------------------
 3766|      0|        else if(ihdr->bit_depth < 8) f.unpack = 1;
  ------------------
  |  Branch (3766:17): [True: 0, False: 0]
  ------------------
 3767|       |
 3768|      0|        f.apply_trns = 0;
 3769|      0|    }
 3770|      0|    else if(fmt == SPNG_FMT_GA8 && ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth <= 8)
  ------------------
  |  Branch (3770:13): [True: 0, False: 0]
  |  Branch (3770:36): [True: 0, False: 0]
  |  Branch (3770:85): [True: 0, False: 0]
  ------------------
 3771|      0|    {
 3772|      0|        if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA &&
  ------------------
  |  Branch (3772:12): [True: 0, False: 0]
  ------------------
 3773|      0|           ihdr->bit_depth == depth_target) f.same_layout = 1;
  ------------------
  |  Branch (3773:12): [True: 0, False: 0]
  ------------------
 3774|      0|        else if(ihdr->bit_depth <= 8) f.unpack = 1;
  ------------------
  |  Branch (3774:17): [True: 0, False: 0]
  ------------------
 3775|      0|    }
 3776|      0|    else if(fmt == SPNG_FMT_GA16 && ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth == 16)
  ------------------
  |  Branch (3776:13): [True: 0, False: 0]
  |  Branch (3776:37): [True: 0, False: 0]
  |  Branch (3776:86): [True: 0, False: 0]
  ------------------
 3777|      0|    {
 3778|      0|        if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA &&
  ------------------
  |  Branch (3778:12): [True: 0, False: 0]
  ------------------
 3779|      0|           ihdr->bit_depth == depth_target) f.same_layout = 1;
  ------------------
  |  Branch (3779:12): [True: 0, False: 0]
  ------------------
 3780|      0|        else if(ihdr->bit_depth == 16) f.unpack = 1;
  ------------------
  |  Branch (3780:17): [True: 0, False: 0]
  ------------------
 3781|      0|    }
 3782|       |
 3783|       |    /*if(f.same_layout && !flags && !f.interlaced) f.zerocopy = 1;*/
 3784|       |
 3785|       |#if 0 /* libjpeg-turbo: Eliminate unused gamma correction code, which
 3786|       |         introduces an unwanted libm dependency */
 3787|       |    uint16_t *gamma_lut = NULL;
 3788|       |
 3789|       |    if(f.apply_gamma)
 3790|       |    {
 3791|       |        float file_gamma = (float)ctx->gama / 100000.0f;
 3792|       |        float max;
 3793|       |
 3794|       |        unsigned lut_entries;
 3795|       |
 3796|       |        if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGB8))
 3797|       |        {
 3798|       |            lut_entries = 256;
 3799|       |            max = 255.0f;
 3800|       |
 3801|       |            gamma_lut = ctx->gamma_lut8;
 3802|       |            ctx->gamma_lut = ctx->gamma_lut8;
 3803|       |        }
 3804|       |        else /* SPNG_FMT_RGBA16 */
 3805|       |        {
 3806|       |            lut_entries = 65536;
 3807|       |            max = 65535.0f;
 3808|       |
 3809|       |            ctx->gamma_lut16 = spng__malloc(ctx, lut_entries * sizeof(uint16_t));
 3810|       |            if(ctx->gamma_lut16 == NULL) return decode_err(ctx, SPNG_EMEM);
 3811|       |
 3812|       |            gamma_lut = ctx->gamma_lut16;
 3813|       |            ctx->gamma_lut = ctx->gamma_lut16;
 3814|       |        }
 3815|       |
 3816|       |        float screen_gamma = 2.2f;
 3817|       |        float exponent = file_gamma * screen_gamma;
 3818|       |
 3819|       |        if(FP_ZERO == fpclassify(exponent)) return decode_err(ctx, SPNG_EGAMA);
 3820|       |
 3821|       |        exponent = 1.0f / exponent;
 3822|       |
 3823|       |        unsigned i;
 3824|       |        for(i=0; i < lut_entries; i++)
 3825|       |        {
 3826|       |            float c = pow((float)i / max, exponent) * max;
 3827|       |            float c = 0.0f;
 3828|       |            if(c > max) c = max;
 3829|       |
 3830|       |            gamma_lut[i] = (uint16_t)c;
 3831|       |        }
 3832|       |    }
 3833|       |#endif
 3834|       |
 3835|  6.89k|    struct spng_sbit *sb = &ctx->decode_sb;
 3836|       |
 3837|  6.89k|    sb->red_bits = processing_depth;
 3838|  6.89k|    sb->green_bits = processing_depth;
 3839|  6.89k|    sb->blue_bits = processing_depth;
 3840|  6.89k|    sb->alpha_bits = processing_depth;
 3841|  6.89k|    sb->grayscale_bits = processing_depth;
 3842|       |
 3843|  6.89k|    if(f.use_sbit)
  ------------------
  |  Branch (3843:8): [True: 0, False: 6.89k]
  ------------------
 3844|      0|    {
 3845|      0|        if(ihdr->color_type == 0)
  ------------------
  |  Branch (3845:12): [True: 0, False: 0]
  ------------------
 3846|      0|        {
 3847|      0|            sb->grayscale_bits = ctx->sbit.grayscale_bits;
 3848|      0|            sb->alpha_bits = ihdr->bit_depth;
 3849|      0|        }
 3850|      0|        else if(ihdr->color_type == 2 || ihdr->color_type == 3)
  ------------------
  |  Branch (3850:17): [True: 0, False: 0]
  |  Branch (3850:42): [True: 0, False: 0]
  ------------------
 3851|      0|        {
 3852|      0|            sb->red_bits = ctx->sbit.red_bits;
 3853|      0|            sb->green_bits = ctx->sbit.green_bits;
 3854|      0|            sb->blue_bits = ctx->sbit.blue_bits;
 3855|      0|            sb->alpha_bits = ihdr->bit_depth;
 3856|      0|        }
 3857|      0|        else if(ihdr->color_type == 4)
  ------------------
  |  Branch (3857:17): [True: 0, False: 0]
  ------------------
 3858|      0|        {
 3859|      0|            sb->grayscale_bits = ctx->sbit.grayscale_bits;
 3860|      0|            sb->alpha_bits = ctx->sbit.alpha_bits;
 3861|      0|        }
 3862|      0|        else /* == 6 */
 3863|      0|        {
 3864|      0|            sb->red_bits = ctx->sbit.red_bits;
 3865|      0|            sb->green_bits = ctx->sbit.green_bits;
 3866|      0|            sb->blue_bits = ctx->sbit.blue_bits;
 3867|      0|            sb->alpha_bits = ctx->sbit.alpha_bits;
 3868|      0|        }
 3869|      0|    }
 3870|       |
 3871|  6.89k|    if(ihdr->bit_depth == 16 && fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGB8))
  ------------------
  |  Branch (3871:8): [True: 1.15k, False: 5.74k]
  |  Branch (3871:33): [True: 0, False: 1.15k]
  ------------------
 3872|      0|    {/* samples are scaled down by 8 bits in the decode loop */
 3873|      0|        sb->red_bits -= 8;
 3874|      0|        sb->green_bits -= 8;
 3875|      0|        sb->blue_bits -= 8;
 3876|      0|        sb->alpha_bits -= 8;
 3877|      0|        sb->grayscale_bits -= 8;
 3878|       |
 3879|      0|        processing_depth = 8;
 3880|      0|    }
 3881|       |
 3882|       |    /* Prevent infinite loops in sample_to_target() */
 3883|  6.89k|    if(!depth_target || depth_target > 16 ||
  ------------------
  |  Branch (3883:8): [True: 0, False: 6.89k]
  |  Branch (3883:25): [True: 0, False: 6.89k]
  ------------------
 3884|  6.89k|       !processing_depth || processing_depth > 16 ||
  ------------------
  |  Branch (3884:8): [True: 0, False: 6.89k]
  |  Branch (3884:29): [True: 0, False: 6.89k]
  ------------------
 3885|  6.89k|       !sb->grayscale_bits || sb->grayscale_bits > processing_depth ||
  ------------------
  |  Branch (3885:8): [True: 0, False: 6.89k]
  |  Branch (3885:31): [True: 0, False: 6.89k]
  ------------------
 3886|  6.89k|       !sb->alpha_bits || sb->alpha_bits > processing_depth ||
  ------------------
  |  Branch (3886:8): [True: 0, False: 6.89k]
  |  Branch (3886:27): [True: 0, False: 6.89k]
  ------------------
 3887|  6.89k|       !sb->red_bits || sb->red_bits > processing_depth ||
  ------------------
  |  Branch (3887:8): [True: 0, False: 6.89k]
  |  Branch (3887:25): [True: 0, False: 6.89k]
  ------------------
 3888|  6.89k|       !sb->green_bits || sb->green_bits > processing_depth ||
  ------------------
  |  Branch (3888:8): [True: 0, False: 6.89k]
  |  Branch (3888:27): [True: 0, False: 6.89k]
  ------------------
 3889|  6.89k|       !sb->blue_bits || sb->blue_bits > processing_depth)
  ------------------
  |  Branch (3889:8): [True: 0, False: 6.89k]
  |  Branch (3889:26): [True: 0, False: 6.89k]
  ------------------
 3890|      0|    {
 3891|      0|        return decode_err(ctx, SPNG_ESBIT);
 3892|      0|    }
 3893|       |
 3894|  6.89k|    if(sb->red_bits == sb->green_bits &&
  ------------------
  |  Branch (3894:8): [True: 6.89k, False: 0]
  ------------------
 3895|  6.89k|       sb->green_bits == sb->blue_bits &&
  ------------------
  |  Branch (3895:8): [True: 6.89k, False: 0]
  ------------------
 3896|  6.89k|       sb->blue_bits == sb->alpha_bits &&
  ------------------
  |  Branch (3896:8): [True: 6.89k, False: 0]
  ------------------
 3897|  6.89k|       sb->alpha_bits == processing_depth &&
  ------------------
  |  Branch (3897:8): [True: 6.89k, False: 0]
  ------------------
 3898|  6.89k|       processing_depth == depth_target) f.do_scaling = 0;
  ------------------
  |  Branch (3898:8): [True: 5.74k, False: 1.15k]
  ------------------
 3899|       |
 3900|  6.89k|    struct spng_plte_entry *plte = ctx->decode_plte.rgba;
 3901|       |
 3902|       |    /* Pre-process palette entries */
 3903|  6.89k|    if(f.indexed)
  ------------------
  |  Branch (3903:8): [True: 238, False: 6.66k]
  ------------------
 3904|    238|    {
 3905|    238|        uint8_t red, green, blue, alpha;
 3906|       |
 3907|    238|        uint32_t i;
 3908|  61.1k|        for(i=0; i < 256; i++)
  ------------------
  |  Branch (3908:18): [True: 60.9k, False: 238]
  ------------------
 3909|  60.9k|        {
 3910|  60.9k|            if(f.apply_trns && i < ctx->trns.n_type3_entries)
  ------------------
  |  Branch (3910:16): [True: 0, False: 60.9k]
  |  Branch (3910:32): [True: 0, False: 0]
  ------------------
 3911|      0|                ctx->plte.entries[i].alpha = ctx->trns.type3_alpha[i];
 3912|  60.9k|            else
 3913|  60.9k|                ctx->plte.entries[i].alpha = 255;
 3914|       |
 3915|  60.9k|            red   = sample_to_target(ctx->plte.entries[i].red, 8, sb->red_bits, 8);
 3916|  60.9k|            green = sample_to_target(ctx->plte.entries[i].green, 8, sb->green_bits, 8);
 3917|  60.9k|            blue  = sample_to_target(ctx->plte.entries[i].blue, 8, sb->blue_bits, 8);
 3918|  60.9k|            alpha = sample_to_target(ctx->plte.entries[i].alpha, 8, sb->alpha_bits, 8);
 3919|       |
 3920|       |#if defined(SPNG_ARM)
 3921|       |            if(fmt == SPNG_FMT_RGB8 && ihdr->bit_depth == 8)
 3922|       |            {/* Working with 3 bytes at a time is more of an ARM thing */
 3923|       |                ctx->decode_plte.rgb[i * 3 + 0] = red;
 3924|       |                ctx->decode_plte.rgb[i * 3 + 1] = green;
 3925|       |                ctx->decode_plte.rgb[i * 3 + 2] = blue;
 3926|       |                continue;
 3927|       |            }
 3928|       |#endif
 3929|  60.9k|            plte[i].red = red;
 3930|  60.9k|            plte[i].green = green;
 3931|  60.9k|            plte[i].blue = blue;
 3932|  60.9k|            plte[i].alpha = alpha;
 3933|  60.9k|        }
 3934|       |
 3935|    238|        f.apply_trns = 0;
 3936|    238|    }
 3937|       |
 3938|  6.89k|    unsigned char *trns_px = ctx->trns_px;
 3939|       |
 3940|  6.89k|    if(f.apply_trns)
  ------------------
  |  Branch (3940:8): [True: 0, False: 6.89k]
  ------------------
 3941|      0|    {
 3942|      0|        uint16_t mask = ~0;
 3943|      0|        if(ctx->ihdr.bit_depth < 16) mask = (1 << ctx->ihdr.bit_depth) - 1;
  ------------------
  |  Branch (3943:12): [True: 0, False: 0]
  ------------------
 3944|       |
 3945|      0|        if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGBA16))
  ------------------
  |  Branch (3945:12): [True: 0, False: 0]
  ------------------
 3946|      0|        {
 3947|      0|            if(ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR)
  ------------------
  |  Branch (3947:16): [True: 0, False: 0]
  ------------------
 3948|      0|            {
 3949|      0|                if(ihdr->bit_depth == 16)
  ------------------
  |  Branch (3949:20): [True: 0, False: 0]
  ------------------
 3950|      0|                {
 3951|      0|                    memcpy(trns_px, &ctx->trns.red, 2);
 3952|      0|                    memcpy(trns_px + 2, &ctx->trns.green, 2);
 3953|      0|                    memcpy(trns_px + 4, &ctx->trns.blue, 2);
 3954|      0|                }
 3955|      0|                else
 3956|      0|                {
 3957|      0|                    trns_px[0] = ctx->trns.red & mask;
 3958|      0|                    trns_px[1] = ctx->trns.green & mask;
 3959|      0|                    trns_px[2] = ctx->trns.blue & mask;
 3960|      0|                }
 3961|      0|            }
 3962|      0|        }
 3963|      0|        else if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE) // fmt == SPNG_FMT_GA8 &&
  ------------------
  |  Branch (3963:17): [True: 0, False: 0]
  ------------------
 3964|      0|        {
 3965|      0|            if(ihdr->bit_depth == 16)
  ------------------
  |  Branch (3965:16): [True: 0, False: 0]
  ------------------
 3966|      0|            {
 3967|      0|                memcpy(trns_px, &ctx->trns.gray, 2);
 3968|      0|            }
 3969|      0|            else
 3970|      0|            {
 3971|      0|                trns_px[0] = ctx->trns.gray & mask;
 3972|      0|            }
 3973|      0|        }
 3974|      0|    }
 3975|       |
 3976|  6.89k|    ctx->decode_flags = f;
 3977|       |
 3978|  6.89k|    ctx->state = SPNG_STATE_DECODE_INIT;
 3979|       |
 3980|  6.89k|    struct spng_row_info *ri = &ctx->row_info;
 3981|  6.89k|    struct spng_subimage *sub = ctx->subimage;
 3982|       |
 3983|  6.89k|    while(!sub[ri->pass].width || !sub[ri->pass].height) ri->pass++;
  ------------------
  |  Branch (3983:11): [True: 0, False: 6.89k]
  |  Branch (3983:35): [True: 0, False: 6.89k]
  ------------------
 3984|       |
 3985|  6.89k|    if(f.interlaced) ri->row_num = adam7_y_start[ri->pass];
  ------------------
  |  Branch (3985:8): [True: 1.26k, False: 5.63k]
  ------------------
 3986|       |
 3987|  6.89k|    unsigned pixel_size = 4; /* SPNG_FMT_RGBA8 */
 3988|       |
 3989|  6.89k|    if(fmt == SPNG_FMT_RGBA16) pixel_size = 8;
  ------------------
  |  Branch (3989:8): [True: 0, False: 6.89k]
  ------------------
 3990|  6.89k|    else if(fmt == SPNG_FMT_RGB8) pixel_size = 3;
  ------------------
  |  Branch (3990:13): [True: 0, False: 6.89k]
  ------------------
 3991|  6.89k|    else if(fmt == SPNG_FMT_G8) pixel_size = 1;
  ------------------
  |  Branch (3991:13): [True: 0, False: 6.89k]
  ------------------
 3992|  6.89k|    else if(fmt == SPNG_FMT_GA8) pixel_size = 2;
  ------------------
  |  Branch (3992:13): [True: 0, False: 6.89k]
  ------------------
 3993|       |
 3994|  6.89k|    int i;
 3995|  21.3k|    for(i=ri->pass; i <= ctx->last_pass; i++)
  ------------------
  |  Branch (3995:21): [True: 14.4k, False: 6.89k]
  ------------------
 3996|  14.4k|    {
 3997|  14.4k|        if(!sub[i].scanline_width) continue;
  ------------------
  |  Branch (3997:12): [True: 0, False: 14.4k]
  ------------------
 3998|       |
 3999|  14.4k|        if(fmt & (SPNG_FMT_PNG | SPNG_FMT_RAW)) sub[i].out_width = sub[i].scanline_width - 1;
  ------------------
  |  Branch (3999:12): [True: 14.4k, False: 0]
  ------------------
 4000|      0|        else sub[i].out_width = (size_t)sub[i].width * pixel_size;
 4001|       |
 4002|  14.4k|        if(sub[i].out_width > UINT32_MAX) return decode_err(ctx, SPNG_EOVERFLOW);
  ------------------
  |  Branch (4002:12): [True: 0, False: 14.4k]
  ------------------
 4003|  14.4k|    }
 4004|       |
 4005|       |    /* Read the first filter byte, offsetting all reads by 1 byte.
 4006|       |    The scanlines will be aligned with the start of the array with
 4007|       |    the next scanline's filter byte at the end,
 4008|       |    the last scanline will end up being 1 byte "shorter". */
 4009|  6.89k|    ret = read_scanline_bytes(ctx, &ri->filter, 1);
 4010|  6.89k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (4010:8): [True: 1.31k, False: 5.58k]
  ------------------
 4011|       |
 4012|  5.58k|    if(ri->filter > 4) return decode_err(ctx, SPNG_EFILTER);
  ------------------
  |  Branch (4012:8): [True: 139, False: 5.44k]
  ------------------
 4013|       |
 4014|  5.44k|    if(flags & SPNG_DECODE_PROGRESSIVE)
  ------------------
  |  Branch (4014:8): [True: 5.44k, False: 0]
  ------------------
 4015|  5.44k|    {
 4016|  5.44k|        return 0;
 4017|  5.44k|    }
 4018|       |
 4019|      0|    do
 4020|      0|    {
 4021|      0|        size_t ioffset = ri->row_num * ctx->image_width;
 4022|       |
 4023|      0|        ret = spng_decode_row(ctx, (unsigned char*)out + ioffset, ctx->image_width);
 4024|      0|    }while(!ret);
  ------------------
  |  Branch (4024:12): [True: 0, False: 0]
  ------------------
 4025|       |
 4026|      0|    if(ret != SPNG_EOI) return decode_err(ctx, ret);
  ------------------
  |  Branch (4026:8): [True: 0, False: 0]
  ------------------
 4027|       |
 4028|      0|    return 0;
 4029|      0|}
spng_ctx_new:
 4901|  30.7k|{
 4902|  30.7k|    struct spng_alloc alloc =
 4903|  30.7k|    {
 4904|  30.7k|        .malloc_fn = malloc,
 4905|  30.7k|        .realloc_fn = realloc,
 4906|  30.7k|        .calloc_fn = calloc,
 4907|  30.7k|        .free_fn = free
 4908|  30.7k|    };
 4909|       |
 4910|  30.7k|    return spng_ctx_new2(&alloc, flags);
 4911|  30.7k|}
spng_ctx_new2:
 4914|  30.7k|{
 4915|  30.7k|    if(alloc == NULL) return NULL;
  ------------------
  |  Branch (4915:8): [True: 0, False: 30.7k]
  ------------------
 4916|  30.7k|    if(flags != (flags & SPNG__CTX_FLAGS_ALL)) return NULL;
  ------------------
  |  Branch (4916:8): [True: 0, False: 30.7k]
  ------------------
 4917|       |
 4918|  30.7k|    if(alloc->malloc_fn == NULL) return NULL;
  ------------------
  |  Branch (4918:8): [True: 0, False: 30.7k]
  ------------------
 4919|  30.7k|    if(alloc->realloc_fn == NULL) return NULL;
  ------------------
  |  Branch (4919:8): [True: 0, False: 30.7k]
  ------------------
 4920|  30.7k|    if(alloc->calloc_fn == NULL) return NULL;
  ------------------
  |  Branch (4920:8): [True: 0, False: 30.7k]
  ------------------
 4921|  30.7k|    if(alloc->free_fn == NULL) return NULL;
  ------------------
  |  Branch (4921:8): [True: 0, False: 30.7k]
  ------------------
 4922|       |
 4923|  30.7k|    spng_ctx *ctx = alloc->calloc_fn(1, sizeof(spng_ctx));
 4924|  30.7k|    if(ctx == NULL) return NULL;
  ------------------
  |  Branch (4924:8): [True: 0, False: 30.7k]
  ------------------
 4925|       |
 4926|  30.7k|    ctx->alloc = *alloc;
 4927|       |
 4928|  30.7k|    ctx->max_width = spng_u32max;
 4929|  30.7k|    ctx->max_height = spng_u32max;
 4930|       |
 4931|  30.7k|    ctx->max_chunk_size = spng_u32max;
 4932|  30.7k|    ctx->chunk_cache_limit = SIZE_MAX;
 4933|  30.7k|    ctx->chunk_count_limit = SPNG_MAX_CHUNK_COUNT;
  ------------------
  |  |   32|  30.7k|#define SPNG_MAX_CHUNK_COUNT (1000)
  ------------------
 4934|       |
 4935|  30.7k|    ctx->state = SPNG_STATE_INIT;
 4936|       |
 4937|  30.7k|    ctx->crc_action_critical = SPNG_CRC_ERROR;
 4938|  30.7k|    ctx->crc_action_ancillary = SPNG_CRC_DISCARD;
 4939|       |
 4940|  30.7k|    const struct spng__zlib_options image_defaults =
 4941|  30.7k|    {
 4942|  30.7k|        .compression_level = Z_DEFAULT_COMPRESSION,
  ------------------
  |  |  197|  30.7k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
 4943|  30.7k|        .window_bits = 15,
 4944|  30.7k|        .mem_level = 8,
 4945|  30.7k|        .strategy = Z_FILTERED,
  ------------------
  |  |  200|  30.7k|#define Z_FILTERED            1
  ------------------
 4946|  30.7k|        .data_type = 0 /* Z_BINARY */
 4947|  30.7k|    };
 4948|       |
 4949|  30.7k|    const struct spng__zlib_options text_defaults =
 4950|  30.7k|    {
 4951|  30.7k|        .compression_level = Z_DEFAULT_COMPRESSION,
  ------------------
  |  |  197|  30.7k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
 4952|  30.7k|        .window_bits = 15,
 4953|  30.7k|        .mem_level = 8,
 4954|  30.7k|        .strategy = Z_DEFAULT_STRATEGY,
  ------------------
  |  |  204|  30.7k|#define Z_DEFAULT_STRATEGY    0
  ------------------
 4955|  30.7k|        .data_type = 1 /* Z_TEXT */
 4956|  30.7k|    };
 4957|       |
 4958|  30.7k|    ctx->image_options = image_defaults;
 4959|  30.7k|    ctx->text_options = text_defaults;
 4960|       |
 4961|  30.7k|    ctx->optimize_option = ~0;
 4962|  30.7k|    ctx->encode_flags.filter_choice = SPNG_FILTER_CHOICE_ALL;
 4963|       |
 4964|  30.7k|    ctx->flags = flags;
 4965|       |
 4966|  30.7k|    if(flags & SPNG_CTX_ENCODER) ctx->encode_only = 1;
  ------------------
  |  Branch (4966:8): [True: 0, False: 30.7k]
  ------------------
 4967|       |
 4968|  30.7k|    return ctx;
 4969|  30.7k|}
spng_ctx_free:
 4972|  30.7k|{
 4973|  30.7k|    if(ctx == NULL) return;
  ------------------
  |  Branch (4973:8): [True: 0, False: 30.7k]
  ------------------
 4974|       |
 4975|  30.7k|    if(ctx->streaming && ctx->stream_buf != NULL) spng__free(ctx, ctx->stream_buf);
  ------------------
  |  Branch (4975:8): [True: 30.7k, False: 0]
  |  Branch (4975:26): [True: 30.7k, False: 0]
  ------------------
 4976|       |
 4977|  30.7k|    if(!ctx->user.exif) spng__free(ctx, ctx->exif.data);
  ------------------
  |  Branch (4977:8): [True: 30.7k, False: 0]
  ------------------
 4978|       |
 4979|  30.7k|    if(!ctx->user.iccp) spng__free(ctx, ctx->iccp.profile);
  ------------------
  |  Branch (4979:8): [True: 30.7k, False: 0]
  ------------------
 4980|       |
 4981|  30.7k|    uint32_t i;
 4982|       |
 4983|  30.7k|    if(ctx->splt_list != NULL && !ctx->user.splt)
  ------------------
  |  Branch (4983:8): [True: 2.06k, False: 28.6k]
  |  Branch (4983:34): [True: 2.06k, False: 0]
  ------------------
 4984|  2.06k|    {
 4985|  3.36k|        for(i=0; i < ctx->n_splt; i++)
  ------------------
  |  Branch (4985:18): [True: 1.30k, False: 2.06k]
  ------------------
 4986|  1.30k|        {
 4987|  1.30k|            spng__free(ctx, ctx->splt_list[i].entries);
 4988|  1.30k|        }
 4989|  2.06k|        spng__free(ctx, ctx->splt_list);
 4990|  2.06k|    }
 4991|       |
 4992|  30.7k|    if(ctx->text_list != NULL)
  ------------------
  |  Branch (4992:8): [True: 9.96k, False: 20.7k]
  ------------------
 4993|  9.96k|    {
 4994|  16.5k|        for(i=0; i< ctx->n_text; i++)
  ------------------
  |  Branch (4994:18): [True: 6.54k, False: 9.96k]
  ------------------
 4995|  6.54k|        {
 4996|  6.54k|            if(ctx->user.text) break;
  ------------------
  |  Branch (4996:16): [True: 0, False: 6.54k]
  ------------------
 4997|       |
 4998|  6.54k|            spng__free(ctx, ctx->text_list[i].keyword);
 4999|  6.54k|            if(ctx->text_list[i].compression_flag) spng__free(ctx, ctx->text_list[i].text);
  ------------------
  |  Branch (4999:16): [True: 833, False: 5.71k]
  ------------------
 5000|  6.54k|        }
 5001|  9.96k|        spng__free(ctx, ctx->text_list);
 5002|  9.96k|    }
 5003|       |
 5004|  30.7k|    if(ctx->chunk_list != NULL && !ctx->user.unknown)
  ------------------
  |  Branch (5004:8): [True: 0, False: 30.7k]
  |  Branch (5004:35): [True: 0, False: 0]
  ------------------
 5005|      0|    {
 5006|      0|        for(i=0; i< ctx->n_chunks; i++)
  ------------------
  |  Branch (5006:18): [True: 0, False: 0]
  ------------------
 5007|      0|        {
 5008|      0|            spng__free(ctx, ctx->chunk_list[i].data);
 5009|      0|        }
 5010|      0|        spng__free(ctx, ctx->chunk_list);
 5011|      0|    }
 5012|       |
 5013|  30.7k|    if(ctx->deflate) deflateEnd(&ctx->zstream);
  ------------------
  |  |   53|  30.7k|#  define deflate               z_deflate
  ------------------
                  if(ctx->deflate) deflateEnd(&ctx->zstream);
  ------------------
  |  |   57|      0|#  define deflateEnd            z_deflateEnd
  ------------------
  |  Branch (5013:8): [True: 0, False: 30.7k]
  ------------------
 5014|  30.7k|    else inflateEnd(&ctx->zstream);
  ------------------
  |  |  121|  30.7k|#  define inflateEnd            z_inflateEnd
  ------------------
 5015|       |
 5016|  30.7k|    if(!ctx->user_owns_out_png) spng__free(ctx, ctx->out_png);
  ------------------
  |  Branch (5016:8): [True: 30.7k, False: 0]
  ------------------
 5017|       |
 5018|       |#if 0 /* libjpeg-turbo: Eliminate unused gamma correction code, which
 5019|       |         introduces an unwanted libm dependency */
 5020|       |    spng__free(ctx, ctx->gamma_lut16);
 5021|       |#endif
 5022|       |
 5023|  30.7k|    spng__free(ctx, ctx->row_buf);
 5024|  30.7k|    spng__free(ctx, ctx->scanline_buf);
 5025|  30.7k|    spng__free(ctx, ctx->prev_scanline_buf);
 5026|  30.7k|    spng__free(ctx, ctx->filtered_scanline_buf);
 5027|       |
 5028|  30.7k|    spng_free_fn *free_fn = ctx->alloc.free_fn;
 5029|       |
 5030|  30.7k|    memset(ctx, 0, sizeof(spng_ctx));
 5031|       |
 5032|  30.7k|    free_fn(ctx);
 5033|  30.7k|}
spng_set_png_stream:
 5094|  30.7k|{
 5095|  30.7k|    if(ctx == NULL || rw_func == NULL) return 1;
  ------------------
  |  Branch (5095:8): [True: 0, False: 30.7k]
  |  Branch (5095:23): [True: 0, False: 30.7k]
  ------------------
 5096|  30.7k|    if(!ctx->state) return SPNG_EBADSTATE;
  ------------------
  |  Branch (5096:8): [True: 0, False: 30.7k]
  ------------------
 5097|       |
 5098|       |    /* SPNG_STATE_OUTPUT shares the same value */
 5099|  30.7k|    if(ctx->state >= SPNG_STATE_INPUT) return SPNG_EBUF_SET;
  ------------------
  |  Branch (5099:8): [True: 0, False: 30.7k]
  ------------------
 5100|       |
 5101|  30.7k|    if(ctx->encode_only)
  ------------------
  |  Branch (5101:8): [True: 0, False: 30.7k]
  ------------------
 5102|      0|    {
 5103|      0|        if(ctx->out_png != NULL) return SPNG_EBUF_SET;
  ------------------
  |  Branch (5103:12): [True: 0, False: 0]
  ------------------
 5104|       |
 5105|      0|        ctx->write_fn = rw_func;
 5106|      0|        ctx->write_ptr = ctx->stream_buf;
 5107|       |
 5108|      0|        ctx->state = SPNG_STATE_OUTPUT;
 5109|      0|    }
 5110|  30.7k|    else
 5111|  30.7k|    {
 5112|  30.7k|        ctx->stream_buf = spng__malloc(ctx, SPNG_READ_SIZE);
  ------------------
  |  |   30|  30.7k|#define SPNG_READ_SIZE (8192)
  ------------------
 5113|  30.7k|        if(ctx->stream_buf == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (5113:12): [True: 0, False: 30.7k]
  ------------------
 5114|       |
 5115|  30.7k|        ctx->read_fn = rw_func;
 5116|  30.7k|        ctx->data = ctx->stream_buf;
 5117|  30.7k|        ctx->data_size = SPNG_READ_SIZE;
  ------------------
  |  |   30|  30.7k|#define SPNG_READ_SIZE (8192)
  ------------------
 5118|       |
 5119|  30.7k|        ctx->state = SPNG_STATE_INPUT;
 5120|  30.7k|    }
 5121|       |
 5122|  30.7k|    ctx->stream_user_ptr = user;
 5123|       |
 5124|  30.7k|    ctx->streaming = 1;
 5125|       |
 5126|  30.7k|    return 0;
 5127|  30.7k|}
spng_set_png_file:
 5130|  30.7k|{
 5131|  30.7k|    if(file == NULL) return 1;
  ------------------
  |  Branch (5131:8): [True: 0, False: 30.7k]
  ------------------
 5132|       |
 5133|  30.7k|    if(ctx->encode_only) return spng_set_png_stream(ctx, file_write_fn, file);
  ------------------
  |  Branch (5133:8): [True: 0, False: 30.7k]
  ------------------
 5134|       |
 5135|  30.7k|    return spng_set_png_stream(ctx, file_read_fn, file);
 5136|  30.7k|}
spng_get_ihdr:
 5399|  30.7k|{
 5400|  30.7k|    if(ctx == NULL) return 1;
  ------------------
  |  Branch (5400:8): [True: 0, False: 30.7k]
  ------------------
 5401|  30.7k|    int ret = read_chunks(ctx, 1);
 5402|  30.7k|    if(ret) return ret;
  ------------------
  |  Branch (5402:8): [True: 1.65k, False: 29.0k]
  ------------------
 5403|  29.0k|    if(ihdr == NULL) return 1;
  ------------------
  |  Branch (5403:8): [True: 0, False: 29.0k]
  ------------------
 5404|       |
 5405|  29.0k|    *ihdr = ctx->ihdr;
 5406|       |
 5407|  29.0k|    return 0;
 5408|  29.0k|}
spng_get_plte:
 5411|  1.02k|{
 5412|  1.56k|    SPNG_GET_CHUNK_BOILERPLATE(plte);
  ------------------
  |  |  119|  1.02k|    if(ctx == NULL) return 1; \
  |  |  ------------------
  |  |  |  Branch (119:8): [True: 0, False: 1.02k]
  |  |  ------------------
  |  |  120|  1.02k|    int ret = read_chunks(ctx, 0); \
  |  |  121|  1.02k|    if(ret) return ret; \
  |  |  ------------------
  |  |  |  Branch (121:8): [True: 763, False: 266]
  |  |  ------------------
  |  |  122|  1.02k|    if(!ctx->stored.chunk) return SPNG_ECHUNKAVAIL; \
  |  |  ------------------
  |  |  |  Branch (122:8): [True: 0, False: 266]
  |  |  ------------------
  |  |  123|    266|    if(chunk == NULL) return 1
  |  |  ------------------
  |  |  |  Branch (123:8): [True: 0, False: 266]
  |  |  ------------------
  ------------------
 5413|       |
 5414|    266|    *plte = ctx->plte;
 5415|       |
 5416|    266|    return 0;
 5417|  1.56k|}
spng_get_iccp:
 5474|  5.44k|{
 5475|  10.9k|    SPNG_GET_CHUNK_BOILERPLATE(iccp);
  ------------------
  |  |  119|  5.44k|    if(ctx == NULL) return 1; \
  |  |  ------------------
  |  |  |  Branch (119:8): [True: 0, False: 5.44k]
  |  |  ------------------
  |  |  120|  5.44k|    int ret = read_chunks(ctx, 0); \
  |  |  121|  5.44k|    if(ret) return ret; \
  |  |  ------------------
  |  |  |  Branch (121:8): [True: 0, False: 5.44k]
  |  |  ------------------
  |  |  122|  5.44k|    if(!ctx->stored.chunk) return SPNG_ECHUNKAVAIL; \
  |  |  ------------------
  |  |  |  Branch (122:8): [True: 5.44k, False: 6]
  |  |  ------------------
  |  |  123|  5.44k|    if(chunk == NULL) return 1
  |  |  ------------------
  |  |  |  Branch (123:8): [True: 0, False: 6]
  |  |  ------------------
  ------------------
 5476|       |
 5477|      6|    *iccp = ctx->iccp;
 5478|       |
 5479|      6|    return 0;
 5480|  10.9k|}
spng_strerror:
 6067|  12.0k|{
 6068|  12.0k|    switch(err)
 6069|  12.0k|    {
 6070|  6.28k|        case SPNG_IO_EOF: return "end of stream";
  ------------------
  |  Branch (6070:9): [True: 6.28k, False: 5.79k]
  ------------------
 6071|      0|        case SPNG_IO_ERROR: return "stream error";
  ------------------
  |  Branch (6071:9): [True: 0, False: 12.0k]
  ------------------
 6072|      0|        case SPNG_OK: return "success";
  ------------------
  |  Branch (6072:9): [True: 0, False: 12.0k]
  ------------------
 6073|      0|        case SPNG_EINVAL: return "invalid argument";
  ------------------
  |  Branch (6073:9): [True: 0, False: 12.0k]
  ------------------
 6074|      0|        case SPNG_EMEM: return "out of memory";
  ------------------
  |  Branch (6074:9): [True: 0, False: 12.0k]
  ------------------
 6075|    161|        case SPNG_EOVERFLOW: return "arithmetic overflow";
  ------------------
  |  Branch (6075:9): [True: 161, False: 11.9k]
  ------------------
 6076|    238|        case SPNG_ESIGNATURE: return "invalid signature";
  ------------------
  |  Branch (6076:9): [True: 238, False: 11.8k]
  ------------------
 6077|    231|        case SPNG_EWIDTH: return "invalid image width";
  ------------------
  |  Branch (6077:9): [True: 231, False: 11.8k]
  ------------------
 6078|    231|        case SPNG_EHEIGHT: return "invalid image height";
  ------------------
  |  Branch (6078:9): [True: 231, False: 11.8k]
  ------------------
 6079|      0|        case SPNG_EUSER_WIDTH: return "image width exceeds user limit";
  ------------------
  |  Branch (6079:9): [True: 0, False: 12.0k]
  ------------------
 6080|      0|        case SPNG_EUSER_HEIGHT: return "image height exceeds user limit";
  ------------------
  |  Branch (6080:9): [True: 0, False: 12.0k]
  ------------------
 6081|    252|        case SPNG_EBIT_DEPTH: return "invalid bit depth";
  ------------------
  |  Branch (6081:9): [True: 252, False: 11.8k]
  ------------------
 6082|     70|        case SPNG_ECOLOR_TYPE: return "invalid color type";
  ------------------
  |  Branch (6082:9): [True: 70, False: 12.0k]
  ------------------
 6083|     42|        case SPNG_ECOMPRESSION_METHOD: return "invalid compression method";
  ------------------
  |  Branch (6083:9): [True: 42, False: 12.0k]
  ------------------
 6084|     35|        case SPNG_EFILTER_METHOD: return "invalid filter method";
  ------------------
  |  Branch (6084:9): [True: 35, False: 12.0k]
  ------------------
 6085|     14|        case SPNG_EINTERLACE_METHOD: return "invalid interlace method";
  ------------------
  |  Branch (6085:9): [True: 14, False: 12.0k]
  ------------------
 6086|    322|        case SPNG_EIHDR_SIZE: return "invalid IHDR chunk size";
  ------------------
  |  Branch (6086:9): [True: 322, False: 11.7k]
  ------------------
 6087|     56|        case SPNG_ENOIHDR: return "missing IHDR chunk";
  ------------------
  |  Branch (6087:9): [True: 56, False: 12.0k]
  ------------------
 6088|     27|        case SPNG_ECHUNK_POS: return "invalid chunk position";
  ------------------
  |  Branch (6088:9): [True: 27, False: 12.0k]
  ------------------
 6089|     50|        case SPNG_ECHUNK_SIZE: return "invalid chunk length";
  ------------------
  |  Branch (6089:9): [True: 50, False: 12.0k]
  ------------------
 6090|    375|        case SPNG_ECHUNK_CRC: return "invalid chunk checksum";
  ------------------
  |  Branch (6090:9): [True: 375, False: 11.6k]
  ------------------
 6091|      0|        case SPNG_ECHUNK_TYPE: return "invalid chunk type";
  ------------------
  |  Branch (6091:9): [True: 0, False: 12.0k]
  ------------------
 6092|    262|        case SPNG_ECHUNK_UNKNOWN_CRITICAL: return "unknown critical chunk";
  ------------------
  |  Branch (6092:9): [True: 262, False: 11.8k]
  ------------------
 6093|      0|        case SPNG_EDUP_PLTE: return "duplicate PLTE chunk";
  ------------------
  |  Branch (6093:9): [True: 0, False: 12.0k]
  ------------------
 6094|      0|        case SPNG_EDUP_CHRM: return "duplicate cHRM chunk";
  ------------------
  |  Branch (6094:9): [True: 0, False: 12.0k]
  ------------------
 6095|      0|        case SPNG_EDUP_GAMA: return "duplicate gAMA chunk";
  ------------------
  |  Branch (6095:9): [True: 0, False: 12.0k]
  ------------------
 6096|      0|        case SPNG_EDUP_ICCP: return "duplicate iCCP chunk";
  ------------------
  |  Branch (6096:9): [True: 0, False: 12.0k]
  ------------------
 6097|      0|        case SPNG_EDUP_SBIT: return "duplicate sBIT chunk";
  ------------------
  |  Branch (6097:9): [True: 0, False: 12.0k]
  ------------------
 6098|      0|        case SPNG_EDUP_SRGB: return "duplicate sRGB chunk";
  ------------------
  |  Branch (6098:9): [True: 0, False: 12.0k]
  ------------------
 6099|      0|        case SPNG_EDUP_BKGD: return "duplicate bKGD chunk";
  ------------------
  |  Branch (6099:9): [True: 0, False: 12.0k]
  ------------------
 6100|      0|        case SPNG_EDUP_HIST: return "duplicate hIST chunk";
  ------------------
  |  Branch (6100:9): [True: 0, False: 12.0k]
  ------------------
 6101|      0|        case SPNG_EDUP_TRNS: return "duplicate tRNS chunk";
  ------------------
  |  Branch (6101:9): [True: 0, False: 12.0k]
  ------------------
 6102|      0|        case SPNG_EDUP_PHYS: return "duplicate pHYs chunk";
  ------------------
  |  Branch (6102:9): [True: 0, False: 12.0k]
  ------------------
 6103|      0|        case SPNG_EDUP_TIME: return "duplicate tIME chunk";
  ------------------
  |  Branch (6103:9): [True: 0, False: 12.0k]
  ------------------
 6104|      0|        case SPNG_EDUP_OFFS: return "duplicate oFFs chunk";
  ------------------
  |  Branch (6104:9): [True: 0, False: 12.0k]
  ------------------
 6105|      0|        case SPNG_EDUP_EXIF: return "duplicate eXIf chunk";
  ------------------
  |  Branch (6105:9): [True: 0, False: 12.0k]
  ------------------
 6106|      0|        case SPNG_ECHRM: return "invalid cHRM chunk";
  ------------------
  |  Branch (6106:9): [True: 0, False: 12.0k]
  ------------------
 6107|      0|        case SPNG_EPLTE_IDX: return "invalid palette (PLTE) index";
  ------------------
  |  Branch (6107:9): [True: 0, False: 12.0k]
  ------------------
 6108|      0|        case SPNG_ETRNS_COLOR_TYPE: return "tRNS chunk with incompatible color type";
  ------------------
  |  Branch (6108:9): [True: 0, False: 12.0k]
  ------------------
 6109|      0|        case SPNG_ETRNS_NO_PLTE: return "missing palette (PLTE) for tRNS chunk";
  ------------------
  |  Branch (6109:9): [True: 0, False: 12.0k]
  ------------------
 6110|      0|        case SPNG_EGAMA: return "invalid gAMA chunk";
  ------------------
  |  Branch (6110:9): [True: 0, False: 12.0k]
  ------------------
 6111|      0|        case SPNG_EICCP_NAME: return "invalid iCCP profile name";
  ------------------
  |  Branch (6111:9): [True: 0, False: 12.0k]
  ------------------
 6112|      0|        case SPNG_EICCP_COMPRESSION_METHOD: return "invalid iCCP compression method";
  ------------------
  |  Branch (6112:9): [True: 0, False: 12.0k]
  ------------------
 6113|      0|        case SPNG_ESBIT: return "invalid sBIT chunk";
  ------------------
  |  Branch (6113:9): [True: 0, False: 12.0k]
  ------------------
 6114|      0|        case SPNG_ESRGB: return "invalid sRGB chunk";
  ------------------
  |  Branch (6114:9): [True: 0, False: 12.0k]
  ------------------
 6115|      0|        case SPNG_ETEXT: return "invalid tEXt chunk";
  ------------------
  |  Branch (6115:9): [True: 0, False: 12.0k]
  ------------------
 6116|      0|        case SPNG_ETEXT_KEYWORD: return "invalid tEXt keyword";
  ------------------
  |  Branch (6116:9): [True: 0, False: 12.0k]
  ------------------
 6117|      0|        case SPNG_EZTXT: return "invalid zTXt chunk";
  ------------------
  |  Branch (6117:9): [True: 0, False: 12.0k]
  ------------------
 6118|      0|        case SPNG_EZTXT_COMPRESSION_METHOD: return "invalid zTXt compression method";
  ------------------
  |  Branch (6118:9): [True: 0, False: 12.0k]
  ------------------
 6119|      0|        case SPNG_EITXT: return "invalid iTXt chunk";
  ------------------
  |  Branch (6119:9): [True: 0, False: 12.0k]
  ------------------
 6120|      0|        case SPNG_EITXT_COMPRESSION_FLAG: return "invalid iTXt compression flag";
  ------------------
  |  Branch (6120:9): [True: 0, False: 12.0k]
  ------------------
 6121|      0|        case SPNG_EITXT_COMPRESSION_METHOD: return "invalid iTXt compression method";
  ------------------
  |  Branch (6121:9): [True: 0, False: 12.0k]
  ------------------
 6122|      0|        case SPNG_EITXT_LANG_TAG: return "invalid iTXt language tag";
  ------------------
  |  Branch (6122:9): [True: 0, False: 12.0k]
  ------------------
 6123|      0|        case SPNG_EITXT_TRANSLATED_KEY: return "invalid iTXt translated key";
  ------------------
  |  Branch (6123:9): [True: 0, False: 12.0k]
  ------------------
 6124|      0|        case SPNG_EBKGD_NO_PLTE: return "missing palette for bKGD chunk";
  ------------------
  |  Branch (6124:9): [True: 0, False: 12.0k]
  ------------------
 6125|      0|        case SPNG_EBKGD_PLTE_IDX: return "invalid palette index for bKGD chunk";
  ------------------
  |  Branch (6125:9): [True: 0, False: 12.0k]
  ------------------
 6126|      0|        case SPNG_EHIST_NO_PLTE: return "missing palette for hIST chunk";
  ------------------
  |  Branch (6126:9): [True: 0, False: 12.0k]
  ------------------
 6127|      0|        case SPNG_EPHYS: return "invalid pHYs chunk";
  ------------------
  |  Branch (6127:9): [True: 0, False: 12.0k]
  ------------------
 6128|      0|        case SPNG_ESPLT_NAME: return "invalid suggested palette name";
  ------------------
  |  Branch (6128:9): [True: 0, False: 12.0k]
  ------------------
 6129|      0|        case SPNG_ESPLT_DUP_NAME: return "duplicate suggested palette (sPLT) name";
  ------------------
  |  Branch (6129:9): [True: 0, False: 12.0k]
  ------------------
 6130|      0|        case SPNG_ESPLT_DEPTH: return "invalid suggested palette (sPLT) sample depth";
  ------------------
  |  Branch (6130:9): [True: 0, False: 12.0k]
  ------------------
 6131|      0|        case SPNG_ETIME: return "invalid tIME chunk";
  ------------------
  |  Branch (6131:9): [True: 0, False: 12.0k]
  ------------------
 6132|      0|        case SPNG_EOFFS: return "invalid oFFs chunk";
  ------------------
  |  Branch (6132:9): [True: 0, False: 12.0k]
  ------------------
 6133|      0|        case SPNG_EEXIF: return "invalid eXIf chunk";
  ------------------
  |  Branch (6133:9): [True: 0, False: 12.0k]
  ------------------
 6134|     33|        case SPNG_EIDAT_TOO_SHORT: return "IDAT stream too short";
  ------------------
  |  Branch (6134:9): [True: 33, False: 12.0k]
  ------------------
 6135|  1.93k|        case SPNG_EIDAT_STREAM: return "IDAT stream error";
  ------------------
  |  Branch (6135:9): [True: 1.93k, False: 10.1k]
  ------------------
 6136|      0|        case SPNG_EZLIB: return "zlib error";
  ------------------
  |  Branch (6136:9): [True: 0, False: 12.0k]
  ------------------
 6137|  1.30k|        case SPNG_EFILTER: return "invalid scanline filter";
  ------------------
  |  Branch (6137:9): [True: 1.30k, False: 10.7k]
  ------------------
 6138|      0|        case SPNG_EBUFSIZ: return "invalid buffer size";
  ------------------
  |  Branch (6138:9): [True: 0, False: 12.0k]
  ------------------
 6139|      0|        case SPNG_EIO: return "i/o error";
  ------------------
  |  Branch (6139:9): [True: 0, False: 12.0k]
  ------------------
 6140|      0|        case SPNG_EOF: return "end of file";
  ------------------
  |  Branch (6140:9): [True: 0, False: 12.0k]
  ------------------
 6141|      0|        case SPNG_EBUF_SET: return "buffer already set";
  ------------------
  |  Branch (6141:9): [True: 0, False: 12.0k]
  ------------------
 6142|      0|        case SPNG_EBADSTATE: return "non-recoverable state";
  ------------------
  |  Branch (6142:9): [True: 0, False: 12.0k]
  ------------------
 6143|      0|        case SPNG_EFMT: return "invalid format";
  ------------------
  |  Branch (6143:9): [True: 0, False: 12.0k]
  ------------------
 6144|      0|        case SPNG_EFLAGS: return "invalid flags";
  ------------------
  |  Branch (6144:9): [True: 0, False: 12.0k]
  ------------------
 6145|      0|        case SPNG_ECHUNKAVAIL: return "chunk not available";
  ------------------
  |  Branch (6145:9): [True: 0, False: 12.0k]
  ------------------
 6146|      0|        case SPNG_ENCODE_ONLY: return "encode only context";
  ------------------
  |  Branch (6146:9): [True: 0, False: 12.0k]
  ------------------
 6147|      0|        case SPNG_EOI: return "reached end-of-image state";
  ------------------
  |  Branch (6147:9): [True: 0, False: 12.0k]
  ------------------
 6148|      7|        case SPNG_ENOPLTE: return "missing PLTE for indexed image";
  ------------------
  |  Branch (6148:9): [True: 7, False: 12.0k]
  ------------------
 6149|      0|        case SPNG_ECHUNK_LIMITS: return "reached chunk/cache limits";
  ------------------
  |  Branch (6149:9): [True: 0, False: 12.0k]
  ------------------
 6150|      0|        case SPNG_EZLIB_INIT: return "zlib init error";
  ------------------
  |  Branch (6150:9): [True: 0, False: 12.0k]
  ------------------
 6151|    146|        case SPNG_ECHUNK_STDLEN: return "chunk exceeds maximum standard length";
  ------------------
  |  Branch (6151:9): [True: 146, False: 11.9k]
  ------------------
 6152|      0|        case SPNG_EINTERNAL: return "internal error";
  ------------------
  |  Branch (6152:9): [True: 0, False: 12.0k]
  ------------------
 6153|      0|        case SPNG_ECTXTYPE: return "invalid operation for context type";
  ------------------
  |  Branch (6153:9): [True: 0, False: 12.0k]
  ------------------
 6154|      0|        case SPNG_ENOSRC: return "source PNG not set";
  ------------------
  |  Branch (6154:9): [True: 0, False: 12.0k]
  ------------------
 6155|      0|        case SPNG_ENODST: return "PNG output not set";
  ------------------
  |  Branch (6155:9): [True: 0, False: 12.0k]
  ------------------
 6156|      0|        case SPNG_EOPSTATE: return "invalid operation for state";
  ------------------
  |  Branch (6156:9): [True: 0, False: 12.0k]
  ------------------
 6157|      0|        case SPNG_ENOTFINAL: return "PNG not finalized";
  ------------------
  |  Branch (6157:9): [True: 0, False: 12.0k]
  ------------------
 6158|      0|        default: return "unknown error";
  ------------------
  |  Branch (6158:9): [True: 0, False: 12.0k]
  ------------------
 6159|  12.0k|    }
 6160|  12.0k|}
spng.c:spng__iter_init:
  494|   153k|{
  495|   153k|    struct spng__iter iter =
  496|   153k|    {
  497|   153k|        .mask = (uint32_t)(1 << bit_depth) - 1,
  498|   153k|        .shift_amount = 8 - bit_depth,
  499|   153k|        .initial_shift = 8 - bit_depth,
  500|   153k|        .bit_depth = bit_depth,
  501|   153k|        .samples = samples
  502|   153k|    };
  503|       |
  504|   153k|    return iter;
  505|   153k|}
spng.c:read_scanline:
 3229|   153k|{
 3230|   153k|    int ret, pass = ctx->row_info.pass;
 3231|   153k|    struct spng_row_info *ri = &ctx->row_info;
 3232|   153k|    const struct spng_subimage *sub = ctx->subimage;
 3233|   153k|    size_t scanline_width = sub[pass].scanline_width;
 3234|   153k|    uint32_t scanline_idx = ri->scanline_idx;
 3235|       |
 3236|   153k|    uint8_t next_filter = 0;
 3237|       |
 3238|   153k|    if(scanline_idx == (sub[pass].height - 1) && ri->pass == ctx->last_pass)
  ------------------
  |  Branch (3238:8): [True: 2.71k, False: 151k]
  |  Branch (3238:50): [True: 2.10k, False: 612]
  ------------------
 3239|  2.10k|    {
 3240|  2.10k|        ret = read_scanline_bytes(ctx, ctx->scanline, scanline_width - 1);
 3241|  2.10k|    }
 3242|   151k|    else
 3243|   151k|    {
 3244|   151k|        ret = read_scanline_bytes(ctx, ctx->scanline, scanline_width);
 3245|   151k|        if(ret) return ret;
  ------------------
  |  Branch (3245:12): [True: 2.06k, False: 149k]
  ------------------
 3246|       |
 3247|   149k|        next_filter = ctx->scanline[scanline_width - 1];
 3248|   149k|        if(next_filter > 4) ret = SPNG_EFILTER;
  ------------------
  |  Branch (3248:12): [True: 1.16k, False: 148k]
  ------------------
 3249|   149k|    }
 3250|       |
 3251|   151k|    if(ret) return ret;
  ------------------
  |  Branch (3251:8): [True: 1.55k, False: 150k]
  ------------------
 3252|       |
 3253|   150k|    if(!scanline_idx && ri->filter > 1)
  ------------------
  |  Branch (3253:8): [True: 5.44k, False: 144k]
  |  Branch (3253:25): [True: 1.35k, False: 4.09k]
  ------------------
 3254|  1.35k|    {
 3255|       |        /* prev_scanline is all zeros for the first scanline */
 3256|  1.35k|        memset(ctx->prev_scanline, 0, scanline_width);
 3257|  1.35k|    }
 3258|       |
 3259|   150k|    if(ctx->ihdr.bit_depth == 16 && ctx->fmt != SPNG_FMT_RAW) u16_row_to_host(ctx->scanline, scanline_width - 1);
  ------------------
  |  Branch (3259:8): [True: 18.7k, False: 131k]
  |  Branch (3259:37): [True: 18.7k, False: 0]
  ------------------
 3260|       |
 3261|   150k|    ret = defilter_scanline(ctx->prev_scanline, ctx->scanline, scanline_width, ctx->bytes_per_pixel, ri->filter);
 3262|   150k|    if(ret) return ret;
  ------------------
  |  Branch (3262:8): [True: 0, False: 150k]
  ------------------
 3263|       |
 3264|   150k|    ri->filter = next_filter;
 3265|       |
 3266|   150k|    return 0;
 3267|   150k|}
spng.c:u16_row_to_host:
  524|  18.7k|{
  525|  18.7k|    uint16_t *px = row;
  526|  18.7k|    size_t i, n = size / 2;
  527|       |
  528|  3.37M|    for(i=0; i < n; i++)
  ------------------
  |  Branch (528:14): [True: 3.35M, False: 18.7k]
  ------------------
  529|  3.35M|    {
  530|  3.35M|        px[i] = read_u16(&px[i]);
  531|  3.35M|    }
  532|  18.7k|}
spng.c:defilter_scanline:
 1463|   150k|{
 1464|   150k|    if(prev_scanline == NULL || scanline == NULL || !scanline_width) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1464:8): [True: 0, False: 150k]
  |  Branch (1464:33): [True: 0, False: 150k]
  |  Branch (1464:53): [True: 0, False: 150k]
  ------------------
 1465|       |
 1466|   150k|    size_t i;
 1467|   150k|    scanline_width--;
 1468|       |
 1469|   150k|    if(filter == 0) return 0;
  ------------------
  |  Branch (1469:8): [True: 86.5k, False: 63.8k]
  ------------------
 1470|       |
 1471|  63.8k|#ifndef SPNG_DISABLE_OPT
 1472|  63.8k|    if(filter == SPNG_FILTER_UP) goto no_opt;
  ------------------
  |  Branch (1472:8): [True: 10.8k, False: 52.9k]
  ------------------
 1473|       |
 1474|  52.9k|    if(bytes_per_pixel == 4)
  ------------------
  |  Branch (1474:8): [True: 0, False: 52.9k]
  ------------------
 1475|      0|    {
 1476|      0|        if(filter == SPNG_FILTER_SUB)
  ------------------
  |  Branch (1476:12): [True: 0, False: 0]
  ------------------
 1477|      0|            defilter_sub4(scanline_width, scanline);
 1478|      0|        else if(filter == SPNG_FILTER_AVERAGE)
  ------------------
  |  Branch (1478:17): [True: 0, False: 0]
  ------------------
 1479|      0|            defilter_avg4(scanline_width, scanline, prev_scanline);
 1480|      0|        else if(filter == SPNG_FILTER_PAETH)
  ------------------
  |  Branch (1480:17): [True: 0, False: 0]
  ------------------
 1481|      0|            defilter_paeth4(scanline_width, scanline, prev_scanline);
 1482|      0|        else return SPNG_EFILTER;
 1483|       |
 1484|      0|        return 0;
 1485|      0|    }
 1486|  52.9k|    else if(bytes_per_pixel == 3)
  ------------------
  |  Branch (1486:13): [True: 18.5k, False: 34.3k]
  ------------------
 1487|  18.5k|    {
 1488|  18.5k|        if(filter == SPNG_FILTER_SUB)
  ------------------
  |  Branch (1488:12): [True: 9.26k, False: 9.33k]
  ------------------
 1489|  9.26k|            defilter_sub3(scanline_width, scanline);
 1490|  9.33k|        else if(filter == SPNG_FILTER_AVERAGE)
  ------------------
  |  Branch (1490:17): [True: 4.72k, False: 4.60k]
  ------------------
 1491|  4.72k|            defilter_avg3(scanline_width, scanline, prev_scanline);
 1492|  4.60k|        else if(filter == SPNG_FILTER_PAETH)
  ------------------
  |  Branch (1492:17): [True: 4.60k, False: 0]
  ------------------
 1493|  4.60k|            defilter_paeth3(scanline_width, scanline, prev_scanline);
 1494|      0|        else return SPNG_EFILTER;
 1495|       |
 1496|  18.5k|        return 0;
 1497|  18.5k|    }
 1498|  45.2k|no_opt:
 1499|  45.2k|#endif
 1500|       |
 1501|  45.2k|    if(filter == SPNG_FILTER_UP)
  ------------------
  |  Branch (1501:8): [True: 10.8k, False: 34.3k]
  ------------------
 1502|  10.8k|    {
 1503|  10.8k|        defilter_up(scanline_width, scanline, prev_scanline);
 1504|  10.8k|        return 0;
 1505|  10.8k|    }
 1506|       |
 1507|  5.53M|    for(i=0; i < scanline_width; i++)
  ------------------
  |  Branch (1507:14): [True: 5.50M, False: 34.3k]
  ------------------
 1508|  5.50M|    {
 1509|  5.50M|        uint8_t x, a, b, c;
 1510|       |
 1511|  5.50M|        if(i >= bytes_per_pixel)
  ------------------
  |  Branch (1511:12): [True: 5.44M, False: 60.6k]
  ------------------
 1512|  5.44M|        {
 1513|  5.44M|            a = scanline[i - bytes_per_pixel];
 1514|  5.44M|            b = prev_scanline[i];
 1515|  5.44M|            c = prev_scanline[i - bytes_per_pixel];
 1516|  5.44M|        }
 1517|  60.6k|        else /* First pixel in row */
 1518|  60.6k|        {
 1519|  60.6k|            a = 0;
 1520|  60.6k|            b = prev_scanline[i];
 1521|  60.6k|            c = 0;
 1522|  60.6k|        }
 1523|       |
 1524|  5.50M|        x = scanline[i];
 1525|       |
 1526|  5.50M|        switch(filter)
  ------------------
  |  Branch (1526:16): [True: 5.50M, False: 0]
  ------------------
 1527|  5.50M|        {
 1528|  1.04M|            case SPNG_FILTER_SUB:
  ------------------
  |  Branch (1528:13): [True: 1.04M, False: 4.46M]
  ------------------
 1529|  1.04M|            {
 1530|  1.04M|                x = x + a;
 1531|  1.04M|                break;
 1532|      0|            }
 1533|  3.45M|            case SPNG_FILTER_AVERAGE:
  ------------------
  |  Branch (1533:13): [True: 3.45M, False: 2.05M]
  ------------------
 1534|  3.45M|            {
 1535|  3.45M|                uint16_t avg = (a + b) / 2;
 1536|  3.45M|                x = x + avg;
 1537|  3.45M|                break;
 1538|      0|            }
 1539|  1.00M|            case SPNG_FILTER_PAETH:
  ------------------
  |  Branch (1539:13): [True: 1.00M, False: 4.49M]
  ------------------
 1540|  1.00M|            {
 1541|  1.00M|                x = x + paeth(a,b,c);
 1542|  1.00M|                break;
 1543|      0|            }
 1544|  5.50M|        }
 1545|       |
 1546|  5.50M|        scanline[i] = x;
 1547|  5.50M|    }
 1548|       |
 1549|  34.3k|    return 0;
 1550|  34.3k|}
spng.c:load4:
 6246|  4.05M|{
 6247|  4.05M|    int tmp;
 6248|  4.05M|    memcpy(&tmp, p, sizeof(tmp));
 6249|  4.05M|    return _mm_cvtsi32_si128(tmp);
 6250|  4.05M|}
spng.c:abs_i16:
 6410|  1.86M|{
 6411|       |#if defined(__SSSE3__) || defined(__AVX__)
 6412|       |    return _mm_abs_epi16(x);
 6413|       |#else
 6414|       |    /* Read this all as, return x<0 ? -x : x.
 6415|       |     * To negate two's complement, you flip all the bits then add 1.
 6416|       |     */
 6417|  1.86M|    __m128i is_negative = _mm_cmplt_epi16(x, _mm_setzero_si128());
 6418|       |
 6419|       |    /* Flip negative lanes. */
 6420|  1.86M|    x = _mm_xor_si128(x, is_negative);
 6421|       |
 6422|       |    /* +1 to negative lanes, else +0. */
 6423|  1.86M|    x = _mm_sub_epi16(x, is_negative);
 6424|  1.86M|    return x;
 6425|  1.86M|#endif
 6426|  1.86M|}
spng.c:if_then_else:
 6430|  1.24M|{
 6431|       |#if defined(__SSE4_1__) || defined(__AVX__)
 6432|       |    return _mm_blendv_epi8(e, t, c);
 6433|       |#else
 6434|  1.24M|    return _mm_or_si128(_mm_and_si128(c, t), _mm_andnot_si128(c, e));
 6435|  1.24M|#endif
 6436|  1.24M|}
spng.c:defilter_sub3:
 6272|  9.26k|{
 6273|       |    /* The Sub filter predicts each pixel as the previous pixel, a.
 6274|       |     * There is no pixel to the left of the first pixel.  It's encoded directly.
 6275|       |     * That works with our main loop if we just say that left pixel was zero.
 6276|       |     */
 6277|  9.26k|    size_t rb = rowbytes;
 6278|       |
 6279|  9.26k|    __m128i a, d = _mm_setzero_si128();
 6280|       |
 6281|  1.74M|    while(rb >= 4)
  ------------------
  |  Branch (6281:11): [True: 1.73M, False: 9.26k]
  ------------------
 6282|  1.73M|    {
 6283|  1.73M|        a = d; d = load4(row);
 6284|  1.73M|        d = _mm_add_epi8(d, a);
 6285|  1.73M|        store3(row, d);
 6286|       |
 6287|  1.73M|        row += 3;
 6288|  1.73M|        rb  -= 3;
 6289|  1.73M|    }
 6290|       |
 6291|  9.26k|    if(rb > 0)
  ------------------
  |  Branch (6291:8): [True: 9.26k, False: 0]
  ------------------
 6292|  9.26k|    {
 6293|  9.26k|        a = d; d = load3(row);
 6294|  9.26k|        d = _mm_add_epi8(d, a);
 6295|  9.26k|        store3(row, d);
 6296|  9.26k|    }
 6297|  9.26k|}
spng.c:store3:
 6266|  2.91M|{
 6267|  2.91M|    int tmp = _mm_cvtsi128_si32(v);
 6268|  2.91M|    memcpy(p, &tmp, 3);
 6269|  2.91M|}
spng.c:load3:
 6259|  27.9k|{
 6260|  27.9k|    uint32_t tmp = 0;
 6261|  27.9k|    memcpy(&tmp, p, 3);
 6262|  27.9k|    return _mm_cvtsi32_si128(tmp);
 6263|  27.9k|}
spng.c:defilter_avg3:
 6321|  4.72k|{
 6322|       |    /* The Avg filter predicts each pixel as the (truncated) average of a and b.
 6323|       |     * There's no pixel to the left of the first pixel.  Luckily, it's
 6324|       |     * predicted to be half of the pixel above it.  So again, this works
 6325|       |     * perfectly with our loop if we make sure a starts at zero.
 6326|       |     */
 6327|       |
 6328|  4.72k|    size_t rb = rowbytes;
 6329|       |
 6330|  4.72k|    const __m128i zero = _mm_setzero_si128();
 6331|       |
 6332|  4.72k|    __m128i b;
 6333|  4.72k|    __m128i a, d = zero;
 6334|       |
 6335|   547k|    while(rb >= 4)
  ------------------
  |  Branch (6335:11): [True: 543k, False: 4.72k]
  ------------------
 6336|   543k|    {
 6337|   543k|        __m128i avg;
 6338|   543k|               b = load4(prev);
 6339|   543k|        a = d; d = load4(row );
 6340|       |
 6341|       |        /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
 6342|   543k|        avg = _mm_avg_epu8(a,b);
 6343|       |        /* ...but we can fix it up by subtracting off 1 if it rounded up. */
 6344|   543k|        avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a, b),
 6345|   543k|                                            _mm_set1_epi8(1)));
 6346|   543k|        d = _mm_add_epi8(d, avg);
 6347|   543k|        store3(row, d);
 6348|       |
 6349|   543k|        prev += 3;
 6350|   543k|        row  += 3;
 6351|   543k|        rb   -= 3;
 6352|   543k|    }
 6353|       |
 6354|  4.72k|    if(rb > 0)
  ------------------
  |  Branch (6354:8): [True: 4.72k, False: 0]
  ------------------
 6355|  4.72k|    {
 6356|  4.72k|        __m128i avg;
 6357|  4.72k|               b = load3(prev);
 6358|  4.72k|        a = d; d = load3(row );
 6359|       |
 6360|       |        /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
 6361|  4.72k|        avg = _mm_avg_epu8(a, b);
 6362|       |        /* ...but we can fix it up by subtracting off 1 if it rounded up. */
 6363|  4.72k|        avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a, b),
 6364|  4.72k|                                            _mm_set1_epi8(1)));
 6365|       |
 6366|  4.72k|        d = _mm_add_epi8(d, avg);
 6367|  4.72k|        store3(row, d);
 6368|  4.72k|    }
 6369|  4.72k|}
spng.c:defilter_paeth3:
 6439|  4.60k|{
 6440|       |    /* Paeth tries to predict pixel d using the pixel to the left of it, a,
 6441|       |     * and two pixels from the previous row, b and c:
 6442|       |     *   prev: c b
 6443|       |     *   row:  a d
 6444|       |     * The Paeth function predicts d to be whichever of a, b, or c is nearest to
 6445|       |     * p=a+b-c.
 6446|       |     *
 6447|       |     * The first pixel has no left context, and so uses an Up filter, p = b.
 6448|       |     * This works naturally with our main loop's p = a+b-c if we force a and c
 6449|       |     * to zero.
 6450|       |     * Here we zero b and d, which become c and a respectively at the start of
 6451|       |     * the loop.
 6452|       |     */
 6453|  4.60k|    size_t rb = rowbytes;
 6454|  4.60k|    const __m128i zero = _mm_setzero_si128();
 6455|  4.60k|    __m128i c, b = zero,
 6456|  4.60k|            a, d = zero;
 6457|       |
 6458|   622k|    while(rb >= 4)
  ------------------
  |  Branch (6458:11): [True: 617k, False: 4.60k]
  ------------------
 6459|   617k|    {
 6460|       |        /* It's easiest to do this math (particularly, deal with pc) with 16-bit
 6461|       |         * intermediates.
 6462|       |         */
 6463|   617k|        __m128i pa,pb,pc,smallest,nearest;
 6464|   617k|        c = b; b = _mm_unpacklo_epi8(load4(prev), zero);
 6465|   617k|        a = d; d = _mm_unpacklo_epi8(load4(row ), zero);
 6466|       |
 6467|       |        /* (p-a) == (a+b-c - a) == (b-c) */
 6468|       |
 6469|   617k|        pa = _mm_sub_epi16(b, c);
 6470|       |
 6471|       |        /* (p-b) == (a+b-c - b) == (a-c) */
 6472|   617k|        pb = _mm_sub_epi16(a, c);
 6473|       |
 6474|       |        /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
 6475|   617k|        pc = _mm_add_epi16(pa, pb);
 6476|       |
 6477|   617k|        pa = abs_i16(pa);  /* |p-a| */
 6478|   617k|        pb = abs_i16(pb);  /* |p-b| */
 6479|   617k|        pc = abs_i16(pc);  /* |p-c| */
 6480|       |
 6481|   617k|        smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
 6482|       |
 6483|       |        /* Paeth breaks ties favoring a over b over c. */
 6484|   617k|        nearest  = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
 6485|   617k|                            if_then_else(_mm_cmpeq_epi16(smallest, pb), b, c));
 6486|       |
 6487|       |        /* Note `_epi8`: we need addition to wrap modulo 255. */
 6488|   617k|        d = _mm_add_epi8(d, nearest);
 6489|   617k|        store3(row, _mm_packus_epi16(d, d));
 6490|       |
 6491|   617k|        prev += 3;
 6492|   617k|        row  += 3;
 6493|   617k|        rb   -= 3;
 6494|   617k|    }
 6495|       |
 6496|  4.60k|    if(rb > 0)
  ------------------
  |  Branch (6496:8): [True: 4.60k, False: 0]
  ------------------
 6497|  4.60k|    {
 6498|       |        /* It's easiest to do this math (particularly, deal with pc) with 16-bit
 6499|       |         * intermediates.
 6500|       |         */
 6501|  4.60k|        __m128i pa, pb, pc, smallest, nearest;
 6502|  4.60k|        c = b; b = _mm_unpacklo_epi8(load3(prev), zero);
 6503|  4.60k|        a = d; d = _mm_unpacklo_epi8(load3(row ), zero);
 6504|       |
 6505|       |        /* (p-a) == (a+b-c - a) == (b-c) */
 6506|  4.60k|        pa = _mm_sub_epi16(b, c);
 6507|       |
 6508|       |        /* (p-b) == (a+b-c - b) == (a-c) */
 6509|  4.60k|        pb = _mm_sub_epi16(a, c);
 6510|       |
 6511|       |        /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
 6512|  4.60k|        pc = _mm_add_epi16(pa, pb);
 6513|       |
 6514|  4.60k|        pa = abs_i16(pa);  /* |p-a| */
 6515|  4.60k|        pb = abs_i16(pb);  /* |p-b| */
 6516|  4.60k|        pc = abs_i16(pc);  /* |p-c| */
 6517|       |
 6518|  4.60k|        smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
 6519|       |
 6520|       |        /* Paeth breaks ties favoring a over b over c. */
 6521|  4.60k|        nearest  = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
 6522|  4.60k|                            if_then_else(_mm_cmpeq_epi16(smallest, pb), b, c));
 6523|       |
 6524|       |        /* Note `_epi8`: we need addition to wrap modulo 255. */
 6525|  4.60k|        d = _mm_add_epi8(d, nearest);
 6526|  4.60k|        store3(row, _mm_packus_epi16(d, d));
 6527|  4.60k|    }
 6528|  4.60k|}
spng.c:defilter_up:
 1449|  10.8k|{
 1450|  10.8k|    size_t i;
 1451|  3.20M|    for(i=0; i < bytes; i++)
  ------------------
  |  Branch (1451:14): [True: 3.19M, False: 10.8k]
  ------------------
 1452|  3.19M|    {
 1453|  3.19M|        row[i] += prev[i];
 1454|  3.19M|    }
 1455|  10.8k|}
spng.c:paeth:
 1435|  1.00M|{
 1436|  1.00M|    int16_t p = a + b - c;
 1437|  1.00M|    int16_t pa = abs(p - a);
 1438|  1.00M|    int16_t pb = abs(p - b);
 1439|  1.00M|    int16_t pc = abs(p - c);
 1440|       |
 1441|  1.00M|    if(pa <= pb && pa <= pc) return a;
  ------------------
  |  Branch (1441:8): [True: 600k, False: 409k]
  |  Branch (1441:20): [True: 566k, False: 33.3k]
  ------------------
 1442|   443k|    else if(pb <= pc) return b;
  ------------------
  |  Branch (1442:13): [True: 377k, False: 65.4k]
  ------------------
 1443|       |
 1444|  65.4k|    return c;
 1445|  1.00M|}
spng.c:decode_err:
  764|  34.3k|{
  765|  34.3k|    ctx->state = SPNG_STATE_INVALID;
  766|       |
  767|  34.3k|    return err;
  768|  34.3k|}
spng.c:update_row_info:
 3270|   150k|{
 3271|   150k|    int interlacing = ctx->ihdr.interlace_method;
 3272|   150k|    struct spng_row_info *ri = &ctx->row_info;
 3273|   150k|    const struct spng_subimage *sub = ctx->subimage;
 3274|       |
 3275|   150k|    if(ri->scanline_idx == (sub[ri->pass].height - 1)) /* Last scanline */
  ------------------
  |  Branch (3275:8): [True: 2.31k, False: 148k]
  ------------------
 3276|  2.31k|    {
 3277|  2.31k|        if(ri->pass == ctx->last_pass)
  ------------------
  |  Branch (3277:12): [True: 1.71k, False: 606]
  ------------------
 3278|  1.71k|        {
 3279|  1.71k|            ctx->state = SPNG_STATE_EOI;
 3280|       |
 3281|  1.71k|            return SPNG_EOI;
 3282|  1.71k|        }
 3283|       |
 3284|    606|        ri->scanline_idx = 0;
 3285|    606|        ri->pass++;
 3286|       |
 3287|       |        /* Skip empty passes */
 3288|    606|        while( (!sub[ri->pass].width || !sub[ri->pass].height) && (ri->pass < ctx->last_pass)) ri->pass++;
  ------------------
  |  Branch (3288:17): [True: 0, False: 606]
  |  Branch (3288:41): [True: 0, False: 606]
  |  Branch (3288:67): [True: 0, False: 0]
  ------------------
 3289|    606|    }
 3290|   148k|    else
 3291|   148k|    {
 3292|   148k|        ri->row_num++;
 3293|   148k|        ri->scanline_idx++;
 3294|   148k|    }
 3295|       |
 3296|   148k|    if(interlacing) ri->row_num = adam7_y_start[ri->pass] + ri->scanline_idx * adam7_y_delta[ri->pass];
  ------------------
  |  Branch (3296:8): [True: 93.5k, False: 55.1k]
  ------------------
 3297|       |
 3298|   148k|    return 0;
 3299|   150k|}
spng.c:discard_chunk_bytes:
 1160|   374k|{
 1161|   374k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1161:8): [True: 0, False: 374k]
  ------------------
 1162|   374k|    if(!bytes) return 0;
  ------------------
  |  Branch (1162:8): [True: 336k, False: 37.7k]
  ------------------
 1163|       |
 1164|  37.7k|    int ret;
 1165|       |
 1166|  37.7k|    if(ctx->streaming) /* Do small, consecutive reads */
  ------------------
  |  Branch (1166:8): [True: 37.7k, False: 0]
  ------------------
 1167|  37.7k|    {
 1168|  79.3k|        while(bytes)
  ------------------
  |  Branch (1168:15): [True: 45.9k, False: 33.4k]
  ------------------
 1169|  45.9k|        {
 1170|  45.9k|            uint32_t len = SPNG_READ_SIZE;
  ------------------
  |  |   30|  45.9k|#define SPNG_READ_SIZE (8192)
  ------------------
 1171|       |
 1172|  45.9k|            if(len > bytes) len = bytes;
  ------------------
  |  Branch (1172:16): [True: 34.0k, False: 11.8k]
  ------------------
 1173|       |
 1174|  45.9k|            ret = read_chunk_bytes(ctx, len);
 1175|  45.9k|            if(ret) return ret;
  ------------------
  |  Branch (1175:16): [True: 4.31k, False: 41.6k]
  ------------------
 1176|       |
 1177|  41.6k|            bytes -= len;
 1178|  41.6k|        }
 1179|  37.7k|    }
 1180|      0|    else
 1181|      0|    {
 1182|      0|        ret = read_chunk_bytes(ctx, bytes);
 1183|      0|        if(ret) return ret;
  ------------------
  |  Branch (1183:12): [True: 0, False: 0]
  ------------------
 1184|      0|    }
 1185|       |
 1186|  33.4k|    return 0;
 1187|  37.7k|}
spng.c:read_chunk_bytes:
 1106|   394k|{
 1107|   394k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1107:8): [True: 0, False: 394k]
  ------------------
 1108|   394k|    if(!ctx->cur_chunk_bytes_left || !bytes) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1108:8): [True: 47.4k, False: 347k]
  |  Branch (1108:38): [True: 0, False: 347k]
  ------------------
 1109|   347k|    if(bytes > ctx->cur_chunk_bytes_left) return SPNG_EINTERNAL; /* XXX: more specific error? */
  ------------------
  |  Branch (1109:8): [True: 0, False: 347k]
  ------------------
 1110|       |
 1111|   347k|    int ret;
 1112|       |
 1113|   347k|    ret = read_data(ctx, bytes);
 1114|   347k|    if(ret) return ret;
  ------------------
  |  Branch (1114:8): [True: 6.86k, False: 340k]
  ------------------
 1115|       |
 1116|   340k|    if(!ctx->skip_crc) ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, ctx->data, bytes);
  ------------------
  |  |   46|   340k|#  define crc32                 z_crc32
  ------------------
  |  Branch (1116:8): [True: 340k, False: 0]
  ------------------
 1117|       |
 1118|   340k|    ctx->cur_chunk_bytes_left -= bytes;
 1119|       |
 1120|   340k|    return ret;
 1121|   347k|}
spng.c:read_data:
  778|  1.19M|{
  779|  1.19M|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (779:8): [True: 0, False: 1.19M]
  ------------------
  780|  1.19M|    if(!bytes) return 0;
  ------------------
  |  Branch (780:8): [True: 0, False: 1.19M]
  ------------------
  781|       |
  782|  1.19M|    if(ctx->streaming && (bytes > SPNG_READ_SIZE)) return SPNG_EINTERNAL;
  ------------------
  |  |   30|  1.19M|#define SPNG_READ_SIZE (8192)
  ------------------
  |  Branch (782:8): [True: 1.19M, False: 0]
  |  Branch (782:26): [True: 0, False: 1.19M]
  ------------------
  783|       |
  784|  1.19M|    int ret = ctx->read_fn(ctx, ctx->stream_user_ptr, ctx->stream_buf, bytes);
  785|       |
  786|  1.19M|    if(ret)
  ------------------
  |  Branch (786:8): [True: 32.1k, False: 1.15M]
  ------------------
  787|  32.1k|    {
  788|  32.1k|        if(ret > 0 || ret < SPNG_IO_ERROR) ret = SPNG_IO_ERROR;
  ------------------
  |  Branch (788:12): [True: 0, False: 32.1k]
  |  Branch (788:23): [True: 0, False: 32.1k]
  ------------------
  789|       |
  790|  32.1k|        return ret;
  791|  32.1k|    }
  792|       |
  793|  1.15M|    ctx->bytes_read += bytes;
  794|  1.15M|    if(ctx->bytes_read < bytes) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (794:8): [True: 0, False: 1.15M]
  ------------------
  795|       |
  796|  1.15M|    return 0;
  797|  1.15M|}
spng.c:read_chunks:
 3117|  67.2k|{
 3118|  67.2k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (3118:8): [True: 0, False: 67.2k]
  ------------------
 3119|  67.2k|    if(!ctx->state) return SPNG_EBADSTATE;
  ------------------
  |  Branch (3119:8): [True: 0, False: 67.2k]
  ------------------
 3120|  67.2k|    if(ctx->data == NULL)
  ------------------
  |  Branch (3120:8): [True: 0, False: 67.2k]
  ------------------
 3121|      0|    {
 3122|      0|        if(ctx->encode_only) return 0;
  ------------------
  |  Branch (3122:12): [True: 0, False: 0]
  ------------------
 3123|      0|        else return SPNG_EINTERNAL;
 3124|      0|    }
 3125|       |
 3126|  67.2k|    int ret = 0;
 3127|       |
 3128|  67.2k|    if(ctx->state == SPNG_STATE_INPUT)
  ------------------
  |  Branch (3128:8): [True: 30.7k, False: 36.5k]
  ------------------
 3129|  30.7k|    {
 3130|  30.7k|        ret = read_ihdr(ctx);
 3131|       |
 3132|  30.7k|        if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3132:12): [True: 1.65k, False: 29.0k]
  ------------------
 3133|       |
 3134|  29.0k|        ctx->state = SPNG_STATE_IHDR;
 3135|  29.0k|    }
 3136|       |
 3137|  65.6k|    if(only_ihdr) return 0;
  ------------------
  |  Branch (3137:8): [True: 29.0k, False: 36.5k]
  ------------------
 3138|       |
 3139|  36.5k|    if(ctx->state == SPNG_STATE_EOI)
  ------------------
  |  Branch (3139:8): [True: 1.64k, False: 34.9k]
  ------------------
 3140|  1.64k|    {
 3141|  1.64k|        ctx->state = SPNG_STATE_AFTER_IDAT;
 3142|  1.64k|        ctx->prev_was_idat = 1;
 3143|  1.64k|    }
 3144|       |
 3145|   334k|    while(ctx->state < SPNG_STATE_FIRST_IDAT || ctx->state == SPNG_STATE_AFTER_IDAT)
  ------------------
  |  Branch (3145:11): [True: 315k, False: 19.1k]
  |  Branch (3145:49): [True: 5.59k, False: 13.5k]
  ------------------
 3146|   320k|    {
 3147|   320k|        ret = read_non_idat_chunks(ctx);
 3148|       |
 3149|   320k|        if(!ret)
  ------------------
  |  Branch (3149:12): [True: 7.71k, False: 313k]
  ------------------
 3150|  7.71k|        {
 3151|  7.71k|            if(ctx->state < SPNG_STATE_FIRST_IDAT) ctx->state = SPNG_STATE_FIRST_IDAT;
  ------------------
  |  Branch (3151:16): [True: 7.64k, False: 72]
  ------------------
 3152|     72|            else if(ctx->state == SPNG_STATE_AFTER_IDAT) ctx->state = SPNG_STATE_IEND;
  ------------------
  |  Branch (3152:21): [True: 72, False: 0]
  ------------------
 3153|  7.71k|        }
 3154|   313k|        else
 3155|   313k|        {
 3156|   313k|            switch(ret)
 3157|   313k|            {
 3158|  4.50k|                case SPNG_ECHUNK_POS:
  ------------------
  |  Branch (3158:17): [True: 4.50k, False: 308k]
  ------------------
 3159|  35.9k|                case SPNG_ECHUNK_SIZE: /* size != expected size, SPNG_ECHUNK_STDLEN = invalid size */
  ------------------
  |  Branch (3159:17): [True: 31.4k, False: 281k]
  ------------------
 3160|  35.9k|                case SPNG_EDUP_PLTE:
  ------------------
  |  Branch (3160:17): [True: 0, False: 313k]
  ------------------
 3161|  38.5k|                case SPNG_EDUP_CHRM:
  ------------------
  |  Branch (3161:17): [True: 2.63k, False: 310k]
  ------------------
 3162|  39.4k|                case SPNG_EDUP_GAMA:
  ------------------
  |  Branch (3162:17): [True: 882, False: 312k]
  ------------------
 3163|  39.9k|                case SPNG_EDUP_ICCP:
  ------------------
  |  Branch (3163:17): [True: 532, False: 312k]
  ------------------
 3164|  40.7k|                case SPNG_EDUP_SBIT:
  ------------------
  |  Branch (3164:17): [True: 777, False: 312k]
  ------------------
 3165|  40.8k|                case SPNG_EDUP_SRGB:
  ------------------
  |  Branch (3165:17): [True: 77, False: 312k]
  ------------------
 3166|  43.0k|                case SPNG_EDUP_BKGD:
  ------------------
  |  Branch (3166:17): [True: 2.24k, False: 310k]
  ------------------
 3167|  43.1k|                case SPNG_EDUP_HIST:
  ------------------
  |  Branch (3167:17): [True: 84, False: 312k]
  ------------------
 3168|  43.5k|                case SPNG_EDUP_TRNS:
  ------------------
  |  Branch (3168:17): [True: 357, False: 312k]
  ------------------
 3169|  44.0k|                case SPNG_EDUP_PHYS:
  ------------------
  |  Branch (3169:17): [True: 567, False: 312k]
  ------------------
 3170|  48.4k|                case SPNG_EDUP_TIME:
  ------------------
  |  Branch (3170:17): [True: 4.34k, False: 308k]
  ------------------
 3171|  48.9k|                case SPNG_EDUP_OFFS:
  ------------------
  |  Branch (3171:17): [True: 476, False: 312k]
  ------------------
 3172|  49.3k|                case SPNG_EDUP_EXIF:
  ------------------
  |  Branch (3172:17): [True: 413, False: 312k]
  ------------------
 3173|  50.4k|                case SPNG_ECHRM:
  ------------------
  |  Branch (3173:17): [True: 1.12k, False: 311k]
  ------------------
 3174|  50.4k|                case SPNG_ETRNS_COLOR_TYPE:
  ------------------
  |  Branch (3174:17): [True: 0, False: 313k]
  ------------------
 3175|  50.4k|                case SPNG_ETRNS_NO_PLTE:
  ------------------
  |  Branch (3175:17): [True: 0, False: 313k]
  ------------------
 3176|  50.9k|                case SPNG_EGAMA:
  ------------------
  |  Branch (3176:17): [True: 532, False: 312k]
  ------------------
 3177|  51.1k|                case SPNG_EICCP_NAME:
  ------------------
  |  Branch (3177:17): [True: 168, False: 312k]
  ------------------
 3178|  51.3k|                case SPNG_EICCP_COMPRESSION_METHOD:
  ------------------
  |  Branch (3178:17): [True: 210, False: 312k]
  ------------------
 3179|  55.9k|                case SPNG_ESBIT:
  ------------------
  |  Branch (3179:17): [True: 4.64k, False: 308k]
  ------------------
 3180|  56.1k|                case SPNG_ESRGB:
  ------------------
  |  Branch (3180:17): [True: 147, False: 312k]
  ------------------
 3181|  56.1k|                case SPNG_ETEXT:
  ------------------
  |  Branch (3181:17): [True: 0, False: 313k]
  ------------------
 3182|  59.1k|                case SPNG_ETEXT_KEYWORD:
  ------------------
  |  Branch (3182:17): [True: 2.98k, False: 310k]
  ------------------
 3183|  59.6k|                case SPNG_EZTXT:
  ------------------
  |  Branch (3183:17): [True: 518, False: 312k]
  ------------------
 3184|  60.6k|                case SPNG_EZTXT_COMPRESSION_METHOD:
  ------------------
  |  Branch (3184:17): [True: 980, False: 312k]
  ------------------
 3185|  65.8k|                case SPNG_EITXT:
  ------------------
  |  Branch (3185:17): [True: 5.25k, False: 307k]
  ------------------
 3186|  67.7k|                case SPNG_EITXT_COMPRESSION_FLAG:
  ------------------
  |  Branch (3186:17): [True: 1.90k, False: 311k]
  ------------------
 3187|  71.5k|                case SPNG_EITXT_COMPRESSION_METHOD:
  ------------------
  |  Branch (3187:17): [True: 3.75k, False: 309k]
  ------------------
 3188|  72.0k|                case SPNG_EITXT_LANG_TAG:
  ------------------
  |  Branch (3188:17): [True: 511, False: 312k]
  ------------------
 3189|  72.0k|                case SPNG_EITXT_TRANSLATED_KEY:
  ------------------
  |  Branch (3189:17): [True: 0, False: 313k]
  ------------------
 3190|  72.4k|                case SPNG_EBKGD_NO_PLTE:
  ------------------
  |  Branch (3190:17): [True: 434, False: 312k]
  ------------------
 3191|  72.6k|                case SPNG_EBKGD_PLTE_IDX:
  ------------------
  |  Branch (3191:17): [True: 168, False: 312k]
  ------------------
 3192|  72.7k|                case SPNG_EHIST_NO_PLTE:
  ------------------
  |  Branch (3192:17): [True: 147, False: 312k]
  ------------------
 3193|  74.4k|                case SPNG_EPHYS:
  ------------------
  |  Branch (3193:17): [True: 1.65k, False: 311k]
  ------------------
 3194|  89.7k|                case SPNG_ESPLT_NAME:
  ------------------
  |  Branch (3194:17): [True: 15.2k, False: 297k]
  ------------------
 3195|  94.0k|                case SPNG_ESPLT_DUP_NAME:
  ------------------
  |  Branch (3195:17): [True: 4.31k, False: 308k]
  ------------------
 3196|  94.5k|                case SPNG_ESPLT_DEPTH:
  ------------------
  |  Branch (3196:17): [True: 497, False: 312k]
  ------------------
 3197|   109k|                case SPNG_ETIME:
  ------------------
  |  Branch (3197:17): [True: 14.7k, False: 298k]
  ------------------
 3198|   109k|                case SPNG_EOFFS:
  ------------------
  |  Branch (3198:17): [True: 497, False: 312k]
  ------------------
 3199|   110k|                case SPNG_EEXIF:
  ------------------
  |  Branch (3199:17): [True: 462, False: 312k]
  ------------------
 3200|   293k|                case SPNG_EZLIB:
  ------------------
  |  Branch (3200:17): [True: 183k, False: 130k]
  ------------------
 3201|   293k|                {
 3202|   293k|                    if(!ctx->strict && !is_critical_chunk(&ctx->current_chunk))
  ------------------
  |  Branch (3202:24): [True: 293k, False: 0]
  |  Branch (3202:40): [True: 292k, False: 385]
  ------------------
 3203|   292k|                    {
 3204|   292k|                        ret = discard_chunk_bytes(ctx, ctx->cur_chunk_bytes_left);
 3205|   292k|                        if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3205:28): [True: 2.79k, False: 290k]
  ------------------
 3206|       |
 3207|   290k|                        if(ctx->undo) ctx->undo(ctx);
  ------------------
  |  Branch (3207:28): [True: 239k, False: 50.1k]
  ------------------
 3208|       |
 3209|   290k|                        ctx->stored = ctx->prev_stored;
 3210|       |
 3211|   290k|                        ctx->discard = 0;
 3212|   290k|                        ctx->undo = NULL;
 3213|       |
 3214|   290k|                        continue;
 3215|   292k|                    }
 3216|    385|                    else return decode_err(ctx, ret);
 3217|       |
 3218|      0|                    break;
 3219|   293k|                }
 3220|  19.8k|                default: return decode_err(ctx, ret);
  ------------------
  |  Branch (3220:17): [True: 19.8k, False: 293k]
  ------------------
 3221|   313k|            }
 3222|   313k|        }
 3223|   320k|    }
 3224|       |
 3225|  13.5k|    return ret;
 3226|  36.5k|}
spng.c:read_ihdr:
 2278|  30.7k|{
 2279|  30.7k|    int ret;
 2280|  30.7k|    struct spng_chunk *chunk = &ctx->current_chunk;
 2281|  30.7k|    const unsigned char *data;
 2282|       |
 2283|  30.7k|    chunk->offset = 8;
 2284|  30.7k|    chunk->length = 13;
 2285|  30.7k|    size_t sizeof_sig_ihdr = 29;
 2286|       |
 2287|  30.7k|    ret = read_data(ctx, sizeof_sig_ihdr);
 2288|  30.7k|    if(ret) return ret;
  ------------------
  |  Branch (2288:8): [True: 7, False: 30.7k]
  ------------------
 2289|       |
 2290|  30.7k|    data = ctx->data;
 2291|       |
 2292|  30.7k|    if(memcmp(data, spng_signature, sizeof(spng_signature))) return SPNG_ESIGNATURE;
  ------------------
  |  Branch (2292:8): [True: 238, False: 30.4k]
  ------------------
 2293|       |
 2294|  30.4k|    chunk->length = read_u32(data + 8);
 2295|  30.4k|    memcpy(&chunk->type, data + 12, 4);
 2296|       |
 2297|  30.4k|    if(chunk->length != 13) return SPNG_EIHDR_SIZE;
  ------------------
  |  Branch (2297:8): [True: 322, False: 30.1k]
  ------------------
 2298|  30.1k|    if(memcmp(chunk->type, type_ihdr, 4)) return SPNG_ENOIHDR;
  ------------------
  |  Branch (2298:8): [True: 56, False: 30.1k]
  ------------------
 2299|       |
 2300|  30.1k|    ctx->cur_actual_crc = crc32(0, NULL, 0);
  ------------------
  |  |   46|  30.1k|#  define crc32                 z_crc32
  ------------------
 2301|  30.1k|    ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, data + 12, 17);
  ------------------
  |  |   46|  30.1k|#  define crc32                 z_crc32
  ------------------
 2302|       |
 2303|  30.1k|    ctx->ihdr.width = read_u32(data + 16);
 2304|  30.1k|    ctx->ihdr.height = read_u32(data + 20);
 2305|  30.1k|    ctx->ihdr.bit_depth = data[24];
 2306|  30.1k|    ctx->ihdr.color_type = data[25];
 2307|  30.1k|    ctx->ihdr.compression_method = data[26];
 2308|  30.1k|    ctx->ihdr.filter_method = data[27];
 2309|  30.1k|    ctx->ihdr.interlace_method = data[28];
 2310|       |
 2311|  30.1k|    ret = check_ihdr(&ctx->ihdr, ctx->max_width, ctx->max_height);
 2312|  30.1k|    if(ret) return ret;
  ------------------
  |  Branch (2312:8): [True: 875, False: 29.2k]
  ------------------
 2313|       |
 2314|  29.2k|    ctx->file.ihdr = 1;
 2315|  29.2k|    ctx->stored.ihdr = 1;
 2316|       |
 2317|  29.2k|    if(ctx->ihdr.bit_depth < 8) ctx->bytes_per_pixel = 1;
  ------------------
  |  Branch (2317:8): [True: 15.3k, False: 13.8k]
  ------------------
 2318|  13.8k|    else ctx->bytes_per_pixel = num_channels(&ctx->ihdr) * (ctx->ihdr.bit_depth / 8);
 2319|       |
 2320|  29.2k|    ret = calculate_subimages(ctx);
 2321|  29.2k|    if(ret) return ret;
  ------------------
  |  Branch (2321:8): [True: 161, False: 29.0k]
  ------------------
 2322|       |
 2323|  29.0k|    return 0;
 2324|  29.2k|}
spng.c:read_u32:
  454|   897k|{
  455|   897k|    const unsigned char *data = src;
  456|       |
  457|   897k|    return (data[0] & 0xFFUL) << 24 | (data[1] & 0xFFUL) << 16 |
  458|   897k|           (data[2] & 0xFFUL) << 8  | (data[3] & 0xFFUL);
  459|   897k|}
spng.c:read_non_idat_chunks:
 2371|   320k|{
 2372|   320k|    int ret;
 2373|   320k|    struct spng_chunk chunk;
 2374|   320k|    const unsigned char *data;
 2375|       |
 2376|   320k|    ctx->discard = 0;
 2377|   320k|    ctx->undo = NULL;
 2378|   320k|    ctx->prev_stored = ctx->stored;
 2379|       |
 2380|   405k|    while( !(ret = read_header(ctx)))
  ------------------
  |  Branch (2380:12): [True: 392k, False: 13.1k]
  ------------------
 2381|   392k|    {
 2382|   392k|        if(ctx->discard)
  ------------------
  |  Branch (2382:12): [True: 343k, False: 48.4k]
  ------------------
 2383|   343k|        {
 2384|   343k|            if(ctx->undo) ctx->undo(ctx);
  ------------------
  |  Branch (2384:16): [True: 8.54k, False: 335k]
  ------------------
 2385|       |
 2386|   343k|            ctx->stored = ctx->prev_stored;
 2387|   343k|        }
 2388|       |
 2389|   392k|        ctx->discard = 0;
 2390|   392k|        ctx->undo = NULL;
 2391|       |
 2392|   392k|        ctx->prev_stored = ctx->stored;
 2393|   392k|        chunk = ctx->current_chunk;
 2394|       |
 2395|   392k|        if(!memcmp(chunk.type, type_idat, 4))
  ------------------
  |  Branch (2395:12): [True: 8.36k, False: 383k]
  ------------------
 2396|  8.36k|        {
 2397|  8.36k|            if(ctx->state < SPNG_STATE_FIRST_IDAT)
  ------------------
  |  Branch (2397:16): [True: 7.65k, False: 714]
  ------------------
 2398|  7.65k|            {
 2399|  7.65k|                if(ctx->ihdr.color_type == 3 && !ctx->stored.plte) return SPNG_ENOPLTE;
  ------------------
  |  Branch (2399:20): [True: 273, False: 7.37k]
  |  Branch (2399:49): [True: 7, False: 266]
  ------------------
 2400|       |
 2401|  7.64k|                ctx->first_idat = chunk;
 2402|  7.64k|                return 0;
 2403|  7.65k|            }
 2404|       |
 2405|    714|            if(ctx->prev_was_idat)
  ------------------
  |  Branch (2405:16): [True: 707, False: 7]
  ------------------
 2406|    707|            {
 2407|       |                /* Ignore extra IDAT's */
 2408|    707|                ret = discard_chunk_bytes(ctx, chunk.length);
 2409|    707|                if(ret) return ret;
  ------------------
  |  Branch (2409:20): [True: 266, False: 441]
  ------------------
 2410|       |
 2411|    441|                continue;
 2412|    707|            }
 2413|      7|            else return SPNG_ECHUNK_POS; /* IDAT chunk not at the end of the IDAT sequence */
 2414|    714|        }
 2415|       |
 2416|   383k|        ctx->prev_was_idat = 0;
 2417|       |
 2418|   383k|        if(is_small_chunk(chunk.type))
  ------------------
  |  Branch (2418:12): [True: 51.8k, False: 331k]
  ------------------
 2419|  51.8k|        {
 2420|       |            /* None of the known chunks can be zero length */
 2421|  51.8k|            if(!chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2421:16): [True: 168, False: 51.7k]
  ------------------
 2422|       |
 2423|       |            /* The largest of these chunks is PLTE with 256 entries */
 2424|  51.7k|            ret = read_chunk_bytes(ctx, chunk.length > 768 ? 768 : chunk.length);
  ------------------
  |  Branch (2424:41): [True: 1.91k, False: 49.8k]
  ------------------
 2425|  51.7k|            if(ret) return ret;
  ------------------
  |  Branch (2425:16): [True: 413, False: 51.3k]
  ------------------
 2426|  51.7k|        }
 2427|       |
 2428|   383k|        data = ctx->data;
 2429|       |
 2430|   383k|        if(is_critical_chunk(&chunk))
  ------------------
  |  Branch (2430:12): [True: 3.03k, False: 380k]
  ------------------
 2431|  3.03k|        {
 2432|  3.03k|            if(!memcmp(chunk.type, type_plte, 4))
  ------------------
  |  Branch (2432:16): [True: 1.05k, False: 1.97k]
  ------------------
 2433|  1.05k|            {
 2434|  1.05k|                if(ctx->file.trns || ctx->file.hist || ctx->file.bkgd) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2434:20): [True: 7, False: 1.05k]
  |  Branch (2434:38): [True: 7, False: 1.04k]
  |  Branch (2434:56): [True: 7, False: 1.03k]
  ------------------
 2435|  1.03k|                if(chunk.length % 3 != 0) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2435:20): [True: 14, False: 1.02k]
  ------------------
 2436|       |
 2437|  1.02k|                ctx->plte.n_entries = chunk.length / 3;
 2438|       |
 2439|  1.02k|                if(check_plte(&ctx->plte, &ctx->ihdr)) return SPNG_ECHUNK_SIZE; /* XXX: EPLTE? */
  ------------------
  |  Branch (2439:20): [True: 161, False: 861]
  ------------------
 2440|       |
 2441|    861|                size_t i;
 2442|  52.8k|                for(i=0; i < ctx->plte.n_entries; i++)
  ------------------
  |  Branch (2442:26): [True: 51.9k, False: 861]
  ------------------
 2443|  51.9k|                {
 2444|  51.9k|                    ctx->plte.entries[i].red   = data[i * 3];
 2445|  51.9k|                    ctx->plte.entries[i].green = data[i * 3 + 1];
 2446|  51.9k|                    ctx->plte.entries[i].blue  = data[i * 3 + 2];
 2447|  51.9k|                }
 2448|       |
 2449|    861|                ctx->file.plte = 1;
 2450|    861|                ctx->stored.plte = 1;
 2451|    861|            }
 2452|  1.97k|            else if(!memcmp(chunk.type, type_iend, 4))
  ------------------
  |  Branch (2452:21): [True: 547, False: 1.42k]
  ------------------
 2453|    547|            {
 2454|    547|                if(ctx->state == SPNG_STATE_AFTER_IDAT)
  ------------------
  |  Branch (2454:20): [True: 540, False: 7]
  ------------------
 2455|    540|                {
 2456|    540|                    if(chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2456:24): [True: 161, False: 379]
  ------------------
 2457|       |
 2458|    379|                    ret = read_and_check_crc(ctx);
 2459|    379|                    if(ret == -SPNG_CRC_DISCARD) ret = 0;
  ------------------
  |  Branch (2459:24): [True: 7, False: 372]
  ------------------
 2460|       |
 2461|    379|                    return ret;
 2462|    540|                }
 2463|      7|                else return SPNG_ECHUNK_POS;
 2464|    547|            }
 2465|  1.42k|            else if(!memcmp(chunk.type, type_ihdr, 4)) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2465:21): [True: 7, False: 1.42k]
  ------------------
 2466|  1.42k|            else return SPNG_ECHUNK_UNKNOWN_CRITICAL;
 2467|  3.03k|        }
 2468|   380k|        else if(!memcmp(chunk.type, type_chrm, 4)) /* Ancillary chunks */
  ------------------
  |  Branch (2468:17): [True: 5.92k, False: 374k]
  ------------------
 2469|  5.92k|        {
 2470|  5.92k|            if(ctx->file.plte) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2470:16): [True: 210, False: 5.71k]
  ------------------
 2471|  5.71k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2471:16): [True: 987, False: 4.73k]
  ------------------
 2472|  4.73k|            if(ctx->file.chrm) return SPNG_EDUP_CHRM;
  ------------------
  |  Branch (2472:16): [True: 2.63k, False: 2.09k]
  ------------------
 2473|       |
 2474|  2.09k|            if(chunk.length != 32) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2474:16): [True: 350, False: 1.74k]
  ------------------
 2475|       |
 2476|  1.74k|            ctx->chrm_int.white_point_x = read_u32(data);
 2477|  1.74k|            ctx->chrm_int.white_point_y = read_u32(data + 4);
 2478|  1.74k|            ctx->chrm_int.red_x = read_u32(data + 8);
 2479|  1.74k|            ctx->chrm_int.red_y = read_u32(data + 12);
 2480|  1.74k|            ctx->chrm_int.green_x = read_u32(data + 16);
 2481|  1.74k|            ctx->chrm_int.green_y = read_u32(data + 20);
 2482|  1.74k|            ctx->chrm_int.blue_x = read_u32(data + 24);
 2483|  1.74k|            ctx->chrm_int.blue_y = read_u32(data + 28);
 2484|       |
 2485|  1.74k|            if(check_chrm_int(&ctx->chrm_int)) return SPNG_ECHRM;
  ------------------
  |  Branch (2485:16): [True: 1.12k, False: 623]
  ------------------
 2486|       |
 2487|    623|            ctx->file.chrm = 1;
 2488|    623|            ctx->stored.chrm = 1;
 2489|    623|        }
 2490|   374k|        else if(!memcmp(chunk.type, type_gama, 4))
  ------------------
  |  Branch (2490:17): [True: 2.21k, False: 371k]
  ------------------
 2491|  2.21k|        {
 2492|  2.21k|            if(ctx->file.plte) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2492:16): [True: 77, False: 2.14k]
  ------------------
 2493|  2.14k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2493:16): [True: 77, False: 2.06k]
  ------------------
 2494|  2.06k|            if(ctx->file.gama) return SPNG_EDUP_GAMA;
  ------------------
  |  Branch (2494:16): [True: 882, False: 1.18k]
  ------------------
 2495|       |
 2496|  1.18k|            if(chunk.length != 4) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2496:16): [True: 497, False: 686]
  ------------------
 2497|       |
 2498|    686|            ctx->gama = read_u32(data);
 2499|       |
 2500|    686|            if(!ctx->gama) return SPNG_EGAMA;
  ------------------
  |  Branch (2500:16): [True: 77, False: 609]
  ------------------
 2501|    609|            if(ctx->gama > spng_u32max) return SPNG_EGAMA;
  ------------------
  |  Branch (2501:16): [True: 455, False: 154]
  ------------------
 2502|       |
 2503|    154|            ctx->file.gama = 1;
 2504|    154|            ctx->stored.gama = 1;
 2505|    154|        }
 2506|   371k|        else if(!memcmp(chunk.type, type_sbit, 4))
  ------------------
  |  Branch (2506:17): [True: 6.99k, False: 364k]
  ------------------
 2507|  6.99k|        {
 2508|  6.99k|            if(ctx->file.plte) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2508:16): [True: 77, False: 6.91k]
  ------------------
 2509|  6.91k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2509:16): [True: 336, False: 6.58k]
  ------------------
 2510|  6.58k|            if(ctx->file.sbit) return SPNG_EDUP_SBIT;
  ------------------
  |  Branch (2510:16): [True: 777, False: 5.80k]
  ------------------
 2511|       |
 2512|  5.80k|            if(ctx->ihdr.color_type == 0)
  ------------------
  |  Branch (2512:16): [True: 4.38k, False: 1.42k]
  ------------------
 2513|  4.38k|            {
 2514|  4.38k|                if(chunk.length != 1) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2514:20): [True: 308, False: 4.07k]
  ------------------
 2515|       |
 2516|  4.07k|                ctx->sbit.grayscale_bits = data[0];
 2517|  4.07k|            }
 2518|  1.42k|            else if(ctx->ihdr.color_type == 2 || ctx->ihdr.color_type == 3)
  ------------------
  |  Branch (2518:21): [True: 861, False: 560]
  |  Branch (2518:50): [True: 560, False: 0]
  ------------------
 2519|  1.42k|            {
 2520|  1.42k|                if(chunk.length != 3) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2520:20): [True: 735, False: 686]
  ------------------
 2521|       |
 2522|    686|                ctx->sbit.red_bits = data[0];
 2523|    686|                ctx->sbit.green_bits = data[1];
 2524|    686|                ctx->sbit.blue_bits = data[2];
 2525|    686|            }
 2526|      0|            else if(ctx->ihdr.color_type == 4)
  ------------------
  |  Branch (2526:21): [True: 0, False: 0]
  ------------------
 2527|      0|            {
 2528|      0|                if(chunk.length != 2) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2528:20): [True: 0, False: 0]
  ------------------
 2529|       |
 2530|      0|                ctx->sbit.grayscale_bits = data[0];
 2531|      0|                ctx->sbit.alpha_bits = data[1];
 2532|      0|            }
 2533|      0|            else if(ctx->ihdr.color_type == 6)
  ------------------
  |  Branch (2533:21): [True: 0, False: 0]
  ------------------
 2534|      0|            {
 2535|      0|                if(chunk.length != 4) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2535:20): [True: 0, False: 0]
  ------------------
 2536|       |
 2537|      0|                ctx->sbit.red_bits = data[0];
 2538|      0|                ctx->sbit.green_bits = data[1];
 2539|      0|                ctx->sbit.blue_bits = data[2];
 2540|      0|                ctx->sbit.alpha_bits = data[3];
 2541|      0|            }
 2542|       |
 2543|  4.76k|            if(check_sbit(&ctx->sbit, &ctx->ihdr)) return SPNG_ESBIT;
  ------------------
  |  Branch (2543:16): [True: 4.64k, False: 119]
  ------------------
 2544|       |
 2545|    119|            ctx->file.sbit = 1;
 2546|    119|            ctx->stored.sbit = 1;
 2547|    119|        }
 2548|   364k|        else if(!memcmp(chunk.type, type_srgb, 4))
  ------------------
  |  Branch (2548:17): [True: 1.02k, False: 363k]
  ------------------
 2549|  1.02k|        {
 2550|  1.02k|            if(ctx->file.plte) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2550:16): [True: 77, False: 952]
  ------------------
 2551|    952|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2551:16): [True: 91, False: 861]
  ------------------
 2552|    861|            if(ctx->file.srgb) return SPNG_EDUP_SRGB;
  ------------------
  |  Branch (2552:16): [True: 77, False: 784]
  ------------------
 2553|       |
 2554|    784|            if(chunk.length != 1) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2554:16): [True: 595, False: 189]
  ------------------
 2555|       |
 2556|    189|            ctx->srgb_rendering_intent = data[0];
 2557|       |
 2558|    189|            if(ctx->srgb_rendering_intent > 3) return SPNG_ESRGB;
  ------------------
  |  Branch (2558:16): [True: 147, False: 42]
  ------------------
 2559|       |
 2560|     42|            ctx->file.srgb = 1;
 2561|     42|            ctx->stored.srgb = 1;
 2562|     42|        }
 2563|   363k|        else if(!memcmp(chunk.type, type_bkgd, 4))
  ------------------
  |  Branch (2563:17): [True: 7.94k, False: 355k]
  ------------------
 2564|  7.94k|        {
 2565|  7.94k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2565:16): [True: 903, False: 7.04k]
  ------------------
 2566|  7.04k|            if(ctx->file.bkgd) return SPNG_EDUP_BKGD;
  ------------------
  |  Branch (2566:16): [True: 2.24k, False: 4.80k]
  ------------------
 2567|       |
 2568|  4.80k|            if(ctx->ihdr.color_type == 0 || ctx->ihdr.color_type == 4)
  ------------------
  |  Branch (2568:16): [True: 2.55k, False: 2.24k]
  |  Branch (2568:45): [True: 0, False: 2.24k]
  ------------------
 2569|  2.55k|            {
 2570|  2.55k|                if(chunk.length != 2) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2570:20): [True: 1.37k, False: 1.18k]
  ------------------
 2571|       |
 2572|  1.18k|                ctx->bkgd.gray = read_u16(data);
 2573|  1.18k|            }
 2574|  2.24k|            else if(ctx->ihdr.color_type == 2 || ctx->ihdr.color_type == 6)
  ------------------
  |  Branch (2574:21): [True: 812, False: 1.43k]
  |  Branch (2574:50): [True: 0, False: 1.43k]
  ------------------
 2575|    812|            {
 2576|    812|                if(chunk.length != 6) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2576:20): [True: 273, False: 539]
  ------------------
 2577|       |
 2578|    539|                ctx->bkgd.red = read_u16(data);
 2579|    539|                ctx->bkgd.green = read_u16(data + 2);
 2580|    539|                ctx->bkgd.blue = read_u16(data + 4);
 2581|    539|            }
 2582|  1.43k|            else if(ctx->ihdr.color_type == 3)
  ------------------
  |  Branch (2582:21): [True: 1.43k, False: 0]
  ------------------
 2583|  1.43k|            {
 2584|  1.43k|                if(chunk.length != 1) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2584:20): [True: 728, False: 707]
  ------------------
 2585|    707|                if(!ctx->file.plte) return SPNG_EBKGD_NO_PLTE;
  ------------------
  |  Branch (2585:20): [True: 434, False: 273]
  ------------------
 2586|       |
 2587|    273|                ctx->bkgd.plte_index = data[0];
 2588|    273|                if(ctx->bkgd.plte_index >= ctx->plte.n_entries) return SPNG_EBKGD_PLTE_IDX;
  ------------------
  |  Branch (2588:20): [True: 168, False: 105]
  ------------------
 2589|    273|            }
 2590|       |
 2591|  1.82k|            ctx->file.bkgd = 1;
 2592|  1.82k|            ctx->stored.bkgd = 1;
 2593|  1.82k|        }
 2594|   355k|        else if(!memcmp(chunk.type, type_trns, 4))
  ------------------
  |  Branch (2594:17): [True: 1.44k, False: 354k]
  ------------------
 2595|  1.44k|        {
 2596|  1.44k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2596:16): [True: 203, False: 1.23k]
  ------------------
 2597|  1.23k|            if(ctx->file.trns) return SPNG_EDUP_TRNS;
  ------------------
  |  Branch (2597:16): [True: 357, False: 882]
  ------------------
 2598|    882|            if(!chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2598:16): [True: 0, False: 882]
  ------------------
 2599|       |
 2600|    882|            if(ctx->ihdr.color_type == 0)
  ------------------
  |  Branch (2600:16): [True: 364, False: 518]
  ------------------
 2601|    364|            {
 2602|    364|                if(chunk.length != 2) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2602:20): [True: 308, False: 56]
  ------------------
 2603|       |
 2604|     56|                ctx->trns.gray = read_u16(data);
 2605|     56|            }
 2606|    518|            else if(ctx->ihdr.color_type == 2)
  ------------------
  |  Branch (2606:21): [True: 217, False: 301]
  ------------------
 2607|    217|            {
 2608|    217|                if(chunk.length != 6) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2608:20): [True: 203, False: 14]
  ------------------
 2609|       |
 2610|     14|                ctx->trns.red = read_u16(data);
 2611|     14|                ctx->trns.green = read_u16(data + 2);
 2612|     14|                ctx->trns.blue = read_u16(data + 4);
 2613|     14|            }
 2614|    301|            else if(ctx->ihdr.color_type == 3)
  ------------------
  |  Branch (2614:21): [True: 301, False: 0]
  ------------------
 2615|    301|            {
 2616|    301|                if(chunk.length > ctx->plte.n_entries) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2616:20): [True: 294, False: 7]
  ------------------
 2617|      7|                if(!ctx->file.plte) return SPNG_ETRNS_NO_PLTE;
  ------------------
  |  Branch (2617:20): [True: 0, False: 7]
  ------------------
 2618|       |
 2619|      7|                memcpy(ctx->trns.type3_alpha, data, chunk.length);
 2620|      7|                ctx->trns.n_type3_entries = chunk.length;
 2621|      7|            }
 2622|       |
 2623|     77|            if(ctx->ihdr.color_type == 4 || ctx->ihdr.color_type == 6)  return SPNG_ETRNS_COLOR_TYPE;
  ------------------
  |  Branch (2623:16): [True: 0, False: 77]
  |  Branch (2623:45): [True: 0, False: 77]
  ------------------
 2624|       |
 2625|     77|            ctx->file.trns = 1;
 2626|     77|            ctx->stored.trns = 1;
 2627|     77|        }
 2628|   354k|        else if(!memcmp(chunk.type, type_hist, 4))
  ------------------
  |  Branch (2628:17): [True: 371, False: 354k]
  ------------------
 2629|    371|        {
 2630|    371|            if(!ctx->file.plte) return SPNG_EHIST_NO_PLTE;
  ------------------
  |  Branch (2630:16): [True: 147, False: 224]
  ------------------
 2631|    224|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2631:16): [True: 0, False: 224]
  ------------------
 2632|    224|            if(ctx->file.hist) return SPNG_EDUP_HIST;
  ------------------
  |  Branch (2632:16): [True: 84, False: 140]
  ------------------
 2633|       |
 2634|    140|            if( (chunk.length / 2) != (ctx->plte.n_entries) ) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2634:17): [True: 84, False: 56]
  ------------------
 2635|       |
 2636|     56|            size_t k;
 2637|  2.91k|            for(k=0; k < (chunk.length / 2); k++)
  ------------------
  |  Branch (2637:22): [True: 2.85k, False: 56]
  ------------------
 2638|  2.85k|            {
 2639|  2.85k|                ctx->hist.frequency[k] = read_u16(data + k*2);
 2640|  2.85k|            }
 2641|       |
 2642|     56|            ctx->file.hist = 1;
 2643|     56|            ctx->stored.hist = 1;
 2644|     56|        }
 2645|   354k|        else if(!memcmp(chunk.type, type_phys, 4))
  ------------------
  |  Branch (2645:17): [True: 2.67k, False: 351k]
  ------------------
 2646|  2.67k|        {
 2647|  2.67k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2647:16): [True: 77, False: 2.59k]
  ------------------
 2648|  2.59k|            if(ctx->file.phys) return SPNG_EDUP_PHYS;
  ------------------
  |  Branch (2648:16): [True: 567, False: 2.03k]
  ------------------
 2649|       |
 2650|  2.03k|            if(chunk.length != 9) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2650:16): [True: 315, False: 1.71k]
  ------------------
 2651|       |
 2652|  1.71k|            ctx->phys.ppu_x = read_u32(data);
 2653|  1.71k|            ctx->phys.ppu_y = read_u32(data + 4);
 2654|  1.71k|            ctx->phys.unit_specifier = data[8];
 2655|       |
 2656|  1.71k|            if(check_phys(&ctx->phys)) return SPNG_EPHYS;
  ------------------
  |  Branch (2656:16): [True: 1.65k, False: 63]
  ------------------
 2657|       |
 2658|     63|            ctx->file.phys = 1;
 2659|     63|            ctx->stored.phys = 1;
 2660|     63|        }
 2661|   351k|        else if(!memcmp(chunk.type, type_time, 4))
  ------------------
  |  Branch (2661:17): [True: 20.1k, False: 331k]
  ------------------
 2662|  20.1k|        {
 2663|  20.1k|            if(ctx->file.time) return SPNG_EDUP_TIME;
  ------------------
  |  Branch (2663:16): [True: 4.34k, False: 15.7k]
  ------------------
 2664|       |
 2665|  15.7k|            if(chunk.length != 7) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2665:16): [True: 413, False: 15.3k]
  ------------------
 2666|       |
 2667|  15.3k|            struct spng_time time;
 2668|       |
 2669|  15.3k|            time.year = read_u16(data);
 2670|  15.3k|            time.month = data[2];
 2671|  15.3k|            time.day = data[3];
 2672|  15.3k|            time.hour = data[4];
 2673|  15.3k|            time.minute = data[5];
 2674|  15.3k|            time.second = data[6];
 2675|       |
 2676|  15.3k|            if(check_time(&time)) return SPNG_ETIME;
  ------------------
  |  Branch (2676:16): [True: 14.7k, False: 679]
  ------------------
 2677|       |
 2678|    679|            ctx->file.time = 1;
 2679|       |
 2680|    679|            if(!ctx->user.time) ctx->time = time;
  ------------------
  |  Branch (2680:16): [True: 679, False: 0]
  ------------------
 2681|       |
 2682|    679|            ctx->stored.time = 1;
 2683|    679|        }
 2684|   331k|        else if(!memcmp(chunk.type, type_offs, 4))
  ------------------
  |  Branch (2684:17): [True: 1.51k, False: 329k]
  ------------------
 2685|  1.51k|        {
 2686|  1.51k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2686:16): [True: 196, False: 1.32k]
  ------------------
 2687|  1.32k|            if(ctx->file.offs) return SPNG_EDUP_OFFS;
  ------------------
  |  Branch (2687:16): [True: 476, False: 847]
  ------------------
 2688|       |
 2689|    847|            if(chunk.length != 9) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2689:16): [True: 294, False: 553]
  ------------------
 2690|       |
 2691|    553|            ctx->offs.x = read_s32(data);
 2692|    553|            ctx->offs.y = read_s32(data + 4);
 2693|    553|            ctx->offs.unit_specifier = data[8];
 2694|       |
 2695|    553|            if(check_offs(&ctx->offs)) return SPNG_EOFFS;
  ------------------
  |  Branch (2695:16): [True: 497, False: 56]
  ------------------
 2696|       |
 2697|     56|            ctx->file.offs = 1;
 2698|     56|            ctx->stored.offs = 1;
 2699|     56|        }
 2700|   329k|        else /* Arbitrary-length chunk */
 2701|   329k|        {
 2702|       |
 2703|   329k|            if(!memcmp(chunk.type, type_exif, 4))
  ------------------
  |  Branch (2703:16): [True: 1.26k, False: 328k]
  ------------------
 2704|  1.26k|            {
 2705|  1.26k|                if(ctx->file.exif) return SPNG_EDUP_EXIF;
  ------------------
  |  Branch (2705:20): [True: 413, False: 854]
  ------------------
 2706|    854|                if(!chunk.length) return SPNG_EEXIF;
  ------------------
  |  Branch (2706:20): [True: 84, False: 770]
  ------------------
 2707|       |
 2708|    770|                ctx->file.exif = 1;
 2709|       |
 2710|    770|                if(ctx->user.exif) goto discard;
  ------------------
  |  Branch (2710:20): [True: 0, False: 770]
  ------------------
 2711|       |
 2712|    770|                if(increase_cache_usage(ctx, chunk.length, 1)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (2712:20): [True: 0, False: 770]
  ------------------
 2713|       |
 2714|    770|                struct spng_exif exif;
 2715|       |
 2716|    770|                exif.length = chunk.length;
 2717|       |
 2718|    770|                exif.data = spng__malloc(ctx, chunk.length);
 2719|    770|                if(exif.data == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2719:20): [True: 0, False: 770]
  ------------------
 2720|       |
 2721|    770|                ret = read_chunk_bytes2(ctx, exif.data, chunk.length);
 2722|    770|                if(ret)
  ------------------
  |  Branch (2722:20): [True: 371, False: 399]
  ------------------
 2723|    371|                {
 2724|    371|                    spng__free(ctx, exif.data);
 2725|    371|                    return ret;
 2726|    371|                }
 2727|       |
 2728|    399|                if(check_exif(&exif))
  ------------------
  |  Branch (2728:20): [True: 378, False: 21]
  ------------------
 2729|    378|                {
 2730|    378|                    spng__free(ctx, exif.data);
 2731|    378|                    return SPNG_EEXIF;
 2732|    378|                }
 2733|       |
 2734|     21|                ctx->exif = exif;
 2735|       |
 2736|     21|                ctx->stored.exif = 1;
 2737|     21|            }
 2738|   328k|            else if(!memcmp(chunk.type, type_iccp, 4))
  ------------------
  |  Branch (2738:21): [True: 4.56k, False: 323k]
  ------------------
 2739|  4.56k|            {/* TODO: add test file with color profile */
 2740|  4.56k|                if(ctx->file.plte) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2740:20): [True: 84, False: 4.48k]
  ------------------
 2741|  4.48k|                if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2741:20): [True: 77, False: 4.40k]
  ------------------
 2742|  4.40k|                if(ctx->file.iccp) return SPNG_EDUP_ICCP;
  ------------------
  |  Branch (2742:20): [True: 532, False: 3.87k]
  ------------------
 2743|  3.87k|                if(!chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2743:20): [True: 1.42k, False: 2.45k]
  ------------------
 2744|       |
 2745|  2.45k|                ctx->file.iccp = 1;
 2746|       |
 2747|  2.45k|                uint32_t peek_bytes =  81 > chunk.length ? chunk.length : 81;
  ------------------
  |  Branch (2747:40): [True: 315, False: 2.13k]
  ------------------
 2748|       |
 2749|  2.45k|                ret = read_chunk_bytes(ctx, peek_bytes);
 2750|  2.45k|                if(ret) return ret;
  ------------------
  |  Branch (2750:20): [True: 287, False: 2.16k]
  ------------------
 2751|       |
 2752|  2.16k|                unsigned char *keyword_nul = memchr(ctx->data, '\0', peek_bytes);
 2753|  2.16k|                if(keyword_nul == NULL) return SPNG_EICCP_NAME;
  ------------------
  |  Branch (2753:20): [True: 21, False: 2.14k]
  ------------------
 2754|       |
 2755|  2.14k|                uint32_t keyword_len = keyword_nul - ctx->data;
 2756|       |
 2757|  2.14k|                if(keyword_len > 79) return SPNG_EICCP_NAME;
  ------------------
  |  Branch (2757:20): [True: 7, False: 2.13k]
  ------------------
 2758|       |
 2759|  2.13k|                memcpy(ctx->iccp.profile_name, ctx->data, keyword_len);
 2760|       |
 2761|  2.13k|                if(check_png_keyword(ctx->iccp.profile_name)) return SPNG_EICCP_NAME;
  ------------------
  |  Branch (2761:20): [True: 140, False: 1.99k]
  ------------------
 2762|       |
 2763|  1.99k|                if(chunk.length < (keyword_len + 2)) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2763:20): [True: 28, False: 1.96k]
  ------------------
 2764|       |
 2765|  1.96k|                if(ctx->data[keyword_len + 1] != 0) return SPNG_EICCP_COMPRESSION_METHOD;
  ------------------
  |  Branch (2765:20): [True: 210, False: 1.75k]
  ------------------
 2766|       |
 2767|  1.75k|                ret = spng__inflate_stream(ctx, &ctx->iccp.profile, &ctx->iccp.profile_len, 0, ctx->data + keyword_len + 2, peek_bytes - (keyword_len + 2));
 2768|       |
 2769|  1.75k|                if(ret) return ret;
  ------------------
  |  Branch (2769:20): [True: 1.74k, False: 14]
  ------------------
 2770|       |
 2771|     14|                ctx->stored.iccp = 1;
 2772|     14|            }
 2773|   323k|             else if(!memcmp(chunk.type, type_text, 4) ||
  ------------------
  |  Branch (2773:22): [True: 13.9k, False: 309k]
  ------------------
 2774|   309k|                     !memcmp(chunk.type, type_ztxt, 4) ||
  ------------------
  |  Branch (2774:22): [True: 3.07k, False: 306k]
  ------------------
 2775|   306k|                     !memcmp(chunk.type, type_itxt, 4))
  ------------------
  |  Branch (2775:22): [True: 194k, False: 112k]
  ------------------
 2776|   211k|            {
 2777|   211k|                if(!chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2777:20): [True: 91, False: 211k]
  ------------------
 2778|       |
 2779|   211k|                ctx->file.text = 1;
 2780|       |
 2781|   211k|                if(ctx->user.text) goto discard;
  ------------------
  |  Branch (2781:20): [True: 0, False: 211k]
  ------------------
 2782|       |
 2783|   211k|                if(increase_cache_usage(ctx, sizeof(struct spng_text2), 1)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (2783:20): [True: 7, False: 211k]
  ------------------
 2784|       |
 2785|   211k|                ctx->n_text++;
 2786|   211k|                if(ctx->n_text < 1) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (2786:20): [True: 0, False: 211k]
  ------------------
 2787|   211k|                if(sizeof(struct spng_text2) > SIZE_MAX / ctx->n_text) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (2787:20): [True: 0, False: 211k]
  ------------------
 2788|       |
 2789|   211k|                void *buf = spng__realloc(ctx, ctx->text_list, ctx->n_text * sizeof(struct spng_text2));
 2790|   211k|                if(buf == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2790:20): [True: 0, False: 211k]
  ------------------
 2791|   211k|                ctx->text_list = buf;
 2792|       |
 2793|   211k|                struct spng_text2 *text = &ctx->text_list[ctx->n_text - 1];
 2794|   211k|                memset(text, 0, sizeof(struct spng_text2));
 2795|       |
 2796|   211k|                ctx->undo = text_undo;
 2797|       |
 2798|   211k|                uint32_t text_offset = 0, language_tag_offset = 0, translated_keyword_offset = 0;
 2799|   211k|                uint32_t peek_bytes = 256; /* enough for 3 80-byte keywords and some text bytes */
 2800|   211k|                uint32_t keyword_len;
 2801|       |
 2802|   211k|                if(peek_bytes > chunk.length) peek_bytes = chunk.length;
  ------------------
  |  Branch (2802:20): [True: 208k, False: 3.31k]
  ------------------
 2803|       |
 2804|   211k|                ret = read_chunk_bytes(ctx, peek_bytes);
 2805|   211k|                if(ret) return ret;
  ------------------
  |  Branch (2805:20): [True: 502, False: 211k]
  ------------------
 2806|       |
 2807|   211k|                data = ctx->data;
 2808|       |
 2809|   211k|                const unsigned char *zlib_stream = NULL;
 2810|   211k|                const unsigned char *peek_end = data + peek_bytes;
 2811|   211k|                const unsigned char *keyword_nul = memchr(data, 0, chunk.length > 80 ? 80 : chunk.length);
  ------------------
  |  Branch (2811:68): [True: 3.81k, False: 207k]
  ------------------
 2812|       |
 2813|   211k|                if(keyword_nul == NULL) return SPNG_ETEXT_KEYWORD;
  ------------------
  |  Branch (2813:20): [True: 161, False: 211k]
  ------------------
 2814|       |
 2815|   211k|                keyword_len = keyword_nul - data;
 2816|       |
 2817|   211k|                if(!memcmp(chunk.type, type_text, 4))
  ------------------
  |  Branch (2817:20): [True: 13.7k, False: 197k]
  ------------------
 2818|  13.7k|                {
 2819|  13.7k|                    text->type = SPNG_TEXT;
 2820|       |
 2821|  13.7k|                    text->text_length = chunk.length - keyword_len - 1;
 2822|       |
 2823|  13.7k|                    text_offset = keyword_len;
 2824|       |
 2825|       |                    /* increment past nul if there is a text field */
 2826|  13.7k|                    if(text->text_length) text_offset++;
  ------------------
  |  Branch (2826:24): [True: 13.6k, False: 140]
  ------------------
 2827|  13.7k|                }
 2828|   197k|                else if(!memcmp(chunk.type, type_ztxt, 4))
  ------------------
  |  Branch (2828:25): [True: 2.88k, False: 194k]
  ------------------
 2829|  2.88k|                {
 2830|  2.88k|                    text->type = SPNG_ZTXT;
 2831|       |
 2832|  2.88k|                    if((peek_bytes - keyword_len) <= 2) return SPNG_EZTXT;
  ------------------
  |  Branch (2832:24): [True: 518, False: 2.36k]
  ------------------
 2833|       |
 2834|  2.36k|                    if(keyword_nul[1]) return SPNG_EZTXT_COMPRESSION_METHOD;
  ------------------
  |  Branch (2834:24): [True: 980, False: 1.38k]
  ------------------
 2835|       |
 2836|  1.38k|                    text->compression_flag = 1;
 2837|       |
 2838|  1.38k|                    text_offset = keyword_len + 2;
 2839|  1.38k|                }
 2840|   194k|                else if(!memcmp(chunk.type, type_itxt, 4))
  ------------------
  |  Branch (2840:25): [True: 194k, False: 0]
  ------------------
 2841|   194k|                {
 2842|   194k|                    text->type = SPNG_ITXT;
 2843|       |
 2844|       |                    /* at least two 1-byte fields, two >=0 length strings, and one byte of (compressed) text */
 2845|   194k|                    if((peek_bytes - keyword_len) < 5) return SPNG_EITXT;
  ------------------
  |  Branch (2845:24): [True: 84, False: 194k]
  ------------------
 2846|       |
 2847|   194k|                    text->compression_flag = keyword_nul[1];
 2848|       |
 2849|   194k|                    if(text->compression_flag > 1) return SPNG_EITXT_COMPRESSION_FLAG;
  ------------------
  |  Branch (2849:24): [True: 1.90k, False: 192k]
  ------------------
 2850|       |
 2851|   192k|                    if(keyword_nul[2]) return SPNG_EITXT_COMPRESSION_METHOD;
  ------------------
  |  Branch (2851:24): [True: 3.75k, False: 188k]
  ------------------
 2852|       |
 2853|   188k|                    language_tag_offset = keyword_len + 3;
 2854|       |
 2855|   188k|                    const unsigned char *term;
 2856|   188k|                    term = memchr(data + language_tag_offset, 0, peek_bytes - language_tag_offset);
 2857|   188k|                    if(term == NULL) return SPNG_EITXT_LANG_TAG;
  ------------------
  |  Branch (2857:24): [True: 511, False: 188k]
  ------------------
 2858|       |
 2859|   188k|                    if((peek_end - term) < 2) return SPNG_EITXT;
  ------------------
  |  Branch (2859:24): [True: 4.22k, False: 183k]
  ------------------
 2860|       |
 2861|   183k|                    translated_keyword_offset = term - data + 1;
 2862|       |
 2863|   183k|                    zlib_stream = memchr(data + translated_keyword_offset, 0, peek_bytes - translated_keyword_offset);
 2864|   183k|                    if(zlib_stream == NULL) return SPNG_EITXT;
  ------------------
  |  Branch (2864:24): [True: 938, False: 183k]
  ------------------
 2865|   183k|                    if(zlib_stream == peek_end) return SPNG_EITXT;
  ------------------
  |  Branch (2865:24): [True: 0, False: 183k]
  ------------------
 2866|       |
 2867|   183k|                    text_offset = zlib_stream - data + 1;
 2868|   183k|                    text->text_length = chunk.length - text_offset;
 2869|   183k|                }
 2870|      0|                else return SPNG_EINTERNAL;
 2871|       |
 2872|       |
 2873|   198k|                if(text->compression_flag)
  ------------------
  |  Branch (2873:20): [True: 182k, False: 15.7k]
  ------------------
 2874|   182k|                {
 2875|       |                    /* cache usage = peek_bytes + decompressed text size + nul */
 2876|   182k|                    if(increase_cache_usage(ctx, peek_bytes, 0)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (2876:24): [True: 0, False: 182k]
  ------------------
 2877|       |
 2878|   182k|                    text->keyword = spng__calloc(ctx, 1, peek_bytes);
 2879|   182k|                    if(text->keyword == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2879:24): [True: 0, False: 182k]
  ------------------
 2880|       |
 2881|   182k|                    memcpy(text->keyword, data, peek_bytes);
 2882|       |
 2883|   182k|                    zlib_stream = ctx->data + text_offset;
 2884|       |
 2885|   182k|                    ret = spng__inflate_stream(ctx, &text->text, &text->text_length, 1, zlib_stream, peek_bytes - text_offset);
 2886|       |
 2887|   182k|                    if(ret) return ret;
  ------------------
  |  Branch (2887:24): [True: 182k, False: 203]
  ------------------
 2888|       |
 2889|    203|                    text->text[text->text_length - 1] = '\0';
 2890|    203|                    text->cache_usage = text->text_length + peek_bytes;
 2891|    203|                }
 2892|  15.7k|                else
 2893|  15.7k|                {
 2894|  15.7k|                    if(increase_cache_usage(ctx, chunk.length + 1, 0)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (2894:24): [True: 0, False: 15.7k]
  ------------------
 2895|       |
 2896|  15.7k|                    text->keyword = spng__malloc(ctx, chunk.length + 1);
 2897|  15.7k|                    if(text->keyword == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2897:24): [True: 0, False: 15.7k]
  ------------------
 2898|       |
 2899|  15.7k|                    memcpy(text->keyword, data, peek_bytes);
 2900|       |
 2901|  15.7k|                    if(chunk.length > peek_bytes)
  ------------------
  |  Branch (2901:24): [True: 826, False: 14.9k]
  ------------------
 2902|    826|                    {
 2903|    826|                        ret = read_chunk_bytes2(ctx, text->keyword + peek_bytes, chunk.length - peek_bytes);
 2904|    826|                        if(ret) return ret;
  ------------------
  |  Branch (2904:28): [True: 602, False: 224]
  ------------------
 2905|    826|                    }
 2906|       |
 2907|  15.1k|                    text->text = text->keyword + text_offset;
 2908|       |
 2909|  15.1k|                    text->text_length = chunk.length - text_offset;
 2910|       |
 2911|  15.1k|                    text->text[text->text_length] = '\0';
 2912|  15.1k|                    text->cache_usage = chunk.length + 1;
 2913|  15.1k|                }
 2914|       |
 2915|  15.3k|                if(check_png_keyword(text->keyword)) return SPNG_ETEXT_KEYWORD;
  ------------------
  |  Branch (2915:20): [True: 2.82k, False: 12.5k]
  ------------------
 2916|       |
 2917|  12.5k|                text->text_length = strlen(text->text);
 2918|       |
 2919|  12.5k|                if(text->type != SPNG_ITXT)
  ------------------
  |  Branch (2919:20): [True: 11.3k, False: 1.23k]
  ------------------
 2920|  11.3k|                {
 2921|  11.3k|                    language_tag_offset = keyword_len;
 2922|  11.3k|                    translated_keyword_offset = keyword_len;
 2923|       |
 2924|  11.3k|                    if(ctx->strict && check_png_text(text->text, text->text_length))
  ------------------
  |  Branch (2924:24): [True: 0, False: 11.3k]
  |  Branch (2924:39): [True: 0, False: 0]
  ------------------
 2925|      0|                    {
 2926|      0|                        if(text->type == SPNG_ZTXT) return SPNG_EZTXT;
  ------------------
  |  Branch (2926:28): [True: 0, False: 0]
  ------------------
 2927|      0|                        else return SPNG_ETEXT;
 2928|      0|                    }
 2929|  11.3k|                }
 2930|       |
 2931|  12.5k|                text->language_tag = text->keyword + language_tag_offset;
 2932|  12.5k|                text->translated_keyword = text->keyword + translated_keyword_offset;
 2933|       |
 2934|  12.5k|                ctx->stored.text = 1;
 2935|  12.5k|            }
 2936|   112k|            else if(!memcmp(chunk.type, type_splt, 4))
  ------------------
  |  Branch (2936:21): [True: 45.6k, False: 66.4k]
  ------------------
 2937|  45.6k|            {
 2938|  45.6k|                if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2938:20): [True: 993, False: 44.6k]
  ------------------
 2939|  44.6k|                if(ctx->user.splt) goto discard; /* XXX: could check profile names for uniqueness */
  ------------------
  |  Branch (2939:20): [True: 0, False: 44.6k]
  ------------------
 2940|  44.6k|                if(!chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2940:20): [True: 98, False: 44.5k]
  ------------------
 2941|       |
 2942|  44.5k|                ctx->file.splt = 1;
 2943|       |
 2944|       |                /* chunk.length + sizeof(struct spng_splt) + splt->n_entries * sizeof(struct spng_splt_entry) */
 2945|  44.5k|                if(increase_cache_usage(ctx, chunk.length + sizeof(struct spng_splt), 1)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (2945:20): [True: 7, False: 44.5k]
  ------------------
 2946|       |
 2947|  44.5k|                ctx->n_splt++;
 2948|  44.5k|                if(ctx->n_splt < 1) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (2948:20): [True: 0, False: 44.5k]
  ------------------
 2949|  44.5k|                if(sizeof(struct spng_splt) > SIZE_MAX / ctx->n_splt) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (2949:20): [True: 0, False: 44.5k]
  ------------------
 2950|       |
 2951|  44.5k|                void *buf = spng__realloc(ctx, ctx->splt_list, ctx->n_splt * sizeof(struct spng_splt));
 2952|  44.5k|                if(buf == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2952:20): [True: 0, False: 44.5k]
  ------------------
 2953|  44.5k|                ctx->splt_list = buf;
 2954|       |
 2955|  44.5k|                struct spng_splt *splt = &ctx->splt_list[ctx->n_splt - 1];
 2956|       |
 2957|  44.5k|                memset(splt, 0, sizeof(struct spng_splt));
 2958|       |
 2959|  44.5k|                ctx->undo = splt_undo;
 2960|       |
 2961|  44.5k|                void *t = spng__malloc(ctx, chunk.length);
 2962|  44.5k|                if(t == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2962:20): [True: 0, False: 44.5k]
  ------------------
 2963|       |
 2964|  44.5k|                splt->entries = t; /* simplifies error handling */
 2965|  44.5k|                data = t;
 2966|       |
 2967|  44.5k|                ret = read_chunk_bytes2(ctx, t, chunk.length);
 2968|  44.5k|                if(ret) return ret;
  ------------------
  |  Branch (2968:20): [True: 406, False: 44.1k]
  ------------------
 2969|       |
 2970|  44.1k|                uint32_t keyword_len = chunk.length < 80 ? chunk.length : 80;
  ------------------
  |  Branch (2970:40): [True: 43.7k, False: 420]
  ------------------
 2971|       |
 2972|  44.1k|                const unsigned char *keyword_nul = memchr(data, 0, keyword_len);
 2973|  44.1k|                if(keyword_nul == NULL) return SPNG_ESPLT_NAME;
  ------------------
  |  Branch (2973:20): [True: 630, False: 43.4k]
  ------------------
 2974|       |
 2975|  43.4k|                keyword_len = keyword_nul - data;
 2976|       |
 2977|  43.4k|                memcpy(splt->name, data, keyword_len);
 2978|       |
 2979|  43.4k|                if(check_png_keyword(splt->name)) return SPNG_ESPLT_NAME;
  ------------------
  |  Branch (2979:20): [True: 14.6k, False: 28.8k]
  ------------------
 2980|       |
 2981|  28.8k|                uint32_t j;
 2982|  30.4k|                for(j=0; j < (ctx->n_splt - 1); j++)
  ------------------
  |  Branch (2982:26): [True: 5.96k, False: 24.5k]
  ------------------
 2983|  5.96k|                {
 2984|  5.96k|                    if(!strcmp(ctx->splt_list[j].name, splt->name)) return SPNG_ESPLT_DUP_NAME;
  ------------------
  |  Branch (2984:24): [True: 4.31k, False: 1.64k]
  ------------------
 2985|  5.96k|                }
 2986|       |
 2987|  24.5k|                if( (chunk.length - keyword_len) <= 2) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2987:21): [True: 154, False: 24.3k]
  ------------------
 2988|       |
 2989|  24.3k|                splt->sample_depth = data[keyword_len + 1];
 2990|       |
 2991|  24.3k|                uint32_t entries_len = chunk.length - keyword_len - 2;
 2992|  24.3k|                if(!entries_len) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2992:20): [True: 0, False: 24.3k]
  ------------------
 2993|       |
 2994|  24.3k|                if(splt->sample_depth == 16)
  ------------------
  |  Branch (2994:20): [True: 2.69k, False: 21.6k]
  ------------------
 2995|  2.69k|                {
 2996|  2.69k|                    if(entries_len % 10 != 0) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2996:24): [True: 2.54k, False: 154]
  ------------------
 2997|    154|                    splt->n_entries = entries_len / 10;
 2998|    154|                }
 2999|  21.6k|                else if(splt->sample_depth == 8)
  ------------------
  |  Branch (2999:25): [True: 21.1k, False: 497]
  ------------------
 3000|  21.1k|                {
 3001|  21.1k|                    if(entries_len % 6 != 0) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (3001:24): [True: 19.8k, False: 1.34k]
  ------------------
 3002|  1.34k|                    splt->n_entries = entries_len / 6;
 3003|  1.34k|                }
 3004|    497|                else return SPNG_ESPLT_DEPTH;
 3005|       |
 3006|  1.49k|                if(!splt->n_entries) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (3006:20): [True: 0, False: 1.49k]
  ------------------
 3007|       |
 3008|  1.49k|                size_t list_size = splt->n_entries;
 3009|       |
 3010|  1.49k|                if(list_size > SIZE_MAX / sizeof(struct spng_splt_entry)) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (3010:20): [True: 0, False: 1.49k]
  ------------------
 3011|       |
 3012|  1.49k|                list_size *= sizeof(struct spng_splt_entry);
 3013|       |
 3014|  1.49k|                if(increase_cache_usage(ctx, list_size, 0)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (3014:20): [True: 0, False: 1.49k]
  ------------------
 3015|       |
 3016|  1.49k|                splt->entries = spng__malloc(ctx, list_size);
 3017|  1.49k|                if(splt->entries == NULL)
  ------------------
  |  Branch (3017:20): [True: 0, False: 1.49k]
  ------------------
 3018|      0|                {
 3019|      0|                    spng__free(ctx, t);
 3020|      0|                    return SPNG_EMEM;
 3021|      0|                }
 3022|       |
 3023|  1.49k|                data = (unsigned char*)t + keyword_len + 2;
 3024|       |
 3025|  1.49k|                uint32_t k;
 3026|  1.49k|                if(splt->sample_depth == 16)
  ------------------
  |  Branch (3026:20): [True: 154, False: 1.34k]
  ------------------
 3027|    154|                {
 3028|  57.9k|                    for(k=0; k < splt->n_entries; k++)
  ------------------
  |  Branch (3028:30): [True: 57.8k, False: 154]
  ------------------
 3029|  57.8k|                    {
 3030|  57.8k|                        splt->entries[k].red =   read_u16(data + k * 10);
 3031|  57.8k|                        splt->entries[k].green = read_u16(data + k * 10 + 2);
 3032|  57.8k|                        splt->entries[k].blue =  read_u16(data + k * 10 + 4);
 3033|  57.8k|                        splt->entries[k].alpha = read_u16(data + k * 10 + 6);
 3034|  57.8k|                        splt->entries[k].frequency = read_u16(data + k * 10 + 8);
 3035|  57.8k|                    }
 3036|    154|                }
 3037|  1.34k|                else if(splt->sample_depth == 8)
  ------------------
  |  Branch (3037:25): [True: 1.34k, False: 0]
  ------------------
 3038|  1.34k|                {
 3039|  54.9k|                    for(k=0; k < splt->n_entries; k++)
  ------------------
  |  Branch (3039:30): [True: 53.6k, False: 1.34k]
  ------------------
 3040|  53.6k|                    {
 3041|  53.6k|                        splt->entries[k].red =   data[k * 6];
 3042|  53.6k|                        splt->entries[k].green = data[k * 6 + 1];
 3043|  53.6k|                        splt->entries[k].blue =  data[k * 6 + 2];
 3044|  53.6k|                        splt->entries[k].alpha = data[k * 6 + 3];
 3045|  53.6k|                        splt->entries[k].frequency = read_u16(data + k * 6 + 4);
 3046|  53.6k|                    }
 3047|  1.34k|                }
 3048|       |
 3049|  1.49k|                spng__free(ctx, t);
 3050|  1.49k|                decrease_cache_usage(ctx, chunk.length);
 3051|       |
 3052|  1.49k|                ctx->stored.splt = 1;
 3053|  1.49k|            }
 3054|  66.4k|            else /* Unknown chunk */
 3055|  66.4k|            {
 3056|  66.4k|                ctx->file.unknown = 1;
 3057|       |
 3058|  66.4k|                if(!ctx->keep_unknown) goto discard;
  ------------------
  |  Branch (3058:20): [True: 66.4k, False: 0]
  ------------------
 3059|      0|                if(ctx->user.unknown) goto discard;
  ------------------
  |  Branch (3059:20): [True: 0, False: 0]
  ------------------
 3060|       |
 3061|      0|                if(increase_cache_usage(ctx, chunk.length + sizeof(struct spng_unknown_chunk), 1)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (3061:20): [True: 0, False: 0]
  ------------------
 3062|       |
 3063|      0|                ctx->n_chunks++;
 3064|      0|                if(ctx->n_chunks < 1) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (3064:20): [True: 0, False: 0]
  ------------------
 3065|      0|                if(sizeof(struct spng_unknown_chunk) > SIZE_MAX / ctx->n_chunks) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (3065:20): [True: 0, False: 0]
  ------------------
 3066|       |
 3067|      0|                void *buf = spng__realloc(ctx, ctx->chunk_list, ctx->n_chunks * sizeof(struct spng_unknown_chunk));
 3068|      0|                if(buf == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (3068:20): [True: 0, False: 0]
  ------------------
 3069|      0|                ctx->chunk_list = buf;
 3070|       |
 3071|      0|                struct spng_unknown_chunk *chunkp = &ctx->chunk_list[ctx->n_chunks - 1];
 3072|       |
 3073|      0|                memset(chunkp, 0, sizeof(struct spng_unknown_chunk));
 3074|       |
 3075|      0|                ctx->undo = chunk_undo;
 3076|       |
 3077|      0|                memcpy(chunkp->type, chunk.type, 4);
 3078|       |
 3079|      0|                if(ctx->state < SPNG_STATE_FIRST_IDAT)
  ------------------
  |  Branch (3079:20): [True: 0, False: 0]
  ------------------
 3080|      0|                {
 3081|      0|                    if(ctx->file.plte) chunkp->location = SPNG_AFTER_PLTE;
  ------------------
  |  Branch (3081:24): [True: 0, False: 0]
  ------------------
 3082|      0|                    else chunkp->location = SPNG_AFTER_IHDR;
 3083|      0|                }
 3084|      0|                else if(ctx->state >= SPNG_STATE_AFTER_IDAT) chunkp->location = SPNG_AFTER_IDAT;
  ------------------
  |  Branch (3084:25): [True: 0, False: 0]
  ------------------
 3085|       |
 3086|      0|                if(chunk.length > 0)
  ------------------
  |  Branch (3086:20): [True: 0, False: 0]
  ------------------
 3087|      0|                {
 3088|      0|                    void *t = spng__malloc(ctx, chunk.length);
 3089|      0|                    if(t == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (3089:24): [True: 0, False: 0]
  ------------------
 3090|       |
 3091|      0|                    ret = read_chunk_bytes2(ctx, t, chunk.length);
 3092|      0|                    if(ret)
  ------------------
  |  Branch (3092:24): [True: 0, False: 0]
  ------------------
 3093|      0|                    {
 3094|      0|                        spng__free(ctx, t);
 3095|      0|                        return ret;
 3096|      0|                    }
 3097|       |
 3098|      0|                    chunkp->length = chunk.length;
 3099|      0|                    chunkp->data = t;
 3100|      0|                }
 3101|       |
 3102|      0|                ctx->stored.unknown = 1;
 3103|      0|            }
 3104|       |
 3105|  80.5k|discard:
 3106|  80.5k|            ret = discard_chunk_bytes(ctx, ctx->cur_chunk_bytes_left);
 3107|  80.5k|            if(ret) return ret;
  ------------------
  |  Branch (3107:16): [True: 1.19k, False: 79.3k]
  ------------------
 3108|  80.5k|        }
 3109|       |
 3110|   383k|    }
 3111|       |
 3112|  13.1k|    return ret;
 3113|   320k|}
spng.c:read_header:
 1060|   406k|{
 1061|   406k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1061:8): [True: 0, False: 406k]
  ------------------
 1062|       |
 1063|   406k|    int ret;
 1064|   406k|    struct spng_chunk chunk = { 0 };
 1065|       |
 1066|   406k|    ret = read_and_check_crc(ctx);
 1067|   406k|    if(ret)
  ------------------
  |  Branch (1067:8): [True: 358k, False: 48.5k]
  ------------------
 1068|   358k|    {
 1069|   358k|        if(ret == -SPNG_CRC_DISCARD)
  ------------------
  |  Branch (1069:12): [True: 357k, False: 743]
  ------------------
 1070|   357k|        {
 1071|   357k|            ctx->discard = 1;
 1072|   357k|        }
 1073|    743|        else return ret;
 1074|   358k|    }
 1075|       |
 1076|   406k|    ret = read_data(ctx, 8);
 1077|   406k|    if(ret) return ret;
  ------------------
  |  Branch (1077:8): [True: 13.3k, False: 392k]
  ------------------
 1078|       |
 1079|   392k|    chunk.offset = ctx->bytes_read - 8;
 1080|       |
 1081|   392k|    chunk.length = read_u32(ctx->data);
 1082|       |
 1083|   392k|    memcpy(&chunk.type, ctx->data + 4, 4);
 1084|       |
 1085|   392k|    if(chunk.length > spng_u32max) return SPNG_ECHUNK_STDLEN;
  ------------------
  |  Branch (1085:8): [True: 623, False: 392k]
  ------------------
 1086|       |
 1087|   392k|    ctx->cur_chunk_bytes_left = chunk.length;
 1088|       |
 1089|   392k|    if(is_critical_chunk(&chunk) && ctx->crc_action_critical == SPNG_CRC_USE) ctx->skip_crc = 1;
  ------------------
  |  Branch (1089:8): [True: 11.5k, False: 380k]
  |  Branch (1089:37): [True: 0, False: 11.5k]
  ------------------
 1090|   392k|    else if(ctx->crc_action_ancillary == SPNG_CRC_USE) ctx->skip_crc = 1;
  ------------------
  |  Branch (1090:13): [True: 0, False: 392k]
  ------------------
 1091|   392k|    else ctx->skip_crc = 0;
 1092|       |
 1093|   392k|    if(!ctx->skip_crc)
  ------------------
  |  Branch (1093:8): [True: 392k, False: 0]
  ------------------
 1094|   392k|    {
 1095|   392k|        ctx->cur_actual_crc = crc32(0, NULL, 0);
  ------------------
  |  |   46|   392k|#  define crc32                 z_crc32
  ------------------
 1096|   392k|        ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, chunk.type, 4);
  ------------------
  |  |   46|   392k|#  define crc32                 z_crc32
  ------------------
 1097|   392k|    }
 1098|       |
 1099|   392k|    ctx->current_chunk = chunk;
 1100|       |
 1101|   392k|    return 0;
 1102|   392k|}
spng.c:is_small_chunk:
 2262|   383k|{
 2263|   383k|    if(!memcmp(type, type_plte, 4)) return 1;
  ------------------
  |  Branch (2263:8): [True: 1.10k, False: 382k]
  ------------------
 2264|   382k|    else if(!memcmp(type, type_chrm, 4)) return 1;
  ------------------
  |  Branch (2264:13): [True: 5.99k, False: 376k]
  ------------------
 2265|   376k|    else if(!memcmp(type, type_gama, 4)) return 1;
  ------------------
  |  Branch (2265:13): [True: 2.23k, False: 374k]
  ------------------
 2266|   374k|    else if(!memcmp(type, type_sbit, 4)) return 1;
  ------------------
  |  Branch (2266:13): [True: 7.02k, False: 367k]
  ------------------
 2267|   367k|    else if(!memcmp(type, type_srgb, 4)) return 1;
  ------------------
  |  Branch (2267:13): [True: 1.03k, False: 366k]
  ------------------
 2268|   366k|    else if(!memcmp(type, type_bkgd, 4)) return 1;
  ------------------
  |  Branch (2268:13): [True: 8.05k, False: 358k]
  ------------------
 2269|   358k|    else if(!memcmp(type, type_trns, 4)) return 1;
  ------------------
  |  Branch (2269:13): [True: 1.47k, False: 356k]
  ------------------
 2270|   356k|    else if(!memcmp(type, type_hist, 4)) return 1;
  ------------------
  |  Branch (2270:13): [True: 427, False: 356k]
  ------------------
 2271|   356k|    else if(!memcmp(type, type_phys, 4)) return 1;
  ------------------
  |  Branch (2271:13): [True: 2.70k, False: 353k]
  ------------------
 2272|   353k|    else if(!memcmp(type, type_time, 4)) return 1;
  ------------------
  |  Branch (2272:13): [True: 20.2k, False: 333k]
  ------------------
 2273|   333k|    else if(!memcmp(type, type_offs, 4)) return 1;
  ------------------
  |  Branch (2273:13): [True: 1.57k, False: 331k]
  ------------------
 2274|   331k|    else return 0;
 2275|   383k|}
spng.c:read_and_check_crc:
 1029|   407k|{
 1030|   407k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1030:8): [True: 0, False: 407k]
  ------------------
 1031|       |
 1032|   407k|    int ret;
 1033|   407k|    ret = read_data(ctx, 4);
 1034|   407k|    if(ret) return ret;
  ------------------
  |  Branch (1034:8): [True: 11.8k, False: 395k]
  ------------------
 1035|       |
 1036|   395k|    ctx->current_chunk.crc = read_u32(ctx->data);
 1037|       |
 1038|   395k|    if(ctx->skip_crc) return 0;
  ------------------
  |  Branch (1038:8): [True: 0, False: 395k]
  ------------------
 1039|       |
 1040|   395k|    if(ctx->cur_actual_crc != ctx->current_chunk.crc)
  ------------------
  |  Branch (1040:8): [True: 346k, False: 48.6k]
  ------------------
 1041|   346k|    {
 1042|   346k|        if(is_critical_chunk(&ctx->current_chunk))
  ------------------
  |  Branch (1042:12): [True: 1.05k, False: 345k]
  ------------------
 1043|  1.05k|        {
 1044|  1.05k|            if(ctx->crc_action_critical == SPNG_CRC_USE) return 0;
  ------------------
  |  Branch (1044:16): [True: 0, False: 1.05k]
  ------------------
 1045|  1.05k|        }
 1046|   345k|        else
 1047|   345k|        {
 1048|   345k|            if(ctx->crc_action_ancillary == SPNG_CRC_USE) return 0;
  ------------------
  |  Branch (1048:16): [True: 0, False: 345k]
  ------------------
 1049|   345k|            if(ctx->crc_action_ancillary == SPNG_CRC_DISCARD) return -SPNG_CRC_DISCARD;
  ------------------
  |  Branch (1049:16): [True: 345k, False: 0]
  ------------------
 1050|   345k|        }
 1051|       |
 1052|  1.05k|        return SPNG_ECHUNK_CRC;
 1053|   346k|    }
 1054|       |
 1055|  48.6k|    return 0;
 1056|   395k|}
spng.c:read_s32:
  462|  1.10k|{
  463|  1.10k|    int32_t ret = (int32_t)read_u32(src);
  464|       |
  465|  1.10k|    return ret;
  466|  1.10k|}
spng.c:increase_cache_usage:
  723|   457k|{
  724|   457k|    if(ctx == NULL || !bytes) return SPNG_EINTERNAL;
  ------------------
  |  Branch (724:8): [True: 0, False: 457k]
  |  Branch (724:23): [True: 0, False: 457k]
  ------------------
  725|       |
  726|   457k|    if(new_chunk)
  ------------------
  |  Branch (726:8): [True: 257k, False: 199k]
  ------------------
  727|   257k|    {
  728|   257k|        ctx->chunk_count_total++;
  729|   257k|        if(ctx->chunk_count_total < 1) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (729:12): [True: 0, False: 257k]
  ------------------
  730|       |
  731|   257k|        if(ctx->chunk_count_total > ctx->chunk_count_limit) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (731:12): [True: 14, False: 257k]
  ------------------
  732|   257k|    }
  733|       |
  734|   456k|    size_t new_usage = ctx->chunk_cache_usage + bytes;
  735|       |
  736|   456k|    if(new_usage < ctx->chunk_cache_usage) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (736:8): [True: 0, False: 456k]
  ------------------
  737|       |
  738|   456k|    if(new_usage > ctx->chunk_cache_limit) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (738:8): [True: 0, False: 456k]
  ------------------
  739|       |
  740|   456k|    ctx->chunk_cache_usage = new_usage;
  741|       |
  742|   456k|    return 0;
  743|   456k|}
spng.c:read_chunk_bytes2:
 1125|  46.1k|{
 1126|  46.1k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1126:8): [True: 0, False: 46.1k]
  ------------------
 1127|  46.1k|    if(!ctx->cur_chunk_bytes_left || !bytes) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1127:8): [True: 0, False: 46.1k]
  |  Branch (1127:38): [True: 0, False: 46.1k]
  ------------------
 1128|  46.1k|    if(bytes > ctx->cur_chunk_bytes_left) return SPNG_EINTERNAL; /* XXX: more specific error? */
  ------------------
  |  Branch (1128:8): [True: 0, False: 46.1k]
  ------------------
 1129|       |
 1130|  46.1k|    int ret;
 1131|  46.1k|    uint32_t len = bytes;
 1132|       |
 1133|  46.1k|    if(ctx->streaming && len > SPNG_READ_SIZE) len = SPNG_READ_SIZE;
  ------------------
  |  |   30|  46.1k|#define SPNG_READ_SIZE (8192)
  ------------------
                  if(ctx->streaming && len > SPNG_READ_SIZE) len = SPNG_READ_SIZE;
  ------------------
  |  |   30|  1.25k|#define SPNG_READ_SIZE (8192)
  ------------------
  |  Branch (1133:8): [True: 46.1k, False: 0]
  |  Branch (1133:26): [True: 1.25k, False: 44.8k]
  ------------------
 1134|       |
 1135|  94.3k|    while(bytes)
  ------------------
  |  Branch (1135:11): [True: 49.6k, False: 44.7k]
  ------------------
 1136|  49.6k|    {
 1137|  49.6k|        if(len > bytes) len = bytes;
  ------------------
  |  Branch (1137:12): [True: 231, False: 49.4k]
  ------------------
 1138|       |
 1139|  49.6k|        ret = ctx->read_fn(ctx, ctx->stream_user_ptr, out, len);
 1140|  49.6k|        if(ret) return ret;
  ------------------
  |  Branch (1140:12): [True: 1.37k, False: 48.2k]
  ------------------
 1141|       |
 1142|  48.2k|        if(!ctx->streaming) memcpy(out, ctx->data, len);
  ------------------
  |  Branch (1142:12): [True: 0, False: 48.2k]
  ------------------
 1143|       |
 1144|  48.2k|        ctx->bytes_read += len;
 1145|  48.2k|        if(ctx->bytes_read < len) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (1145:12): [True: 0, False: 48.2k]
  ------------------
 1146|       |
 1147|  48.2k|        if(!ctx->skip_crc) ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, out, len);
  ------------------
  |  |   46|  48.2k|#  define crc32                 z_crc32
  ------------------
  |  Branch (1147:12): [True: 48.2k, False: 0]
  ------------------
 1148|       |
 1149|  48.2k|        ctx->cur_chunk_bytes_left -= len;
 1150|       |
 1151|  48.2k|        out = (char*)out + len;
 1152|  48.2k|        bytes -= len;
 1153|  48.2k|        len = SPNG_READ_SIZE;
  ------------------
  |  |   30|  48.2k|#define SPNG_READ_SIZE (8192)
  ------------------
 1154|  48.2k|    }
 1155|       |
 1156|  44.7k|    return 0;
 1157|  46.1k|}
spng.c:spng__inflate_stream:
 1254|   184k|{
 1255|   184k|    int ret = spng__inflate_init(ctx, 15);
 1256|   184k|    if(ret) return ret;
  ------------------
  |  Branch (1256:8): [True: 0, False: 184k]
  ------------------
 1257|       |
 1258|   184k|    size_t max = ctx->chunk_cache_limit - ctx->chunk_cache_usage;
 1259|       |
 1260|   184k|    if(ctx->max_chunk_size < max) max = ctx->max_chunk_size;
  ------------------
  |  Branch (1260:8): [True: 184k, False: 0]
  ------------------
 1261|       |
 1262|   184k|    if(extra > max) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (1262:8): [True: 0, False: 184k]
  ------------------
 1263|   184k|    max -= extra;
 1264|       |
 1265|   184k|    uint32_t read_size;
 1266|   184k|    size_t size = 8 * 1024;
 1267|   184k|    void *t, *buf = spng__malloc(ctx, size);
 1268|       |
 1269|   184k|    if(buf == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (1269:8): [True: 0, False: 184k]
  ------------------
 1270|       |
 1271|   184k|    z_stream *stream = &ctx->zstream;
 1272|       |
 1273|   184k|    if(start_buf != NULL && start_len)
  ------------------
  |  Branch (1273:8): [True: 184k, False: 0]
  |  Branch (1273:29): [True: 183k, False: 588]
  ------------------
 1274|   183k|    {
 1275|   183k|        stream->avail_in = (uInt)start_len;
 1276|   183k|        stream->next_in = start_buf;
 1277|   183k|    }
 1278|    588|    else
 1279|    588|    {
 1280|    588|        stream->avail_in = 0;
 1281|    588|        stream->next_in = NULL;
 1282|    588|    }
 1283|       |
 1284|   184k|    stream->avail_out = (uInt)size;
 1285|   184k|    stream->next_out = buf;
 1286|       |
 1287|   220k|    while(ret != Z_STREAM_END)
  ------------------
  |  |  182|   220k|#define Z_STREAM_END    1
  ------------------
  |  Branch (1287:11): [True: 220k, False: 0]
  ------------------
 1288|   220k|    {
 1289|   220k|        ret = inflate(stream, Z_NO_FLUSH);
  ------------------
  |  |  114|   220k|#  define inflate               z_inflate
  ------------------
                      ret = inflate(stream, Z_NO_FLUSH);
  ------------------
  |  |  172|   220k|#define Z_NO_FLUSH      0
  ------------------
 1290|       |
 1291|   220k|        if(ret == Z_STREAM_END) break;
  ------------------
  |  |  182|   220k|#define Z_STREAM_END    1
  ------------------
  |  Branch (1291:12): [True: 224, False: 220k]
  ------------------
 1292|       |
 1293|   220k|        if(ret != Z_OK && ret != Z_BUF_ERROR)
  ------------------
  |  |  181|   440k|#define Z_OK            0
  ------------------
                      if(ret != Z_OK && ret != Z_BUF_ERROR)
  ------------------
  |  |  188|   136k|#define Z_BUF_ERROR    (-5)
  ------------------
  |  Branch (1293:12): [True: 136k, False: 84.0k]
  |  Branch (1293:27): [True: 135k, False: 665]
  ------------------
 1294|   135k|        {
 1295|   135k|            ret = SPNG_EZLIB;
 1296|   135k|            goto err;
 1297|   135k|        }
 1298|       |
 1299|  84.7k|        if(!stream->avail_out) /* Resize buffer */
  ------------------
  |  Branch (1299:12): [True: 10.3k, False: 74.4k]
  ------------------
 1300|  10.3k|        {
 1301|       |            /* overflow or reached chunk/cache limit */
 1302|  10.3k|            if( (2 > SIZE_MAX / size) || (size > max / 2) )
  ------------------
  |  Branch (1302:17): [True: 0, False: 10.3k]
  |  Branch (1302:42): [True: 0, False: 10.3k]
  ------------------
 1303|      0|            {
 1304|      0|                ret = SPNG_ECHUNK_LIMITS;
 1305|      0|                goto err;
 1306|      0|            }
 1307|       |
 1308|  10.3k|            size *= 2;
 1309|       |
 1310|  10.3k|            t = spng__realloc(ctx, buf, size);
 1311|  10.3k|            if(t == NULL) goto mem;
  ------------------
  |  Branch (1311:16): [True: 0, False: 10.3k]
  ------------------
 1312|       |
 1313|  10.3k|            buf = t;
 1314|       |
 1315|  10.3k|            stream->avail_out = (uInt)size / 2;
 1316|  10.3k|            stream->next_out = (unsigned char*)buf + size / 2;
 1317|  10.3k|        }
 1318|  74.4k|        else if(!stream->avail_in) /* Read more chunk bytes */
  ------------------
  |  Branch (1318:17): [True: 74.4k, False: 0]
  ------------------
 1319|  74.4k|        {
 1320|  74.4k|            read_size = ctx->cur_chunk_bytes_left;
 1321|  74.4k|            if(ctx->streaming && read_size > SPNG_READ_SIZE) read_size = SPNG_READ_SIZE;
  ------------------
  |  |   30|  74.4k|#define SPNG_READ_SIZE (8192)
  ------------------
                          if(ctx->streaming && read_size > SPNG_READ_SIZE) read_size = SPNG_READ_SIZE;
  ------------------
  |  |   30|  24.7k|#define SPNG_READ_SIZE (8192)
  ------------------
  |  Branch (1321:16): [True: 74.4k, False: 0]
  |  Branch (1321:34): [True: 24.7k, False: 49.6k]
  ------------------
 1322|       |
 1323|  74.4k|            ret = read_chunk_bytes(ctx, read_size);
 1324|       |
 1325|  74.4k|            if(ret)
  ------------------
  |  Branch (1325:16): [True: 48.3k, False: 26.1k]
  ------------------
 1326|  48.3k|            {
 1327|  48.3k|                if(!read_size) ret = SPNG_EZLIB;
  ------------------
  |  Branch (1327:20): [True: 47.4k, False: 917]
  ------------------
 1328|       |
 1329|  48.3k|                goto err;
 1330|  48.3k|            }
 1331|       |
 1332|  26.1k|            stream->avail_in = read_size;
 1333|  26.1k|            stream->next_in = ctx->data;
 1334|  26.1k|        }
 1335|  84.7k|    }
 1336|       |
 1337|    224|    size = stream->total_out;
 1338|       |
 1339|    224|    if(!size)
  ------------------
  |  Branch (1339:8): [True: 7, False: 217]
  ------------------
 1340|      7|    {
 1341|      7|        ret = SPNG_EZLIB;
 1342|      7|        goto err;
 1343|      7|    }
 1344|       |
 1345|    217|    size += extra;
 1346|    217|    if(size < extra) goto mem;
  ------------------
  |  Branch (1346:8): [True: 0, False: 217]
  ------------------
 1347|       |
 1348|    217|    t = spng__realloc(ctx, buf, size);
 1349|    217|    if(t == NULL) goto mem;
  ------------------
  |  Branch (1349:8): [True: 0, False: 217]
  ------------------
 1350|       |
 1351|    217|    buf = t;
 1352|       |
 1353|    217|    (void)increase_cache_usage(ctx, size, 0);
 1354|       |
 1355|    217|    *out = buf;
 1356|    217|    *len = size;
 1357|       |
 1358|    217|    return 0;
 1359|       |
 1360|      0|mem:
 1361|      0|    ret = SPNG_EMEM;
 1362|   183k|err:
 1363|   183k|    spng__free(ctx, buf);
 1364|   183k|    return ret;
 1365|      0|}
spng.c:spng__realloc:
  416|   266k|{
  417|   266k|    return ctx->alloc.realloc_fn(ptr, size);
  418|   266k|}
spng.c:text_undo:
 2341|   205k|{
 2342|   205k|    struct spng_text2 *text = &ctx->text_list[ctx->n_text - 1];
 2343|       |
 2344|   205k|    spng__free(ctx, text->keyword);
 2345|   205k|    if(text->compression_flag) spng__free(ctx, text->text);
  ------------------
  |  Branch (2345:8): [True: 188k, False: 16.7k]
  ------------------
 2346|       |
 2347|   205k|    decrease_cache_usage(ctx, text->cache_usage);
 2348|   205k|    decrease_cache_usage(ctx, sizeof(struct spng_text2));
 2349|       |
 2350|   205k|    text->keyword = NULL;
 2351|   205k|    text->text = NULL;
 2352|       |
 2353|   205k|    ctx->n_text--;
 2354|   205k|}
spng.c:splt_undo:
 2327|  43.2k|{
 2328|  43.2k|    struct spng_splt *splt = &ctx->splt_list[ctx->n_splt - 1];
 2329|       |
 2330|  43.2k|    spng__free(ctx, splt->entries);
 2331|       |
 2332|  43.2k|    decrease_cache_usage(ctx, sizeof(struct spng_splt));
 2333|  43.2k|    decrease_cache_usage(ctx, splt->n_entries * sizeof(struct spng_splt_entry));
 2334|       |
 2335|  43.2k|    splt->entries = NULL;
 2336|       |
 2337|  43.2k|    ctx->n_splt--;
 2338|  43.2k|}
spng.c:decrease_cache_usage:
  746|   498k|{
  747|   498k|    if(ctx == NULL || !usage) return SPNG_EINTERNAL;
  ------------------
  |  Branch (747:8): [True: 0, False: 498k]
  |  Branch (747:23): [True: 237k, False: 261k]
  ------------------
  748|   261k|    if(usage > ctx->chunk_cache_usage) return SPNG_EINTERNAL;
  ------------------
  |  Branch (748:8): [True: 0, False: 261k]
  ------------------
  749|       |
  750|   261k|    ctx->chunk_cache_usage -= usage;
  751|       |
  752|   261k|    return 0;
  753|   261k|}
spng.c:is_critical_chunk:
  756|  1.60M|{
  757|  1.60M|    if(chunk == NULL) return 0;
  ------------------
  |  Branch (757:8): [True: 0, False: 1.60M]
  ------------------
  758|  1.60M|    if((chunk->type[0] & (1 << 5)) == 0) return 1;
  ------------------
  |  Branch (758:8): [True: 22.8k, False: 1.58M]
  ------------------
  759|       |
  760|  1.58M|    return 0;
  761|  1.60M|}
spng.c:check_decode_fmt:
  639|  7.17k|{
  640|  7.17k|    switch(fmt)
  641|  7.17k|    {
  642|      0|        case SPNG_FMT_RGBA8:
  ------------------
  |  Branch (642:9): [True: 0, False: 7.17k]
  ------------------
  643|      0|        case SPNG_FMT_RGBA16:
  ------------------
  |  Branch (643:9): [True: 0, False: 7.17k]
  ------------------
  644|      0|        case SPNG_FMT_RGB8:
  ------------------
  |  Branch (644:9): [True: 0, False: 7.17k]
  ------------------
  645|  7.17k|        case SPNG_FMT_PNG:
  ------------------
  |  Branch (645:9): [True: 7.17k, False: 0]
  ------------------
  646|  7.17k|        case SPNG_FMT_RAW:
  ------------------
  |  Branch (646:9): [True: 0, False: 7.17k]
  ------------------
  647|  7.17k|            return 0;
  648|      0|        case SPNG_FMT_G8:
  ------------------
  |  Branch (648:9): [True: 0, False: 7.17k]
  ------------------
  649|      0|        case SPNG_FMT_GA8:
  ------------------
  |  Branch (649:9): [True: 0, False: 7.17k]
  ------------------
  650|      0|            if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth <= 8) return 0;
  ------------------
  |  Branch (650:16): [True: 0, False: 0]
  |  Branch (650:65): [True: 0, False: 0]
  ------------------
  651|      0|            else return SPNG_EFMT;
  652|      0|        case SPNG_FMT_GA16:
  ------------------
  |  Branch (652:9): [True: 0, False: 7.17k]
  ------------------
  653|      0|            if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth == 16) return 0;
  ------------------
  |  Branch (653:16): [True: 0, False: 0]
  |  Branch (653:65): [True: 0, False: 0]
  ------------------
  654|      0|            else return SPNG_EFMT;
  655|      0|        default: return SPNG_EFMT;
  ------------------
  |  Branch (655:9): [True: 0, False: 7.17k]
  ------------------
  656|  7.17k|    }
  657|  7.17k|}
spng.c:calculate_image_width:
  660|  7.17k|{
  661|  7.17k|    if(ihdr == NULL || len == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (661:8): [True: 0, False: 7.17k]
  |  Branch (661:24): [True: 0, False: 7.17k]
  ------------------
  662|       |
  663|  7.17k|    size_t res = ihdr->width;
  664|  7.17k|    unsigned bytes_per_pixel;
  665|       |
  666|  7.17k|    switch(fmt)
  667|  7.17k|    {
  668|      0|        case SPNG_FMT_RGBA8:
  ------------------
  |  Branch (668:9): [True: 0, False: 7.17k]
  ------------------
  669|      0|        case SPNG_FMT_GA16:
  ------------------
  |  Branch (669:9): [True: 0, False: 7.17k]
  ------------------
  670|      0|            bytes_per_pixel = 4;
  671|      0|            break;
  672|      0|        case SPNG_FMT_RGBA16:
  ------------------
  |  Branch (672:9): [True: 0, False: 7.17k]
  ------------------
  673|      0|            bytes_per_pixel = 8;
  674|      0|            break;
  675|      0|        case SPNG_FMT_RGB8:
  ------------------
  |  Branch (675:9): [True: 0, False: 7.17k]
  ------------------
  676|      0|            bytes_per_pixel = 3;
  677|      0|            break;
  678|  7.17k|        case SPNG_FMT_PNG:
  ------------------
  |  Branch (678:9): [True: 7.17k, False: 0]
  ------------------
  679|  7.17k|        case SPNG_FMT_RAW:
  ------------------
  |  Branch (679:9): [True: 0, False: 7.17k]
  ------------------
  680|  7.17k|        {
  681|  7.17k|            int ret = calculate_scanline_width(ihdr, ihdr->width, &res);
  682|  7.17k|            if(ret) return ret;
  ------------------
  |  Branch (682:16): [True: 0, False: 7.17k]
  ------------------
  683|       |
  684|  7.17k|            res -= 1; /* exclude filter byte */
  685|  7.17k|            bytes_per_pixel = 1;
  686|  7.17k|            break;
  687|  7.17k|        }
  688|      0|        case SPNG_FMT_G8:
  ------------------
  |  Branch (688:9): [True: 0, False: 7.17k]
  ------------------
  689|      0|            bytes_per_pixel = 1;
  690|      0|            break;
  691|      0|        case SPNG_FMT_GA8:
  ------------------
  |  Branch (691:9): [True: 0, False: 7.17k]
  ------------------
  692|      0|            bytes_per_pixel = 2;
  693|      0|            break;
  694|      0|        default: return SPNG_EINTERNAL;
  ------------------
  |  Branch (694:9): [True: 0, False: 7.17k]
  ------------------
  695|  7.17k|    }
  696|       |
  697|  7.17k|    if(res > SIZE_MAX / bytes_per_pixel) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (697:8): [True: 0, False: 7.17k]
  ------------------
  698|  7.17k|    res = res * bytes_per_pixel;
  699|       |
  700|  7.17k|    *len = res;
  701|       |
  702|  7.17k|    return 0;
  703|  7.17k|}
spng.c:calculate_scanline_width:
  571|  51.2k|{
  572|  51.2k|    if(ihdr == NULL || !width) return SPNG_EINTERNAL;
  ------------------
  |  Branch (572:8): [True: 0, False: 51.2k]
  |  Branch (572:24): [True: 0, False: 51.2k]
  ------------------
  573|       |
  574|  51.2k|    size_t res = num_channels(ihdr) * ihdr->bit_depth;
  575|       |
  576|  51.2k|    if(res > SIZE_MAX / width) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (576:8): [True: 0, False: 51.2k]
  ------------------
  577|  51.2k|    res = res * width;
  578|       |
  579|  51.2k|    res += 15; /* Filter byte + 7 for rounding */
  580|       |
  581|  51.2k|    if(res < 15) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (581:8): [True: 0, False: 51.2k]
  ------------------
  582|       |
  583|  51.2k|    res /= 8;
  584|       |
  585|  51.2k|    if(res > UINT32_MAX) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (585:8): [True: 161, False: 51.0k]
  ------------------
  586|       |
  587|  51.0k|    *scanline_width = res;
  588|       |
  589|  51.0k|    return 0;
  590|  51.2k|}
spng.c:read_idat_bytes:
 1369|  9.73k|{
 1370|  9.73k|    if(ctx == NULL || bytes_read == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1370:8): [True: 0, False: 9.73k]
  |  Branch (1370:23): [True: 0, False: 9.73k]
  ------------------
 1371|  9.73k|    if(memcmp(ctx->current_chunk.type, type_idat, 4)) return SPNG_EIDAT_TOO_SHORT;
  ------------------
  |  Branch (1371:8): [True: 0, False: 9.73k]
  ------------------
 1372|       |
 1373|  9.73k|    int ret;
 1374|  9.73k|    uint32_t len;
 1375|       |
 1376|  9.79k|    while(!ctx->cur_chunk_bytes_left)
  ------------------
  |  Branch (1376:11): [True: 1.70k, False: 8.09k]
  ------------------
 1377|  1.70k|    {
 1378|  1.70k|        ret = read_header(ctx);
 1379|  1.70k|        if(ret) return ret;
  ------------------
  |  Branch (1379:12): [True: 1.64k, False: 61]
  ------------------
 1380|       |
 1381|     61|        if(memcmp(ctx->current_chunk.type, type_idat, 4)) return SPNG_EIDAT_TOO_SHORT;
  ------------------
  |  Branch (1381:12): [True: 7, False: 54]
  ------------------
 1382|     61|    }
 1383|       |
 1384|  8.09k|    if(ctx->streaming)
  ------------------
  |  Branch (1384:8): [True: 8.09k, False: 0]
  ------------------
 1385|  8.09k|    {/* TODO: estimate bytes to read for progressive reads */
 1386|  8.09k|        len = SPNG_READ_SIZE;
  ------------------
  |  |   30|  8.09k|#define SPNG_READ_SIZE (8192)
  ------------------
 1387|  8.09k|        if(len > ctx->cur_chunk_bytes_left) len = ctx->cur_chunk_bytes_left;
  ------------------
  |  Branch (1387:12): [True: 6.49k, False: 1.59k]
  ------------------
 1388|  8.09k|    }
 1389|      0|    else len = ctx->current_chunk.length;
 1390|       |
 1391|  8.09k|    ret = read_chunk_bytes(ctx, len);
 1392|       |
 1393|  8.09k|    *bytes_read = len;
 1394|       |
 1395|  8.09k|    return ret;
 1396|  9.73k|}
spng.c:read_u16:
  447|  3.72M|{
  448|  3.72M|    const unsigned char *data = src;
  449|       |
  450|  3.72M|    return (data[0] & 0xFFU) << 8 | (data[1] & 0xFFU);
  451|  3.72M|}
spng.c:spng__inflate_init:
 1190|   191k|{
 1191|   191k|    if(ctx->zstream.state) inflateEnd(&ctx->zstream);
  ------------------
  |  |  121|   176k|#  define inflateEnd            z_inflateEnd
  ------------------
  |  Branch (1191:8): [True: 176k, False: 14.7k]
  ------------------
 1192|       |
 1193|   191k|    ctx->inflate = 1;
  ------------------
  |  |  114|   191k|#  define inflate               z_inflate
  ------------------
 1194|       |
 1195|   191k|    ctx->zstream.zalloc = spng__zalloc;
 1196|   191k|    ctx->zstream.zfree = spng__zfree;
 1197|   191k|    ctx->zstream.opaque = ctx;
 1198|       |
 1199|   191k|    if(inflateInit2(&ctx->zstream, window_bits) != Z_OK) return SPNG_EZLIB_INIT;
  ------------------
  |  |  125|   191k|#  define inflateInit2          z_inflateInit2
  |  |  ------------------
  |  |  |  | 1926|   191k|          inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   191k|#  define inflateInit2_         z_inflateInit2_
  |  |  |  |  ------------------
  |  |  |  |                         inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   44|   191k|#define ZLIB_VERSION "1.3.2"
  |  |  |  |  ------------------
  |  |  |  | 1927|   191k|                        (int)sizeof(z_stream))
  |  |  ------------------
  ------------------
                  if(inflateInit2(&ctx->zstream, window_bits) != Z_OK) return SPNG_EZLIB_INIT;
  ------------------
  |  |  181|   191k|#define Z_OK            0
  ------------------
  |  Branch (1199:8): [True: 0, False: 191k]
  ------------------
 1200|       |
 1201|   191k|#if ZLIB_VERNUM >= 0x1290 && !defined(SPNG_USE_MINIZ)
 1202|       |
 1203|   191k|    int validate = 1;
 1204|       |
 1205|   191k|    if(ctx->flags & SPNG_CTX_IGNORE_ADLER32) validate = 0;
  ------------------
  |  Branch (1205:8): [True: 0, False: 191k]
  ------------------
 1206|       |
 1207|   191k|    if(is_critical_chunk(&ctx->current_chunk))
  ------------------
  |  Branch (1207:8): [True: 6.89k, False: 184k]
  ------------------
 1208|  6.89k|    {
 1209|  6.89k|        if(ctx->crc_action_critical == SPNG_CRC_USE) validate = 0;
  ------------------
  |  Branch (1209:12): [True: 0, False: 6.89k]
  ------------------
 1210|  6.89k|    }
 1211|   184k|    else /* ancillary */
 1212|   184k|    {
 1213|   184k|        if(ctx->crc_action_ancillary == SPNG_CRC_USE) validate = 0;
  ------------------
  |  Branch (1213:12): [True: 0, False: 184k]
  ------------------
 1214|   184k|    }
 1215|       |
 1216|   191k|    if(inflateValidate(&ctx->zstream, validate)) return SPNG_EZLIB_INIT;
  ------------------
  |  |  137|   191k|#  define inflateValidate       z_inflateValidate
  ------------------
  |  Branch (1216:8): [True: 0, False: 191k]
  ------------------
 1217|       |
 1218|       |#else /* This requires zlib >= 1.2.11 */
 1219|       |#if 0 /* libjpeg-turbo: Silence warning */
 1220|       |    #pragma message ("inflateValidate() not available, SPNG_CTX_IGNORE_ADLER32 will be ignored")
 1221|       |#endif
 1222|       |#endif
 1223|       |
 1224|   191k|    return 0;
 1225|   191k|}
spng.c:spng__zalloc:
  430|   207k|{
  431|   207k|    spng_ctx *ctx = opaque;
  432|       |
  433|   207k|    if(size > SIZE_MAX / items) return NULL;
  ------------------
  |  Branch (433:8): [True: 0, False: 207k]
  ------------------
  434|       |
  435|   207k|    size_t len = (size_t)items * size;
  436|       |
  437|   207k|    return spng__malloc(ctx, len);
  438|   207k|}
spng.c:spng__zfree:
  441|   207k|{
  442|   207k|    spng_ctx *ctx = opqaue;
  443|   207k|    spng__free(ctx, ptr);
  444|   207k|}
spng.c:spng__malloc:
  406|   499k|{
  407|   499k|    return ctx->alloc.malloc_fn(size);
  408|   499k|}
spng.c:sample_to_target:
 1722|   243k|{
 1723|   243k|    if(bit_depth == sbits)
  ------------------
  |  Branch (1723:8): [True: 243k, False: 0]
  ------------------
 1724|   243k|    {
 1725|   243k|        if(target == sbits) return sample; /* No scaling */
  ------------------
  |  Branch (1725:12): [True: 243k, False: 0]
  ------------------
 1726|   243k|    }/* bit_depth > sbits */
 1727|      0|    else sample = sample >> (bit_depth - sbits); /* Shift significant bits to bottom */
 1728|       |
 1729|       |    /* Downscale */
 1730|      0|    if(target < sbits) return sample >> (sbits - target);
  ------------------
  |  Branch (1730:8): [True: 0, False: 0]
  ------------------
 1731|       |
 1732|       |    /* Upscale using left bit replication */
 1733|      0|    int8_t shift_amount = target - sbits;
 1734|      0|    uint16_t sample_bits = sample;
 1735|      0|    sample = 0;
 1736|       |
 1737|      0|    while(shift_amount >= 0)
  ------------------
  |  Branch (1737:11): [True: 0, False: 0]
  ------------------
 1738|      0|    {
 1739|      0|        sample = sample | (sample_bits << shift_amount);
 1740|      0|        shift_amount -= sbits;
 1741|      0|    }
 1742|       |
 1743|      0|    int8_t partial = shift_amount + (int8_t)sbits;
 1744|       |
 1745|      0|    if(partial != 0) sample = sample | (sample_bits >> abs(shift_amount));
  ------------------
  |  Branch (1745:8): [True: 0, False: 0]
  ------------------
 1746|       |
 1747|      0|    return sample;
 1748|      0|}
spng.c:read_scanline_bytes:
 1399|   160k|{
 1400|   160k|    if(ctx == NULL || dest == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1400:8): [True: 0, False: 160k]
  |  Branch (1400:23): [True: 0, False: 160k]
  ------------------
 1401|       |
 1402|   160k|    int ret = Z_OK;
  ------------------
  |  |  181|   160k|#define Z_OK            0
  ------------------
 1403|   160k|    uint32_t bytes_read;
 1404|       |
 1405|   160k|    z_stream *zstream = &ctx->zstream;
 1406|       |
 1407|   160k|    zstream->avail_out = (uInt)len;
 1408|   160k|    zstream->next_out = dest;
 1409|       |
 1410|   321k|    while(zstream->avail_out != 0)
  ------------------
  |  Branch (1410:11): [True: 164k, False: 157k]
  ------------------
 1411|   164k|    {
 1412|   164k|        ret = inflate(zstream, Z_NO_FLUSH);
  ------------------
  |  |  114|   164k|#  define inflate               z_inflate
  ------------------
                      ret = inflate(zstream, Z_NO_FLUSH);
  ------------------
  |  |  172|   164k|#define Z_NO_FLUSH      0
  ------------------
 1413|       |
 1414|   164k|        if(ret == Z_OK) continue;
  ------------------
  |  |  181|   164k|#define Z_OK            0
  ------------------
  |  Branch (1414:12): [True: 158k, False: 5.84k]
  ------------------
 1415|       |
 1416|  5.84k|        if(ret == Z_STREAM_END) /* Reached an end-marker */
  ------------------
  |  |  182|  5.84k|#define Z_STREAM_END    1
  ------------------
  |  Branch (1416:12): [True: 1.34k, False: 4.50k]
  ------------------
 1417|  1.34k|        {
 1418|  1.34k|            if(zstream->avail_out != 0) return SPNG_EIDAT_TOO_SHORT;
  ------------------
  |  Branch (1418:16): [True: 26, False: 1.32k]
  ------------------
 1419|  1.34k|        }
 1420|  4.50k|        else if(ret == Z_BUF_ERROR) /* Read more IDAT bytes */
  ------------------
  |  |  188|  4.50k|#define Z_BUF_ERROR    (-5)
  ------------------
  |  Branch (1420:17): [True: 2.56k, False: 1.93k]
  ------------------
 1421|  2.56k|        {
 1422|  2.56k|            ret = read_idat_bytes(ctx, &bytes_read);
 1423|  2.56k|            if(ret) return ret;
  ------------------
  |  Branch (1423:16): [True: 1.80k, False: 765]
  ------------------
 1424|       |
 1425|    765|            zstream->avail_in = bytes_read;
 1426|    765|            zstream->next_in = ctx->data;
 1427|    765|        }
 1428|  1.93k|        else return SPNG_EIDAT_STREAM;
 1429|  5.84k|    }
 1430|       |
 1431|   157k|    return 0;
 1432|   160k|}
spng.c:calculate_subimages:
  593|  29.2k|{
  594|  29.2k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (594:8): [True: 0, False: 29.2k]
  ------------------
  595|       |
  596|  29.2k|    struct spng_ihdr *ihdr = &ctx->ihdr;
  597|  29.2k|    struct spng_subimage *sub = ctx->subimage;
  598|       |
  599|  29.2k|    if(ihdr->interlace_method == 1)
  ------------------
  |  Branch (599:8): [True: 2.54k, False: 26.6k]
  ------------------
  600|  2.54k|    {
  601|  2.54k|        sub[0].width = (ihdr->width + 7) >> 3;
  602|  2.54k|        sub[0].height = (ihdr->height + 7) >> 3;
  603|  2.54k|        sub[1].width = (ihdr->width + 3) >> 3;
  604|  2.54k|        sub[1].height = (ihdr->height + 7) >> 3;
  605|  2.54k|        sub[2].width = (ihdr->width + 3) >> 2;
  606|  2.54k|        sub[2].height = (ihdr->height + 3) >> 3;
  607|  2.54k|        sub[3].width = (ihdr->width + 1) >> 2;
  608|  2.54k|        sub[3].height = (ihdr->height + 3) >> 2;
  609|  2.54k|        sub[4].width = (ihdr->width + 1) >> 1;
  610|  2.54k|        sub[4].height = (ihdr->height + 1) >> 2;
  611|  2.54k|        sub[5].width = ihdr->width >> 1;
  612|  2.54k|        sub[5].height = (ihdr->height + 1) >> 1;
  613|  2.54k|        sub[6].width = ihdr->width;
  614|  2.54k|        sub[6].height = ihdr->height >> 1;
  615|  2.54k|    }
  616|  26.6k|    else
  617|  26.6k|    {
  618|  26.6k|        sub[0].width = ihdr->width;
  619|  26.6k|        sub[0].height = ihdr->height;
  620|  26.6k|    }
  621|       |
  622|  29.2k|    int i;
  623|   233k|    for(i=0; i < 7; i++)
  ------------------
  |  Branch (623:14): [True: 204k, False: 29.0k]
  ------------------
  624|   204k|    {
  625|   204k|        if(sub[i].width == 0 || sub[i].height == 0) continue;
  ------------------
  |  Branch (625:12): [True: 160k, False: 44.1k]
  |  Branch (625:33): [True: 77, False: 44.0k]
  ------------------
  626|       |
  627|  44.0k|        int ret = calculate_scanline_width(ihdr, sub[i].width, &sub[i].scanline_width);
  628|  44.0k|        if(ret) return ret;
  ------------------
  |  Branch (628:12): [True: 161, False: 43.8k]
  ------------------
  629|       |
  630|  43.8k|        if(sub[ctx->widest_pass].scanline_width < sub[i].scanline_width) ctx->widest_pass = i;
  ------------------
  |  Branch (630:12): [True: 7.18k, False: 36.6k]
  ------------------
  631|       |
  632|  43.8k|        ctx->last_pass = i;
  633|  43.8k|    }
  634|       |
  635|  29.0k|    return 0;
  636|  29.2k|}
spng.c:num_channels:
  556|  65.0k|{
  557|  65.0k|    switch(ihdr->color_type)
  558|  65.0k|    {
  559|  27.9k|        case SPNG_COLOR_TYPE_TRUECOLOR: return 3;
  ------------------
  |  Branch (559:9): [True: 27.9k, False: 37.0k]
  ------------------
  560|    147|        case SPNG_COLOR_TYPE_GRAYSCALE_ALPHA: return 2;
  ------------------
  |  Branch (560:9): [True: 147, False: 64.9k]
  ------------------
  561|  1.39k|        case SPNG_COLOR_TYPE_TRUECOLOR_ALPHA: return 4;
  ------------------
  |  Branch (561:9): [True: 1.39k, False: 63.6k]
  ------------------
  562|  32.7k|        case SPNG_COLOR_TYPE_GRAYSCALE:
  ------------------
  |  Branch (562:9): [True: 32.7k, False: 32.3k]
  ------------------
  563|  35.5k|        case SPNG_COLOR_TYPE_INDEXED:
  ------------------
  |  Branch (563:9): [True: 2.84k, False: 62.2k]
  ------------------
  564|  35.5k|            return 1;
  565|      0|        default: return 0;
  ------------------
  |  Branch (565:9): [True: 0, False: 65.0k]
  ------------------
  566|  65.0k|    }
  567|  65.0k|}
spng.c:spng__free:
  421|  1.09M|{
  422|  1.09M|    ctx->alloc.free_fn(ptr);
  423|  1.09M|}
spng.c:file_read_fn:
 5050|  1.24M|{
 5051|  1.24M|    FILE *file = user;
 5052|  1.24M|    (void)ctx;
 5053|       |
 5054|  1.24M|    if(fread(data, n, 1, file) != 1)
  ------------------
  |  Branch (5054:8): [True: 33.5k, False: 1.20M]
  ------------------
 5055|  33.5k|    {
 5056|  33.5k|        if(feof(file)) return SPNG_IO_EOF;
  ------------------
  |  Branch (5056:12): [True: 33.5k, False: 0]
  ------------------
 5057|      0|        else return SPNG_IO_ERROR;
 5058|  33.5k|    }
 5059|       |
 5060|  1.20M|    return 0;
 5061|  1.24M|}
spng.c:check_ihdr:
 2043|  30.1k|{
 2044|  30.1k|    if(ihdr->width > spng_u32max || !ihdr->width) return SPNG_EWIDTH;
  ------------------
  |  Branch (2044:8): [True: 224, False: 29.8k]
  |  Branch (2044:37): [True: 7, False: 29.8k]
  ------------------
 2045|  29.8k|    if(ihdr->height > spng_u32max || !ihdr->height) return SPNG_EHEIGHT;
  ------------------
  |  Branch (2045:8): [True: 224, False: 29.6k]
  |  Branch (2045:38): [True: 7, False: 29.6k]
  ------------------
 2046|       |
 2047|  29.6k|    if(ihdr->width > max_width) return SPNG_EUSER_WIDTH;
  ------------------
  |  Branch (2047:8): [True: 0, False: 29.6k]
  ------------------
 2048|  29.6k|    if(ihdr->height > max_height) return SPNG_EUSER_HEIGHT;
  ------------------
  |  Branch (2048:8): [True: 0, False: 29.6k]
  ------------------
 2049|       |
 2050|  29.6k|    switch(ihdr->color_type)
 2051|  29.6k|    {
 2052|  21.3k|        case SPNG_COLOR_TYPE_GRAYSCALE:
  ------------------
  |  Branch (2052:9): [True: 21.3k, False: 8.32k]
  ------------------
 2053|  21.3k|        {
 2054|  21.3k|            if( !(ihdr->bit_depth == 1 || ihdr->bit_depth == 2 ||
  ------------------
  |  Branch (2054:19): [True: 14.8k, False: 6.44k]
  |  Branch (2054:43): [True: 42, False: 6.39k]
  ------------------
 2055|  6.39k|                  ihdr->bit_depth == 4 || ihdr->bit_depth == 8 ||
  ------------------
  |  Branch (2055:19): [True: 28, False: 6.37k]
  |  Branch (2055:43): [True: 5.64k, False: 728]
  ------------------
 2056|    728|                  ihdr->bit_depth == 16) )
  ------------------
  |  Branch (2056:19): [True: 609, False: 119]
  ------------------
 2057|    119|                  return SPNG_EBIT_DEPTH;
 2058|       |
 2059|  21.2k|            break;
 2060|  21.3k|        }
 2061|  21.2k|        case SPNG_COLOR_TYPE_TRUECOLOR:
  ------------------
  |  Branch (2061:9): [True: 6.39k, False: 23.2k]
  ------------------
 2062|  6.44k|        case SPNG_COLOR_TYPE_GRAYSCALE_ALPHA:
  ------------------
  |  Branch (2062:9): [True: 49, False: 29.5k]
  ------------------
 2063|  6.68k|        case SPNG_COLOR_TYPE_TRUECOLOR_ALPHA:
  ------------------
  |  Branch (2063:9): [True: 245, False: 29.4k]
  ------------------
 2064|  6.68k|        {
 2065|  6.68k|            if( !(ihdr->bit_depth == 8 || ihdr->bit_depth == 16) )
  ------------------
  |  Branch (2065:19): [True: 4.48k, False: 2.20k]
  |  Branch (2065:43): [True: 2.13k, False: 70]
  ------------------
 2066|     70|                return SPNG_EBIT_DEPTH;
 2067|       |
 2068|  6.61k|            break;
 2069|  6.68k|        }
 2070|  6.61k|        case SPNG_COLOR_TYPE_INDEXED:
  ------------------
  |  Branch (2070:9): [True: 1.56k, False: 28.0k]
  ------------------
 2071|  1.56k|        {
 2072|  1.56k|            if( !(ihdr->bit_depth == 1 || ihdr->bit_depth == 2 ||
  ------------------
  |  Branch (2072:19): [True: 427, False: 1.14k]
  |  Branch (2072:43): [True: 28, False: 1.11k]
  ------------------
 2073|  1.11k|                  ihdr->bit_depth == 4 || ihdr->bit_depth == 8) )
  ------------------
  |  Branch (2073:19): [True: 21, False: 1.09k]
  |  Branch (2073:43): [True: 1.02k, False: 63]
  ------------------
 2074|     63|                return SPNG_EBIT_DEPTH;
 2075|       |
 2076|  1.50k|            break;
 2077|  1.56k|        }
 2078|  1.50k|        default: return SPNG_ECOLOR_TYPE;
  ------------------
  |  Branch (2078:9): [True: 70, False: 29.5k]
  ------------------
 2079|  29.6k|    }
 2080|       |
 2081|  29.3k|    if(ihdr->compression_method) return SPNG_ECOMPRESSION_METHOD;
  ------------------
  |  Branch (2081:8): [True: 42, False: 29.2k]
  ------------------
 2082|  29.2k|    if(ihdr->filter_method) return SPNG_EFILTER_METHOD;
  ------------------
  |  Branch (2082:8): [True: 35, False: 29.2k]
  ------------------
 2083|       |
 2084|  29.2k|    if(ihdr->interlace_method > 1) return SPNG_EINTERLACE_METHOD;
  ------------------
  |  Branch (2084:8): [True: 14, False: 29.2k]
  ------------------
 2085|       |
 2086|  29.2k|    return 0;
 2087|  29.2k|}
spng.c:check_plte:
 2090|  1.02k|{
 2091|  1.02k|    if(plte == NULL || ihdr == NULL) return 1;
  ------------------
  |  Branch (2091:8): [True: 0, False: 1.02k]
  |  Branch (2091:24): [True: 0, False: 1.02k]
  ------------------
 2092|       |
 2093|  1.02k|    if(plte->n_entries == 0) return 1;
  ------------------
  |  Branch (2093:8): [True: 0, False: 1.02k]
  ------------------
 2094|  1.02k|    if(plte->n_entries > 256) return 1;
  ------------------
  |  Branch (2094:8): [True: 154, False: 868]
  ------------------
 2095|       |
 2096|    868|    if(ihdr->color_type == SPNG_COLOR_TYPE_INDEXED)
  ------------------
  |  Branch (2096:8): [True: 728, False: 140]
  ------------------
 2097|    728|    {
 2098|    728|        if(plte->n_entries > (1U << ihdr->bit_depth)) return 1;
  ------------------
  |  Branch (2098:12): [True: 7, False: 721]
  ------------------
 2099|    728|    }
 2100|       |
 2101|    861|    return 0;
 2102|    868|}
spng.c:check_chrm_int:
 2152|  1.74k|{
 2153|  1.74k|    if(chrm_int == NULL) return 1;
  ------------------
  |  Branch (2153:8): [True: 0, False: 1.74k]
  ------------------
 2154|       |
 2155|  1.74k|    if(chrm_int->white_point_x > spng_u32max ||
  ------------------
  |  Branch (2155:8): [True: 119, False: 1.62k]
  ------------------
 2156|  1.62k|       chrm_int->white_point_y > spng_u32max ||
  ------------------
  |  Branch (2156:8): [True: 133, False: 1.49k]
  ------------------
 2157|  1.49k|       chrm_int->red_x > spng_u32max ||
  ------------------
  |  Branch (2157:8): [True: 182, False: 1.30k]
  ------------------
 2158|  1.30k|       chrm_int->red_y > spng_u32max ||
  ------------------
  |  Branch (2158:8): [True: 126, False: 1.18k]
  ------------------
 2159|  1.18k|       chrm_int->green_x  > spng_u32max ||
  ------------------
  |  Branch (2159:8): [True: 147, False: 1.03k]
  ------------------
 2160|  1.03k|       chrm_int->green_y  > spng_u32max ||
  ------------------
  |  Branch (2160:8): [True: 133, False: 903]
  ------------------
 2161|    903|       chrm_int->blue_x > spng_u32max ||
  ------------------
  |  Branch (2161:8): [True: 147, False: 756]
  ------------------
 2162|  1.12k|       chrm_int->blue_y > spng_u32max) return SPNG_ECHRM;
  ------------------
  |  Branch (2162:8): [True: 133, False: 623]
  ------------------
 2163|       |
 2164|    623|    return 0;
 2165|  1.74k|}
spng.c:check_png_keyword:
 2219|  61.0k|{
 2220|  61.0k|    if(str == NULL) return 1;
  ------------------
  |  Branch (2220:8): [True: 0, False: 61.0k]
  ------------------
 2221|  61.0k|    size_t len = strlen(str);
 2222|  61.0k|    const char *end = str + len;
 2223|       |
 2224|  61.0k|    if(!len) return 1;
  ------------------
  |  Branch (2224:8): [True: 8.68k, False: 52.3k]
  ------------------
 2225|  52.3k|    if(len > 79) return 1;
  ------------------
  |  Branch (2225:8): [True: 0, False: 52.3k]
  ------------------
 2226|  52.3k|    if(str[0] == ' ') return 1; /* Leading space */
  ------------------
  |  Branch (2226:8): [True: 84, False: 52.2k]
  ------------------
 2227|  52.2k|    if(end[-1] == ' ') return 1; /* Trailing space */
  ------------------
  |  Branch (2227:8): [True: 1.57k, False: 50.6k]
  ------------------
 2228|  50.6k|    if(strstr(str, "  ") != NULL) return 1; /* Consecutive spaces */
  ------------------
  |  Branch (2228:8): [True: 98, False: 50.5k]
  ------------------
 2229|       |
 2230|  50.5k|    uint8_t c;
 2231|   413k|    while(str != end)
  ------------------
  |  Branch (2231:11): [True: 370k, False: 43.4k]
  ------------------
 2232|   370k|    {
 2233|   370k|        memcpy(&c, str, 1);
 2234|       |
 2235|   370k|        if( (c >= 32 && c <= 126) || (c >= 161) ) str++;
  ------------------
  |  Branch (2235:14): [True: 364k, False: 5.74k]
  |  Branch (2235:25): [True: 255k, False: 109k]
  |  Branch (2235:38): [True: 107k, False: 7.18k]
  ------------------
 2236|  7.18k|        else return 1; /* Invalid character */
 2237|   370k|    }
 2238|       |
 2239|  43.4k|    return 0;
 2240|  50.5k|}
spng.c:check_sbit:
 2105|  4.76k|{
 2106|  4.76k|    if(sbit == NULL || ihdr == NULL) return 1;
  ------------------
  |  Branch (2106:8): [True: 0, False: 4.76k]
  |  Branch (2106:24): [True: 0, False: 4.76k]
  ------------------
 2107|       |
 2108|  4.76k|    if(ihdr->color_type == 0)
  ------------------
  |  Branch (2108:8): [True: 4.07k, False: 686]
  ------------------
 2109|  4.07k|    {
 2110|  4.07k|        if(sbit->grayscale_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2110:12): [True: 476, False: 3.59k]
  ------------------
 2111|  3.59k|        if(sbit->grayscale_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2111:12): [True: 3.52k, False: 77]
  ------------------
 2112|  3.59k|    }
 2113|    686|    else if(ihdr->color_type == 2 || ihdr->color_type == 3)
  ------------------
  |  Branch (2113:13): [True: 511, False: 175]
  |  Branch (2113:38): [True: 175, False: 0]
  ------------------
 2114|    686|    {
 2115|    686|        if(sbit->red_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2115:12): [True: 168, False: 518]
  ------------------
 2116|    518|        if(sbit->green_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2116:12): [True: 105, False: 413]
  ------------------
 2117|    413|        if(sbit->blue_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2117:12): [True: 91, False: 322]
  ------------------
 2118|       |
 2119|    322|        uint8_t bit_depth;
 2120|    322|        if(ihdr->color_type == 3) bit_depth = 8;
  ------------------
  |  Branch (2120:12): [True: 77, False: 245]
  ------------------
 2121|    245|        else bit_depth = ihdr->bit_depth;
 2122|       |
 2123|    322|        if(sbit->red_bits > bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2123:12): [True: 175, False: 147]
  ------------------
 2124|    147|        if(sbit->green_bits > bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2124:12): [True: 35, False: 112]
  ------------------
 2125|    112|        if(sbit->blue_bits > bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2125:12): [True: 70, False: 42]
  ------------------
 2126|    112|    }
 2127|      0|    else if(ihdr->color_type == 4)
  ------------------
  |  Branch (2127:13): [True: 0, False: 0]
  ------------------
 2128|      0|    {
 2129|      0|        if(sbit->grayscale_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2129:12): [True: 0, False: 0]
  ------------------
 2130|      0|        if(sbit->alpha_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2130:12): [True: 0, False: 0]
  ------------------
 2131|       |
 2132|      0|        if(sbit->grayscale_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2132:12): [True: 0, False: 0]
  ------------------
 2133|      0|        if(sbit->alpha_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2133:12): [True: 0, False: 0]
  ------------------
 2134|      0|    }
 2135|      0|    else if(ihdr->color_type == 6)
  ------------------
  |  Branch (2135:13): [True: 0, False: 0]
  ------------------
 2136|      0|    {
 2137|      0|        if(sbit->red_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2137:12): [True: 0, False: 0]
  ------------------
 2138|      0|        if(sbit->green_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2138:12): [True: 0, False: 0]
  ------------------
 2139|      0|        if(sbit->blue_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2139:12): [True: 0, False: 0]
  ------------------
 2140|      0|        if(sbit->alpha_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2140:12): [True: 0, False: 0]
  ------------------
 2141|       |
 2142|      0|        if(sbit->red_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2142:12): [True: 0, False: 0]
  ------------------
 2143|      0|        if(sbit->green_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2143:12): [True: 0, False: 0]
  ------------------
 2144|      0|        if(sbit->blue_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2144:12): [True: 0, False: 0]
  ------------------
 2145|      0|        if(sbit->alpha_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2145:12): [True: 0, False: 0]
  ------------------
 2146|      0|    }
 2147|       |
 2148|    119|    return 0;
 2149|  4.76k|}
spng.c:spng__calloc:
  411|   182k|{
  412|   182k|    return ctx->alloc.calloc_fn(nmemb, size);
  413|   182k|}
spng.c:check_phys:
 2168|  1.71k|{
 2169|  1.71k|    if(phys == NULL) return 1;
  ------------------
  |  Branch (2169:8): [True: 0, False: 1.71k]
  ------------------
 2170|       |
 2171|  1.71k|    if(phys->unit_specifier > 1) return SPNG_EPHYS;
  ------------------
  |  Branch (2171:8): [True: 819, False: 896]
  ------------------
 2172|       |
 2173|    896|    if(phys->ppu_x > spng_u32max) return SPNG_EPHYS;
  ------------------
  |  Branch (2173:8): [True: 686, False: 210]
  ------------------
 2174|    210|    if(phys->ppu_y > spng_u32max) return SPNG_EPHYS;
  ------------------
  |  Branch (2174:8): [True: 147, False: 63]
  ------------------
 2175|       |
 2176|     63|    return 0;
 2177|    210|}
spng.c:check_time:
 2180|  15.3k|{
 2181|  15.3k|    if(time == NULL) return 1;
  ------------------
  |  Branch (2181:8): [True: 0, False: 15.3k]
  ------------------
 2182|       |
 2183|  15.3k|    if(time->month == 0 || time->month > 12) return 1;
  ------------------
  |  Branch (2183:8): [True: 161, False: 15.2k]
  |  Branch (2183:28): [True: 252, False: 14.9k]
  ------------------
 2184|  14.9k|    if(time->day == 0 || time->day > 31) return 1;
  ------------------
  |  Branch (2184:8): [True: 6.61k, False: 8.35k]
  |  Branch (2184:26): [True: 154, False: 8.19k]
  ------------------
 2185|  8.19k|    if(time->hour > 23) return 1;
  ------------------
  |  Branch (2185:8): [True: 126, False: 8.07k]
  ------------------
 2186|  8.07k|    if(time->minute > 59) return 1;
  ------------------
  |  Branch (2186:8): [True: 4.34k, False: 3.73k]
  ------------------
 2187|  3.73k|    if(time->second > 60) return 1;
  ------------------
  |  Branch (2187:8): [True: 3.05k, False: 679]
  ------------------
 2188|       |
 2189|    679|    return 0;
 2190|  3.73k|}
spng.c:check_offs:
 2193|    553|{
 2194|    553|    if(offs == NULL) return 1;
  ------------------
  |  Branch (2194:8): [True: 0, False: 553]
  ------------------
 2195|       |
 2196|    553|    if(offs->unit_specifier > 1) return 1;
  ------------------
  |  Branch (2196:8): [True: 497, False: 56]
  ------------------
 2197|       |
 2198|     56|    return 0;
 2199|    553|}
spng.c:check_exif:
 2202|    399|{
 2203|    399|    if(exif == NULL) return 1;
  ------------------
  |  Branch (2203:8): [True: 0, False: 399]
  ------------------
 2204|    399|    if(exif->data == NULL) return 1;
  ------------------
  |  Branch (2204:8): [True: 0, False: 399]
  ------------------
 2205|       |
 2206|    399|    if(exif->length < 4) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2206:8): [True: 49, False: 350]
  ------------------
 2207|    350|    if(exif->length > spng_u32max) return SPNG_ECHUNK_STDLEN;
  ------------------
  |  Branch (2207:8): [True: 0, False: 350]
  ------------------
 2208|       |
 2209|    350|    const uint8_t exif_le[4] = { 73, 73, 42, 0 };
 2210|    350|    const uint8_t exif_be[4] = { 77, 77, 0, 42 };
 2211|       |
 2212|    350|    if(memcmp(exif->data, exif_le, 4) && memcmp(exif->data, exif_be, 4)) return 1;
  ------------------
  |  Branch (2212:8): [True: 336, False: 14]
  |  Branch (2212:42): [True: 329, False: 7]
  ------------------
 2213|       |
 2214|     21|    return 0;
 2215|    350|}

z_adler32_z:
   61|   441k|uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
   62|   441k|    unsigned long sum2;
   63|   441k|    unsigned n;
   64|       |
   65|       |    /* split Adler-32 into component sums */
   66|   441k|    sum2 = (adler >> 16) & 0xffff;
   67|   441k|    adler &= 0xffff;
   68|       |
   69|       |    /* in case user likes doing a byte at a time, keep it fast */
   70|   441k|    if (len == 1) {
  ------------------
  |  Branch (70:9): [True: 7.78k, False: 434k]
  ------------------
   71|  7.78k|        adler += buf[0];
   72|  7.78k|        if (adler >= BASE)
  ------------------
  |  |   10|  7.78k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (72:13): [True: 7, False: 7.77k]
  ------------------
   73|      7|            adler -= BASE;
  ------------------
  |  |   10|      7|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   74|  7.78k|        sum2 += adler;
   75|  7.78k|        if (sum2 >= BASE)
  ------------------
  |  |   10|  7.78k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (75:13): [True: 286, False: 7.50k]
  ------------------
   76|    286|            sum2 -= BASE;
  ------------------
  |  |   10|    286|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   77|  7.78k|        return adler | (sum2 << 16);
   78|  7.78k|    }
   79|       |
   80|       |    /* initial Adler-32 value (deferred check for len == 1 speed) */
   81|   434k|    if (buf == Z_NULL)
  ------------------
  |  |  216|   434k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (81:9): [True: 181k, False: 252k]
  ------------------
   82|   181k|        return 1L;
   83|       |
   84|       |    /* in case short lengths are provided, keep it somewhat fast */
   85|   252k|    if (len < 16) {
  ------------------
  |  Branch (85:9): [True: 50.1k, False: 202k]
  ------------------
   86|   332k|        while (len--) {
  ------------------
  |  Branch (86:16): [True: 282k, False: 50.1k]
  ------------------
   87|   282k|            adler += *buf++;
   88|   282k|            sum2 += adler;
   89|   282k|        }
   90|  50.1k|        if (adler >= BASE)
  ------------------
  |  |   10|  50.1k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (90:13): [True: 35, False: 50.1k]
  ------------------
   91|     35|            adler -= BASE;
  ------------------
  |  |   10|     35|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   92|  50.1k|        MOD28(sum2);            /* only added so many BASE's */
  ------------------
  |  |   56|  50.1k|#  define MOD28(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|  50.1k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
   93|  50.1k|        return adler | (sum2 << 16);
   94|  50.1k|    }
   95|       |
   96|       |    /* do length NMAX blocks -- requires just one modulo operation */
   97|   424k|    while (len >= NMAX) {
  ------------------
  |  |   11|   424k|#define NMAX 5552
  ------------------
  |  Branch (97:12): [True: 221k, False: 202k]
  ------------------
   98|   221k|        len -= NMAX;
  ------------------
  |  |   11|   221k|#define NMAX 5552
  ------------------
   99|   221k|        n = NMAX / 16;          /* NMAX is divisible by 16 */
  ------------------
  |  |   11|   221k|#define NMAX 5552
  ------------------
  100|  76.9M|        do {
  101|  76.9M|            DO16(buf);          /* 16 sums unrolled */
  ------------------
  |  |   18|  76.9M|#define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|  76.9M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  76.9M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  76.9M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  76.9M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  76.9M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  76.9M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  76.9M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|  76.9M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  76.9M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  76.9M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  76.9M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  76.9M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  76.9M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  76.9M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  76.9M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  102|  76.9M|            buf += 16;
  103|  76.9M|        } while (--n);
  ------------------
  |  Branch (103:18): [True: 76.6M, False: 221k]
  ------------------
  104|   221k|        MOD(adler);
  ------------------
  |  |   55|   221k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|   221k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  105|   221k|        MOD(sum2);
  ------------------
  |  |   55|   221k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|   221k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  106|   221k|    }
  107|       |
  108|       |    /* do remaining bytes (less than NMAX, still just one modulo) */
  109|   202k|    if (len) {                  /* avoid modulos if none remaining */
  ------------------
  |  Branch (109:9): [True: 202k, False: 77]
  ------------------
  110|  10.7M|        while (len >= 16) {
  ------------------
  |  Branch (110:16): [True: 10.5M, False: 202k]
  ------------------
  111|  10.5M|            len -= 16;
  112|  10.5M|            DO16(buf);
  ------------------
  |  |   18|  10.5M|#define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|  10.5M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  10.5M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  10.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  10.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  10.5M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  10.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  10.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|  10.5M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  10.5M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  10.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  10.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  10.5M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  10.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  10.5M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  10.5M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  113|  10.5M|            buf += 16;
  114|  10.5M|        }
  115|  1.18M|        while (len--) {
  ------------------
  |  Branch (115:16): [True: 979k, False: 202k]
  ------------------
  116|   979k|            adler += *buf++;
  117|   979k|            sum2 += adler;
  118|   979k|        }
  119|   202k|        MOD(adler);
  ------------------
  |  |   55|   202k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|   202k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  120|   202k|        MOD(sum2);
  ------------------
  |  |   55|   202k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|   202k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  121|   202k|    }
  122|       |
  123|       |    /* return recombined sums */
  124|   202k|    return adler | (sum2 << 16);
  125|   252k|}
z_adler32:
  128|   441k|uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
  129|   441k|    return adler32_z(adler, buf, len);
  ------------------
  |  |   37|   441k|#  define adler32_z             z_adler32_z
  ------------------
  130|   441k|}

z_crc32_z:
  626|  1.23M|uLong ZEXPORT crc32_z(uLong crc, const unsigned char FAR *buf, z_size_t len) {
  627|       |    /* Return initial CRC, if requested. */
  628|  1.23M|    if (buf == Z_NULL) return 0;
  ------------------
  |  |  216|  1.23M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (628:9): [True: 422k, False: 810k]
  ------------------
  629|       |
  630|       |#ifdef DYNAMIC_CRC_TABLE
  631|       |    z_once(&made, make_crc_table);
  632|       |#endif /* DYNAMIC_CRC_TABLE */
  633|       |
  634|       |    /* Pre-condition the CRC */
  635|   810k|    crc = (~crc) & 0xffffffff;
  636|       |
  637|   810k|#ifdef W
  638|       |
  639|       |    /* If provided enough bytes, do a braided CRC calculation. */
  640|   810k|    if (len >= N * W + W - 1) {
  ------------------
  |  |   64|   810k|#  define N 5
  ------------------
                  if (len >= N * W + W - 1) {
  ------------------
  |  |   90|   810k|#      define W 8
  ------------------
                  if (len >= N * W + W - 1) {
  ------------------
  |  |   90|   810k|#      define W 8
  ------------------
  |  Branch (640:9): [True: 54.4k, False: 756k]
  ------------------
  641|  54.4k|        z_size_t blks;
  642|  54.4k|        z_word_t const *words;
  643|  54.4k|        unsigned endian;
  644|  54.4k|        int k;
  645|       |
  646|       |        /* Compute the CRC up to a z_word_t boundary. */
  647|  54.4k|        while (len && ((z_size_t)buf & (W - 1)) != 0) {
  ------------------
  |  |   90|  54.4k|#      define W 8
  ------------------
  |  Branch (647:16): [True: 54.4k, False: 0]
  |  Branch (647:23): [True: 0, False: 54.4k]
  ------------------
  648|      0|            len--;
  649|      0|            crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  650|      0|        }
  651|       |
  652|       |        /* Compute the CRC on as many N z_word_t blocks as are available. */
  653|  54.4k|        blks = len / (N * W);
  ------------------
  |  |   64|  54.4k|#  define N 5
  ------------------
                      blks = len / (N * W);
  ------------------
  |  |   90|  54.4k|#      define W 8
  ------------------
  654|  54.4k|        len -= blks * N * W;
  ------------------
  |  |   64|  54.4k|#  define N 5
  ------------------
                      len -= blks * N * W;
  ------------------
  |  |   90|  54.4k|#      define W 8
  ------------------
  655|  54.4k|        words = (z_word_t const *)buf;
  656|       |
  657|       |        /* Do endian check at execution time instead of compile time, since ARM
  658|       |           processors can change the endianness at execution time. If the
  659|       |           compiler knows what the endianness will be, it can optimize out the
  660|       |           check and the unused branch. */
  661|  54.4k|        endian = 1;
  662|  54.4k|        if (*(unsigned char *)&endian) {
  ------------------
  |  Branch (662:13): [True: 54.4k, False: 0]
  ------------------
  663|       |            /* Little endian. */
  664|       |
  665|  54.4k|            z_crc_t crc0;
  666|  54.4k|            z_word_t word0;
  667|  54.4k|#if N > 1
  668|  54.4k|            z_crc_t crc1;
  669|  54.4k|            z_word_t word1;
  670|  54.4k|#if N > 2
  671|  54.4k|            z_crc_t crc2;
  672|  54.4k|            z_word_t word2;
  673|  54.4k|#if N > 3
  674|  54.4k|            z_crc_t crc3;
  675|  54.4k|            z_word_t word3;
  676|  54.4k|#if N > 4
  677|  54.4k|            z_crc_t crc4;
  678|  54.4k|            z_word_t word4;
  679|       |#if N > 5
  680|       |            z_crc_t crc5;
  681|       |            z_word_t word5;
  682|       |#endif
  683|  54.4k|#endif
  684|  54.4k|#endif
  685|  54.4k|#endif
  686|  54.4k|#endif
  687|       |
  688|       |            /* Initialize the CRC for each braid. */
  689|  54.4k|            crc0 = crc;
  690|  54.4k|#if N > 1
  691|  54.4k|            crc1 = 0;
  692|  54.4k|#if N > 2
  693|  54.4k|            crc2 = 0;
  694|  54.4k|#if N > 3
  695|  54.4k|            crc3 = 0;
  696|  54.4k|#if N > 4
  697|  54.4k|            crc4 = 0;
  698|       |#if N > 5
  699|       |            crc5 = 0;
  700|       |#endif
  701|  54.4k|#endif
  702|  54.4k|#endif
  703|  54.4k|#endif
  704|  54.4k|#endif
  705|       |
  706|       |            /*
  707|       |              Process the first blks-1 blocks, computing the CRCs on each braid
  708|       |              independently.
  709|       |             */
  710|  7.86M|            while (--blks) {
  ------------------
  |  Branch (710:20): [True: 7.81M, False: 54.4k]
  ------------------
  711|       |                /* Load the word for each braid into registers. */
  712|  7.81M|                word0 = crc0 ^ words[0];
  713|  7.81M|#if N > 1
  714|  7.81M|                word1 = crc1 ^ words[1];
  715|  7.81M|#if N > 2
  716|  7.81M|                word2 = crc2 ^ words[2];
  717|  7.81M|#if N > 3
  718|  7.81M|                word3 = crc3 ^ words[3];
  719|  7.81M|#if N > 4
  720|  7.81M|                word4 = crc4 ^ words[4];
  721|       |#if N > 5
  722|       |                word5 = crc5 ^ words[5];
  723|       |#endif
  724|  7.81M|#endif
  725|  7.81M|#endif
  726|  7.81M|#endif
  727|  7.81M|#endif
  728|  7.81M|                words += N;
  ------------------
  |  |   64|  7.81M|#  define N 5
  ------------------
  729|       |
  730|       |                /* Compute and update the CRC for each word. The loop should
  731|       |                   get unrolled. */
  732|  7.81M|                crc0 = crc_braid_table[0][word0 & 0xff];
  733|  7.81M|#if N > 1
  734|  7.81M|                crc1 = crc_braid_table[0][word1 & 0xff];
  735|  7.81M|#if N > 2
  736|  7.81M|                crc2 = crc_braid_table[0][word2 & 0xff];
  737|  7.81M|#if N > 3
  738|  7.81M|                crc3 = crc_braid_table[0][word3 & 0xff];
  739|  7.81M|#if N > 4
  740|  7.81M|                crc4 = crc_braid_table[0][word4 & 0xff];
  741|       |#if N > 5
  742|       |                crc5 = crc_braid_table[0][word5 & 0xff];
  743|       |#endif
  744|  7.81M|#endif
  745|  7.81M|#endif
  746|  7.81M|#endif
  747|  7.81M|#endif
  748|  62.4M|                for (k = 1; k < W; k++) {
  ------------------
  |  |   90|  62.4M|#      define W 8
  ------------------
  |  Branch (748:29): [True: 54.6M, False: 7.81M]
  ------------------
  749|  54.6M|                    crc0 ^= crc_braid_table[k][(word0 >> (k << 3)) & 0xff];
  750|  54.6M|#if N > 1
  751|  54.6M|                    crc1 ^= crc_braid_table[k][(word1 >> (k << 3)) & 0xff];
  752|  54.6M|#if N > 2
  753|  54.6M|                    crc2 ^= crc_braid_table[k][(word2 >> (k << 3)) & 0xff];
  754|  54.6M|#if N > 3
  755|  54.6M|                    crc3 ^= crc_braid_table[k][(word3 >> (k << 3)) & 0xff];
  756|  54.6M|#if N > 4
  757|  54.6M|                    crc4 ^= crc_braid_table[k][(word4 >> (k << 3)) & 0xff];
  758|       |#if N > 5
  759|       |                    crc5 ^= crc_braid_table[k][(word5 >> (k << 3)) & 0xff];
  760|       |#endif
  761|  54.6M|#endif
  762|  54.6M|#endif
  763|  54.6M|#endif
  764|  54.6M|#endif
  765|  54.6M|                }
  766|  7.81M|            }
  767|       |
  768|       |            /*
  769|       |              Process the last block, combining the CRCs of the N braids at the
  770|       |              same time.
  771|       |             */
  772|  54.4k|            crc = crc_word(crc0 ^ words[0]);
  773|  54.4k|#if N > 1
  774|  54.4k|            crc = crc_word(crc1 ^ words[1] ^ crc);
  775|  54.4k|#if N > 2
  776|  54.4k|            crc = crc_word(crc2 ^ words[2] ^ crc);
  777|  54.4k|#if N > 3
  778|  54.4k|            crc = crc_word(crc3 ^ words[3] ^ crc);
  779|  54.4k|#if N > 4
  780|  54.4k|            crc = crc_word(crc4 ^ words[4] ^ crc);
  781|       |#if N > 5
  782|       |            crc = crc_word(crc5 ^ words[5] ^ crc);
  783|       |#endif
  784|  54.4k|#endif
  785|  54.4k|#endif
  786|  54.4k|#endif
  787|  54.4k|#endif
  788|  54.4k|            words += N;
  ------------------
  |  |   64|  54.4k|#  define N 5
  ------------------
  789|  54.4k|        }
  790|      0|        else {
  791|       |            /* Big endian. */
  792|       |
  793|      0|            z_word_t crc0, word0, comb;
  794|      0|#if N > 1
  795|      0|            z_word_t crc1, word1;
  796|      0|#if N > 2
  797|      0|            z_word_t crc2, word2;
  798|      0|#if N > 3
  799|      0|            z_word_t crc3, word3;
  800|      0|#if N > 4
  801|      0|            z_word_t crc4, word4;
  802|       |#if N > 5
  803|       |            z_word_t crc5, word5;
  804|       |#endif
  805|      0|#endif
  806|      0|#endif
  807|      0|#endif
  808|      0|#endif
  809|       |
  810|       |            /* Initialize the CRC for each braid. */
  811|      0|            crc0 = byte_swap(crc);
  812|      0|#if N > 1
  813|      0|            crc1 = 0;
  814|      0|#if N > 2
  815|      0|            crc2 = 0;
  816|      0|#if N > 3
  817|      0|            crc3 = 0;
  818|      0|#if N > 4
  819|      0|            crc4 = 0;
  820|       |#if N > 5
  821|       |            crc5 = 0;
  822|       |#endif
  823|      0|#endif
  824|      0|#endif
  825|      0|#endif
  826|      0|#endif
  827|       |
  828|       |            /*
  829|       |              Process the first blks-1 blocks, computing the CRCs on each braid
  830|       |              independently.
  831|       |             */
  832|      0|            while (--blks) {
  ------------------
  |  Branch (832:20): [True: 0, False: 0]
  ------------------
  833|       |                /* Load the word for each braid into registers. */
  834|      0|                word0 = crc0 ^ words[0];
  835|      0|#if N > 1
  836|      0|                word1 = crc1 ^ words[1];
  837|      0|#if N > 2
  838|      0|                word2 = crc2 ^ words[2];
  839|      0|#if N > 3
  840|      0|                word3 = crc3 ^ words[3];
  841|      0|#if N > 4
  842|      0|                word4 = crc4 ^ words[4];
  843|       |#if N > 5
  844|       |                word5 = crc5 ^ words[5];
  845|       |#endif
  846|      0|#endif
  847|      0|#endif
  848|      0|#endif
  849|      0|#endif
  850|      0|                words += N;
  ------------------
  |  |   64|      0|#  define N 5
  ------------------
  851|       |
  852|       |                /* Compute and update the CRC for each word. The loop should
  853|       |                   get unrolled. */
  854|      0|                crc0 = crc_braid_big_table[0][word0 & 0xff];
  855|      0|#if N > 1
  856|      0|                crc1 = crc_braid_big_table[0][word1 & 0xff];
  857|      0|#if N > 2
  858|      0|                crc2 = crc_braid_big_table[0][word2 & 0xff];
  859|      0|#if N > 3
  860|      0|                crc3 = crc_braid_big_table[0][word3 & 0xff];
  861|      0|#if N > 4
  862|      0|                crc4 = crc_braid_big_table[0][word4 & 0xff];
  863|       |#if N > 5
  864|       |                crc5 = crc_braid_big_table[0][word5 & 0xff];
  865|       |#endif
  866|      0|#endif
  867|      0|#endif
  868|      0|#endif
  869|      0|#endif
  870|      0|                for (k = 1; k < W; k++) {
  ------------------
  |  |   90|      0|#      define W 8
  ------------------
  |  Branch (870:29): [True: 0, False: 0]
  ------------------
  871|      0|                    crc0 ^= crc_braid_big_table[k][(word0 >> (k << 3)) & 0xff];
  872|      0|#if N > 1
  873|      0|                    crc1 ^= crc_braid_big_table[k][(word1 >> (k << 3)) & 0xff];
  874|      0|#if N > 2
  875|      0|                    crc2 ^= crc_braid_big_table[k][(word2 >> (k << 3)) & 0xff];
  876|      0|#if N > 3
  877|      0|                    crc3 ^= crc_braid_big_table[k][(word3 >> (k << 3)) & 0xff];
  878|      0|#if N > 4
  879|      0|                    crc4 ^= crc_braid_big_table[k][(word4 >> (k << 3)) & 0xff];
  880|       |#if N > 5
  881|       |                    crc5 ^= crc_braid_big_table[k][(word5 >> (k << 3)) & 0xff];
  882|       |#endif
  883|      0|#endif
  884|      0|#endif
  885|      0|#endif
  886|      0|#endif
  887|      0|                }
  888|      0|            }
  889|       |
  890|       |            /*
  891|       |              Process the last block, combining the CRCs of the N braids at the
  892|       |              same time.
  893|       |             */
  894|      0|            comb = crc_word_big(crc0 ^ words[0]);
  895|      0|#if N > 1
  896|      0|            comb = crc_word_big(crc1 ^ words[1] ^ comb);
  897|      0|#if N > 2
  898|      0|            comb = crc_word_big(crc2 ^ words[2] ^ comb);
  899|      0|#if N > 3
  900|      0|            comb = crc_word_big(crc3 ^ words[3] ^ comb);
  901|      0|#if N > 4
  902|      0|            comb = crc_word_big(crc4 ^ words[4] ^ comb);
  903|       |#if N > 5
  904|       |            comb = crc_word_big(crc5 ^ words[5] ^ comb);
  905|       |#endif
  906|      0|#endif
  907|      0|#endif
  908|      0|#endif
  909|      0|#endif
  910|      0|            words += N;
  ------------------
  |  |   64|      0|#  define N 5
  ------------------
  911|      0|            crc = byte_swap(comb);
  912|      0|        }
  913|       |
  914|       |        /*
  915|       |          Update the pointer to the remaining bytes to process.
  916|       |         */
  917|  54.4k|        buf = (unsigned char const *)words;
  918|  54.4k|    }
  919|       |
  920|   810k|#endif /* W */
  921|       |
  922|       |    /* Complete the computation of the CRC on any remaining bytes. */
  923|  2.22M|    while (len >= 8) {
  ------------------
  |  Branch (923:12): [True: 1.41M, False: 810k]
  ------------------
  924|  1.41M|        len -= 8;
  925|  1.41M|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  926|  1.41M|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  927|  1.41M|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  928|  1.41M|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  929|  1.41M|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  930|  1.41M|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  931|  1.41M|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  932|  1.41M|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  933|  1.41M|    }
  934|  3.01M|    while (len) {
  ------------------
  |  Branch (934:12): [True: 2.20M, False: 810k]
  ------------------
  935|  2.20M|        len--;
  936|  2.20M|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  937|  2.20M|    }
  938|       |
  939|       |    /* Return the CRC, post-conditioned. */
  940|   810k|    return crc ^ 0xffffffff;
  941|  1.23M|}
z_crc32:
  946|  1.23M|uLong ZEXPORT crc32(uLong crc, const unsigned char FAR *buf, uInt len) {
  947|       |    #ifdef HAVE_S390X_VX
  948|       |    return crc32_z_hook(crc, buf, len);
  949|       |    #endif
  950|  1.23M|    return crc32_z(crc, buf, len);
  ------------------
  |  |   52|  1.23M|#  define crc32_z               z_crc32_z
  ------------------
  951|  1.23M|}
crc32.c:crc_word:
  608|   272k|local z_crc_t crc_word(z_word_t data) {
  609|   272k|    int k;
  610|  2.44M|    for (k = 0; k < W; k++)
  ------------------
  |  |   90|  2.44M|#      define W 8
  ------------------
  |  Branch (610:17): [True: 2.17M, False: 272k]
  ------------------
  611|  2.17M|        data = (data >> 8) ^ crc_table[data & 0xff];
  612|   272k|    return (z_crc_t)data;
  613|   272k|}

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

z_inflateResetKeep:
  100|   191k|int ZEXPORT inflateResetKeep(z_streamp strm) {
  101|   191k|    struct inflate_state FAR *state;
  102|       |
  103|   191k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (103:9): [True: 0, False: 191k]
  ------------------
  104|   191k|    state = (struct inflate_state FAR *)strm->state;
  105|   191k|    strm->total_in = strm->total_out = state->total = 0;
  106|   191k|    strm->msg = Z_NULL;
  ------------------
  |  |  216|   191k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  107|   191k|    strm->data_type = 0;
  108|   191k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (108:9): [True: 191k, False: 0]
  ------------------
  109|   191k|        strm->adler = state->wrap & 1;
  110|   191k|    state->mode = HEAD;
  111|   191k|    state->last = 0;
  112|   191k|    state->havedict = 0;
  113|   191k|    state->flags = -1;
  114|   191k|    state->dmax = 32768U;
  115|   191k|    state->head = Z_NULL;
  ------------------
  |  |  216|   191k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  116|   191k|    state->hold = 0;
  117|   191k|    state->bits = 0;
  118|   191k|    state->lencode = state->distcode = state->next = state->codes;
  119|   191k|    state->sane = 1;
  120|   191k|    state->back = -1;
  121|   191k|    Tracev((stderr, "inflate: reset\n"));
  122|   191k|    return Z_OK;
  ------------------
  |  |  181|   191k|#define Z_OK            0
  ------------------
  123|   191k|}
z_inflateReset:
  125|   191k|int ZEXPORT inflateReset(z_streamp strm) {
  126|   191k|    struct inflate_state FAR *state;
  127|       |
  128|   191k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (128:9): [True: 0, False: 191k]
  ------------------
  129|   191k|    state = (struct inflate_state FAR *)strm->state;
  130|   191k|    state->wsize = 0;
  131|   191k|    state->whave = 0;
  132|   191k|    state->wnext = 0;
  133|   191k|    return inflateResetKeep(strm);
  ------------------
  |  |  132|   191k|#  define inflateResetKeep      z_inflateResetKeep
  ------------------
  134|   191k|}
z_inflateReset2:
  136|   191k|int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
  137|   191k|    int wrap;
  138|   191k|    struct inflate_state FAR *state;
  139|       |
  140|       |    /* get the state */
  141|   191k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (141:9): [True: 0, False: 191k]
  ------------------
  142|   191k|    state = (struct inflate_state FAR *)strm->state;
  143|       |
  144|       |    /* extract wrap request from windowBits parameter */
  145|   191k|    if (windowBits < 0) {
  ------------------
  |  Branch (145:9): [True: 0, False: 191k]
  ------------------
  146|      0|        if (windowBits < -15)
  ------------------
  |  Branch (146:13): [True: 0, False: 0]
  ------------------
  147|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  148|      0|        wrap = 0;
  149|      0|        windowBits = -windowBits;
  150|      0|    }
  151|   191k|    else {
  152|   191k|        wrap = (windowBits >> 4) + 5;
  153|       |#ifdef GUNZIP
  154|       |        if (windowBits < 48)
  155|       |            windowBits &= 15;
  156|       |#endif
  157|   191k|    }
  158|       |
  159|       |    /* set number of window bits, free window if different */
  160|   191k|    if (windowBits && (windowBits < 8 || windowBits > 15))
  ------------------
  |  Branch (160:9): [True: 191k, False: 0]
  |  Branch (160:24): [True: 0, False: 191k]
  |  Branch (160:42): [True: 0, False: 191k]
  ------------------
  161|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  162|   191k|    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
  ------------------
  |  |  216|   382k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (162:9): [True: 0, False: 191k]
  |  Branch (162:36): [True: 0, False: 0]
  ------------------
  163|      0|        ZFREE(strm, state->window);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  164|      0|        state->window = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  165|      0|    }
  166|       |
  167|       |    /* update state and reset the rest of it */
  168|   191k|    state->wrap = wrap;
  169|   191k|    state->wbits = (unsigned)windowBits;
  170|   191k|    return inflateReset(strm);
  ------------------
  |  |  130|   191k|#  define inflateReset          z_inflateReset
  ------------------
  171|   191k|}
z_inflateInit2_:
  174|   191k|                          const char *version, int stream_size) {
  175|   191k|    int ret;
  176|   191k|    struct inflate_state FAR *state;
  177|       |
  178|   191k|    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |  216|   382k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |   44|   191k|#define ZLIB_VERSION "1.3.2"
  ------------------
  |  Branch (178:9): [True: 0, False: 191k]
  |  Branch (178:30): [True: 0, False: 191k]
  ------------------
  179|   191k|        stream_size != (int)(sizeof(z_stream)))
  ------------------
  |  Branch (179:9): [True: 0, False: 191k]
  ------------------
  180|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  189|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  181|   191k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  216|   191k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (181:9): [True: 0, False: 191k]
  ------------------
  182|   191k|    strm->msg = Z_NULL;                 /* in case we return an error */
  ------------------
  |  |  216|   191k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  183|   191k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (183:9): [True: 0, False: 191k]
  ------------------
  184|       |#ifdef Z_SOLO
  185|       |        return Z_STREAM_ERROR;
  186|       |#else
  187|      0|        strm->zalloc = zcalloc;
  ------------------
  |  |  150|      0|#    define zcalloc               z_zcalloc
  ------------------
  188|      0|        strm->opaque = (voidpf)0;
  189|      0|#endif
  190|      0|    }
  191|   191k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (191:9): [True: 0, False: 191k]
  ------------------
  192|       |#ifdef Z_SOLO
  193|       |        return Z_STREAM_ERROR;
  194|       |#else
  195|      0|        strm->zfree = zcfree;
  ------------------
  |  |  151|      0|#    define zcfree                z_zcfree
  ------------------
  196|   191k|#endif
  197|   191k|    state = (struct inflate_state FAR *)
  198|   191k|            ZALLOC(strm, 1, sizeof(struct inflate_state));
  ------------------
  |  |  253|   191k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  199|   191k|    if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  216|   191k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  |  Branch (199:9): [True: 0, False: 191k]
  ------------------
  200|   191k|    zmemzero(state, sizeof(struct inflate_state));
  ------------------
  |  |  218|   191k|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  201|   191k|    Tracev((stderr, "inflate: allocated\n"));
  202|   191k|    strm->state = (struct internal_state FAR *)state;
  203|   191k|    state->strm = strm;
  204|   191k|    state->window = Z_NULL;
  ------------------
  |  |  216|   191k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  205|   191k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  206|   191k|    ret = inflateReset2(strm, windowBits);
  ------------------
  |  |  131|   191k|#  define inflateReset2         z_inflateReset2
  ------------------
  207|   191k|    if (ret != Z_OK) {
  ------------------
  |  |  181|   191k|#define Z_OK            0
  ------------------
  |  Branch (207:9): [True: 0, False: 191k]
  ------------------
  208|      0|        ZFREE(strm, state);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  209|      0|        strm->state = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  210|      0|    }
  211|   191k|    return ret;
  212|   191k|}
z_inflate:
  474|   384k|int ZEXPORT inflate(z_streamp strm, int flush) {
  475|   384k|    struct inflate_state FAR *state;
  476|   384k|    z_const unsigned char FAR *next;    /* next input */
  477|   384k|    unsigned char FAR *put;     /* next output */
  478|   384k|    unsigned have, left;        /* available input and output */
  479|   384k|    unsigned long hold;         /* bit buffer */
  480|   384k|    unsigned bits;              /* bits in bit buffer */
  481|   384k|    unsigned in, out;           /* save starting available input and output */
  482|   384k|    unsigned copy;              /* number of stored or match bytes to copy */
  483|   384k|    unsigned char FAR *from;    /* where to copy match bytes from */
  484|   384k|    code here;                  /* current decoding table entry */
  485|   384k|    code last;                  /* parent table entry */
  486|   384k|    unsigned len;               /* length to copy for repeats, bits to drop */
  487|   384k|    int ret;                    /* return code */
  488|       |#ifdef GUNZIP
  489|       |    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  490|       |#endif
  491|   384k|    static const unsigned short order[19] = /* permutation of code lengths */
  492|   384k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  493|       |
  494|   384k|    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
  ------------------
  |  |  216|   769k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (494:9): [True: 0, False: 384k]
  |  Branch (494:36): [True: 0, False: 384k]
  ------------------
  495|   384k|        (strm->next_in == Z_NULL && strm->avail_in != 0))
  ------------------
  |  |  216|   769k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (495:10): [True: 588, False: 384k]
  |  Branch (495:37): [True: 0, False: 588]
  ------------------
  496|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  497|       |
  498|   384k|    state = (struct inflate_state FAR *)strm->state;
  499|   384k|    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
  ------------------
  |  Branch (499:9): [True: 28, False: 384k]
  ------------------
  500|   384k|    LOAD();
  ------------------
  |  |  329|   384k|    do { \
  |  |  330|   384k|        put = strm->next_out; \
  |  |  331|   384k|        left = strm->avail_out; \
  |  |  332|   384k|        next = strm->next_in; \
  |  |  333|   384k|        have = strm->avail_in; \
  |  |  334|   384k|        hold = state->hold; \
  |  |  335|   384k|        bits = state->bits; \
  |  |  336|   384k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (336:14): [Folded, False: 384k]
  |  |  ------------------
  ------------------
  501|   384k|    in = have;
  502|   384k|    out = left;
  503|   384k|    ret = Z_OK;
  ------------------
  |  |  181|   384k|#define Z_OK            0
  ------------------
  504|   384k|    for (;;)
  505|  3.19M|        switch (state->mode) {
  506|   191k|        case HEAD:
  ------------------
  |  Branch (506:9): [True: 191k, False: 3.00M]
  ------------------
  507|   191k|            if (state->wrap == 0) {
  ------------------
  |  Branch (507:17): [True: 0, False: 191k]
  ------------------
  508|      0|                state->mode = TYPEDO;
  509|      0|                break;
  510|      0|            }
  511|   191k|            NEEDBITS(16);
  ------------------
  |  |  369|   191k|    do { \
  |  |  370|   571k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 381k, False: 189k]
  |  |  ------------------
  |  |  371|   381k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   381k|    do { \
  |  |  |  |  360|   381k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 1.43k, False: 380k]
  |  |  |  |  ------------------
  |  |  |  |  361|   381k|        have--; \
  |  |  |  |  362|   380k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   380k|        bits += 8; \
  |  |  |  |  364|   380k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 380k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   191k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 189k]
  |  |  ------------------
  ------------------
  512|       |#ifdef GUNZIP
  513|       |            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  514|       |                if (state->wbits == 0)
  515|       |                    state->wbits = 15;
  516|       |                state->check = crc32(0L, Z_NULL, 0);
  517|       |                CRC2(state->check, hold);
  518|       |                INITBITS();
  519|       |                state->mode = FLAGS;
  520|       |                break;
  521|       |            }
  522|       |            if (state->head != Z_NULL)
  523|       |                state->head->done = -1;
  524|       |            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  525|       |#else
  526|   189k|            if (
  527|   189k|#endif
  528|   189k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  376|   189k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  |  Branch (528:17): [True: 5.55k, False: 184k]
  ------------------
  529|  5.55k|                strm->msg = (z_const char *)"incorrect header check";
  530|  5.55k|                state->mode = BAD;
  531|  5.55k|                break;
  532|  5.55k|            }
  533|   184k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  376|   184k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  213|   184k|#define Z_DEFLATED   8
  ------------------
  |  Branch (533:17): [True: 2.96k, False: 181k]
  ------------------
  534|  2.96k|                strm->msg = (z_const char *)"unknown compression method";
  535|  2.96k|                state->mode = BAD;
  536|  2.96k|                break;
  537|  2.96k|            }
  538|   181k|            DROPBITS(4);
  ------------------
  |  |  380|   181k|    do { \
  |  |  381|   181k|        hold >>= (n); \
  |  |  382|   181k|        bits -= (unsigned)(n); \
  |  |  383|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  539|   181k|            len = BITS(4) + 8;
  ------------------
  |  |  376|   181k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  540|   181k|            if (state->wbits == 0)
  ------------------
  |  Branch (540:17): [True: 0, False: 181k]
  ------------------
  541|      0|                state->wbits = len;
  542|   181k|            if (len > 15 || len > state->wbits) {
  ------------------
  |  Branch (542:17): [True: 77, False: 181k]
  |  Branch (542:29): [True: 0, False: 181k]
  ------------------
  543|     77|                strm->msg = (z_const char *)"invalid window size";
  544|     77|                state->mode = BAD;
  545|     77|                break;
  546|     77|            }
  547|   181k|            state->dmax = 1U << len;
  548|   181k|            state->flags = 0;               /* indicate zlib header */
  549|   181k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  550|   181k|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |   34|   181k|#  define adler32               z_adler32
  ------------------
                          strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|   181k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  551|   181k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (551:27): [True: 383, False: 180k]
  ------------------
  552|   181k|            INITBITS();
  ------------------
  |  |  351|   181k|    do { \
  |  |  352|   181k|        hold = 0; \
  |  |  353|   181k|        bits = 0; \
  |  |  354|   181k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 181k]
  |  |  ------------------
  ------------------
  553|   181k|            break;
  554|       |#ifdef GUNZIP
  555|       |        case FLAGS:
  556|       |            NEEDBITS(16);
  557|       |            state->flags = (int)(hold);
  558|       |            if ((state->flags & 0xff) != Z_DEFLATED) {
  559|       |                strm->msg = (z_const char *)"unknown compression method";
  560|       |                state->mode = BAD;
  561|       |                break;
  562|       |            }
  563|       |            if (state->flags & 0xe000) {
  564|       |                strm->msg = (z_const char *)"unknown header flags set";
  565|       |                state->mode = BAD;
  566|       |                break;
  567|       |            }
  568|       |            if (state->head != Z_NULL)
  569|       |                state->head->text = (int)((hold >> 8) & 1);
  570|       |            if ((state->flags & 0x0200) && (state->wrap & 4))
  571|       |                CRC2(state->check, hold);
  572|       |            INITBITS();
  573|       |            state->mode = TIME;
  574|       |                /* fallthrough */
  575|       |        case TIME:
  576|       |            NEEDBITS(32);
  577|       |            if (state->head != Z_NULL)
  578|       |                state->head->time = hold;
  579|       |            if ((state->flags & 0x0200) && (state->wrap & 4))
  580|       |                CRC4(state->check, hold);
  581|       |            INITBITS();
  582|       |            state->mode = OS;
  583|       |                /* fallthrough */
  584|       |        case OS:
  585|       |            NEEDBITS(16);
  586|       |            if (state->head != Z_NULL) {
  587|       |                state->head->xflags = (int)(hold & 0xff);
  588|       |                state->head->os = (int)(hold >> 8);
  589|       |            }
  590|       |            if ((state->flags & 0x0200) && (state->wrap & 4))
  591|       |                CRC2(state->check, hold);
  592|       |            INITBITS();
  593|       |            state->mode = EXLEN;
  594|       |                /* fallthrough */
  595|       |        case EXLEN:
  596|       |            if (state->flags & 0x0400) {
  597|       |                NEEDBITS(16);
  598|       |                state->length = (unsigned)(hold);
  599|       |                if (state->head != Z_NULL)
  600|       |                    state->head->extra_len = (unsigned)hold;
  601|       |                if ((state->flags & 0x0200) && (state->wrap & 4))
  602|       |                    CRC2(state->check, hold);
  603|       |                INITBITS();
  604|       |            }
  605|       |            else if (state->head != Z_NULL)
  606|       |                state->head->extra = Z_NULL;
  607|       |            state->mode = EXTRA;
  608|       |                /* fallthrough */
  609|       |        case EXTRA:
  610|       |            if (state->flags & 0x0400) {
  611|       |                copy = state->length;
  612|       |                if (copy > have) copy = have;
  613|       |                if (copy) {
  614|       |                    if (state->head != Z_NULL &&
  615|       |                        state->head->extra != Z_NULL &&
  616|       |                        (len = state->head->extra_len - state->length) <
  617|       |                            state->head->extra_max) {
  618|       |                        zmemcpy(state->head->extra + len, next,
  619|       |                                len + copy > state->head->extra_max ?
  620|       |                                state->head->extra_max - len : copy);
  621|       |                    }
  622|       |                    if ((state->flags & 0x0200) && (state->wrap & 4))
  623|       |                        state->check = crc32(state->check, next, copy);
  624|       |                    have -= copy;
  625|       |                    next += copy;
  626|       |                    state->length -= copy;
  627|       |                }
  628|       |                if (state->length) goto inf_leave;
  629|       |            }
  630|       |            state->length = 0;
  631|       |            state->mode = NAME;
  632|       |                /* fallthrough */
  633|       |        case NAME:
  634|       |            if (state->flags & 0x0800) {
  635|       |                if (have == 0) goto inf_leave;
  636|       |                copy = 0;
  637|       |                do {
  638|       |                    len = (unsigned)(next[copy++]);
  639|       |                    if (state->head != Z_NULL &&
  640|       |                            state->head->name != Z_NULL &&
  641|       |                            state->length < state->head->name_max)
  642|       |                        state->head->name[state->length++] = (Bytef)len;
  643|       |                } while (len && copy < have);
  644|       |                if ((state->flags & 0x0200) && (state->wrap & 4))
  645|       |                    state->check = crc32(state->check, next, copy);
  646|       |                have -= copy;
  647|       |                next += copy;
  648|       |                if (len) goto inf_leave;
  649|       |            }
  650|       |            else if (state->head != Z_NULL)
  651|       |                state->head->name = Z_NULL;
  652|       |            state->length = 0;
  653|       |            state->mode = COMMENT;
  654|       |                /* fallthrough */
  655|       |        case COMMENT:
  656|       |            if (state->flags & 0x1000) {
  657|       |                if (have == 0) goto inf_leave;
  658|       |                copy = 0;
  659|       |                do {
  660|       |                    len = (unsigned)(next[copy++]);
  661|       |                    if (state->head != Z_NULL &&
  662|       |                            state->head->comment != Z_NULL &&
  663|       |                            state->length < state->head->comm_max)
  664|       |                        state->head->comment[state->length++] = (Bytef)len;
  665|       |                } while (len && copy < have);
  666|       |                if ((state->flags & 0x0200) && (state->wrap & 4))
  667|       |                    state->check = crc32(state->check, next, copy);
  668|       |                have -= copy;
  669|       |                next += copy;
  670|       |                if (len) goto inf_leave;
  671|       |            }
  672|       |            else if (state->head != Z_NULL)
  673|       |                state->head->comment = Z_NULL;
  674|       |            state->mode = HCRC;
  675|       |                /* fallthrough */
  676|       |        case HCRC:
  677|       |            if (state->flags & 0x0200) {
  678|       |                NEEDBITS(16);
  679|       |                if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
  680|       |                    strm->msg = (z_const char *)"header crc mismatch";
  681|       |                    state->mode = BAD;
  682|       |                    break;
  683|       |                }
  684|       |                INITBITS();
  685|       |            }
  686|       |            if (state->head != Z_NULL) {
  687|       |                state->head->hcrc = (int)((state->flags >> 9) & 1);
  688|       |                state->head->done = 1;
  689|       |            }
  690|       |            strm->adler = state->check = crc32(0L, Z_NULL, 0);
  691|       |            state->mode = TYPE;
  692|       |            break;
  693|       |#endif
  694|    409|        case DICTID:
  ------------------
  |  Branch (694:9): [True: 409, False: 3.19M]
  ------------------
  695|    409|            NEEDBITS(32);
  ------------------
  |  |  369|    409|    do { \
  |  |  370|  1.63k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 1.53k, False: 105]
  |  |  ------------------
  |  |  371|  1.53k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  1.53k|    do { \
  |  |  |  |  360|  1.53k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 304, False: 1.22k]
  |  |  |  |  ------------------
  |  |  |  |  361|  1.53k|        have--; \
  |  |  |  |  362|  1.22k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  1.22k|        bits += 8; \
  |  |  |  |  364|  1.22k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 1.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|    409|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 105]
  |  |  ------------------
  ------------------
  696|    105|            strm->adler = state->check = ZSWAP32(hold);
  ------------------
  |  |  258|    105|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|    105|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
  697|    105|            INITBITS();
  ------------------
  |  |  351|    105|    do { \
  |  |  352|    105|        hold = 0; \
  |  |  353|    105|        bits = 0; \
  |  |  354|    105|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 105]
  |  |  ------------------
  ------------------
  698|    105|            state->mode = DICT;
  699|       |                /* fallthrough */
  700|    105|        case DICT:
  ------------------
  |  Branch (700:9): [True: 0, False: 3.19M]
  ------------------
  701|    105|            if (state->havedict == 0) {
  ------------------
  |  Branch (701:17): [True: 105, False: 0]
  ------------------
  702|    105|                RESTORE();
  ------------------
  |  |  340|    105|    do { \
  |  |  341|    105|        strm->next_out = put; \
  |  |  342|    105|        strm->avail_out = left; \
  |  |  343|    105|        strm->next_in = next; \
  |  |  344|    105|        strm->avail_in = have; \
  |  |  345|    105|        state->hold = hold; \
  |  |  346|    105|        state->bits = bits; \
  |  |  347|    105|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 105]
  |  |  ------------------
  ------------------
  703|    105|                return Z_NEED_DICT;
  ------------------
  |  |  183|    105|#define Z_NEED_DICT     2
  ------------------
  704|    105|            }
  705|      0|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |   34|      0|#  define adler32               z_adler32
  ------------------
                          strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  706|      0|            state->mode = TYPE;
  707|       |                /* fallthrough */
  708|   213k|        case TYPE:
  ------------------
  |  Branch (708:9): [True: 213k, False: 2.98M]
  ------------------
  709|   213k|            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  177|   426k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|   213k|#define Z_TREES         6
  ------------------
  |  Branch (709:17): [True: 0, False: 213k]
  |  Branch (709:37): [True: 0, False: 213k]
  ------------------
  710|       |                /* fallthrough */
  711|   213k|        case TYPEDO:
  ------------------
  |  Branch (711:9): [True: 42, False: 3.19M]
  ------------------
  712|   213k|            if (state->last) {
  ------------------
  |  Branch (712:17): [True: 3.59k, False: 209k]
  ------------------
  713|  3.59k|                BYTEBITS();
  ------------------
  |  |  387|  3.59k|    do { \
  |  |  388|  3.59k|        hold >>= bits & 7; \
  |  |  389|  3.59k|        bits -= bits & 7; \
  |  |  390|  3.59k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (390:14): [Folded, False: 3.59k]
  |  |  ------------------
  ------------------
  714|  3.59k|                state->mode = CHECK;
  715|  3.59k|                break;
  716|  3.59k|            }
  717|   209k|            NEEDBITS(3);
  ------------------
  |  |  369|   209k|    do { \
  |  |  370|   405k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 196k, False: 208k]
  |  |  ------------------
  |  |  371|   209k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   196k|    do { \
  |  |  |  |  360|   196k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 1.08k, False: 195k]
  |  |  |  |  ------------------
  |  |  |  |  361|   196k|        have--; \
  |  |  |  |  362|   195k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   195k|        bits += 8; \
  |  |  |  |  364|   195k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 195k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   209k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  718|   208k|            state->last = BITS(1);
  ------------------
  |  |  376|   208k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  719|   208k|            DROPBITS(1);
  ------------------
  |  |  380|   208k|    do { \
  |  |  381|   208k|        hold >>= (n); \
  |  |  382|   208k|        bits -= (unsigned)(n); \
  |  |  383|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  720|   208k|            switch (BITS(2)) {
  ------------------
  |  |  376|   208k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  721|  23.3k|            case 0:                             /* stored block */
  ------------------
  |  Branch (721:13): [True: 23.3k, False: 185k]
  ------------------
  722|  23.3k|                Tracev((stderr, "inflate:     stored block%s\n",
  723|  23.3k|                        state->last ? " (last)" : ""));
  724|  23.3k|                state->mode = STORED;
  725|  23.3k|                break;
  726|  71.2k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (726:13): [True: 71.2k, False: 137k]
  ------------------
  727|  71.2k|                inflate_fixed(state);
  ------------------
  |  |  141|  71.2k|#  define inflate_fixed         z_inflate_fixed
  ------------------
  728|  71.2k|                Tracev((stderr, "inflate:     fixed codes block%s\n",
  729|  71.2k|                        state->last ? " (last)" : ""));
  730|  71.2k|                state->mode = LEN_;             /* decode codes */
  731|  71.2k|                if (flush == Z_TREES) {
  ------------------
  |  |  178|  71.2k|#define Z_TREES         6
  ------------------
  |  Branch (731:21): [True: 0, False: 71.2k]
  ------------------
  732|      0|                    DROPBITS(2);
  ------------------
  |  |  380|      0|    do { \
  |  |  381|      0|        hold >>= (n); \
  |  |  382|      0|        bits -= (unsigned)(n); \
  |  |  383|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  733|      0|                    goto inf_leave;
  734|      0|                }
  735|  71.2k|                break;
  736|   113k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (736:13): [True: 113k, False: 95.6k]
  ------------------
  737|   113k|                Tracev((stderr, "inflate:     dynamic codes block%s\n",
  738|   113k|                        state->last ? " (last)" : ""));
  739|   113k|                state->mode = TABLE;
  740|   113k|                break;
  741|  1.08k|            default:
  ------------------
  |  Branch (741:13): [True: 1.08k, False: 207k]
  ------------------
  742|  1.08k|                strm->msg = (z_const char *)"invalid block type";
  743|  1.08k|                state->mode = BAD;
  744|   208k|            }
  745|   208k|            DROPBITS(2);
  ------------------
  |  |  380|   208k|    do { \
  |  |  381|   208k|        hold >>= (n); \
  |  |  382|   208k|        bits -= (unsigned)(n); \
  |  |  383|   208k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 208k]
  |  |  ------------------
  ------------------
  746|   208k|            break;
  747|  23.4k|        case STORED:
  ------------------
  |  Branch (747:9): [True: 23.4k, False: 3.17M]
  ------------------
  748|  23.4k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  387|  23.4k|    do { \
  |  |  388|  23.4k|        hold >>= bits & 7; \
  |  |  389|  23.4k|        bits -= bits & 7; \
  |  |  390|  23.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (390:14): [Folded, False: 23.4k]
  |  |  ------------------
  ------------------
  749|  23.4k|            NEEDBITS(32);
  ------------------
  |  |  369|  23.4k|    do { \
  |  |  370|   102k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 84.4k, False: 18.5k]
  |  |  ------------------
  |  |  371|  84.4k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  84.4k|    do { \
  |  |  |  |  360|  84.4k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 4.83k, False: 79.5k]
  |  |  |  |  ------------------
  |  |  |  |  361|  84.4k|        have--; \
  |  |  |  |  362|  79.5k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  79.5k|        bits += 8; \
  |  |  |  |  364|  79.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 79.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  23.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 18.5k]
  |  |  ------------------
  ------------------
  750|  18.5k|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (750:17): [True: 12.5k, False: 6.02k]
  ------------------
  751|  12.5k|                strm->msg = (z_const char *)"invalid stored block lengths";
  752|  12.5k|                state->mode = BAD;
  753|  12.5k|                break;
  754|  12.5k|            }
  755|  6.02k|            state->length = (unsigned)hold & 0xffff;
  756|  6.02k|            Tracev((stderr, "inflate:       stored length %u\n",
  757|  6.02k|                    state->length));
  758|  6.02k|            INITBITS();
  ------------------
  |  |  351|  6.02k|    do { \
  |  |  352|  6.02k|        hold = 0; \
  |  |  353|  6.02k|        bits = 0; \
  |  |  354|  6.02k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 6.02k]
  |  |  ------------------
  ------------------
  759|  6.02k|            state->mode = COPY_;
  760|  6.02k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  6.02k|#define Z_TREES         6
  ------------------
  |  Branch (760:17): [True: 0, False: 6.02k]
  ------------------
  761|       |                /* fallthrough */
  762|  6.02k|        case COPY_:
  ------------------
  |  Branch (762:9): [True: 0, False: 3.19M]
  ------------------
  763|  6.02k|            state->mode = COPY;
  764|       |                /* fallthrough */
  765|  60.6k|        case COPY:
  ------------------
  |  Branch (765:9): [True: 54.6k, False: 3.13M]
  ------------------
  766|  60.6k|            copy = state->length;
  767|  60.6k|            if (copy) {
  ------------------
  |  Branch (767:17): [True: 55.4k, False: 5.16k]
  ------------------
  768|  55.4k|                if (copy > have) copy = have;
  ------------------
  |  Branch (768:21): [True: 47.0k, False: 8.38k]
  ------------------
  769|  55.4k|                if (copy > left) copy = left;
  ------------------
  |  Branch (769:21): [True: 48.8k, False: 6.59k]
  ------------------
  770|  55.4k|                if (copy == 0) goto inf_leave;
  ------------------
  |  Branch (770:21): [True: 27.7k, False: 27.7k]
  ------------------
  771|  27.7k|                zmemcpy(put, next, copy);
  ------------------
  |  |  216|  27.7k|#    define zmemcpy memcpy
  ------------------
  772|  27.7k|                have -= copy;
  773|  27.7k|                next += copy;
  774|  27.7k|                left -= copy;
  775|  27.7k|                put += copy;
  776|  27.7k|                state->length -= copy;
  777|  27.7k|                break;
  778|  55.4k|            }
  779|  5.16k|            Tracev((stderr, "inflate:       stored end\n"));
  780|  5.16k|            state->mode = TYPE;
  781|  5.16k|            break;
  782|   113k|        case TABLE:
  ------------------
  |  Branch (782:9): [True: 113k, False: 3.08M]
  ------------------
  783|   113k|            NEEDBITS(14);
  ------------------
  |  |  369|   113k|    do { \
  |  |  370|   338k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 225k, False: 113k]
  |  |  ------------------
  |  |  371|   225k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   225k|    do { \
  |  |  |  |  360|   225k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 56, False: 225k]
  |  |  |  |  ------------------
  |  |  |  |  361|   225k|        have--; \
  |  |  |  |  362|   225k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   225k|        bits += 8; \
  |  |  |  |  364|   225k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 225k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   113k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 113k]
  |  |  ------------------
  ------------------
  784|   113k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  376|   113k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  785|   113k|            DROPBITS(5);
  ------------------
  |  |  380|   113k|    do { \
  |  |  381|   113k|        hold >>= (n); \
  |  |  382|   113k|        bits -= (unsigned)(n); \
  |  |  383|   113k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 113k]
  |  |  ------------------
  ------------------
  786|   113k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  376|   113k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  787|   113k|            DROPBITS(5);
  ------------------
  |  |  380|   113k|    do { \
  |  |  381|   113k|        hold >>= (n); \
  |  |  382|   113k|        bits -= (unsigned)(n); \
  |  |  383|   113k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 113k]
  |  |  ------------------
  ------------------
  788|   113k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  376|   113k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  789|   113k|            DROPBITS(4);
  ------------------
  |  |  380|   113k|    do { \
  |  |  381|   113k|        hold >>= (n); \
  |  |  382|   113k|        bits -= (unsigned)(n); \
  |  |  383|   113k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 113k]
  |  |  ------------------
  ------------------
  790|   113k|#ifndef PKZIP_BUG_WORKAROUND
  791|   113k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (791:17): [True: 805, False: 112k]
  |  Branch (791:38): [True: 993, False: 111k]
  ------------------
  792|  1.79k|                strm->msg = (z_const char *)
  793|  1.79k|                    "too many length or distance symbols";
  794|  1.79k|                state->mode = BAD;
  795|  1.79k|                break;
  796|  1.79k|            }
  797|   111k|#endif
  798|   111k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  799|   111k|            state->have = 0;
  800|   111k|            state->mode = LENLENS;
  801|       |                /* fallthrough */
  802|   111k|        case LENLENS:
  ------------------
  |  Branch (802:9): [True: 53, False: 3.19M]
  ------------------
  803|  1.68M|            while (state->have < state->ncode) {
  ------------------
  |  Branch (803:20): [True: 1.56M, False: 111k]
  ------------------
  804|  1.56M|                NEEDBITS(3);
  ------------------
  |  |  369|  1.56M|    do { \
  |  |  370|  2.11M|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 547k, False: 1.56M]
  |  |  ------------------
  |  |  371|  1.56M|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   547k|    do { \
  |  |  |  |  360|   547k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 176, False: 547k]
  |  |  |  |  ------------------
  |  |  |  |  361|   547k|        have--; \
  |  |  |  |  362|   547k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   547k|        bits += 8; \
  |  |  |  |  364|   547k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 547k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  1.56M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 1.56M]
  |  |  ------------------
  ------------------
  805|  1.56M|                state->lens[order[state->have++]] = (unsigned short)BITS(3);
  ------------------
  |  |  376|  1.56M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  806|  1.56M|                DROPBITS(3);
  ------------------
  |  |  380|  1.56M|    do { \
  |  |  381|  1.56M|        hold >>= (n); \
  |  |  382|  1.56M|        bits -= (unsigned)(n); \
  |  |  383|  1.56M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 1.56M]
  |  |  ------------------
  ------------------
  807|  1.56M|            }
  808|   656k|            while (state->have < 19)
  ------------------
  |  Branch (808:20): [True: 545k, False: 111k]
  ------------------
  809|   545k|                state->lens[order[state->have++]] = 0;
  810|   111k|            state->next = state->codes;
  811|   111k|            state->lencode = state->distcode = (const code FAR *)(state->next);
  812|   111k|            state->lenbits = 7;
  813|   111k|            ret = inflate_table(CODES, state->lens, 19, &(state->next),
  ------------------
  |  |  140|   111k|#  define inflate_table         z_inflate_table
  ------------------
  814|   111k|                                &(state->lenbits), state->work);
  815|   111k|            if (ret) {
  ------------------
  |  Branch (815:17): [True: 65.4k, False: 45.8k]
  ------------------
  816|  65.4k|                strm->msg = (z_const char *)"invalid code lengths set";
  817|  65.4k|                state->mode = BAD;
  818|  65.4k|                break;
  819|  65.4k|            }
  820|  45.8k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  821|  45.8k|            state->have = 0;
  822|  45.8k|            state->mode = CODELENS;
  823|       |                /* fallthrough */
  824|  47.2k|        case CODELENS:
  ------------------
  |  Branch (824:9): [True: 1.46k, False: 3.19M]
  ------------------
  825|  5.21M|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (825:20): [True: 5.21M, False: 5.71k]
  ------------------
  826|  6.30M|                for (;;) {
  827|  6.30M|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  376|  6.30M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  828|  6.30M|                    if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (828:25): [True: 5.20M, False: 1.09M]
  ------------------
  829|  1.09M|                    PULLBYTE();
  ------------------
  |  |  359|  1.09M|    do { \
  |  |  360|  1.09M|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 4.85k, False: 1.09M]
  |  |  ------------------
  |  |  361|  1.09M|        have--; \
  |  |  362|  1.09M|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|  1.09M|        bits += 8; \
  |  |  364|  1.09M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 1.09M]
  |  |  ------------------
  ------------------
  830|  1.09M|                }
  831|  5.20M|                if (here.val < 16) {
  ------------------
  |  Branch (831:21): [True: 4.70M, False: 497k]
  ------------------
  832|  4.70M|                    DROPBITS(here.bits);
  ------------------
  |  |  380|  4.70M|    do { \
  |  |  381|  4.70M|        hold >>= (n); \
  |  |  382|  4.70M|        bits -= (unsigned)(n); \
  |  |  383|  4.70M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 4.70M]
  |  |  ------------------
  ------------------
  833|  4.70M|                    state->lens[state->have++] = here.val;
  834|  4.70M|                }
  835|   497k|                else {
  836|   497k|                    if (here.val == 16) {
  ------------------
  |  Branch (836:25): [True: 79.1k, False: 418k]
  ------------------
  837|  79.1k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  369|  79.1k|    do { \
  |  |  370|  99.7k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 20.8k, False: 78.8k]
  |  |  ------------------
  |  |  371|  79.1k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  20.8k|    do { \
  |  |  |  |  360|  20.8k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 243, False: 20.6k]
  |  |  |  |  ------------------
  |  |  |  |  361|  20.8k|        have--; \
  |  |  |  |  362|  20.6k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  20.6k|        bits += 8; \
  |  |  |  |  364|  20.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 20.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  79.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 78.8k]
  |  |  ------------------
  ------------------
  838|  78.8k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  78.8k|    do { \
  |  |  381|  78.8k|        hold >>= (n); \
  |  |  382|  78.8k|        bits -= (unsigned)(n); \
  |  |  383|  78.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 78.8k]
  |  |  ------------------
  ------------------
  839|  78.8k|                        if (state->have == 0) {
  ------------------
  |  Branch (839:29): [True: 84, False: 78.7k]
  ------------------
  840|     84|                            strm->msg = (z_const char *)
  841|     84|                                "invalid bit length repeat";
  842|     84|                            state->mode = BAD;
  843|     84|                            break;
  844|     84|                        }
  845|  78.7k|                        len = state->lens[state->have - 1];
  846|  78.7k|                        copy = 3 + BITS(2);
  ------------------
  |  |  376|  78.7k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  847|  78.7k|                        DROPBITS(2);
  ------------------
  |  |  380|  78.7k|    do { \
  |  |  381|  78.7k|        hold >>= (n); \
  |  |  382|  78.7k|        bits -= (unsigned)(n); \
  |  |  383|  78.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 78.7k]
  |  |  ------------------
  ------------------
  848|  78.7k|                    }
  849|   418k|                    else if (here.val == 17) {
  ------------------
  |  Branch (849:30): [True: 301k, False: 117k]
  ------------------
  850|   301k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  369|   301k|    do { \
  |  |  370|   405k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 123k, False: 282k]
  |  |  ------------------
  |  |  371|   301k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   123k|    do { \
  |  |  |  |  360|   123k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 18.4k, False: 104k]
  |  |  |  |  ------------------
  |  |  |  |  361|   123k|        have--; \
  |  |  |  |  362|   104k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   104k|        bits += 8; \
  |  |  |  |  364|   104k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 104k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   301k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 282k]
  |  |  ------------------
  ------------------
  851|   282k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|   282k|    do { \
  |  |  381|   282k|        hold >>= (n); \
  |  |  382|   282k|        bits -= (unsigned)(n); \
  |  |  383|   282k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 282k]
  |  |  ------------------
  ------------------
  852|   282k|                        len = 0;
  853|   282k|                        copy = 3 + BITS(3);
  ------------------
  |  |  376|   282k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  854|   282k|                        DROPBITS(3);
  ------------------
  |  |  380|   282k|    do { \
  |  |  381|   282k|        hold >>= (n); \
  |  |  382|   282k|        bits -= (unsigned)(n); \
  |  |  383|   282k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 282k]
  |  |  ------------------
  ------------------
  855|   282k|                    }
  856|   117k|                    else {
  857|   117k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  369|   117k|    do { \
  |  |  370|   216k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 114k, False: 101k]
  |  |  ------------------
  |  |  371|   117k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   114k|    do { \
  |  |  |  |  360|   114k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 15.6k, False: 98.8k]
  |  |  |  |  ------------------
  |  |  |  |  361|   114k|        have--; \
  |  |  |  |  362|  98.8k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  98.8k|        bits += 8; \
  |  |  |  |  364|  98.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 98.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   117k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 101k]
  |  |  ------------------
  ------------------
  858|   101k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|   101k|    do { \
  |  |  381|   101k|        hold >>= (n); \
  |  |  382|   101k|        bits -= (unsigned)(n); \
  |  |  383|   101k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 101k]
  |  |  ------------------
  ------------------
  859|   101k|                        len = 0;
  860|   101k|                        copy = 11 + BITS(7);
  ------------------
  |  |  376|   101k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  861|   101k|                        DROPBITS(7);
  ------------------
  |  |  380|   101k|    do { \
  |  |  381|   101k|        hold >>= (n); \
  |  |  382|   101k|        bits -= (unsigned)(n); \
  |  |  383|   101k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 101k]
  |  |  ------------------
  ------------------
  862|   101k|                    }
  863|   463k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (863:25): [True: 2.23k, False: 460k]
  ------------------
  864|  2.23k|                        strm->msg = (z_const char *)
  865|  2.23k|                            "invalid bit length repeat";
  866|  2.23k|                        state->mode = BAD;
  867|  2.23k|                        break;
  868|  2.23k|                    }
  869|  8.13M|                    while (copy--)
  ------------------
  |  Branch (869:28): [True: 7.67M, False: 460k]
  ------------------
  870|  7.67M|                        state->lens[state->have++] = (unsigned short)len;
  871|   460k|                }
  872|  5.20M|            }
  873|       |
  874|       |            /* handle error breaks in while */
  875|  8.03k|            if (state->mode == BAD) break;
  ------------------
  |  Branch (875:17): [True: 2.31k, False: 5.71k]
  ------------------
  876|       |
  877|       |            /* check for end-of-block code (better have one) */
  878|  5.71k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (878:17): [True: 438, False: 5.28k]
  ------------------
  879|    438|                strm->msg = (z_const char *)
  880|    438|                    "invalid code -- missing end-of-block";
  881|    438|                state->mode = BAD;
  882|    438|                break;
  883|    438|            }
  884|       |
  885|       |            /* build code tables -- note: do not change the lenbits or distbits
  886|       |               values here (9 and 6) without reading the comments in inftrees.h
  887|       |               concerning the ENOUGH constants, which depend on those values */
  888|  5.28k|            state->next = state->codes;
  889|  5.28k|            state->lencode = (const code FAR *)(state->next);
  890|  5.28k|            state->lenbits = 9;
  891|  5.28k|            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
  ------------------
  |  |  140|  5.28k|#  define inflate_table         z_inflate_table
  ------------------
  892|  5.28k|                                &(state->lenbits), state->work);
  893|  5.28k|            if (ret) {
  ------------------
  |  Branch (893:17): [True: 2.02k, False: 3.25k]
  ------------------
  894|  2.02k|                strm->msg = (z_const char *)"invalid literal/lengths set";
  895|  2.02k|                state->mode = BAD;
  896|  2.02k|                break;
  897|  2.02k|            }
  898|  3.25k|            state->distcode = (const code FAR *)(state->next);
  899|  3.25k|            state->distbits = 6;
  900|  3.25k|            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  ------------------
  |  |  140|  3.25k|#  define inflate_table         z_inflate_table
  ------------------
  901|  3.25k|                            &(state->next), &(state->distbits), state->work);
  902|  3.25k|            if (ret) {
  ------------------
  |  Branch (902:17): [True: 233, False: 3.01k]
  ------------------
  903|    233|                strm->msg = (z_const char *)"invalid distances set";
  904|    233|                state->mode = BAD;
  905|    233|                break;
  906|    233|            }
  907|  3.01k|            Tracev((stderr, "inflate:       codes ok\n"));
  908|  3.01k|            state->mode = LEN_;
  909|  3.01k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  3.01k|#define Z_TREES         6
  ------------------
  |  Branch (909:17): [True: 0, False: 3.01k]
  ------------------
  910|       |                /* fallthrough */
  911|  74.2k|        case LEN_:
  ------------------
  |  Branch (911:9): [True: 71.2k, False: 3.12M]
  ------------------
  912|  74.2k|            state->mode = LEN;
  913|       |                /* fallthrough */
  914|  1.60M|        case LEN:
  ------------------
  |  Branch (914:9): [True: 1.52M, False: 1.66M]
  ------------------
  915|  1.60M|            if (have >= 6 && left >= 258) {
  ------------------
  |  Branch (915:17): [True: 1.42M, False: 172k]
  |  Branch (915:30): [True: 233k, False: 1.19M]
  ------------------
  916|   233k|                RESTORE();
  ------------------
  |  |  340|   233k|    do { \
  |  |  341|   233k|        strm->next_out = put; \
  |  |  342|   233k|        strm->avail_out = left; \
  |  |  343|   233k|        strm->next_in = next; \
  |  |  344|   233k|        strm->avail_in = have; \
  |  |  345|   233k|        state->hold = hold; \
  |  |  346|   233k|        state->bits = bits; \
  |  |  347|   233k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 233k]
  |  |  ------------------
  ------------------
  917|   233k|                inflate_fast(strm, out);
  ------------------
  |  |  139|   233k|#  define inflate_fast          z_inflate_fast
  ------------------
  918|   233k|                LOAD();
  ------------------
  |  |  329|   233k|    do { \
  |  |  330|   233k|        put = strm->next_out; \
  |  |  331|   233k|        left = strm->avail_out; \
  |  |  332|   233k|        next = strm->next_in; \
  |  |  333|   233k|        have = strm->avail_in; \
  |  |  334|   233k|        hold = state->hold; \
  |  |  335|   233k|        bits = state->bits; \
  |  |  336|   233k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (336:14): [Folded, False: 233k]
  |  |  ------------------
  ------------------
  919|   233k|                if (state->mode == TYPE)
  ------------------
  |  Branch (919:21): [True: 19.2k, False: 214k]
  ------------------
  920|  19.2k|                    state->back = -1;
  921|   233k|                break;
  922|   233k|            }
  923|  1.36M|            state->back = 0;
  924|  2.62M|            for (;;) {
  925|  2.62M|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  376|  2.62M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  926|  2.62M|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (926:21): [True: 1.34M, False: 1.27M]
  ------------------
  927|  1.27M|                PULLBYTE();
  ------------------
  |  |  359|  1.27M|    do { \
  |  |  360|  1.27M|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 20.1k, False: 1.25M]
  |  |  ------------------
  |  |  361|  1.27M|        have--; \
  |  |  362|  1.25M|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|  1.25M|        bits += 8; \
  |  |  364|  1.25M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 1.25M]
  |  |  ------------------
  ------------------
  928|  1.27M|            }
  929|  1.34M|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (929:17): [True: 858k, False: 490k]
  |  Branch (929:28): [True: 593k, False: 264k]
  ------------------
  930|   593k|                last = here;
  931|   812k|                for (;;) {
  932|   812k|                    here = state->lencode[last.val +
  933|   812k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  376|   812k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  934|   812k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (934:25): [True: 593k, False: 219k]
  ------------------
  935|   219k|                    PULLBYTE();
  ------------------
  |  |  359|   219k|    do { \
  |  |  360|   219k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 433, False: 218k]
  |  |  ------------------
  |  |  361|   219k|        have--; \
  |  |  362|   218k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   218k|        bits += 8; \
  |  |  364|   218k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 218k]
  |  |  ------------------
  ------------------
  936|   219k|                }
  937|   593k|                DROPBITS(last.bits);
  ------------------
  |  |  380|   593k|    do { \
  |  |  381|   593k|        hold >>= (n); \
  |  |  382|   593k|        bits -= (unsigned)(n); \
  |  |  383|   593k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 593k]
  |  |  ------------------
  ------------------
  938|   593k|                state->back += last.bits;
  939|   593k|            }
  940|  1.34M|            DROPBITS(here.bits);
  ------------------
  |  |  380|  1.34M|    do { \
  |  |  381|  1.34M|        hold >>= (n); \
  |  |  382|  1.34M|        bits -= (unsigned)(n); \
  |  |  383|  1.34M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 1.34M]
  |  |  ------------------
  ------------------
  941|  1.34M|            state->back += here.bits;
  942|  1.34M|            state->length = (unsigned)here.val;
  943|  1.34M|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (943:17): [True: 494k, False: 853k]
  ------------------
  944|   494k|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
  945|   494k|                        "inflate:         literal '%c'\n" :
  946|   494k|                        "inflate:         literal 0x%02x\n", here.val));
  947|   494k|                state->mode = LIT;
  948|   494k|                break;
  949|   494k|            }
  950|   853k|            if (here.op & 32) {
  ------------------
  |  Branch (950:17): [True: 8.35k, False: 844k]
  ------------------
  951|  8.35k|                Tracevv((stderr, "inflate:         end of block\n"));
  952|  8.35k|                state->back = -1;
  953|  8.35k|                state->mode = TYPE;
  954|  8.35k|                break;
  955|  8.35k|            }
  956|   844k|            if (here.op & 64) {
  ------------------
  |  Branch (956:17): [True: 2.04k, False: 842k]
  ------------------
  957|  2.04k|                strm->msg = (z_const char *)"invalid literal/length code";
  958|  2.04k|                state->mode = BAD;
  959|  2.04k|                break;
  960|  2.04k|            }
  961|   842k|            state->extra = (unsigned)(here.op) & 15;
  962|   842k|            state->mode = LENEXT;
  963|       |                /* fallthrough */
  964|   844k|        case LENEXT:
  ------------------
  |  Branch (964:9): [True: 1.45k, False: 3.19M]
  ------------------
  965|   844k|            if (state->extra) {
  ------------------
  |  Branch (965:17): [True: 622k, False: 221k]
  ------------------
  966|   622k|                NEEDBITS(state->extra);
  ------------------
  |  |  369|   622k|    do { \
  |  |  370|   822k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 200k, False: 621k]
  |  |  ------------------
  |  |  371|   622k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   200k|    do { \
  |  |  |  |  360|   200k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 1.56k, False: 199k]
  |  |  |  |  ------------------
  |  |  |  |  361|   200k|        have--; \
  |  |  |  |  362|   199k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   199k|        bits += 8; \
  |  |  |  |  364|   199k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 199k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   622k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 621k]
  |  |  ------------------
  ------------------
  967|   621k|                state->length += BITS(state->extra);
  ------------------
  |  |  376|   621k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  968|   621k|                DROPBITS(state->extra);
  ------------------
  |  |  380|   621k|    do { \
  |  |  381|   621k|        hold >>= (n); \
  |  |  382|   621k|        bits -= (unsigned)(n); \
  |  |  383|   621k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 621k]
  |  |  ------------------
  ------------------
  969|   621k|                state->back += state->extra;
  970|   621k|            }
  971|   842k|            Tracevv((stderr, "inflate:         length %u\n", state->length));
  972|   842k|            state->was = state->length;
  973|   842k|            state->mode = DIST;
  974|       |                /* fallthrough */
  975|   844k|        case DIST:
  ------------------
  |  Branch (975:9): [True: 2.25k, False: 3.19M]
  ------------------
  976|  1.36M|            for (;;) {
  977|  1.36M|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  376|  1.36M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  978|  1.36M|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (978:21): [True: 842k, False: 526k]
  ------------------
  979|   526k|                PULLBYTE();
  ------------------
  |  |  359|   526k|    do { \
  |  |  360|   526k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 2.42k, False: 524k]
  |  |  ------------------
  |  |  361|   526k|        have--; \
  |  |  362|   524k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   524k|        bits += 8; \
  |  |  364|   524k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 524k]
  |  |  ------------------
  ------------------
  980|   526k|            }
  981|   842k|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (981:17): [True: 573k, False: 269k]
  ------------------
  982|   573k|                last = here;
  983|   788k|                for (;;) {
  984|   788k|                    here = state->distcode[last.val +
  985|   788k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  376|   788k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  986|   788k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (986:25): [True: 573k, False: 215k]
  ------------------
  987|   215k|                    PULLBYTE();
  ------------------
  |  |  359|   215k|    do { \
  |  |  360|   215k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 149, False: 215k]
  |  |  ------------------
  |  |  361|   215k|        have--; \
  |  |  362|   215k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   215k|        bits += 8; \
  |  |  364|   215k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 215k]
  |  |  ------------------
  ------------------
  988|   215k|                }
  989|   573k|                DROPBITS(last.bits);
  ------------------
  |  |  380|   573k|    do { \
  |  |  381|   573k|        hold >>= (n); \
  |  |  382|   573k|        bits -= (unsigned)(n); \
  |  |  383|   573k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 573k]
  |  |  ------------------
  ------------------
  990|   573k|                state->back += last.bits;
  991|   573k|            }
  992|   842k|            DROPBITS(here.bits);
  ------------------
  |  |  380|   842k|    do { \
  |  |  381|   842k|        hold >>= (n); \
  |  |  382|   842k|        bits -= (unsigned)(n); \
  |  |  383|   842k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 842k]
  |  |  ------------------
  ------------------
  993|   842k|            state->back += here.bits;
  994|   842k|            if (here.op & 64) {
  ------------------
  |  Branch (994:17): [True: 127, False: 842k]
  ------------------
  995|    127|                strm->msg = (z_const char *)"invalid distance code";
  996|    127|                state->mode = BAD;
  997|    127|                break;
  998|    127|            }
  999|   842k|            state->offset = (unsigned)here.val;
 1000|   842k|            state->extra = (unsigned)(here.op) & 15;
 1001|   842k|            state->mode = DISTEXT;
 1002|       |                /* fallthrough */
 1003|   845k|        case DISTEXT:
  ------------------
  |  Branch (1003:9): [True: 3.46k, False: 3.19M]
  ------------------
 1004|   845k|            if (state->extra) {
  ------------------
  |  Branch (1004:17): [True: 836k, False: 8.79k]
  ------------------
 1005|   836k|                NEEDBITS(state->extra);
  ------------------
  |  |  369|   836k|    do { \
  |  |  370|  1.17M|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 342k, False: 832k]
  |  |  ------------------
  |  |  371|   836k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   342k|    do { \
  |  |  |  |  360|   342k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 4.07k, False: 338k]
  |  |  |  |  ------------------
  |  |  |  |  361|   342k|        have--; \
  |  |  |  |  362|   338k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   338k|        bits += 8; \
  |  |  |  |  364|   338k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 338k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   836k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 832k]
  |  |  ------------------
  ------------------
 1006|   832k|                state->offset += BITS(state->extra);
  ------------------
  |  |  376|   832k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1007|   832k|                DROPBITS(state->extra);
  ------------------
  |  |  380|   832k|    do { \
  |  |  381|   832k|        hold >>= (n); \
  |  |  382|   832k|        bits -= (unsigned)(n); \
  |  |  383|   832k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 832k]
  |  |  ------------------
  ------------------
 1008|   832k|                state->back += state->extra;
 1009|   832k|            }
 1010|       |#ifdef INFLATE_STRICT
 1011|       |            if (state->offset > state->dmax) {
 1012|       |                strm->msg = (z_const char *)"invalid distance too far back";
 1013|       |                state->mode = BAD;
 1014|       |                break;
 1015|       |            }
 1016|       |#endif
 1017|   841k|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1018|   841k|            state->mode = MATCH;
 1019|       |                /* fallthrough */
 1020|  1.18M|        case MATCH:
  ------------------
  |  Branch (1020:9): [True: 348k, False: 2.84M]
  ------------------
 1021|  1.18M|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1021:17): [True: 135k, False: 1.05M]
  ------------------
 1022|  1.05M|            copy = out - left;
 1023|  1.05M|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1023:17): [True: 204k, False: 850k]
  ------------------
 1024|   204k|                copy = state->offset - copy;
 1025|   204k|                if (copy > state->whave) {
  ------------------
  |  Branch (1025:21): [True: 799, False: 203k]
  ------------------
 1026|    799|                    if (state->sane) {
  ------------------
  |  Branch (1026:25): [True: 799, False: 0]
  ------------------
 1027|    799|                        strm->msg = (z_const char *)
 1028|    799|                            "invalid distance too far back";
 1029|    799|                        state->mode = BAD;
 1030|    799|                        break;
 1031|    799|                    }
 1032|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 1033|       |                    Trace((stderr, "inflate.c too far\n"));
 1034|       |                    copy -= state->whave;
 1035|       |                    if (copy > state->length) copy = state->length;
 1036|       |                    if (copy > left) copy = left;
 1037|       |                    left -= copy;
 1038|       |                    state->length -= copy;
 1039|       |                    do {
 1040|       |                        *put++ = 0;
 1041|       |                    } while (--copy);
 1042|       |                    if (state->length == 0) state->mode = LEN;
 1043|       |                    break;
 1044|       |#endif
 1045|    799|                }
 1046|   203k|                if (copy > state->wnext) {
  ------------------
  |  Branch (1046:21): [True: 11.8k, False: 191k]
  ------------------
 1047|  11.8k|                    copy -= state->wnext;
 1048|  11.8k|                    from = state->window + (state->wsize - copy);
 1049|  11.8k|                }
 1050|   191k|                else
 1051|   191k|                    from = state->window + (state->wnext - copy);
 1052|   203k|                if (copy > state->length) copy = state->length;
  ------------------
  |  Branch (1052:21): [True: 117k, False: 86.3k]
  ------------------
 1053|   203k|            }
 1054|   850k|            else {                              /* copy from output */
 1055|   850k|                from = put - state->offset;
 1056|   850k|                copy = state->length;
 1057|   850k|            }
 1058|  1.05M|            if (copy > left) copy = left;
  ------------------
  |  Branch (1058:17): [True: 131k, False: 922k]
  ------------------
 1059|  1.05M|            left -= copy;
 1060|  1.05M|            state->length -= copy;
 1061|  31.5M|            do {
 1062|  31.5M|                *put++ = *from++;
 1063|  31.5M|            } while (--copy);
  ------------------
  |  Branch (1063:22): [True: 30.4M, False: 1.05M]
  ------------------
 1064|  1.05M|            if (state->length == 0) state->mode = LEN;
  ------------------
  |  Branch (1064:17): [True: 839k, False: 214k]
  ------------------
 1065|  1.05M|            break;
 1066|   500k|        case LIT:
  ------------------
  |  Branch (1066:9): [True: 500k, False: 2.69M]
  ------------------
 1067|   500k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1067:17): [True: 6.36k, False: 494k]
  ------------------
 1068|   494k|            *put++ = (unsigned char)(state->length);
 1069|   494k|            left--;
 1070|   494k|            state->mode = LEN;
 1071|   494k|            break;
 1072|  3.77k|        case CHECK:
  ------------------
  |  Branch (1072:9): [True: 3.77k, False: 3.19M]
  ------------------
 1073|  3.77k|            if (state->wrap) {
  ------------------
  |  Branch (1073:17): [True: 3.77k, False: 0]
  ------------------
 1074|  3.77k|                NEEDBITS(32);
  ------------------
  |  |  369|  3.77k|    do { \
  |  |  370|  17.1k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 13.9k, False: 3.22k]
  |  |  ------------------
  |  |  371|  13.9k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  13.9k|    do { \
  |  |  |  |  360|  13.9k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 546, False: 13.4k]
  |  |  |  |  ------------------
  |  |  |  |  361|  13.9k|        have--; \
  |  |  |  |  362|  13.4k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  13.4k|        bits += 8; \
  |  |  |  |  364|  13.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 13.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  3.77k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 3.22k]
  |  |  ------------------
  ------------------
 1075|  3.22k|                out -= left;
 1076|  3.22k|                strm->total_out += out;
 1077|  3.22k|                state->total += out;
 1078|  3.22k|                if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1078:21): [True: 3.22k, False: 0]
  |  Branch (1078:42): [True: 3.13k, False: 91]
  ------------------
 1079|  3.13k|                    strm->adler = state->check =
 1080|  3.13k|                        UPDATE_CHECK(state->check, put - out, out);
  ------------------
  |  |  305|  3.13k|#  define UPDATE_CHECK(check, buf, len) adler32(check, buf, len)
  |  |  ------------------
  |  |  |  |   34|  3.13k|#  define adler32               z_adler32
  |  |  ------------------
  ------------------
 1081|  3.22k|                out = left;
 1082|  3.22k|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1082:21): [True: 3.22k, False: 0]
  |  Branch (1082:42): [True: 1.66k, False: 1.56k]
  ------------------
 1083|       |#ifdef GUNZIP
 1084|       |                     state->flags ? hold :
 1085|       |#endif
 1086|  3.22k|                     ZSWAP32(hold)) != state->check) {
  ------------------
  |  |  258|  3.22k|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|  3.22k|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
 1087|  1.66k|                    strm->msg = (z_const char *)"incorrect data check";
 1088|  1.66k|                    state->mode = BAD;
 1089|  1.66k|                    break;
 1090|  1.66k|                }
 1091|  1.56k|                INITBITS();
  ------------------
  |  |  351|  1.56k|    do { \
  |  |  352|  1.56k|        hold = 0; \
  |  |  353|  1.56k|        bits = 0; \
  |  |  354|  1.56k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 1.56k]
  |  |  ------------------
  ------------------
 1092|  1.56k|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1093|  1.56k|            }
 1094|       |#ifdef GUNZIP
 1095|       |            state->mode = LENGTH;
 1096|       |                /* fallthrough */
 1097|       |        case LENGTH:
 1098|       |            if (state->wrap && state->flags) {
 1099|       |                NEEDBITS(32);
 1100|       |                if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
 1101|       |                    strm->msg = (z_const char *)"incorrect length check";
 1102|       |                    state->mode = BAD;
 1103|       |                    break;
 1104|       |                }
 1105|       |                INITBITS();
 1106|       |                Tracev((stderr, "inflate:   length matches trailer\n"));
 1107|       |            }
 1108|       |#endif
 1109|  1.56k|            state->mode = DONE;
 1110|       |                /* fallthrough */
 1111|  1.57k|        case DONE:
  ------------------
  |  Branch (1111:9): [True: 7, False: 3.19M]
  ------------------
 1112|  1.57k|            ret = Z_STREAM_END;
  ------------------
  |  |  182|  1.57k|#define Z_STREAM_END    1
  ------------------
 1113|  1.57k|            goto inf_leave;
 1114|   137k|        case BAD:
  ------------------
  |  Branch (1114:9): [True: 137k, False: 3.05M]
  ------------------
 1115|   137k|            ret = Z_DATA_ERROR;
  ------------------
  |  |  186|   137k|#define Z_DATA_ERROR   (-3)
  ------------------
 1116|   137k|            goto inf_leave;
 1117|      0|        case MEM:
  ------------------
  |  Branch (1117:9): [True: 0, False: 3.19M]
  ------------------
 1118|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1119|      0|        case SYNC:
  ------------------
  |  Branch (1119:9): [True: 0, False: 3.19M]
  ------------------
 1120|       |                /* fallthrough */
 1121|      0|        default:
  ------------------
  |  Branch (1121:9): [True: 0, False: 3.19M]
  ------------------
 1122|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1123|  3.19M|        }
 1124|       |
 1125|       |    /*
 1126|       |       Return from inflate(), updating the total counts and the check value.
 1127|       |       If there was no progress during the inflate() call, return a buffer
 1128|       |       error.  Call updatewindow() to create and/or update the window state.
 1129|       |       Note: a memory error from inflate() is non-recoverable.
 1130|       |     */
 1131|   384k|  inf_leave:
 1132|   384k|    RESTORE();
  ------------------
  |  |  340|   384k|    do { \
  |  |  341|   384k|        strm->next_out = put; \
  |  |  342|   384k|        strm->avail_out = left; \
  |  |  343|   384k|        strm->next_in = next; \
  |  |  344|   384k|        strm->avail_in = have; \
  |  |  345|   384k|        state->hold = hold; \
  |  |  346|   384k|        state->bits = bits; \
  |  |  347|   384k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 384k]
  |  |  ------------------
  ------------------
 1133|   384k|    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1133:9): [True: 192k, False: 192k]
  |  Branch (1133:26): [True: 70.1k, False: 122k]
  |  Branch (1133:52): [True: 16.1k, False: 53.9k]
  ------------------
 1134|  16.1k|            (state->mode < CHECK || flush != Z_FINISH)))
  ------------------
  |  |  176|    160|#define Z_FINISH        4
  ------------------
  |  Branch (1134:14): [True: 16.0k, False: 160]
  |  Branch (1134:37): [True: 160, False: 0]
  ------------------
 1135|   208k|        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
  ------------------
  |  Branch (1135:13): [True: 0, False: 208k]
  ------------------
 1136|      0|            state->mode = MEM;
 1137|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1138|      0|        }
 1139|   384k|    in -= strm->avail_in;
 1140|   384k|    out -= strm->avail_out;
 1141|   384k|    strm->total_in += in;
 1142|   384k|    strm->total_out += out;
 1143|   384k|    state->total += out;
 1144|   384k|    if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1144:9): [True: 384k, False: 0]
  |  Branch (1144:30): [True: 257k, False: 127k]
  ------------------
 1145|   257k|        strm->adler = state->check =
 1146|   257k|            UPDATE_CHECK(state->check, strm->next_out - out, out);
  ------------------
  |  |  305|   257k|#  define UPDATE_CHECK(check, buf, len) adler32(check, buf, len)
  |  |  ------------------
  |  |  |  |   34|   257k|#  define adler32               z_adler32
  |  |  ------------------
  ------------------
 1147|   384k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1147:43): [True: 98.8k, False: 285k]
  ------------------
 1148|   384k|                      (state->mode == TYPE ? 128 : 0) +
  ------------------
  |  Branch (1148:24): [True: 1.05k, False: 383k]
  ------------------
 1149|   384k|                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1149:24): [True: 0, False: 384k]
  |  Branch (1149:47): [True: 0, False: 384k]
  ------------------
 1150|   384k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  176|   381k|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  181|  3.32k|#define Z_OK            0
  ------------------
  |  Branch (1150:11): [True: 8.77k, False: 375k]
  |  Branch (1150:22): [True: 3.32k, False: 5.44k]
  |  Branch (1150:35): [True: 0, False: 381k]
  |  Branch (1150:57): [True: 3.23k, False: 97]
  ------------------
 1151|  3.23k|        ret = Z_BUF_ERROR;
  ------------------
  |  |  188|  3.23k|#define Z_BUF_ERROR    (-5)
  ------------------
 1152|   384k|    return ret;
 1153|   384k|}
z_inflateEnd:
 1155|   207k|int ZEXPORT inflateEnd(z_streamp strm) {
 1156|   207k|    struct inflate_state FAR *state;
 1157|   207k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1157:9): [True: 15.9k, False: 191k]
  ------------------
 1158|  15.9k|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|  15.9k|#define Z_STREAM_ERROR (-2)
  ------------------
 1159|   191k|    state = (struct inflate_state FAR *)strm->state;
 1160|   191k|    if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  216|   191k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  254|  16.1k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  |  Branch (1160:9): [True: 16.1k, False: 174k]
  ------------------
 1161|   191k|    ZFREE(strm, strm->state);
  ------------------
  |  |  254|   191k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1162|   191k|    strm->state = Z_NULL;
  ------------------
  |  |  216|   191k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1163|   191k|    Tracev((stderr, "inflate: end\n"));
 1164|   191k|    return Z_OK;
  ------------------
  |  |  181|   191k|#define Z_OK            0
  ------------------
 1165|   207k|}
z_inflateValidate:
 1385|   191k|int ZEXPORT inflateValidate(z_streamp strm, int check) {
 1386|   191k|    struct inflate_state FAR *state;
 1387|       |
 1388|   191k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (1388:9): [True: 0, False: 191k]
  ------------------
 1389|   191k|    state = (struct inflate_state FAR *)strm->state;
 1390|   191k|    if (check && state->wrap)
  ------------------
  |  Branch (1390:9): [True: 191k, False: 0]
  |  Branch (1390:18): [True: 191k, False: 0]
  ------------------
 1391|   191k|        state->wrap |= 4;
 1392|      0|    else
 1393|      0|        state->wrap &= ~4;
 1394|   191k|    return Z_OK;
  ------------------
  |  |  181|   191k|#define Z_OK            0
  ------------------
 1395|   191k|}
inflate.c:inflateStateCheck:
   88|  1.35M|local int inflateStateCheck(z_streamp strm) {
   89|  1.35M|    struct inflate_state FAR *state;
   90|  1.35M|    if (strm == Z_NULL ||
  ------------------
  |  |  216|  2.71M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (90:9): [True: 0, False: 1.35M]
  ------------------
   91|  1.35M|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (91:9): [True: 15.9k, False: 1.34M]
  |  Branch (91:42): [True: 0, False: 1.34M]
  ------------------
   92|  15.9k|        return 1;
   93|  1.34M|    state = (struct inflate_state FAR *)strm->state;
   94|  1.34M|    if (state == Z_NULL || state->strm != strm ||
  ------------------
  |  |  216|  2.68M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (94:9): [True: 0, False: 1.34M]
  |  Branch (94:28): [True: 0, False: 1.34M]
  ------------------
   95|  1.34M|        state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (95:9): [True: 0, False: 1.34M]
  |  Branch (95:31): [True: 0, False: 1.34M]
  ------------------
   96|      0|        return 1;
   97|  1.34M|    return 0;
   98|  1.34M|}
inflate.c:updatewindow:
  252|   208k|local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
  253|   208k|    struct inflate_state FAR *state;
  254|   208k|    unsigned dist;
  255|       |
  256|   208k|    state = (struct inflate_state FAR *)strm->state;
  257|       |
  258|       |    /* if it hasn't been done already, allocate space for the window */
  259|   208k|    if (state->window == Z_NULL) {
  ------------------
  |  |  216|   208k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (259:9): [True: 16.1k, False: 192k]
  ------------------
  260|  16.1k|        state->window = (unsigned char FAR *)
  261|  16.1k|                        ZALLOC(strm, 1U << state->wbits,
  ------------------
  |  |  253|  16.1k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  262|  16.1k|                               sizeof(unsigned char));
  263|  16.1k|        if (state->window == Z_NULL) return 1;
  ------------------
  |  |  216|  16.1k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (263:13): [True: 0, False: 16.1k]
  ------------------
  264|  16.1k|    }
  265|       |
  266|       |    /* if window not in use yet, initialize */
  267|   208k|    if (state->wsize == 0) {
  ------------------
  |  Branch (267:9): [True: 16.1k, False: 192k]
  ------------------
  268|  16.1k|        state->wsize = 1U << state->wbits;
  269|  16.1k|        state->wnext = 0;
  270|  16.1k|        state->whave = 0;
  271|  16.1k|    }
  272|       |
  273|       |    /* copy state->wsize or less output bytes into the circular window */
  274|   208k|    if (copy >= state->wsize) {
  ------------------
  |  Branch (274:9): [True: 14.7k, False: 193k]
  ------------------
  275|  14.7k|        zmemcpy(state->window, end - state->wsize, state->wsize);
  ------------------
  |  |  216|  14.7k|#    define zmemcpy memcpy
  ------------------
  276|  14.7k|        state->wnext = 0;
  277|  14.7k|        state->whave = state->wsize;
  278|  14.7k|    }
  279|   193k|    else {
  280|   193k|        dist = state->wsize - state->wnext;
  281|   193k|        if (dist > copy) dist = copy;
  ------------------
  |  Branch (281:13): [True: 185k, False: 8.34k]
  ------------------
  282|   193k|        zmemcpy(state->window + state->wnext, end - copy, dist);
  ------------------
  |  |  216|   193k|#    define zmemcpy memcpy
  ------------------
  283|   193k|        copy -= dist;
  284|   193k|        if (copy) {
  ------------------
  |  Branch (284:13): [True: 5.76k, False: 187k]
  ------------------
  285|  5.76k|            zmemcpy(state->window, end - copy, copy);
  ------------------
  |  |  216|  5.76k|#    define zmemcpy memcpy
  ------------------
  286|  5.76k|            state->wnext = copy;
  287|  5.76k|            state->whave = state->wsize;
  288|  5.76k|        }
  289|   187k|        else {
  290|   187k|            state->wnext += dist;
  291|   187k|            if (state->wnext == state->wsize) state->wnext = 0;
  ------------------
  |  Branch (291:17): [True: 2.58k, False: 185k]
  ------------------
  292|   187k|            if (state->whave < state->wsize) state->whave += dist;
  ------------------
  |  Branch (292:17): [True: 122k, False: 64.7k]
  ------------------
  293|   187k|        }
  294|   193k|    }
  295|   208k|    return 0;
  296|   208k|}

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

tj3Compress8:
   80|  21.8k|{
   81|  21.8k|  static const char FUNCTION_NAME[] = GET_STRING(tj3Compress, BITS_IN_JSAMPLE);
  ------------------
  |  |   71|  21.8k|#define GET_STRING(name, suffix)  _GET_STRING(name, suffix)
  |  |  ------------------
  |  |  |  |   70|  21.8k|#define _GET_STRING(name, suffix)  #name #suffix
  |  |  ------------------
  ------------------
   82|  21.8k|  int i, retval = 0;
   83|  21.8k|  boolean alloc = TRUE;
  ------------------
  |  |  210|  21.8k|#define TRUE    1
  ------------------
   84|  21.8k|  _JSAMPROW *row_pointer = NULL;
  ------------------
  |  |   34|  21.8k|#define _JSAMPROW  JSAMPROW
  ------------------
   85|       |
   86|  21.8k|  GET_CINSTANCE(handle)
  ------------------
  |  |  326|  21.8k|  tjinstance *this = (tjinstance *)handle; \
  |  |  327|  21.8k|  j_compress_ptr cinfo = NULL; \
  |  |  328|  21.8k|  \
  |  |  329|  21.8k|  if (!this) { \
  |  |  ------------------
  |  |  |  Branch (329:7): [True: 0, False: 21.8k]
  |  |  ------------------
  |  |  330|      0|    SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                   SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  331|      0|    return -1; \
  |  |  332|      0|  } \
  |  |  333|  21.8k|  cinfo = &this->cinfo; \
  |  |  334|  21.8k|  this->jerr.warning = FALSE; \
  |  |  ------------------
  |  |  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  335|  21.8k|  this->isInstanceError = FALSE;
  |  |  ------------------
  |  |  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  ------------------
   87|  21.8k|  if ((this->init & COMPRESS) == 0)
  ------------------
  |  Branch (87:7): [True: 0, False: 21.8k]
  ------------------
   88|  21.8k|    THROW("Instance has not been initialized for compression");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
   89|       |
   90|  21.8k|  if (srcBuf == NULL || width <= 0 || pitch < 0 || height <= 0 ||
  ------------------
  |  Branch (90:7): [True: 0, False: 21.8k]
  |  Branch (90:25): [True: 0, False: 21.8k]
  |  Branch (90:39): [True: 0, False: 21.8k]
  |  Branch (90:52): [True: 0, False: 21.8k]
  ------------------
   91|  21.8k|      pixelFormat < 0 || pixelFormat >= TJ_NUMPF || jpegBuf == NULL ||
  ------------------
  |  |  283|  43.6k|#define TJ_NUMPF  12
  ------------------
  |  Branch (91:7): [True: 0, False: 21.8k]
  |  Branch (91:26): [True: 0, False: 21.8k]
  |  Branch (91:53): [True: 0, False: 21.8k]
  ------------------
   92|  21.8k|      jpegSize == NULL)
  ------------------
  |  Branch (92:7): [True: 0, False: 21.8k]
  ------------------
   93|  21.8k|    THROW("Invalid argument");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
   94|       |
   95|  21.8k|  if (!this->lossless && this->quality == -1)
  ------------------
  |  Branch (95:7): [True: 0, False: 21.8k]
  |  Branch (95:26): [True: 0, False: 0]
  ------------------
   96|  21.8k|    THROW("TJPARAM_QUALITY must be specified");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
   97|  21.8k|  if (!this->lossless && this->subsamp == TJSAMP_UNKNOWN)
  ------------------
  |  Branch (97:7): [True: 0, False: 21.8k]
  |  Branch (97:26): [True: 0, False: 0]
  ------------------
   98|  21.8k|    THROW("TJPARAM_SUBSAMP must be specified");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
   99|       |
  100|  21.8k|  if (pitch == 0) pitch = width * tjPixelSize[pixelFormat];
  ------------------
  |  Branch (100:7): [True: 21.8k, False: 0]
  ------------------
  101|      0|  else if (pitch < width * tjPixelSize[pixelFormat])
  ------------------
  |  Branch (101:12): [True: 0, False: 0]
  ------------------
  102|  21.8k|    THROW("Invalid argument");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  103|       |
  104|  21.8k|  if ((row_pointer = (_JSAMPROW *)malloc(sizeof(_JSAMPROW) * height)) == NULL)
  ------------------
  |  Branch (104:7): [True: 0, False: 21.8k]
  ------------------
  105|  21.8k|    THROW("Memory allocation failure");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  106|       |
  107|  21.8k|  CATCH_LIBJPEG(this);
  ------------------
  |  |  293|  21.8k|#define CATCH_LIBJPEG(this) { \
  |  |  294|  21.8k|  if (setjmp(this->jerr.setjmp_buffer)) { \
  |  |  295|      0|    /* If we get here, the JPEG code has signaled an error. */ \
  |  |  296|      0|    retval = -1;  goto bailout; \
  |  |  297|      0|  } \
  |  |  298|  21.8k|}
  ------------------
  |  Branch (107:3): [True: 0, False: 21.8k]
  ------------------
  108|       |
  109|  21.8k|  cinfo->image_width = width;
  110|  21.8k|  cinfo->image_height = height;
  111|  21.8k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  | 1267|  21.8k|#define BITS_IN_JSAMPLE  8
  ------------------
  112|  21.8k|#if BITS_IN_JSAMPLE == 8
  113|  21.8k|  if (this->lossless && this->precision >= 2 &&
  ------------------
  |  Branch (113:7): [True: 21.8k, False: 0]
  |  Branch (113:25): [True: 21.8k, False: 0]
  ------------------
  114|  21.8k|      this->precision <= BITS_IN_JSAMPLE)
  ------------------
  |  | 1267|  21.8k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (114:7): [True: 21.8k, False: 0]
  ------------------
  115|       |#else
  116|       |  if (this->lossless && this->precision >= BITS_IN_JSAMPLE - 3 &&
  117|       |      this->precision <= BITS_IN_JSAMPLE)
  118|       |#endif
  119|  21.8k|    cinfo->data_precision = this->precision;
  120|       |
  121|  21.8k|  setCompDefaults(this, pixelFormat, FALSE);
  ------------------
  |  |  207|  21.8k|#define FALSE   0               /* values of boolean */
  ------------------
  122|  21.8k|  if (this->noRealloc) alloc = FALSE;
  ------------------
  |  |  207|  18.9k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (122:7): [True: 18.9k, False: 2.86k]
  ------------------
  123|  21.8k|  jpeg_mem_dest_tj(cinfo, jpegBuf, jpegSize, alloc);
  124|       |
  125|  21.8k|  jpeg_start_compress(cinfo, TRUE);
  ------------------
  |  |  210|  21.8k|#define TRUE    1
  ------------------
  126|  21.8k|  if (this->iccBuf != NULL && this->iccSize != 0)
  ------------------
  |  Branch (126:7): [True: 19.9k, False: 1.82k]
  |  Branch (126:31): [True: 19.9k, False: 0]
  ------------------
  127|  19.9k|    jpeg_write_icc_profile(cinfo, this->iccBuf, (unsigned int)this->iccSize);
  128|  15.3M|  for (i = 0; i < height; i++) {
  ------------------
  |  Branch (128:15): [True: 15.3M, False: 21.8k]
  ------------------
  129|  15.3M|    if (this->bottomUp)
  ------------------
  |  Branch (129:9): [True: 2.30M, False: 13.0M]
  ------------------
  130|  2.30M|      row_pointer[i] = (_JSAMPROW)&srcBuf[(height - i - 1) * (size_t)pitch];
  131|  13.0M|    else
  132|  13.0M|      row_pointer[i] = (_JSAMPROW)&srcBuf[i * (size_t)pitch];
  133|  15.3M|  }
  134|  43.6k|  while (cinfo->next_scanline < cinfo->image_height)
  ------------------
  |  Branch (134:10): [True: 21.8k, False: 21.8k]
  ------------------
  135|  21.8k|    _jpeg_write_scanlines(cinfo, &row_pointer[cinfo->next_scanline],
  ------------------
  |  |   43|  21.8k|#define _jpeg_write_scanlines  jpeg_write_scanlines
  ------------------
  136|  21.8k|                          cinfo->image_height - cinfo->next_scanline);
  137|  21.8k|  jpeg_finish_compress(cinfo);
  138|       |
  139|  21.8k|bailout:
  140|  21.8k|  if (cinfo->global_state > CSTATE_START && alloc)
  ------------------
  |  |   44|  43.6k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (140:7): [True: 0, False: 21.8k]
  |  Branch (140:45): [True: 0, False: 0]
  ------------------
  141|      0|    (*cinfo->dest->term_destination) (cinfo);
  142|  21.8k|  if (cinfo->global_state > CSTATE_START || retval == -1)
  ------------------
  |  |   44|  43.6k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (142:7): [True: 0, False: 21.8k]
  |  Branch (142:45): [True: 0, False: 21.8k]
  ------------------
  143|      0|    jpeg_abort_compress(cinfo);
  144|  21.8k|  free(row_pointer);
  145|  21.8k|  if (this->jerr.warning) retval = -1;
  ------------------
  |  Branch (145:7): [True: 0, False: 21.8k]
  ------------------
  146|  21.8k|  return retval;
  147|  21.8k|}
_tj3LoadImageFromFileHandle8:
  306|  51.3k|{
  307|  51.3k|  static const char FUNCTION_NAME[] =
  308|  51.3k|    GET_STRING(tj3LoadImage, BITS_IN_JSAMPLE);
  ------------------
  |  |   71|  51.3k|#define GET_STRING(name, suffix)  _GET_STRING(name, suffix)
  |  |  ------------------
  |  |  |  |   70|  51.3k|#define _GET_STRING(name, suffix)  #name #suffix
  |  |  ------------------
  ------------------
  309|       |
  310|  51.3k|  int retval = 0, tempc;
  311|  51.3k|  size_t pitch;
  312|  51.3k|  tjhandle handle2 = NULL;
  313|  51.3k|  tjinstance *this2;
  314|  51.3k|  j_compress_ptr cinfo = NULL;
  315|  51.3k|  cjpeg_source_ptr src = NULL;
  316|  51.3k|  _JSAMPLE *dstBuf = NULL;
  ------------------
  |  |   33|  51.3k|#define _JSAMPLE  JSAMPLE
  ------------------
  317|  51.3k|  boolean invert;
  318|       |
  319|  51.3k|  GET_TJINSTANCE(handle, NULL)
  ------------------
  |  |  350|  51.3k|  tjinstance *this = (tjinstance *)handle; \
  |  |  351|  51.3k|  \
  |  |  352|  51.3k|  if (!this) { \
  |  |  ------------------
  |  |  |  Branch (352:7): [True: 0, False: 51.3k]
  |  |  ------------------
  |  |  353|      0|    SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                   SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  354|      0|    return errorReturn; \
  |  |  355|      0|  } \
  |  |  356|  51.3k|  this->jerr.warning = FALSE; \
  |  |  ------------------
  |  |  |  |  207|  51.3k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  357|  51.3k|  this->isInstanceError = FALSE;
  |  |  ------------------
  |  |  |  |  207|  51.3k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  ------------------
  320|       |
  321|  51.3k|  if (!file || !width || align < 1 || !height || !pixelFormat ||
  ------------------
  |  Branch (321:7): [True: 0, False: 51.3k]
  |  Branch (321:16): [True: 0, False: 51.3k]
  |  Branch (321:26): [True: 0, False: 51.3k]
  |  Branch (321:39): [True: 0, False: 51.3k]
  |  Branch (321:50): [True: 0, False: 51.3k]
  ------------------
  322|  51.3k|      *pixelFormat < TJPF_UNKNOWN || *pixelFormat >= TJ_NUMPF)
  ------------------
  |  |  283|  51.3k|#define TJ_NUMPF  12
  ------------------
  |  Branch (322:7): [True: 0, False: 51.3k]
  |  Branch (322:38): [True: 0, False: 51.3k]
  ------------------
  323|  51.3k|    THROW("Invalid argument");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  324|  51.3k|  if ((align & (align - 1)) != 0)
  ------------------
  |  Branch (324:7): [True: 0, False: 51.3k]
  ------------------
  325|  51.3k|    THROW("Alignment must be a power of 2");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  326|       |
  327|       |  /* The instance handle passed to this function is used only for parameter
  328|       |     retrieval.  Create a new temporary instance to avoid interfering with the
  329|       |     libjpeg state of the primary instance. */
  330|  51.3k|  if ((handle2 = tj3Init(TJINIT_COMPRESS)) == NULL) return NULL;
  ------------------
  |  Branch (330:7): [True: 0, False: 51.3k]
  ------------------
  331|  51.3k|  this2 = (tjinstance *)handle2;
  332|  51.3k|  cinfo = &this2->cinfo;
  333|       |
  334|  51.3k|  if ((tempc = getc(file)) < 0 || ungetc(tempc, file) == EOF)
  ------------------
  |  Branch (334:7): [True: 0, False: 51.3k]
  |  Branch (334:35): [True: 0, False: 51.3k]
  ------------------
  335|      0|    THROW_UNIX("Could not read input file")
  ------------------
  |  |  270|      0|#define THROW_UNIX(m) { \
  |  |  271|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s\n%s", FUNCTION_NAME, m, \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s\n%s", FUNCTION_NAME, m, \
  |  |  ------------------
  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  272|      0|           strerror(errno)); \
  |  |  273|      0|  this->isInstanceError = TRUE; \
  |  |  ------------------
  |  |  |  |  210|      0|#define TRUE    1
  |  |  ------------------
  |  |  274|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s\n%s", FUNCTION_NAME, m, \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s\n%s", FUNCTION_NAME, m, \
  |  |  ------------------
  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  275|      0|           strerror(errno)); \
  |  |  276|      0|  retval = -1;  goto bailout; \
  |  |  277|      0|}
  ------------------
  336|  51.3k|  else if (tempc == EOF)
  ------------------
  |  Branch (336:12): [True: 0, False: 51.3k]
  ------------------
  337|  51.3k|    THROW("Input file contains no data");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  338|       |
  339|  51.3k|  CATCH_LIBJPEG2();
  ------------------
  |  |  303|  51.3k|#define CATCH_LIBJPEG2() { \
  |  |  304|  51.3k|  if (setjmp(this2->jerr.setjmp_buffer)) { \
  |  |  305|      0|    memcpy(this->errStr, this2->errStr, JMSG_LENGTH_MAX); \
  |  |  ------------------
  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  306|      0|    this->jerr.warning = this2->jerr.warning; \
  |  |  307|      0|    this->isInstanceError = this2->isInstanceError; \
  |  |  308|      0|    retval = -1;  goto bailout; \
  |  |  309|      0|  } \
  |  |  310|  51.3k|}
  ------------------
  |  Branch (339:3): [True: 0, False: 51.3k]
  ------------------
  340|       |
  341|  51.3k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  | 1267|  51.3k|#define BITS_IN_JSAMPLE  8
  ------------------
  342|  51.3k|  if (*pixelFormat == TJPF_UNKNOWN) cinfo->in_color_space = JCS_UNKNOWN;
  ------------------
  |  Branch (342:7): [True: 0, False: 51.3k]
  ------------------
  343|  51.3k|  else cinfo->in_color_space = pf2cs[*pixelFormat];
  344|  51.3k|  if (tempc == 'B') {
  ------------------
  |  Branch (344:7): [True: 6.76k, False: 44.5k]
  ------------------
  345|  6.76k|    if ((src = jinit_read_bmp(cinfo, FALSE)) == NULL)
  ------------------
  |  |  207|  6.76k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (345:9): [True: 0, False: 6.76k]
  ------------------
  346|  6.76k|      THROW("Could not initialize bitmap loader");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  347|  6.76k|    invert = !this->bottomUp;
  348|  44.5k|  } else if (tempc == 0x89) {
  ------------------
  |  Branch (348:14): [True: 30.7k, False: 13.8k]
  ------------------
  349|  30.7k|#if BITS_IN_JSAMPLE == 8
  350|  30.7k|    if (this->precision >= 2 && this->precision <= BITS_IN_JSAMPLE)
  ------------------
  |  | 1267|  30.7k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (350:9): [True: 30.7k, False: 0]
  |  Branch (350:33): [True: 30.7k, False: 0]
  ------------------
  351|       |#else
  352|       |    if (this->precision >= BITS_IN_JSAMPLE - 3 &&
  353|       |        this->precision <= BITS_IN_JSAMPLE)
  354|       |#endif
  355|  30.7k|      cinfo->data_precision = this->precision;
  356|  30.7k|    if ((src = _jinit_read_png(cinfo)) == NULL)
  ------------------
  |  |   36|  30.7k|#define _jinit_read_png  jinit_read_png
  ------------------
  |  Branch (356:9): [True: 0, False: 30.7k]
  ------------------
  357|  30.7k|      THROW("Could not initialize PNG loader");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  358|  30.7k|    invert = this->bottomUp;
  359|  30.7k|  } else if (tempc == 'P') {
  ------------------
  |  Branch (359:14): [True: 13.4k, False: 399]
  ------------------
  360|  13.4k|#if BITS_IN_JSAMPLE == 8
  361|  13.4k|    if (this->precision >= 2 && this->precision <= BITS_IN_JSAMPLE)
  ------------------
  |  | 1267|  13.4k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (361:9): [True: 13.4k, False: 0]
  |  Branch (361:33): [True: 13.4k, False: 0]
  ------------------
  362|       |#else
  363|       |    if (this->precision >= BITS_IN_JSAMPLE - 3 &&
  364|       |        this->precision <= BITS_IN_JSAMPLE)
  365|       |#endif
  366|  13.4k|      cinfo->data_precision = this->precision;
  367|  13.4k|    if ((src = _jinit_read_ppm(cinfo)) == NULL)
  ------------------
  |  |   38|  13.4k|#define _jinit_read_ppm  jinit_read_ppm
  ------------------
  |  Branch (367:9): [True: 0, False: 13.4k]
  ------------------
  368|  13.4k|      THROW("Could not initialize PPM loader");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  369|  13.4k|    invert = this->bottomUp;
  370|  13.4k|  } else
  371|  50.9k|    THROW("Unsupported file type");
  ------------------
  |  |  283|    399|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|    399|#define THROWRV(m, rv) { \
  |  |  |  |  280|    399|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    399|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|    399|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|    399|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|    399|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|    399|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|    399|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    399|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|    399|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|    399|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|    399|}
  |  |  |  |  ------------------
  |  |  |  |  282|    399|}
  |  |  ------------------
  ------------------
  372|       |
  373|  50.9k|  CATCH_LIBJPEG2();
  ------------------
  |  |  303|  50.9k|#define CATCH_LIBJPEG2() { \
  |  |  304|  50.9k|  if (setjmp(this2->jerr.setjmp_buffer)) { \
  |  |  305|  32.4k|    memcpy(this->errStr, this2->errStr, JMSG_LENGTH_MAX); \
  |  |  ------------------
  |  |  |  |  792|  32.4k|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  306|  32.4k|    this->jerr.warning = this2->jerr.warning; \
  |  |  307|  32.4k|    this->isInstanceError = this2->isInstanceError; \
  |  |  308|  32.4k|    retval = -1;  goto bailout; \
  |  |  309|  32.4k|  } \
  |  |  310|  50.9k|}
  ------------------
  |  Branch (373:3): [True: 32.4k, False: 18.4k]
  ------------------
  374|       |
  375|  18.4k|  cinfo->mem->max_memory_to_use = (long)this->maxMemory * 1048576L;
  376|       |
  377|  18.4k|  src->input_file = file;
  378|       |  /* Refuse to load images larger than the specified size. */
  379|  18.4k|  src->max_pixels = this->maxPixels;
  380|  18.4k|  (*src->start_input) (cinfo, src);
  381|  18.4k|  if (tempc == 'B') {
  ------------------
  |  Branch (381:7): [True: 1.80k, False: 16.6k]
  ------------------
  382|  1.80k|    if (cinfo->X_density && cinfo->Y_density) {
  ------------------
  |  Branch (382:9): [True: 416, False: 1.39k]
  |  Branch (382:29): [True: 398, False: 18]
  ------------------
  383|    398|      this->xDensity = cinfo->X_density;
  384|    398|      this->yDensity = cinfo->Y_density;
  385|    398|      this->densityUnits = cinfo->density_unit;
  386|    398|    }
  387|  16.6k|  } else if (tempc == 0x89 && (this->init & COMPRESS) &&
  ------------------
  |  Branch (387:14): [True: 5.44k, False: 11.2k]
  |  Branch (387:31): [True: 5.44k, False: 0]
  ------------------
  388|  5.44k|             (this->saveMarkers == 2 || this->saveMarkers == 4)) {
  ------------------
  |  Branch (388:15): [True: 5.44k, False: 0]
  |  Branch (388:41): [True: 0, False: 0]
  ------------------
  389|  5.44k|    JOCTET *iccBuf = NULL;
  390|  5.44k|    unsigned int iccLen = 0;
  391|       |
  392|  5.44k|    if ((*src->read_icc_profile) (cinfo, src, &iccBuf, &iccLen) && iccBuf &&
  ------------------
  |  Branch (392:9): [True: 6, False: 5.44k]
  |  Branch (392:68): [True: 6, False: 0]
  ------------------
  393|      6|        iccLen)
  ------------------
  |  Branch (393:9): [True: 6, False: 0]
  ------------------
  394|      6|      tj3SetICCProfile(handle, (unsigned char *)iccBuf, iccLen);
  395|  5.44k|  }
  396|  18.4k|  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
  397|       |
  398|  18.4k|  *width = cinfo->image_width;  *height = cinfo->image_height;
  399|  18.4k|  *pixelFormat = cs2pf[cinfo->in_color_space];
  400|       |
  401|  18.4k|  pitch = PAD((*width) * tjPixelSize[*pixelFormat], align);
  ------------------
  |  |   57|  18.4k|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
  402|       |
  403|  18.4k|  if (
  404|       |#if ULLONG_MAX > SIZE_MAX
  405|       |      (unsigned long long)pitch * (unsigned long long)(*height) *
  406|       |      (unsigned long long)sizeof(_JSAMPLE) >
  407|       |      (unsigned long long)((size_t)-1) ||
  408|       |#endif
  409|  18.4k|      (dstBuf = (_JSAMPLE *)malloc(pitch * (*height) *
  ------------------
  |  Branch (409:7): [True: 0, False: 18.4k]
  ------------------
  410|  18.4k|                                   sizeof(_JSAMPLE))) == NULL)
  411|  18.4k|    THROW("Memory allocation failure");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  412|       |
  413|  18.4k|  CATCH_LIBJPEG2();
  ------------------
  |  |  303|  18.4k|#define CATCH_LIBJPEG2() { \
  |  |  304|  18.4k|  if (setjmp(this2->jerr.setjmp_buffer)) { \
  |  |  305|  12.1k|    memcpy(this->errStr, this2->errStr, JMSG_LENGTH_MAX); \
  |  |  ------------------
  |  |  |  |  792|  12.1k|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  306|  12.1k|    this->jerr.warning = this2->jerr.warning; \
  |  |  307|  12.1k|    this->isInstanceError = this2->isInstanceError; \
  |  |  308|  12.1k|    retval = -1;  goto bailout; \
  |  |  309|  12.1k|  } \
  |  |  310|  18.4k|}
  ------------------
  |  Branch (413:3): [True: 12.1k, False: 6.27k]
  ------------------
  414|       |
  415|  15.3M|  while (cinfo->next_scanline < cinfo->image_height) {
  ------------------
  |  Branch (415:10): [True: 15.3M, False: 6.27k]
  ------------------
  416|  15.3M|    int i, nlines = (*src->get_pixel_rows) (cinfo, src);
  417|       |
  418|  30.6M|    for (i = 0; i < nlines; i++) {
  ------------------
  |  Branch (418:17): [True: 15.3M, False: 15.3M]
  ------------------
  419|  15.3M|      _JSAMPLE *dstptr;
  ------------------
  |  |   33|  15.3M|#define _JSAMPLE  JSAMPLE
  ------------------
  420|  15.3M|      int row;
  421|       |
  422|  15.3M|      row = cinfo->next_scanline + i;
  423|  15.3M|      if (invert) dstptr = &dstBuf[((*height) - row - 1) * pitch];
  ------------------
  |  Branch (423:11): [True: 5.28M, False: 10.0M]
  ------------------
  424|  10.0M|      else dstptr = &dstBuf[row * pitch];
  425|  15.3M|      memcpy(dstptr, src->_buffer[i],
  ------------------
  |  |   35|  15.3M|#define _buffer  buffer
  ------------------
  426|  15.3M|             (*width) * tjPixelSize[*pixelFormat] * sizeof(_JSAMPLE));
  427|  15.3M|    }
  428|  15.3M|    cinfo->next_scanline += nlines;
  429|  15.3M|  }
  430|       |
  431|  51.3k|bailout:
  432|  51.3k|  if (src)
  ------------------
  |  Branch (432:7): [True: 50.9k, False: 399]
  ------------------
  433|  50.9k|    (*src->finish_input) (cinfo, src);
  434|  51.3k|  tj3Destroy(handle2);
  435|  51.3k|  if (retval < 0) { free(dstBuf);  dstBuf = NULL; }
  ------------------
  |  Branch (435:7): [True: 45.0k, False: 6.27k]
  ------------------
  436|  51.3k|  return dstBuf;
  437|  6.27k|}

tj3InitVersion:
  596|  58.6k|{
  597|  58.6k|  static const char FUNCTION_NAME[] = "tj3Init";
  598|  58.6k|  tjinstance *this = NULL;
  599|  58.6k|  tjhandle retval = NULL;
  600|       |
  601|  58.6k|  if (initType < 0 || initType >= TJ_NUMINIT || apiVersion < 1000000 ||
  ------------------
  |  |   86|   117k|#define TJ_NUMINIT  3
  ------------------
  |  Branch (601:7): [True: 0, False: 58.6k]
  |  Branch (601:23): [True: 0, False: 58.6k]
  |  Branch (601:49): [True: 0, False: 58.6k]
  ------------------
  602|  58.6k|      apiVersion > 999999999)
  ------------------
  |  Branch (602:7): [True: 0, False: 58.6k]
  ------------------
  603|  58.6k|    THROWG("Invalid argument", NULL);
  ------------------
  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  257|      0|}
  ------------------
  604|       |
  605|  58.6k|  if ((this = (tjinstance *)malloc(sizeof(tjinstance))) == NULL)
  ------------------
  |  Branch (605:7): [True: 0, False: 58.6k]
  ------------------
  606|  58.6k|    THROWG("Memory allocation failure", NULL);
  ------------------
  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  257|      0|}
  ------------------
  607|  58.6k|  memset(this, 0, sizeof(tjinstance));
  608|  58.6k|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "No error");
  ------------------
  |  |   42|  58.6k|#define SNPRINTF  snprintf
  ------------------
                SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "No error");
  ------------------
  |  |  792|  58.6k|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  609|       |
  610|  58.6k|  this->quality = -1;
  611|  58.6k|  this->subsamp = TJSAMP_UNKNOWN;
  612|  58.6k|  this->jpegWidth = -1;
  613|  58.6k|  this->jpegHeight = -1;
  614|  58.6k|  this->precision = 8;
  615|  58.6k|  this->colorspace = TJCS_DEFAULT;
  616|  58.6k|  this->losslessPSV = 1;
  617|  58.6k|  this->xDensity = 1;
  618|  58.6k|  this->yDensity = 1;
  619|  58.6k|  this->scalingFactor = TJUNSCALED;
  620|  58.6k|  this->saveMarkers = 2;
  621|       |
  622|  58.6k|  this->apiVersion = apiVersion;
  623|  58.6k|  this->numSamp = apiVersion >= 3002000 ? TJ_NUMSAMP : 7;
  ------------------
  |  |  111|  7.33k|#define TJ_NUMSAMP  9
  ------------------
  |  Branch (623:19): [True: 7.33k, False: 51.3k]
  ------------------
  624|       |
  625|  58.6k|  switch (initType) {
  ------------------
  |  Branch (625:11): [True: 58.6k, False: 0]
  ------------------
  626|  58.6k|  case TJINIT_COMPRESS:  return _tjInitCompress(this);
  ------------------
  |  Branch (626:3): [True: 58.6k, False: 0]
  ------------------
  627|      0|  case TJINIT_DECOMPRESS:  return _tjInitDecompress(this);
  ------------------
  |  Branch (627:3): [True: 0, False: 58.6k]
  ------------------
  628|      0|  case TJINIT_TRANSFORM:
  ------------------
  |  Branch (628:3): [True: 0, False: 58.6k]
  ------------------
  629|      0|    retval = _tjInitCompress(this);
  630|      0|    if (!retval) return NULL;
  ------------------
  |  Branch (630:9): [True: 0, False: 0]
  ------------------
  631|      0|    retval = _tjInitDecompress(this);
  632|      0|    return retval;
  633|  58.6k|  }
  634|       |
  635|      0|bailout:
  636|      0|  return retval;
  637|  58.6k|}
tj3Init:
  641|  51.3k|{
  642|  51.3k|  return tj3InitVersion(initType, 3001000);
  643|  51.3k|}
tj3Destroy:
  648|  58.6k|{
  649|  58.6k|  tjinstance *this = (tjinstance *)handle;
  650|  58.6k|  j_compress_ptr cinfo = NULL;
  651|  58.6k|  j_decompress_ptr dinfo = NULL;
  652|       |
  653|  58.6k|  if (!this) return;
  ------------------
  |  Branch (653:7): [True: 0, False: 58.6k]
  ------------------
  654|       |
  655|  58.6k|  cinfo = &this->cinfo;  dinfo = &this->dinfo;
  656|  58.6k|  this->jerr.warning = FALSE;
  ------------------
  |  |  207|  58.6k|#define FALSE   0               /* values of boolean */
  ------------------
  657|  58.6k|  this->isInstanceError = FALSE;
  ------------------
  |  |  207|  58.6k|#define FALSE   0               /* values of boolean */
  ------------------
  658|       |
  659|       |  /* NOTE: jpeg_destroy_*() can never throw a libjpeg error in libjpeg-turbo's
  660|       |     implementation, so this is a belt-and-suspenders measure. */
  661|  58.6k|  if (setjmp(this->jerr.setjmp_buffer)) goto destroy_decompress;
  ------------------
  |  Branch (661:7): [True: 0, False: 58.6k]
  ------------------
  662|  58.6k|  if (this->init & COMPRESS) jpeg_destroy_compress(cinfo);
  ------------------
  |  Branch (662:7): [True: 58.6k, False: 0]
  ------------------
  663|  58.6k|destroy_decompress:
  664|  58.6k|  if (setjmp(this->jerr.setjmp_buffer)) goto bailout;
  ------------------
  |  Branch (664:7): [True: 0, False: 58.6k]
  ------------------
  665|  58.6k|  if (this->init & DECOMPRESS) jpeg_destroy_decompress(dinfo);
  ------------------
  |  Branch (665:7): [True: 0, False: 58.6k]
  ------------------
  666|  58.6k|bailout:
  667|  58.6k|  free(this->iccBuf);
  668|  58.6k|  free(this->decompICCBuf);
  669|  58.6k|  free(this);
  670|  58.6k|}
tj3Set:
  744|   322k|{
  745|   322k|  static const char FUNCTION_NAME[] = "tj3Set";
  746|   322k|  int retval = 0;
  747|       |
  748|   322k|  GET_TJINSTANCE(handle, -1);
  ------------------
  |  |  350|   322k|  tjinstance *this = (tjinstance *)handle; \
  |  |  351|   322k|  \
  |  |  352|   322k|  if (!this) { \
  |  |  ------------------
  |  |  |  Branch (352:7): [True: 0, False: 322k]
  |  |  ------------------
  |  |  353|      0|    SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                   SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  354|      0|    return errorReturn; \
  |  |  355|      0|  } \
  |  |  356|   322k|  this->jerr.warning = FALSE; \
  |  |  ------------------
  |  |  |  |  207|   322k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  357|   322k|  this->isInstanceError = FALSE;
  |  |  ------------------
  |  |  |  |  207|   322k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  ------------------
  749|       |
  750|   322k|  switch (param) {
  751|      0|  case TJPARAM_STOPONWARNING:
  ------------------
  |  Branch (751:3): [True: 0, False: 322k]
  ------------------
  752|      0|    SET_BOOL_PARAM(jerr.stopOnWarning);
  ------------------
  |  |  736|      0|#define SET_BOOL_PARAM(field) { \
  |  |  737|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 0]
  |  |  |  Branch (737:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  738|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  739|      0|  this->field = (boolean)value; \
  |  |  740|      0|}
  ------------------
  753|      0|    break;
  754|  51.3k|  case TJPARAM_BOTTOMUP:
  ------------------
  |  Branch (754:3): [True: 51.3k, False: 270k]
  ------------------
  755|  51.3k|    SET_BOOL_PARAM(bottomUp);
  ------------------
  |  |  736|  51.3k|#define SET_BOOL_PARAM(field) { \
  |  |  737|  51.3k|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 51.3k]
  |  |  |  Branch (737:20): [True: 0, False: 51.3k]
  |  |  ------------------
  |  |  738|  51.3k|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  739|  51.3k|  this->field = (boolean)value; \
  |  |  740|  51.3k|}
  ------------------
  756|  51.3k|    break;
  757|  51.3k|  case TJPARAM_NOREALLOC:
  ------------------
  |  Branch (757:3): [True: 51.3k, False: 270k]
  ------------------
  758|  51.3k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (758:9): [True: 0, False: 51.3k]
  ------------------
  759|  51.3k|      THROW("TJPARAM_NOREALLOC is not applicable to decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  760|  51.3k|    SET_BOOL_PARAM(noRealloc);
  ------------------
  |  |  736|  51.3k|#define SET_BOOL_PARAM(field) { \
  |  |  737|  51.3k|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 51.3k]
  |  |  |  Branch (737:20): [True: 0, False: 51.3k]
  |  |  ------------------
  |  |  738|  51.3k|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  739|  51.3k|  this->field = (boolean)value; \
  |  |  740|  51.3k|}
  ------------------
  761|  51.3k|    break;
  762|      0|  case TJPARAM_QUALITY:
  ------------------
  |  Branch (762:3): [True: 0, False: 322k]
  ------------------
  763|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (763:9): [True: 0, False: 0]
  ------------------
  764|      0|      THROW("TJPARAM_QUALITY is not applicable to decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  765|      0|    SET_PARAM(quality, 1, 100);
  ------------------
  |  |  730|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 0]
  |  |  |  Branch (731:28): [True: 0, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|      0|  this->field = value; \
  |  |  734|      0|}
  ------------------
  766|      0|    break;
  767|      0|  case TJPARAM_SUBSAMP:
  ------------------
  |  Branch (767:3): [True: 0, False: 322k]
  ------------------
  768|      0|    SET_PARAM(subsamp, 0, this->numSamp - 1);
  ------------------
  |  |  730|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 0]
  |  |  |  Branch (731:28): [True: 0, False: 0]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|      0|  this->field = value; \
  |  |  734|      0|}
  ------------------
  769|      0|    break;
  770|      0|  case TJPARAM_JPEGWIDTH:
  ------------------
  |  Branch (770:3): [True: 0, False: 322k]
  ------------------
  771|      0|    if (!(this->init & DECOMPRESS))
  ------------------
  |  Branch (771:9): [True: 0, False: 0]
  ------------------
  772|      0|      THROW("TJPARAM_JPEGWIDTH is not applicable to compression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  773|      0|    THROW("TJPARAM_JPEGWIDTH is read-only in decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  774|      0|    break;
  775|      0|  case TJPARAM_JPEGHEIGHT:
  ------------------
  |  Branch (775:3): [True: 0, False: 322k]
  ------------------
  776|      0|    if (!(this->init & DECOMPRESS))
  ------------------
  |  Branch (776:9): [True: 0, False: 0]
  ------------------
  777|      0|      THROW("TJPARAM_JPEGHEIGHT is not applicable to compression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  778|      0|    THROW("TJPARAM_JPEGHEIGHT is read-only in decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  779|      0|    break;
  780|  51.3k|  case TJPARAM_PRECISION:
  ------------------
  |  Branch (780:3): [True: 51.3k, False: 270k]
  ------------------
  781|  51.3k|    SET_PARAM(precision, 2, 16);
  ------------------
  |  |  730|  51.3k|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|  51.3k|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 51.3k]
  |  |  |  Branch (731:28): [True: 51.3k, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 51.3k]
  |  |  ------------------
  |  |  732|  51.3k|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|  51.3k|  this->field = value; \
  |  |  734|  51.3k|}
  ------------------
  782|  51.3k|    break;
  783|      0|  case TJPARAM_COLORSPACE:
  ------------------
  |  Branch (783:3): [True: 0, False: 322k]
  ------------------
  784|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (784:9): [True: 0, False: 0]
  ------------------
  785|      0|      THROW("TJPARAM_COLORSPACE is read-only in decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  786|      0|    SET_PARAM(colorspace, TJCS_DEFAULT, TJ_NUMCS - 1);
  ------------------
  |  |  730|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 0]
  |  |  |  Branch (731:28): [True: 0, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|      0|  this->field = value; \
  |  |  734|      0|}
  ------------------
  787|      0|    break;
  788|      0|  case TJPARAM_FASTUPSAMPLE:
  ------------------
  |  Branch (788:3): [True: 0, False: 322k]
  ------------------
  789|      0|    if (!(this->init & DECOMPRESS))
  ------------------
  |  Branch (789:9): [True: 0, False: 0]
  ------------------
  790|      0|      THROW("TJPARAM_FASTUPSAMPLE is not applicable to compression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  791|      0|    SET_BOOL_PARAM(fastUpsample);
  ------------------
  |  |  736|      0|#define SET_BOOL_PARAM(field) { \
  |  |  737|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 0]
  |  |  |  Branch (737:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  738|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  739|      0|  this->field = (boolean)value; \
  |  |  740|      0|}
  ------------------
  792|      0|    break;
  793|      0|  case TJPARAM_FASTDCT:
  ------------------
  |  Branch (793:3): [True: 0, False: 322k]
  ------------------
  794|      0|    SET_BOOL_PARAM(fastDCT);
  ------------------
  |  |  736|      0|#define SET_BOOL_PARAM(field) { \
  |  |  737|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 0]
  |  |  |  Branch (737:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  738|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  739|      0|  this->field = (boolean)value; \
  |  |  740|      0|}
  ------------------
  795|      0|    break;
  796|      0|  case TJPARAM_OPTIMIZE:
  ------------------
  |  Branch (796:3): [True: 0, False: 322k]
  ------------------
  797|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  ------------------
  798|      0|      THROW("TJPARAM_OPTIMIZE is not applicable to decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  799|      0|    SET_BOOL_PARAM(optimize);
  ------------------
  |  |  736|      0|#define SET_BOOL_PARAM(field) { \
  |  |  737|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 0]
  |  |  |  Branch (737:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  738|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  739|      0|  this->field = (boolean)value; \
  |  |  740|      0|}
  ------------------
  800|      0|    break;
  801|      0|  case TJPARAM_PROGRESSIVE:
  ------------------
  |  Branch (801:3): [True: 0, False: 322k]
  ------------------
  802|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (802:9): [True: 0, False: 0]
  ------------------
  803|      0|      THROW("TJPARAM_PROGRESSIVE is read-only in decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  804|      0|    SET_BOOL_PARAM(progressive);
  ------------------
  |  |  736|      0|#define SET_BOOL_PARAM(field) { \
  |  |  737|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 0]
  |  |  |  Branch (737:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  738|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  739|      0|  this->field = (boolean)value; \
  |  |  740|      0|}
  ------------------
  805|      0|    break;
  806|      0|  case TJPARAM_SCANLIMIT:
  ------------------
  |  Branch (806:3): [True: 0, False: 322k]
  ------------------
  807|      0|    if (!(this->init & DECOMPRESS))
  ------------------
  |  Branch (807:9): [True: 0, False: 0]
  ------------------
  808|      0|      THROW("TJPARAM_SCANLIMIT is not applicable to compression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  809|      0|    SET_PARAM(scanLimit, 0, -1);
  ------------------
  |  |  730|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 0]
  |  |  |  Branch (731:28): [Folded, False: 0]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|      0|  this->field = value; \
  |  |  734|      0|}
  ------------------
  810|      0|    break;
  811|      0|  case TJPARAM_ARITHMETIC:
  ------------------
  |  Branch (811:3): [True: 0, False: 322k]
  ------------------
  812|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (812:9): [True: 0, False: 0]
  ------------------
  813|      0|      THROW("TJPARAM_ARITHMETIC is read-only in decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  814|      0|    SET_BOOL_PARAM(arithmetic);
  ------------------
  |  |  736|      0|#define SET_BOOL_PARAM(field) { \
  |  |  737|      0|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 0]
  |  |  |  Branch (737:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  738|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  739|      0|  this->field = (boolean)value; \
  |  |  740|      0|}
  ------------------
  815|      0|    break;
  816|  21.8k|  case TJPARAM_LOSSLESS:
  ------------------
  |  Branch (816:3): [True: 21.8k, False: 300k]
  ------------------
  817|  21.8k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (817:9): [True: 0, False: 21.8k]
  ------------------
  818|  21.8k|      THROW("TJPARAM_LOSSLESS is read-only in decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  819|  21.8k|    SET_BOOL_PARAM(lossless);
  ------------------
  |  |  736|  21.8k|#define SET_BOOL_PARAM(field) { \
  |  |  737|  21.8k|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 21.8k]
  |  |  |  Branch (737:20): [True: 0, False: 21.8k]
  |  |  ------------------
  |  |  738|  21.8k|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  739|  21.8k|  this->field = (boolean)value; \
  |  |  740|  21.8k|}
  ------------------
  820|  21.8k|    break;
  821|  21.8k|  case TJPARAM_LOSSLESSPSV:
  ------------------
  |  Branch (821:3): [True: 21.8k, False: 300k]
  ------------------
  822|  21.8k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (822:9): [True: 0, False: 21.8k]
  ------------------
  823|  21.8k|      THROW("TJPARAM_LOSSLESSPSV is read-only in decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  824|  21.8k|    SET_PARAM(losslessPSV, 1, 7);
  ------------------
  |  |  730|  21.8k|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|  21.8k|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 21.8k]
  |  |  |  Branch (731:28): [True: 21.8k, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 21.8k]
  |  |  ------------------
  |  |  732|  21.8k|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|  21.8k|  this->field = value; \
  |  |  734|  21.8k|}
  ------------------
  825|  21.8k|    break;
  826|  21.8k|  case TJPARAM_LOSSLESSPT:
  ------------------
  |  Branch (826:3): [True: 21.8k, False: 300k]
  ------------------
  827|  21.8k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (827:9): [True: 0, False: 21.8k]
  ------------------
  828|  21.8k|      THROW("TJPARAM_LOSSLESSPT is read-only in decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  829|  21.8k|    SET_PARAM(losslessPt, 0, 15);
  ------------------
  |  |  730|  21.8k|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|  21.8k|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 21.8k]
  |  |  |  Branch (731:28): [True: 21.8k, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 21.8k]
  |  |  ------------------
  |  |  732|  21.8k|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|  21.8k|  this->field = value; \
  |  |  734|  21.8k|}
  ------------------
  830|  21.8k|    break;
  831|      0|  case TJPARAM_RESTARTBLOCKS:
  ------------------
  |  Branch (831:3): [True: 0, False: 322k]
  ------------------
  832|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (832:9): [True: 0, False: 0]
  ------------------
  833|      0|      THROW("TJPARAM_RESTARTBLOCKS is not applicable to decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  834|      0|    SET_PARAM(restartIntervalBlocks, 0, 65535);
  ------------------
  |  |  730|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 0]
  |  |  |  Branch (731:28): [True: 0, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|      0|  this->field = value; \
  |  |  734|      0|}
  ------------------
  835|      0|    if (value != 0) this->restartIntervalRows = 0;
  ------------------
  |  Branch (835:9): [True: 0, False: 0]
  ------------------
  836|      0|    break;
  837|  51.3k|  case TJPARAM_RESTARTROWS:
  ------------------
  |  Branch (837:3): [True: 51.3k, False: 270k]
  ------------------
  838|  51.3k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (838:9): [True: 0, False: 51.3k]
  ------------------
  839|  51.3k|      THROW("TJPARAM_RESTARTROWS is not applicable to decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  840|  51.3k|    SET_PARAM(restartIntervalRows, 0, 65535);
  ------------------
  |  |  730|  51.3k|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|  51.3k|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 51.3k]
  |  |  |  Branch (731:28): [True: 51.3k, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 51.3k]
  |  |  ------------------
  |  |  732|  51.3k|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|  51.3k|  this->field = value; \
  |  |  734|  51.3k|}
  ------------------
  841|  51.3k|    if (value != 0) this->restartIntervalBlocks = 0;
  ------------------
  |  Branch (841:9): [True: 14.6k, False: 36.6k]
  ------------------
  842|  51.3k|    break;
  843|      0|  case TJPARAM_XDENSITY:
  ------------------
  |  Branch (843:3): [True: 0, False: 322k]
  ------------------
  844|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (844:9): [True: 0, False: 0]
  ------------------
  845|      0|      THROW("TJPARAM_XDENSITY is read-only in decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  846|      0|    SET_PARAM(xDensity, 1, 65535);
  ------------------
  |  |  730|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 0]
  |  |  |  Branch (731:28): [True: 0, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|      0|  this->field = value; \
  |  |  734|      0|}
  ------------------
  847|      0|    break;
  848|      0|  case TJPARAM_YDENSITY:
  ------------------
  |  Branch (848:3): [True: 0, False: 322k]
  ------------------
  849|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (849:9): [True: 0, False: 0]
  ------------------
  850|      0|      THROW("TJPARAM_YDENSITY is read-only in decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  851|      0|    SET_PARAM(yDensity, 1, 65535);
  ------------------
  |  |  730|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 0]
  |  |  |  Branch (731:28): [True: 0, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|      0|  this->field = value; \
  |  |  734|      0|}
  ------------------
  852|      0|    break;
  853|      0|  case TJPARAM_DENSITYUNITS:
  ------------------
  |  Branch (853:3): [True: 0, False: 322k]
  ------------------
  854|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (854:9): [True: 0, False: 0]
  ------------------
  855|      0|      THROW("TJPARAM_DENSITYUNITS is read-only in decompression instances.");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  856|      0|    SET_PARAM(densityUnits, 0, 2);
  ------------------
  |  |  730|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 0]
  |  |  |  Branch (731:28): [True: 0, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|      0|  this->field = value; \
  |  |  734|      0|}
  ------------------
  857|      0|    break;
  858|      0|  case TJPARAM_MAXMEMORY:
  ------------------
  |  Branch (858:3): [True: 0, False: 322k]
  ------------------
  859|      0|    SET_PARAM(maxMemory, 0, (int)(min(LONG_MAX / 1048576L, (long)INT_MAX)));
  ------------------
  |  |  730|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 0]
  |  |  |  Branch (731:28): [Folded, False: 0]
  |  |  |  Branch (731:28): [True: 0, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  |  Branch (731:52): [Folded, False: 0]
  |  |  ------------------
  |  |  732|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|      0|  this->field = value; \
  |  |  734|      0|}
  ------------------
  860|      0|    break;
  861|  51.3k|  case TJPARAM_MAXPIXELS:
  ------------------
  |  Branch (861:3): [True: 51.3k, False: 270k]
  ------------------
  862|  51.3k|    SET_PARAM(maxPixels, 0, -1);
  ------------------
  |  |  730|  51.3k|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|  51.3k|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 51.3k]
  |  |  |  Branch (731:28): [Folded, False: 51.3k]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|  51.3k|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|  51.3k|  this->field = value; \
  |  |  734|  51.3k|}
  ------------------
  863|  51.3k|    break;
  864|      0|  case TJPARAM_SAVEMARKERS:
  ------------------
  |  Branch (864:3): [True: 0, False: 322k]
  ------------------
  865|      0|    SET_PARAM(saveMarkers, 0, 4);
  ------------------
  |  |  730|      0|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|      0|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 0]
  |  |  |  Branch (731:28): [True: 0, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|      0|    THROW("Parameter value out of range"); \
  |  |  ------------------
  |  |  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  |  |  257|      0|}
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  282|      0|}
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  733|      0|  this->field = value; \
  |  |  734|      0|}
  ------------------
  866|      0|    break;
  867|      0|  default:
  ------------------
  |  Branch (867:3): [True: 0, False: 322k]
  ------------------
  868|      0|    THROW("Invalid parameter");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
  869|   322k|  }
  870|       |
  871|   322k|bailout:
  872|   322k|  return retval;
  873|   322k|}
tj3Get:
  878|  21.8k|{
  879|  21.8k|  tjinstance *this = (tjinstance *)handle;
  880|  21.8k|  if (!this) return -1;
  ------------------
  |  Branch (880:7): [True: 0, False: 21.8k]
  ------------------
  881|       |
  882|  21.8k|  switch (param) {
  ------------------
  |  Branch (882:11): [True: 21.8k, False: 0]
  ------------------
  883|      0|  case TJPARAM_STOPONWARNING:
  ------------------
  |  Branch (883:3): [True: 0, False: 21.8k]
  ------------------
  884|      0|    return this->jerr.stopOnWarning;
  885|      0|  case TJPARAM_BOTTOMUP:
  ------------------
  |  Branch (885:3): [True: 0, False: 21.8k]
  ------------------
  886|      0|    return this->bottomUp;
  887|  21.8k|  case TJPARAM_NOREALLOC:
  ------------------
  |  Branch (887:3): [True: 21.8k, False: 0]
  ------------------
  888|  21.8k|    return this->noRealloc;
  889|      0|  case TJPARAM_QUALITY:
  ------------------
  |  Branch (889:3): [True: 0, False: 21.8k]
  ------------------
  890|      0|    return this->quality;
  891|      0|  case TJPARAM_SUBSAMP:
  ------------------
  |  Branch (891:3): [True: 0, False: 21.8k]
  ------------------
  892|      0|    return this->subsamp;
  893|      0|  case TJPARAM_JPEGWIDTH:
  ------------------
  |  Branch (893:3): [True: 0, False: 21.8k]
  ------------------
  894|      0|    return this->jpegWidth;
  895|      0|  case TJPARAM_JPEGHEIGHT:
  ------------------
  |  Branch (895:3): [True: 0, False: 21.8k]
  ------------------
  896|      0|    return this->jpegHeight;
  897|      0|  case TJPARAM_PRECISION:
  ------------------
  |  Branch (897:3): [True: 0, False: 21.8k]
  ------------------
  898|      0|    return this->precision;
  899|      0|  case TJPARAM_COLORSPACE:
  ------------------
  |  Branch (899:3): [True: 0, False: 21.8k]
  ------------------
  900|      0|    return this->colorspace;
  901|      0|  case TJPARAM_FASTUPSAMPLE:
  ------------------
  |  Branch (901:3): [True: 0, False: 21.8k]
  ------------------
  902|      0|    return this->fastUpsample;
  903|      0|  case TJPARAM_FASTDCT:
  ------------------
  |  Branch (903:3): [True: 0, False: 21.8k]
  ------------------
  904|      0|    return this->fastDCT;
  905|      0|  case TJPARAM_OPTIMIZE:
  ------------------
  |  Branch (905:3): [True: 0, False: 21.8k]
  ------------------
  906|      0|    return this->optimize;
  907|      0|  case TJPARAM_PROGRESSIVE:
  ------------------
  |  Branch (907:3): [True: 0, False: 21.8k]
  ------------------
  908|      0|    return this->progressive;
  909|      0|  case TJPARAM_SCANLIMIT:
  ------------------
  |  Branch (909:3): [True: 0, False: 21.8k]
  ------------------
  910|      0|    return this->scanLimit;
  911|      0|  case TJPARAM_ARITHMETIC:
  ------------------
  |  Branch (911:3): [True: 0, False: 21.8k]
  ------------------
  912|      0|    return this->arithmetic;
  913|      0|  case TJPARAM_LOSSLESS:
  ------------------
  |  Branch (913:3): [True: 0, False: 21.8k]
  ------------------
  914|      0|    return this->lossless;
  915|      0|  case TJPARAM_LOSSLESSPSV:
  ------------------
  |  Branch (915:3): [True: 0, False: 21.8k]
  ------------------
  916|      0|    return this->losslessPSV;
  917|      0|  case TJPARAM_LOSSLESSPT:
  ------------------
  |  Branch (917:3): [True: 0, False: 21.8k]
  ------------------
  918|      0|    return this->losslessPt;
  919|      0|  case TJPARAM_RESTARTBLOCKS:
  ------------------
  |  Branch (919:3): [True: 0, False: 21.8k]
  ------------------
  920|      0|    return this->restartIntervalBlocks;
  921|      0|  case TJPARAM_RESTARTROWS:
  ------------------
  |  Branch (921:3): [True: 0, False: 21.8k]
  ------------------
  922|      0|    return this->restartIntervalRows;
  923|      0|  case TJPARAM_XDENSITY:
  ------------------
  |  Branch (923:3): [True: 0, False: 21.8k]
  ------------------
  924|      0|    return this->xDensity;
  925|      0|  case TJPARAM_YDENSITY:
  ------------------
  |  Branch (925:3): [True: 0, False: 21.8k]
  ------------------
  926|      0|    return this->yDensity;
  927|      0|  case TJPARAM_DENSITYUNITS:
  ------------------
  |  Branch (927:3): [True: 0, False: 21.8k]
  ------------------
  928|      0|    return this->densityUnits;
  929|      0|  case TJPARAM_MAXMEMORY:
  ------------------
  |  Branch (929:3): [True: 0, False: 21.8k]
  ------------------
  930|      0|    return this->maxMemory;
  931|      0|  case TJPARAM_MAXPIXELS:
  ------------------
  |  Branch (931:3): [True: 0, False: 21.8k]
  ------------------
  932|      0|    return this->maxPixels;
  933|      0|  case TJPARAM_SAVEMARKERS:
  ------------------
  |  Branch (933:3): [True: 0, False: 21.8k]
  ------------------
  934|      0|    return this->saveMarkers;
  935|  21.8k|  }
  936|       |
  937|      0|  return -1;
  938|  21.8k|}
tj3Alloc:
  948|  18.9k|{
  949|  18.9k|  return MALLOC(bytes);
  ------------------
  |  |  520|  18.9k|#define MALLOC(size)  malloc(size)
  ------------------
  950|  18.9k|}
tj3Free:
  961|  58.3k|{
  962|  58.3k|  free(buf);
  963|  58.3k|}
tj3JPEGBufSize:
  974|  21.8k|{
  975|  21.8k|  static const char FUNCTION_NAME[] = "tj3JPEGBufSize";
  976|  21.8k|  unsigned long long retval = 0;
  977|  21.8k|  int mcuw, mcuh, chromasf;
  978|       |
  979|  21.8k|  if (width < 1 || height < 1 || jpegSubsamp < TJSAMP_UNKNOWN ||
  ------------------
  |  Branch (979:7): [True: 0, False: 21.8k]
  |  Branch (979:20): [True: 0, False: 21.8k]
  |  Branch (979:34): [True: 0, False: 21.8k]
  ------------------
  980|  21.8k|      jpegSubsamp >= TJ_NUMSAMP)
  ------------------
  |  |  111|  21.8k|#define TJ_NUMSAMP  9
  ------------------
  |  Branch (980:7): [True: 0, False: 21.8k]
  ------------------
  981|  21.8k|    THROWG("Invalid argument", 0);
  ------------------
  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  ------------------
  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  257|      0|}
  ------------------
  982|       |
  983|  21.8k|  if (jpegSubsamp == TJSAMP_UNKNOWN)
  ------------------
  |  Branch (983:7): [True: 0, False: 21.8k]
  ------------------
  984|      0|    jpegSubsamp = TJSAMP_444;
  985|       |
  986|       |  /* This allows for rare corner cases in which a JPEG image can actually be
  987|       |     larger than the uncompressed input (we wouldn't mention it if it hadn't
  988|       |     happened before.) */
  989|  21.8k|  mcuw = tjMCUWidth[jpegSubsamp];
  990|  21.8k|  mcuh = tjMCUHeight[jpegSubsamp];
  991|  21.8k|  chromasf = jpegSubsamp == TJSAMP_GRAY ? 0 : 4 * 64 / (mcuw * mcuh);
  ------------------
  |  Branch (991:14): [True: 0, False: 21.8k]
  ------------------
  992|  21.8k|  retval = (unsigned long long)PAD(width, mcuw) * PAD(height, mcuh) *
  ------------------
  |  |   57|  21.8k|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
                retval = (unsigned long long)PAD(width, mcuw) * PAD(height, mcuh) *
  ------------------
  |  |   57|  21.8k|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
  993|  21.8k|           (2ULL + chromasf) + 2048ULL;
  994|       |#if ULLONG_MAX > ULONG_MAX
  995|       |  if (retval > (unsigned long long)((unsigned long)-1))
  996|       |    THROWG("Image is too large", 0);
  997|       |#endif
  998|       |
  999|  21.8k|bailout:
 1000|  21.8k|  return (size_t)retval;
 1001|  21.8k|}
tj3SetICCProfile:
 1240|  20.0k|{
 1241|  20.0k|  static const char FUNCTION_NAME[] = "tj3SetICCProfile";
 1242|  20.0k|  int retval = 0;
 1243|       |
 1244|  20.0k|  GET_TJINSTANCE(handle, -1)
  ------------------
  |  |  350|  20.0k|  tjinstance *this = (tjinstance *)handle; \
  |  |  351|  20.0k|  \
  |  |  352|  20.0k|  if (!this) { \
  |  |  ------------------
  |  |  |  Branch (352:7): [True: 0, False: 20.0k]
  |  |  ------------------
  |  |  353|      0|    SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  ------------------
  |  |                   SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): Invalid handle", FUNCTION_NAME); \
  |  |  ------------------
  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  354|      0|    return errorReturn; \
  |  |  355|      0|  } \
  |  |  356|  20.0k|  this->jerr.warning = FALSE; \
  |  |  ------------------
  |  |  |  |  207|  20.0k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  357|  20.0k|  this->isInstanceError = FALSE;
  |  |  ------------------
  |  |  |  |  207|  20.0k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  ------------------
 1245|  20.0k|  if ((this->init & COMPRESS) == 0)
  ------------------
  |  Branch (1245:7): [True: 0, False: 20.0k]
  ------------------
 1246|  20.0k|    THROW("Instance has not been initialized for compression");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
 1247|       |
 1248|  20.0k|  if (iccBuf == this->iccBuf && iccSize == this->iccSize)
  ------------------
  |  Branch (1248:7): [True: 0, False: 20.0k]
  |  Branch (1248:33): [True: 0, False: 0]
  ------------------
 1249|      0|    return 0;
 1250|       |
 1251|  20.0k|  free(this->iccBuf);
 1252|  20.0k|  this->iccBuf = NULL;
 1253|  20.0k|  this->iccSize = 0;
 1254|  20.0k|  if (iccBuf && iccSize) {
  ------------------
  |  Branch (1254:7): [True: 20.0k, False: 0]
  |  Branch (1254:17): [True: 20.0k, False: 0]
  ------------------
 1255|  20.0k|    if ((this->iccBuf = (unsigned char *)malloc(iccSize)) == NULL)
  ------------------
  |  Branch (1255:9): [True: 0, False: 20.0k]
  ------------------
 1256|  20.0k|      THROW("Memory allocation failure");
  ------------------
  |  |  283|      0|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|      0|#define THROWRV(m, rv) { \
  |  |  |  |  280|      0|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|      0|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|      0|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|      0|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|      0|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|      0|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|      0|}
  |  |  |  |  ------------------
  |  |  |  |  282|      0|}
  |  |  ------------------
  ------------------
 1257|  20.0k|    memcpy(this->iccBuf, iccBuf, iccSize);
 1258|  20.0k|    this->iccSize = iccSize;
 1259|  20.0k|  }
 1260|       |
 1261|  20.0k|bailout:
 1262|  20.0k|  return retval;
 1263|  20.0k|}
turbojpeg.c:_tjInitCompress:
 1200|  58.6k|{
 1201|  58.6k|  static unsigned char buffer[1];
 1202|  58.6k|  unsigned char *buf = buffer;
 1203|  58.6k|  size_t size = 1;
 1204|       |
 1205|       |  /* This is also straight out of example.c */
 1206|  58.6k|  this->cinfo.err = jpeg_std_error(&this->jerr.pub);
 1207|  58.6k|  this->jerr.pub.error_exit = my_error_exit;
 1208|  58.6k|  this->jerr.pub.output_message = my_output_message;
 1209|  58.6k|  this->jerr.emit_message = this->jerr.pub.emit_message;
 1210|  58.6k|  this->jerr.pub.emit_message = my_emit_message;
 1211|  58.6k|  this->jerr.pub.addon_message_table = turbojpeg_message_table;
 1212|  58.6k|  this->jerr.pub.first_addon_message = JMSG_FIRSTADDONCODE;
 1213|  58.6k|  this->jerr.pub.last_addon_message = JMSG_LASTADDONCODE;
 1214|  58.6k|  this->jerr.tjHandle = (tjhandle)this;
 1215|       |
 1216|  58.6k|  if (setjmp(this->jerr.setjmp_buffer)) {
  ------------------
  |  Branch (1216:7): [True: 0, False: 58.6k]
  ------------------
 1217|       |    /* If we get here, the JPEG code has signaled an error. */
 1218|      0|    free(this);
 1219|      0|    return NULL;
 1220|      0|  }
 1221|       |
 1222|  58.6k|  jpeg_create_compress(&this->cinfo);
  ------------------
  |  |  969|  58.6k|  jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
  |  |  ------------------
  |  |  |  |    4|  58.6k|#define JPEG_LIB_VERSION  62
  |  |  ------------------
  |  |  970|  58.6k|                      (size_t)sizeof(struct jpeg_compress_struct))
  ------------------
 1223|       |  /* Make an initial call so it will create the destination manager */
 1224|  58.6k|  jpeg_mem_dest_tj(&this->cinfo, &buf, &size, 0);
 1225|       |
 1226|  58.6k|  this->init |= COMPRESS;
 1227|  58.6k|  return (tjhandle)this;
 1228|  58.6k|}
turbojpeg.c:my_error_exit:
   81|  44.6k|{
   82|  44.6k|  my_error_ptr myerr = (my_error_ptr)cinfo->err;
   83|       |
   84|  44.6k|  (*cinfo->err->output_message) (cinfo);
   85|  44.6k|  longjmp(myerr->setjmp_buffer, 1);
   86|  44.6k|}
turbojpeg.c:my_output_message:
  149|  44.6k|{
  150|  44.6k|  my_error_ptr myerr = (my_error_ptr)cinfo->err;
  151|  44.6k|  tjinstance *this = (tjinstance *)myerr->tjHandle;
  152|       |
  153|  44.6k|  if (this) {
  ------------------
  |  Branch (153:7): [True: 44.6k, False: 0]
  ------------------
  154|  44.6k|    this->isInstanceError = TRUE;
  ------------------
  |  |  210|  44.6k|#define TRUE    1
  ------------------
  155|  44.6k|    (*cinfo->err->format_message) (cinfo, this->errStr);
  156|  44.6k|  } else
  157|      0|    (*cinfo->err->format_message) (cinfo, errStr);
  158|  44.6k|}
turbojpeg.c:my_emit_message:
   89|  30.7k|{
   90|  30.7k|  my_error_ptr myerr = (my_error_ptr)cinfo->err;
   91|       |
   92|  30.7k|  myerr->emit_message(cinfo, msg_level);
   93|  30.7k|  if (msg_level < 0) {
  ------------------
  |  Branch (93:7): [True: 0, False: 30.7k]
  ------------------
   94|      0|    myerr->warning = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
   95|      0|    if (myerr->stopOnWarning) longjmp(myerr->setjmp_buffer, 1);
  ------------------
  |  Branch (95:9): [True: 0, False: 0]
  ------------------
   96|      0|  }
   97|  30.7k|}
turbojpeg.c:setCompDefaults:
  379|  21.8k|{
  380|  21.8k|  int colorspace = yuv ? TJCS_DEFAULT : this->colorspace;
  ------------------
  |  Branch (380:20): [True: 0, False: 21.8k]
  ------------------
  381|       |
  382|  21.8k|  this->cinfo.in_color_space = pf2cs[pixelFormat];
  383|  21.8k|  this->cinfo.input_components = tjPixelSize[pixelFormat];
  384|  21.8k|  jpeg_set_defaults(&this->cinfo);
  385|       |
  386|  21.8k|  this->cinfo.restart_interval = this->restartIntervalBlocks;
  387|  21.8k|  this->cinfo.restart_in_rows = this->restartIntervalRows;
  388|  21.8k|  this->cinfo.X_density = (UINT16)this->xDensity;
  389|  21.8k|  this->cinfo.Y_density = (UINT16)this->yDensity;
  390|  21.8k|  this->cinfo.density_unit = (UINT8)this->densityUnits;
  391|  21.8k|  this->cinfo.mem->max_memory_to_use = (long)this->maxMemory * 1048576L;
  392|       |
  393|  21.8k|  if (this->lossless && !yuv) {
  ------------------
  |  Branch (393:7): [True: 21.8k, False: 0]
  |  Branch (393:25): [True: 21.8k, False: 0]
  ------------------
  394|  21.8k|#ifdef C_LOSSLESS_SUPPORTED
  395|  21.8k|    jpeg_enable_lossless(&this->cinfo, this->losslessPSV, this->losslessPt);
  396|  21.8k|#endif
  397|  21.8k|    return;
  398|  21.8k|  }
  399|       |
  400|      0|  jpeg_set_quality(&this->cinfo, this->quality, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  401|      0|  this->cinfo.dct_method = this->fastDCT ? JDCT_FASTEST : JDCT_ISLOW;
  ------------------
  |  |  304|      0|#define JDCT_FASTEST  JDCT_IFAST
  ------------------
  |  Branch (401:28): [True: 0, False: 0]
  ------------------
  402|       |
  403|      0|  switch (colorspace) {
  404|      0|  case TJCS_RGB:
  ------------------
  |  Branch (404:3): [True: 0, False: 0]
  ------------------
  405|      0|    jpeg_set_colorspace(&this->cinfo, JCS_RGB);  break;
  406|      0|  case TJCS_YCbCr:
  ------------------
  |  Branch (406:3): [True: 0, False: 0]
  ------------------
  407|      0|    jpeg_set_colorspace(&this->cinfo, JCS_YCbCr);  break;
  408|      0|  case TJCS_GRAY:
  ------------------
  |  Branch (408:3): [True: 0, False: 0]
  ------------------
  409|      0|    jpeg_set_colorspace(&this->cinfo, JCS_GRAYSCALE);  break;
  410|      0|  case TJCS_CMYK:
  ------------------
  |  Branch (410:3): [True: 0, False: 0]
  ------------------
  411|      0|    jpeg_set_colorspace(&this->cinfo, JCS_CMYK);  break;
  412|      0|  case TJCS_YCCK:
  ------------------
  |  Branch (412:3): [True: 0, False: 0]
  ------------------
  413|      0|    jpeg_set_colorspace(&this->cinfo, JCS_YCCK);  break;
  414|      0|  default:
  ------------------
  |  Branch (414:3): [True: 0, False: 0]
  ------------------
  415|      0|    if (this->subsamp == TJSAMP_GRAY)
  ------------------
  |  Branch (415:9): [True: 0, False: 0]
  ------------------
  416|      0|      jpeg_set_colorspace(&this->cinfo, JCS_GRAYSCALE);
  417|      0|    else if (pixelFormat == TJPF_CMYK)
  ------------------
  |  Branch (417:14): [True: 0, False: 0]
  ------------------
  418|      0|      jpeg_set_colorspace(&this->cinfo, JCS_YCCK);
  419|      0|    else
  420|      0|      jpeg_set_colorspace(&this->cinfo, JCS_YCbCr);
  421|      0|  }
  422|       |
  423|      0|  if (this->cinfo.data_precision == 8)
  ------------------
  |  Branch (423:7): [True: 0, False: 0]
  ------------------
  424|      0|    this->cinfo.optimize_coding = this->optimize;
  425|      0|#ifdef C_PROGRESSIVE_SUPPORTED
  426|      0|  if (this->progressive) jpeg_simple_progression(&this->cinfo);
  ------------------
  |  Branch (426:7): [True: 0, False: 0]
  ------------------
  427|      0|#endif
  428|      0|  this->cinfo.arith_code = this->arithmetic;
  429|       |
  430|      0|  this->cinfo.comp_info[0].h_samp_factor = tjMCUWidth[this->subsamp] / 8;
  431|      0|  this->cinfo.comp_info[1].h_samp_factor = 1;
  432|      0|  this->cinfo.comp_info[2].h_samp_factor = 1;
  433|      0|  if (this->cinfo.num_components > 3)
  ------------------
  |  Branch (433:7): [True: 0, False: 0]
  ------------------
  434|      0|    this->cinfo.comp_info[3].h_samp_factor = tjMCUWidth[this->subsamp] / 8;
  435|      0|  this->cinfo.comp_info[0].v_samp_factor = tjMCUHeight[this->subsamp] / 8;
  436|      0|  this->cinfo.comp_info[1].v_samp_factor = 1;
  437|      0|  this->cinfo.comp_info[2].v_samp_factor = 1;
  438|      0|  if (this->cinfo.num_components > 3)
  ------------------
  |  Branch (438:7): [True: 0, False: 0]
  ------------------
  439|      0|    this->cinfo.comp_info[3].v_samp_factor = tjMCUHeight[this->subsamp] / 8;
  440|      0|}

