LLVMFuzzerTestOneInput:
   55|  7.09k|{
   56|  7.09k|  tjhandle handle = NULL;
   57|  7.09k|  short *imgBuf = NULL, *srcBuf;
   58|  7.09k|  unsigned char *dstBuf = NULL;
   59|  7.09k|  int width = 0, height = 0, ti;
   60|  7.09k|  FILE *file = NULL;
   61|  7.09k|  struct test tests[NUMTESTS] = {
   62|       |    /*
   63|       |      BU Pixel      JPEG          Subsampling  Fst Qual Prg Ari No    Rst
   64|       |         Format     Colorspace    Level        DCT              Realc Rows */
   65|  7.09k|    { 0, TJPF_RGB,  TJCS_YCbCr,   TJSAMP_444,  1,  100, 0,  0,  1,    0    },
   66|  7.09k|    { 0, TJPF_BGR,  TJCS_DEFAULT, TJSAMP_422,  0,  90,  0,  0,  0,    0    },
   67|  7.09k|    { 0, TJPF_RGBX, TJCS_RGB,     TJSAMP_420,  0,  75,  0,  1,  0,    1    },
   68|  7.09k|    { 0, TJPF_BGRA, TJCS_DEFAULT, TJSAMP_411,  0,  50,  0,  0,  0,    0    },
   69|  7.09k|    { 0, TJPF_XRGB, TJCS_GRAY,    TJSAMP_GRAY, 0,  25,  0,  0,  0,    0    },
   70|  7.09k|    { 0, TJPF_GRAY, TJCS_DEFAULT, TJSAMP_GRAY, 0,  10,  1,  0,  0,    0    },
   71|  7.09k|    { 1, TJPF_CMYK, TJCS_YCCK,    TJSAMP_440,  0,  1,   1,  1,  0,    1    }
   72|  7.09k|  };
   73|       |
   74|  7.09k|  if ((file = fmemopen((void *)data, size, "r")) == NULL)
  ------------------
  |  Branch (74:7): [True: 0, False: 7.09k]
  ------------------
   75|      0|    goto bailout;
   76|       |
   77|  7.09k|  if ((handle = tj3Init(TJINIT_COMPRESS)) == NULL)
  ------------------
  |  | 1284|  7.09k|#define tj3Init(initType)  tj3InitVersion(initType, TURBOJPEG_VERSION_NUMBER)
  |  |  ------------------
  |  |  |  |   34|  7.09k|#define TURBOJPEG_VERSION_NUMBER  3002000
  |  |  ------------------
  ------------------
  |  Branch (77:7): [True: 0, False: 7.09k]
  ------------------
   78|      0|    goto bailout;
   79|       |
   80|  56.7k|  for (ti = 0; ti < NUMTESTS; ti++) {
  ------------------
  |  |   42|  56.7k|#define NUMTESTS  7
  ------------------
  |  Branch (80:16): [True: 49.6k, False: 7.09k]
  ------------------
   81|  49.6k|    int pf = tests[ti].pf;
   82|  49.6k|    size_t dstSize = 0, maxBufSize, i, sum = 0;
   83|       |
   84|       |    /* Test non-default compression options on specific iterations. */
   85|  49.6k|    tj3Set(handle, TJPARAM_BOTTOMUP, tests[ti].bottomUp);
   86|  49.6k|    tj3Set(handle, TJPARAM_COLORSPACE, tests[ti].colorspace);
   87|  49.6k|    tj3Set(handle, TJPARAM_FASTDCT, tests[ti].fastDCT);
   88|  49.6k|    tj3Set(handle, TJPARAM_PROGRESSIVE, tests[ti].progressive);
   89|  49.6k|    tj3Set(handle, TJPARAM_ARITHMETIC, tests[ti].arithmetic);
   90|  49.6k|    tj3Set(handle, TJPARAM_NOREALLOC, tests[ti].noRealloc);
   91|  49.6k|    tj3Set(handle, TJPARAM_RESTARTROWS, tests[ti].restartRows);
   92|       |
   93|  49.6k|    tj3Set(handle, TJPARAM_MAXPIXELS, 1048576);
   94|       |    /* tj3LoadImage12() will refuse to load images larger than 1 Megapixel, so
   95|       |       we don't need to check the width and height here. */
   96|  49.6k|    fseek(file, 0, SEEK_SET);
   97|  49.6k|    if ((imgBuf = _tj3LoadImageFromFileHandle12(handle, file, &width, 1,
  ------------------
  |  Branch (97:9): [True: 37.5k, False: 12.1k]
  ------------------
   98|  49.6k|                                                &height, &pf)) == NULL) {
   99|  37.5k|      if (size < 2)
  ------------------
  |  Branch (99:11): [True: 154, False: 37.3k]
  ------------------
  100|    154|        continue;
  101|       |
  102|       |      /* Derive image dimensions from input data.  Use first 2 bytes to
  103|       |         influence width/height. */
  104|  37.3k|      width = (data[0] % 64) + 8;   /* 8-71 */
  105|  37.3k|      height = (data[1] % 64) + 8;  /* 8-71 */
  106|       |
  107|  37.3k|      size_t required_size = 2 + (size_t)width * height *
  108|  37.3k|                             tjPixelSize[tests[ti].pf] * 2;
  109|  37.3k|      if (size < required_size) {
  ------------------
  |  Branch (109:11): [True: 33.5k, False: 3.79k]
  ------------------
  110|       |        /* Not enough data - try smaller dimensions */
  111|  33.5k|        width = 8;
  112|  33.5k|        height = 8;
  113|  33.5k|        required_size = 2 + (size_t)width * height *
  114|  33.5k|                        tjPixelSize[tests[ti].pf] * 2;
  115|  33.5k|        if (size < required_size)
  ------------------
  |  Branch (115:13): [True: 27.1k, False: 6.43k]
  ------------------
  116|  27.1k|          continue;
  117|  33.5k|      }
  118|       |
  119|       |      /* Skip header bytes. */
  120|  10.2k|      srcBuf = (short *)(data + 2);
  121|  10.2k|    } else
  122|  12.1k|      srcBuf = imgBuf;
  123|       |
  124|  22.3k|    dstSize = maxBufSize = tj3JPEGBufSize(width, height, tests[ti].subsamp);
  125|  22.3k|    if (tj3Get(handle, TJPARAM_NOREALLOC)) {
  ------------------
  |  Branch (125:9): [True: 3.16k, False: 19.2k]
  ------------------
  126|  3.16k|      if ((dstBuf = (unsigned char *)tj3Alloc(dstSize)) == NULL)
  ------------------
  |  Branch (126:11): [True: 0, False: 3.16k]
  ------------------
  127|      0|        goto bailout;
  128|  3.16k|    } else
  129|  19.2k|      dstBuf = NULL;
  130|       |
  131|  22.3k|    if (size >= 34)
  ------------------
  |  Branch (131:9): [True: 18.8k, False: 3.54k]
  ------------------
  132|  18.8k|      tj3SetICCProfile(handle, (unsigned char *)&data[2], 32);
  133|       |
  134|  22.3k|    tj3Set(handle, TJPARAM_SUBSAMP, tests[ti].subsamp);
  135|  22.3k|    tj3Set(handle, TJPARAM_QUALITY, tests[ti].quality);
  136|  22.3k|    if (tj3Compress12(handle, srcBuf, width, 0, height, pf, &dstBuf,
  ------------------
  |  Branch (136:9): [True: 22.3k, False: 4]
  ------------------
  137|  22.3k|                      &dstSize) == 0) {
  138|       |      /* Touch all of the output data in order to catch uninitialized reads
  139|       |         when using MemorySanitizer. */
  140|   349M|      for (i = 0; i < dstSize; i++)
  ------------------
  |  Branch (140:19): [True: 349M, False: 22.3k]
  ------------------
  141|   349M|        sum += dstBuf[i];
  142|  22.3k|    }
  143|       |
  144|  22.3k|    tj3Free(dstBuf);
  145|  22.3k|    dstBuf = NULL;
  146|  22.3k|    tj3Free(imgBuf);
  147|  22.3k|    imgBuf = NULL;
  148|       |
  149|       |    /* Prevent the sum above from being optimized out.  This test should never
  150|       |       be true, but the compiler doesn't know that. */
  151|  22.3k|    if (sum > 255 * maxBufSize)
  ------------------
  |  Branch (151:9): [True: 0, False: 22.3k]
  ------------------
  152|      0|      goto bailout;
  153|  22.3k|  }
  154|       |
  155|  7.09k|bailout:
  156|  7.09k|  tj3Free(dstBuf);
  157|  7.09k|  tj3Free(imgBuf);
  158|  7.09k|  if (file) fclose(file);
  ------------------
  |  Branch (158:7): [True: 7.09k, False: 0]
  ------------------
  159|  7.09k|  tj3Destroy(handle);
  160|  7.09k|  return 0;
  161|  7.09k|}

jsimd_set_huff_encode_one_block:
 1432|  24.9k|{
 1433|  24.9k|  init_simd((j_common_ptr)cinfo);
 1434|       |
 1435|  24.9k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1435:7): [Folded, False: 24.9k]
  ------------------
 1436|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1437|  24.9k|  if (!cinfo->entropy)
  ------------------
  |  Branch (1437:7): [True: 0, False: 24.9k]
  ------------------
 1438|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1439|       |
 1440|  24.9k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
 1441|  24.9k|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|  24.9k|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (1441:7): [True: 24.9k, False: 0]
  ------------------
 1442|  24.9k|      cinfo->master->simd_huffman &&
  ------------------
  |  Branch (1442:7): [True: 24.9k, False: 0]
  ------------------
 1443|  24.9k|      IS_ALIGNED_SSE(jconst_huff_encode_one_block)) {
  ------------------
  |  |   45|  24.9k|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   43|  24.9k|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (45:30): [True: 24.9k, False: 0]
  |  |  ------------------
  ------------------
 1444|  24.9k|    cinfo->entropy->huff_encode_one_block_simd =
 1445|  24.9k|      jsimd_huff_encode_one_block_sse2;
 1446|  24.9k|    return JSIMD_SSE2;
  ------------------
  |  |   42|  24.9k|#define JSIMD_SSE2       0x08
  ------------------
 1447|  24.9k|  }
 1448|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
 1449|       |  if ((cinfo->master->simd_support & JSIMD_NEON) &&
 1450|       |      cinfo->master->simd_huffman) {
 1451|       |    cinfo->entropy->huff_encode_one_block_simd =
 1452|       |      jsimd_huff_encode_one_block_neon;
 1453|       |    return JSIMD_NEON;
 1454|       |  }
 1455|       |#endif
 1456|       |
 1457|      0|  return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1458|  24.9k|}
jsimd_set_encode_mcu_AC_first_prepare:
 1464|  22.3k|{
 1465|  22.3k|  init_simd((j_common_ptr)cinfo);
 1466|       |
 1467|  22.3k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1467:7): [Folded, False: 22.3k]
  ------------------
 1468|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1469|       |
 1470|  22.3k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
 1471|  22.3k|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|  22.3k|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (1471:7): [True: 22.3k, False: 0]
  ------------------
 1472|  22.3k|      cinfo->master->simd_huffman) {
  ------------------
  |  Branch (1472:7): [True: 22.3k, False: 0]
  ------------------
 1473|  22.3k|    *method = jsimd_encode_mcu_AC_first_prepare_sse2;
 1474|  22.3k|    return JSIMD_SSE2;
  ------------------
  |  |   42|  22.3k|#define JSIMD_SSE2       0x08
  ------------------
 1475|  22.3k|  }
 1476|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
 1477|       |  if ((cinfo->master->simd_support & JSIMD_NEON) &&
 1478|       |      cinfo->master->simd_huffman) {
 1479|       |    *method = jsimd_encode_mcu_AC_first_prepare_neon;
 1480|       |    return JSIMD_NEON;
 1481|       |  }
 1482|       |#endif
 1483|       |
 1484|      0|  return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1485|  22.3k|}
jsimd_set_encode_mcu_AC_refine_prepare:
 1491|  14.9k|{
 1492|  14.9k|  init_simd((j_common_ptr)cinfo);
 1493|       |
 1494|  14.9k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1494:7): [Folded, False: 14.9k]
  ------------------
 1495|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1496|       |
 1497|  14.9k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
 1498|  14.9k|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|  14.9k|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (1498:7): [True: 14.9k, False: 0]
  ------------------
 1499|  14.9k|      cinfo->master->simd_huffman) {
  ------------------
  |  Branch (1499:7): [True: 14.9k, False: 0]
  ------------------
 1500|  14.9k|    *method = jsimd_encode_mcu_AC_refine_prepare_sse2;
 1501|  14.9k|    return JSIMD_SSE2;
  ------------------
  |  |   42|  14.9k|#define JSIMD_SSE2       0x08
  ------------------
 1502|  14.9k|  }
 1503|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
 1504|       |  if ((cinfo->master->simd_support & JSIMD_NEON) &&
 1505|       |      cinfo->master->simd_huffman) {
 1506|       |    *method = jsimd_encode_mcu_AC_refine_prepare_neon;
 1507|       |    return JSIMD_NEON;
 1508|       |  }
 1509|       |#endif
 1510|       |
 1511|      0|  return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1512|  14.9k|}
jsimd.c:init_simd:
   56|  62.2k|{
   57|  62.2k|#ifndef NO_GETENV
   58|  62.2k|  char env[2] = { 0 };
   59|  62.2k|#endif
   60|  62.2k|  unsigned int simd_support = cinfo->is_decompressor ?
  ------------------
  |  Branch (60:31): [True: 0, False: 62.2k]
  ------------------
   61|      0|                              ((j_decompress_ptr)cinfo)->master->simd_support :
   62|  62.2k|                              ((j_compress_ptr)cinfo)->master->simd_support;
   63|  62.2k|  unsigned int simd_huffman = cinfo->is_decompressor ?
  ------------------
  |  Branch (63:31): [True: 0, False: 62.2k]
  ------------------
   64|      0|                              ((j_decompress_ptr)cinfo)->master->simd_huffman :
   65|  62.2k|                              ((j_compress_ptr)cinfo)->master->simd_huffman;
   66|       |
   67|  62.2k|  if (simd_support != JSIMD_UNDEFINED)
  ------------------
  |  |   49|  62.2k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|  62.2k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  |  Branch (67:7): [True: 58.3k, False: 3.91k]
  ------------------
   68|  58.3k|    return;
   69|       |
   70|  3.91k|  simd_support = jpeg_simd_cpu_support();
   71|       |
   72|  3.91k|#ifndef NO_GETENV
   73|       |  /* Force different settings through environment variables */
   74|  3.91k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
   75|  3.91k|  if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1"))
  ------------------
  |  Branch (75:7): [True: 3.91k, False: 0]
  |  Branch (75:47): [True: 0, False: 3.91k]
  ------------------
   76|      0|    simd_support &= JSIMD_SSE2 | JSIMD_SSE;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
                  simd_support &= JSIMD_SSE2 | JSIMD_SSE;
  ------------------
  |  |   41|      0|#define JSIMD_SSE        0x04
  ------------------
   77|       |#if SIMD_ARCHITECTURE == I386
   78|       |  if (!GETENV_S(env, 2, "JSIMD_FORCESSE") && !strcmp(env, "1"))
   79|       |    simd_support &= JSIMD_SSE | JSIMD_MMX;
   80|       |  if (!GETENV_S(env, 2, "JSIMD_FORCEMMX") && !strcmp(env, "1"))
   81|       |    simd_support &= JSIMD_MMX;
   82|       |  if (!GETENV_S(env, 2, "JSIMD_FORCE3DNOW") && !strcmp(env, "1"))
   83|       |    simd_support &= JSIMD_3DNOW | JSIMD_MMX;
   84|       |#endif
   85|       |#elif SIMD_ARCHITECTURE == ARM
   86|       |  if (!GETENV_S(env, 2, "JSIMD_FORCENEON") && !strcmp(env, "1"))
   87|       |    simd_support = JSIMD_NEON;
   88|       |#elif SIMD_ARCHITECTURE == RISCV64
   89|       |  if (!GETENV_S(env, 2, "JSIMD_FORCERVV") && !strcmp(env, "1"))
   90|       |    simd_support = JSIMD_RVV;
   91|       |#elif SIMD_ARCHITECTURE == MIPS64
   92|       |  if (!GETENV_S(env, 2, "JSIMD_FORCEMMI") && !strcmp(env, "1"))
   93|       |    simd_support = JSIMD_MMI;
   94|       |#endif
   95|  3.91k|  if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
  ------------------
  |  Branch (95:7): [True: 3.91k, False: 0]
  |  Branch (95:47): [True: 0, False: 3.91k]
  ------------------
   96|      0|    simd_support = 0;
   97|  3.91k|  if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
  ------------------
  |  Branch (97:7): [True: 3.91k, False: 0]
  |  Branch (97:47): [True: 0, False: 3.91k]
  ------------------
   98|      0|    simd_huffman = 0;
   99|  3.91k|#endif
  100|       |
  101|  3.91k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (101:7): [True: 0, False: 3.91k]
  ------------------
  102|      0|    ((j_decompress_ptr)cinfo)->master->simd_support = simd_support;
  103|      0|    ((j_decompress_ptr)cinfo)->master->simd_huffman = simd_huffman;
  104|  3.91k|  } else {
  105|  3.91k|    ((j_compress_ptr)cinfo)->master->simd_support = simd_support;
  106|  3.91k|    ((j_compress_ptr)cinfo)->master->simd_huffman = simd_huffman;
  107|  3.91k|  }
  108|  3.91k|}

rdpng-12.c:rgb_to_cmyk:
   29|  19.0M|{
   30|  19.0M|  double ctmp = 1.0 - ((double)r / (double)maxval);
   31|  19.0M|  double mtmp = 1.0 - ((double)g / (double)maxval);
   32|  19.0M|  double ytmp = 1.0 - ((double)b / (double)maxval);
   33|  19.0M|  double ktmp = MIN(MIN(ctmp, mtmp), ytmp);
  ------------------
  |  |  515|  38.1M|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 1.86M, False: 17.2M]
  |  |  |  Branch (515:27): [True: 1.00M, False: 18.0M]
  |  |  |  Branch (515:39): [True: 915k, False: 952k]
  |  |  ------------------
  ------------------
   34|       |
   35|  19.0M|  if (ktmp == 1.0) ctmp = mtmp = ytmp = 0.0;
  ------------------
  |  Branch (35:7): [True: 12.3M, False: 6.69M]
  ------------------
   36|  6.69M|  else {
   37|  6.69M|    ctmp = (ctmp - ktmp) / (1.0 - ktmp);
   38|  6.69M|    mtmp = (mtmp - ktmp) / (1.0 - ktmp);
   39|  6.69M|    ytmp = (ytmp - ktmp) / (1.0 - ktmp);
   40|  6.69M|  }
   41|  19.0M|  *c = (_JSAMPLE)((double)maxval - ctmp * (double)maxval + 0.5);
   42|  19.0M|  *m = (_JSAMPLE)((double)maxval - mtmp * (double)maxval + 0.5);
   43|  19.0M|  *y = (_JSAMPLE)((double)maxval - ytmp * (double)maxval + 0.5);
   44|  19.0M|  *k = (_JSAMPLE)((double)maxval - ktmp * (double)maxval + 0.5);
   45|  19.0M|}
rdppm-12.c:rgb_to_cmyk:
   29|  23.1M|{
   30|  23.1M|  double ctmp = 1.0 - ((double)r / (double)maxval);
   31|  23.1M|  double mtmp = 1.0 - ((double)g / (double)maxval);
   32|  23.1M|  double ytmp = 1.0 - ((double)b / (double)maxval);
   33|  23.1M|  double ktmp = MIN(MIN(ctmp, mtmp), ytmp);
  ------------------
  |  |  515|  46.2M|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 1.89M, False: 21.2M]
  |  |  |  Branch (515:27): [True: 1.18M, False: 21.9M]
  |  |  |  Branch (515:39): [True: 888k, False: 1.01M]
  |  |  ------------------
  ------------------
   34|       |
   35|  23.1M|  if (ktmp == 1.0) ctmp = mtmp = ytmp = 0.0;
  ------------------
  |  Branch (35:7): [True: 13.8M, False: 9.24M]
  ------------------
   36|  9.24M|  else {
   37|  9.24M|    ctmp = (ctmp - ktmp) / (1.0 - ktmp);
   38|  9.24M|    mtmp = (mtmp - ktmp) / (1.0 - ktmp);
   39|  9.24M|    ytmp = (ytmp - ktmp) / (1.0 - ktmp);
   40|  9.24M|  }
   41|  23.1M|  *c = (_JSAMPLE)((double)maxval - ctmp * (double)maxval + 0.5);
   42|  23.1M|  *m = (_JSAMPLE)((double)maxval - mtmp * (double)maxval + 0.5);
   43|  23.1M|  *y = (_JSAMPLE)((double)maxval - ytmp * (double)maxval + 0.5);
   44|  23.1M|  *k = (_JSAMPLE)((double)maxval - ktmp * (double)maxval + 0.5);
   45|  23.1M|}

jpeg_CreateCompress:
   39|  56.7k|{
   40|  56.7k|  int i;
   41|       |
   42|       |  /* Guard against version mismatches between library and caller. */
   43|  56.7k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   44|  56.7k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  56.7k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (44:7): [True: 0, False: 56.7k]
  ------------------
   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|  56.7k|  if (structsize != sizeof(struct jpeg_compress_struct))
  ------------------
  |  Branch (46:7): [True: 0, False: 56.7k]
  ------------------
   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|  56.7k|             (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|  56.7k|  {
   57|  56.7k|    struct jpeg_error_mgr *err = cinfo->err;
   58|  56.7k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   59|  56.7k|    memset(cinfo, 0, sizeof(struct jpeg_compress_struct));
   60|  56.7k|    cinfo->err = err;
   61|  56.7k|    cinfo->client_data = client_data;
   62|  56.7k|  }
   63|  56.7k|  cinfo->is_decompressor = FALSE;
  ------------------
  |  |  207|  56.7k|#define FALSE   0               /* values of boolean */
  ------------------
   64|       |
   65|       |  /* Initialize a memory manager instance for this object */
   66|  56.7k|  jinit_memory_mgr((j_common_ptr)cinfo);
   67|       |
   68|       |  /* Zero out pointers to permanent structures. */
   69|  56.7k|  cinfo->progress = NULL;
   70|  56.7k|  cinfo->dest = NULL;
   71|       |
   72|  56.7k|  cinfo->comp_info = NULL;
   73|       |
   74|   283k|  for (i = 0; i < NUM_QUANT_TBLS; i++) {
  ------------------
  |  |   68|   283k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (74:15): [True: 227k, False: 56.7k]
  ------------------
   75|   227k|    cinfo->quant_tbl_ptrs[i] = NULL;
   76|       |#if JPEG_LIB_VERSION >= 70
   77|       |    cinfo->q_scale_factor[i] = 100;
   78|       |#endif
   79|   227k|  }
   80|       |
   81|   283k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|   283k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (81:15): [True: 227k, False: 56.7k]
  ------------------
   82|   227k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   83|   227k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   84|   227k|  }
   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|  56.7k|  cinfo->script_space = NULL;
   94|       |
   95|  56.7k|  cinfo->input_gamma = 1.0;     /* in case application forgets */
   96|       |
   97|  56.7k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|  56.7k|#define BITS_IN_JSAMPLE  8
  ------------------
   98|       |
   99|       |  /* OK, I'm ready */
  100|  56.7k|  cinfo->global_state = CSTATE_START;
  ------------------
  |  |   44|  56.7k|#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|  56.7k|  cinfo->master = (struct jpeg_comp_master *)
  106|  56.7k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  56.7k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  107|  56.7k|                                  sizeof(my_comp_master));
  108|  56.7k|  memset(cinfo->master, 0, sizeof(my_comp_master));
  109|  56.7k|#ifdef WITH_SIMD
  110|  56.7k|  cinfo->master->simd_support = JSIMD_UNDEFINED;
  ------------------
  |  |   49|  56.7k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|  56.7k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  111|  56.7k|  cinfo->master->simd_huffman = 1;
  112|  56.7k|#endif
  113|  56.7k|}
jpeg_destroy_compress:
  122|  56.7k|{
  123|  56.7k|  jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
  124|  56.7k|}
jpeg_abort_compress:
  134|      4|{
  135|      4|  jpeg_abort((j_common_ptr)cinfo); /* use common routine */
  136|      4|}
jpeg_suppress_tables:
  153|  22.3k|{
  154|  22.3k|  int i;
  155|  22.3k|  JQUANT_TBL *qtbl;
  156|  22.3k|  JHUFF_TBL *htbl;
  157|       |
  158|   111k|  for (i = 0; i < NUM_QUANT_TBLS; i++) {
  ------------------
  |  |   68|   111k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (158:15): [True: 89.4k, False: 22.3k]
  ------------------
  159|  89.4k|    if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL)
  ------------------
  |  Branch (159:9): [True: 44.7k, False: 44.7k]
  ------------------
  160|  44.7k|      qtbl->sent_table = suppress;
  161|  89.4k|  }
  162|       |
  163|   111k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|   111k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (163:15): [True: 89.4k, False: 22.3k]
  ------------------
  164|  89.4k|    if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL)
  ------------------
  |  Branch (164:9): [True: 44.7k, False: 44.7k]
  ------------------
  165|  44.7k|      htbl->sent_table = suppress;
  166|  89.4k|    if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL)
  ------------------
  |  Branch (166:9): [True: 44.7k, False: 44.7k]
  ------------------
  167|  44.7k|      htbl->sent_table = suppress;
  168|  89.4k|  }
  169|  22.3k|}
jpeg_finish_compress:
  181|  22.3k|{
  182|  22.3k|  JDIMENSION iMCU_row;
  183|       |
  184|  22.3k|  if (cinfo->global_state == CSTATE_SCANNING ||
  ------------------
  |  |   45|  44.7k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (184:7): [True: 22.3k, False: 0]
  ------------------
  185|  22.3k|      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|  22.3k|    if (cinfo->next_scanline < cinfo->image_height)
  ------------------
  |  Branch (187:9): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|    (*cinfo->master->finish_pass) (cinfo);
  190|  22.3k|  } 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|   124k|  while (!cinfo->master->is_last_pass) {
  ------------------
  |  Branch (193:10): [True: 102k, False: 22.3k]
  ------------------
  194|   102k|    (*cinfo->master->prepare_for_pass) (cinfo);
  195|  12.0M|    for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
  ------------------
  |  Branch (195:24): [True: 11.9M, False: 102k]
  ------------------
  196|  11.9M|      if (cinfo->progress != NULL) {
  ------------------
  |  Branch (196:11): [True: 0, False: 11.9M]
  ------------------
  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|  11.9M|      if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (204:11): [True: 0, False: 11.9M]
  ------------------
  205|      0|        if (cinfo->coef->compress_data == NULL)
  ------------------
  |  Branch (205:13): [True: 0, False: 0]
  ------------------
  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|      0|        if (!(*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE)NULL))
  ------------------
  |  Branch (207:13): [True: 0, False: 0]
  ------------------
  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|  11.9M|      } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (209:18): [True: 11.9M, False: 0]
  ------------------
  210|  11.9M|        if (cinfo->coef->compress_data_12 == NULL)
  ------------------
  |  Branch (210:13): [True: 0, False: 11.9M]
  ------------------
  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|  11.9M|        if (!(*cinfo->coef->compress_data_12) (cinfo, (J12SAMPIMAGE)NULL))
  ------------------
  |  Branch (212:13): [True: 0, False: 11.9M]
  ------------------
  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|  11.9M|      } 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|  11.9M|    }
  225|   102k|    (*cinfo->master->finish_pass) (cinfo);
  226|   102k|  }
  227|       |  /* Write EOI, do final cleanup */
  228|  22.3k|  (*cinfo->marker->write_file_trailer) (cinfo);
  229|  22.3k|  (*cinfo->dest->term_destination) (cinfo);
  230|       |  /* We can use jpeg_abort to release memory and reset global_state */
  231|  22.3k|  jpeg_abort((j_common_ptr)cinfo);
  232|  22.3k|}
jpeg_write_m_header:
  266|  18.8k|{
  267|  18.8k|  if (cinfo->next_scanline != 0 ||
  ------------------
  |  Branch (267:7): [True: 0, False: 18.8k]
  ------------------
  268|  18.8k|      (cinfo->global_state != CSTATE_SCANNING &&
  ------------------
  |  |   45|  37.6k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (268:8): [True: 0, False: 18.8k]
  ------------------
  269|      0|       cinfo->global_state != CSTATE_RAW_OK &&
  ------------------
  |  |   46|  18.8k|#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|  18.8k|  (*cinfo->marker->write_marker_header) (cinfo, marker, datalen);
  274|  18.8k|}
jpeg_write_m_byte:
  278|   865k|{
  279|   865k|  (*cinfo->marker->write_marker_byte) (cinfo, val);
  280|   865k|}

jpeg_start_compress:
   45|  22.3k|{
   46|  22.3k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  22.3k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (46:7): [True: 0, False: 22.3k]
  ------------------
   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|  22.3k|  if (write_all_tables)
  ------------------
  |  Branch (49:7): [True: 22.3k, False: 0]
  ------------------
   50|  22.3k|    jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */
  ------------------
  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  ------------------
   51|       |
   52|       |  /* (Re)initialize error mgr and destination modules */
   53|  22.3k|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
   54|  22.3k|  (*cinfo->dest->init_destination) (cinfo);
   55|       |  /* Perform master selection of active modules */
   56|  22.3k|  jinit_compress_master(cinfo);
   57|       |  /* Set up for the first pass */
   58|  22.3k|  (*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|  22.3k|  cinfo->next_scanline = 0;
   63|  22.3k|  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|  22.3k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (63:26): [True: 0, False: 22.3k]
  ------------------
   64|  22.3k|}
jpeg12_write_scanlines:
   87|  22.3k|{
   88|  22.3k|#if BITS_IN_JSAMPLE != 16 || defined(C_LOSSLESS_SUPPORTED)
   89|  22.3k|  JDIMENSION row_ctr, rows_left;
   90|       |
   91|  22.3k|#ifdef C_LOSSLESS_SUPPORTED
   92|  22.3k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (92:7): [True: 0, False: 22.3k]
  ------------------
   93|       |#if BITS_IN_JSAMPLE == 8
   94|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
   95|       |#else
   96|      0|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (96:9): [True: 0, False: 0]
  ------------------
   97|      0|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (97:9): [True: 0, False: 0]
  ------------------
   98|      0|#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|      0|  } else
  101|  22.3k|#endif
  102|  22.3k|  {
  103|  22.3k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  22.3k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (103:9): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  }
  106|       |
  107|  22.3k|  if (cinfo->global_state != CSTATE_SCANNING)
  ------------------
  |  |   45|  22.3k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (107:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  if (cinfo->next_scanline >= cinfo->image_height)
  ------------------
  |  Branch (109:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (113:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  if (cinfo->master->call_pass_startup)
  ------------------
  |  Branch (124:7): [True: 6.15k, False: 16.2k]
  ------------------
  125|  6.15k|    (*cinfo->master->pass_startup) (cinfo);
  126|       |
  127|       |  /* Ignore any extra scanlines at bottom of image. */
  128|  22.3k|  rows_left = cinfo->image_height - cinfo->next_scanline;
  129|  22.3k|  if (num_lines > rows_left)
  ------------------
  |  Branch (129:7): [True: 0, False: 22.3k]
  ------------------
  130|      0|    num_lines = rows_left;
  131|       |
  132|  22.3k|  row_ctr = 0;
  133|  22.3k|  if (cinfo->main->_process_data == NULL)
  ------------------
  |  |  140|  22.3k|#define _process_data  process_data_12
  ------------------
  |  Branch (133:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  (*cinfo->main->_process_data) (cinfo, scanlines, &row_ctr, num_lines);
  ------------------
  |  |  140|  22.3k|#define _process_data  process_data_12
  ------------------
  136|  22.3k|  cinfo->next_scanline += row_ctr;
  137|  22.3k|  return row_ctr;
  138|       |#else
  139|       |  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  140|       |  return 0;
  141|       |#endif
  142|  22.3k|}

jinit_arith_encoder:
  913|  6.15k|{
  914|  6.15k|  arith_entropy_ptr entropy;
  915|  6.15k|  int i;
  916|       |
  917|  6.15k|  entropy = (arith_entropy_ptr)
  918|  6.15k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  6.15k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  919|  6.15k|                                sizeof(arith_entropy_encoder));
  920|  6.15k|  cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
  921|  6.15k|  entropy->pub.start_pass = start_pass;
  922|  6.15k|  entropy->pub.finish_pass = finish_pass;
  923|       |
  924|       |  /* Mark tables unallocated */
  925|   104k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|   104k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (925:15): [True: 98.4k, False: 6.15k]
  ------------------
  926|  98.4k|    entropy->dc_stats[i] = NULL;
  927|  98.4k|    entropy->ac_stats[i] = NULL;
  928|  98.4k|  }
  929|       |
  930|       |  /* Initialize index for fixed probability estimation */
  931|  6.15k|  entropy->fixed_bin[0] = 113;
  932|  6.15k|}
jcarith.c:start_pass:
  829|  58.4k|{
  830|  58.4k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  831|  58.4k|  int ci, tbl;
  832|  58.4k|  jpeg_component_info *compptr;
  833|       |
  834|  58.4k|  if (gather_statistics)
  ------------------
  |  Branch (834:7): [True: 0, False: 58.4k]
  ------------------
  835|       |    /* Make sure to avoid that in the master control logic!
  836|       |     * We are fully adaptive here and need no extra
  837|       |     * statistics gathering pass!
  838|       |     */
  839|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  840|       |
  841|       |  /* We assume jcmaster.c already validated the progressive scan parameters. */
  842|       |
  843|       |  /* Select execution routines */
  844|  58.4k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (844:7): [True: 55.3k, False: 3.07k]
  ------------------
  845|  55.3k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (845:9): [True: 27.6k, False: 27.6k]
  ------------------
  846|  27.6k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (846:11): [True: 3.07k, False: 24.6k]
  ------------------
  847|  3.07k|        entropy->pub.encode_mcu = encode_mcu_DC_first;
  848|  24.6k|      else
  849|  24.6k|        entropy->pub.encode_mcu = encode_mcu_AC_first;
  850|  27.6k|    } else {
  851|  27.6k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (851:11): [True: 3.07k, False: 24.6k]
  ------------------
  852|  3.07k|        entropy->pub.encode_mcu = encode_mcu_DC_refine;
  853|  24.6k|      else
  854|  24.6k|        entropy->pub.encode_mcu = encode_mcu_AC_refine;
  855|  27.6k|    }
  856|  55.3k|  } else
  857|  3.07k|    entropy->pub.encode_mcu = encode_mcu;
  858|       |
  859|       |  /* Allocate & initialize requested statistics areas */
  860|   141k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (860:16): [True: 83.0k, False: 58.4k]
  ------------------
  861|  83.0k|    compptr = cinfo->cur_comp_info[ci];
  862|       |    /* DC needs no table for refinement scan */
  863|  83.0k|    if (cinfo->progressive_mode == 0 || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (863:9): [True: 9.23k, False: 73.8k]
  |  Branch (863:42): [True: 24.6k, False: 49.2k]
  |  Branch (863:60): [True: 12.3k, False: 12.3k]
  ------------------
  864|  21.5k|      tbl = compptr->dc_tbl_no;
  865|  21.5k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  21.5k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (865:11): [True: 0, False: 21.5k]
  |  Branch (865:22): [True: 0, False: 21.5k]
  ------------------
  866|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, 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)))
  ------------------
  867|  21.5k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (867:11): [True: 9.23k, False: 12.3k]
  ------------------
  868|  9.23k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  869|  9.23k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  889|  9.23k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  9.23k|#define DC_STAT_BINS  64
  ------------------
  870|  21.5k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  21.5k|#define DC_STAT_BINS  64
  ------------------
  871|       |      /* Initialize DC predictions to 0 */
  872|  21.5k|      entropy->last_dc_val[ci] = 0;
  873|  21.5k|      entropy->dc_context[ci] = 0;
  874|  21.5k|    }
  875|       |    /* AC needs no table when not present */
  876|  83.0k|    if (cinfo->progressive_mode == 0 || cinfo->Se) {
  ------------------
  |  Branch (876:9): [True: 9.23k, False: 73.8k]
  |  Branch (876:41): [True: 49.2k, False: 24.6k]
  ------------------
  877|  58.4k|      tbl = compptr->ac_tbl_no;
  878|  58.4k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  58.4k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (878:11): [True: 0, False: 58.4k]
  |  Branch (878:22): [True: 0, False: 58.4k]
  ------------------
  879|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, 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)))
  ------------------
  880|  58.4k|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (880:11): [True: 9.23k, False: 49.2k]
  ------------------
  881|  9.23k|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  882|  9.23k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  889|  9.23k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|  9.23k|#define AC_STAT_BINS  256
  ------------------
  883|  58.4k|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  58.4k|#define AC_STAT_BINS  256
  ------------------
  884|       |#ifdef CALCULATE_SPECTRAL_CONDITIONING
  885|       |      if (cinfo->progressive_mode)
  886|       |        /* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */
  887|       |        cinfo->arith_ac_K[tbl] = cinfo->Ss +
  888|       |                                 ((8 + cinfo->Se - cinfo->Ss) >> 4);
  889|       |#endif
  890|  58.4k|    }
  891|  83.0k|  }
  892|       |
  893|       |  /* Initialize arithmetic encoding variables */
  894|  58.4k|  entropy->c = 0;
  895|  58.4k|  entropy->a = 0x10000L;
  896|  58.4k|  entropy->sc = 0;
  897|  58.4k|  entropy->zc = 0;
  898|  58.4k|  entropy->ct = 11;
  899|  58.4k|  entropy->buffer = -1;  /* empty */
  900|       |
  901|       |  /* Initialize restart stuff */
  902|  58.4k|  entropy->restarts_to_go = cinfo->restart_interval;
  903|  58.4k|  entropy->next_restart_num = 0;
  904|  58.4k|}
jcarith.c:encode_mcu_DC_first:
  369|   912k|{
  370|   912k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  371|   912k|  JBLOCKROW block;
  372|   912k|  unsigned char *st;
  373|   912k|  int blkn, ci, tbl;
  374|   912k|  int v, v2, m;
  375|   912k|  ISHIFT_TEMPS
  376|       |
  377|       |  /* Emit restart marker if needed */
  378|   912k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (378:7): [True: 912k, False: 0]
  ------------------
  379|   912k|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (379:9): [True: 292k, False: 619k]
  ------------------
  380|   292k|      emit_restart(cinfo, entropy->next_restart_num);
  381|   292k|      entropy->restarts_to_go = cinfo->restart_interval;
  382|   292k|      entropy->next_restart_num++;
  383|   292k|      entropy->next_restart_num &= 7;
  384|   292k|    }
  385|   912k|    entropy->restarts_to_go--;
  386|   912k|  }
  387|       |
  388|       |  /* Encode the MCU data blocks */
  389|  6.38M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (389:18): [True: 5.47M, False: 912k]
  ------------------
  390|  5.47M|    block = MCU_data[blkn];
  391|  5.47M|    ci = cinfo->MCU_membership[blkn];
  392|  5.47M|    tbl = cinfo->cur_comp_info[ci]->dc_tbl_no;
  393|       |
  394|       |    /* Compute the DC value after the required point transform by Al.
  395|       |     * This is simply an arithmetic right shift.
  396|       |     */
  397|  5.47M|    m = IRIGHT_SHIFT((int)((*block)[0]), cinfo->Al);
  ------------------
  |  |  117|  5.47M|#define IRIGHT_SHIFT(x, shft)   ((x) >> (shft))
  ------------------
  398|       |
  399|       |    /* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */
  400|       |
  401|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  402|  5.47M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  403|       |
  404|       |    /* Figure F.4: Encode_DC_DIFF */
  405|  5.47M|    if ((v = m - entropy->last_dc_val[ci]) == 0) {
  ------------------
  |  Branch (405:9): [True: 3.79M, False: 1.67M]
  ------------------
  406|  3.79M|      arith_encode(cinfo, st, 0);
  407|  3.79M|      entropy->dc_context[ci] = 0;      /* zero diff category */
  408|  3.79M|    } else {
  409|  1.67M|      entropy->last_dc_val[ci] = m;
  410|  1.67M|      arith_encode(cinfo, st, 1);
  411|       |      /* Figure F.6: Encoding nonzero value v */
  412|       |      /* Figure F.7: Encoding the sign of v */
  413|  1.67M|      if (v > 0) {
  ------------------
  |  Branch (413:11): [True: 572k, False: 1.10M]
  ------------------
  414|   572k|        arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */
  415|   572k|        st += 2;                        /* Table F.4: SP = S0 + 2 */
  416|   572k|        entropy->dc_context[ci] = 4;    /* small positive diff category */
  417|  1.10M|      } else {
  418|  1.10M|        v = -v;
  419|  1.10M|        arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */
  420|  1.10M|        st += 3;                        /* Table F.4: SN = S0 + 3 */
  421|  1.10M|        entropy->dc_context[ci] = 8;    /* small negative diff category */
  422|  1.10M|      }
  423|       |      /* Figure F.8: Encoding the magnitude category of v */
  424|  1.67M|      m = 0;
  425|  1.67M|      if (v -= 1) {
  ------------------
  |  Branch (425:11): [True: 1.48M, False: 194k]
  ------------------
  426|  1.48M|        arith_encode(cinfo, st, 1);
  427|  1.48M|        m = 1;
  428|  1.48M|        v2 = v;
  429|  1.48M|        st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
  430|  5.28M|        while (v2 >>= 1) {
  ------------------
  |  Branch (430:16): [True: 3.79M, False: 1.48M]
  ------------------
  431|  3.79M|          arith_encode(cinfo, st, 1);
  432|  3.79M|          m <<= 1;
  433|  3.79M|          st += 1;
  434|  3.79M|        }
  435|  1.48M|      }
  436|  1.67M|      arith_encode(cinfo, st, 0);
  437|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  438|  1.67M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (438:11): [True: 0, False: 1.67M]
  ------------------
  439|      0|        entropy->dc_context[ci] = 0;    /* zero diff category */
  440|  1.67M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (440:16): [True: 1.32M, False: 357k]
  ------------------
  441|  1.32M|        entropy->dc_context[ci] += 8;   /* large diff category */
  442|       |      /* Figure F.9: Encoding the magnitude bit pattern of v */
  443|  1.67M|      st += 14;
  444|  5.47M|      while (m >>= 1)
  ------------------
  |  Branch (444:14): [True: 3.79M, False: 1.67M]
  ------------------
  445|  3.79M|        arith_encode(cinfo, st, (m & v) ? 1 : 0);
  ------------------
  |  Branch (445:33): [True: 2.50M, False: 1.29M]
  ------------------
  446|  1.67M|    }
  447|  5.47M|  }
  448|       |
  449|   912k|  return TRUE;
  ------------------
  |  |  210|   912k|#define TRUE    1
  ------------------
  450|   912k|}
jcarith.c:emit_restart:
  326|  7.90M|{
  327|  7.90M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  328|  7.90M|  int ci;
  329|  7.90M|  jpeg_component_info *compptr;
  330|       |
  331|  7.90M|  finish_pass(cinfo);
  332|       |
  333|  7.90M|  emit_byte(0xFF, cinfo);
  334|  7.90M|  emit_byte(JPEG_RST0 + restart_num, cinfo);
  ------------------
  |  | 1166|  7.90M|#define JPEG_RST0       0xD0    /* RST0 marker code */
  ------------------
  335|       |
  336|       |  /* Re-initialize statistics areas */
  337|  18.1M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (337:16): [True: 10.2M, False: 7.90M]
  ------------------
  338|  10.2M|    compptr = cinfo->cur_comp_info[ci];
  339|       |    /* DC needs no table for refinement scan */
  340|  10.2M|    if (cinfo->progressive_mode == 0 || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (340:9): [True: 877k, False: 9.36M]
  |  Branch (340:42): [True: 2.33M, False: 7.02M]
  |  Branch (340:60): [True: 1.16M, False: 1.16M]
  ------------------
  341|  2.04M|      memset(entropy->dc_stats[compptr->dc_tbl_no], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  2.04M|#define DC_STAT_BINS  64
  ------------------
  342|       |      /* Reset DC predictions to 0 */
  343|  2.04M|      entropy->last_dc_val[ci] = 0;
  344|  2.04M|      entropy->dc_context[ci] = 0;
  345|  2.04M|    }
  346|       |    /* AC needs no table when not present */
  347|  10.2M|    if (cinfo->progressive_mode == 0 || cinfo->Se) {
  ------------------
  |  Branch (347:9): [True: 877k, False: 9.36M]
  |  Branch (347:41): [True: 7.02M, False: 2.33M]
  ------------------
  348|  7.90M|      memset(entropy->ac_stats[compptr->ac_tbl_no], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  7.90M|#define AC_STAT_BINS  256
  ------------------
  349|  7.90M|    }
  350|  10.2M|  }
  351|       |
  352|       |  /* Reset arithmetic encoding variables */
  353|  7.90M|  entropy->c = 0;
  354|  7.90M|  entropy->a = 0x10000L;
  355|  7.90M|  entropy->sc = 0;
  356|  7.90M|  entropy->zc = 0;
  357|  7.90M|  entropy->ct = 11;
  358|  7.90M|  entropy->buffer = -1;  /* empty */
  359|  7.90M|}
jcarith.c:emit_byte:
  124|   115M|{
  125|   115M|  struct jpeg_destination_mgr *dest = cinfo->dest;
  126|       |
  127|   115M|  *dest->next_output_byte++ = (JOCTET)val;
  128|   115M|  if (--dest->free_in_buffer == 0)
  ------------------
  |  Branch (128:7): [True: 3.73k, False: 115M]
  ------------------
  129|  3.73k|    if (!(*dest->empty_output_buffer) (cinfo))
  ------------------
  |  Branch (129:9): [True: 0, False: 3.73k]
  ------------------
  130|      0|      ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  131|   115M|}
jcarith.c:arith_encode:
  226|  1.01G|{
  227|  1.01G|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  228|  1.01G|  register unsigned char nl, nm;
  229|  1.01G|  register JLONG qe, temp;
  230|  1.01G|  register int sv;
  231|       |
  232|       |  /* Fetch values from our compact representation of Table D.2:
  233|       |   * Qe values and probability estimation state machine
  234|       |   */
  235|  1.01G|  sv = *st;
  236|  1.01G|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  237|  1.01G|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  238|  1.01G|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  239|       |
  240|       |  /* Encode & estimation procedures per sections D.1.4 & D.1.5 */
  241|  1.01G|  e->a -= qe;
  242|  1.01G|  if (val != (sv >> 7)) {
  ------------------
  |  Branch (242:7): [True: 297M, False: 720M]
  ------------------
  243|       |    /* Encode the less probable symbol */
  244|   297M|    if (e->a >= qe) {
  ------------------
  |  Branch (244:9): [True: 230M, False: 66.1M]
  ------------------
  245|       |      /* If the interval size (qe) for the less probable symbol (LPS)
  246|       |       * is larger than the interval size for the MPS, then exchange
  247|       |       * the two symbols for coding efficiency, otherwise code the LPS
  248|       |       * as usual: */
  249|   230M|      e->c += e->a;
  250|   230M|      e->a = qe;
  251|   230M|    }
  252|   297M|    *st = (sv & 0x80) ^ nl;     /* Estimate_after_LPS */
  253|   720M|  } else {
  254|       |    /* Encode the more probable symbol */
  255|   720M|    if (e->a >= 0x8000L)
  ------------------
  |  Branch (255:9): [True: 404M, False: 316M]
  ------------------
  256|   404M|      return;  /* A >= 0x8000 -> ready, no renormalization required */
  257|   316M|    if (e->a < qe) {
  ------------------
  |  Branch (257:9): [True: 74.0M, False: 242M]
  ------------------
  258|       |      /* If the interval size (qe) for the less probable symbol (LPS)
  259|       |       * is larger than the interval size for the MPS, then exchange
  260|       |       * the two symbols for coding efficiency: */
  261|  74.0M|      e->c += e->a;
  262|  74.0M|      e->a = qe;
  263|  74.0M|    }
  264|   316M|    *st = (sv & 0x80) ^ nm;     /* Estimate_after_MPS */
  265|   316M|  }
  266|       |
  267|       |  /* Renormalization & data output per section D.1.6 */
  268|   749M|  do {
  269|   749M|    e->a <<= 1;
  270|   749M|    e->c <<= 1;
  271|   749M|    if (--e->ct == 0) {
  ------------------
  |  Branch (271:9): [True: 90.8M, False: 658M]
  ------------------
  272|       |      /* Another byte is ready for output */
  273|  90.8M|      temp = e->c >> 19;
  274|  90.8M|      if (temp > 0xFF) {
  ------------------
  |  Branch (274:11): [True: 3.59M, False: 87.2M]
  ------------------
  275|       |        /* Handle overflow over all stacked 0xFF bytes */
  276|  3.59M|        if (e->buffer >= 0) {
  ------------------
  |  Branch (276:13): [True: 3.59M, False: 0]
  ------------------
  277|  3.59M|          if (e->zc)
  ------------------
  |  Branch (277:15): [True: 14.5k, False: 3.58M]
  ------------------
  278|  15.1k|            do emit_byte(0x00, cinfo);
  279|  15.1k|            while (--e->zc);
  ------------------
  |  Branch (279:20): [True: 646, False: 14.5k]
  ------------------
  280|  3.59M|          emit_byte(e->buffer + 1, cinfo);
  281|  3.59M|          if (e->buffer + 1 == 0xFF)
  ------------------
  |  Branch (281:15): [True: 13.3k, False: 3.58M]
  ------------------
  282|  13.3k|            emit_byte(0x00, cinfo);
  283|  3.59M|        }
  284|  3.59M|        e->zc += e->sc;  /* carry-over converts stacked 0xFF bytes to 0x00 */
  285|  3.59M|        e->sc = 0;
  286|       |        /* Note: The 3 spacer bits in the C register guarantee
  287|       |         * that the new buffer byte can't be 0xFF here
  288|       |         * (see page 160 in the P&M JPEG book). */
  289|  3.59M|        e->buffer = temp & 0xFF;  /* new output byte, might overflow later */
  290|  87.2M|      } else if (temp == 0xFF) {
  ------------------
  |  Branch (290:18): [True: 663k, False: 86.6M]
  ------------------
  291|   663k|        ++e->sc;  /* stack 0xFF byte (which might overflow later) */
  292|  86.6M|      } else {
  293|       |        /* Output all stacked 0xFF bytes, they will not overflow any more */
  294|  86.6M|        if (e->buffer == 0)
  ------------------
  |  Branch (294:13): [True: 518k, False: 86.1M]
  ------------------
  295|   518k|          ++e->zc;
  296|  86.1M|        else if (e->buffer >= 0) {
  ------------------
  |  Branch (296:18): [True: 83.6M, False: 2.45M]
  ------------------
  297|  83.6M|          if (e->zc)
  ------------------
  |  Branch (297:15): [True: 336k, False: 83.3M]
  ------------------
  298|   434k|            do emit_byte(0x00, cinfo);
  299|   434k|            while (--e->zc);
  ------------------
  |  Branch (299:20): [True: 97.5k, False: 336k]
  ------------------
  300|  83.6M|          emit_byte(e->buffer, cinfo);
  301|  83.6M|        }
  302|  86.6M|        if (e->sc) {
  ------------------
  |  Branch (302:13): [True: 627k, False: 85.9M]
  ------------------
  303|   627k|          if (e->zc)
  ------------------
  |  Branch (303:15): [True: 1.80k, False: 625k]
  ------------------
  304|  1.95k|            do emit_byte(0x00, cinfo);
  305|  1.95k|            while (--e->zc);
  ------------------
  |  Branch (305:20): [True: 157, False: 1.80k]
  ------------------
  306|   641k|          do {
  307|   641k|            emit_byte(0xFF, cinfo);
  308|   641k|            emit_byte(0x00, cinfo);
  309|   641k|          } while (--e->sc);
  ------------------
  |  Branch (309:20): [True: 13.6k, False: 627k]
  ------------------
  310|   627k|        }
  311|  86.6M|        e->buffer = temp & 0xFF;  /* new output byte (can still overflow) */
  312|  86.6M|      }
  313|  90.8M|      e->c &= 0x7FFFFL;
  314|  90.8M|      e->ct += 8;
  315|  90.8M|    }
  316|   749M|  } while (e->a < 0x8000L);
  ------------------
  |  Branch (316:12): [True: 136M, False: 613M]
  ------------------
  317|   613M|}
jcarith.c:encode_mcu_AC_first:
  460|  9.33M|{
  461|  9.33M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  462|  9.33M|  JBLOCKROW block;
  463|  9.33M|  unsigned char *st;
  464|  9.33M|  int tbl, k, ke;
  465|  9.33M|  int v, v2, m;
  466|       |
  467|       |  /* Emit restart marker if needed */
  468|  9.33M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (468:7): [True: 9.33M, False: 0]
  ------------------
  469|  9.33M|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (469:9): [True: 3.51M, False: 5.82M]
  ------------------
  470|  3.51M|      emit_restart(cinfo, entropy->next_restart_num);
  471|  3.51M|      entropy->restarts_to_go = cinfo->restart_interval;
  472|  3.51M|      entropy->next_restart_num++;
  473|  3.51M|      entropy->next_restart_num &= 7;
  474|  3.51M|    }
  475|  9.33M|    entropy->restarts_to_go--;
  476|  9.33M|  }
  477|       |
  478|       |  /* Encode the MCU data block */
  479|  9.33M|  block = MCU_data[0];
  480|  9.33M|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  481|       |
  482|       |  /* Sections F.1.4.2 & F.1.4.4.2: Encoding of AC coefficients */
  483|       |
  484|       |  /* Establish EOB (end-of-block) index */
  485|   270M|  for (ke = cinfo->Se; ke > 0; ke--)
  ------------------
  |  Branch (485:24): [True: 263M, False: 6.85M]
  ------------------
  486|       |    /* We must apply the point transform by Al.  For AC coefficients this
  487|       |     * is an integer division with rounding towards 0.  To do this portably
  488|       |     * in C, we shift after obtaining the absolute value.
  489|       |     */
  490|   263M|    if ((v = (*block)[jpeg_natural_order[ke]]) >= 0) {
  ------------------
  |  Branch (490:9): [True: 257M, False: 6.14M]
  ------------------
  491|   257M|      if (v >>= cinfo->Al) break;
  ------------------
  |  Branch (491:11): [True: 1.21M, False: 255M]
  ------------------
  492|   257M|    } else {
  493|  6.14M|      v = -v;
  494|  6.14M|      if (v >>= cinfo->Al) break;
  ------------------
  |  Branch (494:11): [True: 1.27M, False: 4.87M]
  ------------------
  495|  6.14M|    }
  496|       |
  497|       |  /* Figure F.5: Encode_AC_Coefficients */
  498|  25.4M|  for (k = cinfo->Ss; k <= ke; k++) {
  ------------------
  |  Branch (498:23): [True: 16.0M, False: 9.33M]
  ------------------
  499|  16.0M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  500|  16.0M|    arith_encode(cinfo, st, 0);         /* EOB decision */
  501|  50.2M|    for (;;) {
  502|  50.2M|      if ((v = (*block)[jpeg_natural_order[k]]) >= 0) {
  ------------------
  |  Branch (502:11): [True: 32.4M, False: 17.7M]
  ------------------
  503|  32.4M|        if (v >>= cinfo->Al) {
  ------------------
  |  Branch (503:13): [True: 7.88M, False: 24.5M]
  ------------------
  504|  7.88M|          arith_encode(cinfo, st + 1, 1);
  505|  7.88M|          arith_encode(cinfo, entropy->fixed_bin, 0);
  506|  7.88M|          break;
  507|  7.88M|        }
  508|  32.4M|      } else {
  509|  17.7M|        v = -v;
  510|  17.7M|        if (v >>= cinfo->Al) {
  ------------------
  |  Branch (510:13): [True: 8.19M, False: 9.56M]
  ------------------
  511|  8.19M|          arith_encode(cinfo, st + 1, 1);
  512|  8.19M|          arith_encode(cinfo, entropy->fixed_bin, 1);
  513|  8.19M|          break;
  514|  8.19M|        }
  515|  17.7M|      }
  516|  34.1M|      arith_encode(cinfo, st + 1, 0);  st += 3;  k++;
  517|  34.1M|    }
  518|  16.0M|    st += 2;
  519|       |    /* Figure F.8: Encoding the magnitude category of v */
  520|  16.0M|    m = 0;
  521|  16.0M|    if (v -= 1) {
  ------------------
  |  Branch (521:9): [True: 5.81M, False: 10.2M]
  ------------------
  522|  5.81M|      arith_encode(cinfo, st, 1);
  523|  5.81M|      m = 1;
  524|  5.81M|      v2 = v;
  525|  5.81M|      if (v2 >>= 1) {
  ------------------
  |  Branch (525:11): [True: 2.77M, False: 3.03M]
  ------------------
  526|  2.77M|        arith_encode(cinfo, st, 1);
  527|  2.77M|        m <<= 1;
  528|  2.77M|        st = entropy->ac_stats[tbl] +
  529|  2.77M|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (529:15): [True: 753k, False: 2.02M]
  ------------------
  530|  3.81M|        while (v2 >>= 1) {
  ------------------
  |  Branch (530:16): [True: 1.03M, False: 2.77M]
  ------------------
  531|  1.03M|          arith_encode(cinfo, st, 1);
  532|  1.03M|          m <<= 1;
  533|  1.03M|          st += 1;
  534|  1.03M|        }
  535|  2.77M|      }
  536|  5.81M|    }
  537|  16.0M|    arith_encode(cinfo, st, 0);
  538|       |    /* Figure F.9: Encoding the magnitude bit pattern of v */
  539|  16.0M|    st += 14;
  540|  19.8M|    while (m >>= 1)
  ------------------
  |  Branch (540:12): [True: 3.81M, False: 16.0M]
  ------------------
  541|  3.81M|      arith_encode(cinfo, st, (m & v) ? 1 : 0);
  ------------------
  |  Branch (541:31): [True: 1.21M, False: 2.59M]
  ------------------
  542|  16.0M|  }
  543|       |  /* Encode EOB decision only if k <= cinfo->Se */
  544|  9.33M|  if (k <= cinfo->Se) {
  ------------------
  |  Branch (544:7): [True: 8.60M, False: 729k]
  ------------------
  545|  8.60M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  546|  8.60M|    arith_encode(cinfo, st, 1);
  547|  8.60M|  }
  548|       |
  549|  9.33M|  return TRUE;
  ------------------
  |  |  210|  9.33M|#define TRUE    1
  ------------------
  550|  9.33M|}
jcarith.c:encode_mcu_DC_refine:
  559|   912k|{
  560|   912k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  561|   912k|  unsigned char *st;
  562|   912k|  int Al, blkn;
  563|       |
  564|       |  /* Emit restart marker if needed */
  565|   912k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (565:7): [True: 912k, False: 0]
  ------------------
  566|   912k|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (566:9): [True: 292k, False: 619k]
  ------------------
  567|   292k|      emit_restart(cinfo, entropy->next_restart_num);
  568|   292k|      entropy->restarts_to_go = cinfo->restart_interval;
  569|   292k|      entropy->next_restart_num++;
  570|   292k|      entropy->next_restart_num &= 7;
  571|   292k|    }
  572|   912k|    entropy->restarts_to_go--;
  573|   912k|  }
  574|       |
  575|   912k|  st = entropy->fixed_bin;      /* use fixed probability estimation */
  576|   912k|  Al = cinfo->Al;
  577|       |
  578|       |  /* Encode the MCU data blocks */
  579|  6.38M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (579:18): [True: 5.47M, False: 912k]
  ------------------
  580|       |    /* We simply emit the Al'th bit of the DC coefficient value. */
  581|  5.47M|    arith_encode(cinfo, st, (MCU_data[blkn][0][0] >> Al) & 1);
  582|  5.47M|  }
  583|       |
  584|   912k|  return TRUE;
  ------------------
  |  |  210|   912k|#define TRUE    1
  ------------------
  585|   912k|}
jcarith.c:encode_mcu_AC_refine:
  594|  9.33M|{
  595|  9.33M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  596|  9.33M|  JBLOCKROW block;
  597|  9.33M|  unsigned char *st;
  598|  9.33M|  int tbl, k, ke, kex;
  599|  9.33M|  int v;
  600|       |
  601|       |  /* Emit restart marker if needed */
  602|  9.33M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (602:7): [True: 9.33M, False: 0]
  ------------------
  603|  9.33M|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (603:9): [True: 3.51M, False: 5.82M]
  ------------------
  604|  3.51M|      emit_restart(cinfo, entropy->next_restart_num);
  605|  3.51M|      entropy->restarts_to_go = cinfo->restart_interval;
  606|  3.51M|      entropy->next_restart_num++;
  607|  3.51M|      entropy->next_restart_num &= 7;
  608|  3.51M|    }
  609|  9.33M|    entropy->restarts_to_go--;
  610|  9.33M|  }
  611|       |
  612|       |  /* Encode the MCU data block */
  613|  9.33M|  block = MCU_data[0];
  614|  9.33M|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  615|       |
  616|       |  /* Section G.1.3.3: Encoding of AC coefficients */
  617|       |
  618|       |  /* Establish EOB (end-of-block) index */
  619|   468M|  for (ke = cinfo->Se; ke > 0; ke--)
  ------------------
  |  Branch (619:24): [True: 461M, False: 6.61M]
  ------------------
  620|       |    /* We must apply the point transform by Al.  For AC coefficients this
  621|       |     * is an integer division with rounding towards 0.  To do this portably
  622|       |     * in C, we shift after obtaining the absolute value.
  623|       |     */
  624|   461M|    if ((v = (*block)[jpeg_natural_order[ke]]) >= 0) {
  ------------------
  |  Branch (624:9): [True: 458M, False: 2.52M]
  ------------------
  625|   458M|      if (v >>= cinfo->Al) break;
  ------------------
  |  Branch (625:11): [True: 1.27M, False: 457M]
  ------------------
  626|   458M|    } else {
  627|  2.52M|      v = -v;
  628|  2.52M|      if (v >>= cinfo->Al) break;
  ------------------
  |  Branch (628:11): [True: 1.44M, False: 1.08M]
  ------------------
  629|  2.52M|    }
  630|       |
  631|       |  /* Establish EOBx (previous stage end-of-block) index */
  632|  24.5M|  for (kex = ke; kex > 0; kex--)
  ------------------
  |  Branch (632:18): [True: 17.8M, False: 6.69M]
  ------------------
  633|  17.8M|    if ((v = (*block)[jpeg_natural_order[kex]]) >= 0) {
  ------------------
  |  Branch (633:9): [True: 12.1M, False: 5.65M]
  ------------------
  634|  12.1M|      if (v >>= cinfo->Ah) break;
  ------------------
  |  Branch (634:11): [True: 1.29M, False: 10.8M]
  ------------------
  635|  12.1M|    } else {
  636|  5.65M|      v = -v;
  637|  5.65M|      if (v >>= cinfo->Ah) break;
  ------------------
  |  Branch (637:11): [True: 1.35M, False: 4.30M]
  ------------------
  638|  5.65M|    }
  639|       |
  640|       |  /* Figure G.10: Encode_AC_Coefficients_SA */
  641|  84.8M|  for (k = cinfo->Ss; k <= ke; k++) {
  ------------------
  |  Branch (641:23): [True: 75.4M, False: 9.33M]
  ------------------
  642|  75.4M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  643|  75.4M|    if (k > kex)
  ------------------
  |  Branch (643:9): [True: 5.56M, False: 69.9M]
  ------------------
  644|  5.56M|      arith_encode(cinfo, st, 0);       /* EOB decision */
  645|   129M|    for (;;) {
  646|   129M|      if ((v = (*block)[jpeg_natural_order[k]]) >= 0) {
  ------------------
  |  Branch (646:11): [True: 85.5M, False: 44.0M]
  ------------------
  647|  85.5M|        if (v >>= cinfo->Al) {
  ------------------
  |  Branch (647:13): [True: 37.2M, False: 48.2M]
  ------------------
  648|  37.2M|          if (v >> 1)                   /* previously nonzero coef */
  ------------------
  |  Branch (648:15): [True: 23.1M, False: 14.1M]
  ------------------
  649|  23.1M|            arith_encode(cinfo, st + 2, (v & 1));
  650|  14.1M|          else {                        /* newly nonzero coef */
  651|  14.1M|            arith_encode(cinfo, st + 1, 1);
  652|  14.1M|            arith_encode(cinfo, entropy->fixed_bin, 0);
  653|  14.1M|          }
  654|  37.2M|          break;
  655|  37.2M|        }
  656|  85.5M|      } else {
  657|  44.0M|        v = -v;
  658|  44.0M|        if (v >>= cinfo->Al) {
  ------------------
  |  Branch (658:13): [True: 38.2M, False: 5.84M]
  ------------------
  659|  38.2M|          if (v >> 1)                   /* previously nonzero coef */
  ------------------
  |  Branch (659:15): [True: 23.8M, False: 14.3M]
  ------------------
  660|  23.8M|            arith_encode(cinfo, st + 2, (v & 1));
  661|  14.3M|          else {                        /* newly nonzero coef */
  662|  14.3M|            arith_encode(cinfo, st + 1, 1);
  663|  14.3M|            arith_encode(cinfo, entropy->fixed_bin, 1);
  664|  14.3M|          }
  665|  38.2M|          break;
  666|  38.2M|        }
  667|  44.0M|      }
  668|  54.1M|      arith_encode(cinfo, st + 1, 0);  st += 3;  k++;
  669|  54.1M|    }
  670|  75.4M|  }
  671|       |  /* Encode EOB decision only if k <= cinfo->Se */
  672|  9.33M|  if (k <= cinfo->Se) {
  ------------------
  |  Branch (672:7): [True: 8.50M, False: 836k]
  ------------------
  673|  8.50M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  674|  8.50M|    arith_encode(cinfo, st, 1);
  675|  8.50M|  }
  676|       |
  677|  9.33M|  return TRUE;
  ------------------
  |  |  210|  9.33M|#define TRUE    1
  ------------------
  678|  9.33M|}
jcarith.c:encode_mcu:
  687|   601k|{
  688|   601k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  689|   601k|  jpeg_component_info *compptr;
  690|   601k|  JBLOCKROW block;
  691|   601k|  unsigned char *st;
  692|   601k|  int blkn, ci, tbl, k, ke;
  693|   601k|  int v, v2, m;
  694|       |
  695|       |  /* Emit restart marker if needed */
  696|   601k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (696:7): [True: 601k, False: 0]
  ------------------
  697|   601k|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (697:9): [True: 292k, False: 308k]
  ------------------
  698|   292k|      emit_restart(cinfo, entropy->next_restart_num);
  699|   292k|      entropy->restarts_to_go = cinfo->restart_interval;
  700|   292k|      entropy->next_restart_num++;
  701|   292k|      entropy->next_restart_num &= 7;
  702|   292k|    }
  703|   601k|    entropy->restarts_to_go--;
  704|   601k|  }
  705|       |
  706|       |  /* Encode the MCU data blocks */
  707|  4.20M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (707:18): [True: 3.60M, False: 601k]
  ------------------
  708|  3.60M|    block = MCU_data[blkn];
  709|  3.60M|    ci = cinfo->MCU_membership[blkn];
  710|  3.60M|    compptr = cinfo->cur_comp_info[ci];
  711|       |
  712|       |    /* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */
  713|       |
  714|  3.60M|    tbl = compptr->dc_tbl_no;
  715|       |
  716|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  717|  3.60M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  718|       |
  719|       |    /* Figure F.4: Encode_DC_DIFF */
  720|  3.60M|    if ((v = (*block)[0] - entropy->last_dc_val[ci]) == 0) {
  ------------------
  |  Branch (720:9): [True: 1.56M, False: 2.04M]
  ------------------
  721|  1.56M|      arith_encode(cinfo, st, 0);
  722|  1.56M|      entropy->dc_context[ci] = 0;      /* zero diff category */
  723|  2.04M|    } else {
  724|  2.04M|      entropy->last_dc_val[ci] = (*block)[0];
  725|  2.04M|      arith_encode(cinfo, st, 1);
  726|       |      /* Figure F.6: Encoding nonzero value v */
  727|       |      /* Figure F.7: Encoding the sign of v */
  728|  2.04M|      if (v > 0) {
  ------------------
  |  Branch (728:11): [True: 631k, False: 1.41M]
  ------------------
  729|   631k|        arith_encode(cinfo, st + 1, 0); /* Table F.4: SS = S0 + 1 */
  730|   631k|        st += 2;                        /* Table F.4: SP = S0 + 2 */
  731|   631k|        entropy->dc_context[ci] = 4;    /* small positive diff category */
  732|  1.41M|      } else {
  733|  1.41M|        v = -v;
  734|  1.41M|        arith_encode(cinfo, st + 1, 1); /* Table F.4: SS = S0 + 1 */
  735|  1.41M|        st += 3;                        /* Table F.4: SN = S0 + 3 */
  736|  1.41M|        entropy->dc_context[ci] = 8;    /* small negative diff category */
  737|  1.41M|      }
  738|       |      /* Figure F.8: Encoding the magnitude category of v */
  739|  2.04M|      m = 0;
  740|  2.04M|      if (v -= 1) {
  ------------------
  |  Branch (740:11): [True: 2.03M, False: 6.17k]
  ------------------
  741|  2.03M|        arith_encode(cinfo, st, 1);
  742|  2.03M|        m = 1;
  743|  2.03M|        v2 = v;
  744|  2.03M|        st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
  745|  18.8M|        while (v2 >>= 1) {
  ------------------
  |  Branch (745:16): [True: 16.8M, False: 2.03M]
  ------------------
  746|  16.8M|          arith_encode(cinfo, st, 1);
  747|  16.8M|          m <<= 1;
  748|  16.8M|          st += 1;
  749|  16.8M|        }
  750|  2.03M|      }
  751|  2.04M|      arith_encode(cinfo, st, 0);
  752|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  753|  2.04M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (753:11): [True: 0, False: 2.04M]
  ------------------
  754|      0|        entropy->dc_context[ci] = 0;    /* zero diff category */
  755|  2.04M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (755:16): [True: 2.03M, False: 10.5k]
  ------------------
  756|  2.03M|        entropy->dc_context[ci] += 8;   /* large diff category */
  757|       |      /* Figure F.9: Encoding the magnitude bit pattern of v */
  758|  2.04M|      st += 14;
  759|  18.9M|      while (m >>= 1)
  ------------------
  |  Branch (759:14): [True: 16.8M, False: 2.04M]
  ------------------
  760|  16.8M|        arith_encode(cinfo, st, (m & v) ? 1 : 0);
  ------------------
  |  Branch (760:33): [True: 10.5M, False: 6.32M]
  ------------------
  761|  2.04M|    }
  762|       |
  763|       |    /* Sections F.1.4.2 & F.1.4.4.2: Encoding of AC coefficients */
  764|       |
  765|  3.60M|    tbl = compptr->ac_tbl_no;
  766|       |
  767|       |    /* Establish EOB (end-of-block) index */
  768|   155M|    for (ke = DCTSIZE2 - 1; ke > 0; ke--)
  ------------------
  |  |   67|  3.60M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (768:29): [True: 153M, False: 2.02M]
  ------------------
  769|   153M|      if ((*block)[jpeg_natural_order[ke]]) break;
  ------------------
  |  Branch (769:11): [True: 1.57M, False: 152M]
  ------------------
  770|       |
  771|       |    /* Figure F.5: Encode_AC_Coefficients */
  772|  55.7M|    for (k = 1; k <= ke; k++) {
  ------------------
  |  Branch (772:17): [True: 52.1M, False: 3.60M]
  ------------------
  773|  52.1M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  774|  52.1M|      arith_encode(cinfo, st, 0);       /* EOB decision */
  775|  74.9M|      while ((v = (*block)[jpeg_natural_order[k]]) == 0) {
  ------------------
  |  Branch (775:14): [True: 22.7M, False: 52.1M]
  ------------------
  776|  22.7M|        arith_encode(cinfo, st + 1, 0);  st += 3;  k++;
  777|  22.7M|      }
  778|  52.1M|      arith_encode(cinfo, st + 1, 1);
  779|       |      /* Figure F.6: Encoding nonzero value v */
  780|       |      /* Figure F.7: Encoding the sign of v */
  781|  52.1M|      if (v > 0) {
  ------------------
  |  Branch (781:11): [True: 25.7M, False: 26.4M]
  ------------------
  782|  25.7M|        arith_encode(cinfo, entropy->fixed_bin, 0);
  783|  26.4M|      } else {
  784|  26.4M|        v = -v;
  785|  26.4M|        arith_encode(cinfo, entropy->fixed_bin, 1);
  786|  26.4M|      }
  787|  52.1M|      st += 2;
  788|       |      /* Figure F.8: Encoding the magnitude category of v */
  789|  52.1M|      m = 0;
  790|  52.1M|      if (v -= 1) {
  ------------------
  |  Branch (790:11): [True: 48.5M, False: 3.65M]
  ------------------
  791|  48.5M|        arith_encode(cinfo, st, 1);
  792|  48.5M|        m = 1;
  793|  48.5M|        v2 = v;
  794|  48.5M|        if (v2 >>= 1) {
  ------------------
  |  Branch (794:13): [True: 45.5M, False: 2.98M]
  ------------------
  795|  45.5M|          arith_encode(cinfo, st, 1);
  796|  45.5M|          m <<= 1;
  797|  45.5M|          st = entropy->ac_stats[tbl] +
  798|  45.5M|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (798:17): [True: 5.52M, False: 40.0M]
  ------------------
  799|   187M|          while (v2 >>= 1) {
  ------------------
  |  Branch (799:18): [True: 142M, False: 45.5M]
  ------------------
  800|   142M|            arith_encode(cinfo, st, 1);
  801|   142M|            m <<= 1;
  802|   142M|            st += 1;
  803|   142M|          }
  804|  45.5M|        }
  805|  48.5M|      }
  806|  52.1M|      arith_encode(cinfo, st, 0);
  807|       |      /* Figure F.9: Encoding the magnitude bit pattern of v */
  808|  52.1M|      st += 14;
  809|   239M|      while (m >>= 1)
  ------------------
  |  Branch (809:14): [True: 187M, False: 52.1M]
  ------------------
  810|   187M|        arith_encode(cinfo, st, (m & v) ? 1 : 0);
  ------------------
  |  Branch (810:33): [True: 85.4M, False: 102M]
  ------------------
  811|  52.1M|    }
  812|       |    /* Encode EOB decision only if k <= DCTSIZE2 - 1 */
  813|  3.60M|    if (k <= DCTSIZE2 - 1) {
  ------------------
  |  |   67|  3.60M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (813:9): [True: 2.93M, False: 673k]
  ------------------
  814|  2.93M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  815|  2.93M|      arith_encode(cinfo, st, 1);
  816|  2.93M|    }
  817|  3.60M|  }
  818|       |
  819|   601k|  return TRUE;
  ------------------
  |  |  210|   601k|#define TRUE    1
  ------------------
  820|   601k|}
jcarith.c:finish_pass:
  140|  7.95M|{
  141|  7.95M|  arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  142|  7.95M|  JLONG temp;
  143|       |
  144|       |  /* Section D.1.8: Termination of encoding */
  145|       |
  146|       |  /* Find the e->c in the coding interval with the largest
  147|       |   * number of trailing zero bits */
  148|  7.95M|  if ((temp = (e->a - 1 + e->c) & 0xFFFF0000UL) < e->c)
  ------------------
  |  Branch (148:7): [True: 5.86M, False: 2.09M]
  ------------------
  149|  5.86M|    e->c = temp + 0x8000L;
  150|  2.09M|  else
  151|  2.09M|    e->c = temp;
  152|       |  /* Send remaining bytes to output */
  153|  7.95M|  e->c <<= e->ct;
  154|  7.95M|  if (e->c & 0xF8000000UL) {
  ------------------
  |  Branch (154:7): [True: 127k, False: 7.83M]
  ------------------
  155|       |    /* One final overflow has to be handled */
  156|   127k|    if (e->buffer >= 0) {
  ------------------
  |  Branch (156:9): [True: 127k, False: 0]
  ------------------
  157|   127k|      if (e->zc)
  ------------------
  |  Branch (157:11): [True: 9.93k, False: 118k]
  ------------------
  158|  10.1k|        do emit_byte(0x00, cinfo);
  159|  10.1k|        while (--e->zc);
  ------------------
  |  Branch (159:16): [True: 257, False: 9.93k]
  ------------------
  160|   127k|      emit_byte(e->buffer + 1, cinfo);
  161|   127k|      if (e->buffer + 1 == 0xFF)
  ------------------
  |  Branch (161:11): [True: 687, False: 127k]
  ------------------
  162|    687|        emit_byte(0x00, cinfo);
  163|   127k|    }
  164|   127k|    e->zc += e->sc;  /* carry-over converts stacked 0xFF bytes to 0x00 */
  165|   127k|    e->sc = 0;
  166|  7.83M|  } else {
  167|  7.83M|    if (e->buffer == 0)
  ------------------
  |  Branch (167:9): [True: 70.8k, False: 7.76M]
  ------------------
  168|  70.8k|      ++e->zc;
  169|  7.76M|    else if (e->buffer >= 0) {
  ------------------
  |  Branch (169:14): [True: 2.26M, False: 5.49M]
  ------------------
  170|  2.26M|      if (e->zc)
  ------------------
  |  Branch (170:11): [True: 9.40k, False: 2.25M]
  ------------------
  171|  11.1k|        do emit_byte(0x00, cinfo);
  172|  11.1k|        while (--e->zc);
  ------------------
  |  Branch (172:16): [True: 1.70k, False: 9.40k]
  ------------------
  173|  2.26M|      emit_byte(e->buffer, cinfo);
  174|  2.26M|    }
  175|  7.83M|    if (e->sc) {
  ------------------
  |  Branch (175:9): [True: 5.70k, False: 7.82M]
  ------------------
  176|  5.70k|      if (e->zc)
  ------------------
  |  Branch (176:11): [True: 75, False: 5.62k]
  ------------------
  177|     88|        do emit_byte(0x00, cinfo);
  178|     88|        while (--e->zc);
  ------------------
  |  Branch (178:16): [True: 13, False: 75]
  ------------------
  179|  5.91k|      do {
  180|  5.91k|        emit_byte(0xFF, cinfo);
  181|  5.91k|        emit_byte(0x00, cinfo);
  182|  5.91k|      } while (--e->sc);
  ------------------
  |  Branch (182:16): [True: 215, False: 5.70k]
  ------------------
  183|  5.70k|    }
  184|  7.83M|  }
  185|       |  /* Output final bytes only if they are not 0x00 */
  186|  7.95M|  if (e->c & 0x7FFF800L) {
  ------------------
  |  Branch (186:7): [True: 7.89M, False: 66.8k]
  ------------------
  187|  7.89M|    if (e->zc)  /* output final pending zero bytes */
  ------------------
  |  Branch (187:9): [True: 69.6k, False: 7.82M]
  ------------------
  188|  82.7k|      do emit_byte(0x00, cinfo);
  189|  82.7k|      while (--e->zc);
  ------------------
  |  Branch (189:14): [True: 13.0k, False: 69.6k]
  ------------------
  190|  7.89M|    emit_byte((e->c >> 19) & 0xFF, cinfo);
  191|  7.89M|    if (((e->c >> 19) & 0xFF) == 0xFF)
  ------------------
  |  Branch (191:9): [True: 4.30k, False: 7.88M]
  ------------------
  192|  4.30k|      emit_byte(0x00, cinfo);
  193|  7.89M|    if (e->c & 0x7F800L) {
  ------------------
  |  Branch (193:9): [True: 458k, False: 7.43M]
  ------------------
  194|   458k|      emit_byte((e->c >> 11) & 0xFF, cinfo);
  195|   458k|      if (((e->c >> 11) & 0xFF) == 0xFF)
  ------------------
  |  Branch (195:11): [True: 0, False: 458k]
  ------------------
  196|      0|        emit_byte(0x00, cinfo);
  197|   458k|    }
  198|  7.89M|  }
  199|  7.95M|}

j12init_c_coef_controller:
  437|  22.3k|{
  438|  22.3k|  my_coef_ptr coef;
  439|       |
  440|  22.3k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  22.3k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (440:7): [True: 0, False: 22.3k]
  ------------------
  441|      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)))
  ------------------
  442|       |
  443|  22.3k|  coef = (my_coef_ptr)
  444|  22.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  22.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  445|  22.3k|                                sizeof(my_coef_controller));
  446|  22.3k|  memset(coef, 0, sizeof(my_coef_controller));
  447|  22.3k|  cinfo->coef = (struct jpeg_c_coef_controller *)coef;
  448|  22.3k|  coef->pub.start_pass = start_pass_coef;
  449|       |
  450|       |  /* Create the coefficient buffer. */
  451|  22.3k|  if (need_full_buffer) {
  ------------------
  |  Branch (451:7): [True: 19.2k, False: 3.07k]
  ------------------
  452|  19.2k|#ifdef FULL_COEF_BUFFER_SUPPORTED
  453|       |    /* Allocate a full-image virtual array for each component, */
  454|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  455|  19.2k|    int ci;
  456|  19.2k|    jpeg_component_info *compptr;
  457|       |
  458|  66.6k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (458:46): [True: 47.3k, False: 19.2k]
  ------------------
  459|  47.3k|         ci++, compptr++) {
  460|  47.3k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  461|  47.3k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|  47.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|  47.3k|#define FALSE   0               /* values of boolean */
  ------------------
  462|  47.3k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  463|  47.3k|                               (long)compptr->h_samp_factor),
  464|  47.3k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  465|  47.3k|                               (long)compptr->v_samp_factor),
  466|  47.3k|         (JDIMENSION)compptr->v_samp_factor);
  467|  47.3k|    }
  468|       |#else
  469|       |    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  470|       |#endif
  471|  19.2k|  } else {
  472|       |    /* We only need a single-MCU buffer. */
  473|  3.07k|    JBLOCKROW buffer;
  474|  3.07k|    int i;
  475|       |
  476|  3.07k|    buffer = (JBLOCKROW)
  477|  3.07k|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.07k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|  3.07k|                                  C_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   80|  3.07k|#define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on data units/MCU */
  ------------------
  479|  33.8k|    for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   80|  33.8k|#define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on data units/MCU */
  ------------------
  |  Branch (479:17): [True: 30.7k, False: 3.07k]
  ------------------
  480|  30.7k|      coef->MCU_buffer[i] = buffer + i;
  481|  30.7k|    }
  482|       |    coef->whole_image[0] = NULL; /* flag for no virtual arrays */
  483|  3.07k|  }
  484|  22.3k|}
jccoefct-12.c:start_pass_coef:
  104|   124k|{
  105|   124k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  106|       |
  107|   124k|  coef->iMCU_row_num = 0;
  108|   124k|  start_iMCU_row(cinfo);
  109|       |
  110|   124k|  switch (pass_mode) {
  111|  3.07k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (111:3): [True: 3.07k, False: 121k]
  ------------------
  112|  3.07k|    if (coef->whole_image[0] != NULL)
  ------------------
  |  Branch (112:9): [True: 0, False: 3.07k]
  ------------------
  113|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  114|  3.07k|    coef->pub._compress_data = compress_data;
  ------------------
  |  |  132|  3.07k|#define _compress_data  compress_data_12
  ------------------
  115|  3.07k|    break;
  116|      0|#ifdef FULL_COEF_BUFFER_SUPPORTED
  117|  19.2k|  case JBUF_SAVE_AND_PASS:
  ------------------
  |  Branch (117:3): [True: 19.2k, False: 105k]
  ------------------
  118|  19.2k|    if (coef->whole_image[0] == NULL)
  ------------------
  |  Branch (118:9): [True: 0, False: 19.2k]
  ------------------
  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|  19.2k|    coef->pub._compress_data = compress_first_pass;
  ------------------
  |  |  132|  19.2k|#define _compress_data  compress_data_12
  ------------------
  121|  19.2k|    break;
  122|   102k|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (122:3): [True: 102k, False: 22.3k]
  ------------------
  123|   102k|    if (coef->whole_image[0] == NULL)
  ------------------
  |  Branch (123:9): [True: 0, False: 102k]
  ------------------
  124|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  125|   102k|    coef->pub._compress_data = compress_output;
  ------------------
  |  |  132|   102k|#define _compress_data  compress_data_12
  ------------------
  126|   102k|    break;
  127|      0|#endif
  128|      0|  default:
  ------------------
  |  Branch (128:3): [True: 0, False: 124k]
  ------------------
  129|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  130|      0|    break;
  131|   124k|  }
  132|   124k|}
jccoefct-12.c:start_iMCU_row:
   77|  15.4M|{
   78|  15.4M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   79|       |
   80|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   81|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   82|       |   * But at the bottom of the image, process only what's left.
   83|       |   */
   84|  15.4M|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (84:7): [True: 4.44M, False: 11.0M]
  ------------------
   85|  4.44M|    coef->MCU_rows_per_iMCU_row = 1;
   86|  11.0M|  } else {
   87|  11.0M|    if (coef->iMCU_row_num < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (87:9): [True: 10.8M, False: 192k]
  ------------------
   88|  10.8M|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   89|   192k|    else
   90|   192k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   91|  11.0M|  }
   92|       |
   93|  15.4M|  coef->mcu_ctr = 0;
   94|  15.4M|  coef->MCU_vert_offset = 0;
   95|  15.4M|}
jccoefct-12.c:compress_data:
  147|   295k|{
  148|   295k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  149|   295k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  150|   295k|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
  151|   295k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  152|   295k|  int blkn, bi, ci, yindex, yoffset, blockcnt;
  153|   295k|  JDIMENSION ypos, xpos;
  154|   295k|  jpeg_component_info *compptr;
  155|       |
  156|       |  /* Loop to write as much as one whole iMCU row */
  157|   591k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (157:41): [True: 295k, False: 295k]
  ------------------
  158|   295k|       yoffset++) {
  159|   896k|    for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (159:39): [True: 601k, False: 295k]
  ------------------
  160|   601k|         MCU_col_num++) {
  161|       |      /* Determine where data comes from in input_buf and do the DCT thing.
  162|       |       * Each call on forward_DCT processes a horizontal row of DCT blocks
  163|       |       * as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks
  164|       |       * sequentially.  Dummy blocks at the right or bottom edge are filled in
  165|       |       * specially.  The data in them does not matter for image reconstruction,
  166|       |       * so we fill them with values that will encode to the smallest amount of
  167|       |       * data, viz: all zeroes in the AC entries, DC entries equal to previous
  168|       |       * block's DC value.  (Thanks to Thomas Kinsman for this idea.)
  169|       |       */
  170|   601k|      blkn = 0;
  171|  2.40M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (171:20): [True: 1.80M, False: 601k]
  ------------------
  172|  1.80M|        compptr = cinfo->cur_comp_info[ci];
  173|  1.80M|        blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width :
  ------------------
  |  Branch (173:20): [True: 917k, False: 886k]
  ------------------
  174|  1.80M|                                                  compptr->last_col_width;
  175|  1.80M|        xpos = MCU_col_num * compptr->MCU_sample_width;
  176|  1.80M|        ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
  ------------------
  |  |   66|  1.80M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  177|  4.20M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (177:26): [True: 2.40M, False: 1.80M]
  ------------------
  178|  2.40M|          if (coef->iMCU_row_num < last_iMCU_row ||
  ------------------
  |  Branch (178:15): [True: 1.35M, False: 1.05M]
  ------------------
  179|  2.20M|              yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (179:15): [True: 851k, False: 202k]
  ------------------
  180|  2.20M|            (*cinfo->fdct->_forward_DCT) (cinfo, compptr,
  ------------------
  |  |  138|  2.20M|#define _forward_DCT  forward_DCT_12
  ------------------
  181|  2.20M|                                          input_buf[compptr->component_index],
  182|  2.20M|                                          coef->MCU_buffer[blkn],
  183|  2.20M|                                          ypos, xpos, (JDIMENSION)blockcnt);
  184|  2.20M|            if (blockcnt < compptr->MCU_width) {
  ------------------
  |  Branch (184:17): [True: 577k, False: 1.62M]
  ------------------
  185|       |              /* Create some dummy blocks at the right edge of the image. */
  186|   577k|              jzero_far((void *)coef->MCU_buffer[blkn + blockcnt],
  187|   577k|                        (compptr->MCU_width - blockcnt) * sizeof(JBLOCK));
  188|  1.15M|              for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
  ------------------
  |  Branch (188:35): [True: 577k, False: 577k]
  ------------------
  189|   577k|                coef->MCU_buffer[blkn + bi][0][0] =
  190|   577k|                  coef->MCU_buffer[blkn + bi - 1][0][0];
  191|   577k|              }
  192|   577k|            }
  193|  2.20M|          } else {
  194|       |            /* Create a row of dummy blocks at the bottom of the image. */
  195|   202k|            jzero_far((void *)coef->MCU_buffer[blkn],
  196|   202k|                      compptr->MCU_width * sizeof(JBLOCK));
  197|   607k|            for (bi = 0; bi < compptr->MCU_width; bi++) {
  ------------------
  |  Branch (197:26): [True: 404k, False: 202k]
  ------------------
  198|   404k|              coef->MCU_buffer[blkn + bi][0][0] =
  199|   404k|                coef->MCU_buffer[blkn - 1][0][0];
  200|   404k|            }
  201|   202k|          }
  202|  2.40M|          blkn += compptr->MCU_width;
  203|  2.40M|          ypos += DCTSIZE;
  ------------------
  |  |   66|  2.40M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  204|  2.40M|        }
  205|  1.80M|      }
  206|       |      /* Try to write the MCU.  In event of a suspension failure, we will
  207|       |       * re-DCT the MCU on restart (a bit inefficient, could be fixed...)
  208|       |       */
  209|       |#ifdef WITH_PROFILE
  210|       |      cinfo->master->start = getTime();
  211|       |#endif
  212|   601k|      if (!(*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (212:11): [True: 0, False: 601k]
  ------------------
  213|       |        /* Suspension forced; update state counters and exit */
  214|      0|        coef->MCU_vert_offset = yoffset;
  215|      0|        coef->mcu_ctr = MCU_col_num;
  216|       |#ifdef WITH_PROFILE
  217|       |        cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  218|       |        cinfo->master->entropy_mcoeffs +=
  219|       |          (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  220|       |#endif
  221|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  222|      0|      }
  223|       |#ifdef WITH_PROFILE
  224|       |      cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  225|       |      cinfo->master->entropy_mcoeffs +=
  226|       |        (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  227|       |#endif
  228|   601k|    }
  229|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  230|   295k|    coef->mcu_ctr = 0;
  231|   295k|  }
  232|       |  /* Completed the iMCU row, advance counters for next one */
  233|   295k|  coef->iMCU_row_num++;
  234|   295k|  start_iMCU_row(cinfo);
  235|   295k|  return TRUE;
  ------------------
  |  |  210|   295k|#define TRUE    1
  ------------------
  236|   295k|}
jccoefct-12.c:compress_first_pass:
  264|  3.10M|{
  265|  3.10M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  266|  3.10M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  267|  3.10M|  JDIMENSION blocks_across, MCUs_across, MCUindex;
  268|  3.10M|  int bi, ci, h_samp_factor, block_row, block_rows, ndummy;
  269|  3.10M|  JCOEF lastDC;
  270|  3.10M|  jpeg_component_info *compptr;
  271|  3.10M|  JBLOCKARRAY buffer;
  272|  3.10M|  JBLOCKROW thisblockrow, lastblockrow;
  273|       |
  274|  10.6M|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (274:44): [True: 7.52M, False: 3.10M]
  ------------------
  275|  7.52M|       ci++, compptr++) {
  276|       |    /* Align the virtual buffer for this component. */
  277|  7.52M|    buffer = (*cinfo->mem->access_virt_barray)
  278|  7.52M|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  279|  7.52M|       coef->iMCU_row_num * compptr->v_samp_factor,
  280|  7.52M|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  7.52M|#define TRUE    1
  ------------------
  281|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  282|  7.52M|    if (coef->iMCU_row_num < last_iMCU_row)
  ------------------
  |  Branch (282:9): [True: 7.47M, False: 47.3k]
  ------------------
  283|  7.47M|      block_rows = compptr->v_samp_factor;
  284|  47.3k|    else {
  285|       |      /* NB: can't use last_row_height here, since may not be set! */
  286|  47.3k|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  287|  47.3k|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (287:11): [True: 42.2k, False: 5.07k]
  ------------------
  288|  47.3k|    }
  289|  7.52M|    blocks_across = compptr->width_in_blocks;
  290|  7.52M|    h_samp_factor = compptr->h_samp_factor;
  291|       |    /* Count number of dummy blocks to be added at the right margin. */
  292|  7.52M|    ndummy = (int)(blocks_across % h_samp_factor);
  293|  7.52M|    if (ndummy > 0)
  ------------------
  |  Branch (293:9): [True: 1.16M, False: 6.36M]
  ------------------
  294|  1.16M|      ndummy = h_samp_factor - ndummy;
  295|       |    /* Perform DCT for all non-dummy blocks in this iMCU row.  Each call
  296|       |     * on forward_DCT processes a complete horizontal row of DCT blocks.
  297|       |     */
  298|  15.6M|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (298:25): [True: 8.11M, False: 7.52M]
  ------------------
  299|  8.11M|      thisblockrow = buffer[block_row];
  300|  8.11M|      (*cinfo->fdct->_forward_DCT) (cinfo, compptr,
  ------------------
  |  |  138|  8.11M|#define _forward_DCT  forward_DCT_12
  ------------------
  301|  8.11M|                                    input_buf[ci], thisblockrow,
  302|  8.11M|                                    (JDIMENSION)(block_row * DCTSIZE),
  ------------------
  |  |   66|  8.11M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  303|  8.11M|                                    (JDIMENSION)0, blocks_across);
  304|  8.11M|      if (ndummy > 0) {
  ------------------
  |  Branch (304:11): [True: 1.16M, False: 6.95M]
  ------------------
  305|       |        /* Create dummy blocks at the right edge of the image. */
  306|  1.16M|        thisblockrow += blocks_across; /* => first dummy block */
  307|  1.16M|        jzero_far((void *)thisblockrow, ndummy * sizeof(JBLOCK));
  308|  1.16M|        lastDC = thisblockrow[-1][0];
  309|  3.48M|        for (bi = 0; bi < ndummy; bi++) {
  ------------------
  |  Branch (309:22): [True: 2.31M, False: 1.16M]
  ------------------
  310|  2.31M|          thisblockrow[bi][0] = lastDC;
  311|  2.31M|        }
  312|  1.16M|      }
  313|  8.11M|    }
  314|       |    /* If at end of image, create dummy block rows as needed.
  315|       |     * The tricky part here is that within each MCU, we want the DC values
  316|       |     * of the dummy blocks to match the last real block's DC value.
  317|       |     * This squeezes a few more bytes out of the resulting file...
  318|       |     */
  319|  7.52M|    if (coef->iMCU_row_num == last_iMCU_row) {
  ------------------
  |  Branch (319:9): [True: 47.3k, False: 7.47M]
  ------------------
  320|  47.3k|      blocks_across += ndummy;  /* include lower right corner */
  321|  47.3k|      MCUs_across = blocks_across / h_samp_factor;
  322|  52.3k|      for (block_row = block_rows; block_row < compptr->v_samp_factor;
  ------------------
  |  Branch (322:36): [True: 5.07k, False: 47.3k]
  ------------------
  323|  47.3k|           block_row++) {
  324|  5.07k|        thisblockrow = buffer[block_row];
  325|  5.07k|        lastblockrow = buffer[block_row - 1];
  326|  5.07k|        jzero_far((void *)thisblockrow,
  327|  5.07k|                  (size_t)(blocks_across * sizeof(JBLOCK)));
  328|   810k|        for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
  ------------------
  |  Branch (328:28): [True: 805k, False: 5.07k]
  ------------------
  329|   805k|          lastDC = lastblockrow[h_samp_factor - 1][0];
  330|  1.61M|          for (bi = 0; bi < h_samp_factor; bi++) {
  ------------------
  |  Branch (330:24): [True: 805k, False: 805k]
  ------------------
  331|   805k|            thisblockrow[bi][0] = lastDC;
  332|   805k|          }
  333|   805k|          thisblockrow += h_samp_factor; /* advance to next MCU in row */
  334|   805k|          lastblockrow += h_samp_factor;
  335|   805k|        }
  336|  5.07k|      }
  337|  47.3k|    }
  338|  7.52M|  }
  339|       |  /* NB: compress_output will increment iMCU_row_num if successful.
  340|       |   * A suspension return will result in redoing all the work above next time.
  341|       |   */
  342|       |
  343|       |  /* Emit data to the entropy encoder, sharing code with subsequent passes */
  344|  3.10M|  return compress_output(cinfo, input_buf);
  345|  3.10M|}
jccoefct-12.c:compress_output:
  360|  15.0M|{
  361|  15.0M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  362|  15.0M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  363|  15.0M|  int blkn, ci, xindex, yindex, yoffset;
  364|  15.0M|  JDIMENSION start_col;
  365|  15.0M|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  366|  15.0M|  JBLOCKROW buffer_ptr;
  367|  15.0M|  jpeg_component_info *compptr;
  368|       |
  369|       |  /* Align the virtual buffers for the components used in this scan.
  370|       |   * NB: during first pass, this is safe only because the buffers will
  371|       |   * already be aligned properly, so jmemmgr.c won't need to do any I/O.
  372|       |   */
  373|  38.9M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (373:16): [True: 23.9M, False: 15.0M]
  ------------------
  374|  23.9M|    compptr = cinfo->cur_comp_info[ci];
  375|  23.9M|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  376|  23.9M|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  377|  23.9M|       coef->iMCU_row_num * compptr->v_samp_factor,
  378|  23.9M|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  23.9M|#define FALSE   0               /* values of boolean */
  ------------------
  379|  23.9M|  }
  380|       |
  381|       |  /* Loop to process one whole iMCU row */
  382|  32.4M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (382:41): [True: 17.4M, False: 15.0M]
  ------------------
  383|  17.4M|       yoffset++) {
  384|  59.0M|    for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (384:39): [True: 41.6M, False: 17.4M]
  ------------------
  385|  41.6M|         MCU_col_num++) {
  386|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  387|  41.6M|      blkn = 0;                 /* index of current DCT block within MCU */
  388|   101M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (388:20): [True: 59.9M, False: 41.6M]
  ------------------
  389|  59.9M|        compptr = cinfo->cur_comp_info[ci];
  390|  59.9M|        start_col = MCU_col_num * compptr->MCU_width;
  391|   123M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (391:26): [True: 63.6M, False: 59.9M]
  ------------------
  392|  63.6M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  393|   134M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (393:28): [True: 70.3M, False: 63.6M]
  ------------------
  394|  70.3M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  395|  70.3M|          }
  396|  63.6M|        }
  397|  59.9M|      }
  398|       |      /* Try to write the MCU. */
  399|       |#ifdef WITH_PROFILE
  400|       |      cinfo->master->start = getTime();
  401|       |#endif
  402|  41.6M|      if (!(*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (402:11): [True: 0, False: 41.6M]
  ------------------
  403|       |        /* Suspension forced; update state counters and exit */
  404|      0|        coef->MCU_vert_offset = yoffset;
  405|      0|        coef->mcu_ctr = MCU_col_num;
  406|       |#ifdef WITH_PROFILE
  407|       |        cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  408|       |        cinfo->master->entropy_mcoeffs +=
  409|       |          (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  410|       |#endif
  411|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  412|      0|      }
  413|       |#ifdef WITH_PROFILE
  414|       |      cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  415|       |      cinfo->master->entropy_mcoeffs +=
  416|       |        (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  417|       |#endif
  418|  41.6M|    }
  419|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  420|  17.4M|    coef->mcu_ctr = 0;
  421|  17.4M|  }
  422|       |  /* Completed the iMCU row, advance counters for next one */
  423|  15.0M|  coef->iMCU_row_num++;
  424|  15.0M|  start_iMCU_row(cinfo);
  425|  15.0M|  return TRUE;
  ------------------
  |  |  210|  15.0M|#define TRUE    1
  ------------------
  426|  15.0M|}

jccolor-12.c:extxrgb_gray_convert:
   91|  4.69M|{
   92|  4.69M|#if BITS_IN_JSAMPLE != 16
   93|  4.69M|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
   94|  4.69M|  register int r, g, b;
   95|  4.69M|  register JLONG *ctab = cconvert->rgb_ycc_tab;
   96|  4.69M|  register _JSAMPROW inptr;
   97|  4.69M|  register _JSAMPROW outptr;
   98|  4.69M|  register JDIMENSION col;
   99|  4.69M|  JDIMENSION num_cols = cinfo->image_width;
  100|       |
  101|  9.39M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (101:10): [True: 4.69M, False: 4.69M]
  ------------------
  102|  4.69M|    inptr = *input_buf++;
  103|  4.69M|    outptr = output_buf[0][output_row];
  104|  4.69M|    output_row++;
  105|  40.7M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (105:19): [True: 36.0M, False: 4.69M]
  ------------------
  106|  36.0M|      r = RANGE_LIMIT(inptr[RGB_RED]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
  107|  36.0M|      g = RANGE_LIMIT(inptr[RGB_GREEN]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
  108|  36.0M|      b = RANGE_LIMIT(inptr[RGB_BLUE]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
  109|  36.0M|      inptr += RGB_PIXELSIZE;
  ------------------
  |  |  196|  36.0M|#define RGB_PIXELSIZE  EXT_XRGB_PIXELSIZE
  |  |  ------------------
  |  |  |  |  334|  36.0M|#define EXT_XRGB_PIXELSIZE  4
  |  |  ------------------
  ------------------
  110|       |      /* Y */
  111|  36.0M|      outptr[col] = (_JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
  ------------------
  |  |   81|  36.0M|#define R_Y_OFF         0                       /* offset to R => Y section */
  ------------------
                    outptr[col] = (_JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
  ------------------
  |  |   82|  36.0M|#define G_Y_OFF         (1 * (_MAXJSAMPLE + 1)) /* offset to G => Y section */
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  112|  36.0M|                                ctab[b + B_Y_OFF]) >> SCALEBITS);
  ------------------
  |  |   83|  36.0M|#define B_Y_OFF         (2 * (_MAXJSAMPLE + 1)) /* etc. */
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                              ctab[b + B_Y_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
  113|  36.0M|    }
  114|  4.69M|  }
  115|       |#else
  116|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  117|       |#endif
  118|  4.69M|}
jccolor-12.c:extrgbx_rgb_convert:
  130|  2.35M|{
  131|  2.35M|  register _JSAMPROW inptr;
  132|  2.35M|  register _JSAMPROW outptr0, outptr1, outptr2;
  133|  2.35M|  register JDIMENSION col;
  134|  2.35M|  JDIMENSION num_cols = cinfo->image_width;
  135|       |
  136|  7.05M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (136:10): [True: 4.69M, False: 2.35M]
  ------------------
  137|  4.69M|    inptr = *input_buf++;
  138|  4.69M|    outptr0 = output_buf[0][output_row];
  139|  4.69M|    outptr1 = output_buf[1][output_row];
  140|  4.69M|    outptr2 = output_buf[2][output_row];
  141|  4.69M|    output_row++;
  142|  40.7M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (142:19): [True: 36.0M, False: 4.69M]
  ------------------
  143|  36.0M|      outptr0[col] = inptr[RGB_RED];
  ------------------
  |  |  129|  36.0M|#define RGB_RED  EXT_RGBX_RED
  |  |  ------------------
  |  |  |  |  311|  36.0M|#define EXT_RGBX_RED        0
  |  |  ------------------
  ------------------
  144|  36.0M|      outptr1[col] = inptr[RGB_GREEN];
  ------------------
  |  |  130|  36.0M|#define RGB_GREEN  EXT_RGBX_GREEN
  |  |  ------------------
  |  |  |  |  312|  36.0M|#define EXT_RGBX_GREEN      1
  |  |  ------------------
  ------------------
  145|  36.0M|      outptr2[col] = inptr[RGB_BLUE];
  ------------------
  |  |  131|  36.0M|#define RGB_BLUE  EXT_RGBX_BLUE
  |  |  ------------------
  |  |  |  |  313|  36.0M|#define EXT_RGBX_BLUE       2
  |  |  ------------------
  ------------------
  146|  36.0M|      inptr += RGB_PIXELSIZE;
  ------------------
  |  |  132|  36.0M|#define RGB_PIXELSIZE  EXT_RGBX_PIXELSIZE
  |  |  ------------------
  |  |  |  |  314|  36.0M|#define EXT_RGBX_PIXELSIZE  4
  |  |  ------------------
  ------------------
  147|  36.0M|    }
  148|  4.69M|  }
  149|  2.35M|}
jccolor-12.c:extrgb_ycc_convert:
   34|  4.70M|{
   35|  4.70M|#if BITS_IN_JSAMPLE != 16
   36|  4.70M|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
   37|  4.70M|  register int r, g, b;
   38|  4.70M|  register JLONG *ctab = cconvert->rgb_ycc_tab;
   39|  4.70M|  register _JSAMPROW inptr;
   40|  4.70M|  register _JSAMPROW outptr0, outptr1, outptr2;
   41|  4.70M|  register JDIMENSION col;
   42|  4.70M|  JDIMENSION num_cols = cinfo->image_width;
   43|       |
   44|  9.40M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (44:10): [True: 4.70M, False: 4.70M]
  ------------------
   45|  4.70M|    inptr = *input_buf++;
   46|  4.70M|    outptr0 = output_buf[0][output_row];
   47|  4.70M|    outptr1 = output_buf[1][output_row];
   48|  4.70M|    outptr2 = output_buf[2][output_row];
   49|  4.70M|    output_row++;
   50|  40.7M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (50:19): [True: 36.0M, False: 4.70M]
  ------------------
   51|  36.0M|      r = RANGE_LIMIT(inptr[RGB_RED]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
   52|  36.0M|      g = RANGE_LIMIT(inptr[RGB_GREEN]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
   53|  36.0M|      b = RANGE_LIMIT(inptr[RGB_BLUE]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
   54|  36.0M|      inptr += RGB_PIXELSIZE;
  ------------------
  |  |  116|  36.0M|#define RGB_PIXELSIZE  EXT_RGB_PIXELSIZE
  |  |  ------------------
  |  |  |  |  309|  36.0M|#define EXT_RGB_PIXELSIZE   3
  |  |  ------------------
  ------------------
   55|       |      /* If the inputs are 0.._MAXJSAMPLE, the outputs of these equations
   56|       |       * must be too; we do not need an explicit range-limiting operation.
   57|       |       * Hence the value being shifted is never negative, and we don't
   58|       |       * need the general RIGHT_SHIFT macro.
   59|       |       */
   60|       |      /* Y */
   61|  36.0M|      outptr0[col] = (_JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
  ------------------
  |  |   81|  36.0M|#define R_Y_OFF         0                       /* offset to R => Y section */
  ------------------
                    outptr0[col] = (_JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
  ------------------
  |  |   82|  36.0M|#define G_Y_OFF         (1 * (_MAXJSAMPLE + 1)) /* offset to G => Y section */
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   62|  36.0M|                                 ctab[b + B_Y_OFF]) >> SCALEBITS);
  ------------------
  |  |   83|  36.0M|#define B_Y_OFF         (2 * (_MAXJSAMPLE + 1)) /* etc. */
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_Y_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
   63|       |      /* Cb */
   64|  36.0M|      outptr1[col] = (_JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
  ------------------
  |  |   84|  36.0M|#define R_CB_OFF        (3 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                    outptr1[col] = (_JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
  ------------------
  |  |   85|  36.0M|#define G_CB_OFF        (4 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   65|  36.0M|                                 ctab[b + B_CB_OFF]) >> SCALEBITS);
  ------------------
  |  |   86|  36.0M|#define B_CB_OFF        (5 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_CB_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
   66|       |      /* Cr */
   67|  36.0M|      outptr2[col] = (_JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
  ------------------
  |  |   87|  36.0M|#define R_CR_OFF        B_CB_OFF                /* B=>Cb, R=>Cr are the same */
  |  |  ------------------
  |  |  |  |   86|  36.0M|#define B_CB_OFF        (5 * (_MAXJSAMPLE + 1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                    outptr2[col] = (_JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
  ------------------
  |  |   88|  36.0M|#define G_CR_OFF        (6 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   68|  36.0M|                                 ctab[b + B_CR_OFF]) >> SCALEBITS);
  ------------------
  |  |   89|  36.0M|#define B_CR_OFF        (7 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_CR_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
   69|  36.0M|    }
   70|  4.70M|  }
   71|       |#else
   72|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
   73|       |#endif
   74|  4.70M|}
jccolor-12.c:extbgr_ycc_convert:
   34|  4.70M|{
   35|  4.70M|#if BITS_IN_JSAMPLE != 16
   36|  4.70M|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
   37|  4.70M|  register int r, g, b;
   38|  4.70M|  register JLONG *ctab = cconvert->rgb_ycc_tab;
   39|  4.70M|  register _JSAMPROW inptr;
   40|  4.70M|  register _JSAMPROW outptr0, outptr1, outptr2;
   41|  4.70M|  register JDIMENSION col;
   42|  4.70M|  JDIMENSION num_cols = cinfo->image_width;
   43|       |
   44|  9.40M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (44:10): [True: 4.70M, False: 4.70M]
  ------------------
   45|  4.70M|    inptr = *input_buf++;
   46|  4.70M|    outptr0 = output_buf[0][output_row];
   47|  4.70M|    outptr1 = output_buf[1][output_row];
   48|  4.70M|    outptr2 = output_buf[2][output_row];
   49|  4.70M|    output_row++;
   50|  40.7M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (50:19): [True: 36.0M, False: 4.70M]
  ------------------
   51|  36.0M|      r = RANGE_LIMIT(inptr[RGB_RED]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
   52|  36.0M|      g = RANGE_LIMIT(inptr[RGB_GREEN]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
   53|  36.0M|      b = RANGE_LIMIT(inptr[RGB_BLUE]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
   54|  36.0M|      inptr += RGB_PIXELSIZE;
  ------------------
  |  |  148|  36.0M|#define RGB_PIXELSIZE  EXT_BGR_PIXELSIZE
  |  |  ------------------
  |  |  |  |  319|  36.0M|#define EXT_BGR_PIXELSIZE   3
  |  |  ------------------
  ------------------
   55|       |      /* If the inputs are 0.._MAXJSAMPLE, the outputs of these equations
   56|       |       * must be too; we do not need an explicit range-limiting operation.
   57|       |       * Hence the value being shifted is never negative, and we don't
   58|       |       * need the general RIGHT_SHIFT macro.
   59|       |       */
   60|       |      /* Y */
   61|  36.0M|      outptr0[col] = (_JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
  ------------------
  |  |   81|  36.0M|#define R_Y_OFF         0                       /* offset to R => Y section */
  ------------------
                    outptr0[col] = (_JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
  ------------------
  |  |   82|  36.0M|#define G_Y_OFF         (1 * (_MAXJSAMPLE + 1)) /* offset to G => Y section */
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   62|  36.0M|                                 ctab[b + B_Y_OFF]) >> SCALEBITS);
  ------------------
  |  |   83|  36.0M|#define B_Y_OFF         (2 * (_MAXJSAMPLE + 1)) /* etc. */
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_Y_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
   63|       |      /* Cb */
   64|  36.0M|      outptr1[col] = (_JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
  ------------------
  |  |   84|  36.0M|#define R_CB_OFF        (3 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                    outptr1[col] = (_JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
  ------------------
  |  |   85|  36.0M|#define G_CB_OFF        (4 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   65|  36.0M|                                 ctab[b + B_CB_OFF]) >> SCALEBITS);
  ------------------
  |  |   86|  36.0M|#define B_CB_OFF        (5 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_CB_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
   66|       |      /* Cr */
   67|  36.0M|      outptr2[col] = (_JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
  ------------------
  |  |   87|  36.0M|#define R_CR_OFF        B_CB_OFF                /* B=>Cb, R=>Cr are the same */
  |  |  ------------------
  |  |  |  |   86|  36.0M|#define B_CB_OFF        (5 * (_MAXJSAMPLE + 1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                    outptr2[col] = (_JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
  ------------------
  |  |   88|  36.0M|#define G_CR_OFF        (6 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   68|  36.0M|                                 ctab[b + B_CR_OFF]) >> SCALEBITS);
  ------------------
  |  |   89|  36.0M|#define B_CR_OFF        (7 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_CR_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
   69|  36.0M|    }
   70|  4.70M|  }
   71|       |#else
   72|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
   73|       |#endif
   74|  4.70M|}
jccolor-12.c:extbgrx_ycc_convert:
   34|  4.69M|{
   35|  4.69M|#if BITS_IN_JSAMPLE != 16
   36|  4.69M|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
   37|  4.69M|  register int r, g, b;
   38|  4.69M|  register JLONG *ctab = cconvert->rgb_ycc_tab;
   39|  4.69M|  register _JSAMPROW inptr;
   40|  4.69M|  register _JSAMPROW outptr0, outptr1, outptr2;
   41|  4.69M|  register JDIMENSION col;
   42|  4.69M|  JDIMENSION num_cols = cinfo->image_width;
   43|       |
   44|  9.39M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (44:10): [True: 4.69M, False: 4.69M]
  ------------------
   45|  4.69M|    inptr = *input_buf++;
   46|  4.69M|    outptr0 = output_buf[0][output_row];
   47|  4.69M|    outptr1 = output_buf[1][output_row];
   48|  4.69M|    outptr2 = output_buf[2][output_row];
   49|  4.69M|    output_row++;
   50|  40.7M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (50:19): [True: 36.0M, False: 4.69M]
  ------------------
   51|  36.0M|      r = RANGE_LIMIT(inptr[RGB_RED]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
   52|  36.0M|      g = RANGE_LIMIT(inptr[RGB_GREEN]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
   53|  36.0M|      b = RANGE_LIMIT(inptr[RGB_BLUE]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
   54|  36.0M|      inptr += RGB_PIXELSIZE;
  ------------------
  |  |  164|  36.0M|#define RGB_PIXELSIZE  EXT_BGRX_PIXELSIZE
  |  |  ------------------
  |  |  |  |  324|  36.0M|#define EXT_BGRX_PIXELSIZE  4
  |  |  ------------------
  ------------------
   55|       |      /* If the inputs are 0.._MAXJSAMPLE, the outputs of these equations
   56|       |       * must be too; we do not need an explicit range-limiting operation.
   57|       |       * Hence the value being shifted is never negative, and we don't
   58|       |       * need the general RIGHT_SHIFT macro.
   59|       |       */
   60|       |      /* Y */
   61|  36.0M|      outptr0[col] = (_JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
  ------------------
  |  |   81|  36.0M|#define R_Y_OFF         0                       /* offset to R => Y section */
  ------------------
                    outptr0[col] = (_JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
  ------------------
  |  |   82|  36.0M|#define G_Y_OFF         (1 * (_MAXJSAMPLE + 1)) /* offset to G => Y section */
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   62|  36.0M|                                 ctab[b + B_Y_OFF]) >> SCALEBITS);
  ------------------
  |  |   83|  36.0M|#define B_Y_OFF         (2 * (_MAXJSAMPLE + 1)) /* etc. */
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_Y_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
   63|       |      /* Cb */
   64|  36.0M|      outptr1[col] = (_JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
  ------------------
  |  |   84|  36.0M|#define R_CB_OFF        (3 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                    outptr1[col] = (_JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
  ------------------
  |  |   85|  36.0M|#define G_CB_OFF        (4 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   65|  36.0M|                                 ctab[b + B_CB_OFF]) >> SCALEBITS);
  ------------------
  |  |   86|  36.0M|#define B_CB_OFF        (5 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_CB_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
   66|       |      /* Cr */
   67|  36.0M|      outptr2[col] = (_JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
  ------------------
  |  |   87|  36.0M|#define R_CR_OFF        B_CB_OFF                /* B=>Cb, R=>Cr are the same */
  |  |  ------------------
  |  |  |  |   86|  36.0M|#define B_CB_OFF        (5 * (_MAXJSAMPLE + 1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                    outptr2[col] = (_JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
  ------------------
  |  |   88|  36.0M|#define G_CR_OFF        (6 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   68|  36.0M|                                 ctab[b + B_CR_OFF]) >> SCALEBITS);
  ------------------
  |  |   89|  36.0M|#define B_CR_OFF        (7 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_CR_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
   69|  36.0M|    }
   70|  4.69M|  }
   71|       |#else
   72|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
   73|       |#endif
   74|  4.69M|}

j12init_color_converter:
  418|  22.3k|{
  419|  22.3k|  my_cconvert_ptr cconvert;
  420|       |
  421|  22.3k|#ifdef C_LOSSLESS_SUPPORTED
  422|  22.3k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (422:7): [True: 0, False: 22.3k]
  ------------------
  423|       |#if BITS_IN_JSAMPLE == 8
  424|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  425|       |#else
  426|      0|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (426:9): [True: 0, False: 0]
  ------------------
  427|      0|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (427:9): [True: 0, False: 0]
  ------------------
  428|      0|#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|      0|  } else
  431|  22.3k|#endif
  432|  22.3k|  {
  433|  22.3k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  22.3k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (433:9): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  }
  436|       |
  437|  22.3k|  cconvert = (my_cconvert_ptr)
  438|  22.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  22.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  439|  22.3k|                                sizeof(my_color_converter));
  440|  22.3k|  cinfo->cconvert = (struct jpeg_color_converter *)cconvert;
  441|       |  /* set start_pass to null method until we find out differently */
  442|  22.3k|  cconvert->pub.start_pass = null_method;
  443|       |
  444|       |  /* Make sure input_components agrees with in_color_space */
  445|  22.3k|  switch (cinfo->in_color_space) {
  446|  3.73k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (446:3): [True: 3.73k, False: 18.6k]
  ------------------
  447|  3.73k|    if (cinfo->input_components != 1)
  ------------------
  |  Branch (447:9): [True: 0, False: 3.73k]
  ------------------
  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|  3.73k|    break;
  450|       |
  451|      0|  case JCS_RGB:
  ------------------
  |  Branch (451:3): [True: 0, False: 22.3k]
  ------------------
  452|  3.16k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (452:3): [True: 3.16k, False: 19.2k]
  ------------------
  453|  6.24k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (453:3): [True: 3.07k, False: 19.2k]
  ------------------
  454|  9.40k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (454:3): [True: 3.16k, False: 19.2k]
  ------------------
  455|  9.40k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (455:3): [True: 0, False: 22.3k]
  ------------------
  456|  9.40k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (456:3): [True: 0, False: 22.3k]
  ------------------
  457|  12.4k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (457:3): [True: 3.07k, False: 19.2k]
  ------------------
  458|  12.4k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (458:3): [True: 0, False: 22.3k]
  ------------------
  459|  15.5k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (459:3): [True: 3.07k, False: 19.2k]
  ------------------
  460|  15.5k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (460:3): [True: 0, False: 22.3k]
  ------------------
  461|  15.5k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (461:3): [True: 0, False: 22.3k]
  ------------------
  462|  15.5k|    if (cinfo->input_components != rgb_pixelsize[cinfo->in_color_space])
  ------------------
  |  Branch (462:9): [True: 0, False: 15.5k]
  ------------------
  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|  15.5k|    break;
  465|       |
  466|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (466:3): [True: 0, False: 22.3k]
  ------------------
  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|  3.07k|  case JCS_CMYK:
  ------------------
  |  Branch (471:3): [True: 3.07k, False: 19.2k]
  ------------------
  472|  3.07k|  case JCS_YCCK:
  ------------------
  |  Branch (472:3): [True: 0, False: 22.3k]
  ------------------
  473|  3.07k|    if (cinfo->input_components != 4)
  ------------------
  |  Branch (473:9): [True: 0, False: 3.07k]
  ------------------
  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|  3.07k|    break;
  476|       |
  477|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (477:3): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  }
  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|  22.3k|  switch (cinfo->jpeg_color_space) {
  488|  6.80k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (488:3): [True: 6.80k, False: 15.5k]
  ------------------
  489|  6.80k|#ifdef C_LOSSLESS_SUPPORTED
  490|  6.80k|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (490:9): [True: 0, False: 6.80k]
  ------------------
  491|      0|        cinfo->in_color_space != cinfo->jpeg_color_space)
  ------------------
  |  Branch (491:9): [True: 0, False: 0]
  ------------------
  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|  6.80k|#endif
  494|  6.80k|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (494:9): [True: 0, False: 6.80k]
  ------------------
  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|  6.80k|    if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (496:9): [True: 3.73k, False: 3.07k]
  ------------------
  497|  3.73k|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  151|  3.73k|#define _color_convert  color_convert_12
  ------------------
  498|  3.07k|    else if (IsExtRGB(cinfo->in_color_space)) {
  ------------------
  |  |   78|  3.07k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 3.07k]
  |  |  |  Branch (78:22): [True: 3.07k, False: 0]
  |  |  |  Branch (78:43): [True: 3.07k, False: 0]
  |  |  ------------------
  ------------------
  499|       |#ifdef WITH_SIMD
  500|       |      if (jsimd_set_rgb_gray(cinfo))
  501|       |        cconvert->pub._color_convert = jsimd_color_convert;
  502|       |      else
  503|       |#endif
  504|  3.07k|      {
  505|  3.07k|        cconvert->pub.start_pass = rgb_ycc_start;
  506|  3.07k|        switch (cinfo->in_color_space) {
  507|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (507:9): [True: 0, False: 3.07k]
  ------------------
  508|      0|          cconvert->pub._color_convert = extrgb_gray_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  509|      0|          break;
  510|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (510:9): [True: 0, False: 3.07k]
  ------------------
  511|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (511:9): [True: 0, False: 3.07k]
  ------------------
  512|      0|          cconvert->pub._color_convert = extrgbx_gray_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  513|      0|          break;
  514|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (514:9): [True: 0, False: 3.07k]
  ------------------
  515|      0|          cconvert->pub._color_convert = extbgr_gray_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  516|      0|          break;
  517|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (517:9): [True: 0, False: 3.07k]
  ------------------
  518|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (518:9): [True: 0, False: 3.07k]
  ------------------
  519|      0|          cconvert->pub._color_convert = extbgrx_gray_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  520|      0|          break;
  521|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (521:9): [True: 0, False: 3.07k]
  ------------------
  522|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (522:9): [True: 0, False: 3.07k]
  ------------------
  523|      0|          cconvert->pub._color_convert = extxbgr_gray_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  524|      0|          break;
  525|  3.07k|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (525:9): [True: 3.07k, False: 0]
  ------------------
  526|  3.07k|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (526:9): [True: 0, False: 3.07k]
  ------------------
  527|  3.07k|          cconvert->pub._color_convert = extxrgb_gray_convert;
  ------------------
  |  |  151|  3.07k|#define _color_convert  color_convert_12
  ------------------
  528|  3.07k|          break;
  529|      0|        default:
  ------------------
  |  Branch (529:9): [True: 0, False: 3.07k]
  ------------------
  530|      0|          cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  531|  3.07k|        }
  532|  3.07k|      }
  533|  3.07k|    } else if (cinfo->in_color_space == JCS_YCbCr)
  ------------------
  |  Branch (533:16): [True: 0, False: 0]
  ------------------
  534|      0|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  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|  6.80k|    break;
  538|       |
  539|  6.80k|  case JCS_RGB:
  ------------------
  |  Branch (539:3): [True: 3.07k, False: 19.2k]
  ------------------
  540|  3.07k|#ifdef C_LOSSLESS_SUPPORTED
  541|  3.07k|    if (cinfo->master->lossless && !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]
  |  |  ------------------
  ------------------
  |  Branch (541:9): [True: 0, False: 3.07k]
  ------------------
  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|  3.07k|#endif
  544|  3.07k|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (544:9): [True: 0, False: 3.07k]
  ------------------
  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|  3.07k|    if (rgb_red[cinfo->in_color_space] == 0 &&
  ------------------
  |  Branch (546:9): [True: 3.07k, False: 0]
  ------------------
  547|  3.07k|        rgb_green[cinfo->in_color_space] == 1 &&
  ------------------
  |  Branch (547:9): [True: 3.07k, False: 0]
  ------------------
  548|  3.07k|        rgb_blue[cinfo->in_color_space] == 2 &&
  ------------------
  |  Branch (548:9): [True: 3.07k, False: 0]
  ------------------
  549|  3.07k|        rgb_pixelsize[cinfo->in_color_space] == 3) {
  ------------------
  |  Branch (549:9): [True: 0, False: 3.07k]
  ------------------
  550|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  551|  3.07k|    } else if (IsExtRGB(cinfo->in_color_space)) {
  ------------------
  |  |   78|  3.07k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 3.07k]
  |  |  |  Branch (78:22): [True: 3.07k, False: 0]
  |  |  |  Branch (78:43): [True: 3.07k, False: 0]
  |  |  ------------------
  ------------------
  552|  3.07k|      switch (cinfo->in_color_space) {
  553|      0|      case JCS_EXT_RGB:
  ------------------
  |  Branch (553:7): [True: 0, False: 3.07k]
  ------------------
  554|      0|        cconvert->pub._color_convert = extrgb_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  555|      0|        break;
  556|  3.07k|      case JCS_EXT_RGBX:
  ------------------
  |  Branch (556:7): [True: 3.07k, False: 0]
  ------------------
  557|  3.07k|      case JCS_EXT_RGBA:
  ------------------
  |  Branch (557:7): [True: 0, False: 3.07k]
  ------------------
  558|  3.07k|        cconvert->pub._color_convert = extrgbx_rgb_convert;
  ------------------
  |  |  151|  3.07k|#define _color_convert  color_convert_12
  ------------------
  559|  3.07k|        break;
  560|      0|      case JCS_EXT_BGR:
  ------------------
  |  Branch (560:7): [True: 0, False: 3.07k]
  ------------------
  561|      0|        cconvert->pub._color_convert = extbgr_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  562|      0|        break;
  563|      0|      case JCS_EXT_BGRX:
  ------------------
  |  Branch (563:7): [True: 0, False: 3.07k]
  ------------------
  564|      0|      case JCS_EXT_BGRA:
  ------------------
  |  Branch (564:7): [True: 0, False: 3.07k]
  ------------------
  565|      0|        cconvert->pub._color_convert = extbgrx_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  566|      0|        break;
  567|      0|      case JCS_EXT_XBGR:
  ------------------
  |  Branch (567:7): [True: 0, False: 3.07k]
  ------------------
  568|      0|      case JCS_EXT_ABGR:
  ------------------
  |  Branch (568:7): [True: 0, False: 3.07k]
  ------------------
  569|      0|        cconvert->pub._color_convert = extxbgr_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  570|      0|        break;
  571|      0|      case JCS_EXT_XRGB:
  ------------------
  |  Branch (571:7): [True: 0, False: 3.07k]
  ------------------
  572|      0|      case JCS_EXT_ARGB:
  ------------------
  |  Branch (572:7): [True: 0, False: 3.07k]
  ------------------
  573|      0|        cconvert->pub._color_convert = extxrgb_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  574|      0|        break;
  575|      0|      default:
  ------------------
  |  Branch (575:7): [True: 0, False: 3.07k]
  ------------------
  576|      0|        cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  577|  3.07k|      }
  578|  3.07k|    } 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|  3.07k|    break;
  581|       |
  582|  9.40k|  case JCS_YCbCr:
  ------------------
  |  Branch (582:3): [True: 9.40k, False: 12.9k]
  ------------------
  583|  9.40k|#ifdef C_LOSSLESS_SUPPORTED
  584|  9.40k|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (584:9): [True: 0, False: 9.40k]
  ------------------
  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|  9.40k|#endif
  588|  9.40k|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (588:9): [True: 0, False: 9.40k]
  ------------------
  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|  9.40k|    if (IsExtRGB(cinfo->in_color_space)) {
  ------------------
  |  |   78|  9.40k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 9.40k]
  |  |  |  Branch (78:22): [True: 9.40k, False: 0]
  |  |  |  Branch (78:43): [True: 9.40k, False: 0]
  |  |  ------------------
  ------------------
  591|       |#ifdef WITH_SIMD
  592|       |      if (jsimd_set_rgb_ycc(cinfo))
  593|       |        cconvert->pub._color_convert = jsimd_color_convert;
  594|       |      else
  595|       |#endif
  596|  9.40k|      {
  597|  9.40k|        cconvert->pub.start_pass = rgb_ycc_start;
  598|  9.40k|        switch (cinfo->in_color_space) {
  599|  3.16k|        case JCS_EXT_RGB:
  ------------------
  |  Branch (599:9): [True: 3.16k, False: 6.24k]
  ------------------
  600|  3.16k|          cconvert->pub._color_convert = extrgb_ycc_convert;
  ------------------
  |  |  151|  3.16k|#define _color_convert  color_convert_12
  ------------------
  601|  3.16k|          break;
  602|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (602:9): [True: 0, False: 9.40k]
  ------------------
  603|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (603:9): [True: 0, False: 9.40k]
  ------------------
  604|      0|          cconvert->pub._color_convert = extrgbx_ycc_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  605|      0|          break;
  606|  3.16k|        case JCS_EXT_BGR:
  ------------------
  |  Branch (606:9): [True: 3.16k, False: 6.24k]
  ------------------
  607|  3.16k|          cconvert->pub._color_convert = extbgr_ycc_convert;
  ------------------
  |  |  151|  3.16k|#define _color_convert  color_convert_12
  ------------------
  608|  3.16k|          break;
  609|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (609:9): [True: 0, False: 9.40k]
  ------------------
  610|  3.07k|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (610:9): [True: 3.07k, False: 6.32k]
  ------------------
  611|  3.07k|          cconvert->pub._color_convert = extbgrx_ycc_convert;
  ------------------
  |  |  151|  3.07k|#define _color_convert  color_convert_12
  ------------------
  612|  3.07k|          break;
  613|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (613:9): [True: 0, False: 9.40k]
  ------------------
  614|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (614:9): [True: 0, False: 9.40k]
  ------------------
  615|      0|          cconvert->pub._color_convert = extxbgr_ycc_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  616|      0|          break;
  617|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (617:9): [True: 0, False: 9.40k]
  ------------------
  618|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (618:9): [True: 0, False: 9.40k]
  ------------------
  619|      0|          cconvert->pub._color_convert = extxrgb_ycc_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  620|      0|          break;
  621|      0|        default:
  ------------------
  |  Branch (621:9): [True: 0, False: 9.40k]
  ------------------
  622|      0|          cconvert->pub._color_convert = rgb_ycc_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  623|  9.40k|        }
  624|  9.40k|      }
  625|  9.40k|    } else if (cinfo->in_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (625:16): [True: 0, False: 0]
  ------------------
  626|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  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|  9.40k|    break;
  630|       |
  631|  9.40k|  case JCS_CMYK:
  ------------------
  |  Branch (631:3): [True: 0, False: 22.3k]
  ------------------
  632|      0|#ifdef C_LOSSLESS_SUPPORTED
  633|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (633:9): [True: 0, False: 0]
  ------------------
  634|      0|        cinfo->in_color_space != cinfo->jpeg_color_space)
  ------------------
  |  Branch (634:9): [True: 0, False: 0]
  ------------------
  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|      0|#endif
  637|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (637:9): [True: 0, False: 0]
  ------------------
  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|      0|    if (cinfo->in_color_space == JCS_CMYK) {
  ------------------
  |  Branch (639:9): [True: 0, False: 0]
  ------------------
  640|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  641|      0|    } 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|      0|    break;
  644|       |
  645|  3.07k|  case JCS_YCCK:
  ------------------
  |  Branch (645:3): [True: 3.07k, False: 19.2k]
  ------------------
  646|  3.07k|#ifdef C_LOSSLESS_SUPPORTED
  647|  3.07k|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (647:9): [True: 0, False: 3.07k]
  ------------------
  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|  3.07k|#endif
  651|  3.07k|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (651:9): [True: 0, False: 3.07k]
  ------------------
  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|  3.07k|    if (cinfo->in_color_space == JCS_CMYK) {
  ------------------
  |  Branch (653:9): [True: 3.07k, False: 0]
  ------------------
  654|  3.07k|      cconvert->pub.start_pass = rgb_ycc_start;
  655|  3.07k|      cconvert->pub._color_convert = cmyk_ycck_convert;
  ------------------
  |  |  151|  3.07k|#define _color_convert  color_convert_12
  ------------------
  656|  3.07k|    } else if (cinfo->in_color_space == JCS_YCCK) {
  ------------------
  |  Branch (656:16): [True: 0, False: 0]
  ------------------
  657|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  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|  3.07k|    break;
  661|       |
  662|      0|  default:                      /* allow null conversion of JCS_UNKNOWN */
  ------------------
  |  Branch (662:3): [True: 0, False: 22.3k]
  ------------------
  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;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  667|      0|    break;
  668|  22.3k|  }
  669|  22.3k|}
jccolor-12.c:null_method:
  407|  6.80k|{
  408|       |  /* no work needed */
  409|  6.80k|}
jccolor-12.c:grayscale_convert:
  319|  3.65M|{
  320|  3.65M|  register _JSAMPROW inptr;
  321|  3.65M|  register _JSAMPROW outptr;
  322|  3.65M|  register JDIMENSION col;
  323|  3.65M|  JDIMENSION num_cols = cinfo->image_width;
  324|  3.65M|  int instride = cinfo->input_components;
  325|       |
  326|  7.31M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (326:10): [True: 3.65M, False: 3.65M]
  ------------------
  327|  3.65M|    inptr = *input_buf++;
  328|  3.65M|    outptr = output_buf[0][output_row];
  329|  3.65M|    output_row++;
  330|  23.2M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (330:19): [True: 19.5M, False: 3.65M]
  ------------------
  331|  19.5M|      outptr[col] = inptr[0];
  332|  19.5M|      inptr += instride;
  333|  19.5M|    }
  334|  3.65M|  }
  335|  3.65M|}
jccolor-12.c:rgb_ycc_start:
  216|  15.5k|{
  217|  15.5k|#if BITS_IN_JSAMPLE != 16
  218|  15.5k|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  219|  15.5k|  JLONG *rgb_ycc_tab;
  220|  15.5k|  JLONG i;
  221|       |
  222|       |  /* Allocate and fill in the conversion tables. */
  223|  15.5k|  cconvert->rgb_ycc_tab = rgb_ycc_tab = (JLONG *)
  224|  15.5k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  15.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  225|  15.5k|                                (TABLE_SIZE * sizeof(JLONG)));
  ------------------
  |  |   90|  15.5k|#define TABLE_SIZE      (8 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  15.5k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  15.5k|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  226|       |
  227|  63.7M|  for (i = 0; i <= _MAXJSAMPLE; i++) {
  ------------------
  |  |  110|  63.7M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  63.7M|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (227:15): [True: 63.7M, False: 15.5k]
  ------------------
  228|  63.7M|    rgb_ycc_tab[i + R_Y_OFF] = FIX(0.29900) * i;
  ------------------
  |  |   81|  63.7M|#define R_Y_OFF         0                       /* offset to R => Y section */
  ------------------
                  rgb_ycc_tab[i + R_Y_OFF] = FIX(0.29900) * i;
  ------------------
  |  |   73|  63.7M|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   70|  63.7M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  229|  63.7M|    rgb_ycc_tab[i + G_Y_OFF] = FIX(0.58700) * i;
  ------------------
  |  |   82|  63.7M|#define G_Y_OFF         (1 * (_MAXJSAMPLE + 1)) /* offset to G => Y section */
  |  |  ------------------
  |  |  |  |  110|  63.7M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  63.7M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  rgb_ycc_tab[i + G_Y_OFF] = FIX(0.58700) * i;
  ------------------
  |  |   73|  63.7M|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   70|  63.7M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  230|  63.7M|    rgb_ycc_tab[i + B_Y_OFF] = FIX(0.11400) * i   + ONE_HALF;
  ------------------
  |  |   83|  63.7M|#define B_Y_OFF         (2 * (_MAXJSAMPLE + 1)) /* etc. */
  |  |  ------------------
  |  |  |  |  110|  63.7M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  63.7M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  rgb_ycc_tab[i + B_Y_OFF] = FIX(0.11400) * i   + ONE_HALF;
  ------------------
  |  |   73|  63.7M|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   70|  63.7M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  rgb_ycc_tab[i + B_Y_OFF] = FIX(0.11400) * i   + ONE_HALF;
  ------------------
  |  |   72|  63.7M|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   70|  63.7M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  231|  63.7M|    rgb_ycc_tab[i + R_CB_OFF] = (-FIX(0.16874)) * i;
  ------------------
  |  |   84|  63.7M|#define R_CB_OFF        (3 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  63.7M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  63.7M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  rgb_ycc_tab[i + R_CB_OFF] = (-FIX(0.16874)) * i;
  ------------------
  |  |   73|  63.7M|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   70|  63.7M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  232|  63.7M|    rgb_ycc_tab[i + G_CB_OFF] = (-FIX(0.33126)) * i;
  ------------------
  |  |   85|  63.7M|#define G_CB_OFF        (4 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  63.7M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  63.7M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  rgb_ycc_tab[i + G_CB_OFF] = (-FIX(0.33126)) * i;
  ------------------
  |  |   73|  63.7M|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   70|  63.7M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  233|       |    /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
  234|       |     * This ensures that the maximum output will round to _MAXJSAMPLE
  235|       |     * not _MAXJSAMPLE+1, and thus that we don't have to range-limit.
  236|       |     */
  237|  63.7M|    rgb_ycc_tab[i + B_CB_OFF] = FIX(0.50000) * i  + CBCR_OFFSET + ONE_HALF - 1;
  ------------------
  |  |   86|  63.7M|#define B_CB_OFF        (5 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  63.7M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  63.7M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  rgb_ycc_tab[i + B_CB_OFF] = FIX(0.50000) * i  + CBCR_OFFSET + ONE_HALF - 1;
  ------------------
  |  |   73|  63.7M|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   70|  63.7M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  rgb_ycc_tab[i + B_CB_OFF] = FIX(0.50000) * i  + CBCR_OFFSET + ONE_HALF - 1;
  ------------------
  |  |   71|  63.7M|#define CBCR_OFFSET     ((JLONG)_CENTERJSAMPLE << SCALEBITS)
  |  |  ------------------
  |  |  |  |  111|  63.7M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  63.7M|#define CENTERJ12SAMPLE  2048
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define CBCR_OFFSET     ((JLONG)_CENTERJSAMPLE << SCALEBITS)
  |  |  ------------------
  |  |  |  |   70|  63.7M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  rgb_ycc_tab[i + B_CB_OFF] = FIX(0.50000) * i  + CBCR_OFFSET + ONE_HALF - 1;
  ------------------
  |  |   72|  63.7M|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   70|  63.7M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  238|       |/*  B=>Cb and R=>Cr tables are the same
  239|       |    rgb_ycc_tab[i + R_CR_OFF] = FIX(0.50000) * i  + CBCR_OFFSET + ONE_HALF - 1;
  240|       |*/
  241|  63.7M|    rgb_ycc_tab[i + G_CR_OFF] = (-FIX(0.41869)) * i;
  ------------------
  |  |   88|  63.7M|#define G_CR_OFF        (6 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  63.7M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  63.7M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  rgb_ycc_tab[i + G_CR_OFF] = (-FIX(0.41869)) * i;
  ------------------
  |  |   73|  63.7M|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   70|  63.7M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  242|  63.7M|    rgb_ycc_tab[i + B_CR_OFF] = (-FIX(0.08131)) * i;
  ------------------
  |  |   89|  63.7M|#define B_CR_OFF        (7 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  63.7M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  63.7M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  rgb_ycc_tab[i + B_CR_OFF] = (-FIX(0.08131)) * i;
  ------------------
  |  |   73|  63.7M|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   70|  63.7M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  243|  63.7M|  }
  244|       |#else
  245|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  246|       |#endif
  247|  15.5k|}
jccolor-12.c:cmyk_ycck_convert:
  264|  2.35M|{
  265|  2.35M|#if BITS_IN_JSAMPLE != 16
  266|  2.35M|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  267|  2.35M|  register int r, g, b;
  268|  2.35M|  register JLONG *ctab = cconvert->rgb_ycc_tab;
  269|  2.35M|  register _JSAMPROW inptr;
  270|  2.35M|  register _JSAMPROW outptr0, outptr1, outptr2, outptr3;
  271|  2.35M|  register JDIMENSION col;
  272|  2.35M|  JDIMENSION num_cols = cinfo->image_width;
  273|       |
  274|  7.05M|  while (--num_rows >= 0) {
  ------------------
  |  Branch (274:10): [True: 4.69M, False: 2.35M]
  ------------------
  275|  4.69M|    inptr = *input_buf++;
  276|  4.69M|    outptr0 = output_buf[0][output_row];
  277|  4.69M|    outptr1 = output_buf[1][output_row];
  278|  4.69M|    outptr2 = output_buf[2][output_row];
  279|  4.69M|    outptr3 = output_buf[3][output_row];
  280|  4.69M|    output_row++;
  281|  40.7M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (281:19): [True: 36.0M, False: 4.69M]
  ------------------
  282|  36.0M|      r = _MAXJSAMPLE - RANGE_LIMIT(inptr[0]);
  ------------------
  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
                    r = _MAXJSAMPLE - RANGE_LIMIT(inptr[0]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
  283|  36.0M|      g = _MAXJSAMPLE - RANGE_LIMIT(inptr[1]);
  ------------------
  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
                    g = _MAXJSAMPLE - RANGE_LIMIT(inptr[1]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
  284|  36.0M|      b = _MAXJSAMPLE - RANGE_LIMIT(inptr[2]);
  ------------------
  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
                    b = _MAXJSAMPLE - RANGE_LIMIT(inptr[2]);
  ------------------
  |  |   99|  36.0M|#define RANGE_LIMIT(value)  ((value) & 0xFFF)
  ------------------
  285|       |      /* K passes through as-is */
  286|  36.0M|      outptr3[col] = inptr[3];
  287|  36.0M|      inptr += 4;
  288|       |      /* If the inputs are 0.._MAXJSAMPLE, the outputs of these equations
  289|       |       * must be too; we do not need an explicit range-limiting operation.
  290|       |       * Hence the value being shifted is never negative, and we don't
  291|       |       * need the general RIGHT_SHIFT macro.
  292|       |       */
  293|       |      /* Y */
  294|  36.0M|      outptr0[col] = (_JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
  ------------------
  |  |   81|  36.0M|#define R_Y_OFF         0                       /* offset to R => Y section */
  ------------------
                    outptr0[col] = (_JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
  ------------------
  |  |   82|  36.0M|#define G_Y_OFF         (1 * (_MAXJSAMPLE + 1)) /* offset to G => Y section */
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  295|  36.0M|                                 ctab[b + B_Y_OFF]) >> SCALEBITS);
  ------------------
  |  |   83|  36.0M|#define B_Y_OFF         (2 * (_MAXJSAMPLE + 1)) /* etc. */
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_Y_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
  296|       |      /* Cb */
  297|  36.0M|      outptr1[col] = (_JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
  ------------------
  |  |   84|  36.0M|#define R_CB_OFF        (3 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                    outptr1[col] = (_JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
  ------------------
  |  |   85|  36.0M|#define G_CB_OFF        (4 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  298|  36.0M|                                 ctab[b + B_CB_OFF]) >> SCALEBITS);
  ------------------
  |  |   86|  36.0M|#define B_CB_OFF        (5 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_CB_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
  299|       |      /* Cr */
  300|  36.0M|      outptr2[col] = (_JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
  ------------------
  |  |   87|  36.0M|#define R_CR_OFF        B_CB_OFF                /* B=>Cb, R=>Cr are the same */
  |  |  ------------------
  |  |  |  |   86|  36.0M|#define B_CB_OFF        (5 * (_MAXJSAMPLE + 1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                    outptr2[col] = (_JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
  ------------------
  |  |   88|  36.0M|#define G_CR_OFF        (6 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  301|  36.0M|                                 ctab[b + B_CR_OFF]) >> SCALEBITS);
  ------------------
  |  |   89|  36.0M|#define B_CR_OFF        (7 * (_MAXJSAMPLE + 1))
  |  |  ------------------
  |  |  |  |  110|  36.0M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  36.0M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                               ctab[b + B_CR_OFF]) >> SCALEBITS);
  ------------------
  |  |   70|  36.0M|#define SCALEBITS       16      /* speediest right-shift on some machines */
  ------------------
  302|  36.0M|    }
  303|  4.69M|  }
  304|       |#else
  305|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  306|       |#endif
  307|  2.35M|}

j12init_forward_dct:
  672|  22.3k|{
  673|  22.3k|  my_fdct_ptr fdct;
  674|  22.3k|  int i;
  675|       |
  676|  22.3k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  22.3k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (676:7): [True: 0, False: 22.3k]
  ------------------
  677|      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)))
  ------------------
  678|       |
  679|  22.3k|  fdct = (my_fdct_ptr)
  680|  22.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  22.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  681|  22.3k|                                sizeof(my_fdct_controller));
  682|  22.3k|  cinfo->fdct = (struct jpeg_forward_dct *)fdct;
  683|  22.3k|  fdct->pub.start_pass = start_pass_fdctmgr;
  684|       |
  685|       |  /* First determine the DCT... */
  686|  22.3k|  switch (cinfo->dct_method) {
  687|      0|#ifdef DCT_ISLOW_SUPPORTED
  688|  19.2k|  case JDCT_ISLOW:
  ------------------
  |  Branch (688:3): [True: 19.2k, False: 3.16k]
  ------------------
  689|  19.2k|    fdct->pub._forward_DCT = forward_DCT;
  ------------------
  |  |  138|  19.2k|#define _forward_DCT  forward_DCT_12
  ------------------
  690|       |#ifdef WITH_SIMD
  691|       |    if (!jsimd_set_fdct_islow(cinfo, &fdct->dct))
  692|       |#endif
  693|  19.2k|      fdct->dct = _jpeg_fdct_islow;
  ------------------
  |  |  184|  19.2k|#define _jpeg_fdct_islow  jpeg12_fdct_islow
  ------------------
  694|  19.2k|    break;
  695|      0|#endif
  696|      0|#ifdef DCT_IFAST_SUPPORTED
  697|  3.16k|  case JDCT_IFAST:
  ------------------
  |  Branch (697:3): [True: 3.16k, False: 19.2k]
  ------------------
  698|  3.16k|    fdct->pub._forward_DCT = forward_DCT;
  ------------------
  |  |  138|  3.16k|#define _forward_DCT  forward_DCT_12
  ------------------
  699|       |#ifdef WITH_SIMD
  700|       |    if (!jsimd_set_fdct_ifast(cinfo, &fdct->dct))
  701|       |#endif
  702|  3.16k|      fdct->dct = _jpeg_fdct_ifast;
  ------------------
  |  |  185|  3.16k|#define _jpeg_fdct_ifast  jpeg12_fdct_ifast
  ------------------
  703|  3.16k|    break;
  704|      0|#endif
  705|      0|#ifdef DCT_FLOAT_SUPPORTED
  706|      0|  case JDCT_FLOAT:
  ------------------
  |  Branch (706:3): [True: 0, False: 22.3k]
  ------------------
  707|      0|    fdct->pub._forward_DCT = forward_DCT_float;
  ------------------
  |  |  138|      0|#define _forward_DCT  forward_DCT_12
  ------------------
  708|       |#ifdef WITH_SIMD
  709|       |    if (!jsimd_set_fdct_float(cinfo, &fdct->float_dct))
  710|       |#endif
  711|      0|      fdct->float_dct = jpeg_fdct_float;
  712|      0|    break;
  713|      0|#endif
  714|      0|  default:
  ------------------
  |  Branch (714:3): [True: 0, False: 22.3k]
  ------------------
  715|      0|    ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  716|      0|    break;
  717|  22.3k|  }
  718|       |
  719|       |  /* ...then the supporting stages. */
  720|  22.3k|  switch (cinfo->dct_method) {
  721|      0|#ifdef DCT_ISLOW_SUPPORTED
  722|  19.2k|  case JDCT_ISLOW:
  ------------------
  |  Branch (722:3): [True: 19.2k, False: 3.16k]
  ------------------
  723|  19.2k|#endif
  724|  19.2k|#ifdef DCT_IFAST_SUPPORTED
  725|  22.3k|  case JDCT_IFAST:
  ------------------
  |  Branch (725:3): [True: 3.16k, False: 19.2k]
  ------------------
  726|  22.3k|#endif
  727|  22.3k|#if defined(DCT_ISLOW_SUPPORTED) || defined(DCT_IFAST_SUPPORTED)
  728|       |#ifdef WITH_SIMD
  729|       |    if (!jsimd_set_convsamp(cinfo, &fdct->convsamp))
  730|       |#endif
  731|  22.3k|      fdct->convsamp = convsamp;
  732|       |#ifdef WITH_SIMD
  733|       |    if (!jsimd_set_quantize(cinfo, &fdct->quantize))
  734|       |#endif
  735|  22.3k|      fdct->quantize = quantize;
  736|  22.3k|    break;
  737|      0|#endif
  738|      0|#ifdef DCT_FLOAT_SUPPORTED
  739|      0|  case JDCT_FLOAT:
  ------------------
  |  Branch (739:3): [True: 0, False: 22.3k]
  ------------------
  740|       |#ifdef WITH_SIMD
  741|       |    if (!jsimd_set_convsamp_float(cinfo, &fdct->float_convsamp))
  742|       |#endif
  743|      0|      fdct->float_convsamp = convsamp_float;
  744|       |#ifdef WITH_SIMD
  745|       |    if (!jsimd_set_quantize_float(cinfo, &fdct->float_quantize))
  746|       |#endif
  747|      0|      fdct->float_quantize = quantize_float;
  748|      0|    break;
  749|      0|#endif
  750|      0|  default:
  ------------------
  |  Branch (750:3): [True: 0, False: 22.3k]
  ------------------
  751|      0|    ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  752|      0|    break;
  753|  22.3k|  }
  754|       |
  755|       |  /* Allocate workspace memory */
  756|  22.3k|#ifdef DCT_FLOAT_SUPPORTED
  757|  22.3k|  if (cinfo->dct_method == JDCT_FLOAT)
  ------------------
  |  Branch (757:7): [True: 0, False: 22.3k]
  ------------------
  758|      0|    fdct->float_workspace = (FAST_FLOAT *)
  759|      0|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  760|      0|                                  sizeof(FAST_FLOAT) * DCTSIZE2);
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  761|  22.3k|  else
  762|  22.3k|#endif
  763|  22.3k|    fdct->workspace = (DCTELEM *)
  764|  22.3k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  22.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  765|  22.3k|                                  sizeof(DCTELEM) * DCTSIZE2);
  ------------------
  |  |   67|  22.3k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  766|       |
  767|       |  /* Mark divisor tables unallocated */
  768|   111k|  for (i = 0; i < NUM_QUANT_TBLS; i++) {
  ------------------
  |  |   68|   111k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (768:15): [True: 89.4k, False: 22.3k]
  ------------------
  769|  89.4k|    fdct->divisors[i] = NULL;
  770|  89.4k|#ifdef DCT_FLOAT_SUPPORTED
  771|       |    fdct->float_divisors[i] = NULL;
  772|  89.4k|#endif
  773|  89.4k|  }
  774|  22.3k|}
jcdctmgr-12.c:start_pass_fdctmgr:
  235|  22.3k|{
  236|  22.3k|  my_fdct_ptr fdct = (my_fdct_ptr)cinfo->fdct;
  237|  22.3k|  int ci, qtblno, i;
  238|  22.3k|  jpeg_component_info *compptr;
  239|  22.3k|  JQUANT_TBL *qtbl;
  240|  22.3k|  DCTELEM *dtbl;
  241|       |
  242|  78.9k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (242:44): [True: 56.5k, False: 22.3k]
  ------------------
  243|  56.5k|       ci++, compptr++) {
  244|  56.5k|    qtblno = compptr->quant_tbl_no;
  245|       |    /* Make sure specified quantization table is present */
  246|  56.5k|    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
  ------------------
  |  |   68|   113k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (246:9): [True: 0, False: 56.5k]
  |  Branch (246:23): [True: 0, False: 56.5k]
  ------------------
  247|  56.5k|        cinfo->quant_tbl_ptrs[qtblno] == NULL)
  ------------------
  |  Branch (247:9): [True: 0, False: 56.5k]
  ------------------
  248|      0|      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
  ------------------
  |  |  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)))
  ------------------
  249|  56.5k|    qtbl = cinfo->quant_tbl_ptrs[qtblno];
  250|       |    /* Compute divisors for this quant table */
  251|       |    /* We may do this more than once for same table, but it's not a big deal */
  252|  56.5k|    switch (cinfo->dct_method) {
  253|      0|#ifdef DCT_ISLOW_SUPPORTED
  254|  47.0k|    case JDCT_ISLOW:
  ------------------
  |  Branch (254:5): [True: 47.0k, False: 9.49k]
  ------------------
  255|       |      /* For LL&M IDCT method, divisors are equal to raw quantization
  256|       |       * coefficients multiplied by 8 (to counteract scaling).
  257|       |       */
  258|  47.0k|      if (fdct->divisors[qtblno] == NULL) {
  ------------------
  |  Branch (258:11): [True: 28.5k, False: 18.5k]
  ------------------
  259|  28.5k|        fdct->divisors[qtblno] = (DCTELEM *)
  260|  28.5k|          (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  28.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  261|  28.5k|                                      (DCTSIZE2 * 4) * sizeof(DCTELEM));
  ------------------
  |  |   67|  28.5k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  262|  28.5k|      }
  263|  47.0k|      dtbl = fdct->divisors[qtblno];
  264|  3.05M|      for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  3.05M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (264:19): [True: 3.01M, False: 47.0k]
  ------------------
  265|       |#if BITS_IN_JSAMPLE == 8
  266|       |#ifdef WITH_SIMD
  267|       |        if (!compute_reciprocal(qtbl->quantval[i] << 3, &dtbl[i]) &&
  268|       |            fdct->quantize != quantize)
  269|       |          fdct->quantize = quantize;
  270|       |#else
  271|       |        compute_reciprocal(qtbl->quantval[i] << 3, &dtbl[i]);
  272|       |#endif
  273|       |#else
  274|  3.01M|        dtbl[i] = ((DCTELEM)qtbl->quantval[i]) << 3;
  275|  3.01M|#endif
  276|  3.01M|      }
  277|  47.0k|      break;
  278|      0|#endif
  279|      0|#ifdef DCT_IFAST_SUPPORTED
  280|  9.49k|    case JDCT_IFAST:
  ------------------
  |  Branch (280:5): [True: 9.49k, False: 47.0k]
  ------------------
  281|  9.49k|      {
  282|       |        /* For AA&N IDCT method, divisors are equal to quantization
  283|       |         * coefficients scaled by scalefactor[row]*scalefactor[col], where
  284|       |         *   scalefactor[0] = 1
  285|       |         *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
  286|       |         * We apply a further scale factor of 8.
  287|       |         */
  288|  9.49k|#define CONST_BITS  14
  289|  9.49k|        static const INT16 aanscales[DCTSIZE2] = {
  290|       |          /* precomputed values scaled up by 14 bits */
  291|  9.49k|          16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
  292|  9.49k|          22725, 31521, 29692, 26722, 22725, 17855, 12299,  6270,
  293|  9.49k|          21407, 29692, 27969, 25172, 21407, 16819, 11585,  5906,
  294|  9.49k|          19266, 26722, 25172, 22654, 19266, 15137, 10426,  5315,
  295|  9.49k|          16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
  296|  9.49k|          12873, 17855, 16819, 15137, 12873, 10114,  6967,  3552,
  297|  9.49k|           8867, 12299, 11585, 10426,  8867,  6967,  4799,  2446,
  298|  9.49k|           4520,  6270,  5906,  5315,  4520,  3552,  2446,  1247
  299|  9.49k|        };
  300|  9.49k|        SHIFT_TEMPS
  301|       |
  302|  9.49k|        if (fdct->divisors[qtblno] == NULL) {
  ------------------
  |  Branch (302:13): [True: 6.32k, False: 3.16k]
  ------------------
  303|  6.32k|          fdct->divisors[qtblno] = (DCTELEM *)
  304|  6.32k|            (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  6.32k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  305|  6.32k|                                        (DCTSIZE2 * 4) * sizeof(DCTELEM));
  ------------------
  |  |   67|  6.32k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  306|  6.32k|        }
  307|  9.49k|        dtbl = fdct->divisors[qtblno];
  308|   616k|        for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|   616k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (308:21): [True: 607k, False: 9.49k]
  ------------------
  309|       |#if BITS_IN_JSAMPLE == 8
  310|       |#ifdef WITH_SIMD
  311|       |          if (!compute_reciprocal(
  312|       |                DESCALE(MULTIPLY16V16((JLONG)qtbl->quantval[i],
  313|       |                                      (JLONG)aanscales[i]),
  314|       |                        CONST_BITS - 3), &dtbl[i]) &&
  315|       |              fdct->quantize != quantize)
  316|       |            fdct->quantize = quantize;
  317|       |#else
  318|       |          compute_reciprocal(
  319|       |            DESCALE(MULTIPLY16V16((JLONG)qtbl->quantval[i],
  320|       |                                  (JLONG)aanscales[i]),
  321|       |                    CONST_BITS-3), &dtbl[i]);
  322|       |#endif
  323|       |#else
  324|   607k|          dtbl[i] = (DCTELEM)
  325|   607k|            DESCALE(MULTIPLY16V16((JLONG)qtbl->quantval[i],
  ------------------
  |  |  216|   607k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   607k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  326|   607k|                                  (JLONG)aanscales[i]),
  327|   607k|                    CONST_BITS - 3);
  328|   607k|#endif
  329|   607k|        }
  330|  9.49k|      }
  331|  9.49k|      break;
  332|      0|#endif
  333|      0|#ifdef DCT_FLOAT_SUPPORTED
  334|      0|    case JDCT_FLOAT:
  ------------------
  |  Branch (334:5): [True: 0, False: 56.5k]
  ------------------
  335|      0|      {
  336|       |        /* For float AA&N IDCT method, divisors are equal to quantization
  337|       |         * coefficients scaled by scalefactor[row]*scalefactor[col], where
  338|       |         *   scalefactor[0] = 1
  339|       |         *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
  340|       |         * We apply a further scale factor of 8.
  341|       |         * What's actually stored is 1/divisor so that the inner loop can
  342|       |         * use a multiplication rather than a division.
  343|       |         */
  344|      0|        FAST_FLOAT *fdtbl;
  ------------------
  |  |  386|      0|#define FAST_FLOAT  float
  ------------------
  345|      0|        int row, col;
  346|      0|        static const double aanscalefactor[DCTSIZE] = {
  347|      0|          1.0, 1.387039845, 1.306562965, 1.175875602,
  348|      0|          1.0, 0.785694958, 0.541196100, 0.275899379
  349|      0|        };
  350|       |
  351|      0|        if (fdct->float_divisors[qtblno] == NULL) {
  ------------------
  |  Branch (351:13): [True: 0, False: 0]
  ------------------
  352|      0|          fdct->float_divisors[qtblno] = (FAST_FLOAT *)
  353|      0|            (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  354|      0|                                        DCTSIZE2 * sizeof(FAST_FLOAT));
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  355|      0|        }
  356|      0|        fdtbl = fdct->float_divisors[qtblno];
  357|      0|        i = 0;
  358|      0|        for (row = 0; row < DCTSIZE; row++) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (358:23): [True: 0, False: 0]
  ------------------
  359|      0|          for (col = 0; col < DCTSIZE; col++) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (359:25): [True: 0, False: 0]
  ------------------
  360|      0|            fdtbl[i] = (FAST_FLOAT)
  361|      0|              (1.0 / (((double)qtbl->quantval[i] *
  362|      0|                       aanscalefactor[row] * aanscalefactor[col] * 8.0)));
  363|      0|            i++;
  364|      0|          }
  365|      0|        }
  366|      0|      }
  367|      0|      break;
  368|      0|#endif
  369|      0|    default:
  ------------------
  |  Branch (369:5): [True: 0, False: 56.5k]
  ------------------
  370|      0|      ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  371|      0|      break;
  372|  56.5k|    }
  373|  56.5k|  }
  374|  22.3k|}
jcdctmgr-12.c:forward_DCT:
  503|  10.3M|{
  504|       |  /* This routine is heavily used, so it's worth coding it tightly. */
  505|  10.3M|  my_fdct_ptr fdct = (my_fdct_ptr)cinfo->fdct;
  506|  10.3M|  DCTELEM *divisors = fdct->divisors[compptr->quant_tbl_no];
  507|  10.3M|  DCTELEM *workspace;
  508|  10.3M|  JDIMENSION bi;
  509|       |
  510|       |  /* Make sure the compiler doesn't look up these every pass */
  511|  10.3M|  forward_DCT_method_ptr do_dct = fdct->dct;
  512|  10.3M|  convsamp_method_ptr do_convsamp = fdct->convsamp;
  513|  10.3M|  quantize_method_ptr do_quantize = fdct->quantize;
  514|  10.3M|  workspace = fdct->workspace;
  515|       |
  516|  10.3M|  sample_data += start_row;     /* fold in the vertical offset once */
  517|       |
  518|  30.8M|  for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) {
  ------------------
  |  |   66|  20.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (518:16): [True: 20.4M, False: 10.3M]
  ------------------
  519|       |    /* Load data into workspace, applying unsigned->signed conversion */
  520|       |#ifdef WITH_PROFILE
  521|       |    cinfo->master->start = getTime();
  522|       |#endif
  523|  20.4M|    (*do_convsamp) (sample_data, start_col, workspace);
  524|       |#ifdef WITH_PROFILE
  525|       |    cinfo->master->convsamp_elapsed += getTime() - cinfo->master->start;
  526|       |    cinfo->master->convsamp_msamples += (double)DCTSIZE2 / 1000000.;
  527|       |#endif
  528|       |
  529|       |    /* Perform the DCT */
  530|       |#ifdef WITH_PROFILE
  531|       |    cinfo->master->start = getTime();
  532|       |#endif
  533|  20.4M|    (*do_dct) (workspace);
  534|       |#ifdef WITH_PROFILE
  535|       |    cinfo->master->fdct_elapsed += getTime() - cinfo->master->start;
  536|       |    cinfo->master->fdct_mcoeffs += (double)DCTSIZE2 / 1000000.;
  537|       |#endif
  538|       |
  539|       |    /* Quantize/descale the coefficients, and store into coef_blocks[] */
  540|       |#ifdef WITH_PROFILE
  541|       |    cinfo->master->start = getTime();
  542|       |#endif
  543|  20.4M|    (*do_quantize) (coef_blocks[bi], divisors, workspace);
  544|       |#ifdef WITH_PROFILE
  545|       |    cinfo->master->quantize_elapsed += getTime() - cinfo->master->start;
  546|       |    cinfo->master->quantize_mcoeffs += (double)DCTSIZE2 / 1000000.;
  547|       |#endif
  548|  20.4M|  }
  549|  10.3M|}
jcdctmgr-12.c:convsamp:
  383|  20.4M|{
  384|  20.4M|  register DCTELEM *workspaceptr;
  385|  20.4M|  register _JSAMPROW elemptr;
  386|  20.4M|  register int elemr;
  387|       |
  388|  20.4M|  workspaceptr = workspace;
  389|   184M|  for (elemr = 0; elemr < DCTSIZE; elemr++) {
  ------------------
  |  |   66|   184M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (389:19): [True: 163M, False: 20.4M]
  ------------------
  390|   163M|    elemptr = sample_data[elemr] + start_col;
  391|       |
  392|   163M|#if DCTSIZE == 8                /* unroll the inner loop */
  393|   163M|    *workspaceptr++ = (*elemptr++) - _CENTERJSAMPLE;
  ------------------
  |  |  111|   163M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|   163M|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
  394|   163M|    *workspaceptr++ = (*elemptr++) - _CENTERJSAMPLE;
  ------------------
  |  |  111|   163M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|   163M|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
  395|   163M|    *workspaceptr++ = (*elemptr++) - _CENTERJSAMPLE;
  ------------------
  |  |  111|   163M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|   163M|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
  396|   163M|    *workspaceptr++ = (*elemptr++) - _CENTERJSAMPLE;
  ------------------
  |  |  111|   163M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|   163M|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
  397|   163M|    *workspaceptr++ = (*elemptr++) - _CENTERJSAMPLE;
  ------------------
  |  |  111|   163M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|   163M|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
  398|   163M|    *workspaceptr++ = (*elemptr++) - _CENTERJSAMPLE;
  ------------------
  |  |  111|   163M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|   163M|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
  399|   163M|    *workspaceptr++ = (*elemptr++) - _CENTERJSAMPLE;
  ------------------
  |  |  111|   163M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|   163M|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
  400|   163M|    *workspaceptr++ = (*elemptr++) - _CENTERJSAMPLE;
  ------------------
  |  |  111|   163M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|   163M|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
  401|       |#else
  402|       |    {
  403|       |      register int elemc;
  404|       |      for (elemc = DCTSIZE; elemc > 0; elemc--)
  405|       |        *workspaceptr++ = (*elemptr++) - _CENTERJSAMPLE;
  406|       |    }
  407|       |#endif
  408|   163M|  }
  409|  20.4M|}
jcdctmgr-12.c:quantize:
  418|  20.4M|{
  419|  20.4M|  int i;
  420|  20.4M|  DCTELEM temp;
  421|  20.4M|  JCOEFPTR output_ptr = coef_block;
  422|       |
  423|       |#if BITS_IN_JSAMPLE == 8
  424|       |
  425|       |  UDCTELEM recip, corr;
  426|       |  int shift;
  427|       |  UDCTELEM2 product;
  428|       |
  429|       |  for (i = 0; i < DCTSIZE2; i++) {
  430|       |    temp = workspace[i];
  431|       |    recip = divisors[i + DCTSIZE2 * 0];
  432|       |    corr =  divisors[i + DCTSIZE2 * 1];
  433|       |    shift = divisors[i + DCTSIZE2 * 3];
  434|       |
  435|       |    if (temp < 0) {
  436|       |      temp = -temp;
  437|       |      product = (UDCTELEM2)(temp + corr) * recip;
  438|       |      product >>= shift + sizeof(DCTELEM) * 8;
  439|       |      temp = (DCTELEM)product;
  440|       |      temp = -temp;
  441|       |    } else {
  442|       |      product = (UDCTELEM2)(temp + corr) * recip;
  443|       |      product >>= shift + sizeof(DCTELEM) * 8;
  444|       |      temp = (DCTELEM)product;
  445|       |    }
  446|       |    output_ptr[i] = (JCOEF)temp;
  447|       |  }
  448|       |
  449|       |#else
  450|       |
  451|  20.4M|  register DCTELEM qval;
  452|       |
  453|  1.33G|  for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  1.33G|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (453:15): [True: 1.31G, False: 20.4M]
  ------------------
  454|  1.31G|    qval = divisors[i];
  455|  1.31G|    temp = workspace[i];
  456|       |    /* Divide the coefficient value by qval, ensuring proper rounding.
  457|       |     * Since C does not specify the direction of rounding for negative
  458|       |     * quotients, we have to force the dividend positive for portability.
  459|       |     *
  460|       |     * In most files, at least half of the output values will be zero
  461|       |     * (at default quantization settings, more like three-quarters...)
  462|       |     * so we should ensure that this case is fast.  On many machines,
  463|       |     * a comparison is enough cheaper than a divide to make a special test
  464|       |     * a win.  Since both inputs will be nonnegative, we need only test
  465|       |     * for a < b to discover whether a/b is 0.
  466|       |     * If your machine's division is fast enough, define FAST_DIVIDE.
  467|       |     */
  468|       |#ifdef FAST_DIVIDE
  469|       |#define DIVIDE_BY(a, b)  a /= b
  470|       |#else
  471|  1.31G|#define DIVIDE_BY(a, b)  if (a >= b) a /= b;  else a = 0
  472|  1.31G|#endif
  473|  1.31G|    if (temp < 0) {
  ------------------
  |  Branch (473:9): [True: 186M, False: 1.12G]
  ------------------
  474|   186M|      temp = -temp;
  475|   186M|      temp += qval >> 1;        /* for rounding */
  476|   186M|      DIVIDE_BY(temp, qval);
  ------------------
  |  |  471|   186M|#define DIVIDE_BY(a, b)  if (a >= b) a /= b;  else a = 0
  |  |  ------------------
  |  |  |  Branch (471:30): [True: 161M, False: 24.3M]
  |  |  ------------------
  ------------------
  477|   186M|      temp = -temp;
  478|  1.12G|    } else {
  479|  1.12G|      temp += qval >> 1;        /* for rounding */
  480|  1.12G|      DIVIDE_BY(temp, qval);
  ------------------
  |  |  471|  1.12G|#define DIVIDE_BY(a, b)  if (a >= b) a /= b;  else a = 0
  |  |  ------------------
  |  |  |  Branch (471:30): [True: 147M, False: 978M]
  |  |  ------------------
  ------------------
  481|  1.12G|    }
  482|  1.31G|    output_ptr[i] = (JCOEF)temp;
  483|  1.31G|  }
  484|       |
  485|  20.4M|#endif
  486|       |
  487|  20.4M|}

jpeg_make_c_derived_tbl:
  224|  81.2k|{
  225|  81.2k|  JHUFF_TBL *htbl;
  226|  81.2k|  c_derived_tbl *dtbl;
  227|  81.2k|  int p, i, l, lastp, si, maxsymbol;
  228|  81.2k|  char huffsize[257];
  229|  81.2k|  unsigned int huffcode[257];
  230|  81.2k|  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|  81.2k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  81.2k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (237:7): [True: 0, False: 81.2k]
  |  Branch (237:20): [True: 0, False: 81.2k]
  ------------------
  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|  81.2k|  htbl =
  240|  81.2k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (240:5): [True: 35.0k, False: 46.2k]
  ------------------
  241|  81.2k|  if (htbl == NULL)
  ------------------
  |  Branch (241:7): [True: 0, False: 81.2k]
  ------------------
  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|  81.2k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (245:7): [True: 47.4k, False: 33.7k]
  ------------------
  246|  47.4k|    *pdtbl = (c_derived_tbl *)
  247|  47.4k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  47.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  248|  47.4k|                                  sizeof(c_derived_tbl));
  249|  81.2k|  dtbl = *pdtbl;
  250|       |
  251|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  252|       |
  253|  81.2k|  p = 0;
  254|  1.38M|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (254:15): [True: 1.29M, False: 81.2k]
  ------------------
  255|  1.29M|    i = (int)htbl->bits[l];
  256|  1.29M|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (256:9): [True: 0, False: 1.29M]
  |  Branch (256:18): [True: 0, False: 1.29M]
  ------------------
  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|  2.00M|    while (i--)
  ------------------
  |  Branch (258:12): [True: 704k, False: 1.29M]
  ------------------
  259|   704k|      huffsize[p++] = (char)l;
  260|  1.29M|  }
  261|  81.2k|  huffsize[p] = 0;
  262|  81.2k|  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|  81.2k|  code = 0;
  268|  81.2k|  si = huffsize[0];
  269|  81.2k|  p = 0;
  270|   388k|  while (huffsize[p]) {
  ------------------
  |  Branch (270:10): [True: 307k, False: 81.2k]
  ------------------
  271|  1.01M|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (271:12): [True: 704k, False: 307k]
  ------------------
  272|   704k|      huffcode[p++] = code;
  273|   704k|      code++;
  274|   704k|    }
  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|   307k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (278:9): [True: 0, False: 307k]
  ------------------
  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|   307k|    code <<= 1;
  281|   307k|    si++;
  282|   307k|  }
  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|  81.2k|  memset(dtbl->ehufco, 0, sizeof(dtbl->ehufco));
  292|  81.2k|  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|  81.2k|  maxsymbol = isDC ? (cinfo->master->lossless ? 16 : 15) : 255;
  ------------------
  |  Branch (299:15): [True: 35.0k, False: 46.2k]
  |  Branch (299:23): [True: 0, False: 35.0k]
  ------------------
  300|       |
  301|   785k|  for (p = 0; p < lastp; p++) {
  ------------------
  |  Branch (301:15): [True: 704k, False: 81.2k]
  ------------------
  302|   704k|    i = htbl->huffval[p];
  303|   704k|    if (i < 0 || i > maxsymbol || dtbl->ehufsi[i])
  ------------------
  |  Branch (303:9): [True: 0, False: 704k]
  |  Branch (303:18): [True: 0, False: 704k]
  |  Branch (303:35): [True: 0, False: 704k]
  ------------------
  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|   704k|    dtbl->ehufco[i] = huffcode[p];
  306|   704k|    dtbl->ehufsi[i] = huffsize[p];
  307|   704k|  }
  308|  81.2k|}
jpeg_gen_optimal_table:
  931|  62.4k|{
  932|  62.4k|#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|  62.4k|  UINT8 bits[MAX_CLEN + 2];     /* bits[k] = # of symbols with code length k */
  937|  62.4k|  int bit_pos[MAX_CLEN + 1];    /* # of symbols with smaller code length */
  938|  62.4k|  int codesize[257];            /* codesize[k] = code length of symbol k */
  939|  62.4k|  int nz_index[257];            /* index of nonzero symbol in the original freq
  940|       |                                   array */
  941|  62.4k|  int others[257];              /* next symbol in current branch of tree */
  942|  62.4k|  int c1, c2;
  943|  62.4k|  int p, i, j;
  944|  62.4k|  int num_nz_symbols;
  945|  62.4k|  long v, v2;
  946|       |
  947|       |  /* This algorithm is explained in section K.2 of the JPEG standard */
  948|       |
  949|  62.4k|  memset(bits, 0, sizeof(bits));
  950|  62.4k|  memset(codesize, 0, sizeof(codesize));
  951|  16.1M|  for (i = 0; i < 257; i++)
  ------------------
  |  Branch (951:15): [True: 16.0M, False: 62.4k]
  ------------------
  952|  16.0M|    others[i] = -1;             /* init links to empty */
  953|       |
  954|  62.4k|  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|  62.4k|  num_nz_symbols = 0;
  964|  16.1M|  for (i = 0; i < 257; i++) {
  ------------------
  |  Branch (964:15): [True: 16.0M, False: 62.4k]
  ------------------
  965|  16.0M|    if (freq[i]) {
  ------------------
  |  Branch (965:9): [True: 629k, False: 15.4M]
  ------------------
  966|   629k|      nz_index[num_nz_symbols] = i;
  967|   629k|      freq[num_nz_symbols] = freq[i];
  968|   629k|      num_nz_symbols++;
  969|   629k|    }
  970|  16.0M|  }
  971|       |
  972|       |  /* Huffman's basic algorithm to assign optimal code lengths to symbols */
  973|       |
  974|   629k|  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|   629k|    c1 = -1;
  981|   629k|    c2 = -1;
  982|   629k|    v = 1000000000L;
  983|   629k|    v2 = 1000000000L;
  984|  17.8M|    for (i = 0; i < num_nz_symbols; i++) {
  ------------------
  |  Branch (984:17): [True: 17.2M, False: 629k]
  ------------------
  985|  17.2M|      if (freq[i] <= v2) {
  ------------------
  |  Branch (985:11): [True: 3.81M, False: 13.3M]
  ------------------
  986|  3.81M|        if (freq[i] <= v) {
  ------------------
  |  Branch (986:13): [True: 2.50M, False: 1.31M]
  ------------------
  987|  2.50M|          c2 = c1;
  988|  2.50M|          v2 = v;
  989|  2.50M|          v = freq[i];
  990|  2.50M|          c1 = i;
  991|  2.50M|        } else {
  992|  1.31M|          v2 = freq[i];
  993|  1.31M|          c2 = i;
  994|  1.31M|        }
  995|  3.81M|      }
  996|  17.2M|    }
  997|       |
  998|       |    /* Done if we've merged everything into one frequency */
  999|   629k|    if (c2 < 0)
  ------------------
  |  Branch (999:9): [True: 62.4k, False: 567k]
  ------------------
 1000|  62.4k|      break;
 1001|       |
 1002|       |    /* Else merge the two counts/trees */
 1003|   567k|    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|   567k|    freq[c2] = 1000000001L;
 1008|       |
 1009|       |    /* Increment the codesize of everything in c1's tree branch */
 1010|   567k|    codesize[c1]++;
 1011|  1.71M|    while (others[c1] >= 0) {
  ------------------
  |  Branch (1011:12): [True: 1.14M, False: 567k]
  ------------------
 1012|  1.14M|      c1 = others[c1];
 1013|  1.14M|      codesize[c1]++;
 1014|  1.14M|    }
 1015|       |
 1016|   567k|    others[c1] = c2;            /* chain c2 onto c1's tree branch */
 1017|       |
 1018|       |    /* Increment the codesize of everything in c2's tree branch */
 1019|   567k|    codesize[c2]++;
 1020|  1.83M|    while (others[c2] >= 0) {
  ------------------
  |  Branch (1020:12): [True: 1.27M, False: 567k]
  ------------------
 1021|  1.27M|      c2 = others[c2];
 1022|  1.27M|      codesize[c2]++;
 1023|  1.27M|    }
 1024|   567k|  }
 1025|       |
 1026|       |  /* Now count the number of symbols of each code length */
 1027|   692k|  for (i = 0; i < num_nz_symbols; i++) {
  ------------------
  |  Branch (1027:15): [True: 629k, False: 62.4k]
  ------------------
 1028|       |    /* The JPEG standard seems to think that this can't happen, */
 1029|       |    /* but I'm paranoid... */
 1030|   629k|    if (codesize[i] > MAX_CLEN)
  ------------------
  |  |  932|   629k|#define MAX_CLEN  32            /* assumed maximum initial code length */
  ------------------
  |  Branch (1030:9): [True: 0, False: 629k]
  ------------------
 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|   629k|    bits[codesize[i]]++;
 1034|   629k|  }
 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|  62.4k|  p = 0;
 1042|  2.05M|  for (i = 1; i <= MAX_CLEN; i++) {
  ------------------
  |  |  932|  2.05M|#define MAX_CLEN  32            /* assumed maximum initial code length */
  ------------------
  |  Branch (1042:15): [True: 1.99M, False: 62.4k]
  ------------------
 1043|  1.99M|    bit_pos[i] = p;
 1044|  1.99M|    p += bits[i];
 1045|  1.99M|  }
 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|  1.06M|  for (i = MAX_CLEN; i > 16; i--) {
  ------------------
  |  |  932|  62.4k|#define MAX_CLEN  32            /* assumed maximum initial code length */
  ------------------
  |  Branch (1058:22): [True: 998k, False: 62.4k]
  ------------------
 1059|  1.00M|    while (bits[i] > 0) {
  ------------------
  |  Branch (1059:12): [True: 5.68k, False: 998k]
  ------------------
 1060|  5.68k|      j = i - 2;                /* find length of new prefix to be used */
 1061|  7.12k|      while (bits[j] == 0)
  ------------------
  |  Branch (1061:14): [True: 1.43k, False: 5.68k]
  ------------------
 1062|  1.43k|        j--;
 1063|       |
 1064|  5.68k|      bits[i] -= 2;             /* remove two symbols */
 1065|  5.68k|      bits[i - 1]++;            /* one goes in this length */
 1066|  5.68k|      bits[j + 1] += 2;         /* two new symbols in this length */
 1067|  5.68k|      bits[j]--;                /* symbol of this length is now a prefix */
 1068|  5.68k|    }
 1069|   998k|  }
 1070|       |
 1071|       |  /* Remove the count for the pseudo-symbol 256 from the largest codelength */
 1072|   784k|  while (bits[i] == 0)          /* find largest codelength still in use */
  ------------------
  |  Branch (1072:10): [True: 722k, False: 62.4k]
  ------------------
 1073|   722k|    i--;
 1074|  62.4k|  bits[i]--;
 1075|       |
 1076|       |  /* Return final symbol counts (only for lengths 0..16) */
 1077|  62.4k|  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|   629k|  for (i = 0; i < num_nz_symbols - 1; i++) {
  ------------------
  |  Branch (1084:15): [True: 567k, False: 62.4k]
  ------------------
 1085|   567k|    htbl->huffval[bit_pos[codesize[i]]] = (UINT8)nz_index[i];
 1086|   567k|    bit_pos[codesize[i]]++;
 1087|   567k|  }
 1088|       |
 1089|       |  /* Set sent_table FALSE so updated table will be written to JPEG file. */
 1090|  62.4k|  htbl->sent_table = FALSE;
  ------------------
  |  |  207|  62.4k|#define FALSE   0               /* values of boolean */
  ------------------
 1091|  62.4k|}
jinit_huff_encoder:
 1145|  12.4k|{
 1146|  12.4k|  huff_entropy_ptr entropy;
 1147|  12.4k|  int i;
 1148|       |
 1149|  12.4k|  entropy = (huff_entropy_ptr)
 1150|  12.4k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  12.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1151|  12.4k|                                sizeof(huff_entropy_encoder));
 1152|  12.4k|  cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
 1153|  12.4k|  entropy->pub.start_pass = start_pass_huff;
 1154|       |
 1155|       |  /* Mark tables unallocated */
 1156|  62.4k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  62.4k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (1156:15): [True: 49.9k, False: 12.4k]
  ------------------
 1157|  49.9k|    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
 1158|  49.9k|#ifdef ENTROPY_OPT_SUPPORTED
 1159|       |    entropy->dc_count_ptrs[i] = entropy->ac_count_ptrs[i] = NULL;
 1160|  49.9k|#endif
 1161|  49.9k|  }
 1162|  12.4k|}
jchuff.c:start_pass_huff:
  138|  24.9k|{
  139|  24.9k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  140|  24.9k|  int ci, dctbl, actbl;
  141|  24.9k|  jpeg_component_info *compptr;
  142|       |
  143|  24.9k|  if (gather_statistics) {
  ------------------
  |  Branch (143:7): [True: 12.4k, False: 12.4k]
  ------------------
  144|  12.4k|#ifdef ENTROPY_OPT_SUPPORTED
  145|  12.4k|    entropy->pub.encode_mcu = encode_mcu_gather;
  146|  12.4k|    entropy->pub.finish_pass = finish_pass_gather;
  147|       |#else
  148|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  149|       |#endif
  150|  12.4k|  } else {
  151|  12.4k|    entropy->pub.encode_mcu = encode_mcu_huff;
  152|  12.4k|    entropy->pub.finish_pass = finish_pass_huff;
  153|  12.4k|  }
  154|       |
  155|  24.9k|#ifdef WITH_SIMD
  156|  24.9k|  entropy->simd = jsimd_set_huff_encode_one_block(cinfo);
  157|  24.9k|#endif
  158|       |
  159|  87.5k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (159:16): [True: 62.5k, False: 24.9k]
  ------------------
  160|  62.5k|    compptr = cinfo->cur_comp_info[ci];
  161|  62.5k|    dctbl = compptr->dc_tbl_no;
  162|  62.5k|    actbl = compptr->ac_tbl_no;
  163|  62.5k|    if (gather_statistics) {
  ------------------
  |  Branch (163:9): [True: 31.2k, False: 31.2k]
  ------------------
  164|  31.2k|#ifdef ENTROPY_OPT_SUPPORTED
  165|       |      /* Check for invalid table indexes */
  166|       |      /* (make_c_derived_tbl does this in the other path) */
  167|  31.2k|      if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  31.2k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (167:11): [True: 0, False: 31.2k]
  |  Branch (167:24): [True: 0, False: 31.2k]
  ------------------
  168|      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)))
  ------------------
  169|  31.2k|      if (actbl < 0 || actbl >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  31.2k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (169:11): [True: 0, False: 31.2k]
  |  Branch (169:24): [True: 0, False: 31.2k]
  ------------------
  170|      0|        ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);
  ------------------
  |  |  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)))
  ------------------
  171|       |      /* Allocate and zero the statistics tables */
  172|       |      /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
  173|  31.2k|      if (entropy->dc_count_ptrs[dctbl] == NULL)
  ------------------
  |  Branch (173:11): [True: 21.8k, False: 9.40k]
  ------------------
  174|  21.8k|        entropy->dc_count_ptrs[dctbl] = (long *)
  175|  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 */
  ------------------
  176|  21.8k|                                      257 * sizeof(long));
  177|  31.2k|      memset(entropy->dc_count_ptrs[dctbl], 0, 257 * sizeof(long));
  178|  31.2k|      if (entropy->ac_count_ptrs[actbl] == NULL)
  ------------------
  |  Branch (178:11): [True: 21.8k, False: 9.40k]
  ------------------
  179|  21.8k|        entropy->ac_count_ptrs[actbl] = (long *)
  180|  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 */
  ------------------
  181|  21.8k|                                      257 * sizeof(long));
  182|  31.2k|      memset(entropy->ac_count_ptrs[actbl], 0, 257 * sizeof(long));
  183|  31.2k|#endif
  184|  31.2k|    } else {
  185|       |      /* Compute derived values for Huffman tables */
  186|       |      /* We may do this more than once for a table, but it's not expensive */
  187|  31.2k|      jpeg_make_c_derived_tbl(cinfo, TRUE, dctbl,
  ------------------
  |  |  210|  31.2k|#define TRUE    1
  ------------------
  188|  31.2k|                              &entropy->dc_derived_tbls[dctbl]);
  189|  31.2k|      jpeg_make_c_derived_tbl(cinfo, FALSE, actbl,
  ------------------
  |  |  207|  31.2k|#define FALSE   0               /* values of boolean */
  ------------------
  190|  31.2k|                              &entropy->ac_derived_tbls[actbl]);
  191|  31.2k|    }
  192|       |    /* Initialize DC predictions to 0 */
  193|  62.5k|    entropy->saved.last_dc_val[ci] = 0;
  194|  62.5k|  }
  195|       |
  196|       |  /* Initialize bit buffer to empty */
  197|  24.9k|#ifdef WITH_SIMD
  198|  24.9k|  if (entropy->simd) {
  ------------------
  |  Branch (198:7): [True: 24.9k, False: 0]
  ------------------
  199|  24.9k|    entropy->saved.put_buffer.simd = 0;
  200|  24.9k|    entropy->saved.free_bits = SIMD_BIT_BUF_SIZE;
  ------------------
  |  |   67|  24.9k|#define SIMD_BIT_BUF_SIZE  (sizeof(simd_bit_buf_type) * 8)
  ------------------
  201|  24.9k|  } else
  202|      0|#endif
  203|      0|  {
  204|      0|    entropy->saved.put_buffer.c = 0;
  205|      0|    entropy->saved.free_bits = BIT_BUF_SIZE;
  ------------------
  |  |   61|      0|#define BIT_BUF_SIZE  64
  ------------------
  206|      0|  }
  207|       |
  208|       |  /* Initialize restart stuff */
  209|  24.9k|  entropy->restarts_to_go = cinfo->restart_interval;
  210|  24.9k|  entropy->next_restart_num = 0;
  211|  24.9k|}
jchuff.c:encode_mcu_gather:
  870|  4.63M|{
  871|  4.63M|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  872|  4.63M|  int blkn, ci;
  873|  4.63M|  jpeg_component_info *compptr;
  874|       |
  875|       |  /* Take care of restart intervals if needed */
  876|  4.63M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (876:7): [True: 0, False: 4.63M]
  ------------------
  877|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (877:9): [True: 0, False: 0]
  ------------------
  878|       |      /* Re-initialize DC predictions to 0 */
  879|      0|      for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (879:20): [True: 0, False: 0]
  ------------------
  880|      0|        entropy->saved.last_dc_val[ci] = 0;
  881|       |      /* Update restart state */
  882|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  883|      0|    }
  884|      0|    entropy->restarts_to_go--;
  885|      0|  }
  886|       |
  887|  19.0M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (887:18): [True: 14.4M, False: 4.63M]
  ------------------
  888|  14.4M|    ci = cinfo->MCU_membership[blkn];
  889|  14.4M|    compptr = cinfo->cur_comp_info[ci];
  890|  14.4M|    htest_one_block(cinfo, MCU_data[blkn][0], entropy->saved.last_dc_val[ci],
  891|  14.4M|                    entropy->dc_count_ptrs[compptr->dc_tbl_no],
  892|  14.4M|                    entropy->ac_count_ptrs[compptr->ac_tbl_no]);
  893|  14.4M|    entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0];
  894|  14.4M|  }
  895|       |
  896|  4.63M|  return TRUE;
  ------------------
  |  |  210|  4.63M|#define TRUE    1
  ------------------
  897|  4.63M|}
jchuff.c:htest_one_block:
  797|  14.4M|{
  798|  14.4M|  register int temp;
  799|  14.4M|  register int nbits;
  800|  14.4M|  register int k, r;
  801|  14.4M|  int max_coef_bits = cinfo->data_precision + 2;
  802|       |
  803|       |  /* Encode the DC coefficient difference per section F.1.2.1 */
  804|       |
  805|  14.4M|  temp = block[0] - last_dc_val;
  806|  14.4M|  if (temp < 0)
  ------------------
  |  Branch (806:7): [True: 2.29M, False: 12.1M]
  ------------------
  807|  2.29M|    temp = -temp;
  808|       |
  809|       |  /* Find the number of bits needed for the magnitude of the coefficient */
  810|  14.4M|  nbits = 0;
  811|  54.6M|  while (temp) {
  ------------------
  |  Branch (811:10): [True: 40.1M, False: 14.4M]
  ------------------
  812|  40.1M|    nbits++;
  813|  40.1M|    temp >>= 1;
  814|  40.1M|  }
  815|       |  /* Check for out-of-range coefficient values.
  816|       |   * Since we're encoding a difference, the range limit is twice as much.
  817|       |   */
  818|  14.4M|  if (nbits > max_coef_bits + 1)
  ------------------
  |  Branch (818:7): [True: 0, False: 14.4M]
  ------------------
  819|      0|    ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  820|       |
  821|       |  /* Count the Huffman symbol for the number of bits */
  822|  14.4M|  dc_counts[nbits]++;
  823|       |
  824|       |  /* Encode the AC coefficients per section F.1.2.2 */
  825|       |
  826|  14.4M|  r = 0;                        /* r = run length of zeros */
  827|       |
  828|   923M|  for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|   923M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (828:15): [True: 909M, False: 14.4M]
  ------------------
  829|   909M|    if ((temp = block[jpeg_natural_order[k]]) == 0) {
  ------------------
  |  Branch (829:9): [True: 728M, False: 180M]
  ------------------
  830|   728M|      r++;
  831|   728M|    } else {
  832|       |      /* if run length > 15, must emit special run-length-16 codes (0xF0) */
  833|   180M|      while (r > 15) {
  ------------------
  |  Branch (833:14): [True: 6.07k, False: 180M]
  ------------------
  834|  6.07k|        ac_counts[0xF0]++;
  835|  6.07k|        r -= 16;
  836|  6.07k|      }
  837|       |
  838|       |      /* Find the number of bits needed for the magnitude of the coefficient */
  839|   180M|      if (temp < 0)
  ------------------
  |  Branch (839:11): [True: 91.5M, False: 89.3M]
  ------------------
  840|  91.5M|        temp = -temp;
  841|       |
  842|       |      /* Find the number of bits needed for the magnitude of the coefficient */
  843|   180M|      nbits = 1;                /* there must be at least one 1 bit */
  844|  1.00G|      while ((temp >>= 1))
  ------------------
  |  Branch (844:14): [True: 827M, False: 180M]
  ------------------
  845|   827M|        nbits++;
  846|       |      /* Check for out-of-range coefficient values */
  847|   180M|      if (nbits > max_coef_bits)
  ------------------
  |  Branch (847:11): [True: 4, False: 180M]
  ------------------
  848|      4|        ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  240|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      4|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  849|       |
  850|       |      /* Count Huffman symbol for run length / number of bits */
  851|   180M|      ac_counts[(r << 4) + nbits]++;
  852|       |
  853|   180M|      r = 0;
  854|   180M|    }
  855|   909M|  }
  856|       |
  857|       |  /* If the last coef(s) were zero, emit an end-of-block code */
  858|  14.4M|  if (r > 0)
  ------------------
  |  Branch (858:7): [True: 11.9M, False: 2.43M]
  ------------------
  859|  11.9M|    ac_counts[0]++;
  860|  14.4M|}
jchuff.c:finish_pass_gather:
 1100|  12.4k|{
 1101|  12.4k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
 1102|  12.4k|  int ci, dctbl, actbl;
 1103|  12.4k|  jpeg_component_info *compptr;
 1104|  12.4k|  JHUFF_TBL **htblptr;
 1105|  12.4k|  boolean did_dc[NUM_HUFF_TBLS];
 1106|  12.4k|  boolean did_ac[NUM_HUFF_TBLS];
 1107|       |
 1108|       |  /* It's important not to apply jpeg_gen_optimal_table more than once
 1109|       |   * per table, because it clobbers the input frequency counts!
 1110|       |   */
 1111|  12.4k|  memset(did_dc, 0, sizeof(did_dc));
 1112|  12.4k|  memset(did_ac, 0, sizeof(did_ac));
 1113|       |
 1114|  43.7k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (1114:16): [True: 31.2k, False: 12.4k]
  ------------------
 1115|  31.2k|    compptr = cinfo->cur_comp_info[ci];
 1116|  31.2k|    dctbl = compptr->dc_tbl_no;
 1117|  31.2k|    actbl = compptr->ac_tbl_no;
 1118|  31.2k|    if (!did_dc[dctbl]) {
  ------------------
  |  Branch (1118:9): [True: 21.8k, False: 9.40k]
  ------------------
 1119|  21.8k|      htblptr = &cinfo->dc_huff_tbl_ptrs[dctbl];
 1120|  21.8k|      if (*htblptr == NULL)
  ------------------
  |  Branch (1120:11): [True: 0, False: 21.8k]
  ------------------
 1121|      0|        *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
 1122|  21.8k|      jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]);
 1123|  21.8k|      did_dc[dctbl] = TRUE;
  ------------------
  |  |  210|  21.8k|#define TRUE    1
  ------------------
 1124|  21.8k|    }
 1125|  31.2k|    if (!did_ac[actbl]) {
  ------------------
  |  Branch (1125:9): [True: 21.8k, False: 9.40k]
  ------------------
 1126|  21.8k|      htblptr = &cinfo->ac_huff_tbl_ptrs[actbl];
 1127|  21.8k|      if (*htblptr == NULL)
  ------------------
  |  Branch (1127:11): [True: 0, False: 21.8k]
  ------------------
 1128|      0|        *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
 1129|  21.8k|      jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]);
 1130|  21.8k|      did_ac[actbl] = TRUE;
  ------------------
  |  |  210|  21.8k|#define TRUE    1
  ------------------
 1131|  21.8k|    }
 1132|  31.2k|  }
 1133|  12.4k|}
jchuff.c:encode_mcu_huff:
  677|  4.63M|{
  678|  4.63M|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  679|  4.63M|  working_state state;
  680|  4.63M|  int blkn, ci;
  681|  4.63M|  jpeg_component_info *compptr;
  682|       |
  683|       |  /* Load up working state */
  684|  4.63M|  state.next_output_byte = cinfo->dest->next_output_byte;
  685|  4.63M|  state.free_in_buffer = cinfo->dest->free_in_buffer;
  686|  4.63M|  state.cur = entropy->saved;
  687|  4.63M|  state.cinfo = cinfo;
  688|  4.63M|#ifdef WITH_SIMD
  689|  4.63M|  state.simd = entropy->simd;
  690|  4.63M|#endif
  691|       |
  692|       |  /* Emit restart marker if needed */
  693|  4.63M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (693:7): [True: 0, False: 4.63M]
  ------------------
  694|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (694:9): [True: 0, False: 0]
  ------------------
  695|      0|      if (!emit_restart(&state, entropy->next_restart_num))
  ------------------
  |  Branch (695:11): [True: 0, False: 0]
  ------------------
  696|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|      0|  }
  698|       |
  699|       |  /* Encode the MCU data blocks */
  700|  4.63M|#ifdef WITH_SIMD
  701|  4.63M|  if (entropy->simd) {
  ------------------
  |  Branch (701:7): [True: 4.63M, False: 0]
  ------------------
  702|  19.0M|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (702:20): [True: 14.4M, False: 4.63M]
  ------------------
  703|  14.4M|      ci = cinfo->MCU_membership[blkn];
  704|  14.4M|      compptr = cinfo->cur_comp_info[ci];
  705|  14.4M|      if (!encode_one_block_simd(&state,
  ------------------
  |  Branch (705:11): [True: 0, False: 14.4M]
  ------------------
  706|  14.4M|                                 MCU_data[blkn][0], state.cur.last_dc_val[ci],
  707|  14.4M|                                 entropy->dc_derived_tbls[compptr->dc_tbl_no],
  708|  14.4M|                                 entropy->ac_derived_tbls[compptr->ac_tbl_no]))
  709|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  710|       |      /* Update last_dc_val */
  711|  14.4M|      state.cur.last_dc_val[ci] = MCU_data[blkn][0][0];
  712|  14.4M|    }
  713|  4.63M|  } else
  714|      0|#endif
  715|      0|  {
  716|      0|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (716:20): [True: 0, False: 0]
  ------------------
  717|      0|      ci = cinfo->MCU_membership[blkn];
  718|      0|      compptr = cinfo->cur_comp_info[ci];
  719|      0|      if (!encode_one_block(&state,
  ------------------
  |  Branch (719:11): [True: 0, False: 0]
  ------------------
  720|      0|                            MCU_data[blkn][0], state.cur.last_dc_val[ci],
  721|      0|                            entropy->dc_derived_tbls[compptr->dc_tbl_no],
  722|      0|                            entropy->ac_derived_tbls[compptr->ac_tbl_no]))
  723|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  724|       |      /* Update last_dc_val */
  725|      0|      state.cur.last_dc_val[ci] = MCU_data[blkn][0][0];
  726|      0|    }
  727|      0|  }
  728|       |
  729|       |  /* Completed MCU, so update state */
  730|  4.63M|  cinfo->dest->next_output_byte = state.next_output_byte;
  731|  4.63M|  cinfo->dest->free_in_buffer = state.free_in_buffer;
  732|  4.63M|  entropy->saved = state.cur;
  733|       |
  734|       |  /* Update restart-interval state too */
  735|  4.63M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (735:7): [True: 0, False: 4.63M]
  ------------------
  736|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (736:9): [True: 0, False: 0]
  ------------------
  737|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  738|      0|      entropy->next_restart_num++;
  739|      0|      entropy->next_restart_num &= 7;
  740|      0|    }
  741|      0|    entropy->restarts_to_go--;
  742|      0|  }
  743|       |
  744|  4.63M|  return TRUE;
  ------------------
  |  |  210|  4.63M|#define TRUE    1
  ------------------
  745|  4.63M|}
jchuff.c:flush_bits:
  471|  12.4k|{
  472|  12.4k|  JOCTET _buffer[BUFSIZE], *buffer, temp;
  473|  12.4k|  simd_bit_buf_type put_buffer;  int put_bits;
  474|  12.4k|  int localbuf = 0;
  475|       |
  476|  12.4k|#ifdef WITH_SIMD
  477|  12.4k|  if (state->simd) {
  ------------------
  |  Branch (477:7): [True: 12.4k, False: 0]
  ------------------
  478|  12.4k|    put_bits = SIMD_BIT_BUF_SIZE - state->cur.free_bits;
  ------------------
  |  |   67|  12.4k|#define SIMD_BIT_BUF_SIZE  (sizeof(simd_bit_buf_type) * 8)
  ------------------
  479|  12.4k|    put_buffer = state->cur.put_buffer.simd;
  480|  12.4k|  } else
  481|      0|#endif
  482|      0|  {
  483|      0|    put_bits = BIT_BUF_SIZE - state->cur.free_bits;
  ------------------
  |  |   61|      0|#define BIT_BUF_SIZE  64
  ------------------
  484|      0|    put_buffer = state->cur.put_buffer.c;
  485|      0|  }
  486|       |
  487|  12.4k|  LOAD_BUFFER()
  ------------------
  |  |  439|  12.4k|#define LOAD_BUFFER() { \
  |  |  440|  12.4k|  if (state->free_in_buffer < BUFSIZE) { \
  |  |  ------------------
  |  |  |  |  437|  12.4k|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   67|  12.4k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (440:7): [True: 141, False: 12.3k]
  |  |  ------------------
  |  |  441|    141|    localbuf = 1; \
  |  |  442|    141|    buffer = _buffer; \
  |  |  443|    141|  } else \
  |  |  444|  12.4k|    buffer = state->next_output_byte; \
  |  |  445|  12.4k|}
  ------------------
  488|       |
  489|  54.2k|  while (put_bits >= 8) {
  ------------------
  |  Branch (489:10): [True: 41.7k, False: 12.4k]
  ------------------
  490|  41.7k|    put_bits -= 8;
  491|  41.7k|    temp = (JOCTET)(put_buffer >> put_bits);
  492|  41.7k|    EMIT_BYTE(temp)
  ------------------
  |  |  344|  41.7k|#define EMIT_BYTE(b) { \
  |  |  345|  41.7k|  buffer[0] = (JOCTET)(b); \
  |  |  346|  41.7k|  buffer[1] = 0; \
  |  |  347|  41.7k|  buffer -= -2 + ((JOCTET)(b) < 0xFF); \
  |  |  348|  41.7k|}
  ------------------
  493|  41.7k|  }
  494|  12.4k|  if (put_bits) {
  ------------------
  |  Branch (494:7): [True: 10.9k, False: 1.50k]
  ------------------
  495|       |    /* fill partial byte with ones */
  496|  10.9k|    temp = (JOCTET)((put_buffer << (8 - put_bits)) | (0xFF >> put_bits));
  497|  10.9k|    EMIT_BYTE(temp)
  ------------------
  |  |  344|  10.9k|#define EMIT_BYTE(b) { \
  |  |  345|  10.9k|  buffer[0] = (JOCTET)(b); \
  |  |  346|  10.9k|  buffer[1] = 0; \
  |  |  347|  10.9k|  buffer -= -2 + ((JOCTET)(b) < 0xFF); \
  |  |  348|  10.9k|}
  ------------------
  498|  10.9k|  }
  499|       |
  500|  12.4k|#ifdef WITH_SIMD
  501|  12.4k|  if (state->simd) {                    /* and reset bit buffer to empty */
  ------------------
  |  Branch (501:7): [True: 12.4k, False: 0]
  ------------------
  502|  12.4k|    state->cur.put_buffer.simd = 0;
  503|  12.4k|    state->cur.free_bits = SIMD_BIT_BUF_SIZE;
  ------------------
  |  |   67|  12.4k|#define SIMD_BIT_BUF_SIZE  (sizeof(simd_bit_buf_type) * 8)
  ------------------
  504|  12.4k|  } else
  505|      0|#endif
  506|      0|  {
  507|      0|    state->cur.put_buffer.c = 0;
  508|      0|    state->cur.free_bits = BIT_BUF_SIZE;
  ------------------
  |  |   61|      0|#define BIT_BUF_SIZE  64
  ------------------
  509|      0|  }
  510|  12.4k|  STORE_BUFFER()
  ------------------
  |  |  447|  12.4k|#define STORE_BUFFER() { \
  |  |  448|  12.4k|  if (localbuf) { \
  |  |  ------------------
  |  |  |  Branch (448:7): [True: 141, False: 12.3k]
  |  |  ------------------
  |  |  449|    141|    size_t bytes, bytestocopy; \
  |  |  450|    141|    bytes = buffer - _buffer; \
  |  |  451|    141|    buffer = _buffer; \
  |  |  452|    286|    while (bytes > 0) { \
  |  |  ------------------
  |  |  |  Branch (452:12): [True: 145, False: 141]
  |  |  ------------------
  |  |  453|    145|      bytestocopy = MIN(bytes, state->free_in_buffer); \
  |  |  ------------------
  |  |  |  |  515|    145|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:26): [True: 135, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  454|    145|      memcpy(state->next_output_byte, buffer, bytestocopy); \
  |  |  455|    145|      state->next_output_byte += bytestocopy; \
  |  |  456|    145|      buffer += bytestocopy; \
  |  |  457|    145|      state->free_in_buffer -= bytestocopy; \
  |  |  458|    145|      if (state->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (458:11): [True: 10, False: 135]
  |  |  ------------------
  |  |  459|    145|        if (!dump_buffer(state)) return FALSE; \
  |  |  ------------------
  |  |  |  |  207|      0|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  |  Branch (459:13): [True: 0, False: 10]
  |  |  ------------------
  |  |  460|    145|      bytes -= bytestocopy; \
  |  |  461|    145|    } \
  |  |  462|  12.3k|  } else { \
  |  |  463|  12.3k|    state->free_in_buffer -= (buffer - state->next_output_byte); \
  |  |  464|  12.3k|    state->next_output_byte = buffer; \
  |  |  465|  12.3k|  } \
  |  |  466|  12.4k|}
  ------------------
  511|       |
  512|  12.4k|  return TRUE;
  ------------------
  |  |  210|  12.4k|#define TRUE    1
  ------------------
  513|  12.4k|}
jchuff.c:dump_buffer:
  325|  4.32k|{
  326|  4.32k|  struct jpeg_destination_mgr *dest = state->cinfo->dest;
  327|       |
  328|  4.32k|  if (!(*dest->empty_output_buffer) (state->cinfo))
  ------------------
  |  Branch (328:7): [True: 0, False: 4.32k]
  ------------------
  329|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  330|       |  /* After a successful buffer dump, must reset buffer pointers */
  331|  4.32k|  state->next_output_byte = dest->next_output_byte;
  332|  4.32k|  state->free_in_buffer = dest->free_in_buffer;
  333|  4.32k|  return TRUE;
  ------------------
  |  |  210|  4.32k|#define TRUE    1
  ------------------
  334|  4.32k|}
jchuff.c:encode_one_block_simd:
  523|  14.4M|{
  524|  14.4M|  JOCTET _buffer[BUFSIZE], *buffer;
  525|  14.4M|  int localbuf = 0;
  526|       |
  527|       |#ifdef ZERO_BUFFERS
  528|       |  memset(_buffer, 0, sizeof(_buffer));
  529|       |#endif
  530|       |
  531|  14.4M|  LOAD_BUFFER()
  ------------------
  |  |  439|  14.4M|#define LOAD_BUFFER() { \
  |  |  440|  14.4M|  if (state->free_in_buffer < BUFSIZE) { \
  |  |  ------------------
  |  |  |  |  437|  14.4M|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   67|  14.4M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (440:7): [True: 474k, False: 13.9M]
  |  |  ------------------
  |  |  441|   474k|    localbuf = 1; \
  |  |  442|   474k|    buffer = _buffer; \
  |  |  443|   474k|  } else \
  |  |  444|  14.4M|    buffer = state->next_output_byte; \
  |  |  445|  14.4M|}
  ------------------
  532|       |
  533|  14.4M|  buffer = state->cinfo->entropy->huff_encode_one_block_simd(state, buffer,
  534|  14.4M|                                                             block,
  535|  14.4M|                                                             last_dc_val,
  536|  14.4M|                                                             dctbl, actbl);
  537|       |
  538|  14.4M|  STORE_BUFFER()
  ------------------
  |  |  447|  14.4M|#define STORE_BUFFER() { \
  |  |  448|  14.4M|  if (localbuf) { \
  |  |  ------------------
  |  |  |  Branch (448:7): [True: 474k, False: 13.9M]
  |  |  ------------------
  |  |  449|   474k|    size_t bytes, bytestocopy; \
  |  |  450|   474k|    bytes = buffer - _buffer; \
  |  |  451|   474k|    buffer = _buffer; \
  |  |  452|   584k|    while (bytes > 0) { \
  |  |  ------------------
  |  |  |  Branch (452:12): [True: 110k, False: 474k]
  |  |  ------------------
  |  |  453|   110k|      bytestocopy = MIN(bytes, state->free_in_buffer); \
  |  |  ------------------
  |  |  |  |  515|   110k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (515:26): [True: 106k, False: 4.31k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  454|   110k|      memcpy(state->next_output_byte, buffer, bytestocopy); \
  |  |  455|   110k|      state->next_output_byte += bytestocopy; \
  |  |  456|   110k|      buffer += bytestocopy; \
  |  |  457|   110k|      state->free_in_buffer -= bytestocopy; \
  |  |  458|   110k|      if (state->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (458:11): [True: 4.31k, False: 106k]
  |  |  ------------------
  |  |  459|   110k|        if (!dump_buffer(state)) return FALSE; \
  |  |  ------------------
  |  |  |  |  207|      0|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  |  Branch (459:13): [True: 0, False: 4.31k]
  |  |  ------------------
  |  |  460|   110k|      bytes -= bytestocopy; \
  |  |  461|   110k|    } \
  |  |  462|  13.9M|  } else { \
  |  |  463|  13.9M|    state->free_in_buffer -= (buffer - state->next_output_byte); \
  |  |  464|  13.9M|    state->next_output_byte = buffer; \
  |  |  465|  13.9M|  } \
  |  |  466|  14.4M|}
  ------------------
  539|       |
  540|  14.4M|  return TRUE;
  ------------------
  |  |  210|  14.4M|#define TRUE    1
  ------------------
  541|  14.4M|}
jchuff.c:finish_pass_huff:
  754|  12.4k|{
  755|  12.4k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  756|  12.4k|  working_state state;
  757|       |
  758|       |  /* Load up working state ... flush_bits needs it */
  759|  12.4k|  state.next_output_byte = cinfo->dest->next_output_byte;
  760|  12.4k|  state.free_in_buffer = cinfo->dest->free_in_buffer;
  761|  12.4k|  state.cur = entropy->saved;
  762|  12.4k|  state.cinfo = cinfo;
  763|  12.4k|#ifdef WITH_SIMD
  764|  12.4k|  state.simd = entropy->simd;
  765|  12.4k|#endif
  766|       |
  767|       |  /* Flush out the last data */
  768|  12.4k|  if (!flush_bits(&state))
  ------------------
  |  Branch (768:7): [True: 0, False: 12.4k]
  ------------------
  769|      0|    ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  770|       |
  771|       |  /* Update state */
  772|  12.4k|  cinfo->dest->next_output_byte = state.next_output_byte;
  773|  12.4k|  cinfo->dest->free_in_buffer = state.free_in_buffer;
  774|  12.4k|  entropy->saved = state.cur;
  775|  12.4k|}

jpeg_write_icc_profile:
   51|  18.8k|{
   52|  18.8k|  unsigned int num_markers;     /* total number of markers we'll write */
   53|  18.8k|  int cur_marker = 1;           /* per spec, counting starts at 1 */
   54|  18.8k|  unsigned int length;          /* number of bytes to write in this marker */
   55|       |
   56|  18.8k|  if (icc_data_ptr == NULL || icc_data_len == 0)
  ------------------
  |  Branch (56:7): [True: 0, False: 18.8k]
  |  Branch (56:31): [True: 0, False: 18.8k]
  ------------------
   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|  18.8k|  if (cinfo->global_state < CSTATE_SCANNING)
  ------------------
  |  |   45|  18.8k|#define CSTATE_SCANNING  101    /* start_compress done, write_scanlines OK */
  ------------------
  |  Branch (58:7): [True: 0, False: 18.8k]
  ------------------
   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|  18.8k|  num_markers = icc_data_len / MAX_DATA_BYTES_IN_MARKER;
  ------------------
  |  |   38|  18.8k|#define MAX_DATA_BYTES_IN_MARKER  (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
  |  |  ------------------
  |  |  |  |   37|  18.8k|#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|  18.8k|#define ICC_OVERHEAD_LEN  14            /* size of non-profile data in APP2 */
  |  |  ------------------
  ------------------
   63|  18.8k|  if (num_markers * MAX_DATA_BYTES_IN_MARKER != icc_data_len)
  ------------------
  |  |   38|  18.8k|#define MAX_DATA_BYTES_IN_MARKER  (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
  |  |  ------------------
  |  |  |  |   37|  18.8k|#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|  18.8k|#define ICC_OVERHEAD_LEN  14            /* size of non-profile data in APP2 */
  |  |  ------------------
  ------------------
  |  Branch (63:7): [True: 18.8k, False: 0]
  ------------------
   64|  18.8k|    num_markers++;
   65|       |
   66|  37.6k|  while (icc_data_len > 0) {
  ------------------
  |  Branch (66:10): [True: 18.8k, False: 18.8k]
  ------------------
   67|       |    /* length of profile to put in this marker */
   68|  18.8k|    length = icc_data_len;
   69|  18.8k|    if (length > MAX_DATA_BYTES_IN_MARKER)
  ------------------
  |  |   38|  18.8k|#define MAX_DATA_BYTES_IN_MARKER  (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
  |  |  ------------------
  |  |  |  |   37|  18.8k|#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|  18.8k|#define ICC_OVERHEAD_LEN  14            /* size of non-profile data in APP2 */
  |  |  ------------------
  ------------------
  |  Branch (69:9): [True: 0, False: 18.8k]
  ------------------
   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|  18.8k|    icc_data_len -= length;
   72|       |
   73|       |    /* Write the JPEG marker header (APP2 code and marker length) */
   74|  18.8k|    jpeg_write_m_header(cinfo, ICC_MARKER,
  ------------------
  |  |   35|  18.8k|#define ICC_MARKER  (JPEG_APP0 + 2)     /* JPEG marker code for ICC */
  |  |  ------------------
  |  |  |  | 1168|  18.8k|#define JPEG_APP0       0xE0    /* APP0 marker code */
  |  |  ------------------
  ------------------
   75|  18.8k|                        (unsigned int)(length + ICC_OVERHEAD_LEN));
  ------------------
  |  |   36|  18.8k|#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|  18.8k|    jpeg_write_m_byte(cinfo, 0x49);
   82|  18.8k|    jpeg_write_m_byte(cinfo, 0x43);
   83|  18.8k|    jpeg_write_m_byte(cinfo, 0x43);
   84|  18.8k|    jpeg_write_m_byte(cinfo, 0x5F);
   85|  18.8k|    jpeg_write_m_byte(cinfo, 0x50);
   86|  18.8k|    jpeg_write_m_byte(cinfo, 0x52);
   87|  18.8k|    jpeg_write_m_byte(cinfo, 0x4F);
   88|  18.8k|    jpeg_write_m_byte(cinfo, 0x46);
   89|  18.8k|    jpeg_write_m_byte(cinfo, 0x49);
   90|  18.8k|    jpeg_write_m_byte(cinfo, 0x4C);
   91|  18.8k|    jpeg_write_m_byte(cinfo, 0x45);
   92|  18.8k|    jpeg_write_m_byte(cinfo, 0x0);
   93|       |
   94|       |    /* Add the sequencing info */
   95|  18.8k|    jpeg_write_m_byte(cinfo, cur_marker);
   96|  18.8k|    jpeg_write_m_byte(cinfo, (int)num_markers);
   97|       |
   98|       |    /* Add the profile data */
   99|   621k|    while (length--) {
  ------------------
  |  Branch (99:12): [True: 602k, False: 18.8k]
  ------------------
  100|   602k|      jpeg_write_m_byte(cinfo, *icc_data_ptr);
  101|   602k|      icc_data_ptr++;
  102|   602k|    }
  103|  18.8k|    cur_marker++;
  104|  18.8k|  }
  105|  18.8k|}

jinit_compress_master:
   37|  22.3k|{
   38|       |  /* Initialize master control (includes parameter checking/processing) */
   39|  22.3k|  jinit_c_master_control(cinfo, FALSE /* full compression */);
  ------------------
  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  ------------------
   40|       |
   41|       |  /* Preprocessing */
   42|  22.3k|  if (!cinfo->raw_data_in) {
  ------------------
  |  Branch (42:7): [True: 22.3k, False: 0]
  ------------------
   43|  22.3k|    if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (43:9): [True: 0, False: 22.3k]
  ------------------
   44|      0|      jinit_color_converter(cinfo);
   45|      0|      jinit_downsampler(cinfo);
   46|      0|      jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   47|  22.3k|    } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (47:16): [True: 22.3k, False: 0]
  ------------------
   48|  22.3k|      j12init_color_converter(cinfo);
   49|  22.3k|      j12init_downsampler(cinfo);
   50|  22.3k|      j12init_c_prep_controller(cinfo,
   51|  22.3k|                                FALSE /* never need full buffer here */);
  ------------------
  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  ------------------
   52|  22.3k|    } 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|  22.3k|  }
   63|       |
   64|  22.3k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (64:7): [True: 0, False: 22.3k]
  ------------------
   65|      0|#ifdef C_LOSSLESS_SUPPORTED
   66|       |    /* Prediction, sample differencing, and point transform */
   67|      0|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (67:9): [True: 0, False: 0]
  ------------------
   68|      0|      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|      0|    if (cinfo->arith_code) {
  ------------------
  |  Branch (74:9): [True: 0, False: 0]
  ------------------
   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|      0|    } else {
   77|      0|      jinit_lhuff_encoder(cinfo);
   78|      0|    }
   79|       |
   80|       |    /* Need a full-image difference buffer in any multi-pass mode. */
   81|      0|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (81:9): [True: 0, False: 0]
  ------------------
   82|      0|      jinit_c_diff_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
  ------------------
  |  Branch (82:48): [True: 0, False: 0]
  ------------------
   83|      0|                                               cinfo->optimize_coding));
  ------------------
  |  Branch (83:48): [True: 0, 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|  22.3k|  } else {
   94|  22.3k|#if defined(DCT_ISLOW_SUPPORTED) || defined(DCT_IFAST_SUPPORTED) || \
   95|  22.3k|    defined(DCT_FLOAT_SUPPORTED)
   96|       |    /* Forward DCT */
   97|  22.3k|    if (cinfo->data_precision == 8)
  ------------------
  |  Branch (97:9): [True: 0, False: 22.3k]
  ------------------
   98|      0|      jinit_forward_dct(cinfo);
   99|  22.3k|    else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (99:14): [True: 22.3k, False: 0]
  ------------------
  100|  22.3k|      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|  22.3k|    if (cinfo->arith_code) {
  ------------------
  |  Branch (104:9): [True: 6.15k, False: 16.2k]
  ------------------
  105|  6.15k|#ifdef C_ARITH_CODING_SUPPORTED
  106|  6.15k|      jinit_arith_encoder(cinfo);
  107|       |#else
  108|       |      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  109|       |#endif
  110|  16.2k|    } else {
  111|  16.2k|      if (cinfo->progressive_mode) {
  ------------------
  |  Branch (111:11): [True: 3.73k, False: 12.4k]
  ------------------
  112|  3.73k|#ifdef C_PROGRESSIVE_SUPPORTED
  113|  3.73k|        jinit_phuff_encoder(cinfo);
  114|       |#else
  115|       |        ERREXIT(cinfo, JERR_NOT_COMPILED);
  116|       |#endif
  117|  3.73k|      } else
  118|  12.4k|        jinit_huff_encoder(cinfo);
  119|  16.2k|    }
  120|       |
  121|       |    /* Need a full-image coefficient buffer in any multi-pass mode. */
  122|  22.3k|    if (cinfo->data_precision == 12)
  ------------------
  |  Branch (122:9): [True: 22.3k, False: 0]
  ------------------
  123|  22.3k|      j12init_c_coef_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
  ------------------
  |  Branch (123:50): [True: 6.80k, False: 15.5k]
  ------------------
  124|  15.5k|                                                 cinfo->optimize_coding));
  ------------------
  |  Branch (124:50): [True: 12.4k, False: 3.07k]
  ------------------
  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|  22.3k|  }
  132|       |
  133|  22.3k|  if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (133:7): [True: 0, False: 22.3k]
  ------------------
  134|      0|    jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  135|  22.3k|  else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (135:12): [True: 22.3k, False: 0]
  ------------------
  136|  22.3k|    j12init_c_main_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  207|  22.3k|#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|  22.3k|  jinit_marker_writer(cinfo);
  145|       |
  146|       |  /* We can now tell the memory manager to allocate virtual arrays. */
  147|  22.3k|  (*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|  22.3k|  (*cinfo->marker->write_file_header) (cinfo);
  154|  22.3k|}

j12init_c_main_controller:
  137|  22.3k|{
  138|  22.3k|  my_main_ptr main_ptr;
  139|  22.3k|  int ci;
  140|  22.3k|  jpeg_component_info *compptr;
  141|  22.3k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  22.3k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (141:19): [True: 0, False: 22.3k]
  ------------------
  142|       |
  143|  22.3k|#ifdef C_LOSSLESS_SUPPORTED
  144|  22.3k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (144:7): [True: 0, False: 22.3k]
  ------------------
  145|       |#if BITS_IN_JSAMPLE == 8
  146|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  147|       |#else
  148|      0|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (148:9): [True: 0, False: 0]
  ------------------
  149|      0|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (149:9): [True: 0, False: 0]
  ------------------
  150|      0|#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|      0|  } else
  153|  22.3k|#endif
  154|  22.3k|  {
  155|  22.3k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  22.3k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (155:9): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  }
  158|       |
  159|  22.3k|  main_ptr = (my_main_ptr)
  160|  22.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  22.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  161|  22.3k|                                sizeof(my_main_controller));
  162|  22.3k|  memset(main_ptr, 0, sizeof(my_main_controller));
  163|  22.3k|  cinfo->main = (struct jpeg_c_main_controller *)main_ptr;
  164|  22.3k|  main_ptr->pub.start_pass = start_pass_main;
  165|       |
  166|       |  /* We don't need to create a buffer in raw-data mode. */
  167|  22.3k|  if (cinfo->raw_data_in)
  ------------------
  |  Branch (167:7): [True: 0, False: 22.3k]
  ------------------
  168|      0|    return;
  169|       |
  170|       |  /* Create the buffer.  It holds downsampled data, so each component
  171|       |   * may be of a different size.
  172|       |   */
  173|  22.3k|  if (need_full_buffer) {
  ------------------
  |  Branch (173:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  } else {
  176|       |    /* Allocate a strip buffer for each component */
  177|  78.9k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (177:46): [True: 56.5k, False: 22.3k]
  ------------------
  178|  56.5k|         ci++, compptr++) {
  179|  56.5k|      main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  180|  56.5k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  56.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  181|  56.5k|         compptr->width_in_blocks * data_unit,
  182|  56.5k|         (JDIMENSION)(compptr->v_samp_factor * data_unit));
  183|  56.5k|    }
  184|  22.3k|  }
  185|  22.3k|}
jcmainct-12.c:start_pass_main:
   59|  22.3k|{
   60|  22.3k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
   61|       |
   62|       |  /* Do nothing in raw-data mode. */
   63|  22.3k|  if (cinfo->raw_data_in)
  ------------------
  |  Branch (63:7): [True: 0, False: 22.3k]
  ------------------
   64|      0|    return;
   65|       |
   66|  22.3k|  if (pass_mode != JBUF_PASS_THRU)
  ------------------
  |  Branch (66:7): [True: 0, False: 22.3k]
  ------------------
   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|  22.3k|  main_ptr->cur_iMCU_row = 0;   /* initialize counters */
   70|  22.3k|  main_ptr->rowgroup_ctr = 0;
   71|  22.3k|  main_ptr->suspended = FALSE;
  ------------------
  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  ------------------
   72|  22.3k|  main_ptr->pass_mode = pass_mode;      /* save mode for use by process_data */
   73|  22.3k|  main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  140|  22.3k|#define _process_data  process_data_12
  ------------------
   74|  22.3k|}
jcmainct-12.c:process_data_simple_main:
   86|  22.3k|{
   87|  22.3k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
   88|  22.3k|  JDIMENSION data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  44.7k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (88:26): [True: 0, False: 22.3k]
  ------------------
   89|       |
   90|  3.42M|  while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (90:10): [True: 3.40M, False: 22.3k]
  ------------------
   91|       |    /* Read input data if we haven't filled the main buffer yet */
   92|  3.40M|    if (main_ptr->rowgroup_ctr < data_unit)
  ------------------
  |  Branch (92:9): [True: 3.40M, False: 0]
  ------------------
   93|  3.40M|      (*cinfo->prep->_pre_process_data) (cinfo, input_buf, in_row_ctr,
  ------------------
  |  |  130|  3.40M|#define _pre_process_data  pre_process_data_12
  ------------------
   94|  3.40M|                                         in_rows_avail, main_ptr->buffer,
   95|  3.40M|                                         &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|  3.40M|    if (main_ptr->rowgroup_ctr != data_unit)
  ------------------
  |  Branch (101:9): [True: 0, False: 3.40M]
  ------------------
  102|      0|      return;
  103|       |
  104|       |    /* Send the completed row to the compressor */
  105|  3.40M|    if (!(*cinfo->coef->_compress_data) (cinfo, main_ptr->buffer)) {
  ------------------
  |  |  132|  3.40M|#define _compress_data  compress_data_12
  ------------------
  |  Branch (105:9): [True: 0, False: 3.40M]
  ------------------
  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|  3.40M|    if (main_ptr->suspended) {
  ------------------
  |  Branch (121:9): [True: 0, False: 3.40M]
  ------------------
  122|      0|      (*in_row_ctr)++;
  123|      0|      main_ptr->suspended = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  124|      0|    }
  125|  3.40M|    main_ptr->rowgroup_ctr = 0;
  126|  3.40M|    main_ptr->cur_iMCU_row++;
  127|  3.40M|  }
  128|  22.3k|}

jinit_marker_writer:
  652|  22.3k|{
  653|  22.3k|  my_marker_ptr marker;
  654|       |
  655|       |  /* Create the subobject */
  656|  22.3k|  marker = (my_marker_ptr)
  657|  22.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  22.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  658|  22.3k|                                sizeof(my_marker_writer));
  659|  22.3k|  cinfo->marker = (struct jpeg_marker_writer *)marker;
  660|       |  /* Initialize method pointers */
  661|  22.3k|  marker->pub.write_file_header = write_file_header;
  662|  22.3k|  marker->pub.write_frame_header = write_frame_header;
  663|  22.3k|  marker->pub.write_scan_header = write_scan_header;
  664|  22.3k|  marker->pub.write_file_trailer = write_file_trailer;
  665|  22.3k|  marker->pub.write_tables_only = write_tables_only;
  666|  22.3k|  marker->pub.write_marker_header = write_marker_header;
  667|  22.3k|  marker->pub.write_marker_byte = write_marker_byte;
  668|       |  /* Initialize private state */
  669|  22.3k|  marker->last_restart_interval = 0;
  670|  22.3k|}
jcmarker.c:write_file_header:
  476|  22.3k|{
  477|  22.3k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
  478|       |
  479|  22.3k|  emit_marker(cinfo, M_SOI);    /* first the SOI */
  480|       |
  481|       |  /* SOI is defined to reset restart interval to 0 */
  482|  22.3k|  marker->last_restart_interval = 0;
  483|       |
  484|  22.3k|  if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */
  ------------------
  |  Branch (484:7): [True: 16.2k, False: 6.15k]
  ------------------
  485|  16.2k|    emit_jfif_app0(cinfo);
  486|  22.3k|  if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */
  ------------------
  |  Branch (486:7): [True: 6.15k, False: 16.2k]
  ------------------
  487|  6.15k|    emit_adobe_app14(cinfo);
  488|  22.3k|}
jcmarker.c:emit_marker:
  131|   360k|{
  132|   360k|  emit_byte(cinfo, 0xFF);
  133|   360k|  emit_byte(cinfo, (int)mark);
  134|   360k|}
jcmarker.c:emit_byte:
  117|  7.49M|{
  118|  7.49M|  struct jpeg_destination_mgr *dest = cinfo->dest;
  119|       |
  120|  7.49M|  *(dest->next_output_byte)++ = (JOCTET)val;
  121|  7.49M|  if (--dest->free_in_buffer == 0) {
  ------------------
  |  Branch (121:7): [True: 105, False: 7.49M]
  ------------------
  122|    105|    if (!(*dest->empty_output_buffer) (cinfo))
  ------------------
  |  Branch (122:9): [True: 0, False: 105]
  ------------------
  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|    105|  }
  125|  7.49M|}
jcmarker.c:emit_jfif_app0:
  357|  16.2k|{
  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|  16.2k|  emit_marker(cinfo, M_APP0);
  371|       |
  372|  16.2k|  emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
  373|       |
  374|  16.2k|  emit_byte(cinfo, 0x4A);       /* Identifier: ASCII "JFIF" */
  375|  16.2k|  emit_byte(cinfo, 0x46);
  376|  16.2k|  emit_byte(cinfo, 0x49);
  377|  16.2k|  emit_byte(cinfo, 0x46);
  378|  16.2k|  emit_byte(cinfo, 0);
  379|  16.2k|  emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */
  380|  16.2k|  emit_byte(cinfo, cinfo->JFIF_minor_version);
  381|  16.2k|  emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
  382|  16.2k|  emit_2bytes(cinfo, (int)cinfo->X_density);
  383|  16.2k|  emit_2bytes(cinfo, (int)cinfo->Y_density);
  384|  16.2k|  emit_byte(cinfo, 0);          /* No thumbnail image */
  385|  16.2k|  emit_byte(cinfo, 0);
  386|  16.2k|}
jcmarker.c:emit_2bytes:
  140|   417k|{
  141|   417k|  emit_byte(cinfo, (value >> 8) & 0xFF);
  142|   417k|  emit_byte(cinfo, value & 0xFF);
  143|   417k|}
jcmarker.c:emit_adobe_app14:
  392|  6.15k|{
  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|  6.15k|  emit_marker(cinfo, M_APP14);
  410|       |
  411|  6.15k|  emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
  412|       |
  413|  6.15k|  emit_byte(cinfo, 0x41);       /* Identifier: ASCII "Adobe" */
  414|  6.15k|  emit_byte(cinfo, 0x64);
  415|  6.15k|  emit_byte(cinfo, 0x6F);
  416|  6.15k|  emit_byte(cinfo, 0x62);
  417|  6.15k|  emit_byte(cinfo, 0x65);
  418|  6.15k|  emit_2bytes(cinfo, 100);      /* Version */
  419|  6.15k|  emit_2bytes(cinfo, 0);        /* Flags0 */
  420|  6.15k|  emit_2bytes(cinfo, 0);        /* Flags1 */
  421|  6.15k|  switch (cinfo->jpeg_color_space) {
  422|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (422:3): [True: 0, False: 6.15k]
  ------------------
  423|      0|    emit_byte(cinfo, 1);        /* Color transform = 1 */
  424|      0|    break;
  425|  3.07k|  case JCS_YCCK:
  ------------------
  |  Branch (425:3): [True: 3.07k, False: 3.07k]
  ------------------
  426|  3.07k|    emit_byte(cinfo, 2);        /* Color transform = 2 */
  427|  3.07k|    break;
  428|  3.07k|  default:
  ------------------
  |  Branch (428:3): [True: 3.07k, False: 3.07k]
  ------------------
  429|  3.07k|    emit_byte(cinfo, 0);        /* Color transform = 0 */
  430|  3.07k|    break;
  431|  6.15k|  }
  432|  6.15k|}
jcmarker.c:write_frame_header:
  501|  22.3k|{
  502|  22.3k|  int ci, prec = 0;
  503|  22.3k|  boolean is_baseline;
  504|  22.3k|  jpeg_component_info *compptr;
  505|       |
  506|  22.3k|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (506:7): [True: 22.3k, False: 0]
  ------------------
  507|       |    /* Emit DQT for each quantization table.
  508|       |     * Note that emit_dqt() suppresses any duplicate tables.
  509|       |     */
  510|  78.9k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (510:46): [True: 56.5k, False: 22.3k]
  ------------------
  511|  56.5k|         ci++, compptr++) {
  512|  56.5k|      prec += emit_dqt(cinfo, compptr->quant_tbl_no);
  513|  56.5k|    }
  514|       |    /* now prec is nonzero iff there are any 16-bit quant tables. */
  515|  22.3k|  }
  516|       |
  517|       |  /* Check for a non-baseline specification.
  518|       |   * Note we assume that Huffman table numbers won't be changed later.
  519|       |   */
  520|  22.3k|  if (cinfo->arith_code || cinfo->progressive_mode ||
  ------------------
  |  Branch (520:7): [True: 6.15k, False: 16.2k]
  |  Branch (520:28): [True: 3.73k, False: 12.4k]
  ------------------
  521|  22.3k|      cinfo->master->lossless || cinfo->data_precision != 8) {
  ------------------
  |  Branch (521:7): [True: 0, False: 12.4k]
  |  Branch (521:34): [True: 12.4k, False: 0]
  ------------------
  522|  22.3k|    is_baseline = FALSE;
  ------------------
  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  ------------------
  523|  22.3k|  } 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|  22.3k|  if (cinfo->arith_code) {
  ------------------
  |  Branch (538:7): [True: 6.15k, False: 16.2k]
  ------------------
  539|  6.15k|    if (cinfo->progressive_mode)
  ------------------
  |  Branch (539:9): [True: 3.07k, False: 3.07k]
  ------------------
  540|  3.07k|      emit_sof(cinfo, M_SOF10); /* SOF code for progressive arithmetic */
  541|  3.07k|    else
  542|  3.07k|      emit_sof(cinfo, M_SOF9);  /* SOF code for sequential arithmetic */
  543|  16.2k|  } else {
  544|  16.2k|    if (cinfo->progressive_mode)
  ------------------
  |  Branch (544:9): [True: 3.73k, False: 12.4k]
  ------------------
  545|  3.73k|      emit_sof(cinfo, M_SOF2);  /* SOF code for progressive Huffman */
  546|  12.4k|    else if (cinfo->master->lossless)
  ------------------
  |  Branch (546:14): [True: 0, False: 12.4k]
  ------------------
  547|      0|      emit_sof(cinfo, M_SOF3);  /* SOF code for lossless Huffman */
  548|  12.4k|    else if (is_baseline)
  ------------------
  |  Branch (548:14): [True: 0, False: 12.4k]
  ------------------
  549|      0|      emit_sof(cinfo, M_SOF0);  /* SOF code for baseline implementation */
  550|  12.4k|    else
  551|  12.4k|      emit_sof(cinfo, M_SOF1);  /* SOF code for non-baseline Huffman file */
  552|  16.2k|  }
  553|  22.3k|}
jcmarker.c:emit_dqt:
  154|  56.5k|{
  155|  56.5k|  JQUANT_TBL *qtbl = cinfo->quant_tbl_ptrs[index];
  156|  56.5k|  int prec;
  157|  56.5k|  int i;
  158|       |
  159|  56.5k|  if (qtbl == NULL)
  ------------------
  |  Branch (159:7): [True: 0, False: 56.5k]
  ------------------
  160|      0|    ERREXIT1(cinfo, JERR_NO_QUANT_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)))
  ------------------
  161|       |
  162|  56.5k|  prec = 0;
  163|  3.67M|  for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  3.67M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (163:15): [True: 3.61M, False: 56.5k]
  ------------------
  164|  3.61M|    if (qtbl->quantval[i] > 255)
  ------------------
  |  Branch (164:9): [True: 0, False: 3.61M]
  ------------------
  165|      0|      prec = 1;
  166|  3.61M|  }
  167|       |
  168|  56.5k|  if (!qtbl->sent_table) {
  ------------------
  |  Branch (168:7): [True: 34.8k, False: 21.7k]
  ------------------
  169|  34.8k|    emit_marker(cinfo, M_DQT);
  170|       |
  171|  34.8k|    emit_2bytes(cinfo, prec ? DCTSIZE2 * 2 + 1 + 2 : DCTSIZE2 + 1 + 2);
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
                  emit_2bytes(cinfo, prec ? DCTSIZE2 * 2 + 1 + 2 : DCTSIZE2 + 1 + 2);
  ------------------
  |  |   67|  34.8k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (171:24): [True: 0, False: 34.8k]
  ------------------
  172|       |
  173|  34.8k|    emit_byte(cinfo, index + (prec << 4));
  174|       |
  175|  2.26M|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  2.26M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (175:17): [True: 2.22M, False: 34.8k]
  ------------------
  176|       |      /* The table entries must be emitted in zigzag order. */
  177|  2.22M|      unsigned int qval = qtbl->quantval[jpeg_natural_order[i]];
  178|  2.22M|      if (prec)
  ------------------
  |  Branch (178:11): [True: 0, False: 2.22M]
  ------------------
  179|      0|        emit_byte(cinfo, (int)(qval >> 8));
  180|  2.22M|      emit_byte(cinfo, (int)(qval & 0xFF));
  181|  2.22M|    }
  182|       |
  183|  34.8k|    qtbl->sent_table = TRUE;
  ------------------
  |  |  210|  34.8k|#define TRUE    1
  ------------------
  184|  34.8k|  }
  185|       |
  186|  56.5k|  return prec;
  187|  56.5k|}
jcmarker.c:emit_sof:
  292|  22.3k|{
  293|  22.3k|  int ci;
  294|  22.3k|  jpeg_component_info *compptr;
  295|       |
  296|  22.3k|  emit_marker(cinfo, code);
  297|       |
  298|  22.3k|  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|  22.3k|  if ((long)cinfo->_jpeg_height > 65535L || (long)cinfo->_jpeg_width > 65535L)
  ------------------
  |  |   31|  22.3k|#define _jpeg_height  image_height
  ------------------
                if ((long)cinfo->_jpeg_height > 65535L || (long)cinfo->_jpeg_width > 65535L)
  ------------------
  |  |   30|  22.3k|#define _jpeg_width  image_width
  ------------------
  |  Branch (301:7): [True: 0, False: 22.3k]
  |  Branch (301:45): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  emit_byte(cinfo, cinfo->data_precision);
  305|  22.3k|  emit_2bytes(cinfo, (int)cinfo->_jpeg_height);
  ------------------
  |  |   31|  22.3k|#define _jpeg_height  image_height
  ------------------
  306|  22.3k|  emit_2bytes(cinfo, (int)cinfo->_jpeg_width);
  ------------------
  |  |   30|  22.3k|#define _jpeg_width  image_width
  ------------------
  307|       |
  308|  22.3k|  emit_byte(cinfo, cinfo->num_components);
  309|       |
  310|  78.9k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (310:44): [True: 56.5k, False: 22.3k]
  ------------------
  311|  56.5k|       ci++, compptr++) {
  312|  56.5k|    emit_byte(cinfo, compptr->component_id);
  313|  56.5k|    emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor);
  314|  56.5k|    emit_byte(cinfo, compptr->quant_tbl_no);
  315|  56.5k|  }
  316|  22.3k|}
jcmarker.c:write_scan_header:
  564|  93.3k|{
  565|  93.3k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
  566|  93.3k|  int i;
  567|  93.3k|  jpeg_component_info *compptr;
  568|       |
  569|  93.3k|  if (cinfo->arith_code) {
  ------------------
  |  Branch (569:7): [True: 58.4k, False: 34.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|  58.4k|    emit_dac(cinfo);
  575|  58.4k|  } else {
  576|       |    /* Emit Huffman tables.
  577|       |     * Note that emit_dht() suppresses any duplicate tables.
  578|       |     */
  579|  88.5k|    for (i = 0; i < cinfo->comps_in_scan; i++) {
  ------------------
  |  Branch (579:17): [True: 53.6k, False: 34.8k]
  ------------------
  580|  53.6k|      compptr = cinfo->cur_comp_info[i];
  581|       |      /* DC needs no table for refinement scan */
  582|  53.6k|      if ((cinfo->Ss == 0 && cinfo->Ah == 0) || cinfo->master->lossless)
  ------------------
  |  Branch (582:12): [True: 38.7k, False: 14.9k]
  |  Branch (582:30): [True: 35.0k, False: 3.73k]
  |  Branch (582:49): [True: 0, False: 18.6k]
  ------------------
  583|  35.0k|        emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
  ------------------
  |  |  207|  35.0k|#define FALSE   0               /* values of boolean */
  ------------------
  584|       |      /* AC needs no table when not present, and lossless mode uses only DC
  585|       |         tables. */
  586|  53.6k|      if (cinfo->Se && !cinfo->master->lossless)
  ------------------
  |  Branch (586:11): [True: 46.2k, False: 7.46k]
  |  Branch (586:24): [True: 46.2k, False: 0]
  ------------------
  587|  46.2k|        emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
  ------------------
  |  |  210|  46.2k|#define TRUE    1
  ------------------
  588|  53.6k|    }
  589|  34.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|  93.3k|  if (cinfo->restart_interval != marker->last_restart_interval) {
  ------------------
  |  Branch (594:7): [True: 6.15k, False: 87.1k]
  ------------------
  595|  6.15k|    emit_dri(cinfo);
  596|  6.15k|    marker->last_restart_interval = cinfo->restart_interval;
  597|  6.15k|  }
  598|       |
  599|  93.3k|  emit_sos(cinfo);
  600|  93.3k|}
jcmarker.c:emit_dac:
  233|  58.4k|{
  234|  58.4k|#ifdef C_ARITH_CODING_SUPPORTED
  235|  58.4k|  char dc_in_use[NUM_ARITH_TBLS];
  236|  58.4k|  char ac_in_use[NUM_ARITH_TBLS];
  237|  58.4k|  int length, i;
  238|  58.4k|  jpeg_component_info *compptr;
  239|       |
  240|   993k|  for (i = 0; i < NUM_ARITH_TBLS; i++)
  ------------------
  |  |   70|   993k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (240:15): [True: 935k, False: 58.4k]
  ------------------
  241|   935k|    dc_in_use[i] = ac_in_use[i] = 0;
  242|       |
  243|   141k|  for (i = 0; i < cinfo->comps_in_scan; i++) {
  ------------------
  |  Branch (243:15): [True: 83.0k, False: 58.4k]
  ------------------
  244|  83.0k|    compptr = cinfo->cur_comp_info[i];
  245|       |    /* DC needs no table for refinement scan */
  246|  83.0k|    if (cinfo->Ss == 0 && cinfo->Ah == 0)
  ------------------
  |  Branch (246:9): [True: 33.8k, False: 49.2k]
  |  Branch (246:27): [True: 21.5k, False: 12.3k]
  ------------------
  247|  21.5k|      dc_in_use[compptr->dc_tbl_no] = 1;
  248|       |    /* AC needs no table when not present */
  249|  83.0k|    if (cinfo->Se)
  ------------------
  |  Branch (249:9): [True: 58.4k, False: 24.6k]
  ------------------
  250|  58.4k|      ac_in_use[compptr->ac_tbl_no] = 1;
  251|  83.0k|  }
  252|       |
  253|  58.4k|  length = 0;
  254|   993k|  for (i = 0; i < NUM_ARITH_TBLS; i++)
  ------------------
  |  |   70|   993k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (254:15): [True: 935k, False: 58.4k]
  ------------------
  255|   935k|    length += dc_in_use[i] + ac_in_use[i];
  256|       |
  257|  58.4k|  if (length) {
  ------------------
  |  Branch (257:7): [True: 55.3k, False: 3.07k]
  ------------------
  258|  55.3k|    emit_marker(cinfo, M_DAC);
  259|       |
  260|  55.3k|    emit_2bytes(cinfo, length * 2 + 2);
  261|       |
  262|   941k|    for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|   941k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (262:17): [True: 886k, False: 55.3k]
  ------------------
  263|   886k|      if (dc_in_use[i]) {
  ------------------
  |  Branch (263:11): [True: 9.23k, False: 876k]
  ------------------
  264|  9.23k|        emit_byte(cinfo, i);
  265|  9.23k|        emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i] << 4));
  266|  9.23k|      }
  267|   886k|      if (ac_in_use[i]) {
  ------------------
  |  Branch (267:11): [True: 52.3k, False: 833k]
  ------------------
  268|  52.3k|        emit_byte(cinfo, i + 0x10);
  269|  52.3k|        emit_byte(cinfo, cinfo->arith_ac_K[i]);
  270|  52.3k|      }
  271|   886k|    }
  272|  55.3k|  }
  273|  58.4k|#endif /* C_ARITH_CODING_SUPPORTED */
  274|  58.4k|}
jcmarker.c:emit_dht:
  193|  81.2k|{
  194|  81.2k|  JHUFF_TBL *htbl;
  195|  81.2k|  int length, i;
  196|       |
  197|  81.2k|  if (is_ac) {
  ------------------
  |  Branch (197:7): [True: 46.2k, False: 35.0k]
  ------------------
  198|  46.2k|    htbl = cinfo->ac_huff_tbl_ptrs[index];
  199|  46.2k|    index += 0x10;              /* output index has AC bit set */
  200|  46.2k|  } else {
  201|  35.0k|    htbl = cinfo->dc_huff_tbl_ptrs[index];
  202|  35.0k|  }
  203|       |
  204|  81.2k|  if (htbl == NULL)
  ------------------
  |  Branch (204:7): [True: 0, False: 81.2k]
  ------------------
  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|  81.2k|  if (!htbl->sent_table) {
  ------------------
  |  Branch (207:7): [True: 62.4k, False: 18.8k]
  ------------------
  208|  62.4k|    emit_marker(cinfo, M_DHT);
  209|       |
  210|  62.4k|    length = 0;
  211|  1.06M|    for (i = 1; i <= 16; i++)
  ------------------
  |  Branch (211:17): [True: 998k, False: 62.4k]
  ------------------
  212|   998k|      length += htbl->bits[i];
  213|       |
  214|  62.4k|    emit_2bytes(cinfo, length + 2 + 1 + 16);
  215|  62.4k|    emit_byte(cinfo, index);
  216|       |
  217|  1.06M|    for (i = 1; i <= 16; i++)
  ------------------
  |  Branch (217:17): [True: 998k, False: 62.4k]
  ------------------
  218|   998k|      emit_byte(cinfo, htbl->bits[i]);
  219|       |
  220|   629k|    for (i = 0; i < length; i++)
  ------------------
  |  Branch (220:17): [True: 567k, False: 62.4k]
  ------------------
  221|   567k|      emit_byte(cinfo, htbl->huffval[i]);
  222|       |
  223|  62.4k|    htbl->sent_table = TRUE;
  ------------------
  |  |  210|  62.4k|#define TRUE    1
  ------------------
  224|  62.4k|  }
  225|  81.2k|}
jcmarker.c:emit_dri:
  280|  6.15k|{
  281|  6.15k|  emit_marker(cinfo, M_DRI);
  282|       |
  283|  6.15k|  emit_2bytes(cinfo, 4);        /* fixed length */
  284|       |
  285|  6.15k|  emit_2bytes(cinfo, (int)cinfo->restart_interval);
  286|  6.15k|}
jcmarker.c:emit_sos:
  322|  93.3k|{
  323|  93.3k|  int i, td, ta;
  324|  93.3k|  jpeg_component_info *compptr;
  325|       |
  326|  93.3k|  emit_marker(cinfo, M_SOS);
  327|       |
  328|  93.3k|  emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
  329|       |
  330|  93.3k|  emit_byte(cinfo, cinfo->comps_in_scan);
  331|       |
  332|   230k|  for (i = 0; i < cinfo->comps_in_scan; i++) {
  ------------------
  |  Branch (332:15): [True: 136k, False: 93.3k]
  ------------------
  333|   136k|    compptr = cinfo->cur_comp_info[i];
  334|   136k|    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|   136k|    td = cinfo->Ss == 0 && cinfo->Ah == 0 ? compptr->dc_tbl_no : 0;
  ------------------
  |  Branch (341:10): [True: 72.5k, False: 64.1k]
  |  Branch (341:28): [True: 56.5k, False: 16.0k]
  ------------------
  342|       |    /* AC needs no table when not present */
  343|   136k|    ta = cinfo->Se ? compptr->ac_tbl_no : 0;
  ------------------
  |  Branch (343:10): [True: 104k, False: 32.0k]
  ------------------
  344|       |
  345|   136k|    emit_byte(cinfo, (td << 4) + ta);
  346|   136k|  }
  347|       |
  348|  93.3k|  emit_byte(cinfo, cinfo->Ss);
  349|  93.3k|  emit_byte(cinfo, cinfo->Se);
  350|  93.3k|  emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al);
  351|  93.3k|}
jcmarker.c:write_file_trailer:
  609|  22.3k|{
  610|  22.3k|  emit_marker(cinfo, M_EOI);
  611|  22.3k|}
jcmarker.c:write_marker_header:
  446|  18.8k|{
  447|  18.8k|  if (datalen > (unsigned int)65533)            /* safety check */
  ------------------
  |  Branch (447:7): [True: 0, False: 18.8k]
  ------------------
  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|  18.8k|  emit_marker(cinfo, (JPEG_MARKER)marker);
  451|       |
  452|  18.8k|  emit_2bytes(cinfo, (int)(datalen + 2));       /* total length */
  453|  18.8k|}
jcmarker.c:write_marker_byte:
  458|   865k|{
  459|   865k|  emit_byte(cinfo, val);
  460|   865k|}

jinit_c_master_control:
  722|  22.3k|{
  723|  22.3k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  724|  22.3k|  boolean empty_huff_tables = TRUE;
  ------------------
  |  |  210|  22.3k|#define TRUE    1
  ------------------
  725|  22.3k|  int i;
  726|       |
  727|       |#ifdef WITH_PROFILE
  728|       |  master->pub.total_start = getTime();
  729|       |#endif
  730|       |
  731|  22.3k|  master->pub.prepare_for_pass = prepare_for_pass;
  732|  22.3k|  master->pub.pass_startup = pass_startup;
  733|  22.3k|  master->pub.finish_pass = finish_pass_master;
  734|  22.3k|  master->pub.is_last_pass = FALSE;
  ------------------
  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  ------------------
  735|       |
  736|  22.3k|  if (cinfo->scan_info != NULL) {
  ------------------
  |  Branch (736:7): [True: 6.80k, False: 15.5k]
  ------------------
  737|  6.80k|#ifdef NEED_SCAN_SCRIPT
  738|  6.80k|    validate_script(cinfo);
  739|       |#else
  740|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  741|       |#endif
  742|  15.5k|  } else {
  743|  15.5k|    cinfo->progressive_mode = FALSE;
  ------------------
  |  |  207|  15.5k|#define FALSE   0               /* values of boolean */
  ------------------
  744|  15.5k|    cinfo->num_scans = 1;
  745|  15.5k|  }
  746|       |
  747|  22.3k|#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|  22.3k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (753:7): [True: 0, False: 22.3k]
  ------------------
  754|      0|    int ci;
  755|      0|    jpeg_component_info *compptr;
  756|       |
  757|      0|    cinfo->raw_data_in = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  758|      0|    cinfo->smoothing_factor = 0;
  759|      0|    jpeg_default_colorspace(cinfo);
  760|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (760:46): [True: 0, False: 0]
  ------------------
  761|      0|         ci++, compptr++)
  762|      0|      compptr->h_samp_factor = compptr->v_samp_factor = 1;
  763|      0|  }
  764|  22.3k|#endif
  765|       |
  766|       |  /* Validate parameters, determine derived values */
  767|  22.3k|  initial_setup(cinfo, transcode_only);
  768|       |
  769|  22.3k|  if (cinfo->arith_code)
  ------------------
  |  Branch (769:7): [True: 6.15k, False: 16.2k]
  ------------------
  770|  6.15k|    cinfo->optimize_coding = FALSE;
  ------------------
  |  |  207|  6.15k|#define FALSE   0               /* values of boolean */
  ------------------
  771|  16.2k|  else {
  772|  16.2k|    if (cinfo->master->lossless ||      /*  TEMPORARY HACK ??? */
  ------------------
  |  Branch (772:9): [True: 0, False: 16.2k]
  ------------------
  773|  16.2k|        cinfo->progressive_mode)
  ------------------
  |  Branch (773:9): [True: 3.73k, False: 12.4k]
  ------------------
  774|  3.73k|      cinfo->optimize_coding = TRUE; /* assume default tables no good for
  ------------------
  |  |  210|  3.73k|#define TRUE    1
  ------------------
  775|       |                                        progressive mode or lossless mode */
  776|  16.2k|    for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  16.2k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (776:17): [True: 16.2k, False: 0]
  ------------------
  777|  16.2k|      if (cinfo->dc_huff_tbl_ptrs[i] != NULL ||
  ------------------
  |  Branch (777:11): [True: 16.2k, False: 0]
  ------------------
  778|  16.2k|          cinfo->ac_huff_tbl_ptrs[i] != NULL) {
  ------------------
  |  Branch (778:11): [True: 0, False: 0]
  ------------------
  779|  16.2k|        empty_huff_tables = FALSE;
  ------------------
  |  |  207|  16.2k|#define FALSE   0               /* values of boolean */
  ------------------
  780|  16.2k|        break;
  781|  16.2k|      }
  782|  16.2k|    }
  783|  16.2k|    if (cinfo->data_precision == 12 && !cinfo->optimize_coding &&
  ------------------
  |  Branch (783:9): [True: 16.2k, False: 0]
  |  Branch (783:40): [True: 0, False: 16.2k]
  ------------------
  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|  16.2k|  }
  788|       |
  789|       |  /* Initialize my private state */
  790|  22.3k|  if (transcode_only) {
  ------------------
  |  Branch (790:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  } else {
  797|       |    /* for normal compression, first pass is always this type: */
  798|  22.3k|    master->pass_type = main_pass;
  799|  22.3k|  }
  800|  22.3k|  master->scan_number = 0;
  801|  22.3k|  master->pass_number = 0;
  802|  22.3k|  if (cinfo->optimize_coding)
  ------------------
  |  Branch (802:7): [True: 16.2k, False: 6.15k]
  ------------------
  803|  16.2k|    master->total_passes = cinfo->num_scans * 2;
  804|  6.15k|  else
  805|  6.15k|    master->total_passes = cinfo->num_scans;
  806|       |
  807|  22.3k|  master->jpeg_version = PACKAGE_NAME " version " VERSION " (build " BUILD ")";
  ------------------
  |  |   17|  22.3k|#define PACKAGE_NAME  "libjpeg-turbo"
  ------------------
  808|  22.3k|}
jcmaster.c:prepare_for_pass:
  579|   124k|{
  580|   124k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  581|       |
  582|   124k|  switch (master->pass_type) {
  583|  22.3k|  case main_pass:
  ------------------
  |  Branch (583:3): [True: 22.3k, False: 102k]
  ------------------
  584|       |    /* Initial pass: will collect input data, and do either Huffman
  585|       |     * optimization or data output for the first scan.
  586|       |     */
  587|  22.3k|    select_scan_parameters(cinfo);
  588|  22.3k|    per_scan_setup(cinfo);
  589|  22.3k|    if (!cinfo->raw_data_in) {
  ------------------
  |  Branch (589:9): [True: 22.3k, False: 0]
  ------------------
  590|  22.3k|      (*cinfo->cconvert->start_pass) (cinfo);
  591|  22.3k|      (*cinfo->downsample->start_pass) (cinfo);
  592|  22.3k|      (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU);
  593|  22.3k|    }
  594|  22.3k|    (*cinfo->fdct->start_pass) (cinfo);
  595|  22.3k|    (*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding);
  596|  22.3k|    (*cinfo->coef->start_pass) (cinfo,
  597|  22.3k|                                (master->total_passes > 1 ?
  ------------------
  |  Branch (597:34): [True: 19.2k, False: 3.07k]
  ------------------
  598|  19.2k|                                 JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
  599|  22.3k|    (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
  600|  22.3k|    if (cinfo->optimize_coding) {
  ------------------
  |  Branch (600:9): [True: 16.2k, False: 6.15k]
  ------------------
  601|       |      /* No immediate data output; postpone writing frame/scan headers */
  602|  16.2k|      master->pub.call_pass_startup = FALSE;
  ------------------
  |  |  207|  16.2k|#define FALSE   0               /* values of boolean */
  ------------------
  603|  16.2k|    } else {
  604|       |      /* Will write frame/scan headers at first jpeg_write_scanlines call */
  605|  6.15k|      master->pub.call_pass_startup = TRUE;
  ------------------
  |  |  210|  6.15k|#define TRUE    1
  ------------------
  606|  6.15k|    }
  607|  22.3k|    break;
  608|      0|#ifdef ENTROPY_OPT_SUPPORTED
  609|  18.6k|  case huff_opt_pass:
  ------------------
  |  Branch (609:3): [True: 18.6k, False: 105k]
  ------------------
  610|       |    /* Do Huffman optimization for a scan after the first one. */
  611|  18.6k|    select_scan_parameters(cinfo);
  612|  18.6k|    per_scan_setup(cinfo);
  613|  18.6k|    if (cinfo->Ss != 0 || cinfo->Ah == 0 || cinfo->arith_code ||
  ------------------
  |  Branch (613:9): [True: 14.9k, False: 3.73k]
  |  Branch (613:27): [True: 0, False: 3.73k]
  |  Branch (613:45): [True: 0, False: 3.73k]
  ------------------
  614|  14.9k|        cinfo->master->lossless) {
  ------------------
  |  Branch (614:9): [True: 0, False: 3.73k]
  ------------------
  615|  14.9k|      (*cinfo->entropy->start_pass) (cinfo, TRUE);
  ------------------
  |  |  210|  14.9k|#define TRUE    1
  ------------------
  616|  14.9k|      (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
  617|  14.9k|      master->pub.call_pass_startup = FALSE;
  ------------------
  |  |  207|  14.9k|#define FALSE   0               /* values of boolean */
  ------------------
  618|  14.9k|      break;
  619|  14.9k|    }
  620|       |    /* Special case: Huffman DC refinement scans need no Huffman table
  621|       |     * and therefore we can skip the optimization pass for them.
  622|       |     */
  623|  3.73k|    master->pass_type = output_pass;
  624|  3.73k|    master->pass_number++;
  625|  3.73k|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|  3.73k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  626|  3.73k|#endif
  627|  87.1k|  case output_pass:
  ------------------
  |  Branch (627:3): [True: 83.4k, False: 41.0k]
  ------------------
  628|       |    /* Do a data-output pass. */
  629|       |    /* We need not repeat per-scan setup if prior optimization pass did it. */
  630|  87.1k|    if (!cinfo->optimize_coding) {
  ------------------
  |  Branch (630:9): [True: 52.3k, False: 34.8k]
  ------------------
  631|  52.3k|      select_scan_parameters(cinfo);
  632|  52.3k|      per_scan_setup(cinfo);
  633|  52.3k|    }
  634|  87.1k|    (*cinfo->entropy->start_pass) (cinfo, FALSE);
  ------------------
  |  |  207|  87.1k|#define FALSE   0               /* values of boolean */
  ------------------
  635|  87.1k|    (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
  636|       |    /* We emit frame/scan headers now */
  637|  87.1k|    if (master->scan_number == 0)
  ------------------
  |  Branch (637:9): [True: 16.2k, False: 70.9k]
  ------------------
  638|  16.2k|      (*cinfo->marker->write_frame_header) (cinfo);
  639|  87.1k|    (*cinfo->marker->write_scan_header) (cinfo);
  640|  87.1k|    master->pub.call_pass_startup = FALSE;
  ------------------
  |  |  207|  87.1k|#define FALSE   0               /* values of boolean */
  ------------------
  641|  87.1k|    break;
  642|      0|  default:
  ------------------
  |  Branch (642:3): [True: 0, False: 124k]
  ------------------
  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|   124k|  }
  645|       |
  646|   124k|  master->pub.is_last_pass = (master->pass_number == master->total_passes - 1);
  647|       |
  648|       |  /* Set up progress monitor's pass info if present */
  649|   124k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (649:7): [True: 0, False: 124k]
  ------------------
  650|      0|    cinfo->progress->completed_passes = master->pass_number;
  651|      0|    cinfo->progress->total_passes = master->total_passes;
  652|      0|  }
  653|   124k|}
jcmaster.c:select_scan_parameters:
  444|  93.3k|{
  445|  93.3k|  int ci;
  446|       |
  447|  93.3k|#ifdef NEED_SCAN_SCRIPT
  448|  93.3k|  if (cinfo->scan_info != NULL) {
  ------------------
  |  Branch (448:7): [True: 77.7k, False: 15.5k]
  ------------------
  449|       |    /* Prepare for current scan --- the script is already validated */
  450|  77.7k|    my_master_ptr master = (my_master_ptr)cinfo->master;
  451|  77.7k|    const jpeg_scan_info *scanptr = cinfo->scan_info + master->scan_number;
  452|       |
  453|  77.7k|    cinfo->comps_in_scan = scanptr->comps_in_scan;
  454|   174k|    for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
  ------------------
  |  Branch (454:18): [True: 96.2k, False: 77.7k]
  ------------------
  455|  96.2k|      cinfo->cur_comp_info[ci] =
  456|  96.2k|        &cinfo->comp_info[scanptr->component_index[ci]];
  457|  96.2k|    }
  458|  77.7k|    cinfo->Ss = scanptr->Ss;
  459|  77.7k|    cinfo->Se = scanptr->Se;
  460|  77.7k|    cinfo->Ah = scanptr->Ah;
  461|  77.7k|    cinfo->Al = scanptr->Al;
  462|  77.7k|  } else
  463|  15.5k|#endif
  464|  15.5k|  {
  465|       |    /* Prepare for single sequential-JPEG scan containing all components */
  466|  15.5k|    if (cinfo->num_components > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  15.5k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (466:9): [True: 0, False: 15.5k]
  ------------------
  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|  15.5k|               MAX_COMPS_IN_SCAN);
  469|  15.5k|    cinfo->comps_in_scan = cinfo->num_components;
  470|  56.0k|    for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (470:18): [True: 40.5k, False: 15.5k]
  ------------------
  471|  40.5k|      cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
  472|  40.5k|    }
  473|  15.5k|    if (!cinfo->master->lossless) {
  ------------------
  |  Branch (473:9): [True: 15.5k, False: 0]
  ------------------
  474|  15.5k|      cinfo->Ss = 0;
  475|  15.5k|      cinfo->Se = DCTSIZE2 - 1;
  ------------------
  |  |   67|  15.5k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  476|  15.5k|      cinfo->Ah = 0;
  477|  15.5k|      cinfo->Al = 0;
  478|  15.5k|    }
  479|  15.5k|  }
  480|  93.3k|}
jcmaster.c:per_scan_setup:
  487|  93.3k|{
  488|  93.3k|  int ci, mcublks, tmp;
  489|  93.3k|  jpeg_component_info *compptr;
  490|  93.3k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  93.3k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (490:19): [True: 0, False: 93.3k]
  ------------------
  491|       |
  492|  93.3k|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (492:7): [True: 74.6k, False: 18.6k]
  ------------------
  493|       |
  494|       |    /* Noninterleaved (single-component) scan */
  495|  74.6k|    compptr = cinfo->cur_comp_info[0];
  496|       |
  497|       |    /* Overall image size in MCUs */
  498|  74.6k|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  499|  74.6k|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  500|       |
  501|       |    /* For noninterleaved scan, always one block per MCU */
  502|  74.6k|    compptr->MCU_width = 1;
  503|  74.6k|    compptr->MCU_height = 1;
  504|  74.6k|    compptr->MCU_blocks = 1;
  505|  74.6k|    compptr->MCU_sample_width = data_unit;
  506|  74.6k|    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|  74.6k|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  511|  74.6k|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (511:9): [True: 54.4k, False: 20.2k]
  ------------------
  512|  74.6k|    compptr->last_row_height = tmp;
  513|       |
  514|       |    /* Prepare array describing MCU composition */
  515|  74.6k|    cinfo->blocks_in_MCU = 1;
  516|  74.6k|    cinfo->MCU_membership[0] = 0;
  517|       |
  518|  74.6k|  } else {
  519|       |
  520|       |    /* Interleaved (multi-component) scan */
  521|  18.6k|    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  18.6k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (521:9): [True: 0, False: 18.6k]
  |  Branch (521:38): [True: 0, False: 18.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|  18.6k|               MAX_COMPS_IN_SCAN);
  524|       |
  525|       |    /* Overall image size in MCUs */
  526|  18.6k|    cinfo->MCUs_per_row = (JDIMENSION)
  527|  18.6k|      jdiv_round_up((long)cinfo->_jpeg_width,
  ------------------
  |  |   30|  18.6k|#define _jpeg_width  image_width
  ------------------
  528|  18.6k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  529|  18.6k|    cinfo->MCU_rows_in_scan = (JDIMENSION)
  530|  18.6k|      jdiv_round_up((long)cinfo->_jpeg_height,
  ------------------
  |  |   31|  18.6k|#define _jpeg_height  image_height
  ------------------
  531|  18.6k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  532|       |
  533|  18.6k|    cinfo->blocks_in_MCU = 0;
  534|       |
  535|  80.6k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (535:18): [True: 62.0k, False: 18.6k]
  ------------------
  536|  62.0k|      compptr = cinfo->cur_comp_info[ci];
  537|       |      /* Sampling factors give # of blocks of component in each MCU */
  538|  62.0k|      compptr->MCU_width = compptr->h_samp_factor;
  539|  62.0k|      compptr->MCU_height = compptr->v_samp_factor;
  540|  62.0k|      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
  541|  62.0k|      compptr->MCU_sample_width = compptr->MCU_width * data_unit;
  542|       |      /* Figure number of non-dummy blocks in last MCU column & row */
  543|  62.0k|      tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
  544|  62.0k|      if (tmp == 0) tmp = compptr->MCU_width;
  ------------------
  |  Branch (544:11): [True: 53.9k, False: 8.07k]
  ------------------
  545|  62.0k|      compptr->last_col_width = tmp;
  546|  62.0k|      tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
  547|  62.0k|      if (tmp == 0) tmp = compptr->MCU_height;
  ------------------
  |  Branch (547:11): [True: 49.3k, False: 12.6k]
  ------------------
  548|  62.0k|      compptr->last_row_height = tmp;
  549|       |      /* Prepare array describing MCU composition */
  550|  62.0k|      mcublks = compptr->MCU_blocks;
  551|  62.0k|      if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU)
  ------------------
  |  |   80|  62.0k|#define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on data units/MCU */
  ------------------
  |  Branch (551:11): [True: 0, False: 62.0k]
  ------------------
  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|   158k|      while (mcublks-- > 0) {
  ------------------
  |  Branch (553:14): [True: 95.9k, False: 62.0k]
  ------------------
  554|  95.9k|        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
  555|  95.9k|      }
  556|  62.0k|    }
  557|       |
  558|  18.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|  93.3k|  if (cinfo->restart_in_rows > 0) {
  ------------------
  |  Branch (562:7): [True: 58.4k, False: 34.8k]
  ------------------
  563|  58.4k|    long nominal = (long)cinfo->restart_in_rows * (long)cinfo->MCUs_per_row;
  564|  58.4k|    cinfo->restart_interval = (unsigned int)MIN(nominal, 65535L);
  ------------------
  |  |  515|  58.4k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 58.4k, False: 0]
  |  |  ------------------
  ------------------
  565|  58.4k|  }
  566|  93.3k|}
jcmaster.c:pass_startup:
  668|  6.15k|{
  669|  6.15k|  cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */
  ------------------
  |  |  207|  6.15k|#define FALSE   0               /* values of boolean */
  ------------------
  670|       |
  671|  6.15k|  (*cinfo->marker->write_frame_header) (cinfo);
  672|  6.15k|  (*cinfo->marker->write_scan_header) (cinfo);
  673|  6.15k|}
jcmaster.c:finish_pass_master:
  682|   124k|{
  683|   124k|  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|   124k|  (*cinfo->entropy->finish_pass) (cinfo);
  689|       |
  690|       |  /* Update state for next pass */
  691|   124k|  switch (master->pass_type) {
  ------------------
  |  Branch (691:11): [True: 124k, False: 0]
  ------------------
  692|  22.3k|  case main_pass:
  ------------------
  |  Branch (692:3): [True: 22.3k, False: 102k]
  ------------------
  693|       |    /* next pass is either output of scan 0 (after optimization)
  694|       |     * or output of scan 1 (if no optimization).
  695|       |     */
  696|  22.3k|    master->pass_type = output_pass;
  697|  22.3k|    if (!cinfo->optimize_coding)
  ------------------
  |  Branch (697:9): [True: 6.15k, False: 16.2k]
  ------------------
  698|  6.15k|      master->scan_number++;
  699|  22.3k|    break;
  700|  14.9k|  case huff_opt_pass:
  ------------------
  |  Branch (700:3): [True: 14.9k, False: 109k]
  ------------------
  701|       |    /* next pass is always output of current scan */
  702|  14.9k|    master->pass_type = output_pass;
  703|  14.9k|    break;
  704|  87.1k|  case output_pass:
  ------------------
  |  Branch (704:3): [True: 87.1k, False: 37.2k]
  ------------------
  705|       |    /* next pass is either optimization or output of next scan */
  706|  87.1k|    if (cinfo->optimize_coding)
  ------------------
  |  Branch (706:9): [True: 34.8k, False: 52.3k]
  ------------------
  707|  34.8k|      master->pass_type = huff_opt_pass;
  708|  87.1k|    master->scan_number++;
  709|  87.1k|    break;
  710|   124k|  }
  711|       |
  712|   124k|  master->pass_number++;
  713|   124k|}
jcmaster.c:validate_script:
  280|  6.80k|{
  281|  6.80k|  const jpeg_scan_info *scanptr;
  282|  6.80k|  int scanno, ncomps, ci, thisi;
  283|  6.80k|  int Ss, Se, Ah, Al;
  284|  6.80k|  boolean component_sent[MAX_COMPONENTS];
  285|  6.80k|#ifdef C_PROGRESSIVE_SUPPORTED
  286|  6.80k|  int coefi, *last_bitpos_ptr;
  287|  6.80k|  int last_bitpos[MAX_COMPONENTS][DCTSIZE2];
  288|       |  /* -1 until that coefficient has been seen; then last Al for it */
  289|  6.80k|#endif
  290|       |
  291|  6.80k|  if (cinfo->num_scans <= 0)
  ------------------
  |  Branch (291:7): [True: 0, False: 6.80k]
  ------------------
  292|      0|    ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 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)))
  ------------------
  293|       |
  294|       |#ifndef C_MULTISCAN_FILES_SUPPORTED
  295|       |  if (cinfo->num_scans > 1)
  296|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  297|       |#endif
  298|       |
  299|  6.80k|  scanptr = cinfo->scan_info;
  300|  6.80k|  if (scanptr->Ss != 0 && scanptr->Se == 0) {
  ------------------
  |  Branch (300:7): [True: 0, False: 6.80k]
  |  Branch (300:27): [True: 0, False: 0]
  ------------------
  301|      0|#ifdef C_LOSSLESS_SUPPORTED
  302|      0|    cinfo->master->lossless = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  303|      0|    cinfo->progressive_mode = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  304|      0|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (304:18): [True: 0, False: 0]
  ------------------
  305|      0|      component_sent[ci] = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  306|       |#else
  307|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  308|       |#endif
  309|      0|  }
  310|       |  /* For sequential JPEG, all scans must have Ss=0, Se=DCTSIZE2-1;
  311|       |   * for progressive JPEG, no scan can have this.
  312|       |   */
  313|  6.80k|  else if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2 - 1) {
  ------------------
  |  |   67|  6.80k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (313:12): [True: 0, False: 6.80k]
  |  Branch (313:32): [True: 6.80k, False: 0]
  ------------------
  314|  6.80k|#ifdef C_PROGRESSIVE_SUPPORTED
  315|  6.80k|    cinfo->progressive_mode = TRUE;
  ------------------
  |  |  210|  6.80k|#define TRUE    1
  ------------------
  316|  6.80k|    cinfo->master->lossless = FALSE;
  ------------------
  |  |  207|  6.80k|#define FALSE   0               /* values of boolean */
  ------------------
  317|  6.80k|    last_bitpos_ptr = &last_bitpos[0][0];
  318|  22.8k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (318:18): [True: 16.0k, False: 6.80k]
  ------------------
  319|  1.04M|      for (coefi = 0; coefi < DCTSIZE2; coefi++)
  ------------------
  |  |   67|  1.04M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (319:23): [True: 1.02M, False: 16.0k]
  ------------------
  320|  1.02M|        *last_bitpos_ptr++ = -1;
  321|       |#else
  322|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  323|       |#endif
  324|  6.80k|  } else {
  325|      0|    cinfo->progressive_mode = cinfo->master->lossless = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  326|      0|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (326:18): [True: 0, False: 0]
  ------------------
  327|      0|      component_sent[ci] = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  328|      0|  }
  329|       |
  330|  84.5k|  for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) {
  ------------------
  |  Branch (330:20): [True: 77.7k, False: 6.80k]
  ------------------
  331|       |    /* Validate component indexes */
  332|  77.7k|    ncomps = scanptr->comps_in_scan;
  333|  77.7k|    if (ncomps <= 0 || ncomps > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  77.7k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (333:9): [True: 0, False: 77.7k]
  |  Branch (333:24): [True: 0, False: 77.7k]
  ------------------
  334|      0|      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_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)))
  ------------------
  335|   174k|    for (ci = 0; ci < ncomps; ci++) {
  ------------------
  |  Branch (335:18): [True: 96.2k, False: 77.7k]
  ------------------
  336|  96.2k|      thisi = scanptr->component_index[ci];
  337|  96.2k|      if (thisi < 0 || thisi >= cinfo->num_components)
  ------------------
  |  Branch (337:11): [True: 0, False: 96.2k]
  |  Branch (337:24): [True: 0, False: 96.2k]
  ------------------
  338|      0|        ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
  ------------------
  |  |  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)))
  ------------------
  339|       |      /* Components must appear in SOF order within each scan */
  340|  96.2k|      if (ci > 0 && thisi <= scanptr->component_index[ci - 1])
  ------------------
  |  Branch (340:11): [True: 18.4k, False: 77.7k]
  |  Branch (340:21): [True: 0, False: 18.4k]
  ------------------
  341|      0|        ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
  ------------------
  |  |  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)))
  ------------------
  342|  96.2k|    }
  343|       |    /* Validate progression parameters */
  344|  77.7k|    Ss = scanptr->Ss;
  345|  77.7k|    Se = scanptr->Se;
  346|  77.7k|    Ah = scanptr->Ah;
  347|  77.7k|    Al = scanptr->Al;
  348|  77.7k|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (348:9): [True: 77.7k, False: 0]
  ------------------
  349|  77.7k|#ifdef C_PROGRESSIVE_SUPPORTED
  350|       |      /* Rec. ITU-T T.81 | ISO/IEC 10918-1 simply gives the ranges 0..13 for Ah
  351|       |       * and Al, but that seems wrong: the upper bound ought to depend on data
  352|       |       * precision.  Perhaps they really meant 0..N+1 for N-bit precision.
  353|       |       * Here we allow 0..10 for 8-bit data; Al larger than 10 results in
  354|       |       * out-of-range reconstructed DC values during the first DC scan,
  355|       |       * which might cause problems for some decoders.
  356|       |       */
  357|  77.7k|      int max_Ah_Al = cinfo->data_precision == 12 ? 13 : 10;
  ------------------
  |  Branch (357:23): [True: 77.7k, False: 0]
  ------------------
  358|       |
  359|  77.7k|      if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
  ------------------
  |  |   67|   155k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
                    if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
  ------------------
  |  |   67|   155k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (359:11): [True: 0, False: 77.7k]
  |  Branch (359:21): [True: 0, False: 77.7k]
  |  Branch (359:39): [True: 0, False: 77.7k]
  |  Branch (359:50): [True: 0, False: 77.7k]
  ------------------
  360|  77.7k|          Ah < 0 || Ah > max_Ah_Al || Al < 0 || Al > max_Ah_Al)
  ------------------
  |  Branch (360:11): [True: 0, False: 77.7k]
  |  Branch (360:21): [True: 0, False: 77.7k]
  |  Branch (360:39): [True: 0, False: 77.7k]
  |  Branch (360:49): [True: 0, False: 77.7k]
  ------------------
  361|      0|        ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  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)))
  ------------------
  362|  77.7k|      if (Ss == 0) {
  ------------------
  |  Branch (362:11): [True: 13.6k, False: 64.1k]
  ------------------
  363|  13.6k|        if (Se != 0)            /* DC and AC together not OK */
  ------------------
  |  Branch (363:13): [True: 0, False: 13.6k]
  ------------------
  364|      0|          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  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)))
  ------------------
  365|  64.1k|      } else {
  366|  64.1k|        if (ncomps != 1)        /* AC scans must be for only one component */
  ------------------
  |  Branch (366:13): [True: 0, False: 64.1k]
  ------------------
  367|      0|          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  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)))
  ------------------
  368|  64.1k|      }
  369|   174k|      for (ci = 0; ci < ncomps; ci++) {
  ------------------
  |  Branch (369:20): [True: 96.2k, False: 77.7k]
  ------------------
  370|  96.2k|        last_bitpos_ptr = &last_bitpos[scanptr->component_index[ci]][0];
  371|  96.2k|        if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (371:13): [True: 64.1k, False: 32.0k]
  |  Branch (371:24): [True: 0, False: 64.1k]
  ------------------
  372|      0|          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  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)))
  ------------------
  373|  3.15M|        for (coefi = Ss; coefi <= Se; coefi++) {
  ------------------
  |  Branch (373:26): [True: 3.06M, False: 96.2k]
  ------------------
  374|  3.06M|          if (last_bitpos_ptr[coefi] < 0) {
  ------------------
  |  Branch (374:15): [True: 1.02M, False: 2.03M]
  ------------------
  375|       |            /* first scan of this coefficient */
  376|  1.02M|            if (Ah != 0)
  ------------------
  |  Branch (376:17): [True: 0, False: 1.02M]
  ------------------
  377|      0|              ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  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)))
  ------------------
  378|  2.03M|          } else {
  379|       |            /* not first scan */
  380|  2.03M|            if (Ah != last_bitpos_ptr[coefi] || Al != Ah - 1)
  ------------------
  |  Branch (380:17): [True: 0, False: 2.03M]
  |  Branch (380:49): [True: 0, False: 2.03M]
  ------------------
  381|      0|              ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  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)))
  ------------------
  382|  2.03M|          }
  383|  3.06M|          last_bitpos_ptr[coefi] = Al;
  384|  3.06M|        }
  385|  96.2k|      }
  386|  77.7k|#endif
  387|  77.7k|    } else {
  388|      0|#ifdef C_LOSSLESS_SUPPORTED
  389|      0|      if (cinfo->master->lossless) {
  ------------------
  |  Branch (389:11): [True: 0, False: 0]
  ------------------
  390|       |        /* The JPEG spec simply gives the range 0..15 for Al (Pt), but that
  391|       |         * seems wrong: the upper bound ought to depend on data precision.
  392|       |         * Perhaps they really meant 0..N-1 for N-bit precision, which is what
  393|       |         * we allow here.  Values greater than or equal to the data precision
  394|       |         * will result in a blank image.
  395|       |         */
  396|      0|        if (Ss < 1 || Ss > 7 ||         /* predictor selection value */
  ------------------
  |  Branch (396:13): [True: 0, False: 0]
  |  Branch (396:23): [True: 0, False: 0]
  ------------------
  397|      0|            Se != 0 || Ah != 0 ||
  ------------------
  |  Branch (397:13): [True: 0, False: 0]
  |  Branch (397:24): [True: 0, False: 0]
  ------------------
  398|      0|            Al < 0 || Al >= cinfo->data_precision) /* point transform */
  ------------------
  |  Branch (398:13): [True: 0, False: 0]
  |  Branch (398:23): [True: 0, False: 0]
  ------------------
  399|      0|          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  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)))
  ------------------
  400|      0|      } else
  401|      0|#endif
  402|      0|      {
  403|       |        /* For sequential JPEG, all progression parameters must be these: */
  404|      0|        if (Ss != 0 || Se != DCTSIZE2 - 1 || Ah != 0 || Al != 0)
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (404:13): [True: 0, False: 0]
  |  Branch (404:24): [True: 0, False: 0]
  |  Branch (404:46): [True: 0, False: 0]
  |  Branch (404:57): [True: 0, False: 0]
  ------------------
  405|      0|          ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
  ------------------
  |  |  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)))
  ------------------
  406|      0|      }
  407|       |      /* Make sure components are not sent twice */
  408|      0|      for (ci = 0; ci < ncomps; ci++) {
  ------------------
  |  Branch (408:20): [True: 0, False: 0]
  ------------------
  409|      0|        thisi = scanptr->component_index[ci];
  410|      0|        if (component_sent[thisi])
  ------------------
  |  Branch (410:13): [True: 0, False: 0]
  ------------------
  411|      0|          ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
  ------------------
  |  |  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)))
  ------------------
  412|      0|        component_sent[thisi] = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  413|      0|      }
  414|      0|    }
  415|  77.7k|  }
  416|       |
  417|       |  /* Now verify that everything got sent. */
  418|  6.80k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (418:7): [True: 6.80k, False: 0]
  ------------------
  419|  6.80k|#ifdef C_PROGRESSIVE_SUPPORTED
  420|       |    /* For progressive mode, we only check that at least some DC data
  421|       |     * got sent for each component; the spec does not require that all bits
  422|       |     * of all coefficients be transmitted.  Would it be wiser to enforce
  423|       |     * transmission of all coefficient bits??
  424|       |     */
  425|  22.8k|    for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (425:18): [True: 16.0k, False: 6.80k]
  ------------------
  426|  16.0k|      if (last_bitpos[ci][0] < 0)
  ------------------
  |  Branch (426:11): [True: 0, False: 16.0k]
  ------------------
  427|      0|        ERREXIT(cinfo, JERR_MISSING_DATA);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  428|  16.0k|    }
  429|  6.80k|#endif
  430|  6.80k|  } else {
  431|      0|    for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (431:18): [True: 0, False: 0]
  ------------------
  432|      0|      if (!component_sent[ci])
  ------------------
  |  Branch (432:11): [True: 0, False: 0]
  ------------------
  433|      0|        ERREXIT(cinfo, JERR_MISSING_DATA);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  434|      0|    }
  435|      0|  }
  436|  6.80k|}
jcmaster.c:initial_setup:
  166|  22.3k|{
  167|  22.3k|  int ci;
  168|  22.3k|  jpeg_component_info *compptr;
  169|  22.3k|  long samplesperrow;
  170|  22.3k|  JDIMENSION jd_samplesperrow;
  171|  22.3k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  22.3k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (171:19): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 ||
  ------------------
  |  |   31|  22.3k|#define _jpeg_height  image_height
  ------------------
                if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 ||
  ------------------
  |  |   30|  22.3k|#define _jpeg_width  image_width
  ------------------
  |  Branch (181:7): [True: 0, False: 22.3k]
  |  Branch (181:35): [True: 0, False: 22.3k]
  ------------------
  182|  22.3k|      cinfo->num_components <= 0 || cinfo->input_components <= 0)
  ------------------
  |  Branch (182:7): [True: 0, False: 22.3k]
  |  Branch (182:37): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  if ((long)cinfo->_jpeg_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |   31|  22.3k|#define _jpeg_height  image_height
  ------------------
                if ((long)cinfo->_jpeg_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  158|  44.7k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (186:7): [True: 0, False: 22.3k]
  ------------------
  187|  22.3k|      (long)cinfo->_jpeg_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |   30|  22.3k|#define _jpeg_width  image_width
  ------------------
                    (long)cinfo->_jpeg_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  22.3k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (187:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  samplesperrow = (long)cinfo->image_width * (long)cinfo->input_components;
  192|  22.3k|  jd_samplesperrow = (JDIMENSION)samplesperrow;
  193|  22.3k|  if ((long)jd_samplesperrow != samplesperrow)
  ------------------
  |  Branch (193:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|#ifdef C_LOSSLESS_SUPPORTED
  200|  22.3k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (200:7): [True: 0, False: 22.3k]
  ------------------
  201|      0|    if (cinfo->data_precision < 2 || cinfo->data_precision > 16)
  ------------------
  |  Branch (201:9): [True: 0, False: 0]
  |  Branch (201:38): [True: 0, False: 0]
  ------------------
  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|      0|  } else
  204|  22.3k|#endif
  205|  22.3k|  {
  206|  22.3k|    if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
  ------------------
  |  Branch (206:9): [True: 22.3k, False: 0]
  |  Branch (206:39): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  }
  209|       |
  210|       |  /* Check that number of components won't exceed internal array sizes */
  211|  22.3k|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   30|  22.3k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (211:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|             MAX_COMPONENTS);
  214|       |
  215|       |  /* Compute maximum sampling factors; check factor validity */
  216|  22.3k|  cinfo->max_h_samp_factor = 1;
  217|  22.3k|  cinfo->max_v_samp_factor = 1;
  218|  78.9k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (218:44): [True: 56.5k, False: 22.3k]
  ------------------
  219|  56.5k|       ci++, compptr++) {
  220|  56.5k|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (220:9): [True: 0, False: 56.5k]
  ------------------
  221|  56.5k|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   72|   113k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (221:9): [True: 0, False: 56.5k]
  ------------------
  222|  56.5k|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (222:9): [True: 0, False: 56.5k]
  ------------------
  223|  56.5k|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   72|  56.5k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (223:9): [True: 0, False: 56.5k]
  ------------------
  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|  56.5k|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  513|  56.5k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 18.6k, False: 37.9k]
  |  |  ------------------
  ------------------
  226|  56.5k|                                   compptr->h_samp_factor);
  227|  56.5k|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  513|  56.5k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 12.3k, False: 44.2k]
  |  |  ------------------
  ------------------
  228|  56.5k|                                   compptr->v_samp_factor);
  229|  56.5k|  }
  230|       |
  231|       |  /* Compute dimensions of components */
  232|  78.9k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (232:44): [True: 56.5k, False: 22.3k]
  ------------------
  233|  56.5k|       ci++, compptr++) {
  234|       |    /* Fill in the correct component_index value; don't rely on application */
  235|  56.5k|    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|  56.5k|    compptr->DCT_scaled_size = data_unit;
  241|  56.5k|#endif
  242|       |    /* Size in data units */
  243|  56.5k|    compptr->width_in_blocks = (JDIMENSION)
  244|  56.5k|      jdiv_round_up((long)cinfo->_jpeg_width * (long)compptr->h_samp_factor,
  ------------------
  |  |   30|  56.5k|#define _jpeg_width  image_width
  ------------------
  245|  56.5k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  246|  56.5k|    compptr->height_in_blocks = (JDIMENSION)
  247|  56.5k|      jdiv_round_up((long)cinfo->_jpeg_height * (long)compptr->v_samp_factor,
  ------------------
  |  |   31|  56.5k|#define _jpeg_height  image_height
  ------------------
  248|  56.5k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  249|       |    /* Size in samples */
  250|  56.5k|    compptr->downsampled_width = (JDIMENSION)
  251|  56.5k|      jdiv_round_up((long)cinfo->_jpeg_width * (long)compptr->h_samp_factor,
  ------------------
  |  |   30|  56.5k|#define _jpeg_width  image_width
  ------------------
  252|  56.5k|                    (long)cinfo->max_h_samp_factor);
  253|  56.5k|    compptr->downsampled_height = (JDIMENSION)
  254|  56.5k|      jdiv_round_up((long)cinfo->_jpeg_height * (long)compptr->v_samp_factor,
  ------------------
  |  |   31|  56.5k|#define _jpeg_height  image_height
  ------------------
  255|  56.5k|                    (long)cinfo->max_v_samp_factor);
  256|       |    /* Mark component needed (this flag isn't actually used for compression) */
  257|  56.5k|    compptr->component_needed = TRUE;
  ------------------
  |  |  210|  56.5k|#define TRUE    1
  ------------------
  258|  56.5k|  }
  259|       |
  260|       |  /* Compute number of fully interleaved MCU rows (number of times that
  261|       |   * main controller will call coefficient or difference controller).
  262|       |   */
  263|  22.3k|  cinfo->total_iMCU_rows = (JDIMENSION)
  264|  22.3k|    jdiv_round_up((long)cinfo->_jpeg_height,
  ------------------
  |  |   31|  22.3k|#define _jpeg_height  image_height
  ------------------
  265|  22.3k|                  (long)(cinfo->max_v_samp_factor * data_unit));
  266|  22.3k|}

jpeg_abort:
   37|  22.3k|{
   38|  22.3k|  int pool;
   39|       |
   40|       |  /* Do nothing if called on a not-initialized or destroyed JPEG object. */
   41|  22.3k|  if (cinfo->mem == NULL)
  ------------------
  |  Branch (41:7): [True: 0, False: 22.3k]
  ------------------
   42|      0|    return;
   43|       |
   44|       |  /* Releasing pools in reverse order might help avoid fragmentation
   45|       |   * with some (brain-damaged) malloc libraries.
   46|       |   */
   47|  44.7k|  for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  22.3k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  44.7k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (47:35): [True: 22.3k, False: 22.3k]
  ------------------
   48|  22.3k|    (*cinfo->mem->free_pool) (cinfo, pool);
   49|  22.3k|  }
   50|       |
   51|       |  /* Reset overall state for possible reuse of object */
   52|  22.3k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (52:7): [True: 0, False: 22.3k]
  ------------------
   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|  22.3k|  } else {
   60|  22.3k|    cinfo->global_state = CSTATE_START;
  ------------------
  |  |   44|  22.3k|#define CSTATE_START     100    /* after create_compress */
  ------------------
   61|  22.3k|  }
   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|  22.3k|}
jpeg_destroy:
   90|  56.7k|{
   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|  56.7k|  if (cinfo->mem != NULL)
  ------------------
  |  Branch (210:7): [True: 56.7k, False: 0]
  ------------------
  211|  56.7k|    (*cinfo->mem->self_destruct) (cinfo);
  212|       |  cinfo->mem = NULL;            /* be safe if jpeg_destroy is called twice */
  213|  56.7k|  cinfo->global_state = 0;      /* mark it destroyed */
  214|  56.7k|}
jpeg_alloc_quant_table:
  224|  7.83k|{
  225|  7.83k|  JQUANT_TBL *tbl;
  226|       |
  227|  7.83k|  tbl = (JQUANT_TBL *)
  228|  7.83k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JQUANT_TBL));
  ------------------
  |  |  888|  7.83k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  229|  7.83k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  207|  7.83k|#define FALSE   0               /* values of boolean */
  ------------------
  230|  7.83k|  return tbl;
  231|  7.83k|}
jpeg_alloc_huff_table:
  236|  15.6k|{
  237|  15.6k|  JHUFF_TBL *tbl;
  238|       |
  239|  15.6k|  tbl = (JHUFF_TBL *)
  240|  15.6k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JHUFF_TBL));
  ------------------
  |  |  888|  15.6k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  241|  15.6k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  207|  15.6k|#define FALSE   0               /* values of boolean */
  ------------------
  242|  15.6k|  return tbl;
  243|  15.6k|}

jpeg_add_quant_table:
   38|  89.4k|{
   39|  89.4k|  JQUANT_TBL **qtblptr;
   40|  89.4k|  int i;
   41|  89.4k|  long temp;
   42|       |
   43|       |  /* Safety check to ensure start_compress not called yet. */
   44|  89.4k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  89.4k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (44:7): [True: 0, False: 89.4k]
  ------------------
   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|  89.4k|  if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS)
  ------------------
  |  |   68|  89.4k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (47:7): [True: 0, False: 89.4k]
  |  Branch (47:24): [True: 0, False: 89.4k]
  ------------------
   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|  89.4k|  qtblptr = &cinfo->quant_tbl_ptrs[which_tbl];
   51|       |
   52|  89.4k|  if (*qtblptr == NULL)
  ------------------
  |  Branch (52:7): [True: 7.83k, False: 81.6k]
  ------------------
   53|  7.83k|    *qtblptr = jpeg_alloc_quant_table((j_common_ptr)cinfo);
   54|       |
   55|  5.81M|  for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  5.81M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (55:15): [True: 5.72M, False: 89.4k]
  ------------------
   56|  5.72M|    temp = ((long)basic_table[i] * scale_factor + 50L) / 100L;
   57|       |    /* limit the values to the valid range */
   58|  5.72M|    if (temp <= 0L) temp = 1L;
  ------------------
  |  Branch (58:9): [True: 404k, False: 5.32M]
  ------------------
   59|  5.72M|    if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
  ------------------
  |  Branch (59:9): [True: 0, False: 5.72M]
  ------------------
   60|  5.72M|    if (force_baseline && temp > 255L)
  ------------------
  |  Branch (60:9): [True: 5.72M, False: 0]
  |  Branch (60:27): [True: 729k, False: 4.99M]
  ------------------
   61|   729k|      temp = 255L;              /* limit to baseline range if requested */
   62|  5.72M|    (*qtblptr)->quantval[i] = (UINT16)temp;
   63|  5.72M|  }
   64|       |
   65|       |  /* Initialize sent_table FALSE so table will be written to JPEG file. */
   66|  89.4k|  (*qtblptr)->sent_table = FALSE;
  ------------------
  |  |  207|  89.4k|#define FALSE   0               /* values of boolean */
  ------------------
   67|  89.4k|}
jpeg_set_linear_quality:
  122|  44.7k|{
  123|       |  /* Set up two quantization tables using the specified scaling */
  124|  44.7k|  jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
  125|  44.7k|                       scale_factor, force_baseline);
  126|  44.7k|  jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
  127|  44.7k|                       scale_factor, force_baseline);
  128|  44.7k|}
jpeg_quality_scaling:
  137|  44.7k|{
  138|       |  /* Safety limit on quality factor.  Convert 0 to 1 to avoid zero divide. */
  139|  44.7k|  if (quality <= 0) quality = 1;
  ------------------
  |  Branch (139:7): [True: 0, False: 44.7k]
  ------------------
  140|  44.7k|  if (quality > 100) quality = 100;
  ------------------
  |  Branch (140:7): [True: 0, False: 44.7k]
  ------------------
  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|  44.7k|  if (quality < 50)
  ------------------
  |  Branch (148:7): [True: 9.88k, False: 34.8k]
  ------------------
  149|  9.88k|    quality = 5000 / quality;
  150|  34.8k|  else
  151|  34.8k|    quality = 200 - quality * 2;
  152|       |
  153|  44.7k|  return quality;
  154|  44.7k|}
jpeg_set_quality:
  164|  44.7k|{
  165|       |  /* Convert user 0-100 rating to percentage scaling */
  166|  44.7k|  quality = jpeg_quality_scaling(quality);
  167|       |
  168|       |  /* Set up standard quality tables */
  169|  44.7k|  jpeg_set_linear_quality(cinfo, quality, force_baseline);
  170|  44.7k|}
jpeg_set_defaults:
  185|  22.3k|{
  186|  22.3k|  int i;
  187|       |
  188|       |  /* Safety check to ensure start_compress not called yet. */
  189|  22.3k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  22.3k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (189:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  if (cinfo->comp_info == NULL)
  ------------------
  |  Branch (196:7): [True: 3.91k, False: 18.4k]
  ------------------
  197|  3.91k|    cinfo->comp_info = (jpeg_component_info *)
  198|  3.91k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  3.91k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  199|  3.91k|                                  MAX_COMPONENTS * sizeof(jpeg_component_info));
  ------------------
  |  |   30|  3.91k|#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|  22.3k|  jpeg_set_quality(cinfo, 75, TRUE);
  ------------------
  |  |  210|  22.3k|#define TRUE    1
  ------------------
  209|       |  /* Set up two Huffman tables */
  210|  22.3k|  std_huff_tables((j_common_ptr)cinfo);
  211|       |
  212|       |  /* Initialize default arithmetic coding conditioning */
  213|   380k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|   380k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (213:15): [True: 357k, False: 22.3k]
  ------------------
  214|   357k|    cinfo->arith_dc_L[i] = 0;
  215|   357k|    cinfo->arith_dc_U[i] = 1;
  216|   357k|    cinfo->arith_ac_K[i] = 5;
  217|   357k|  }
  218|       |
  219|       |  /* Default is no multiple-scan output */
  220|  22.3k|  cinfo->scan_info = NULL;
  221|  22.3k|  cinfo->num_scans = 0;
  222|       |
  223|       |  /* Default is lossy output */
  224|  22.3k|  cinfo->master->lossless = FALSE;
  ------------------
  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|       |  /* Expect normal source image, not raw downsampled data */
  227|  22.3k|  cinfo->raw_data_in = FALSE;
  ------------------
  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  ------------------
  228|       |
  229|       |  /* Use Huffman coding, not arithmetic coding, by default */
  230|  22.3k|  cinfo->arith_code = FALSE;
  ------------------
  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  ------------------
  231|       |
  232|       |  /* By default, don't do extra passes to optimize entropy coding */
  233|  22.3k|  cinfo->optimize_coding = FALSE;
  ------------------
  |  |  207|  22.3k|#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|  22.3k|  if (cinfo->data_precision == 12)
  ------------------
  |  Branch (239:7): [True: 22.3k, False: 0]
  ------------------
  240|  22.3k|    cinfo->optimize_coding = TRUE;
  ------------------
  |  |  210|  22.3k|#define TRUE    1
  ------------------
  241|       |
  242|       |  /* By default, use the simpler non-cosited sampling alignment */
  243|  22.3k|  cinfo->CCIR601_sampling = FALSE;
  ------------------
  |  |  207|  22.3k|#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|  22.3k|  cinfo->smoothing_factor = 0;
  252|       |
  253|       |  /* DCT algorithm preference */
  254|  22.3k|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  301|  22.3k|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  255|       |
  256|       |  /* No restart markers */
  257|  22.3k|  cinfo->restart_interval = 0;
  258|  22.3k|  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|  22.3k|  cinfo->JFIF_major_version = 1; /* Default JFIF version = 1.01 */
  270|  22.3k|  cinfo->JFIF_minor_version = 1;
  271|  22.3k|  cinfo->density_unit = 0;      /* Pixel size is unknown by default */
  272|  22.3k|  cinfo->X_density = 1;         /* Pixel aspect ratio is square by default */
  273|  22.3k|  cinfo->Y_density = 1;
  274|       |
  275|       |  /* Choose JPEG colorspace based on input space, set defaults accordingly */
  276|       |
  277|  22.3k|  jpeg_default_colorspace(cinfo);
  278|  22.3k|}
jpeg_default_colorspace:
  287|  22.3k|{
  288|  22.3k|  switch (cinfo->in_color_space) {
  289|  3.73k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (289:3): [True: 3.73k, False: 18.6k]
  ------------------
  290|  3.73k|    jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
  291|  3.73k|    break;
  292|      0|  case JCS_RGB:
  ------------------
  |  Branch (292:3): [True: 0, False: 22.3k]
  ------------------
  293|  3.16k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (293:3): [True: 3.16k, False: 19.2k]
  ------------------
  294|  6.24k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (294:3): [True: 3.07k, False: 19.2k]
  ------------------
  295|  9.40k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (295:3): [True: 3.16k, False: 19.2k]
  ------------------
  296|  9.40k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (296:3): [True: 0, False: 22.3k]
  ------------------
  297|  9.40k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (297:3): [True: 0, False: 22.3k]
  ------------------
  298|  12.4k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (298:3): [True: 3.07k, False: 19.2k]
  ------------------
  299|  12.4k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (299:3): [True: 0, False: 22.3k]
  ------------------
  300|  15.5k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (300:3): [True: 3.07k, False: 19.2k]
  ------------------
  301|  15.5k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (301:3): [True: 0, False: 22.3k]
  ------------------
  302|  15.5k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (302:3): [True: 0, False: 22.3k]
  ------------------
  303|  15.5k|#ifdef C_LOSSLESS_SUPPORTED
  304|  15.5k|    if (cinfo->master->lossless)
  ------------------
  |  Branch (304:9): [True: 0, False: 15.5k]
  ------------------
  305|      0|      jpeg_set_colorspace(cinfo, JCS_RGB);
  306|  15.5k|    else
  307|  15.5k|#endif
  308|  15.5k|      jpeg_set_colorspace(cinfo, JCS_YCbCr);
  309|  15.5k|    break;
  310|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (310:3): [True: 0, False: 22.3k]
  ------------------
  311|      0|    jpeg_set_colorspace(cinfo, JCS_YCbCr);
  312|      0|    break;
  313|  3.07k|  case JCS_CMYK:
  ------------------
  |  Branch (313:3): [True: 3.07k, False: 19.2k]
  ------------------
  314|  3.07k|    jpeg_set_colorspace(cinfo, JCS_CMYK); /* By default, no translation */
  315|  3.07k|    break;
  316|      0|  case JCS_YCCK:
  ------------------
  |  Branch (316:3): [True: 0, False: 22.3k]
  ------------------
  317|      0|    jpeg_set_colorspace(cinfo, JCS_YCCK);
  318|      0|    break;
  319|      0|  case JCS_UNKNOWN:
  ------------------
  |  Branch (319:3): [True: 0, False: 22.3k]
  ------------------
  320|      0|    jpeg_set_colorspace(cinfo, JCS_UNKNOWN);
  321|      0|    break;
  322|      0|  default:
  ------------------
  |  Branch (322:3): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  }
  325|  22.3k|}
jpeg_set_colorspace:
  334|  44.7k|{
  335|  44.7k|  jpeg_component_info *compptr;
  336|  44.7k|  int ci;
  337|       |
  338|  44.7k|#define SET_COMP(index, id, hsamp, vsamp, quant, dctbl, actbl) \
  339|  44.7k|  (compptr = &cinfo->comp_info[index], \
  340|  44.7k|   compptr->component_id = (id), \
  341|  44.7k|   compptr->h_samp_factor = (hsamp), \
  342|  44.7k|   compptr->v_samp_factor = (vsamp), \
  343|  44.7k|   compptr->quant_tbl_no = (quant), \
  344|  44.7k|   compptr->dc_tbl_no = (dctbl), \
  345|  44.7k|   compptr->ac_tbl_no = (actbl) )
  346|       |
  347|       |  /* Safety check to ensure start_compress not called yet. */
  348|  44.7k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  44.7k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (348:7): [True: 0, False: 44.7k]
  ------------------
  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|  44.7k|  cinfo->jpeg_color_space = colorspace;
  356|       |
  357|  44.7k|  cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */
  ------------------
  |  |  207|  44.7k|#define FALSE   0               /* values of boolean */
  ------------------
  358|  44.7k|  cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */
  ------------------
  |  |  207|  44.7k|#define FALSE   0               /* values of boolean */
  ------------------
  359|       |
  360|  44.7k|  switch (colorspace) {
  361|  10.5k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (361:3): [True: 10.5k, False: 34.1k]
  ------------------
  362|  10.5k|    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
  ------------------
  |  |  210|  10.5k|#define TRUE    1
  ------------------
  363|  10.5k|    cinfo->num_components = 1;
  364|       |    /* JFIF specifies component ID 1 */
  365|  10.5k|    SET_COMP(0, 1, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  10.5k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  10.5k|   compptr->component_id = (id), \
  |  |  341|  10.5k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  10.5k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  10.5k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  10.5k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  10.5k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  366|  10.5k|    break;
  367|  3.07k|  case JCS_RGB:
  ------------------
  |  Branch (367:3): [True: 3.07k, False: 41.6k]
  ------------------
  368|  3.07k|    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */
  ------------------
  |  |  210|  3.07k|#define TRUE    1
  ------------------
  369|  3.07k|    cinfo->num_components = 3;
  370|  3.07k|    SET_COMP(0, 0x52 /* 'R' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  3.07k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  3.07k|   compptr->component_id = (id), \
  |  |  341|  3.07k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  3.07k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  3.07k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  3.07k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  3.07k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  371|  3.07k|    SET_COMP(1, 0x47 /* 'G' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  3.07k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  3.07k|   compptr->component_id = (id), \
  |  |  341|  3.07k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  3.07k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  3.07k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  3.07k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  3.07k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  372|  3.07k|    SET_COMP(2, 0x42 /* 'B' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  3.07k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  3.07k|   compptr->component_id = (id), \
  |  |  341|  3.07k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  3.07k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  3.07k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  3.07k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  3.07k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  373|  3.07k|    break;
  374|  24.9k|  case JCS_YCbCr:
  ------------------
  |  Branch (374:3): [True: 24.9k, False: 19.7k]
  ------------------
  375|  24.9k|    cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
  ------------------
  |  |  210|  24.9k|#define TRUE    1
  ------------------
  376|  24.9k|    cinfo->num_components = 3;
  377|       |    /* JFIF specifies component IDs 1,2,3 */
  378|       |    /* We default to 2x2 subsamples of chrominance */
  379|  24.9k|    SET_COMP(0, 1, 2, 2, 0, 0, 0);
  ------------------
  |  |  339|  24.9k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  24.9k|   compptr->component_id = (id), \
  |  |  341|  24.9k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  24.9k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  24.9k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  24.9k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  24.9k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  380|  24.9k|    SET_COMP(1, 2, 1, 1, 1, 1, 1);
  ------------------
  |  |  339|  24.9k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  24.9k|   compptr->component_id = (id), \
  |  |  341|  24.9k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  24.9k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  24.9k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  24.9k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  24.9k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  381|  24.9k|    SET_COMP(2, 3, 1, 1, 1, 1, 1);
  ------------------
  |  |  339|  24.9k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  24.9k|   compptr->component_id = (id), \
  |  |  341|  24.9k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  24.9k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  24.9k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  24.9k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  24.9k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  382|  24.9k|    break;
  383|  3.07k|  case JCS_CMYK:
  ------------------
  |  Branch (383:3): [True: 3.07k, False: 41.6k]
  ------------------
  384|  3.07k|    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */
  ------------------
  |  |  210|  3.07k|#define TRUE    1
  ------------------
  385|  3.07k|    cinfo->num_components = 4;
  386|  3.07k|    SET_COMP(0, 0x43 /* 'C' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  3.07k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  3.07k|   compptr->component_id = (id), \
  |  |  341|  3.07k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  3.07k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  3.07k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  3.07k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  3.07k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  387|  3.07k|    SET_COMP(1, 0x4D /* 'M' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  3.07k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  3.07k|   compptr->component_id = (id), \
  |  |  341|  3.07k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  3.07k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  3.07k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  3.07k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  3.07k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  388|  3.07k|    SET_COMP(2, 0x59 /* 'Y' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  3.07k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  3.07k|   compptr->component_id = (id), \
  |  |  341|  3.07k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  3.07k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  3.07k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  3.07k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  3.07k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  389|  3.07k|    SET_COMP(3, 0x4B /* 'K' */, 1, 1, 0, 0, 0);
  ------------------
  |  |  339|  3.07k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  3.07k|   compptr->component_id = (id), \
  |  |  341|  3.07k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  3.07k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  3.07k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  3.07k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  3.07k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  390|  3.07k|    break;
  391|  3.07k|  case JCS_YCCK:
  ------------------
  |  Branch (391:3): [True: 3.07k, False: 41.6k]
  ------------------
  392|  3.07k|    cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */
  ------------------
  |  |  210|  3.07k|#define TRUE    1
  ------------------
  393|  3.07k|    cinfo->num_components = 4;
  394|  3.07k|    SET_COMP(0, 1, 2, 2, 0, 0, 0);
  ------------------
  |  |  339|  3.07k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  3.07k|   compptr->component_id = (id), \
  |  |  341|  3.07k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  3.07k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  3.07k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  3.07k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  3.07k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  395|  3.07k|    SET_COMP(1, 2, 1, 1, 1, 1, 1);
  ------------------
  |  |  339|  3.07k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  3.07k|   compptr->component_id = (id), \
  |  |  341|  3.07k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  3.07k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  3.07k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  3.07k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  3.07k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  396|  3.07k|    SET_COMP(2, 3, 1, 1, 1, 1, 1);
  ------------------
  |  |  339|  3.07k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  3.07k|   compptr->component_id = (id), \
  |  |  341|  3.07k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  3.07k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  3.07k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  3.07k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  3.07k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  397|  3.07k|    SET_COMP(3, 4, 2, 2, 0, 0, 0);
  ------------------
  |  |  339|  3.07k|  (compptr = &cinfo->comp_info[index], \
  |  |  340|  3.07k|   compptr->component_id = (id), \
  |  |  341|  3.07k|   compptr->h_samp_factor = (hsamp), \
  |  |  342|  3.07k|   compptr->v_samp_factor = (vsamp), \
  |  |  343|  3.07k|   compptr->quant_tbl_no = (quant), \
  |  |  344|  3.07k|   compptr->dc_tbl_no = (dctbl), \
  |  |  345|  3.07k|   compptr->ac_tbl_no = (actbl) )
  ------------------
  398|  3.07k|    break;
  399|      0|  case JCS_UNKNOWN:
  ------------------
  |  Branch (399:3): [True: 0, False: 44.7k]
  ------------------
  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: 44.7k]
  ------------------
  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|  44.7k|  }
  411|  44.7k|}
jpeg_simple_progression:
  478|  6.80k|{
  479|  6.80k|  int ncomps = cinfo->num_components;
  480|  6.80k|  int nscans;
  481|  6.80k|  jpeg_scan_info *scanptr;
  482|       |
  483|       |  /* Safety check to ensure start_compress not called yet. */
  484|  6.80k|  if (cinfo->global_state != CSTATE_START)
  ------------------
  |  |   44|  6.80k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (484:7): [True: 0, False: 6.80k]
  ------------------
  485|      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)))
  ------------------
  486|       |
  487|  6.80k|#ifdef C_LOSSLESS_SUPPORTED
  488|  6.80k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (488:7): [True: 0, False: 6.80k]
  ------------------
  489|      0|    cinfo->master->lossless = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  490|      0|    jpeg_default_colorspace(cinfo);
  491|      0|  }
  492|  6.80k|#endif
  493|       |
  494|       |  /* Figure space needed for script.  Calculation must match code below! */
  495|  6.80k|  if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (495:7): [True: 0, False: 6.80k]
  |  Branch (495:22): [True: 0, False: 0]
  ------------------
  496|       |    /* Custom script for YCbCr color images. */
  497|      0|    nscans = 10;
  498|  6.80k|  } else {
  499|       |    /* All-purpose script for other color spaces. */
  500|  6.80k|    if (ncomps > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  6.80k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (500:9): [True: 0, False: 6.80k]
  ------------------
  501|      0|      nscans = 6 * ncomps;      /* 2 DC + 4 AC scans per component */
  502|  6.80k|    else
  503|  6.80k|      nscans = 2 + 4 * ncomps;  /* 2 DC scans; 4 AC scans per component */
  504|  6.80k|  }
  505|       |
  506|       |  /* Allocate space for script.
  507|       |   * We need to put it in the permanent pool in case the application performs
  508|       |   * multiple compressions without changing the settings.  To avoid a memory
  509|       |   * leak if jpeg_simple_progression is called repeatedly for the same JPEG
  510|       |   * object, we try to re-use previously allocated space, and we allocate
  511|       |   * enough space to handle YCbCr even if initially asked for grayscale.
  512|       |   */
  513|  6.80k|  if (cinfo->script_space == NULL || cinfo->script_space_size < nscans) {
  ------------------
  |  Branch (513:7): [True: 3.91k, False: 2.88k]
  |  Branch (513:38): [True: 2.88k, False: 0]
  ------------------
  514|  6.80k|    cinfo->script_space_size = MAX(nscans, 10);
  ------------------
  |  |  513|  6.80k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 3.07k, False: 3.73k]
  |  |  ------------------
  ------------------
  515|  6.80k|    cinfo->script_space = (jpeg_scan_info *)
  516|  6.80k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  6.80k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  517|  6.80k|                        cinfo->script_space_size * sizeof(jpeg_scan_info));
  518|  6.80k|  }
  519|  6.80k|  scanptr = cinfo->script_space;
  520|  6.80k|  cinfo->scan_info = scanptr;
  521|  6.80k|  cinfo->num_scans = nscans;
  522|       |
  523|  6.80k|  if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (523:7): [True: 0, False: 6.80k]
  |  Branch (523:22): [True: 0, False: 0]
  ------------------
  524|       |    /* Custom script for YCbCr color images. */
  525|       |    /* Initial DC scan */
  526|      0|    scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
  527|       |    /* Initial AC scan: get some luma data out in a hurry */
  528|      0|    scanptr = fill_a_scan(scanptr, 0, 1, 5, 0, 2);
  529|       |    /* Chroma data is too small to be worth expending many scans on */
  530|      0|    scanptr = fill_a_scan(scanptr, 2, 1, 63, 0, 1);
  531|      0|    scanptr = fill_a_scan(scanptr, 1, 1, 63, 0, 1);
  532|       |    /* Complete spectral selection for luma AC */
  533|      0|    scanptr = fill_a_scan(scanptr, 0, 6, 63, 0, 2);
  534|       |    /* Refine next bit of luma AC */
  535|      0|    scanptr = fill_a_scan(scanptr, 0, 1, 63, 2, 1);
  536|       |    /* Finish DC successive approximation */
  537|      0|    scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
  538|       |    /* Finish AC successive approximation */
  539|      0|    scanptr = fill_a_scan(scanptr, 2, 1, 63, 1, 0);
  540|      0|    scanptr = fill_a_scan(scanptr, 1, 1, 63, 1, 0);
  541|       |    /* Luma bottom bit comes last since it's usually largest scan */
  542|      0|    scanptr = fill_a_scan(scanptr, 0, 1, 63, 1, 0);
  543|  6.80k|  } else {
  544|       |    /* All-purpose script for other color spaces. */
  545|       |    /* Successive approximation first pass */
  546|  6.80k|    scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
  547|  6.80k|    scanptr = fill_scans(scanptr, ncomps, 1, 5, 0, 2);
  548|  6.80k|    scanptr = fill_scans(scanptr, ncomps, 6, 63, 0, 2);
  549|       |    /* Successive approximation second pass */
  550|  6.80k|    scanptr = fill_scans(scanptr, ncomps, 1, 63, 2, 1);
  551|       |    /* Successive approximation final pass */
  552|  6.80k|    scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
  553|  6.80k|    scanptr = fill_scans(scanptr, ncomps, 1, 63, 1, 0);
  554|  6.80k|  }
  555|  6.80k|}
jcparam.c:fill_dc_scans:
  451|  13.6k|{
  452|  13.6k|  int ci;
  453|       |
  454|  13.6k|  if (ncomps <= MAX_COMPS_IN_SCAN) {
  ------------------
  |  |   71|  13.6k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (454:7): [True: 13.6k, False: 0]
  ------------------
  455|       |    /* Single interleaved DC scan */
  456|  13.6k|    scanptr->comps_in_scan = ncomps;
  457|  45.6k|    for (ci = 0; ci < ncomps; ci++)
  ------------------
  |  Branch (457:18): [True: 32.0k, False: 13.6k]
  ------------------
  458|  32.0k|      scanptr->component_index[ci] = ci;
  459|  13.6k|    scanptr->Ss = scanptr->Se = 0;
  460|  13.6k|    scanptr->Ah = Ah;
  461|  13.6k|    scanptr->Al = Al;
  462|  13.6k|    scanptr++;
  463|  13.6k|  } else {
  464|       |    /* Noninterleaved DC scan for each component */
  465|      0|    scanptr = fill_scans(scanptr, ncomps, 0, 0, Ah, Al);
  466|      0|  }
  467|  13.6k|  return scanptr;
  468|  13.6k|}
jcparam.c:fill_scans:
  433|  27.2k|{
  434|  27.2k|  int ci;
  435|       |
  436|  91.3k|  for (ci = 0; ci < ncomps; ci++) {
  ------------------
  |  Branch (436:16): [True: 64.1k, False: 27.2k]
  ------------------
  437|  64.1k|    scanptr->comps_in_scan = 1;
  438|  64.1k|    scanptr->component_index[0] = ci;
  439|  64.1k|    scanptr->Ss = Ss;
  440|  64.1k|    scanptr->Se = Se;
  441|  64.1k|    scanptr->Ah = Ah;
  442|  64.1k|    scanptr->Al = Al;
  443|  64.1k|    scanptr++;
  444|  64.1k|  }
  445|  27.2k|  return scanptr;
  446|  27.2k|}

jinit_phuff_encoder:
 1081|  3.73k|{
 1082|  3.73k|  phuff_entropy_ptr entropy;
 1083|  3.73k|  int i;
 1084|       |
 1085|  3.73k|  entropy = (phuff_entropy_ptr)
 1086|  3.73k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.73k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
 1087|  3.73k|                                sizeof(phuff_entropy_encoder));
 1088|  3.73k|  cinfo->entropy = (struct jpeg_entropy_encoder *)entropy;
 1089|  3.73k|  entropy->pub.start_pass = start_pass_phuff;
 1090|       |
 1091|       |  /* Mark tables unallocated */
 1092|  18.6k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  18.6k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (1092:15): [True: 14.9k, False: 3.73k]
  ------------------
 1093|  14.9k|    entropy->derived_tbls[i] = NULL;
 1094|  14.9k|    entropy->count_ptrs[i] = NULL;
 1095|  14.9k|  }
 1096|       |  entropy->bit_buffer = NULL;   /* needed only in AC refinement scan */
 1097|  3.73k|}
jcphuff.c:start_pass_phuff:
  179|  41.0k|{
  180|  41.0k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  181|  41.0k|  boolean is_DC_band;
  182|  41.0k|  int ci, tbl;
  183|  41.0k|  jpeg_component_info *compptr;
  184|       |
  185|  41.0k|  entropy->cinfo = cinfo;
  186|  41.0k|  entropy->gather_statistics = gather_statistics;
  187|       |
  188|  41.0k|  is_DC_band = (cinfo->Ss == 0);
  189|       |
  190|       |  /* We assume jcmaster.c already validated the scan parameters. */
  191|       |
  192|       |  /* Select execution routines */
  193|  41.0k|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (193:7): [True: 22.3k, False: 18.6k]
  ------------------
  194|  22.3k|    if (is_DC_band)
  ------------------
  |  Branch (194:9): [True: 7.46k, False: 14.9k]
  ------------------
  195|  7.46k|      entropy->pub.encode_mcu = encode_mcu_DC_first;
  196|  14.9k|    else
  197|  14.9k|      entropy->pub.encode_mcu = encode_mcu_AC_first;
  198|  22.3k|#ifdef WITH_SIMD
  199|  22.3k|    if (!jsimd_set_encode_mcu_AC_first_prepare(cinfo,
  ------------------
  |  Branch (199:9): [True: 0, False: 22.3k]
  ------------------
  200|  22.3k|                                               &entropy->AC_first_prepare))
  201|      0|#endif
  202|      0|      entropy->AC_first_prepare = encode_mcu_AC_first_prepare;
  203|  22.3k|  } else {
  204|  18.6k|    if (is_DC_band)
  ------------------
  |  Branch (204:9): [True: 3.73k, False: 14.9k]
  ------------------
  205|  3.73k|      entropy->pub.encode_mcu = encode_mcu_DC_refine;
  206|  14.9k|    else {
  207|  14.9k|      entropy->pub.encode_mcu = encode_mcu_AC_refine;
  208|  14.9k|#ifdef WITH_SIMD
  209|  14.9k|      if (!jsimd_set_encode_mcu_AC_refine_prepare(cinfo,
  ------------------
  |  Branch (209:11): [True: 0, False: 14.9k]
  ------------------
  210|  14.9k|                                                  &entropy->AC_refine_prepare))
  211|      0|#endif
  212|      0|        entropy->AC_refine_prepare = encode_mcu_AC_refine_prepare;
  213|       |      /* AC refinement needs a correction bit buffer */
  214|  14.9k|      if (entropy->bit_buffer == NULL)
  ------------------
  |  Branch (214:11): [True: 3.73k, False: 11.1k]
  ------------------
  215|  3.73k|        entropy->bit_buffer = (char *)
  216|  3.73k|          (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.73k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  217|  3.73k|                                      MAX_CORR_BITS);
  ------------------
  |  |  106|  3.73k|#define MAX_CORR_BITS  1000     /* Max # of correction bits I can buffer */
  ------------------
  218|  14.9k|    }
  219|  18.6k|  }
  220|  41.0k|  if (gather_statistics)
  ------------------
  |  Branch (220:7): [True: 18.6k, False: 22.3k]
  ------------------
  221|  18.6k|    entropy->pub.finish_pass = finish_pass_gather_phuff;
  222|  22.3k|  else
  223|  22.3k|    entropy->pub.finish_pass = finish_pass_phuff;
  224|       |
  225|       |  /* Only DC coefficients may be interleaved, so cinfo->comps_in_scan = 1
  226|       |   * for AC coefficients.
  227|       |   */
  228|  82.0k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 41.0k, False: 41.0k]
  ------------------
  229|  41.0k|    compptr = cinfo->cur_comp_info[ci];
  230|       |    /* Initialize DC predictions to 0 */
  231|  41.0k|    entropy->last_dc_val[ci] = 0;
  232|       |    /* Get table index */
  233|  41.0k|    if (is_DC_band) {
  ------------------
  |  Branch (233:9): [True: 11.1k, False: 29.8k]
  ------------------
  234|  11.1k|      if (cinfo->Ah != 0)       /* DC refinement needs no table */
  ------------------
  |  Branch (234:11): [True: 3.73k, False: 7.46k]
  ------------------
  235|  3.73k|        continue;
  236|  7.46k|      tbl = compptr->dc_tbl_no;
  237|  29.8k|    } else {
  238|  29.8k|      entropy->ac_tbl_no = tbl = compptr->ac_tbl_no;
  239|  29.8k|    }
  240|  37.3k|    if (gather_statistics) {
  ------------------
  |  Branch (240:9): [True: 18.6k, False: 18.6k]
  ------------------
  241|       |      /* Check for invalid table index */
  242|       |      /* (make_c_derived_tbl does this in the other path) */
  243|  18.6k|      if (tbl < 0 || tbl >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  18.6k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (243:11): [True: 0, False: 18.6k]
  |  Branch (243:22): [True: 0, False: 18.6k]
  ------------------
  244|      0|        ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, 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)))
  ------------------
  245|       |      /* Allocate and zero the statistics tables */
  246|       |      /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
  247|  18.6k|      if (entropy->count_ptrs[tbl] == NULL)
  ------------------
  |  Branch (247:11): [True: 3.73k, False: 14.9k]
  ------------------
  248|  3.73k|        entropy->count_ptrs[tbl] = (long *)
  249|  3.73k|          (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.73k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  250|  3.73k|                                      257 * sizeof(long));
  251|  18.6k|      memset(entropy->count_ptrs[tbl], 0, 257 * sizeof(long));
  252|  18.6k|    } else {
  253|       |      /* Compute derived values for Huffman table */
  254|       |      /* We may do this more than once for a table, but it's not expensive */
  255|  18.6k|      jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl,
  256|  18.6k|                              &entropy->derived_tbls[tbl]);
  257|  18.6k|    }
  258|  37.3k|  }
  259|       |
  260|       |  /* Initialize AC stuff */
  261|  41.0k|  entropy->EOBRUN = 0;
  262|  41.0k|  entropy->BE = 0;
  263|       |
  264|       |  /* Initialize bit buffer to empty */
  265|  41.0k|  entropy->put_buffer = 0;
  266|  41.0k|  entropy->put_bits = 0;
  267|       |
  268|       |  /* Initialize restart stuff */
  269|  41.0k|  entropy->restarts_to_go = cinfo->restart_interval;
  270|  41.0k|  entropy->next_restart_num = 0;
  271|  41.0k|}
jcphuff.c:encode_mcu_DC_first:
  457|  2.16M|{
  458|  2.16M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  459|  2.16M|  register int temp, temp2, temp3;
  460|  2.16M|  register int nbits;
  461|  2.16M|  int blkn, ci;
  462|  2.16M|  int Al = cinfo->Al;
  463|  2.16M|  JBLOCKROW block;
  464|  2.16M|  jpeg_component_info *compptr;
  465|  2.16M|  ISHIFT_TEMPS
  466|  2.16M|  int max_coef_bits = cinfo->data_precision + 2;
  467|       |
  468|  2.16M|  entropy->next_output_byte = cinfo->dest->next_output_byte;
  469|  2.16M|  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
  470|       |
  471|       |  /* Emit restart marker if needed */
  472|  2.16M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (472:7): [True: 0, False: 2.16M]
  ------------------
  473|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (473:9): [True: 0, False: 0]
  ------------------
  474|      0|      emit_restart(entropy, entropy->next_restart_num);
  475|       |
  476|       |  /* Encode the MCU data blocks */
  477|  4.32M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (477:18): [True: 2.16M, False: 2.16M]
  ------------------
  478|  2.16M|    block = MCU_data[blkn];
  479|  2.16M|    ci = cinfo->MCU_membership[blkn];
  480|  2.16M|    compptr = cinfo->cur_comp_info[ci];
  481|       |
  482|       |    /* Compute the DC value after the required point transform by Al.
  483|       |     * This is simply an arithmetic right shift.
  484|       |     */
  485|  2.16M|    temp2 = IRIGHT_SHIFT((int)((*block)[0]), Al);
  ------------------
  |  |  121|  2.16M|#define IRIGHT_SHIFT(x, shft)   ((x) >> (shft))
  ------------------
  486|       |
  487|       |    /* DC differences are figured on the point-transformed values. */
  488|  2.16M|    temp = temp2 - entropy->last_dc_val[ci];
  489|  2.16M|    entropy->last_dc_val[ci] = temp2;
  490|       |
  491|       |    /* Encode the DC coefficient difference per section G.1.2.1 */
  492|       |
  493|       |    /* This is a well-known technique for obtaining the absolute value without
  494|       |     * a branch.  It is derived from an assembly language technique presented
  495|       |     * in "How to Optimize for the Pentium Processors", Copyright (c) 1996,
  496|       |     * 1997 by Agner Fog.
  497|       |     */
  498|  2.16M|    temp3 = temp >> (CHAR_BIT * sizeof(int) - 1);
  499|  2.16M|    temp ^= temp3;
  500|  2.16M|    temp -= temp3;              /* temp is abs value of input */
  501|       |    /* For a negative input, want temp2 = bitwise complement of abs(input) */
  502|  2.16M|    temp2 = temp ^ temp3;
  503|       |
  504|       |    /* Find the number of bits needed for the magnitude of the coefficient */
  505|  2.16M|    nbits = JPEG_NBITS(temp);
  ------------------
  |  |   41|  2.16M|#define JPEG_NBITS(x)          (jpeg_nbits_table[x])
  ------------------
  506|       |    /* Check for out-of-range coefficient values.
  507|       |     * Since we're encoding a difference, the range limit is twice as much.
  508|       |     */
  509|  2.16M|    if (nbits > max_coef_bits + 1)
  ------------------
  |  Branch (509:9): [True: 0, False: 2.16M]
  ------------------
  510|      0|      ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  511|       |
  512|       |    /* Count/emit the Huffman-coded symbol for the number of bits */
  513|  2.16M|    emit_symbol(entropy, compptr->dc_tbl_no, nbits);
  514|       |
  515|       |    /* Emit that number of bits of the value, if positive, */
  516|       |    /* or the complement of its magnitude, if negative. */
  517|  2.16M|    if (nbits)                  /* emit_bits rejects calls with size 0 */
  ------------------
  |  Branch (517:9): [True: 1.04M, False: 1.11M]
  ------------------
  518|  1.04M|      emit_bits(entropy, (unsigned int)temp2, nbits);
  519|  2.16M|  }
  520|       |
  521|  2.16M|  cinfo->dest->next_output_byte = entropy->next_output_byte;
  522|  2.16M|  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
  523|       |
  524|       |  /* Update restart-interval state too */
  525|  2.16M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (525:7): [True: 0, False: 2.16M]
  ------------------
  526|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (526:9): [True: 0, False: 0]
  ------------------
  527|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  528|      0|      entropy->next_restart_num++;
  529|      0|      entropy->next_restart_num &= 7;
  530|      0|    }
  531|      0|    entropy->restarts_to_go--;
  532|      0|  }
  533|       |
  534|  2.16M|  return TRUE;
  ------------------
  |  |  210|  2.16M|#define TRUE    1
  ------------------
  535|  2.16M|}
jcphuff.c:emit_eobrun:
  398|  19.0M|{
  399|  19.0M|  register int temp, nbits;
  400|       |
  401|  19.0M|  if (entropy->EOBRUN > 0) {    /* if there is any pending EOBRUN */
  ------------------
  |  Branch (401:7): [True: 2.64M, False: 16.4M]
  ------------------
  402|  2.64M|    temp = entropy->EOBRUN;
  403|  2.64M|    nbits = JPEG_NBITS_NONZERO(temp) - 1;
  ------------------
  |  |   42|  2.64M|#define JPEG_NBITS_NONZERO(x)  JPEG_NBITS(x)
  |  |  ------------------
  |  |  |  |   41|  2.64M|#define JPEG_NBITS(x)          (jpeg_nbits_table[x])
  |  |  ------------------
  ------------------
  404|       |    /* safety check: shouldn't happen given limited correction-bit buffer */
  405|  2.64M|    if (nbits > 14)
  ------------------
  |  Branch (405:9): [True: 0, False: 2.64M]
  ------------------
  406|      0|      ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  407|       |
  408|  2.64M|    emit_symbol(entropy, entropy->ac_tbl_no, nbits << 4);
  409|  2.64M|    if (nbits)
  ------------------
  |  Branch (409:9): [True: 404k, False: 2.23M]
  ------------------
  410|   404k|      emit_bits(entropy, entropy->EOBRUN, nbits);
  411|       |
  412|  2.64M|    entropy->EOBRUN = 0;
  413|       |
  414|       |    /* Emit any buffered correction bits */
  415|  2.64M|    emit_buffered_bits(entropy, entropy->bit_buffer, entropy->BE);
  416|  2.64M|    entropy->BE = 0;
  417|  2.64M|  }
  418|  19.0M|}
jcphuff.c:emit_buffered_bits:
  380|  20.3M|{
  381|  20.3M|  if (entropy->gather_statistics)
  ------------------
  |  Branch (381:7): [True: 10.1M, False: 10.1M]
  ------------------
  382|  10.1M|    return;                     /* no real work */
  383|       |
  384|  31.5M|  while (nbits > 0) {
  ------------------
  |  Branch (384:10): [True: 21.3M, False: 10.1M]
  ------------------
  385|  21.3M|    emit_bits(entropy, (unsigned int)(*bufstart), 1);
  386|  21.3M|    bufstart++;
  387|  21.3M|    nbits--;
  388|  21.3M|  }
  389|  10.1M|}
jcphuff.c:flush_bits:
  350|  22.3k|{
  351|  22.3k|  emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */
  352|  22.3k|  entropy->put_buffer = 0;     /* and reset bit-buffer to empty */
  353|  22.3k|  entropy->put_bits = 0;
  354|  22.3k|}
jcphuff.c:dump_buffer:
  290|    547|{
  291|    547|  struct jpeg_destination_mgr *dest = entropy->cinfo->dest;
  292|       |
  293|    547|  if (!(*dest->empty_output_buffer) (entropy->cinfo))
  ------------------
  |  Branch (293:7): [True: 0, False: 547]
  ------------------
  294|      0|    ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  295|       |  /* After a successful buffer dump, must reset buffer pointers */
  296|    547|  entropy->next_output_byte = dest->next_output_byte;
  297|    547|  entropy->free_in_buffer = dest->free_in_buffer;
  298|    547|}
jcphuff.c:emit_symbol:
  363|  39.4M|{
  364|  39.4M|  if (entropy->gather_statistics)
  ------------------
  |  Branch (364:7): [True: 19.7M, False: 19.7M]
  ------------------
  365|  19.7M|    entropy->count_ptrs[tbl_no][symbol]++;
  366|  19.7M|  else {
  367|  19.7M|    c_derived_tbl *tbl = entropy->derived_tbls[tbl_no];
  368|  19.7M|    emit_bits(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]);
  369|  19.7M|  }
  370|  39.4M|}
jcphuff.c:emit_bits:
  312|  78.0M|{
  313|       |  /* This routine is heavily used, so it's worth coding tightly. */
  314|  78.0M|  register size_t put_buffer = (size_t)code;
  315|  78.0M|  register int put_bits = entropy->put_bits;
  316|       |
  317|       |  /* if size is 0, caller used an invalid Huffman table entry */
  318|  78.0M|  if (size == 0)
  ------------------
  |  Branch (318:7): [True: 0, False: 78.0M]
  ------------------
  319|      0|    ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  320|       |
  321|  78.0M|  if (entropy->gather_statistics)
  ------------------
  |  Branch (321:7): [True: 17.9M, False: 60.1M]
  ------------------
  322|  17.9M|    return;                     /* do nothing if we're only getting stats */
  323|       |
  324|  60.1M|  put_buffer &= (((size_t)1) << size) - 1; /* mask off any extra bits in code */
  325|       |
  326|  60.1M|  put_bits += size;             /* new number of bits in buffer */
  327|       |
  328|  60.1M|  put_buffer <<= 24 - put_bits; /* align incoming bits */
  329|       |
  330|  60.1M|  put_buffer |= entropy->put_buffer; /* and merge with old buffer contents */
  331|       |
  332|  73.5M|  while (put_bits >= 8) {
  ------------------
  |  Branch (332:10): [True: 13.3M, False: 60.1M]
  ------------------
  333|  13.3M|    int c = (int)((put_buffer >> 16) & 0xFF);
  334|       |
  335|  13.3M|    emit_byte(entropy, c);
  ------------------
  |  |  280|  13.3M|#define emit_byte(entropy, val) { \
  |  |  281|  13.3M|  *(entropy)->next_output_byte++ = (JOCTET)(val); \
  |  |  282|  13.3M|  if (--(entropy)->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (282:7): [True: 534, False: 13.3M]
  |  |  ------------------
  |  |  283|  13.3M|    dump_buffer(entropy); \
  |  |  284|  13.3M|}
  ------------------
  336|  13.3M|    if (c == 0xFF) {            /* need to stuff a zero byte? */
  ------------------
  |  Branch (336:9): [True: 101k, False: 13.2M]
  ------------------
  337|   101k|      emit_byte(entropy, 0);
  ------------------
  |  |  280|   101k|#define emit_byte(entropy, val) { \
  |  |  281|   101k|  *(entropy)->next_output_byte++ = (JOCTET)(val); \
  |  |  282|   101k|  if (--(entropy)->free_in_buffer == 0) \
  |  |  ------------------
  |  |  |  Branch (282:7): [True: 13, False: 101k]
  |  |  ------------------
  |  |  283|   101k|    dump_buffer(entropy); \
  |  |  284|   101k|}
  ------------------
  338|   101k|    }
  339|  13.3M|    put_buffer <<= 8;
  340|  13.3M|    put_bits -= 8;
  341|  13.3M|  }
  342|       |
  343|  60.1M|  entropy->put_buffer = put_buffer; /* update variables */
  344|  60.1M|  entropy->put_bits = put_bits;
  345|  60.1M|}
jcphuff.c:encode_mcu_AC_first:
  637|  4.32M|{
  638|  4.32M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  639|  4.32M|  register int temp, temp2;
  640|  4.32M|  register int nbits, r;
  641|  4.32M|  int Sl = cinfo->Se - cinfo->Ss + 1;
  642|  4.32M|  int Al = cinfo->Al;
  643|  4.32M|  UJCOEF values_unaligned[2 * DCTSIZE2 + 15];
  644|  4.32M|  UJCOEF *values;
  645|  4.32M|  const UJCOEF *cvalue;
  646|  4.32M|  size_t zerobits;
  647|  4.32M|  size_t bits[8 / SIZEOF_SIZE_T];
  648|  4.32M|  int max_coef_bits = cinfo->data_precision + 2;
  649|       |
  650|       |#ifdef ZERO_BUFFERS
  651|       |  memset(values_unaligned, 0, sizeof(values_unaligned));
  652|       |  memset(bits, 0, sizeof(bits));
  653|       |#endif
  654|       |
  655|  4.32M|  entropy->next_output_byte = cinfo->dest->next_output_byte;
  656|  4.32M|  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
  657|       |
  658|       |  /* Emit restart marker if needed */
  659|  4.32M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (659:7): [True: 0, False: 4.32M]
  ------------------
  660|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (660:9): [True: 0, False: 0]
  ------------------
  661|      0|      emit_restart(entropy, entropy->next_restart_num);
  662|       |
  663|  4.32M|#ifdef WITH_SIMD
  664|  4.32M|  cvalue = values = (UJCOEF *)PAD((JUINTPTR)values_unaligned, 16);
  ------------------
  |  |  124|  4.32M|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
  665|       |#else
  666|       |  /* Not using SIMD, so alignment is not needed */
  667|       |  cvalue = values = values_unaligned;
  668|       |#endif
  669|       |
  670|       |  /* Prepare data */
  671|  4.32M|  entropy->AC_first_prepare(MCU_data[0][0], jpeg_natural_order + cinfo->Ss,
  672|  4.32M|                            Sl, Al, values, bits);
  673|       |
  674|  4.32M|  zerobits = bits[0];
  675|       |#if SIZEOF_SIZE_T == 4
  676|       |  zerobits |= bits[1];
  677|       |#endif
  678|       |
  679|       |  /* Emit any pending EOBRUN */
  680|  4.32M|  if (zerobits && (entropy->EOBRUN > 0))
  ------------------
  |  Branch (680:7): [True: 2.07M, False: 2.25M]
  |  Branch (680:19): [True: 1.35M, False: 718k]
  ------------------
  681|  1.35M|    emit_eobrun(entropy);
  682|       |
  683|       |#if SIZEOF_SIZE_T == 4
  684|       |  zerobits = bits[0];
  685|       |#endif
  686|       |
  687|       |  /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
  688|       |
  689|  4.32M|  ENCODE_COEFS_AC_FIRST((void)0;);
  ------------------
  |  |  603|  4.32M|#define ENCODE_COEFS_AC_FIRST(label) { \
  |  |  604|  21.2M|  while (zerobits) { \
  |  |  ------------------
  |  |  |  Branch (604:10): [True: 16.9M, False: 4.32M]
  |  |  ------------------
  |  |  605|  16.9M|    r = count_zeroes(&zerobits); \
  |  |  606|  16.9M|    cvalue += r; \
  |  |  607|  16.9M|label \
  |  |  608|  16.9M|    temp  = cvalue[0]; \
  |  |  609|  16.9M|    temp2 = cvalue[DCTSIZE2]; \
  |  |  ------------------
  |  |  |  |   67|  16.9M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  |  |  610|  16.9M|    \
  |  |  611|  16.9M|    /* if run length > 15, must emit special run-length-16 codes (0xF0) */ \
  |  |  612|  16.9M|    while (r > 15) { \
  |  |  ------------------
  |  |  |  Branch (612:12): [True: 19.4k, False: 16.9M]
  |  |  ------------------
  |  |  613|  19.4k|      emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); \
  |  |  614|  19.4k|      r -= 16; \
  |  |  615|  19.4k|    } \
  |  |  616|  16.9M|    \
  |  |  617|  16.9M|    /* Find the number of bits needed for the magnitude of the coefficient */ \
  |  |  618|  16.9M|    nbits = JPEG_NBITS_NONZERO(temp);  /* there must be at least one 1 bit */ \
  |  |  ------------------
  |  |  |  |   42|  16.9M|#define JPEG_NBITS_NONZERO(x)  JPEG_NBITS(x)
  |  |  |  |  ------------------
  |  |  |  |  |  |   41|  16.9M|#define JPEG_NBITS(x)          (jpeg_nbits_table[x])
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  619|  16.9M|    /* Check for out-of-range coefficient values */ \
  |  |  620|  16.9M|    if (nbits > max_coef_bits) \
  |  |  ------------------
  |  |  |  Branch (620:9): [True: 0, False: 16.9M]
  |  |  ------------------
  |  |  621|  16.9M|      ERREXIT(cinfo, JERR_BAD_DCT_COEF); \
  |  |  ------------------
  |  |  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  |  |  ------------------
  |  |  622|  16.9M|    \
  |  |  623|  16.9M|    /* Count/emit Huffman symbol for run length / number of bits */ \
  |  |  624|  16.9M|    emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits); \
  |  |  625|  16.9M|    \
  |  |  626|  16.9M|    /* Emit that number of bits of the value, if positive, */ \
  |  |  627|  16.9M|    /* or the complement of its magnitude, if negative. */ \
  |  |  628|  16.9M|    emit_bits(entropy, (unsigned int)temp2, nbits); \
  |  |  629|  16.9M|    \
  |  |  630|  16.9M|    cvalue++; \
  |  |  631|  16.9M|    zerobits >>= 1; \
  |  |  632|  16.9M|  } \
  |  |  633|  4.32M|}
  ------------------
  690|       |
  691|       |#if SIZEOF_SIZE_T == 4
  692|       |  zerobits = bits[1];
  693|       |  if (zerobits) {
  694|       |    int diff = ((values + DCTSIZE2 / 2) - cvalue);
  695|       |    r = count_zeroes(&zerobits);
  696|       |    r += diff;
  697|       |    cvalue += r;
  698|       |    goto first_iter_ac_first;
  699|       |  }
  700|       |
  701|       |  ENCODE_COEFS_AC_FIRST(first_iter_ac_first:);
  702|       |#endif
  703|       |
  704|  4.32M|  if (cvalue < (values + Sl)) { /* If there are trailing zeroes, */
  ------------------
  |  Branch (704:7): [True: 3.57M, False: 751k]
  ------------------
  705|  3.57M|    entropy->EOBRUN++;          /* count an EOB */
  706|  3.57M|    if (entropy->EOBRUN == 0x7FFF)
  ------------------
  |  Branch (706:9): [True: 0, False: 3.57M]
  ------------------
  707|      0|      emit_eobrun(entropy);     /* force it out to avoid overflow */
  708|  3.57M|  }
  709|       |
  710|  4.32M|  cinfo->dest->next_output_byte = entropy->next_output_byte;
  711|  4.32M|  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
  712|       |
  713|       |  /* Update restart-interval state too */
  714|  4.32M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (714:7): [True: 0, False: 4.32M]
  ------------------
  715|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (715:9): [True: 0, False: 0]
  ------------------
  716|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  717|      0|      entropy->next_restart_num++;
  718|      0|      entropy->next_restart_num &= 7;
  719|      0|    }
  720|      0|    entropy->restarts_to_go--;
  721|      0|  }
  722|       |
  723|  4.32M|  return TRUE;
  ------------------
  |  |  210|  4.32M|#define TRUE    1
  ------------------
  724|  4.32M|}
jcphuff.c:count_zeroes:
  149|  77.2M|{
  150|  77.2M|#if defined(HAVE_BUILTIN_CTZL)
  151|  77.2M|  int result;
  152|  77.2M|  result = __builtin_ctzl(*x);
  153|  77.2M|  *x >>= result;
  154|       |#elif defined(HAVE_BITSCANFORWARD64)
  155|       |  unsigned long result;
  156|       |  _BitScanForward64(&result, *x);
  157|       |  *x >>= result;
  158|       |#elif defined(HAVE_BITSCANFORWARD)
  159|       |  unsigned long result;
  160|       |  _BitScanForward(&result, *x);
  161|       |  *x >>= result;
  162|       |#else
  163|       |  int result = 0;
  164|       |  while ((*x & 1) == 0) {
  165|       |    ++result;
  166|       |    *x >>= 1;
  167|       |  }
  168|       |#endif
  169|  77.2M|  return (int)result;
  170|  77.2M|}
jcphuff.c:encode_mcu_DC_refine:
  735|  1.08M|{
  736|  1.08M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  737|  1.08M|  register int temp;
  738|  1.08M|  int blkn;
  739|  1.08M|  int Al = cinfo->Al;
  740|  1.08M|  JBLOCKROW block;
  741|       |
  742|  1.08M|  entropy->next_output_byte = cinfo->dest->next_output_byte;
  743|  1.08M|  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
  744|       |
  745|       |  /* Emit restart marker if needed */
  746|  1.08M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (746:7): [True: 0, False: 1.08M]
  ------------------
  747|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (747:9): [True: 0, False: 0]
  ------------------
  748|      0|      emit_restart(entropy, entropy->next_restart_num);
  749|       |
  750|       |  /* Encode the MCU data blocks */
  751|  2.16M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (751:18): [True: 1.08M, False: 1.08M]
  ------------------
  752|  1.08M|    block = MCU_data[blkn];
  753|       |
  754|       |    /* We simply emit the Al'th bit of the DC coefficient value. */
  755|  1.08M|    temp = (*block)[0];
  756|  1.08M|    emit_bits(entropy, (unsigned int)(temp >> Al), 1);
  757|  1.08M|  }
  758|       |
  759|  1.08M|  cinfo->dest->next_output_byte = entropy->next_output_byte;
  760|  1.08M|  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
  761|       |
  762|       |  /* Update restart-interval state too */
  763|  1.08M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (763:7): [True: 0, False: 1.08M]
  ------------------
  764|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (764:9): [True: 0, False: 0]
  ------------------
  765|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  766|      0|      entropy->next_restart_num++;
  767|      0|      entropy->next_restart_num &= 7;
  768|      0|    }
  769|      0|    entropy->restarts_to_go--;
  770|      0|  }
  771|       |
  772|  1.08M|  return TRUE;
  ------------------
  |  |  210|  1.08M|#define TRUE    1
  ------------------
  773|  1.08M|}
jcphuff.c:encode_mcu_AC_refine:
  907|  4.32M|{
  908|  4.32M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  909|  4.32M|  register int temp, r, idx;
  910|  4.32M|  char *BR_buffer;
  911|  4.32M|  unsigned int BR;
  912|  4.32M|  int Sl = cinfo->Se - cinfo->Ss + 1;
  913|  4.32M|  int Al = cinfo->Al;
  914|  4.32M|  UJCOEF absvalues_unaligned[DCTSIZE2 + 15];
  915|  4.32M|  UJCOEF *absvalues;
  916|  4.32M|  const UJCOEF *cabsvalue, *EOBPTR;
  917|  4.32M|  size_t zerobits, signbits;
  918|  4.32M|  size_t bits[16 / SIZEOF_SIZE_T];
  919|       |
  920|       |#ifdef ZERO_BUFFERS
  921|       |  memset(absvalues_unaligned, 0, sizeof(absvalues_unaligned));
  922|       |  memset(bits, 0, sizeof(bits));
  923|       |#endif
  924|       |
  925|  4.32M|  entropy->next_output_byte = cinfo->dest->next_output_byte;
  926|  4.32M|  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
  927|       |
  928|       |  /* Emit restart marker if needed */
  929|  4.32M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (929:7): [True: 0, False: 4.32M]
  ------------------
  930|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (930:9): [True: 0, False: 0]
  ------------------
  931|      0|      emit_restart(entropy, entropy->next_restart_num);
  932|       |
  933|  4.32M|#ifdef WITH_SIMD
  934|  4.32M|  cabsvalue = absvalues = (UJCOEF *)PAD((JUINTPTR)absvalues_unaligned, 16);
  ------------------
  |  |  124|  4.32M|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
  935|       |#else
  936|       |  /* Not using SIMD, so alignment is not needed */
  937|       |  cabsvalue = absvalues = absvalues_unaligned;
  938|       |#endif
  939|       |
  940|       |  /* Prepare data */
  941|  4.32M|  EOBPTR = absvalues +
  942|  4.32M|    entropy->AC_refine_prepare(MCU_data[0][0], jpeg_natural_order + cinfo->Ss,
  943|  4.32M|                               Sl, Al, absvalues, bits);
  944|       |
  945|       |  /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
  946|       |
  947|  4.32M|  r = 0;                        /* r = run length of zeros */
  948|  4.32M|  BR = 0;                       /* BR = count of buffered bits added now */
  949|  4.32M|  BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */
  950|       |
  951|  4.32M|  zerobits = bits[0];
  952|  4.32M|#if SIZEOF_SIZE_T == 8
  953|  4.32M|  signbits = bits[1];
  954|       |#else
  955|       |  signbits = bits[2];
  956|       |#endif
  957|  4.32M|  ENCODE_COEFS_AC_REFINE((void)0;);
  ------------------
  |  |  850|  4.32M|#define ENCODE_COEFS_AC_REFINE(label) { \
  |  |  851|  64.6M|  while (zerobits) { \
  |  |  ------------------
  |  |  |  Branch (851:10): [True: 60.3M, False: 4.32M]
  |  |  ------------------
  |  |  852|  60.3M|    idx = count_zeroes(&zerobits); \
  |  |  853|  60.3M|    r += idx; \
  |  |  854|  60.3M|    cabsvalue += idx; \
  |  |  855|  60.3M|    signbits >>= idx; \
  |  |  856|  60.3M|label \
  |  |  857|  60.3M|    /* Emit any required ZRLs, but not if they can be folded into EOB */ \
  |  |  858|  60.4M|    while (r > 15 && (cabsvalue <= EOBPTR)) { \
  |  |  ------------------
  |  |  |  Branch (858:12): [True: 1.07M, False: 59.3M]
  |  |  |  Branch (858:22): [True: 159k, False: 912k]
  |  |  ------------------
  |  |  859|   159k|      /* emit any pending EOBRUN and the BE correction bits */ \
  |  |  860|   159k|      emit_eobrun(entropy); \
  |  |  861|   159k|      /* Emit ZRL */ \
  |  |  862|   159k|      emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); \
  |  |  863|   159k|      r -= 16; \
  |  |  864|   159k|      /* Emit buffered correction bits that must be associated with ZRL */ \
  |  |  865|   159k|      emit_buffered_bits(entropy, BR_buffer, BR); \
  |  |  866|   159k|      BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ \
  |  |  867|   159k|      BR = 0; \
  |  |  868|   159k|    } \
  |  |  869|  60.3M|    \
  |  |  870|  60.3M|    temp = *cabsvalue++; \
  |  |  871|  60.3M|    \
  |  |  872|  60.3M|    /* If the coef was previously nonzero, it only needs a correction bit. \
  |  |  873|  60.3M|     * NOTE: a straight translation of the spec's figure G.7 would suggest \
  |  |  874|  60.3M|     * that we also need to test r > 15.  But if r > 15, we can only get here \
  |  |  875|  60.3M|     * if k > EOB, which implies that this coefficient is not 1. \
  |  |  876|  60.3M|     */ \
  |  |  877|  60.3M|    if (temp > 1) { \
  |  |  ------------------
  |  |  |  Branch (877:9): [True: 42.7M, False: 17.5M]
  |  |  ------------------
  |  |  878|  42.7M|      /* The correction bit is the next bit of the absolute value. */ \
  |  |  879|  42.7M|      BR_buffer[BR++] = (char)(temp & 1); \
  |  |  880|  42.7M|      signbits >>= 1; \
  |  |  881|  42.7M|      zerobits >>= 1; \
  |  |  882|  42.7M|      continue; \
  |  |  883|  42.7M|    } \
  |  |  884|  60.3M|    \
  |  |  885|  60.3M|    /* Emit any pending EOBRUN and the BE correction bits */ \
  |  |  886|  60.3M|    emit_eobrun(entropy); \
  |  |  887|  17.5M|    \
  |  |  888|  17.5M|    /* Count/emit Huffman symbol for run length / number of bits */ \
  |  |  889|  17.5M|    emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1); \
  |  |  890|  17.5M|    \
  |  |  891|  17.5M|    /* Emit output bit for newly-nonzero coef */ \
  |  |  892|  17.5M|    temp = signbits & 1; /* ((*block)[jpeg_natural_order_start[k]] < 0) ? 0 : 1 */ \
  |  |  893|  17.5M|    emit_bits(entropy, (unsigned int)temp, 1); \
  |  |  894|  17.5M|    \
  |  |  895|  17.5M|    /* Emit buffered correction bits that must be associated with this code */ \
  |  |  896|  17.5M|    emit_buffered_bits(entropy, BR_buffer, BR); \
  |  |  897|  17.5M|    BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ \
  |  |  898|  17.5M|    BR = 0; \
  |  |  899|  17.5M|    r = 0;                      /* reset zero run length */ \
  |  |  900|  17.5M|    signbits >>= 1; \
  |  |  901|  17.5M|    zerobits >>= 1; \
  |  |  902|  17.5M|  } \
  |  |  903|  4.32M|}
  ------------------
  958|       |
  959|       |#if SIZEOF_SIZE_T == 4
  960|       |  zerobits = bits[1];
  961|       |  signbits = bits[3];
  962|       |
  963|       |  if (zerobits) {
  964|       |    int diff = ((absvalues + DCTSIZE2 / 2) - cabsvalue);
  965|       |    idx = count_zeroes(&zerobits);
  966|       |    signbits >>= idx;
  967|       |    idx += diff;
  968|       |    r += idx;
  969|       |    cabsvalue += idx;
  970|       |    goto first_iter_ac_refine;
  971|       |  }
  972|       |
  973|       |  ENCODE_COEFS_AC_REFINE(first_iter_ac_refine:);
  974|       |#endif
  975|       |
  976|  4.32M|  r |= (int)((absvalues + Sl) - cabsvalue);
  977|       |
  978|  4.32M|  if (r > 0 || BR > 0) {        /* If there are trailing zeroes, */
  ------------------
  |  Branch (978:7): [True: 3.94M, False: 386k]
  |  Branch (978:16): [True: 126k, False: 260k]
  ------------------
  979|  4.06M|    entropy->EOBRUN++;          /* count an EOB */
  980|  4.06M|    entropy->BE += BR;          /* concat my correction bits to older ones */
  981|       |    /* We force out the EOB if we risk either:
  982|       |     * 1. overflow of the EOB counter;
  983|       |     * 2. overflow of the correction bit buffer during the next MCU.
  984|       |     */
  985|  4.06M|    if (entropy->EOBRUN == 0x7FFF ||
  ------------------
  |  Branch (985:9): [True: 0, False: 4.06M]
  ------------------
  986|  4.06M|        entropy->BE > (MAX_CORR_BITS - DCTSIZE2 + 1))
  ------------------
  |  |  106|  4.06M|#define MAX_CORR_BITS  1000     /* Max # of correction bits I can buffer */
  ------------------
                      entropy->BE > (MAX_CORR_BITS - DCTSIZE2 + 1))
  ------------------
  |  |   67|  4.06M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (986:9): [True: 786, False: 4.06M]
  ------------------
  987|    786|      emit_eobrun(entropy);
  988|  4.06M|  }
  989|       |
  990|  4.32M|  cinfo->dest->next_output_byte = entropy->next_output_byte;
  991|  4.32M|  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
  992|       |
  993|       |  /* Update restart-interval state too */
  994|  4.32M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (994:7): [True: 0, False: 4.32M]
  ------------------
  995|      0|    if (entropy->restarts_to_go == 0) {
  ------------------
  |  Branch (995:9): [True: 0, False: 0]
  ------------------
  996|      0|      entropy->restarts_to_go = cinfo->restart_interval;
  997|      0|      entropy->next_restart_num++;
  998|      0|      entropy->next_restart_num &= 7;
  999|      0|    }
 1000|      0|    entropy->restarts_to_go--;
 1001|      0|  }
 1002|       |
 1003|  4.32M|  return TRUE;
  ------------------
  |  |  210|  4.32M|#define TRUE    1
  ------------------
 1004|  4.32M|}
jcphuff.c:finish_pass_gather_phuff:
 1034|  18.6k|{
 1035|  18.6k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
 1036|  18.6k|  boolean is_DC_band;
 1037|  18.6k|  int ci, tbl;
 1038|  18.6k|  jpeg_component_info *compptr;
 1039|  18.6k|  JHUFF_TBL **htblptr;
 1040|  18.6k|  boolean did[NUM_HUFF_TBLS];
 1041|       |
 1042|       |  /* Flush out buffered data (all we care about is counting the EOB symbol) */
 1043|  18.6k|  emit_eobrun(entropy);
 1044|       |
 1045|  18.6k|  is_DC_band = (cinfo->Ss == 0);
 1046|       |
 1047|       |  /* It's important not to apply jpeg_gen_optimal_table more than once
 1048|       |   * per table, because it clobbers the input frequency counts!
 1049|       |   */
 1050|  18.6k|  memset(did, 0, sizeof(did));
 1051|       |
 1052|  37.3k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (1052:16): [True: 18.6k, False: 18.6k]
  ------------------
 1053|  18.6k|    compptr = cinfo->cur_comp_info[ci];
 1054|  18.6k|    if (is_DC_band) {
  ------------------
  |  Branch (1054:9): [True: 3.73k, False: 14.9k]
  ------------------
 1055|  3.73k|      if (cinfo->Ah != 0)       /* DC refinement needs no table */
  ------------------
  |  Branch (1055:11): [True: 0, False: 3.73k]
  ------------------
 1056|      0|        continue;
 1057|  3.73k|      tbl = compptr->dc_tbl_no;
 1058|  14.9k|    } else {
 1059|  14.9k|      tbl = compptr->ac_tbl_no;
 1060|  14.9k|    }
 1061|  18.6k|    if (!did[tbl]) {
  ------------------
  |  Branch (1061:9): [True: 18.6k, False: 0]
  ------------------
 1062|  18.6k|      if (is_DC_band)
  ------------------
  |  Branch (1062:11): [True: 3.73k, False: 14.9k]
  ------------------
 1063|  3.73k|        htblptr = &cinfo->dc_huff_tbl_ptrs[tbl];
 1064|  14.9k|      else
 1065|  14.9k|        htblptr = &cinfo->ac_huff_tbl_ptrs[tbl];
 1066|  18.6k|      if (*htblptr == NULL)
  ------------------
  |  Branch (1066:11): [True: 0, False: 18.6k]
  ------------------
 1067|      0|        *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
 1068|  18.6k|      jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]);
 1069|  18.6k|      did[tbl] = TRUE;
  ------------------
  |  |  210|  18.6k|#define TRUE    1
  ------------------
 1070|  18.6k|    }
 1071|  18.6k|  }
 1072|  18.6k|}
jcphuff.c:finish_pass_phuff:
 1013|  22.3k|{
 1014|  22.3k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
 1015|       |
 1016|  22.3k|  entropy->next_output_byte = cinfo->dest->next_output_byte;
 1017|  22.3k|  entropy->free_in_buffer = cinfo->dest->free_in_buffer;
 1018|       |
 1019|       |  /* Flush out any buffered data */
 1020|  22.3k|  emit_eobrun(entropy);
 1021|  22.3k|  flush_bits(entropy);
 1022|       |
 1023|  22.3k|  cinfo->dest->next_output_byte = entropy->next_output_byte;
 1024|  22.3k|  cinfo->dest->free_in_buffer = entropy->free_in_buffer;
 1025|  22.3k|}

j12init_c_prep_controller:
  356|  22.3k|{
  357|  22.3k|  my_prep_ptr prep;
  358|  22.3k|  int ci;
  359|  22.3k|  jpeg_component_info *compptr;
  360|  22.3k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  22.3k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (360:19): [True: 0, False: 22.3k]
  ------------------
  361|       |
  362|  22.3k|#ifdef C_LOSSLESS_SUPPORTED
  363|  22.3k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (363:7): [True: 0, False: 22.3k]
  ------------------
  364|       |#if BITS_IN_JSAMPLE == 8
  365|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  366|       |#else
  367|      0|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (367:9): [True: 0, False: 0]
  ------------------
  368|      0|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (368:9): [True: 0, False: 0]
  ------------------
  369|      0|#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|      0|  } else
  372|  22.3k|#endif
  373|  22.3k|  {
  374|  22.3k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  22.3k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (374:9): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  }
  377|       |
  378|  22.3k|  if (need_full_buffer)         /* safety check */
  ------------------
  |  Branch (378:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  prep = (my_prep_ptr)
  382|  22.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  22.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  383|  22.3k|                                sizeof(my_prep_controller));
  384|  22.3k|  cinfo->prep = (struct jpeg_c_prep_controller *)prep;
  385|  22.3k|  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|  22.3k|  if (cinfo->downsample->need_context_rows) {
  ------------------
  |  Branch (391:7): [True: 0, False: 22.3k]
  ------------------
  392|       |    /* Set up to provide context rows */
  393|      0|#ifdef CONTEXT_ROWS_SUPPORTED
  394|      0|    prep->pub._pre_process_data = pre_process_context;
  ------------------
  |  |  130|      0|#define _pre_process_data  pre_process_data_12
  ------------------
  395|      0|    create_context_buffer(cinfo);
  396|       |#else
  397|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  398|       |#endif
  399|  22.3k|  } else {
  400|       |    /* No context, just make it tall enough for one row group */
  401|  22.3k|    prep->pub._pre_process_data = pre_process_data;
  ------------------
  |  |  130|  22.3k|#define _pre_process_data  pre_process_data_12
  ------------------
  402|  78.9k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (402:46): [True: 56.5k, False: 22.3k]
  ------------------
  403|  56.5k|         ci++, compptr++) {
  404|  56.5k|      prep->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  405|  56.5k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  56.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  406|  56.5k|         (JDIMENSION)(((long)compptr->width_in_blocks * data_unit *
  407|  56.5k|                       cinfo->max_h_samp_factor) / compptr->h_samp_factor),
  408|  56.5k|         (JDIMENSION)cinfo->max_v_samp_factor);
  409|  56.5k|    }
  410|  22.3k|  }
  411|  22.3k|}
jcprepct-12.c:start_pass_prep:
   90|  22.3k|{
   91|  22.3k|  my_prep_ptr prep = (my_prep_ptr)cinfo->prep;
   92|       |
   93|  22.3k|  if (pass_mode != JBUF_PASS_THRU)
  ------------------
  |  Branch (93:7): [True: 0, False: 22.3k]
  ------------------
   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|  22.3k|  prep->rows_to_go = cinfo->image_height;
   98|       |  /* Mark the conversion buffer empty */
   99|  22.3k|  prep->next_buf_row = 0;
  100|  22.3k|#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|  22.3k|  prep->this_row_group = 0;
  105|       |  /* Set next_buf_stop to stop after two row groups have been read in. */
  106|  22.3k|  prep->next_buf_stop = 2 * cinfo->max_v_samp_factor;
  107|  22.3k|#endif
  108|  22.3k|}
jcprepct-12.c:expand_bottom_edge:
  119|  44.9k|{
  120|  44.9k|  register int row;
  121|       |
  122|   283k|  for (row = input_rows; row < output_rows; row++) {
  ------------------
  |  Branch (122:26): [True: 238k, False: 44.9k]
  ------------------
  123|   238k|    _jcopy_sample_rows(image_data, input_rows - 1, image_data, row, 1,
  ------------------
  |  |  181|   238k|#define _jcopy_sample_rows  j12copy_sample_rows
  ------------------
  124|   238k|                       num_cols);
  125|   238k|  }
  126|  44.9k|}
jcprepct-12.c:pre_process_data:
  143|  3.40M|{
  144|  3.40M|  my_prep_ptr prep = (my_prep_ptr)cinfo->prep;
  145|  3.40M|  int numrows, ci;
  146|  3.40M|  JDIMENSION inrows;
  147|  3.40M|  jpeg_component_info *compptr;
  148|  3.40M|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  3.40M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (148:19): [True: 0, False: 3.40M]
  ------------------
  149|       |
  150|  30.5M|  while (*in_row_ctr < in_rows_avail &&
  ------------------
  |  Branch (150:10): [True: 30.5M, False: 8.78k]
  ------------------
  151|  30.5M|         *out_row_group_ctr < out_row_groups_avail) {
  ------------------
  |  Branch (151:10): [True: 27.1M, False: 3.38M]
  ------------------
  152|       |    /* Do color conversion to fill the conversion buffer. */
  153|  27.1M|    inrows = in_rows_avail - *in_row_ctr;
  154|  27.1M|    numrows = cinfo->max_v_samp_factor - prep->next_buf_row;
  155|  27.1M|    numrows = (int)MIN((JDIMENSION)numrows, inrows);
  ------------------
  |  |  515|  27.1M|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 27.1M, False: 22.3k]
  |  |  ------------------
  ------------------
  156|       |#ifdef WITH_PROFILE
  157|       |    cinfo->master->start = getTime();
  158|       |#endif
  159|  27.1M|    (*cinfo->cconvert->_color_convert) (cinfo, input_buf + *in_row_ctr,
  ------------------
  |  |  151|  27.1M|#define _color_convert  color_convert_12
  ------------------
  160|  27.1M|                                        prep->color_buf,
  161|  27.1M|                                        (JDIMENSION)prep->next_buf_row,
  162|  27.1M|                                        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|  27.1M|    *in_row_ctr += numrows;
  169|  27.1M|    prep->next_buf_row += numrows;
  170|  27.1M|    prep->rows_to_go -= numrows;
  171|       |    /* If at bottom of image, pad to fill the conversion buffer. */
  172|  27.1M|    if (prep->rows_to_go == 0 &&
  ------------------
  |  Branch (172:9): [True: 22.3k, False: 27.1M]
  ------------------
  173|  22.3k|        prep->next_buf_row < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (173:9): [True: 2.16k, False: 20.2k]
  ------------------
  174|  9.72k|      for (ci = 0; ci < cinfo->num_components; ci++) {
  ------------------
  |  Branch (174:20): [True: 7.56k, False: 2.16k]
  ------------------
  175|  7.56k|        expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
  176|  7.56k|                           prep->next_buf_row, cinfo->max_v_samp_factor);
  177|  7.56k|      }
  178|  2.16k|      prep->next_buf_row = cinfo->max_v_samp_factor;
  179|  2.16k|    }
  180|       |    /* If we've filled the conversion buffer, empty it. */
  181|  27.1M|    if (prep->next_buf_row == cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (181:9): [True: 27.1M, False: 0]
  ------------------
  182|       |#ifdef WITH_PROFILE
  183|       |      cinfo->master->start = getTime();
  184|       |#endif
  185|  27.1M|      (*cinfo->downsample->_downsample) (cinfo,
  ------------------
  |  |  136|  27.1M|#define _downsample  downsample_12
  ------------------
  186|  27.1M|                                         prep->color_buf, (JDIMENSION)0,
  187|  27.1M|                                         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|  27.1M|      prep->next_buf_row = 0;
  194|  27.1M|      (*out_row_group_ctr)++;
  195|  27.1M|    }
  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|  27.1M|    if (prep->rows_to_go == 0 && *out_row_group_ctr < out_row_groups_avail) {
  ------------------
  |  Branch (199:9): [True: 22.3k, False: 27.1M]
  |  Branch (199:34): [True: 13.5k, False: 8.78k]
  ------------------
  200|  51.0k|      for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (200:48): [True: 37.4k, False: 13.5k]
  ------------------
  201|  37.4k|           ci++, compptr++) {
  202|  37.4k|        expand_bottom_edge(output_buf[ci],
  203|  37.4k|                           compptr->width_in_blocks * data_unit,
  204|  37.4k|                           (int)(*out_row_group_ctr * compptr->v_samp_factor),
  205|  37.4k|                           (int)(out_row_groups_avail * compptr->v_samp_factor));
  206|  37.4k|      }
  207|  13.5k|      *out_row_group_ctr = out_row_groups_avail;
  208|  13.5k|      break;                    /* can exit outer loop without test */
  209|  13.5k|    }
  210|  27.1M|  }
  211|  3.40M|}

j12init_downsampler:
  468|  22.3k|{
  469|  22.3k|  my_downsample_ptr downsample;
  470|  22.3k|  int ci;
  471|  22.3k|  jpeg_component_info *compptr;
  472|  22.3k|#ifdef INPUT_SMOOTHING_SUPPORTED
  473|  22.3k|  boolean smoothok = TRUE;
  ------------------
  |  |  210|  22.3k|#define TRUE    1
  ------------------
  474|  22.3k|#endif
  475|       |
  476|  22.3k|#ifdef C_LOSSLESS_SUPPORTED
  477|  22.3k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (477:7): [True: 0, False: 22.3k]
  ------------------
  478|       |#if BITS_IN_JSAMPLE == 8
  479|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  480|       |#else
  481|      0|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (481:9): [True: 0, False: 0]
  ------------------
  482|      0|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (482:9): [True: 0, False: 0]
  ------------------
  483|      0|#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|      0|  } else
  486|  22.3k|#endif
  487|  22.3k|  {
  488|  22.3k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  22.3k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (488:9): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  }
  491|       |
  492|  22.3k|  downsample = (my_downsample_ptr)
  493|  22.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  22.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  494|  22.3k|                                sizeof(my_downsampler));
  495|  22.3k|  cinfo->downsample = (struct jpeg_downsampler *)downsample;
  496|  22.3k|  downsample->pub.start_pass = start_pass_downsample;
  497|  22.3k|  downsample->pub._downsample = sep_downsample;
  ------------------
  |  |  136|  22.3k|#define _downsample  downsample_12
  ------------------
  498|  22.3k|  downsample->pub.need_context_rows = FALSE;
  ------------------
  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  ------------------
  499|       |
  500|  22.3k|  if (cinfo->CCIR601_sampling)
  ------------------
  |  Branch (500:7): [True: 0, False: 22.3k]
  ------------------
  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|  78.9k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (504:44): [True: 56.5k, False: 22.3k]
  ------------------
  505|  56.5k|       ci++, compptr++) {
  506|  56.5k|    if (compptr->h_samp_factor == cinfo->max_h_samp_factor &&
  ------------------
  |  Branch (506:9): [True: 37.9k, False: 18.6k]
  ------------------
  507|  37.9k|        compptr->v_samp_factor == cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (507:9): [True: 31.7k, False: 6.15k]
  ------------------
  508|  31.7k|#ifdef INPUT_SMOOTHING_SUPPORTED
  509|  31.7k|      if (cinfo->smoothing_factor) {
  ------------------
  |  Branch (509:11): [True: 0, False: 31.7k]
  ------------------
  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|  31.7k|#endif
  514|  31.7k|        downsample->methods[ci] = fullsize_downsample;
  515|  31.7k|    } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
  ------------------
  |  Branch (515:16): [True: 12.4k, False: 12.3k]
  ------------------
  516|  12.4k|               compptr->v_samp_factor == cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (516:16): [True: 6.32k, False: 6.15k]
  ------------------
  517|  6.32k|#ifdef INPUT_SMOOTHING_SUPPORTED
  518|  6.32k|      smoothok = FALSE;
  ------------------
  |  |  207|  6.32k|#define FALSE   0               /* values of boolean */
  ------------------
  519|  6.32k|#endif
  520|       |#ifdef WITH_SIMD
  521|       |      if (jsimd_set_h2v1_downsample(cinfo))
  522|       |        downsample->methods[ci] = jsimd_h2v1_downsample;
  523|       |      else
  524|       |#endif
  525|  6.32k|        downsample->methods[ci] = h2v1_downsample;
  526|  18.4k|    } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
  ------------------
  |  Branch (526:16): [True: 6.15k, False: 12.3k]
  ------------------
  527|  6.15k|               compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (527:16): [True: 6.15k, False: 0]
  ------------------
  528|  6.15k|#ifdef INPUT_SMOOTHING_SUPPORTED
  529|  6.15k|      if (cinfo->smoothing_factor) {
  ------------------
  |  Branch (529:11): [True: 0, False: 6.15k]
  ------------------
  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|  6.15k|#endif
  534|  6.15k|      {
  535|       |#ifdef WITH_SIMD
  536|       |        if (jsimd_set_h2v2_downsample(cinfo))
  537|       |          downsample->methods[ci] = jsimd_h2v2_downsample;
  538|       |        else
  539|       |#endif
  540|  6.15k|          downsample->methods[ci] = h2v2_downsample;
  541|  6.15k|      }
  542|  12.3k|    } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&
  ------------------
  |  Branch (542:16): [True: 12.3k, False: 0]
  ------------------
  543|  12.3k|               (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) {
  ------------------
  |  Branch (543:16): [True: 12.3k, False: 0]
  ------------------
  544|  12.3k|#ifdef INPUT_SMOOTHING_SUPPORTED
  545|  12.3k|      smoothok = FALSE;
  ------------------
  |  |  207|  12.3k|#define FALSE   0               /* values of boolean */
  ------------------
  546|  12.3k|#endif
  547|  12.3k|      downsample->methods[ci] = int_downsample;
  548|  12.3k|    } 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|  56.5k|  }
  551|       |
  552|  22.3k|#ifdef INPUT_SMOOTHING_SUPPORTED
  553|  22.3k|  if (cinfo->smoothing_factor && !smoothok)
  ------------------
  |  Branch (553:7): [True: 0, False: 22.3k]
  |  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|  22.3k|#endif
  556|  22.3k|}
jcsample-12.c:start_pass_downsample:
   89|  22.3k|{
   90|       |  /* no work for now */
   91|  22.3k|}
jcsample-12.c:sep_downsample:
  130|  27.1M|{
  131|  27.1M|  my_downsample_ptr downsample = (my_downsample_ptr)cinfo->downsample;
  132|  27.1M|  int ci;
  133|  27.1M|  jpeg_component_info *compptr;
  134|  27.1M|  _JSAMPARRAY in_ptr, out_ptr;
  ------------------
  |  |  114|  27.1M|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  135|       |
  136|  94.2M|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (136:44): [True: 67.1M, False: 27.1M]
  ------------------
  137|  67.1M|       ci++, compptr++) {
  138|  67.1M|    in_ptr = input_buf[ci] + in_row_index;
  139|  67.1M|    out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor);
  140|  67.1M|    (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr);
  141|  67.1M|  }
  142|  27.1M|}
jcsample-12.c:expand_right_edge:
  102|  67.1M|{
  103|  67.1M|  register _JSAMPROW ptr;
  104|  67.1M|  register _JSAMPLE pixval;
  105|  67.1M|  register int count;
  106|  67.1M|  int row;
  107|  67.1M|  int numcols = (int)(output_cols - input_cols);
  108|       |
  109|  67.1M|  if (numcols > 0) {
  ------------------
  |  Branch (109:7): [True: 66.5M, False: 580k]
  ------------------
  110|   149M|    for (row = 0; row < num_rows; row++) {
  ------------------
  |  Branch (110:19): [True: 82.8M, False: 66.5M]
  ------------------
  111|  82.8M|      ptr = image_data[row] + input_cols;
  112|  82.8M|      pixval = ptr[-1];
  113|   962M|      for (count = numcols; count > 0; count--)
  ------------------
  |  Branch (113:29): [True: 879M, False: 82.8M]
  ------------------
  114|   879M|        *ptr++ = pixval;
  115|  82.8M|    }
  116|  66.5M|  }
  117|  67.1M|}
jcsample-12.c:fullsize_downsample:
  203|  38.9M|{
  204|  38.9M|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  38.9M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (204:19): [True: 0, False: 38.9M]
  ------------------
  205|       |
  206|       |  /* Copy the data */
  207|  38.9M|  _jcopy_sample_rows(input_data, 0, output_data, 0, cinfo->max_v_samp_factor,
  ------------------
  |  |  181|  38.9M|#define _jcopy_sample_rows  j12copy_sample_rows
  ------------------
  208|  38.9M|                     cinfo->image_width);
  209|       |  /* Edge-expand */
  210|  38.9M|  expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width,
  211|  38.9M|                    compptr->width_in_blocks * data_unit);
  212|  38.9M|}
jcsample-12.c:h2v1_downsample:
  230|  9.40M|{
  231|  9.40M|  int outrow;
  232|  9.40M|  JDIMENSION outcol;
  233|  9.40M|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  9.40M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (233:19): [True: 0, False: 9.40M]
  ------------------
  234|  9.40M|  JDIMENSION output_cols = compptr->width_in_blocks * data_unit;
  235|  9.40M|  register _JSAMPROW inptr, outptr;
  236|  9.40M|  register int bias;
  237|       |
  238|       |  /* Expand input data enough to let all the output samples be generated
  239|       |   * by the standard loop.  Special-casing padded output would be more
  240|       |   * efficient.
  241|       |   */
  242|  9.40M|  expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
  243|  9.40M|                    output_cols * 2);
  244|       |
  245|  18.8M|  for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
  ------------------
  |  Branch (245:20): [True: 9.40M, False: 9.40M]
  ------------------
  246|  9.40M|    outptr = output_data[outrow];
  247|  9.40M|    inptr = input_data[outrow];
  248|  9.40M|    bias = 0;                   /* bias = 0,1,0,1,... for successive samples */
  249|   110M|    for (outcol = 0; outcol < output_cols; outcol++) {
  ------------------
  |  Branch (249:22): [True: 101M, False: 9.40M]
  ------------------
  250|   101M|      *outptr++ = (_JSAMPLE)((inptr[0] + inptr[1] + bias) >> 1);
  251|   101M|      bias ^= 1;                /* 0=>1, 1=>0 */
  252|   101M|      inptr += 2;
  253|   101M|    }
  254|  9.40M|  }
  255|  9.40M|}
jcsample-12.c:h2v2_downsample:
  267|  4.70M|{
  268|  4.70M|  int inrow, outrow;
  269|  4.70M|  JDIMENSION outcol;
  270|  4.70M|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  4.70M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (270:19): [True: 0, False: 4.70M]
  ------------------
  271|  4.70M|  JDIMENSION output_cols = compptr->width_in_blocks * data_unit;
  272|  4.70M|  register _JSAMPROW inptr0, inptr1, outptr;
  273|  4.70M|  register int bias;
  274|       |
  275|       |  /* Expand input data enough to let all the output samples be generated
  276|       |   * by the standard loop.  Special-casing padded output would be more
  277|       |   * efficient.
  278|       |   */
  279|  4.70M|  expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
  280|  4.70M|                    output_cols * 2);
  281|       |
  282|  4.70M|  inrow = 0;
  283|  9.40M|  for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
  ------------------
  |  Branch (283:20): [True: 4.70M, False: 4.70M]
  ------------------
  284|  4.70M|    outptr = output_data[outrow];
  285|  4.70M|    inptr0 = input_data[inrow];
  286|  4.70M|    inptr1 = input_data[inrow + 1];
  287|  4.70M|    bias = 1;                   /* bias = 1,2,1,2,... for successive samples */
  288|  56.5M|    for (outcol = 0; outcol < output_cols; outcol++) {
  ------------------
  |  Branch (288:22): [True: 51.8M, False: 4.70M]
  ------------------
  289|  51.8M|      *outptr++ = (_JSAMPLE)
  290|  51.8M|        ((inptr0[0] + inptr0[1] + inptr1[0] + inptr1[1] + bias) >> 2);
  291|  51.8M|      bias ^= 3;                /* 1=>2, 2=>1 */
  292|  51.8M|      inptr0 += 2;  inptr1 += 2;
  293|  51.8M|    }
  294|  4.70M|    inrow += 2;
  295|  4.70M|  }
  296|  4.70M|}
jcsample-12.c:int_downsample:
  155|  14.1M|{
  156|  14.1M|  int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
  157|  14.1M|  JDIMENSION outcol, outcol_h;  /* outcol_h == outcol*h_expand */
  158|  14.1M|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  14.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (158:19): [True: 0, False: 14.1M]
  ------------------
  159|  14.1M|  JDIMENSION output_cols = compptr->width_in_blocks * data_unit;
  160|  14.1M|  _JSAMPROW inptr, outptr;
  ------------------
  |  |  113|  14.1M|#define _JSAMPROW  J12SAMPROW
  ------------------
  161|  14.1M|  JLONG outvalue;
  162|       |
  163|  14.1M|  h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor;
  164|  14.1M|  v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor;
  165|  14.1M|  numpix = h_expand * v_expand;
  166|  14.1M|  numpix2 = numpix / 2;
  167|       |
  168|       |  /* Expand input data enough to let all the output samples be generated
  169|       |   * by the standard loop.  Special-casing padded output would be more
  170|       |   * efficient.
  171|       |   */
  172|  14.1M|  expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
  173|  14.1M|                    output_cols * h_expand);
  174|       |
  175|  14.1M|  inrow = 0;
  176|  28.2M|  for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
  ------------------
  |  Branch (176:20): [True: 14.1M, False: 14.1M]
  ------------------
  177|  14.1M|    outptr = output_data[outrow];
  178|   168M|    for (outcol = 0, outcol_h = 0; outcol < output_cols;
  ------------------
  |  Branch (178:36): [True: 154M, False: 14.1M]
  ------------------
  179|   154M|         outcol++, outcol_h += h_expand) {
  180|   154M|      outvalue = 0;
  181|   376M|      for (v = 0; v < v_expand; v++) {
  ------------------
  |  Branch (181:19): [True: 221M, False: 154M]
  ------------------
  182|   221M|        inptr = input_data[inrow + v] + outcol_h;
  183|   706M|        for (h = 0; h < h_expand; h++) {
  ------------------
  |  Branch (183:21): [True: 485M, False: 221M]
  ------------------
  184|   485M|          outvalue += (JLONG)(*inptr++);
  185|   485M|        }
  186|   221M|      }
  187|   154M|      *outptr++ = (_JSAMPLE)((outvalue + numpix2) / numpix);
  188|   154M|    }
  189|  14.1M|    inrow += v_expand;
  190|  14.1M|  }
  191|  14.1M|}

jpeg_mem_dest_tj:
  164|  79.1k|{
  165|  79.1k|  boolean reused = FALSE;
  ------------------
  |  |  207|  79.1k|#define FALSE   0               /* values of boolean */
  ------------------
  166|  79.1k|  my_mem_dest_ptr dest;
  167|       |
  168|  79.1k|  if (outbuffer == NULL || outsize == NULL)     /* sanity check */
  ------------------
  |  Branch (168:7): [True: 0, False: 79.1k]
  |  Branch (168:28): [True: 0, False: 79.1k]
  ------------------
  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|  79.1k|  if (cinfo->dest == NULL) {    /* first time for this JPEG object? */
  ------------------
  |  Branch (174:7): [True: 56.7k, False: 22.3k]
  ------------------
  175|  56.7k|    cinfo->dest = (struct jpeg_destination_mgr *)
  176|  56.7k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  56.7k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  177|  56.7k|                                  sizeof(my_mem_destination_mgr));
  178|  56.7k|    dest = (my_mem_dest_ptr)cinfo->dest;
  179|  56.7k|    dest->newbuffer = NULL;
  180|  56.7k|    dest->buffer = NULL;
  181|  56.7k|  } else if (cinfo->dest->init_destination != init_mem_destination) {
  ------------------
  |  Branch (181:14): [True: 0, False: 22.3k]
  ------------------
  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|  79.1k|  dest = (my_mem_dest_ptr)cinfo->dest;
  189|  79.1k|  dest->pub.init_destination = init_mem_destination;
  190|  79.1k|  dest->pub.empty_output_buffer = empty_mem_output_buffer;
  191|  79.1k|  dest->pub.term_destination = term_mem_destination;
  192|  79.1k|  if (dest->buffer == *outbuffer && *outbuffer != NULL && alloc)
  ------------------
  |  Branch (192:7): [True: 0, False: 79.1k]
  |  Branch (192:37): [True: 0, False: 0]
  |  Branch (192:59): [True: 0, False: 0]
  ------------------
  193|      0|    reused = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  194|  79.1k|  dest->outbuffer = outbuffer;
  195|  79.1k|  dest->outsize = outsize;
  196|  79.1k|  dest->alloc = alloc;
  197|       |
  198|  79.1k|  if (*outbuffer == NULL || (*outsize == 0 && !reused)) {
  ------------------
  |  Branch (198:7): [True: 19.2k, False: 59.9k]
  |  Branch (198:30): [True: 0, False: 59.9k]
  |  Branch (198:47): [True: 0, False: 0]
  ------------------
  199|  19.2k|    if (alloc) {
  ------------------
  |  Branch (199:9): [True: 19.2k, False: 0]
  ------------------
  200|       |      /* Allocate initial buffer */
  201|  19.2k|      dest->newbuffer = *outbuffer = (unsigned char *)MALLOC(OUTPUT_BUF_SIZE);
  ------------------
  |  |  520|  19.2k|#define MALLOC(size)  malloc(size)
  ------------------
  202|  19.2k|      if (dest->newbuffer == NULL)
  ------------------
  |  Branch (202:11): [True: 0, False: 19.2k]
  ------------------
  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|  19.2k|      *outsize = OUTPUT_BUF_SIZE;
  ------------------
  |  |   34|  19.2k|#define OUTPUT_BUF_SIZE  4096   /* choose an efficiently fwrite'able size */
  ------------------
  205|  19.2k|    } 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|  19.2k|  } else
  208|  59.9k|    dest->newbuffer = *outbuffer;
  209|       |
  210|  79.1k|  dest->pub.next_output_byte = dest->buffer = *outbuffer;
  211|  79.1k|  if (!reused)
  ------------------
  |  Branch (211:7): [True: 79.1k, False: 0]
  ------------------
  212|  79.1k|    dest->bufsize = *outsize;
  213|  79.1k|  dest->pub.free_in_buffer = dest->bufsize;
  214|  79.1k|}
jdatadst-tj.c:init_mem_destination:
   60|  22.3k|{
   61|       |  /* no work necessary here */
   62|  22.3k|}
jdatadst-tj.c:empty_mem_output_buffer:
   90|  8.71k|{
   91|  8.71k|  size_t nextsize;
   92|  8.71k|  JOCTET *nextbuffer;
   93|  8.71k|  my_mem_dest_ptr dest = (my_mem_dest_ptr)cinfo->dest;
   94|       |
   95|  8.71k|  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: 8.71k]
  ------------------
   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|  8.71k|  if (dest->bufsize > SIZE_MAX / 2)
  ------------------
  |  Branch (107:7): [True: 0, False: 8.71k]
  ------------------
  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|  8.71k|  nextsize = dest->bufsize * 2;
  110|  8.71k|  nextbuffer = (JOCTET *)MALLOC(nextsize);
  ------------------
  |  |  520|  8.71k|#define MALLOC(size)  malloc(size)
  ------------------
  111|       |
  112|  8.71k|  if (nextbuffer == NULL)
  ------------------
  |  Branch (112:7): [True: 0, False: 8.71k]
  ------------------
  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|  8.71k|  memcpy(nextbuffer, dest->buffer, dest->bufsize);
  116|       |
  117|  8.71k|  free(dest->newbuffer);
  118|       |
  119|  8.71k|  dest->newbuffer = nextbuffer;
  120|       |
  121|  8.71k|  dest->pub.next_output_byte = nextbuffer + dest->bufsize;
  122|  8.71k|  dest->pub.free_in_buffer = dest->bufsize;
  123|       |
  124|  8.71k|  dest->buffer = nextbuffer;
  125|  8.71k|  dest->bufsize = nextsize;
  126|       |
  127|  8.71k|  return TRUE;
  ------------------
  |  |  210|  8.71k|#define TRUE    1
  ------------------
  128|  8.71k|}
jdatadst-tj.c:term_mem_destination:
  142|  22.3k|{
  143|  22.3k|  my_mem_dest_ptr dest = (my_mem_dest_ptr)cinfo->dest;
  144|       |
  145|  22.3k|  if (dest->alloc) *dest->outbuffer = dest->buffer;
  ------------------
  |  Branch (145:7): [True: 19.2k, False: 3.16k]
  ------------------
  146|  22.3k|  *dest->outsize = dest->bufsize - dest->pub.free_in_buffer;
  147|  22.3k|}

jpeg_std_error:
  229|  56.7k|{
  230|  56.7k|  memset(err, 0, sizeof(struct jpeg_error_mgr));
  231|       |
  232|  56.7k|  err->error_exit = error_exit;
  233|  56.7k|  err->emit_message = emit_message;
  234|  56.7k|  err->output_message = output_message;
  235|  56.7k|  err->format_message = format_message;
  236|  56.7k|  err->reset_error_mgr = reset_error_mgr;
  237|       |
  238|       |  /* Initialize message table pointers */
  239|  56.7k|  err->jpeg_message_table = jpeg_std_message_table;
  240|  56.7k|  err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1;
  241|       |
  242|  56.7k|  return err;
  243|  56.7k|}
jerror.c:emit_message:
  126|  35.4k|{
  127|  35.4k|  struct jpeg_error_mgr *err = cinfo->err;
  128|       |
  129|  35.4k|  if (msg_level < 0) {
  ------------------
  |  Branch (129:7): [True: 0, False: 35.4k]
  ------------------
  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|  35.4k|  } else {
  139|       |    /* It's a trace message.  Show it if trace_level >= msg_level. */
  140|  35.4k|    if (err->trace_level >= msg_level)
  ------------------
  |  Branch (140:9): [True: 0, False: 35.4k]
  ------------------
  141|      0|      (*err->output_message) (cinfo);
  142|  35.4k|  }
  143|  35.4k|}
jerror.c:format_message:
  155|  36.8k|{
  156|  36.8k|  struct jpeg_error_mgr *err = cinfo->err;
  157|  36.8k|  int msg_code = err->msg_code;
  158|  36.8k|  const char *msgtext = NULL;
  159|  36.8k|  const char *msgptr;
  160|  36.8k|  char ch;
  161|  36.8k|  boolean isstring;
  162|       |
  163|       |  /* Look up message string in proper table */
  164|  36.8k|  if (msg_code > 0 && msg_code <= err->last_jpeg_message) {
  ------------------
  |  Branch (164:7): [True: 36.8k, False: 0]
  |  Branch (164:23): [True: 11.6k, False: 25.1k]
  ------------------
  165|  11.6k|    msgtext = err->jpeg_message_table[msg_code];
  166|  25.1k|  } else if (err->addon_message_table != NULL &&
  ------------------
  |  Branch (166:14): [True: 25.1k, False: 0]
  ------------------
  167|  25.1k|             msg_code >= err->first_addon_message &&
  ------------------
  |  Branch (167:14): [True: 25.1k, False: 0]
  ------------------
  168|  25.1k|             msg_code <= err->last_addon_message) {
  ------------------
  |  Branch (168:14): [True: 25.1k, False: 0]
  ------------------
  169|  25.1k|    msgtext = err->addon_message_table[msg_code - err->first_addon_message];
  170|  25.1k|  }
  171|       |
  172|       |  /* Defend against bogus message number */
  173|  36.8k|  if (msgtext == NULL) {
  ------------------
  |  Branch (173:7): [True: 0, False: 36.8k]
  ------------------
  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|  36.8k|  isstring = FALSE;
  ------------------
  |  |  207|  36.8k|#define FALSE   0               /* values of boolean */
  ------------------
  180|  36.8k|  msgptr = msgtext;
  181|  1.06M|  while ((ch = *msgptr++) != '\0') {
  ------------------
  |  Branch (181:10): [True: 1.04M, False: 16.0k]
  ------------------
  182|  1.04M|    if (ch == '%') {
  ------------------
  |  Branch (182:9): [True: 20.7k, False: 1.02M]
  ------------------
  183|  20.7k|      if (*msgptr == 's') isstring = TRUE;
  ------------------
  |  |  210|  16.4k|#define TRUE    1
  ------------------
  |  Branch (183:11): [True: 16.4k, False: 4.26k]
  ------------------
  184|  20.7k|      break;
  185|  20.7k|    }
  186|  1.04M|  }
  187|       |
  188|       |  /* Format the message into the passed buffer */
  189|  36.8k|  if (isstring)
  ------------------
  |  Branch (189:7): [True: 16.4k, False: 20.3k]
  ------------------
  190|  16.4k|    SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
  ------------------
  |  |   55|  16.4k|#define SNPRINTF  snprintf
  ------------------
                  SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
  ------------------
  |  |  792|  16.4k|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  191|  20.3k|  else
  192|  20.3k|    SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |   55|  20.3k|#define SNPRINTF  snprintf
  ------------------
                  SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |  792|  20.3k|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  193|  20.3k|             err->msg_parm.i[0], err->msg_parm.i[1],
  194|  20.3k|             err->msg_parm.i[2], err->msg_parm.i[3],
  195|  20.3k|             err->msg_parm.i[4], err->msg_parm.i[5],
  196|  20.3k|             err->msg_parm.i[6], err->msg_parm.i[7]);
  197|  36.8k|}
jerror.c:reset_error_mgr:
  210|  22.3k|{
  211|  22.3k|  cinfo->err->num_warnings = 0;
  212|       |  /* trace_level is not reset since it is an application-supplied parameter */
  213|  22.3k|  cinfo->err->msg_code = 0;     /* may be useful as a flag for "no error" */
  214|  22.3k|}

jpeg12_fdct_ifast:
  118|  4.26M|{
  119|  4.26M|  DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
  120|  4.26M|  DCTELEM tmp10, tmp11, tmp12, tmp13;
  121|  4.26M|  DCTELEM z1, z2, z3, z4, z5, z11, z13;
  122|  4.26M|  DCTELEM *dataptr;
  123|  4.26M|  int ctr;
  124|  4.26M|  SHIFT_TEMPS
  125|       |
  126|       |  /* Pass 1: process rows. */
  127|       |
  128|  4.26M|  dataptr = data;
  129|  38.4M|  for (ctr = DCTSIZE - 1; ctr >= 0; ctr--) {
  ------------------
  |  |   66|  4.26M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (129:27): [True: 34.1M, False: 4.26M]
  ------------------
  130|  34.1M|    tmp0 = dataptr[0] + dataptr[7];
  131|  34.1M|    tmp7 = dataptr[0] - dataptr[7];
  132|  34.1M|    tmp1 = dataptr[1] + dataptr[6];
  133|  34.1M|    tmp6 = dataptr[1] - dataptr[6];
  134|  34.1M|    tmp2 = dataptr[2] + dataptr[5];
  135|  34.1M|    tmp5 = dataptr[2] - dataptr[5];
  136|  34.1M|    tmp3 = dataptr[3] + dataptr[4];
  137|  34.1M|    tmp4 = dataptr[3] - dataptr[4];
  138|       |
  139|       |    /* Even part */
  140|       |
  141|  34.1M|    tmp10 = tmp0 + tmp3;        /* phase 2 */
  142|  34.1M|    tmp13 = tmp0 - tmp3;
  143|  34.1M|    tmp11 = tmp1 + tmp2;
  144|  34.1M|    tmp12 = tmp1 - tmp2;
  145|       |
  146|  34.1M|    dataptr[0] = tmp10 + tmp11; /* phase 3 */
  147|  34.1M|    dataptr[4] = tmp10 - tmp11;
  148|       |
  149|  34.1M|    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
  ------------------
  |  |  109|  34.1M|#define MULTIPLY(var, const)  ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
  |  |  ------------------
  |  |  |  |  101|  34.1M|#define DESCALE(x, n)  RIGHT_SHIFT(x, n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|  34.1M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  150|  34.1M|    dataptr[2] = tmp13 + z1;    /* phase 5 */
  151|  34.1M|    dataptr[6] = tmp13 - z1;
  152|       |
  153|       |    /* Odd part */
  154|       |
  155|  34.1M|    tmp10 = tmp4 + tmp5;        /* phase 2 */
  156|  34.1M|    tmp11 = tmp5 + tmp6;
  157|  34.1M|    tmp12 = tmp6 + tmp7;
  158|       |
  159|       |    /* The rotator is modified from fig 4-8 to avoid extra negations. */
  160|  34.1M|    z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
  ------------------
  |  |  109|  34.1M|#define MULTIPLY(var, const)  ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
  |  |  ------------------
  |  |  |  |  101|  34.1M|#define DESCALE(x, n)  RIGHT_SHIFT(x, n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|  34.1M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  161|  34.1M|    z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
  ------------------
  |  |  109|  34.1M|#define MULTIPLY(var, const)  ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
  |  |  ------------------
  |  |  |  |  101|  34.1M|#define DESCALE(x, n)  RIGHT_SHIFT(x, n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|  34.1M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  162|  34.1M|    z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
  ------------------
  |  |  109|  34.1M|#define MULTIPLY(var, const)  ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
  |  |  ------------------
  |  |  |  |  101|  34.1M|#define DESCALE(x, n)  RIGHT_SHIFT(x, n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|  34.1M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  163|  34.1M|    z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
  ------------------
  |  |  109|  34.1M|#define MULTIPLY(var, const)  ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
  |  |  ------------------
  |  |  |  |  101|  34.1M|#define DESCALE(x, n)  RIGHT_SHIFT(x, n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|  34.1M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  164|       |
  165|  34.1M|    z11 = tmp7 + z3;            /* phase 5 */
  166|  34.1M|    z13 = tmp7 - z3;
  167|       |
  168|  34.1M|    dataptr[5] = z13 + z2;      /* phase 6 */
  169|  34.1M|    dataptr[3] = z13 - z2;
  170|  34.1M|    dataptr[1] = z11 + z4;
  171|  34.1M|    dataptr[7] = z11 - z4;
  172|       |
  173|  34.1M|    dataptr += DCTSIZE;         /* advance pointer to next row */
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  174|  34.1M|  }
  175|       |
  176|       |  /* Pass 2: process columns. */
  177|       |
  178|  4.26M|  dataptr = data;
  179|  38.4M|  for (ctr = DCTSIZE - 1; ctr >= 0; ctr--) {
  ------------------
  |  |   66|  4.26M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (179:27): [True: 34.1M, False: 4.26M]
  ------------------
  180|  34.1M|    tmp0 = dataptr[DCTSIZE * 0] + dataptr[DCTSIZE * 7];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp0 = dataptr[DCTSIZE * 0] + dataptr[DCTSIZE * 7];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  181|  34.1M|    tmp7 = dataptr[DCTSIZE * 0] - dataptr[DCTSIZE * 7];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp7 = dataptr[DCTSIZE * 0] - dataptr[DCTSIZE * 7];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  182|  34.1M|    tmp1 = dataptr[DCTSIZE * 1] + dataptr[DCTSIZE * 6];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp1 = dataptr[DCTSIZE * 1] + dataptr[DCTSIZE * 6];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  183|  34.1M|    tmp6 = dataptr[DCTSIZE * 1] - dataptr[DCTSIZE * 6];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp6 = dataptr[DCTSIZE * 1] - dataptr[DCTSIZE * 6];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  184|  34.1M|    tmp2 = dataptr[DCTSIZE * 2] + dataptr[DCTSIZE * 5];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp2 = dataptr[DCTSIZE * 2] + dataptr[DCTSIZE * 5];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  185|  34.1M|    tmp5 = dataptr[DCTSIZE * 2] - dataptr[DCTSIZE * 5];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp5 = dataptr[DCTSIZE * 2] - dataptr[DCTSIZE * 5];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  186|  34.1M|    tmp3 = dataptr[DCTSIZE * 3] + dataptr[DCTSIZE * 4];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp3 = dataptr[DCTSIZE * 3] + dataptr[DCTSIZE * 4];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  187|  34.1M|    tmp4 = dataptr[DCTSIZE * 3] - dataptr[DCTSIZE * 4];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp4 = dataptr[DCTSIZE * 3] - dataptr[DCTSIZE * 4];
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  188|       |
  189|       |    /* Even part */
  190|       |
  191|  34.1M|    tmp10 = tmp0 + tmp3;        /* phase 2 */
  192|  34.1M|    tmp13 = tmp0 - tmp3;
  193|  34.1M|    tmp11 = tmp1 + tmp2;
  194|  34.1M|    tmp12 = tmp1 - tmp2;
  195|       |
  196|  34.1M|    dataptr[DCTSIZE * 0] = tmp10 + tmp11; /* phase 3 */
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  197|  34.1M|    dataptr[DCTSIZE * 4] = tmp10 - tmp11;
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  198|       |
  199|  34.1M|    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
  ------------------
  |  |  109|  34.1M|#define MULTIPLY(var, const)  ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
  |  |  ------------------
  |  |  |  |  101|  34.1M|#define DESCALE(x, n)  RIGHT_SHIFT(x, n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|  34.1M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  200|  34.1M|    dataptr[DCTSIZE * 2] = tmp13 + z1; /* phase 5 */
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  201|  34.1M|    dataptr[DCTSIZE * 6] = tmp13 - z1;
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  202|       |
  203|       |    /* Odd part */
  204|       |
  205|  34.1M|    tmp10 = tmp4 + tmp5;        /* phase 2 */
  206|  34.1M|    tmp11 = tmp5 + tmp6;
  207|  34.1M|    tmp12 = tmp6 + tmp7;
  208|       |
  209|       |    /* The rotator is modified from fig 4-8 to avoid extra negations. */
  210|  34.1M|    z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
  ------------------
  |  |  109|  34.1M|#define MULTIPLY(var, const)  ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
  |  |  ------------------
  |  |  |  |  101|  34.1M|#define DESCALE(x, n)  RIGHT_SHIFT(x, n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|  34.1M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  211|  34.1M|    z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
  ------------------
  |  |  109|  34.1M|#define MULTIPLY(var, const)  ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
  |  |  ------------------
  |  |  |  |  101|  34.1M|#define DESCALE(x, n)  RIGHT_SHIFT(x, n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|  34.1M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  212|  34.1M|    z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
  ------------------
  |  |  109|  34.1M|#define MULTIPLY(var, const)  ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
  |  |  ------------------
  |  |  |  |  101|  34.1M|#define DESCALE(x, n)  RIGHT_SHIFT(x, n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|  34.1M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  213|  34.1M|    z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
  ------------------
  |  |  109|  34.1M|#define MULTIPLY(var, const)  ((DCTELEM)DESCALE((var) * (const), CONST_BITS))
  |  |  ------------------
  |  |  |  |  101|  34.1M|#define DESCALE(x, n)  RIGHT_SHIFT(x, n)
  |  |  |  |  ------------------
  |  |  |  |  |  |  542|  34.1M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  214|       |
  215|  34.1M|    z11 = tmp7 + z3;            /* phase 5 */
  216|  34.1M|    z13 = tmp7 - z3;
  217|       |
  218|  34.1M|    dataptr[DCTSIZE * 5] = z13 + z2; /* phase 6 */
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  219|  34.1M|    dataptr[DCTSIZE * 3] = z13 - z2;
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  220|  34.1M|    dataptr[DCTSIZE * 1] = z11 + z4;
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  221|  34.1M|    dataptr[DCTSIZE * 7] = z11 - z4;
  ------------------
  |  |   66|  34.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  222|       |
  223|  34.1M|    dataptr++;                  /* advance pointer to next column */
  224|  34.1M|  }
  225|  4.26M|}

jpeg12_fdct_islow:
  144|  16.2M|{
  145|  16.2M|  JLONG tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
  146|  16.2M|  JLONG tmp10, tmp11, tmp12, tmp13;
  147|  16.2M|  JLONG z1, z2, z3, z4, z5;
  148|  16.2M|  DCTELEM *dataptr;
  149|  16.2M|  int ctr;
  150|  16.2M|  SHIFT_TEMPS
  151|       |
  152|       |  /* Pass 1: process rows. */
  153|       |  /* Note results are scaled up by sqrt(8) compared to a true DCT; */
  154|       |  /* furthermore, we scale the results by 2**PASS1_BITS. */
  155|       |
  156|  16.2M|  dataptr = data;
  157|   146M|  for (ctr = DCTSIZE - 1; ctr >= 0; ctr--) {
  ------------------
  |  |   66|  16.2M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (157:27): [True: 129M, False: 16.2M]
  ------------------
  158|   129M|    tmp0 = dataptr[0] + dataptr[7];
  159|   129M|    tmp7 = dataptr[0] - dataptr[7];
  160|   129M|    tmp1 = dataptr[1] + dataptr[6];
  161|   129M|    tmp6 = dataptr[1] - dataptr[6];
  162|   129M|    tmp2 = dataptr[2] + dataptr[5];
  163|   129M|    tmp5 = dataptr[2] - dataptr[5];
  164|   129M|    tmp3 = dataptr[3] + dataptr[4];
  165|   129M|    tmp4 = dataptr[3] - dataptr[4];
  166|       |
  167|       |    /* Even part per LL&M figure 1 --- note that published figure is faulty;
  168|       |     * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
  169|       |     */
  170|       |
  171|   129M|    tmp10 = tmp0 + tmp3;
  172|   129M|    tmp13 = tmp0 - tmp3;
  173|   129M|    tmp11 = tmp1 + tmp2;
  174|   129M|    tmp12 = tmp1 - tmp2;
  175|       |
  176|   129M|    dataptr[0] = (DCTELEM)LEFT_SHIFT(tmp10 + tmp11, PASS1_BITS);
  ------------------
  |  |   85|   129M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  177|   129M|    dataptr[4] = (DCTELEM)LEFT_SHIFT(tmp10 - tmp11, PASS1_BITS);
  ------------------
  |  |   85|   129M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  178|       |
  179|   129M|    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  180|   129M|    dataptr[2] = (DCTELEM)DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  181|   129M|                                  CONST_BITS - PASS1_BITS);
  182|   129M|    dataptr[6] = (DCTELEM)DESCALE(z1 + MULTIPLY(tmp12, -FIX_1_847759065),
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  183|   129M|                                  CONST_BITS - PASS1_BITS);
  184|       |
  185|       |    /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
  186|       |     * cK represents cos(K*pi/16).
  187|       |     * i0..i3 in the paper are tmp4..tmp7 here.
  188|       |     */
  189|       |
  190|   129M|    z1 = tmp4 + tmp7;
  191|   129M|    z2 = tmp5 + tmp6;
  192|   129M|    z3 = tmp4 + tmp6;
  193|   129M|    z4 = tmp5 + tmp7;
  194|   129M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  195|       |
  196|   129M|    tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  197|   129M|    tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  198|   129M|    tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  199|   129M|    tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  200|   129M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  201|   129M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  202|   129M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  203|   129M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  204|       |
  205|   129M|    z3 += z5;
  206|   129M|    z4 += z5;
  207|       |
  208|   129M|    dataptr[7] = (DCTELEM)DESCALE(tmp4 + z1 + z3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  209|   129M|    dataptr[5] = (DCTELEM)DESCALE(tmp5 + z2 + z4, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  210|   129M|    dataptr[3] = (DCTELEM)DESCALE(tmp6 + z2 + z3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  211|   129M|    dataptr[1] = (DCTELEM)DESCALE(tmp7 + z1 + z4, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  212|       |
  213|   129M|    dataptr += DCTSIZE;         /* advance pointer to next row */
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  214|   129M|  }
  215|       |
  216|       |  /* Pass 2: process columns.
  217|       |   * We remove the PASS1_BITS scaling, but leave the results scaled up
  218|       |   * by an overall factor of 8.
  219|       |   */
  220|       |
  221|  16.2M|  dataptr = data;
  222|   146M|  for (ctr = DCTSIZE - 1; ctr >= 0; ctr--) {
  ------------------
  |  |   66|  16.2M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (222:27): [True: 129M, False: 16.2M]
  ------------------
  223|   129M|    tmp0 = dataptr[DCTSIZE * 0] + dataptr[DCTSIZE * 7];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp0 = dataptr[DCTSIZE * 0] + dataptr[DCTSIZE * 7];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  224|   129M|    tmp7 = dataptr[DCTSIZE * 0] - dataptr[DCTSIZE * 7];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp7 = dataptr[DCTSIZE * 0] - dataptr[DCTSIZE * 7];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  225|   129M|    tmp1 = dataptr[DCTSIZE * 1] + dataptr[DCTSIZE * 6];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp1 = dataptr[DCTSIZE * 1] + dataptr[DCTSIZE * 6];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  226|   129M|    tmp6 = dataptr[DCTSIZE * 1] - dataptr[DCTSIZE * 6];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp6 = dataptr[DCTSIZE * 1] - dataptr[DCTSIZE * 6];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  227|   129M|    tmp2 = dataptr[DCTSIZE * 2] + dataptr[DCTSIZE * 5];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp2 = dataptr[DCTSIZE * 2] + dataptr[DCTSIZE * 5];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  228|   129M|    tmp5 = dataptr[DCTSIZE * 2] - dataptr[DCTSIZE * 5];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp5 = dataptr[DCTSIZE * 2] - dataptr[DCTSIZE * 5];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  229|   129M|    tmp3 = dataptr[DCTSIZE * 3] + dataptr[DCTSIZE * 4];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp3 = dataptr[DCTSIZE * 3] + dataptr[DCTSIZE * 4];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  230|   129M|    tmp4 = dataptr[DCTSIZE * 3] - dataptr[DCTSIZE * 4];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  tmp4 = dataptr[DCTSIZE * 3] - dataptr[DCTSIZE * 4];
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  231|       |
  232|       |    /* Even part per LL&M figure 1 --- note that published figure is faulty;
  233|       |     * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
  234|       |     */
  235|       |
  236|   129M|    tmp10 = tmp0 + tmp3;
  237|   129M|    tmp13 = tmp0 - tmp3;
  238|   129M|    tmp11 = tmp1 + tmp2;
  239|   129M|    tmp12 = tmp1 - tmp2;
  240|       |
  241|   129M|    dataptr[DCTSIZE * 0] = (DCTELEM)DESCALE(tmp10 + tmp11, PASS1_BITS);
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  dataptr[DCTSIZE * 0] = (DCTELEM)DESCALE(tmp10 + tmp11, PASS1_BITS);
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  242|   129M|    dataptr[DCTSIZE * 4] = (DCTELEM)DESCALE(tmp10 - tmp11, PASS1_BITS);
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  dataptr[DCTSIZE * 4] = (DCTELEM)DESCALE(tmp10 - tmp11, PASS1_BITS);
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  243|       |
  244|   129M|    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  245|   129M|    dataptr[DCTSIZE * 2] =
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  246|   129M|      (DCTELEM)DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  247|   129M|                       CONST_BITS + PASS1_BITS);
  248|   129M|    dataptr[DCTSIZE * 6] =
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  249|   129M|      (DCTELEM)DESCALE(z1 + MULTIPLY(tmp12, -FIX_1_847759065),
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  250|   129M|                       CONST_BITS + PASS1_BITS);
  251|       |
  252|       |    /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
  253|       |     * cK represents cos(K*pi/16).
  254|       |     * i0..i3 in the paper are tmp4..tmp7 here.
  255|       |     */
  256|       |
  257|   129M|    z1 = tmp4 + tmp7;
  258|   129M|    z2 = tmp5 + tmp6;
  259|   129M|    z3 = tmp4 + tmp6;
  260|   129M|    z4 = tmp5 + tmp7;
  261|   129M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  262|       |
  263|   129M|    tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  264|   129M|    tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  265|   129M|    tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  266|   129M|    tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  267|   129M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  268|   129M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  269|   129M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  270|   129M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  134|   129M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  271|       |
  272|   129M|    z3 += z5;
  273|   129M|    z4 += z5;
  274|       |
  275|   129M|    dataptr[DCTSIZE * 7] = (DCTELEM)DESCALE(tmp4 + z1 + z3,
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  dataptr[DCTSIZE * 7] = (DCTELEM)DESCALE(tmp4 + z1 + z3,
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  276|   129M|                                            CONST_BITS + PASS1_BITS);
  277|   129M|    dataptr[DCTSIZE * 5] = (DCTELEM)DESCALE(tmp5 + z2 + z4,
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  dataptr[DCTSIZE * 5] = (DCTELEM)DESCALE(tmp5 + z2 + z4,
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  278|   129M|                                            CONST_BITS + PASS1_BITS);
  279|   129M|    dataptr[DCTSIZE * 3] = (DCTELEM)DESCALE(tmp6 + z2 + z3,
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  dataptr[DCTSIZE * 3] = (DCTELEM)DESCALE(tmp6 + z2 + z3,
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  280|   129M|                                            CONST_BITS + PASS1_BITS);
  281|   129M|    dataptr[DCTSIZE * 1] = (DCTELEM)DESCALE(tmp7 + z1 + z4,
  ------------------
  |  |   66|   129M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  dataptr[DCTSIZE * 1] = (DCTELEM)DESCALE(tmp7 + z1 + z4,
  ------------------
  |  |  216|   129M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   129M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  282|   129M|                                            CONST_BITS + PASS1_BITS);
  283|       |
  284|   129M|    dataptr++;                  /* advance pointer to next column */
  285|   129M|  }
  286|  16.2M|}

jmemmgr.c:GETENV_S:
   80|  56.7k|{
   81|  56.7k|  char *env;
   82|       |
   83|  56.7k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 56.7k]
  ------------------
   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|  56.7k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 56.7k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|  56.7k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 56.7k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|  56.7k|  env = getenv(name);
   97|  56.7k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 56.7k, False: 0]
  ------------------
   98|  56.7k|  {
   99|  56.7k|    *buffer = 0;
  100|  56.7k|    return 0;
  101|  56.7k|  }
  102|       |
  103|      0|  if (strlen(env) + 1 > buffer_size) {
  ------------------
  |  Branch (103:7): [True: 0, False: 0]
  ------------------
  104|      0|    *buffer = 0;
  105|      0|    return ERANGE;
  106|      0|  }
  107|       |
  108|      0|  strncpy(buffer, env, buffer_size);
  109|       |
  110|      0|  return 0;
  111|      0|}
jsimd.c:GETENV_S:
   80|  11.7k|{
   81|  11.7k|  char *env;
   82|       |
   83|  11.7k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 11.7k]
  ------------------
   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|  11.7k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 11.7k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|  11.7k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 11.7k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|  11.7k|  env = getenv(name);
   97|  11.7k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 11.7k, False: 0]
  ------------------
   98|  11.7k|  {
   99|  11.7k|    *buffer = 0;
  100|  11.7k|    return 0;
  101|  11.7k|  }
  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|  56.7k|{
 1197|  56.7k|  my_mem_ptr mem;
 1198|  56.7k|  long max_to_use;
 1199|  56.7k|  int pool;
 1200|  56.7k|  size_t test_mac;
 1201|       |
 1202|  56.7k|  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|  56.7k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  56.7k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  56.7k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1211:7): [Folded, False: 56.7k]
  ------------------
 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|  56.7k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  56.7k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1219|  56.7k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|   113k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1219:7): [True: 0, False: 56.7k]
  ------------------
 1220|  56.7k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  56.7k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  56.7k|#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|  56.7k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1224|       |
 1225|       |  /* Attempt to allocate memory manager's control block */
 1226|  56.7k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1227|       |
 1228|  56.7k|  if (mem == NULL) {
  ------------------
  |  Branch (1228:7): [True: 0, False: 56.7k]
  ------------------
 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|  56.7k|  mem->pub.alloc_small = alloc_small;
 1235|  56.7k|  mem->pub.alloc_large = alloc_large;
 1236|  56.7k|  mem->pub.alloc_sarray = alloc_sarray;
 1237|  56.7k|  mem->pub.alloc_barray = alloc_barray;
 1238|  56.7k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1239|  56.7k|  mem->pub.request_virt_barray = request_virt_barray;
 1240|  56.7k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1241|  56.7k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1242|  56.7k|  mem->pub.access_virt_barray = access_virt_barray;
 1243|  56.7k|  mem->pub.free_pool = free_pool;
 1244|  56.7k|  mem->pub.self_destruct = self_destruct;
 1245|       |
 1246|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1247|  56.7k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  56.7k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1248|       |
 1249|       |  /* Initialize working state */
 1250|  56.7k|  mem->pub.max_memory_to_use = max_to_use;
 1251|       |
 1252|   170k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  56.7k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|   170k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1252:35): [True: 113k, False: 56.7k]
  ------------------
 1253|   113k|    mem->small_list[pool] = NULL;
 1254|   113k|    mem->large_list[pool] = NULL;
 1255|   113k|  }
 1256|  56.7k|  mem->virt_sarray_list = NULL;
 1257|  56.7k|  mem->virt_barray_list = NULL;
 1258|       |
 1259|  56.7k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1260|       |
 1261|       |  /* Declare ourselves open for business */
 1262|  56.7k|  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|  56.7k|#ifndef NO_GETENV
 1271|  56.7k|  {
 1272|  56.7k|    char memenv[30] = { 0 };
 1273|       |
 1274|  56.7k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1274:9): [True: 56.7k, False: 0]
  |  Branch (1274:45): [True: 0, False: 56.7k]
  ------------------
 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|  56.7k|  }
 1288|  56.7k|#endif
 1289|       |
 1290|  56.7k|}
jmemmgr.c:alloc_small:
  269|   869k|{
  270|   869k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  271|   869k|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  272|   869k|  char *data_ptr;
  273|   869k|  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|   869k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   869k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (281:7): [True: 0, False: 869k]
  ------------------
  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|   869k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|   869k|#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|   869k|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|   869k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (289:7): [True: 0, False: 869k]
  ------------------
  290|   869k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|   869k|#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|   869k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|   869k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (294:7): [True: 0, False: 869k]
  |  Branch (294:22): [True: 0, False: 869k]
  ------------------
  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|   869k|  prev_hdr_ptr = NULL;
  297|   869k|  hdr_ptr = mem->small_list[pool_id];
  298|  1.02M|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (298:10): [True: 839k, False: 183k]
  ------------------
  299|   839k|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (299:9): [True: 685k, False: 153k]
  ------------------
  300|   685k|      break;                    /* found pool with enough space */
  301|   153k|    prev_hdr_ptr = hdr_ptr;
  302|   153k|    hdr_ptr = hdr_ptr->next;
  303|   153k|  }
  304|       |
  305|       |  /* Time to make a new pool? */
  306|   869k|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (306:7): [True: 183k, False: 685k]
  ------------------
  307|       |    /* min_request is what we need now, slop is what will be leftover */
  308|   183k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   183k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  309|   183k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (309:9): [True: 128k, False: 55.5k]
  ------------------
  310|   128k|      slop = first_pool_slop[pool_id];
  311|  55.5k|    else
  312|  55.5k|      slop = extra_pool_slop[pool_id];
  313|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  314|   183k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|   183k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (314:9): [True: 0, False: 183k]
  ------------------
  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|   183k|    for (;;) {
  318|   183k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  319|   183k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (319:11): [True: 183k, False: 0]
  ------------------
  320|   183k|        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|   183k|    mem->total_space_allocated += min_request + slop;
  326|       |    /* Success, initialize the new pool header and add to end of list */
  327|   183k|    hdr_ptr->next = NULL;
  328|   183k|    hdr_ptr->bytes_used = 0;
  329|   183k|    hdr_ptr->bytes_left = sizeofobject + slop;
  330|   183k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (330:9): [True: 128k, False: 55.5k]
  ------------------
  331|   128k|      mem->small_list[pool_id] = hdr_ptr;
  332|  55.5k|    else
  333|  55.5k|      prev_hdr_ptr->next = hdr_ptr;
  334|   183k|  }
  335|       |
  336|       |  /* OK, allocate the object from the current pool */
  337|   869k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  338|   869k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  339|   869k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|   869k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (339:7): [True: 869k, False: 0]
  ------------------
  340|   869k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   869k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   869k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  341|   869k|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  342|   869k|  hdr_ptr->bytes_used += sizeofobject;
  343|   869k|  hdr_ptr->bytes_left -= sizeofobject;
  344|       |
  345|   869k|  return (void *)data_ptr;
  346|   869k|}
jmemmgr.c:round_up_pow2:
   45|  1.21M|{
   46|  1.21M|  return ((a + b - 1) & (~(b - 1)));
   47|  1.21M|}
jmemmgr.c:alloc_large:
  366|   196k|{
  367|   196k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  368|   196k|  large_pool_ptr hdr_ptr;
  369|   196k|  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|   196k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   196k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (376:7): [True: 0, False: 196k]
  ------------------
  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|   196k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|   196k|#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|   196k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|   196k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (384:7): [True: 0, False: 196k]
  ------------------
  385|   196k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|   196k|#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|   196k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|   196k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (389:7): [True: 0, False: 196k]
  |  Branch (389:22): [True: 0, False: 196k]
  ------------------
  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|   196k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  393|   196k|                                           sizeof(large_pool_hdr) +
  394|   196k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|   196k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  395|   196k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (395:7): [True: 0, False: 196k]
  ------------------
  396|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  397|   196k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  398|   196k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|   196k|#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|   196k|  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|   196k|  hdr_ptr->bytes_used = sizeofobject;
  406|   196k|  hdr_ptr->bytes_left = 0;
  407|   196k|  mem->large_list[pool_id] = hdr_ptr;
  408|       |
  409|   196k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  410|   196k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  411|   196k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|   196k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (411:7): [True: 196k, False: 0]
  ------------------
  412|   196k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   196k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   196k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  413|       |
  414|   196k|  return (void *)data_ptr;
  415|   196k|}
jmemmgr.c:alloc_sarray:
  438|   145k|{
  439|   145k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  440|   145k|  JSAMPARRAY result;
  441|   145k|  JSAMPROW workspace;
  442|   145k|  JDIMENSION rowsperchunk, currow, i;
  443|   145k|  long ltemp;
  444|   145k|  J12SAMPARRAY result12;
  445|   145k|  J12SAMPROW workspace12;
  446|   145k|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  447|   145k|  J16SAMPARRAY result16;
  448|   145k|  J16SAMPROW workspace16;
  449|   145k|#endif
  450|   145k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (450:24): [True: 0, False: 145k]
  ------------------
  451|      0|                        ((j_decompress_ptr)cinfo)->data_precision :
  452|   145k|                        ((j_compress_ptr)cinfo)->data_precision;
  453|   145k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (453:24): [True: 0, False: 145k]
  ------------------
  454|   145k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (454:45): [True: 145k, False: 0]
  ------------------
  455|   145k|                                            sizeof(J12SAMPLE) :
  456|   145k|                                            sizeof(JSAMPLE));
  457|       |
  458|       |  /* Make sure each row is properly aligned */
  459|   145k|  if ((ALIGN_SIZE % sample_size) != 0)
  ------------------
  |  |   89|   145k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (459:7): [True: 0, False: 145k]
  ------------------
  460|      0|    out_of_memory(cinfo, 5);    /* safety check */
  461|       |
  462|   145k|  if (samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   145k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (462:7): [True: 0, False: 145k]
  ------------------
  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|   145k|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|   145k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  468|   145k|                                                           sample_size);
  469|       |
  470|       |  /* Calculate max # of rows allowed in one allocation chunk */
  471|   145k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|   145k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  472|   145k|          ((long)samplesperrow * (long)sample_size);
  473|   145k|  if (ltemp <= 0)
  ------------------
  |  Branch (473:7): [True: 0, False: 145k]
  ------------------
  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|   145k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (475:7): [True: 0, False: 145k]
  ------------------
  476|      0|    rowsperchunk = (JDIMENSION)ltemp;
  477|   145k|  else
  478|   145k|    rowsperchunk = numrows;
  479|   145k|  mem->last_rowsperchunk = rowsperchunk;
  480|       |
  481|   145k|  if (data_precision <= 8) {
  ------------------
  |  Branch (481:7): [True: 0, False: 145k]
  ------------------
  482|       |    /* Get space for row pointers (small object) */
  483|      0|    result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  484|      0|                                     (size_t)(numrows * sizeof(JSAMPROW)));
  485|       |
  486|       |    /* Get the rows themselves (large objects) */
  487|      0|    currow = 0;
  488|      0|    while (currow < numrows) {
  ------------------
  |  Branch (488:12): [True: 0, False: 0]
  ------------------
  489|      0|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|      0|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  490|      0|      workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  491|      0|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  492|      0|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (492:30): [True: 0, False: 0]
  ------------------
  493|      0|        result[currow++] = workspace;
  494|      0|        workspace += samplesperrow;
  495|      0|      }
  496|      0|    }
  497|       |
  498|      0|    return result;
  499|   145k|  } else if (data_precision <= 12) {
  ------------------
  |  Branch (499:14): [True: 145k, False: 0]
  ------------------
  500|       |    /* Get space for row pointers (small object) */
  501|   145k|    result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
  502|   145k|                                         (size_t)(numrows *
  503|   145k|                                                  sizeof(J12SAMPROW)));
  504|       |
  505|       |    /* Get the rows themselves (large objects) */
  506|   145k|    currow = 0;
  507|   291k|    while (currow < numrows) {
  ------------------
  |  Branch (507:12): [True: 145k, False: 145k]
  ------------------
  508|   145k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|   145k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 145k]
  |  |  ------------------
  ------------------
  509|   145k|      workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
  510|   145k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  511|   782k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (511:30): [True: 637k, False: 145k]
  ------------------
  512|   637k|        result12[currow++] = workspace12;
  513|   637k|        workspace12 += samplesperrow;
  514|   637k|      }
  515|   145k|    }
  516|       |
  517|   145k|    return (JSAMPARRAY)result12;
  518|   145k|  } 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|   145k|}
jmemmgr.c:alloc_barray:
  555|  47.3k|{
  556|  47.3k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  557|  47.3k|  JBLOCKARRAY result;
  558|  47.3k|  JBLOCKROW workspace;
  559|  47.3k|  JDIMENSION rowsperchunk, currow, i;
  560|  47.3k|  long ltemp;
  561|       |
  562|       |  /* Make sure each row is properly aligned */
  563|  47.3k|  if ((sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  47.3k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (563:7): [Folded, False: 47.3k]
  ------------------
  564|      0|    out_of_memory(cinfo, 6);    /* safety check */
  565|       |
  566|       |  /* Calculate max # of rows allowed in one allocation chunk */
  567|  47.3k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  47.3k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  568|  47.3k|          ((long)blocksperrow * sizeof(JBLOCK));
  569|  47.3k|  if (ltemp <= 0)
  ------------------
  |  Branch (569:7): [True: 0, False: 47.3k]
  ------------------
  570|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  571|  47.3k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (571:7): [True: 0, False: 47.3k]
  ------------------
  572|      0|    rowsperchunk = (JDIMENSION)ltemp;
  573|  47.3k|  else
  574|  47.3k|    rowsperchunk = numrows;
  575|  47.3k|  mem->last_rowsperchunk = rowsperchunk;
  576|       |
  577|       |  /* Get space for row pointers (small object) */
  578|  47.3k|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  579|  47.3k|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  580|       |
  581|       |  /* Get the rows themselves (large objects) */
  582|  47.3k|  currow = 0;
  583|  94.6k|  while (currow < numrows) {
  ------------------
  |  Branch (583:10): [True: 47.3k, False: 47.3k]
  ------------------
  584|  47.3k|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  47.3k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 47.3k]
  |  |  ------------------
  ------------------
  585|  47.3k|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  586|  47.3k|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  587|  47.3k|                  sizeof(JBLOCK)));
  588|  8.16M|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (588:28): [True: 8.11M, False: 47.3k]
  ------------------
  589|  8.11M|      result[currow++] = workspace;
  590|  8.11M|      workspace += blocksperrow;
  591|  8.11M|    }
  592|  47.3k|  }
  593|       |
  594|  47.3k|  return result;
  595|  47.3k|}
jmemmgr.c:request_virt_barray:
  670|  47.3k|{
  671|  47.3k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  672|  47.3k|  jvirt_barray_ptr result;
  673|       |
  674|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  675|  47.3k|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|  47.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (675:7): [True: 0, False: 47.3k]
  ------------------
  676|      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)))
  ------------------
  677|       |
  678|       |  /* get control block */
  679|  47.3k|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  680|  47.3k|                                         sizeof(struct jvirt_barray_control));
  681|       |
  682|  47.3k|  result->mem_buffer = NULL;    /* marks array not yet realized */
  683|  47.3k|  result->rows_in_array = numrows;
  684|  47.3k|  result->blocksperrow = blocksperrow;
  685|  47.3k|  result->maxaccess = maxaccess;
  686|  47.3k|  result->pre_zero = pre_zero;
  687|  47.3k|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|  47.3k|#define FALSE   0               /* values of boolean */
  ------------------
  688|  47.3k|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  689|  47.3k|  mem->virt_barray_list = result;
  690|       |
  691|  47.3k|  return result;
  692|  47.3k|}
jmemmgr.c:realize_virt_arrays:
  698|  43.9k|{
  699|  43.9k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  700|  43.9k|  size_t space_per_minheight, maximum_space, avail_mem;
  701|  43.9k|  size_t minheights, max_minheights;
  702|  43.9k|  jvirt_sarray_ptr sptr;
  703|  43.9k|  jvirt_barray_ptr bptr;
  704|  43.9k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (704:24): [True: 0, False: 43.9k]
  ------------------
  705|      0|                        ((j_decompress_ptr)cinfo)->data_precision :
  706|  43.9k|                        ((j_compress_ptr)cinfo)->data_precision;
  707|  43.9k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (707:24): [True: 0, False: 43.9k]
  ------------------
  708|  43.9k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (708:45): [True: 43.9k, False: 0]
  ------------------
  709|  43.9k|                                            sizeof(J12SAMPLE) :
  710|  43.9k|                                            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|  43.9k|  space_per_minheight = 0;
  717|  43.9k|  maximum_space = 0;
  718|  43.9k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (718:38): [True: 0, False: 43.9k]
  ------------------
  719|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (719:9): [True: 0, False: 0]
  ------------------
  720|      0|      size_t new_space = (size_t)sptr->rows_in_array *
  721|      0|                         (size_t)sptr->samplesperrow * sample_size;
  722|       |
  723|      0|      space_per_minheight += (size_t)sptr->maxaccess *
  724|      0|                             (size_t)sptr->samplesperrow * sample_size;
  725|      0|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (725:11): [True: 0, False: 0]
  ------------------
  726|      0|        out_of_memory(cinfo, 10);
  727|      0|      maximum_space += new_space;
  728|      0|    }
  729|      0|  }
  730|  91.2k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (730:38): [True: 47.3k, False: 43.9k]
  ------------------
  731|  47.3k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (731:9): [True: 47.3k, False: 0]
  ------------------
  732|  47.3k|      size_t new_space = (size_t)bptr->rows_in_array *
  733|  47.3k|                         (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  734|       |
  735|  47.3k|      space_per_minheight += (size_t)bptr->maxaccess *
  736|  47.3k|                             (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  737|  47.3k|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (737:11): [True: 0, False: 47.3k]
  ------------------
  738|      0|        out_of_memory(cinfo, 11);
  739|  47.3k|      maximum_space += new_space;
  740|  47.3k|    }
  741|  47.3k|  }
  742|       |
  743|  43.9k|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (743:7): [True: 24.6k, False: 19.2k]
  ------------------
  744|  24.6k|    return;                     /* no unrealized arrays, no work */
  745|       |
  746|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  747|  19.2k|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  748|  19.2k|                                 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|  19.2k|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (754:7): [True: 19.2k, False: 0]
  ------------------
  755|  19.2k|    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|  19.2k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (767:38): [True: 0, False: 19.2k]
  ------------------
  768|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (768:9): [True: 0, False: 0]
  ------------------
  769|      0|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  770|      0|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (770:11): [True: 0, False: 0]
  ------------------
  771|       |        /* This buffer fits in memory */
  772|      0|        sptr->rows_in_mem = sptr->rows_in_array;
  773|      0|      } 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|      0|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  783|      0|                                      sptr->samplesperrow, sptr->rows_in_mem);
  784|      0|      sptr->rowsperchunk = mem->last_rowsperchunk;
  785|      0|      sptr->cur_start_row = 0;
  786|      0|      sptr->first_undef_row = 0;
  787|      0|      sptr->dirty = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  788|      0|    }
  789|      0|  }
  790|       |
  791|  66.6k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (791:38): [True: 47.3k, False: 19.2k]
  ------------------
  792|  47.3k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (792:9): [True: 47.3k, False: 0]
  ------------------
  793|  47.3k|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  794|  47.3k|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (794:11): [True: 47.3k, False: 0]
  ------------------
  795|       |        /* This buffer fits in memory */
  796|  47.3k|        bptr->rows_in_mem = bptr->rows_in_array;
  797|  47.3k|      } 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|  47.3k|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  47.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  807|  47.3k|                                      bptr->blocksperrow, bptr->rows_in_mem);
  808|  47.3k|      bptr->rowsperchunk = mem->last_rowsperchunk;
  809|  47.3k|      bptr->cur_start_row = 0;
  810|  47.3k|      bptr->first_undef_row = 0;
  811|  47.3k|      bptr->dirty = FALSE;
  ------------------
  |  |  207|  47.3k|#define FALSE   0               /* values of boolean */
  ------------------
  812|  47.3k|    }
  813|  47.3k|  }
  814|  19.2k|}
jmemmgr.c:access_virt_barray:
 1015|  31.4M|{
 1016|  31.4M|  JDIMENSION end_row = start_row + num_rows;
 1017|  31.4M|  JDIMENSION undef_row;
 1018|       |
 1019|       |  /* debugging check */
 1020|  31.4M|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (1020:7): [True: 0, False: 31.4M]
  |  Branch (1020:39): [True: 0, False: 31.4M]
  ------------------
 1021|  31.4M|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (1021:7): [True: 0, False: 31.4M]
  ------------------
 1022|      0|    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1023|       |
 1024|       |  /* Make the desired part of the virtual array accessible */
 1025|  31.4M|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (1025:7): [True: 0, False: 31.4M]
  ------------------
 1026|  31.4M|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (1026:7): [True: 0, False: 31.4M]
  ------------------
 1027|      0|    if (!ptr->b_s_open)
  ------------------
  |  Branch (1027:9): [True: 0, False: 0]
  ------------------
 1028|      0|      ERREXIT(cinfo, JERR_VIRTUAL_BUG);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1029|       |    /* Flush old buffer contents if necessary */
 1030|      0|    if (ptr->dirty) {
  ------------------
  |  Branch (1030:9): [True: 0, False: 0]
  ------------------
 1031|      0|      do_barray_io(cinfo, ptr, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
 1032|      0|      ptr->dirty = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1033|      0|    }
 1034|       |    /* Decide what part of virtual array to access.
 1035|       |     * Algorithm: if target address > current window, assume forward scan,
 1036|       |     * load starting at target address.  If target address < current window,
 1037|       |     * assume backward scan, load so that target area is top of window.
 1038|       |     * Note that when switching from forward write to forward read, will have
 1039|       |     * start_row = 0, so the limiting case applies and we load from 0 anyway.
 1040|       |     */
 1041|      0|    if (start_row > ptr->cur_start_row) {
  ------------------
  |  Branch (1041:9): [True: 0, False: 0]
  ------------------
 1042|      0|      ptr->cur_start_row = start_row;
 1043|      0|    } else {
 1044|       |      /* use long arithmetic here to avoid overflow & unsigned problems */
 1045|      0|      long ltemp;
 1046|       |
 1047|      0|      ltemp = (long)end_row - (long)ptr->rows_in_mem;
 1048|      0|      if (ltemp < 0)
  ------------------
  |  Branch (1048:11): [True: 0, False: 0]
  ------------------
 1049|      0|        ltemp = 0;              /* don't fall off front end of file */
 1050|      0|      ptr->cur_start_row = (JDIMENSION)ltemp;
 1051|      0|    }
 1052|       |    /* Read in the selected part of the array.
 1053|       |     * During the initial write pass, we will do no actual read
 1054|       |     * because the selected part is all undefined.
 1055|       |     */
 1056|      0|    do_barray_io(cinfo, ptr, FALSE);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1057|      0|  }
 1058|       |  /* Ensure the accessed part of the array is defined; prezero if needed.
 1059|       |   * To improve locality of access, we only prezero the part of the array
 1060|       |   * that the caller is about to access, not the entire in-memory array.
 1061|       |   */
 1062|  31.4M|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (1062:7): [True: 7.52M, False: 23.9M]
  ------------------
 1063|  7.52M|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (1063:9): [True: 0, False: 7.52M]
  ------------------
 1064|      0|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (1064:11): [True: 0, False: 0]
  ------------------
 1065|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1066|      0|      undef_row = start_row;    /* but reader is allowed to read ahead */
 1067|  7.52M|    } else {
 1068|  7.52M|      undef_row = ptr->first_undef_row;
 1069|  7.52M|    }
 1070|  7.52M|    if (writable)
  ------------------
  |  Branch (1070:9): [True: 7.52M, False: 0]
  ------------------
 1071|  7.52M|      ptr->first_undef_row = end_row;
 1072|  7.52M|    if (ptr->pre_zero) {
  ------------------
  |  Branch (1072:9): [True: 0, False: 7.52M]
  ------------------
 1073|      0|      size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
 1074|      0|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
 1075|      0|      end_row -= ptr->cur_start_row;
 1076|      0|      while (undef_row < end_row) {
  ------------------
  |  Branch (1076:14): [True: 0, False: 0]
  ------------------
 1077|      0|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
 1078|      0|        undef_row++;
 1079|      0|      }
 1080|  7.52M|    } else {
 1081|  7.52M|      if (!writable)            /* reader looking at undefined data */
  ------------------
  |  Branch (1081:11): [True: 0, False: 7.52M]
  ------------------
 1082|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1083|  7.52M|    }
 1084|  7.52M|  }
 1085|       |  /* Flag the buffer dirty if caller will write in it */
 1086|  31.4M|  if (writable)
  ------------------
  |  Branch (1086:7): [True: 7.52M, False: 23.9M]
  ------------------
 1087|  7.52M|    ptr->dirty = TRUE;
  ------------------
  |  |  210|  7.52M|#define TRUE    1
  ------------------
 1088|       |  /* Return address of proper part of the buffer */
 1089|  31.4M|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1090|  31.4M|}
jmemmgr.c:free_pool:
 1099|   135k|{
 1100|   135k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1101|   135k|  small_pool_ptr shdr_ptr;
 1102|   135k|  large_pool_ptr lhdr_ptr;
 1103|   135k|  size_t space_freed;
 1104|       |
 1105|   135k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|   135k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1105:7): [True: 0, False: 135k]
  |  Branch (1105:22): [True: 0, False: 135k]
  ------------------
 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|   135k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  889|   135k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1114:7): [True: 79.1k, False: 56.7k]
  ------------------
 1115|  79.1k|    jvirt_sarray_ptr sptr;
 1116|  79.1k|    jvirt_barray_ptr bptr;
 1117|       |
 1118|  79.1k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1118:40): [True: 0, False: 79.1k]
  ------------------
 1119|      0|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1119:11): [True: 0, False: 0]
  ------------------
 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|      0|    }
 1124|  79.1k|    mem->virt_sarray_list = NULL;
 1125|   126k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1125:40): [True: 47.3k, False: 79.1k]
  ------------------
 1126|  47.3k|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1126:11): [True: 0, False: 47.3k]
  ------------------
 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|  47.3k|    }
 1131|  79.1k|    mem->virt_barray_list = NULL;
 1132|  79.1k|  }
 1133|       |
 1134|       |  /* Release large objects */
 1135|   135k|  lhdr_ptr = mem->large_list[pool_id];
 1136|   135k|  mem->large_list[pool_id] = NULL;
 1137|       |
 1138|   332k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1138:10): [True: 196k, False: 135k]
  ------------------
 1139|   196k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1140|   196k|    space_freed = lhdr_ptr->bytes_used +
 1141|   196k|                  lhdr_ptr->bytes_left +
 1142|   196k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   196k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1143|   196k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1144|   196k|    mem->total_space_allocated -= space_freed;
 1145|   196k|    lhdr_ptr = next_lhdr_ptr;
 1146|   196k|  }
 1147|       |
 1148|       |  /* Release small objects */
 1149|   135k|  shdr_ptr = mem->small_list[pool_id];
 1150|   135k|  mem->small_list[pool_id] = NULL;
 1151|       |
 1152|   319k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1152:10): [True: 183k, False: 135k]
  ------------------
 1153|   183k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1154|   183k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1155|   183k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   183k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1156|   183k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1157|   183k|    mem->total_space_allocated -= space_freed;
 1158|   183k|    shdr_ptr = next_shdr_ptr;
 1159|   183k|  }
 1160|   135k|}
jmemmgr.c:self_destruct:
 1170|  56.7k|{
 1171|  56.7k|  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|   170k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  56.7k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|   170k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1177:35): [True: 113k, False: 56.7k]
  ------------------
 1178|   113k|    free_pool(cinfo, pool);
 1179|   113k|  }
 1180|       |
 1181|       |  /* Release the memory manager control block too. */
 1182|  56.7k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1183|  56.7k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1184|       |
 1185|  56.7k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1186|  56.7k|}

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

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

jdiv_round_up:
   81|   285k|{
   82|   285k|  return (a + b - 1L) / b;
   83|   285k|}
jround_up:
   90|  94.6k|{
   91|  94.6k|  a += b - 1L;
   92|  94.6k|  return a - (a % b);
   93|  94.6k|}
jzero_far:
  144|  1.94M|{
  145|  1.94M|  memset(target, 0, bytestozero);
  146|  1.94M|}
j12copy_sample_rows:
  110|  39.1M|{
  111|  39.1M|  register _JSAMPROW inptr, outptr;
  112|  39.1M|  register size_t count = (size_t)(num_cols * sizeof(_JSAMPLE));
  113|  39.1M|  register int row;
  114|       |
  115|  39.1M|  input_array += source_row;
  116|  39.1M|  output_array += dest_row;
  117|       |
  118|  85.3M|  for (row = num_rows; row > 0; row--) {
  ------------------
  |  Branch (118:24): [True: 46.2M, False: 39.1M]
  ------------------
  119|  46.2M|    inptr = *input_array++;
  120|  46.2M|    outptr = *output_array++;
  121|  46.2M|    memcpy(outptr, inptr, count);
  122|  46.2M|  }
  123|  39.1M|}

jinit_read_bmp:
  662|     28|{
  663|     28|  bmp_source_ptr source;
  664|       |
  665|     28|  if (cinfo->data_precision != 8)
  ------------------
  |  Branch (665:7): [True: 28, False: 0]
  ------------------
  666|     28|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|     28|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     28|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     28|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  667|       |
  668|       |  /* Create module interface object */
  669|     28|  source = (bmp_source_ptr)
  670|     28|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     28|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  671|     28|                                sizeof(bmp_source_struct));
  672|     28|  source->cinfo = cinfo;        /* make back link for subroutines */
  673|       |  /* Fill in method ptrs, except get_pixel_rows which start_input sets */
  674|     28|  source->pub.start_input = start_input_bmp;
  675|     28|  source->pub.read_icc_profile = read_icc_profile_bmp;
  676|     28|  source->pub.finish_input = finish_input_bmp;
  677|     28|  source->pub.max_pixels = 0;
  678|       |
  679|     28|  source->use_inversion_array = use_inversion_array;
  680|       |
  681|     28|  return (cjpeg_source_ptr)source;
  682|     28|}

j12init_read_png:
  703|  32.8k|{
  704|  32.8k|  png_source_ptr source;
  705|       |
  706|       |#if BITS_IN_JSAMPLE == 8
  707|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  708|       |#else
  709|  32.8k|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|  65.6k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (709:7): [True: 0, False: 32.8k]
  ------------------
  710|  32.8k|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|  32.8k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (710:7): [True: 0, False: 32.8k]
  ------------------
  711|      0|#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|  32.8k|  source = (png_source_ptr)
  716|  32.8k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  32.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  717|  32.8k|                                sizeof(png_source_struct));
  718|       |  /* Fill in method ptrs, except get_pixel_rows which start_input sets */
  719|  32.8k|  source->pub.start_input = start_input_png;
  720|  32.8k|  source->pub.read_icc_profile = read_icc_profile_png;
  721|  32.8k|  source->pub.finish_input = finish_input_png;
  722|  32.8k|  source->pub.max_pixels = 0;
  723|       |
  724|  32.8k|  return (cjpeg_source_ptr)source;
  725|  32.8k|}
rdpng-12.c:start_input_png:
  472|  32.8k|{
  473|  32.8k|  png_source_ptr source = (png_source_ptr)sinfo;
  474|  32.8k|  struct spng_ihdr ihdr;
  475|  32.8k|  int png_components = 3;
  476|  32.8k|  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|  32.8k|  source->ctx = spng_ctx_new(0);
  487|  32.8k|#endif
  488|  32.8k|  if (!source->ctx)
  ------------------
  |  Branch (488:7): [True: 0, False: 32.8k]
  ------------------
  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|  32.8k|  TRY_SPNG(spng_set_png_file(source->ctx, sinfo->input_file));
  ------------------
  |  |   33|  32.8k|#define TRY_SPNG(f) { \
  |  |   34|  32.8k|  int __spng_error = (f); \
  |  |   35|  32.8k|  if (__spng_error) \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 0, False: 32.8k]
  |  |  ------------------
  |  |   36|  32.8k|    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|  32.8k|}
  ------------------
  492|       |
  493|  32.8k|  TRY_SPNG(spng_get_ihdr(source->ctx, &ihdr));
  ------------------
  |  |   33|  32.8k|#define TRY_SPNG(f) { \
  |  |   34|  32.8k|  int __spng_error = (f); \
  |  |   35|  32.8k|  if (__spng_error) \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 1.33k, False: 31.4k]
  |  |  ------------------
  |  |   36|  32.8k|    ERREXITS(cinfo, JERR_PNG_LIBSPNG, spng_strerror(__spng_error)); \
  |  |  ------------------
  |  |  |  |  274|  1.33k|  ((cinfo)->err->msg_code = (code), \
  |  |  |  |  275|  1.33k|   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX - 1), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|  1.33k|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  276|  1.33k|   (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|  1.33k|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  277|  1.33k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  |  |  ------------------
  |  |   37|  32.8k|}
  ------------------
  494|       |
  495|  32.8k|  if (ihdr.width > JPEG_MAX_DIMENSION || ihdr.height > JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  65.6k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
                if (ihdr.width > JPEG_MAX_DIMENSION || ihdr.height > JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  29.0k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (495:7): [True: 3.76k, False: 29.0k]
  |  Branch (495:42): [True: 1.28k, False: 27.7k]
  ------------------
  496|  3.72k|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|  3.72k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  3.72k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  3.72k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  497|  32.8k|  if (ihdr.bit_depth != 8 && ihdr.bit_depth != 16)
  ------------------
  |  Branch (497:7): [True: 12.4k, False: 20.3k]
  |  Branch (497:30): [True: 6.69k, False: 5.73k]
  ------------------
  498|  6.69k|    ERREXIT(cinfo, JERR_PNG_BADDEPTH);
  ------------------
  |  |  240|  6.69k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  6.69k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  499|  32.8k|  if (sinfo->max_pixels &&
  ------------------
  |  Branch (499:7): [True: 21.0k, False: 11.7k]
  ------------------
  500|  21.0k|      (unsigned long long)ihdr.width * ihdr.height > sinfo->max_pixels)
  ------------------
  |  Branch (500:7): [True: 252, False: 20.7k]
  ------------------
  501|    252|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, sinfo->max_pixels);
  ------------------
  |  |  243|    252|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    252|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    252|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  502|       |
  503|  32.8k|  cinfo->image_width = (JDIMENSION)ihdr.width;
  504|  32.8k|  cinfo->image_height = (JDIMENSION)ihdr.height;
  505|  32.8k|  source->png_bit_depth = ihdr.bit_depth;
  506|  32.8k|  source->png_color_type = ihdr.color_type;
  507|       |
  508|       |  /* initialize flags to most common settings */
  509|  32.8k|  use_raw_buffer = FALSE;       /* do we map input buffer onto I/O buffer? */
  ------------------
  |  |  207|  32.8k|#define FALSE   0               /* values of boolean */
  ------------------
  510|       |
  511|  32.8k|  switch (ihdr.color_type) {
  512|  1.05k|  case SPNG_COLOR_TYPE_GRAYSCALE_ALPHA:
  ------------------
  |  Branch (512:3): [True: 1.05k, False: 31.7k]
  ------------------
  513|  7.96k|  case SPNG_COLOR_TYPE_GRAYSCALE:
  ------------------
  |  Branch (513:3): [True: 6.90k, False: 25.8k]
  ------------------
  514|  7.96k|    if (cinfo->in_color_space == JCS_UNKNOWN ||
  ------------------
  |  Branch (514:9): [True: 0, False: 7.96k]
  ------------------
  515|  7.96k|        cinfo->in_color_space == JCS_RGB)
  ------------------
  |  Branch (515:9): [True: 0, False: 7.96k]
  ------------------
  516|      0|      cinfo->in_color_space = JCS_GRAYSCALE;
  517|  7.96k|    TRACEMS3(cinfo, 1, JTRC_PNG_GRAYSCALE, ihdr.width, ihdr.height,
  ------------------
  |  |  309|  7.96k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  7.96k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 7.96k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  7.96k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  7.96k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  7.96k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  518|  7.96k|             ihdr.bit_depth);
  519|  7.96k|    if (cinfo->in_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (519:9): [True: 1.13k, False: 6.82k]
  ------------------
  520|  1.13k|      if (ihdr.color_type == SPNG_COLOR_TYPE_GRAYSCALE &&
  ------------------
  |  Branch (520:11): [True: 987, False: 151]
  ------------------
  521|    987|          cinfo->data_precision == ihdr.bit_depth) {
  ------------------
  |  Branch (521:11): [True: 0, False: 987]
  ------------------
  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|  1.13k|        source->pub.get_pixel_rows = get_gray_row;
  526|  6.82k|    } else if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  6.82k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 6.82k]
  |  |  |  Branch (78:22): [True: 5.69k, False: 1.13k]
  |  |  |  Branch (78:43): [True: 5.69k, False: 0]
  |  |  ------------------
  ------------------
  527|  5.69k|      source->pub.get_pixel_rows = get_gray_rgb_row;
  528|  1.13k|    else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (528:14): [True: 1.13k, False: 0]
  ------------------
  529|  1.13k|        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|  7.96k|    if (ihdr.color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA) {
  ------------------
  |  Branch (532:9): [True: 1.05k, False: 6.90k]
  ------------------
  533|  1.05k|      png_components = 2;
  534|  1.05k|      source->png_alpha = 1;
  535|  6.90k|    } else {
  536|  6.90k|      png_components = 1;
  537|  6.90k|      source->png_alpha = 0;
  538|  6.90k|    }
  539|  7.96k|    break;
  540|       |
  541|  8.86k|  case SPNG_COLOR_TYPE_TRUECOLOR:
  ------------------
  |  Branch (541:3): [True: 8.86k, False: 23.9k]
  ------------------
  542|  12.1k|  case SPNG_COLOR_TYPE_TRUECOLOR_ALPHA:
  ------------------
  |  Branch (542:3): [True: 3.26k, False: 29.5k]
  ------------------
  543|  12.1k|    if (cinfo->in_color_space == JCS_UNKNOWN)
  ------------------
  |  Branch (543:9): [True: 0, False: 12.1k]
  ------------------
  544|      0|      cinfo->in_color_space = JCS_EXT_RGB;
  545|  12.1k|    TRACEMS3(cinfo, 1, JTRC_PNG_TRUECOLOR, ihdr.width, ihdr.height,
  ------------------
  |  |  309|  12.1k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  12.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 12.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  12.1k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  12.1k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  12.1k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  546|  12.1k|             ihdr.bit_depth);
  547|  12.1k|    if (ihdr.color_type == SPNG_COLOR_TYPE_TRUECOLOR &&
  ------------------
  |  Branch (547:9): [True: 8.86k, False: 3.26k]
  ------------------
  548|  8.86k|        cinfo->data_precision == ihdr.bit_depth &&
  ------------------
  |  Branch (548:9): [True: 0, False: 8.86k]
  ------------------
  549|      0|#if RGB_RED == 0 && RGB_GREEN == 1 && RGB_BLUE == 2 && RGB_PIXELSIZE == 3
  550|      0|        (cinfo->in_color_space == JCS_EXT_RGB ||
  ------------------
  |  Branch (550:10): [True: 0, False: 0]
  ------------------
  551|      0|         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|      0|      source->pub.get_pixel_rows = get_raw_row;
  556|      0|      use_raw_buffer = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  557|  12.1k|    } else if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  12.1k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 12.1k]
  |  |  |  Branch (78:22): [True: 8.66k, False: 3.46k]
  |  |  |  Branch (78:43): [True: 8.66k, False: 0]
  |  |  ------------------
  ------------------
  558|  8.66k|      source->pub.get_pixel_rows = get_rgb_row;
  559|  3.46k|    else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (559:14): [True: 1.73k, False: 1.73k]
  ------------------
  560|  1.73k|      source->pub.get_pixel_rows = get_rgb_cmyk_row;
  561|  1.73k|    else
  562|  1.73k|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|  1.73k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.73k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  563|  12.1k|    if (ihdr.color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA) {
  ------------------
  |  Branch (563:9): [True: 2.79k, False: 9.33k]
  ------------------
  564|  2.79k|      png_components = 4;
  565|  2.79k|      source->png_alpha = 1;
  566|  9.33k|    } else {
  567|  9.33k|      png_components = 3;
  568|  9.33k|      source->png_alpha = 0;
  569|  9.33k|    }
  570|  12.1k|    break;
  571|       |
  572|    700|  case SPNG_COLOR_TYPE_INDEXED:
  ------------------
  |  Branch (572:3): [True: 700, False: 32.1k]
  ------------------
  573|    700|  {
  574|    700|    int i, gray = 1;
  575|       |
  576|    700|    TRACEMS3(cinfo, 1, JTRC_PNG_INDEXED, ihdr.width, ihdr.height,
  ------------------
  |  |  309|    700|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    700|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 700]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|    700|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|    700|           (cinfo)->err->msg_code = (code); \
  |  |  312|    700|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  577|    700|             ihdr.bit_depth);
  578|    700|    TRY_SPNG(spng_get_plte(source->ctx, &source->colormap));
  ------------------
  |  |   33|    700|#define TRY_SPNG(f) { \
  |  |   34|    700|  int __spng_error = (f); \
  |  |   35|    700|  if (__spng_error) \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 266, False: 434]
  |  |  ------------------
  |  |   36|    700|    ERREXITS(cinfo, JERR_PNG_LIBSPNG, spng_strerror(__spng_error)); \
  |  |  ------------------
  |  |  |  |  274|    266|  ((cinfo)->err->msg_code = (code), \
  |  |  |  |  275|    266|   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX - 1), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|    266|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  276|    266|   (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|    266|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  277|    266|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  |  |  ------------------
  |  |   37|    700|}
  ------------------
  579|    700|    if (source->png_bit_depth != 8 || source->colormap.n_entries > 256)
  ------------------
  |  Branch (579:9): [True: 266, False: 434]
  |  Branch (579:39): [True: 0, False: 434]
  ------------------
  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|  61.4k|    for (i = 0; i < (int)source->colormap.n_entries; i++) {
  ------------------
  |  Branch (582:17): [True: 60.7k, False: 700]
  ------------------
  583|  60.7k|      if (source->colormap.entries[i].red !=
  ------------------
  |  Branch (583:11): [True: 53.0k, False: 7.70k]
  ------------------
  584|  60.7k|          source->colormap.entries[i].green ||
  585|  7.70k|          source->colormap.entries[i].green !=
  ------------------
  |  Branch (585:11): [True: 1.13k, False: 6.57k]
  ------------------
  586|  7.70k|          source->colormap.entries[i].blue)
  587|  54.1k|        gray = 0;
  588|  60.7k|    }
  589|       |
  590|    700|    if ((cinfo->in_color_space == JCS_UNKNOWN ||
  ------------------
  |  Branch (590:10): [True: 266, False: 434]
  ------------------
  591|    434|         cinfo->in_color_space == JCS_RGB) && gray)
  ------------------
  |  Branch (591:10): [True: 0, False: 434]
  |  Branch (591:47): [True: 0, False: 0]
  ------------------
  592|      0|      cinfo->in_color_space = JCS_GRAYSCALE;
  593|    700|    if (cinfo->in_color_space == JCS_GRAYSCALE && !gray)
  ------------------
  |  Branch (593:9): [True: 62, False: 638]
  |  Branch (593:51): [True: 49, False: 13]
  ------------------
  594|     49|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|     49|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     49|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  595|       |
  596|    700|    source->pub.get_pixel_rows = get_indexed_row;
  597|    700|    png_components = 1;
  598|    700|    source->png_alpha = 0;
  599|    700|    break;
  600|  8.86k|  }
  601|       |
  602|      0|  default:
  ------------------
  |  Branch (602:3): [True: 0, False: 32.8k]
  ------------------
  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|  32.8k|  }
  605|       |
  606|  18.7k|  if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  18.7k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 18.7k]
  |  |  |  Branch (78:22): [True: 14.6k, False: 4.08k]
  |  |  |  Branch (78:43): [True: 14.6k, False: 0]
  |  |  ------------------
  ------------------
  607|  14.6k|    cinfo->input_components = rgb_pixelsize[cinfo->in_color_space];
  608|  4.08k|  else if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (608:12): [True: 1.15k, False: 2.93k]
  ------------------
  609|  1.15k|    cinfo->input_components = 1;
  610|  2.93k|  else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (610:12): [True: 2.93k, False: 0]
  ------------------
  611|  2.93k|    cinfo->input_components = 4;
  612|       |
  613|       |  /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */
  614|  18.7k|  source->buffer_width =
  615|  18.7k|    (size_t)ihdr.width * png_components * source->png_bit_depth / 8;
  616|  18.7k|  source->iobuffer = (unsigned char *)
  617|  18.7k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  18.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  618|  18.7k|                                source->buffer_width);
  619|       |
  620|       |  /* Create compressor input buffer. */
  621|  18.7k|  if (use_raw_buffer) {
  ------------------
  |  Branch (621:7): [True: 0, False: 18.7k]
  ------------------
  622|       |    /* For unscaled raw-input case, we can just map it onto the I/O buffer. */
  623|       |    /* Synthesize a _JSAMPARRAY pointer structure */
  624|      0|    source->pixrow = (_JSAMPROW)source->iobuffer;
  625|      0|    source->pub._buffer = &source->pixrow;
  ------------------
  |  |  210|      0|#define _buffer  buffer12
  ------------------
  626|      0|    source->pub.buffer_height = 1;
  627|  18.7k|  } else {
  628|  18.7k|    unsigned int maxval = source->png_bit_depth == 16 ? 65535 : 255;
  ------------------
  |  Branch (628:27): [True: 5.07k, False: 13.6k]
  ------------------
  629|  18.7k|    size_t val, half_maxval;
  630|       |
  631|       |    /* Need to translate anyway, so make a separate sample buffer. */
  632|  18.7k|    source->pub._buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  ------------------
  |  |  210|  18.7k|#define _buffer  buffer12
  ------------------
  633|  18.7k|      ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  18.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  634|  18.7k|       (JDIMENSION)ihdr.width * cinfo->input_components, (JDIMENSION)1);
  635|  18.7k|    source->pub.buffer_height = 1;
  636|       |
  637|       |    /* Compute the rescaling array. */
  638|  18.7k|    source->rescale = (_JSAMPLE *)
  639|  18.7k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  18.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  640|  18.7k|                                  (maxval + 1L) * sizeof(_JSAMPLE));
  641|  18.7k|    memset(source->rescale, 0, (maxval + 1L) * sizeof(_JSAMPLE));
  642|  18.7k|    half_maxval = maxval / 2;
  643|   336M|    for (val = 0; val <= maxval; val++) {
  ------------------
  |  Branch (643:19): [True: 336M, False: 18.7k]
  ------------------
  644|       |      /* The multiplication here must be done in 32 bits to avoid overflow */
  645|   336M|      source->rescale[val] =
  646|   336M|        (_JSAMPLE)((val * ((1 << cinfo->data_precision) - 1) + half_maxval) /
  647|   336M|                   maxval);
  648|   336M|    }
  649|  18.7k|  }
  650|       |
  651|  18.7k|  TRY_SPNG(spng_decode_image(source->ctx, NULL, 0, SPNG_FMT_PNG,
  ------------------
  |  |   33|  18.7k|#define TRY_SPNG(f) { \
  |  |   34|  18.7k|  int __spng_error = (f); \
  |  |   35|  18.7k|  if (__spng_error) \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 11.1k, False: 7.61k]
  |  |  ------------------
  |  |   36|  18.7k|    ERREXITS(cinfo, JERR_PNG_LIBSPNG, spng_strerror(__spng_error)); \
  |  |  ------------------
  |  |  |  |  274|  11.1k|  ((cinfo)->err->msg_code = (code), \
  |  |  |  |  275|  11.1k|   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX - 1), \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|  11.1k|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  276|  11.1k|   (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
  |  |  |  |  ------------------
  |  |  |  |  |  |  800|  11.1k|#define JMSG_STR_PARM_MAX  80
  |  |  |  |  ------------------
  |  |  |  |  277|  11.1k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  |  |  ------------------
  |  |   37|  18.7k|}
  ------------------
  652|  18.7k|                             SPNG_DECODE_PROGRESSIVE));
  653|  18.7k|}
rdpng-12.c:get_raw_row:
   75|   729k|{
   76|   729k|  png_source_ptr source = (png_source_ptr)sinfo;
   77|   729k|  int spng_error;
   78|       |
   79|   729k|  spng_error = spng_decode_row(source->ctx, source->iobuffer,
   80|   729k|                               source->buffer_width);
   81|   729k|  if (spng_error && spng_error != SPNG_EOI)
  ------------------
  |  Branch (81:7): [True: 6.20k, False: 723k]
  |  Branch (81:21): [True: 3.75k, False: 2.44k]
  ------------------
   82|  3.75k|    ERREXITS(cinfo, JERR_PNG_LIBSPNG, spng_strerror(spng_error)); \
  ------------------
  |  |  274|  3.75k|  ((cinfo)->err->msg_code = (code), \
  |  |  275|  3.75k|   strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX - 1), \
  |  |  ------------------
  |  |  |  |  800|  3.75k|#define JMSG_STR_PARM_MAX  80
  |  |  ------------------
  |  |  276|  3.75k|   (cinfo)->err->msg_parm.s[JMSG_STR_PARM_MAX - 1] = '\0', \
  |  |  ------------------
  |  |  |  |  800|  3.75k|#define JMSG_STR_PARM_MAX  80
  |  |  ------------------
  |  |  277|  3.75k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   83|   729k|  return 1;
   84|   729k|}
rdpng-12.c:get_gray_row:
  102|  25.3k|{
  103|  25.3k|  png_source_ptr source = (png_source_ptr)sinfo;
  104|  25.3k|  register _JSAMPROW ptr;
  105|  25.3k|  register _JSAMPLE *rescale = source->rescale;
  106|  25.3k|  JDIMENSION col;
  107|       |
  108|  25.3k|  get_raw_row(cinfo, sinfo);
  109|  25.3k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  25.3k|#define _buffer  buffer12
  ------------------
  110|       |#if BITS_IN_JSAMPLE != 12
  111|       |  if (source->png_bit_depth == cinfo->data_precision) {
  112|       |    _JSAMPLE *bufferptr = (_JSAMPLE *)source->iobuffer;
  113|       |    for (col = cinfo->image_width; col > 0; col--) {
  114|       |      *ptr++ = *bufferptr++;
  115|       |      bufferptr += source->png_alpha;
  116|       |    }
  117|       |  } else
  118|       |#endif
  119|  25.3k|  if (source->png_bit_depth == 16) {
  ------------------
  |  Branch (119:7): [True: 1.47k, False: 23.8k]
  ------------------
  120|  1.47k|    register unsigned short *bufferptr = (unsigned short *)source->iobuffer;
  121|  70.2k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (121:36): [True: 68.7k, False: 1.47k]
  ------------------
  122|  68.7k|      *ptr++ = rescale[*bufferptr++];
  123|  68.7k|      bufferptr += source->png_alpha;
  124|  68.7k|    }
  125|  23.8k|  } else {
  126|  23.8k|    register unsigned char *bufferptr = source->iobuffer;
  127|  4.64M|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (127:36): [True: 4.61M, False: 23.8k]
  ------------------
  128|  4.61M|      *ptr++ = rescale[*bufferptr++];
  129|  4.61M|      bufferptr += source->png_alpha;
  130|  4.61M|    }
  131|  23.8k|  }
  132|  25.3k|  return 1;
  133|  25.3k|}
rdpng-12.c:get_gray_rgb_row:
  141|   126k|{
  142|   126k|  png_source_ptr source = (png_source_ptr)sinfo;
  143|   126k|  register _JSAMPROW ptr;
  144|   126k|  register _JSAMPLE *rescale = source->rescale;
  145|   126k|  JDIMENSION col;
  146|   126k|  register int rindex = rgb_red[cinfo->in_color_space];
  147|   126k|  register int gindex = rgb_green[cinfo->in_color_space];
  148|   126k|  register int bindex = rgb_blue[cinfo->in_color_space];
  149|   126k|  register int aindex = alpha_index[cinfo->in_color_space];
  150|   126k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  151|       |
  152|   126k|  get_raw_row(cinfo, sinfo);
  153|   126k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|   126k|#define _buffer  buffer12
  ------------------
  154|       |#if BITS_IN_JSAMPLE != 12
  155|       |  if (source->png_bit_depth == cinfo->data_precision) {
  156|       |    _JSAMPLE *bufferptr = (_JSAMPLE *)source->iobuffer;
  157|       |    if (aindex >= 0)
  158|       |      GRAY_RGB_READ_LOOP(*bufferptr++, ptr[aindex] = _MAXJSAMPLE;,
  159|       |                         bufferptr += source->png_alpha;)
  160|       |    else
  161|       |      GRAY_RGB_READ_LOOP(*bufferptr++, {}, bufferptr += source->png_alpha;)
  162|       |  } else
  163|       |#endif
  164|   126k|  if (source->png_bit_depth == 16) {
  ------------------
  |  Branch (164:7): [True: 7.37k, False: 119k]
  ------------------
  165|  7.37k|    register unsigned short *bufferptr = (unsigned short *)source->iobuffer;
  166|  7.37k|    if (aindex >= 0)
  ------------------
  |  Branch (166:9): [True: 1.47k, False: 5.90k]
  ------------------
  167|  1.47k|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |   87|  1.47k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |   88|  70.2k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (88:34): [True: 68.7k, False: 1.47k]
  |  |  ------------------
  |  |   89|  68.7k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |   90|  68.7k|    alpha_set_op \
  |  |   91|  68.7k|    ptr += ps; \
  |  |   92|  68.7k|    pointer_op \
  |  |   93|  68.7k|  } \
  |  |   94|  1.47k|}
  ------------------
  168|  7.37k|                         ptr[aindex] = (1 << cinfo->data_precision) - 1;,
  169|  7.37k|                         bufferptr += source->png_alpha;)
  170|  5.90k|    else
  171|  5.90k|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++], {},
  ------------------
  |  |   87|  5.90k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |   88|   280k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (88:34): [True: 274k, False: 5.90k]
  |  |  ------------------
  |  |   89|   274k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |   90|   274k|    alpha_set_op \
  |  |   91|   274k|    ptr += ps; \
  |  |   92|   274k|    pointer_op \
  |  |   93|   274k|  } \
  |  |   94|  5.90k|}
  ------------------
  172|  7.37k|                         bufferptr += source->png_alpha;)
  173|   119k|  } else {
  174|   119k|    register unsigned char *bufferptr = source->iobuffer;
  175|   119k|    if (aindex >= 0)
  ------------------
  |  Branch (175:9): [True: 23.6k, False: 95.7k]
  ------------------
  176|  23.6k|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |   87|  23.6k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |   88|  4.64M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (88:34): [True: 4.61M, False: 23.6k]
  |  |  ------------------
  |  |   89|  4.61M|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |   90|  4.61M|    alpha_set_op \
  |  |   91|  4.61M|    ptr += ps; \
  |  |   92|  4.61M|    pointer_op \
  |  |   93|  4.61M|  } \
  |  |   94|  23.6k|}
  ------------------
  177|   119k|                         ptr[aindex] = (1 << cinfo->data_precision) - 1;,
  178|   119k|                         bufferptr += source->png_alpha;)
  179|  95.7k|    else
  180|  95.7k|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++], {},
  ------------------
  |  |   87|  95.7k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |   88|  18.5M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (88:34): [True: 18.4M, False: 95.7k]
  |  |  ------------------
  |  |   89|  18.4M|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |   90|  18.4M|    alpha_set_op \
  |  |   91|  18.4M|    ptr += ps; \
  |  |   92|  18.4M|    pointer_op \
  |  |   93|  18.4M|  } \
  |  |   94|  95.7k|}
  ------------------
  181|   119k|                         bufferptr += source->png_alpha;)
  182|   119k|  }
  183|   126k|  return 1;
  184|   126k|}
rdpng-12.c:get_gray_cmyk_row:
  192|  25.3k|{
  193|  25.3k|  png_source_ptr source = (png_source_ptr)sinfo;
  194|  25.3k|  register _JSAMPROW ptr;
  195|  25.3k|  register _JSAMPLE *rescale = source->rescale;
  196|  25.3k|  JDIMENSION col;
  197|       |
  198|  25.3k|  get_raw_row(cinfo, sinfo);
  199|  25.3k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  25.3k|#define _buffer  buffer12
  ------------------
  200|       |#if BITS_IN_JSAMPLE != 12
  201|       |  if (source->png_bit_depth == cinfo->data_precision) {
  202|       |    register _JSAMPLE *bufferptr = (_JSAMPLE *)source->iobuffer;
  203|       |    for (col = cinfo->image_width; col > 0; col--) {
  204|       |      _JSAMPLE gray = *bufferptr++;
  205|       |      bufferptr += source->png_alpha;
  206|       |      rgb_to_cmyk(_MAXJSAMPLE, gray, gray, gray, ptr, ptr + 1, ptr + 2,
  207|       |                  ptr + 3);
  208|       |      ptr += 4;
  209|       |    }
  210|       |  } else
  211|       |#endif
  212|  25.3k|  if (source->png_bit_depth == 16) {
  ------------------
  |  Branch (212:7): [True: 1.47k, False: 23.8k]
  ------------------
  213|  1.47k|    unsigned short *bufferptr = (unsigned short *)source->iobuffer;
  214|  70.2k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (214:36): [True: 68.7k, False: 1.47k]
  ------------------
  215|  68.7k|      _JSAMPLE gray = rescale[*bufferptr++];
  ------------------
  |  |  108|  68.7k|#define _JSAMPLE  J12SAMPLE
  ------------------
  216|  68.7k|      bufferptr += source->png_alpha;
  217|  68.7k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, gray, gray, gray, ptr,
  218|  68.7k|                  ptr + 1, ptr + 2, ptr + 3);
  219|  68.7k|      ptr += 4;
  220|  68.7k|    }
  221|  23.8k|  } else {
  222|  23.8k|    register unsigned char *bufferptr = source->iobuffer;
  223|  4.64M|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (223:36): [True: 4.61M, False: 23.8k]
  ------------------
  224|  4.61M|      _JSAMPLE gray = rescale[*bufferptr++];
  ------------------
  |  |  108|  4.61M|#define _JSAMPLE  J12SAMPLE
  ------------------
  225|  4.61M|      bufferptr += source->png_alpha;
  226|  4.61M|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, gray, gray, gray, ptr,
  227|  4.61M|                  ptr + 1, ptr + 2, ptr + 3);
  228|  4.61M|      ptr += 4;
  229|  4.61M|    }
  230|  23.8k|  }
  231|  25.3k|  return 1;
  232|  25.3k|}
rdpng-12.c:get_rgb_row:
  252|   459k|{
  253|   459k|  png_source_ptr source = (png_source_ptr)sinfo;
  254|   459k|  register _JSAMPROW ptr;
  255|   459k|  register _JSAMPLE *rescale = source->rescale;
  256|   459k|  JDIMENSION col;
  257|   459k|  register int rindex = rgb_red[cinfo->in_color_space];
  258|   459k|  register int gindex = rgb_green[cinfo->in_color_space];
  259|   459k|  register int bindex = rgb_blue[cinfo->in_color_space];
  260|   459k|  register int aindex = alpha_index[cinfo->in_color_space];
  261|   459k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  262|       |
  263|   459k|  get_raw_row(cinfo, sinfo);
  264|   459k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|   459k|#define _buffer  buffer12
  ------------------
  265|       |#if BITS_IN_JSAMPLE != 12
  266|       |  if (source->png_bit_depth == cinfo->data_precision) {
  267|       |    register _JSAMPLE *bufferptr = (_JSAMPLE *)source->iobuffer;
  268|       |    if (aindex >= 0)
  269|       |      RGB_READ_LOOP(*bufferptr++, ptr[aindex] = _MAXJSAMPLE;,
  270|       |                    bufferptr += source->png_alpha;)
  271|       |    else
  272|       |      RGB_READ_LOOP(*bufferptr++, {}, bufferptr += source->png_alpha;)
  273|       |  } else
  274|       |#endif
  275|   459k|  if (source->png_bit_depth == 16) {
  ------------------
  |  Branch (275:7): [True: 236k, False: 223k]
  ------------------
  276|   236k|    unsigned short *bufferptr = (unsigned short *)source->iobuffer;
  277|   236k|    if (aindex >= 0)
  ------------------
  |  Branch (277:9): [True: 47.3k, False: 189k]
  ------------------
  278|  47.3k|      RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |  235|  47.3k|#define RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |  236|  3.51M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (236:34): [True: 3.46M, False: 47.3k]
  |  |  ------------------
  |  |  237|  3.46M|    ptr[rindex] = read_op; \
  |  |  238|  3.46M|    ptr[gindex] = read_op; \
  |  |  239|  3.46M|    ptr[bindex] = read_op; \
  |  |  240|  3.46M|    alpha_set_op \
  |  |  241|  3.46M|    pointer_op \
  |  |  242|  3.46M|    ptr += ps; \
  |  |  243|  3.46M|  } \
  |  |  244|  47.3k|}
  ------------------
  279|   236k|                    ptr[aindex] = (1 << cinfo->data_precision) - 1;,
  280|   236k|                    bufferptr += source->png_alpha;)
  281|   189k|    else
  282|   189k|      RGB_READ_LOOP(rescale[*bufferptr++], {},
  ------------------
  |  |  235|   189k|#define RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |  236|  14.0M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (236:34): [True: 13.8M, False: 189k]
  |  |  ------------------
  |  |  237|  13.8M|    ptr[rindex] = read_op; \
  |  |  238|  13.8M|    ptr[gindex] = read_op; \
  |  |  239|  13.8M|    ptr[bindex] = read_op; \
  |  |  240|  13.8M|    alpha_set_op \
  |  |  241|  13.8M|    pointer_op \
  |  |  242|  13.8M|    ptr += ps; \
  |  |  243|  13.8M|  } \
  |  |  244|   189k|}
  ------------------
  283|   236k|                    bufferptr += source->png_alpha;)
  284|   236k|  } else {
  285|   223k|    register unsigned char *bufferptr = source->iobuffer;
  286|   223k|    if (aindex >= 0)
  ------------------
  |  Branch (286:9): [True: 44.2k, False: 178k]
  ------------------
  287|  44.2k|      RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |  235|  44.2k|#define RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |  236|  10.9M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (236:34): [True: 10.9M, False: 44.2k]
  |  |  ------------------
  |  |  237|  10.9M|    ptr[rindex] = read_op; \
  |  |  238|  10.9M|    ptr[gindex] = read_op; \
  |  |  239|  10.9M|    ptr[bindex] = read_op; \
  |  |  240|  10.9M|    alpha_set_op \
  |  |  241|  10.9M|    pointer_op \
  |  |  242|  10.9M|    ptr += ps; \
  |  |  243|  10.9M|  } \
  |  |  244|  44.2k|}
  ------------------
  288|   223k|                    ptr[aindex] = (1 << cinfo->data_precision) - 1;,
  289|   223k|                    bufferptr += source->png_alpha;)
  290|   178k|    else
  291|   178k|      RGB_READ_LOOP(rescale[*bufferptr++], {},
  ------------------
  |  |  235|   178k|#define RGB_READ_LOOP(read_op, alpha_set_op, pointer_op) { \
  |  |  236|  43.9M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (236:34): [True: 43.7M, False: 178k]
  |  |  ------------------
  |  |  237|  43.7M|    ptr[rindex] = read_op; \
  |  |  238|  43.7M|    ptr[gindex] = read_op; \
  |  |  239|  43.7M|    ptr[bindex] = read_op; \
  |  |  240|  43.7M|    alpha_set_op \
  |  |  241|  43.7M|    pointer_op \
  |  |  242|  43.7M|    ptr += ps; \
  |  |  243|  43.7M|  } \
  |  |  244|   178k|}
  ------------------
  292|   223k|                    bufferptr += source->png_alpha;)
  293|   223k|  }
  294|   459k|  return 1;
  295|   459k|}
rdpng-12.c:get_rgb_cmyk_row:
  303|  91.9k|{
  304|  91.9k|  png_source_ptr source = (png_source_ptr)sinfo;
  305|  91.9k|  register _JSAMPROW ptr;
  306|  91.9k|  register _JSAMPLE *rescale = source->rescale;
  307|  91.9k|  JDIMENSION col;
  308|       |
  309|  91.9k|  get_raw_row(cinfo, sinfo);
  310|  91.9k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  91.9k|#define _buffer  buffer12
  ------------------
  311|       |#if BITS_IN_JSAMPLE != 12
  312|       |  if (source->png_bit_depth == cinfo->data_precision) {
  313|       |    register _JSAMPLE *bufferptr = (_JSAMPLE *)source->iobuffer;
  314|       |    for (col = cinfo->image_width; col > 0; col--) {
  315|       |      _JSAMPLE r = *bufferptr++;
  316|       |      _JSAMPLE g = *bufferptr++;
  317|       |      _JSAMPLE b = *bufferptr++;
  318|       |      bufferptr += source->png_alpha;
  319|       |      rgb_to_cmyk(_MAXJSAMPLE, r, g, b, ptr, ptr + 1, ptr + 2, ptr + 3);
  320|       |      ptr += 4;
  321|       |    }
  322|       |  } else
  323|       |#endif
  324|  91.9k|  if (source->png_bit_depth == 16) {
  ------------------
  |  Branch (324:7): [True: 47.3k, False: 44.6k]
  ------------------
  325|  47.3k|    unsigned short *bufferptr = (unsigned short *)source->iobuffer;
  326|  3.51M|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (326:36): [True: 3.46M, False: 47.3k]
  ------------------
  327|  3.46M|      _JSAMPLE r = rescale[*bufferptr++];
  ------------------
  |  |  108|  3.46M|#define _JSAMPLE  J12SAMPLE
  ------------------
  328|  3.46M|      _JSAMPLE g = rescale[*bufferptr++];
  ------------------
  |  |  108|  3.46M|#define _JSAMPLE  J12SAMPLE
  ------------------
  329|  3.46M|      _JSAMPLE b = rescale[*bufferptr++];
  ------------------
  |  |  108|  3.46M|#define _JSAMPLE  J12SAMPLE
  ------------------
  330|  3.46M|      bufferptr += source->png_alpha;
  331|  3.46M|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, r, g, b, ptr, ptr + 1,
  332|  3.46M|                  ptr + 2, ptr + 3);
  333|  3.46M|      ptr += 4;
  334|  3.46M|    }
  335|  47.3k|  } else {
  336|  44.6k|    register unsigned char *bufferptr = source->iobuffer;
  337|  10.9M|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (337:36): [True: 10.9M, False: 44.6k]
  ------------------
  338|  10.9M|      _JSAMPLE r = rescale[*bufferptr++];
  ------------------
  |  |  108|  10.9M|#define _JSAMPLE  J12SAMPLE
  ------------------
  339|  10.9M|      _JSAMPLE g = rescale[*bufferptr++];
  ------------------
  |  |  108|  10.9M|#define _JSAMPLE  J12SAMPLE
  ------------------
  340|  10.9M|      _JSAMPLE b = rescale[*bufferptr++];
  ------------------
  |  |  108|  10.9M|#define _JSAMPLE  J12SAMPLE
  ------------------
  341|  10.9M|      bufferptr += source->png_alpha;
  342|  10.9M|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, r, g, b, ptr, ptr + 1,
  343|  10.9M|                  ptr + 2, ptr + 3);
  344|  10.9M|      ptr += 4;
  345|  10.9M|    }
  346|  44.6k|  }
  347|  91.9k|  return 1;
  348|  91.9k|}
rdpng-12.c:get_indexed_row:
  353|    735|{
  354|       |/* This version is for reading 8-bit-per-channel indexed-color PNG files and
  355|       | * converting to extended RGB or CMYK.
  356|       | */
  357|    735|  png_source_ptr source = (png_source_ptr)sinfo;
  358|    735|  register _JSAMPROW ptr;
  359|    735|  register JSAMPLE *bufferptr = (JSAMPLE *)source->iobuffer;
  360|    735|  register _JSAMPLE *rescale = source->rescale;
  361|    735|  JDIMENSION col;
  362|       |
  363|    735|  get_raw_row(cinfo, sinfo);
  364|    735|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|    735|#define _buffer  buffer12
  ------------------
  365|       |#if BITS_IN_JSAMPLE == 8
  366|       |  if (source->png_bit_depth == cinfo->data_precision) {
  367|       |    if (cinfo->in_color_space == JCS_GRAYSCALE) {
  368|       |      for (col = cinfo->image_width; col > 0; col--) {
  369|       |        JSAMPLE index = *bufferptr++;
  370|       |
  371|       |        if (index >= source->colormap.n_entries)
  372|       |          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  373|       |        *ptr++ = source->colormap.entries[index].red;
  374|       |      }
  375|       |    } else if (cinfo->in_color_space == JCS_CMYK) {
  376|       |      for (col = cinfo->image_width; col > 0; col--) {
  377|       |        JSAMPLE index = *bufferptr++;
  378|       |
  379|       |        if (index >= source->colormap.n_entries)
  380|       |          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  381|       |        rgb_to_cmyk(_MAXJSAMPLE, source->colormap.entries[index].red,
  382|       |                    source->colormap.entries[index].green,
  383|       |                    source->colormap.entries[index].blue, ptr, ptr + 1,
  384|       |                    ptr + 2, ptr + 3);
  385|       |        ptr += 4;
  386|       |      }
  387|       |    } else {
  388|       |      register int rindex = rgb_red[cinfo->in_color_space];
  389|       |      register int gindex = rgb_green[cinfo->in_color_space];
  390|       |      register int bindex = rgb_blue[cinfo->in_color_space];
  391|       |      register int aindex = alpha_index[cinfo->in_color_space];
  392|       |      register int ps = rgb_pixelsize[cinfo->in_color_space];
  393|       |
  394|       |      for (col = cinfo->image_width; col > 0; col--) {
  395|       |        JSAMPLE index = *bufferptr++;
  396|       |
  397|       |        if (index >= source->colormap.n_entries)
  398|       |          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  399|       |        ptr[rindex] = source->colormap.entries[index].red;
  400|       |        ptr[gindex] = source->colormap.entries[index].green;
  401|       |        ptr[bindex] = source->colormap.entries[index].blue;
  402|       |        if (aindex >= 0)
  403|       |          ptr[aindex] = _MAXJSAMPLE;
  404|       |        ptr += ps;
  405|       |      }
  406|       |    }
  407|       |  } else
  408|       |#endif
  409|    735|  {
  410|    735|    if (cinfo->in_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (410:9): [True: 42, False: 693]
  ------------------
  411|    355|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (411:38): [True: 313, False: 42]
  ------------------
  412|    313|        JSAMPLE index = *bufferptr++;
  413|       |
  414|    313|        if (index >= source->colormap.n_entries)
  ------------------
  |  Branch (414:13): [True: 6, False: 307]
  ------------------
  415|      6|          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  ------------------
  |  |  240|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  416|    313|        *ptr++ = rescale[source->colormap.entries[index].red];
  417|    313|      }
  418|    693|    } else if (cinfo->in_color_space == JCS_CMYK) {
  ------------------
  |  Branch (418:16): [True: 106, False: 587]
  ------------------
  419|  1.76k|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (419:38): [True: 1.66k, False: 106]
  ------------------
  420|  1.66k|        JSAMPLE index = *bufferptr++;
  421|       |
  422|  1.66k|        if (index >= source->colormap.n_entries)
  ------------------
  |  Branch (422:13): [True: 37, False: 1.62k]
  ------------------
  423|     37|          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  ------------------
  |  |  240|     37|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     37|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  424|  1.66k|        rgb_to_cmyk((1 << cinfo->data_precision) - 1,
  425|  1.66k|                    rescale[source->colormap.entries[index].red],
  426|  1.66k|                    rescale[source->colormap.entries[index].green],
  427|  1.66k|                    rescale[source->colormap.entries[index].blue], ptr,
  428|  1.66k|                    ptr + 1, ptr + 2, ptr + 3);
  429|  1.66k|        ptr += 4;
  430|  1.66k|      }
  431|    587|    } else {
  432|    587|      register int rindex = rgb_red[cinfo->in_color_space];
  433|    587|      register int gindex = rgb_green[cinfo->in_color_space];
  434|    587|      register int bindex = rgb_blue[cinfo->in_color_space];
  435|    587|      register int aindex = alpha_index[cinfo->in_color_space];
  436|    587|      register int ps = rgb_pixelsize[cinfo->in_color_space];
  437|       |
  438|  11.7k|      for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (438:38): [True: 11.1k, False: 587]
  ------------------
  439|  11.1k|        JSAMPLE index = *bufferptr++;
  440|       |
  441|  11.1k|        if (index >= source->colormap.n_entries)
  ------------------
  |  Branch (441:13): [True: 185, False: 10.9k]
  ------------------
  442|    185|          ERREXIT(cinfo, JERR_PNG_OUTOFRANGE);
  ------------------
  |  |  240|    185|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    185|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  443|  11.1k|        ptr[rindex] = rescale[source->colormap.entries[index].red];
  444|  11.1k|        ptr[gindex] = rescale[source->colormap.entries[index].green];
  445|  11.1k|        ptr[bindex] = rescale[source->colormap.entries[index].blue];
  446|  11.1k|        if (aindex >= 0)
  ------------------
  |  Branch (446:13): [True: 2.72k, False: 8.42k]
  ------------------
  447|  2.72k|          ptr[aindex] = (1 << cinfo->data_precision) - 1;
  448|  11.1k|        ptr += ps;
  449|  11.1k|      }
  450|    587|    }
  451|    735|  }
  452|    735|  return 1;
  453|    735|}
rdpng-12.c:read_icc_profile_png:
  663|  7.61k|{
  664|  7.61k|  png_source_ptr source = (png_source_ptr)sinfo;
  665|  7.61k|  struct spng_iccp iccp;
  666|       |
  667|  7.61k|  if (!icc_data_ptr || !icc_data_len)
  ------------------
  |  Branch (667:7): [True: 0, False: 7.61k]
  |  Branch (667:24): [True: 0, False: 7.61k]
  ------------------
  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|  7.61k|  if (source->ctx && spng_get_iccp(source->ctx, &iccp) == 0) {
  ------------------
  |  Branch (670:7): [True: 7.61k, False: 0]
  |  Branch (670:22): [True: 7, False: 7.61k]
  ------------------
  671|      7|    *icc_data_ptr = (JOCTET *)iccp.profile;
  672|      7|    *icc_data_len = (unsigned int)iccp.profile_len;
  673|      7|    return TRUE;
  ------------------
  |  |  210|      7|#define TRUE    1
  ------------------
  674|      7|  }
  675|       |
  676|  7.61k|  return FALSE;
  ------------------
  |  |  207|  7.61k|#define FALSE   0               /* values of boolean */
  ------------------
  677|  7.61k|}
rdpng-12.c:finish_input_png:
  686|  32.8k|{
  687|  32.8k|  png_source_ptr source = (png_source_ptr)sinfo;
  688|       |
  689|  32.8k|  if (source->ctx) {
  ------------------
  |  Branch (689:7): [True: 32.8k, False: 0]
  ------------------
  690|  32.8k|    spng_decode_chunks(source->ctx);
  691|  32.8k|    spng_ctx_free(source->ctx);
  692|       |    source->ctx = NULL;
  693|  32.8k|  }
  694|  32.8k|}

j12init_read_ppm:
  924|  16.1k|{
  925|  16.1k|  ppm_source_ptr source;
  926|       |
  927|       |#if BITS_IN_JSAMPLE == 8
  928|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  929|       |#else
  930|  16.1k|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|  32.2k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (930:7): [True: 0, False: 16.1k]
  ------------------
  931|  16.1k|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|  16.1k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (931:7): [True: 0, False: 16.1k]
  ------------------
  932|      0|#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|  16.1k|  source = (ppm_source_ptr)
  937|  16.1k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  16.1k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  938|  16.1k|                                sizeof(ppm_source_struct));
  939|       |  /* Fill in method ptrs, except get_pixel_rows which start_input sets */
  940|  16.1k|  source->pub.start_input = start_input_ppm;
  941|  16.1k|  source->pub.read_icc_profile = read_icc_profile_ppm;
  942|  16.1k|  source->pub.finish_input = finish_input_ppm;
  943|  16.1k|  source->pub.max_pixels = 0;
  944|       |
  945|  16.1k|  return (cjpeg_source_ptr)source;
  946|  16.1k|}
rdppm-12.c:start_input_ppm:
  703|  16.1k|{
  704|  16.1k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  705|  16.1k|  int c;
  706|  16.1k|  unsigned int w, h, maxval;
  707|  16.1k|  boolean need_iobuffer, use_raw_buffer, need_rescale;
  708|       |
  709|  16.1k|  if (getc(source->pub.input_file) != 'P')
  ------------------
  |  Branch (709:7): [True: 0, False: 16.1k]
  ------------------
  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|  16.1k|  c = getc(source->pub.input_file); /* subformat discriminator character */
  713|       |
  714|       |  /* detect unsupported variants (ie, PBM) before trying to read header */
  715|  16.1k|  switch (c) {
  716|  1.47k|  case '2':                     /* it's a text-format PGM file */
  ------------------
  |  Branch (716:3): [True: 1.47k, False: 14.6k]
  ------------------
  717|  3.05k|  case '3':                     /* it's a text-format PPM file */
  ------------------
  |  Branch (717:3): [True: 1.57k, False: 14.5k]
  ------------------
  718|  12.0k|  case '5':                     /* it's a raw-format PGM file */
  ------------------
  |  Branch (718:3): [True: 8.95k, False: 7.18k]
  ------------------
  719|  16.1k|  case '6':                     /* it's a raw-format PPM file */
  ------------------
  |  Branch (719:3): [True: 4.09k, False: 12.0k]
  ------------------
  720|  16.1k|    break;
  721|     35|  default:
  ------------------
  |  Branch (721:3): [True: 35, False: 16.1k]
  ------------------
  722|     35|    ERREXIT(cinfo, JERR_PPM_NOT);
  ------------------
  |  |  240|     35|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     35|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  723|     35|    break;
  724|  16.1k|  }
  725|       |
  726|       |  /* fetch the remaining header info */
  727|  16.1k|  w = read_pbm_integer(cinfo, source->pub.input_file, 65535);
  728|  16.1k|  h = read_pbm_integer(cinfo, source->pub.input_file, 65535);
  729|  16.1k|  maxval = read_pbm_integer(cinfo, source->pub.input_file, 65535);
  730|       |
  731|  16.1k|  if (w <= 0 || h <= 0 || maxval <= 0) /* error check */
  ------------------
  |  Branch (731:7): [True: 1.17k, False: 14.9k]
  |  Branch (731:17): [True: 14, False: 14.9k]
  |  Branch (731:27): [True: 7, False: 14.9k]
  ------------------
  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|  16.1k|  if (w > JPEG_MAX_DIMENSION || h > JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  32.2k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
                if (w > JPEG_MAX_DIMENSION || h > JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  14.8k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (733:7): [True: 1.20k, False: 14.8k]
  |  Branch (733:33): [True: 7, False: 14.8k]
  ------------------
  734|     14|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     14|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     14|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  735|  16.1k|  if (sinfo->max_pixels && (unsigned long long)w * h > sinfo->max_pixels)
  ------------------
  |  Branch (735:7): [True: 14.8k, False: 1.21k]
  |  Branch (735:28): [True: 245, False: 14.6k]
  ------------------
  736|    245|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, sinfo->max_pixels);
  ------------------
  |  |  243|    245|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    245|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    245|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  737|       |
  738|  16.1k|  cinfo->image_width = (JDIMENSION)w;
  739|  16.1k|  cinfo->image_height = (JDIMENSION)h;
  740|  16.1k|  source->maxval = maxval;
  741|       |
  742|       |  /* initialize flags to most common settings */
  743|  16.1k|  need_iobuffer = TRUE;         /* do we need an I/O buffer? */
  ------------------
  |  |  210|  16.1k|#define TRUE    1
  ------------------
  744|  16.1k|  use_raw_buffer = FALSE;       /* do we map input buffer onto I/O buffer? */
  ------------------
  |  |  207|  16.1k|#define FALSE   0               /* values of boolean */
  ------------------
  745|  16.1k|  need_rescale = TRUE;          /* do we need a rescale array? */
  ------------------
  |  |  210|  16.1k|#define TRUE    1
  ------------------
  746|       |
  747|  16.1k|  switch (c) {
  ------------------
  |  Branch (747:11): [True: 14.6k, False: 1.45k]
  ------------------
  748|  1.09k|  case '2':                     /* it's a text-format PGM file */
  ------------------
  |  Branch (748:3): [True: 1.09k, False: 15.0k]
  ------------------
  749|  1.09k|    if (cinfo->in_color_space == JCS_UNKNOWN ||
  ------------------
  |  Branch (749:9): [True: 0, False: 1.09k]
  ------------------
  750|  1.09k|        cinfo->in_color_space == JCS_RGB)
  ------------------
  |  Branch (750:9): [True: 0, False: 1.09k]
  ------------------
  751|      0|      cinfo->in_color_space = JCS_GRAYSCALE;
  752|  1.09k|    TRACEMS3(cinfo, 1, JTRC_PGM_TEXT, w, h, maxval);
  ------------------
  |  |  309|  1.09k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.09k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.09k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  1.09k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  1.09k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  1.09k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  753|  1.09k|    if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (753:9): [True: 156, False: 936]
  ------------------
  754|    156|      source->pub.get_pixel_rows = get_text_gray_row;
  755|    936|    else if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|    936|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 936]
  |  |  |  Branch (78:22): [True: 780, False: 156]
  |  |  |  Branch (78:43): [True: 780, False: 0]
  |  |  ------------------
  ------------------
  756|    780|      source->pub.get_pixel_rows = get_text_gray_rgb_row;
  757|    156|    else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (757:14): [True: 156, False: 0]
  ------------------
  758|    156|      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.09k|    need_iobuffer = FALSE;
  ------------------
  |  |  207|  1.09k|#define FALSE   0               /* values of boolean */
  ------------------
  762|  1.09k|    break;
  763|       |
  764|  1.19k|  case '3':                     /* it's a text-format PPM file */
  ------------------
  |  Branch (764:3): [True: 1.19k, False: 14.9k]
  ------------------
  765|  1.19k|    if (cinfo->in_color_space == JCS_UNKNOWN)
  ------------------
  |  Branch (765:9): [True: 0, False: 1.19k]
  ------------------
  766|      0|      cinfo->in_color_space = JCS_EXT_RGB;
  767|  1.19k|    TRACEMS3(cinfo, 1, JTRC_PPM_TEXT, w, h, maxval);
  ------------------
  |  |  309|  1.19k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.19k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  1.19k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  1.19k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  1.19k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  768|  1.19k|    if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  1.19k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 1.19k]
  |  |  |  Branch (78:22): [True: 850, False: 340]
  |  |  |  Branch (78:43): [True: 850, False: 0]
  |  |  ------------------
  ------------------
  769|    850|      source->pub.get_pixel_rows = get_text_rgb_row;
  770|    340|    else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (770:14): [True: 170, False: 170]
  ------------------
  771|    170|      source->pub.get_pixel_rows = get_text_rgb_cmyk_row;
  772|    170|    else
  773|    170|      ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|    170|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    170|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  774|  1.19k|    need_iobuffer = FALSE;
  ------------------
  |  |  207|  1.19k|#define FALSE   0               /* values of boolean */
  ------------------
  775|  1.19k|    break;
  776|       |
  777|  8.54k|  case '5':                     /* it's a raw-format PGM file */
  ------------------
  |  Branch (777:3): [True: 8.54k, False: 7.55k]
  ------------------
  778|  8.54k|    if (cinfo->in_color_space == JCS_UNKNOWN ||
  ------------------
  |  Branch (778:9): [True: 0, False: 8.54k]
  ------------------
  779|  8.54k|        cinfo->in_color_space == JCS_RGB)
  ------------------
  |  Branch (779:9): [True: 0, False: 8.54k]
  ------------------
  780|      0|      cinfo->in_color_space = JCS_GRAYSCALE;
  781|  8.54k|    TRACEMS3(cinfo, 1, JTRC_PGM, w, h, maxval);
  ------------------
  |  |  309|  8.54k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  8.54k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 8.54k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  8.54k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  8.54k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  8.54k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  782|  8.54k|    if (maxval > 255) {
  ------------------
  |  Branch (782:9): [True: 1.14k, False: 7.40k]
  ------------------
  783|  1.14k|      if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (783:11): [True: 163, False: 978]
  ------------------
  784|    163|        source->pub.get_pixel_rows = get_word_gray_row;
  785|    978|      else if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|    978|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 978]
  |  |  |  Branch (78:22): [True: 815, False: 163]
  |  |  |  Branch (78:43): [True: 815, False: 0]
  |  |  ------------------
  ------------------
  786|    815|        source->pub.get_pixel_rows = get_word_gray_rgb_row;
  787|    163|      else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (787:16): [True: 163, False: 0]
  ------------------
  788|    163|        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|       |#if BITS_IN_JSAMPLE == 8
  792|       |    } else if (maxval <= _MAXJSAMPLE &&
  793|       |               maxval == ((1U << cinfo->data_precision) - 1U) &&
  794|       |               cinfo->in_color_space == JCS_GRAYSCALE) {
  795|       |      source->pub.get_pixel_rows = get_raw_row;
  796|       |      use_raw_buffer = TRUE;
  797|       |      need_rescale = FALSE;
  798|       |#endif
  799|  7.40k|    } else {
  800|  7.40k|      if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (800:11): [True: 1.05k, False: 6.34k]
  ------------------
  801|  1.05k|        source->pub.get_pixel_rows = get_scaled_gray_row;
  802|  6.34k|      else if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  6.34k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 6.34k]
  |  |  |  Branch (78:22): [True: 5.29k, False: 1.05k]
  |  |  |  Branch (78:43): [True: 5.29k, False: 0]
  |  |  ------------------
  ------------------
  803|  5.29k|        source->pub.get_pixel_rows = get_gray_rgb_row;
  804|  1.05k|      else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (804:16): [True: 1.05k, False: 0]
  ------------------
  805|  1.05k|        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|  7.40k|    }
  809|  8.54k|    break;
  810|       |
  811|  3.81k|  case '6':                     /* it's a raw-format PPM file */
  ------------------
  |  Branch (811:3): [True: 3.81k, False: 12.2k]
  ------------------
  812|  3.81k|    if (cinfo->in_color_space == JCS_UNKNOWN)
  ------------------
  |  Branch (812:9): [True: 0, False: 3.81k]
  ------------------
  813|      0|      cinfo->in_color_space = JCS_EXT_RGB;
  814|  3.81k|    TRACEMS3(cinfo, 1, JTRC_PPM, w, h, maxval);
  ------------------
  |  |  309|  3.81k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  3.81k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  3.81k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  3.81k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  3.81k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  815|  3.81k|    if (maxval > 255) {
  ------------------
  |  Branch (815:9): [True: 1.75k, False: 2.05k]
  ------------------
  816|  1.75k|      if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  1.75k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 1.75k]
  |  |  |  Branch (78:22): [True: 1.25k, False: 502]
  |  |  |  Branch (78:43): [True: 1.25k, False: 0]
  |  |  ------------------
  ------------------
  817|  1.25k|        source->pub.get_pixel_rows = get_word_rgb_row;
  818|    502|      else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (818:16): [True: 251, False: 251]
  ------------------
  819|    251|        source->pub.get_pixel_rows = get_word_rgb_cmyk_row;
  820|    251|      else
  821|    251|        ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|    251|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    251|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  822|       |#if BITS_IN_JSAMPLE == 8
  823|       |    } else if (maxval <= _MAXJSAMPLE &&
  824|       |               maxval == ((1U << cinfo->data_precision) - 1U) &&
  825|       |#if RGB_RED == 0 && RGB_GREEN == 1 && RGB_BLUE == 2 && RGB_PIXELSIZE == 3
  826|       |               (cinfo->in_color_space == JCS_EXT_RGB ||
  827|       |                cinfo->in_color_space == JCS_RGB)) {
  828|       |#else
  829|       |               cinfo->in_color_space == JCS_EXT_RGB) {
  830|       |#endif
  831|       |      source->pub.get_pixel_rows = get_raw_row;
  832|       |      use_raw_buffer = TRUE;
  833|       |      need_rescale = FALSE;
  834|       |#endif
  835|  2.05k|    } else {
  836|  2.05k|      if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  2.05k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 2.05k]
  |  |  |  Branch (78:22): [True: 1.47k, False: 588]
  |  |  |  Branch (78:43): [True: 1.47k, False: 0]
  |  |  ------------------
  ------------------
  837|  1.47k|        source->pub.get_pixel_rows = get_rgb_row;
  838|    588|      else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (838:16): [True: 294, False: 294]
  ------------------
  839|    294|        source->pub.get_pixel_rows = get_rgb_cmyk_row;
  840|    294|      else
  841|    294|        ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
  ------------------
  |  |  240|    294|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    294|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  842|  2.05k|    }
  843|  3.81k|    break;
  844|  16.1k|  }
  845|       |
  846|  13.9k|  if (IsExtRGB(cinfo->in_color_space))
  ------------------
  |  |   78|  13.9k|  (cs == JCS_RGB || (cs >= JCS_EXT_RGB && cs <= JCS_EXT_ARGB))
  |  |  ------------------
  |  |  |  Branch (78:4): [True: 0, False: 13.9k]
  |  |  |  Branch (78:22): [True: 10.4k, False: 3.46k]
  |  |  |  Branch (78:43): [True: 10.4k, False: 0]
  |  |  ------------------
  ------------------
  847|  10.4k|    cinfo->input_components = rgb_pixelsize[cinfo->in_color_space];
  848|  3.46k|  else if (cinfo->in_color_space == JCS_GRAYSCALE)
  ------------------
  |  Branch (848:12): [True: 1.37k, False: 2.09k]
  ------------------
  849|  1.37k|    cinfo->input_components = 1;
  850|  2.09k|  else if (cinfo->in_color_space == JCS_CMYK)
  ------------------
  |  Branch (850:12): [True: 2.09k, False: 0]
  ------------------
  851|  2.09k|    cinfo->input_components = 4;
  852|       |
  853|       |  /* Allocate space for I/O buffer: 1 or 3 bytes or words/pixel. */
  854|  13.9k|  if (need_iobuffer) {
  ------------------
  |  Branch (854:7): [True: 11.8k, False: 2.11k]
  ------------------
  855|  11.8k|    if (c == '6')
  ------------------
  |  Branch (855:9): [True: 3.27k, False: 8.54k]
  ------------------
  856|  3.27k|      source->buffer_width = (size_t)w * 3 * (maxval <= 255 ? 1 : 2);
  ------------------
  |  Branch (856:47): [True: 1.76k, False: 1.50k]
  ------------------
  857|  8.54k|    else
  858|  8.54k|      source->buffer_width = (size_t)w * (maxval <= 255 ? 1 : 2);
  ------------------
  |  Branch (858:43): [True: 7.40k, False: 1.14k]
  ------------------
  859|  11.8k|    source->iobuffer = (unsigned char *)
  860|  11.8k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  11.8k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  861|  11.8k|                                  source->buffer_width);
  862|  11.8k|  }
  863|       |
  864|       |  /* Create compressor input buffer. */
  865|  13.9k|  if (use_raw_buffer) {
  ------------------
  |  Branch (865:7): [True: 0, False: 13.9k]
  ------------------
  866|       |    /* For unscaled raw-input case, we can just map it onto the I/O buffer. */
  867|       |    /* Synthesize a _JSAMPARRAY pointer structure */
  868|      0|    source->pixrow = (_JSAMPROW)source->iobuffer;
  869|      0|    source->pub._buffer = &source->pixrow;
  ------------------
  |  |  210|      0|#define _buffer  buffer12
  ------------------
  870|      0|    source->pub.buffer_height = 1;
  871|  13.9k|  } else {
  872|       |    /* Need to translate anyway, so make a separate sample buffer. */
  873|  13.9k|    source->pub._buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  ------------------
  |  |  210|  13.9k|#define _buffer  buffer12
  ------------------
  874|  13.9k|      ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  13.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  875|  13.9k|       (JDIMENSION)w * cinfo->input_components, (JDIMENSION)1);
  876|  13.9k|    source->pub.buffer_height = 1;
  877|  13.9k|  }
  878|       |
  879|       |  /* Compute the rescaling array if required. */
  880|  13.9k|  if (need_rescale) {
  ------------------
  |  Branch (880:7): [True: 13.9k, False: 0]
  ------------------
  881|  13.9k|    size_t val, half_maxval;
  882|       |
  883|       |    /* On 16-bit-int machines we have to be careful of maxval = 65535 */
  884|  13.9k|    source->rescale = (_JSAMPLE *)
  885|  13.9k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  13.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  886|  13.9k|                                  (MAX(maxval, 255) + 1L) * sizeof(_JSAMPLE));
  ------------------
  |  |  513|  13.9k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 3.54k, False: 10.3k]
  |  |  ------------------
  ------------------
  887|  13.9k|    memset(source->rescale, 0, (MAX(maxval, 255) + 1L) * sizeof(_JSAMPLE));
  ------------------
  |  |  513|  13.9k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 3.54k, False: 10.3k]
  |  |  ------------------
  ------------------
  888|  13.9k|    half_maxval = (size_t)maxval / 2;
  889|  27.7M|    for (val = 0; val <= (size_t)maxval; val++) {
  ------------------
  |  Branch (889:19): [True: 27.7M, False: 13.9k]
  ------------------
  890|       |      /* The multiplication here must be done in 32 bits to avoid overflow */
  891|  27.7M|      source->rescale[val] =
  892|  27.7M|        (_JSAMPLE)((val * ((1 << cinfo->data_precision) - 1) + half_maxval) /
  893|  27.7M|                   maxval);
  894|  27.7M|    }
  895|  13.9k|  }
  896|  13.9k|}
rdppm-12.c:read_pbm_integer:
   92|   122k|{
   93|   122k|  register int ch;
   94|   122k|  register unsigned int val;
   95|       |
   96|       |  /* Skip any leading whitespace */
   97|   130k|  do {
   98|   130k|    ch = pbm_getc(infile);
   99|   130k|    if (ch == EOF)
  ------------------
  |  Branch (99:9): [True: 2.60k, False: 127k]
  ------------------
  100|  2.60k|      ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|  2.60k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  2.60k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  101|   130k|  } while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
  ------------------
  |  Branch (101:12): [True: 4.12k, False: 126k]
  |  Branch (101:25): [True: 1.00k, False: 125k]
  |  Branch (101:39): [True: 3.73k, False: 121k]
  |  Branch (101:53): [True: 1.01k, False: 120k]
  ------------------
  102|       |
  103|   122k|  if (ch < '0' || ch > '9')
  ------------------
  |  Branch (103:7): [True: 2.72k, False: 120k]
  |  Branch (103:19): [True: 163, False: 120k]
  ------------------
  104|    280|    ERREXIT(cinfo, JERR_PPM_NONNUMERIC);
  ------------------
  |  |  240|    280|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    280|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  105|       |
  106|   122k|  val = ch - '0';
  107|   162k|  while ((ch = pbm_getc(infile)) >= '0' && ch <= '9') {
  ------------------
  |  Branch (107:10): [True: 99.7k, False: 63.1k]
  |  Branch (107:44): [True: 39.9k, False: 59.7k]
  ------------------
  108|  39.9k|    val *= 10;
  109|  39.9k|    val += ch - '0';
  110|  39.9k|    if (val > maxval)
  ------------------
  |  Branch (110:9): [True: 139, False: 39.8k]
  ------------------
  111|    139|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|    139|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    139|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  112|  39.9k|  }
  113|       |
  114|   122k|  return val;
  115|   122k|}
rdppm-12.c:pbm_getc:
   73|   290k|{
   74|   290k|  register int ch;
   75|       |
   76|   290k|  ch = getc(infile);
   77|   290k|  if (ch == '#') {
  ------------------
  |  Branch (77:7): [True: 3.50k, False: 286k]
  ------------------
   78|  47.2k|    do {
   79|  47.2k|      ch = getc(infile);
   80|  47.2k|    } while (ch != '\n' && ch != EOF);
  ------------------
  |  Branch (80:14): [True: 44.1k, False: 3.13k]
  |  Branch (80:28): [True: 43.7k, False: 370]
  ------------------
   81|  3.50k|  }
   82|   290k|  return ch;
   83|   290k|}
rdppm-12.c:get_text_gray_row:
  133|  1.37k|{
  134|  1.37k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  135|  1.37k|  FILE *infile = source->pub.input_file;
  136|  1.37k|  register _JSAMPROW ptr;
  137|  1.37k|  register _JSAMPLE *rescale = source->rescale;
  138|  1.37k|  JDIMENSION col;
  139|  1.37k|  unsigned int maxval = source->maxval;
  140|       |
  141|  1.37k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  1.37k|#define _buffer  buffer12
  ------------------
  142|  3.69k|  for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (142:34): [True: 2.31k, False: 1.37k]
  ------------------
  143|  2.31k|    *ptr++ = rescale[read_pbm_integer(cinfo, infile, maxval)];
  144|  2.31k|  }
  145|  1.37k|  return 1;
  146|  1.37k|}
rdppm-12.c:get_text_gray_rgb_row:
  161|  6.89k|{
  162|  6.89k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  163|  6.89k|  FILE *infile = source->pub.input_file;
  164|  6.89k|  register _JSAMPROW ptr;
  165|  6.89k|  register _JSAMPLE *rescale = source->rescale;
  166|  6.89k|  JDIMENSION col;
  167|  6.89k|  unsigned int maxval = source->maxval;
  168|  6.89k|  register int rindex = rgb_red[cinfo->in_color_space];
  169|  6.89k|  register int gindex = rgb_green[cinfo->in_color_space];
  170|  6.89k|  register int bindex = rgb_blue[cinfo->in_color_space];
  171|  6.89k|  register int aindex = alpha_index[cinfo->in_color_space];
  172|  6.89k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  173|       |
  174|  6.89k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  6.89k|#define _buffer  buffer12
  ------------------
  175|  6.89k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (175:7): [True: 1.12k, False: 5.77k]
  ------------------
  176|  1.12k|    if (aindex >= 0)
  ------------------
  |  Branch (176:9): [True: 224, False: 896]
  ------------------
  177|    224|      GRAY_RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval),
  ------------------
  |  |  149|    224|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|    642|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 418, False: 224]
  |  |  ------------------
  |  |  151|    418|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|    418|    alpha_set_op \
  |  |  153|    418|    ptr += ps; \
  |  |  154|    418|  } \
  |  |  155|    224|}
  ------------------
  178|  1.12k|                         ptr[aindex] = (_JSAMPLE)maxval;)
  179|    896|    else
  180|    896|      GRAY_RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval), {})
  ------------------
  |  |  149|    896|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|  2.56k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 1.67k, False: 896]
  |  |  ------------------
  |  |  151|  1.67k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|  1.67k|    alpha_set_op \
  |  |  153|  1.67k|    ptr += ps; \
  |  |  154|  1.67k|  } \
  |  |  155|    896|}
  ------------------
  181|  5.77k|  } else {
  182|  5.77k|    if (aindex >= 0)
  ------------------
  |  Branch (182:9): [True: 1.15k, False: 4.62k]
  ------------------
  183|  1.15k|      GRAY_RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)],
  ------------------
  |  |  149|  1.15k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|  3.05k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 1.90k, False: 1.15k]
  |  |  ------------------
  |  |  151|  1.90k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|  1.90k|    alpha_set_op \
  |  |  153|  1.90k|    ptr += ps; \
  |  |  154|  1.90k|  } \
  |  |  155|  1.15k|}
  ------------------
  184|  5.77k|                         ptr[aindex] = (1 << cinfo->data_precision) - 1;)
  185|  4.62k|    else
  186|  4.62k|      GRAY_RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)], {})
  ------------------
  |  |  149|  4.62k|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|  12.2k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 7.60k, False: 4.62k]
  |  |  ------------------
  |  |  151|  7.60k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|  7.60k|    alpha_set_op \
  |  |  153|  7.60k|    ptr += ps; \
  |  |  154|  7.60k|  } \
  |  |  155|  4.62k|}
  ------------------
  187|  5.77k|  }
  188|  6.89k|  return 1;
  189|  6.89k|}
rdppm-12.c:get_text_gray_cmyk_row:
  196|  1.37k|{
  197|  1.37k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  198|  1.37k|  FILE *infile = source->pub.input_file;
  199|  1.37k|  register _JSAMPROW ptr;
  200|  1.37k|  register _JSAMPLE *rescale = source->rescale;
  201|  1.37k|  JDIMENSION col;
  202|  1.37k|  unsigned int maxval = source->maxval;
  203|       |
  204|  1.37k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  1.37k|#define _buffer  buffer12
  ------------------
  205|  1.37k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (205:7): [True: 224, False: 1.15k]
  ------------------
  206|    642|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (206:36): [True: 418, False: 224]
  ------------------
  207|    418|      _JSAMPLE gray = (_JSAMPLE)read_pbm_integer(cinfo, infile, maxval);
  ------------------
  |  |  108|    418|#define _JSAMPLE  J12SAMPLE
  ------------------
  208|    418|      rgb_to_cmyk(maxval, gray, gray, gray, ptr, ptr + 1, ptr + 2, ptr + 3);
  209|    418|      ptr += 4;
  210|    418|    }
  211|  1.15k|  } else {
  212|  3.05k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (212:36): [True: 1.90k, False: 1.15k]
  ------------------
  213|  1.90k|      _JSAMPLE gray = rescale[read_pbm_integer(cinfo, infile, maxval)];
  ------------------
  |  |  108|  1.90k|#define _JSAMPLE  J12SAMPLE
  ------------------
  214|  1.90k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, gray, gray, gray, ptr,
  215|  1.90k|                  ptr + 1, ptr + 2, ptr + 3);
  216|  1.90k|      ptr += 4;
  217|  1.90k|    }
  218|  1.15k|  }
  219|  1.37k|  return 1;
  220|  1.37k|}
rdppm-12.c:get_text_rgb_row:
  236|  7.15k|{
  237|  7.15k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  238|  7.15k|  FILE *infile = source->pub.input_file;
  239|  7.15k|  register _JSAMPROW ptr;
  240|  7.15k|  register _JSAMPLE *rescale = source->rescale;
  241|  7.15k|  JDIMENSION col;
  242|  7.15k|  unsigned int maxval = source->maxval;
  243|  7.15k|  register int rindex = rgb_red[cinfo->in_color_space];
  244|  7.15k|  register int gindex = rgb_green[cinfo->in_color_space];
  245|  7.15k|  register int bindex = rgb_blue[cinfo->in_color_space];
  246|  7.15k|  register int aindex = alpha_index[cinfo->in_color_space];
  247|  7.15k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  248|       |
  249|  7.15k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  7.15k|#define _buffer  buffer12
  ------------------
  250|  7.15k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (250:7): [True: 1.39k, False: 5.76k]
  ------------------
  251|  1.39k|    if (aindex >= 0)
  ------------------
  |  Branch (251:9): [True: 278, False: 1.11k]
  ------------------
  252|    278|      RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval),
  ------------------
  |  |  223|    278|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  1.75k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 1.48k, False: 278]
  |  |  ------------------
  |  |  225|  1.48k|    ptr[rindex] = read_op; \
  |  |  226|  1.48k|    ptr[gindex] = read_op; \
  |  |  227|  1.48k|    ptr[bindex] = read_op; \
  |  |  228|  1.48k|    alpha_set_op \
  |  |  229|  1.48k|    ptr += ps; \
  |  |  230|  1.48k|  } \
  |  |  231|    278|}
  ------------------
  253|  1.39k|                    ptr[aindex] = (_JSAMPLE)maxval;)
  254|  1.11k|    else
  255|  1.11k|      RGB_READ_LOOP((_JSAMPLE)read_pbm_integer(cinfo, infile, maxval), {})
  ------------------
  |  |  223|  1.11k|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  7.03k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 5.92k, False: 1.11k]
  |  |  ------------------
  |  |  225|  5.92k|    ptr[rindex] = read_op; \
  |  |  226|  5.92k|    ptr[gindex] = read_op; \
  |  |  227|  5.92k|    ptr[bindex] = read_op; \
  |  |  228|  5.92k|    alpha_set_op \
  |  |  229|  5.92k|    ptr += ps; \
  |  |  230|  5.92k|  } \
  |  |  231|  1.11k|}
  ------------------
  256|  5.76k|  } else {
  257|  5.76k|    if (aindex >= 0)
  ------------------
  |  Branch (257:9): [True: 1.15k, False: 4.61k]
  ------------------
  258|  1.15k|      RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)],
  ------------------
  |  |  223|  1.15k|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  3.12k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 1.97k, False: 1.15k]
  |  |  ------------------
  |  |  225|  1.97k|    ptr[rindex] = read_op; \
  |  |  226|  1.97k|    ptr[gindex] = read_op; \
  |  |  227|  1.97k|    ptr[bindex] = read_op; \
  |  |  228|  1.97k|    alpha_set_op \
  |  |  229|  1.97k|    ptr += ps; \
  |  |  230|  1.97k|  } \
  |  |  231|  1.15k|}
  ------------------
  259|  5.76k|                    ptr[aindex] = (1 << cinfo->data_precision) - 1;)
  260|  4.61k|    else
  261|  4.61k|      RGB_READ_LOOP(rescale[read_pbm_integer(cinfo, infile, maxval)], {})
  ------------------
  |  |  223|  4.61k|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  12.4k|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 7.88k, False: 4.61k]
  |  |  ------------------
  |  |  225|  7.88k|    ptr[rindex] = read_op; \
  |  |  226|  7.88k|    ptr[gindex] = read_op; \
  |  |  227|  7.88k|    ptr[bindex] = read_op; \
  |  |  228|  7.88k|    alpha_set_op \
  |  |  229|  7.88k|    ptr += ps; \
  |  |  230|  7.88k|  } \
  |  |  231|  4.61k|}
  ------------------
  262|  5.76k|  }
  263|  7.15k|  return 1;
  264|  7.15k|}
rdppm-12.c:get_text_rgb_cmyk_row:
  271|  1.43k|{
  272|  1.43k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  273|  1.43k|  FILE *infile = source->pub.input_file;
  274|  1.43k|  register _JSAMPROW ptr;
  275|  1.43k|  register _JSAMPLE *rescale = source->rescale;
  276|  1.43k|  JDIMENSION col;
  277|  1.43k|  unsigned int maxval = source->maxval;
  278|       |
  279|  1.43k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  1.43k|#define _buffer  buffer12
  ------------------
  280|  1.43k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (280:7): [True: 278, False: 1.15k]
  ------------------
  281|  1.75k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (281:36): [True: 1.48k, False: 278]
  ------------------
  282|  1.48k|      _JSAMPLE r = (_JSAMPLE)read_pbm_integer(cinfo, infile, maxval);
  ------------------
  |  |  108|  1.48k|#define _JSAMPLE  J12SAMPLE
  ------------------
  283|  1.48k|      _JSAMPLE g = (_JSAMPLE)read_pbm_integer(cinfo, infile, maxval);
  ------------------
  |  |  108|  1.48k|#define _JSAMPLE  J12SAMPLE
  ------------------
  284|  1.48k|      _JSAMPLE b = (_JSAMPLE)read_pbm_integer(cinfo, infile, maxval);
  ------------------
  |  |  108|  1.48k|#define _JSAMPLE  J12SAMPLE
  ------------------
  285|  1.48k|      rgb_to_cmyk(maxval, r, g, b, ptr, ptr + 1, ptr + 2, ptr + 3);
  286|  1.48k|      ptr += 4;
  287|  1.48k|    }
  288|  1.15k|  } else {
  289|  3.12k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (289:36): [True: 1.97k, False: 1.15k]
  ------------------
  290|  1.97k|      _JSAMPLE r = rescale[read_pbm_integer(cinfo, infile, maxval)];
  ------------------
  |  |  108|  1.97k|#define _JSAMPLE  J12SAMPLE
  ------------------
  291|  1.97k|      _JSAMPLE g = rescale[read_pbm_integer(cinfo, infile, maxval)];
  ------------------
  |  |  108|  1.97k|#define _JSAMPLE  J12SAMPLE
  ------------------
  292|  1.97k|      _JSAMPLE b = rescale[read_pbm_integer(cinfo, infile, maxval)];
  ------------------
  |  |  108|  1.97k|#define _JSAMPLE  J12SAMPLE
  ------------------
  293|  1.97k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, r, g, b, ptr, ptr + 1,
  294|  1.97k|                  ptr + 2, ptr + 3);
  295|  1.97k|      ptr += 4;
  296|  1.97k|    }
  297|  1.15k|  }
  298|  1.43k|  return 1;
  299|  1.43k|}
rdppm-12.c:get_word_gray_row:
  491|  34.6k|{
  492|  34.6k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  493|  34.6k|  register _JSAMPROW ptr;
  494|  34.6k|  register unsigned char *bufferptr;
  495|  34.6k|  register _JSAMPLE *rescale = source->rescale;
  496|  34.6k|  JDIMENSION col;
  497|  34.6k|  unsigned int maxval = source->maxval;
  498|       |
  499|  34.6k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  34.6k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (499:7): [True: 80, False: 34.5k]
  ------------------
  500|     80|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     80|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     80|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  501|  34.6k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  34.6k|#define _buffer  buffer12
  ------------------
  502|  34.6k|  bufferptr = source->iobuffer;
  503|  70.5k|  for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (503:34): [True: 35.9k, False: 34.6k]
  ------------------
  504|  35.9k|    register unsigned int temp;
  505|  35.9k|    temp  = (*bufferptr++) << 8;
  506|  35.9k|    temp |= (*bufferptr++);
  507|  35.9k|    if (temp > maxval)
  ------------------
  |  Branch (507:9): [True: 69, False: 35.8k]
  ------------------
  508|     69|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     69|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     69|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  509|  35.9k|    *ptr++ = rescale[temp];
  510|  35.9k|  }
  511|  34.6k|  return 1;
  512|  34.6k|}
rdppm-12.c:get_word_gray_rgb_row:
  518|   173k|{
  519|   173k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  520|   173k|  register _JSAMPROW ptr;
  521|   173k|  register unsigned char *bufferptr;
  522|   173k|  register _JSAMPLE *rescale = source->rescale;
  523|   173k|  JDIMENSION col;
  524|   173k|  unsigned int maxval = source->maxval;
  525|   173k|  register int rindex = rgb_red[cinfo->in_color_space];
  526|   173k|  register int gindex = rgb_green[cinfo->in_color_space];
  527|   173k|  register int bindex = rgb_blue[cinfo->in_color_space];
  528|   173k|  register int aindex = alpha_index[cinfo->in_color_space];
  529|   173k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  530|       |
  531|   173k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|   173k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (531:7): [True: 400, False: 172k]
  ------------------
  532|    400|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    400|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    400|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  533|   173k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|   173k|#define _buffer  buffer12
  ------------------
  534|   173k|  bufferptr = source->iobuffer;
  535|   352k|  for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (535:34): [True: 179k, False: 173k]
  ------------------
  536|   179k|    register unsigned int temp;
  537|   179k|    temp  = (*bufferptr++) << 8;
  538|   179k|    temp |= (*bufferptr++);
  539|   179k|    if (temp > maxval)
  ------------------
  |  Branch (539:9): [True: 345, False: 179k]
  ------------------
  540|    345|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|    345|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    345|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  541|   179k|    ptr[rindex] = ptr[gindex] = ptr[bindex] = rescale[temp];
  542|   179k|    if (aindex >= 0)
  ------------------
  |  Branch (542:9): [True: 35.8k, False: 143k]
  ------------------
  543|  35.8k|      ptr[aindex] = (1 << cinfo->data_precision) - 1;
  544|   179k|    ptr += ps;
  545|   179k|  }
  546|   173k|  return 1;
  547|   173k|}
rdppm-12.c:get_word_gray_cmyk_row:
  553|  34.6k|{
  554|  34.6k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  555|  34.6k|  register _JSAMPROW ptr;
  556|  34.6k|  register unsigned char *bufferptr;
  557|  34.6k|  register _JSAMPLE *rescale = source->rescale;
  558|  34.6k|  JDIMENSION col;
  559|  34.6k|  unsigned int maxval = source->maxval;
  560|       |
  561|  34.6k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  34.6k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (561:7): [True: 80, False: 34.5k]
  ------------------
  562|     80|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     80|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     80|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  563|  34.6k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  34.6k|#define _buffer  buffer12
  ------------------
  564|  34.6k|  bufferptr = source->iobuffer;
  565|  34.6k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (565:7): [True: 280, False: 34.3k]
  ------------------
  566|  1.05k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (566:36): [True: 772, False: 280]
  ------------------
  567|    772|      register unsigned int gray;
  568|    772|      gray  = (*bufferptr++) << 8;
  569|    772|      gray |= (*bufferptr++);
  570|    772|      if (gray > maxval)
  ------------------
  |  Branch (570:11): [True: 21, False: 751]
  ------------------
  571|     21|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     21|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     21|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  572|    772|      rgb_to_cmyk(maxval, (_JSAMPLE)gray, (_JSAMPLE)gray, (_JSAMPLE)gray, ptr,
  573|    772|                  ptr + 1, ptr + 2, ptr + 3);
  574|    772|      ptr += 4;
  575|    772|    }
  576|  34.3k|  } else {
  577|  69.4k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (577:36): [True: 35.1k, False: 34.3k]
  ------------------
  578|  35.1k|      register unsigned int temp;
  579|  35.1k|      _JSAMPLE gray;
  ------------------
  |  |  108|  35.1k|#define _JSAMPLE  J12SAMPLE
  ------------------
  580|  35.1k|      temp  = (*bufferptr++) << 8;
  581|  35.1k|      temp |= (*bufferptr++);
  582|  35.1k|      if (temp > maxval)
  ------------------
  |  Branch (582:11): [True: 48, False: 35.1k]
  ------------------
  583|     48|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     48|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     48|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  584|  35.1k|      gray = rescale[temp];
  585|  35.1k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, gray, gray, gray, ptr,
  586|  35.1k|                  ptr + 1, ptr + 2, ptr + 3);
  587|  35.1k|      ptr += 4;
  588|  35.1k|    }
  589|  34.3k|  }
  590|  34.6k|  return 1;
  591|  34.6k|}
rdppm-12.c:get_scaled_gray_row:
  305|  3.57M|{
  306|  3.57M|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  307|  3.57M|  register _JSAMPROW ptr;
  308|  3.57M|  register unsigned char *bufferptr;
  309|  3.57M|  register _JSAMPLE *rescale = source->rescale;
  310|  3.57M|  JDIMENSION col;
  311|       |
  312|  3.57M|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  3.57M|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (312:7): [True: 73, False: 3.57M]
  ------------------
  313|     73|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     73|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     73|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  314|  3.57M|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  3.57M|#define _buffer  buffer12
  ------------------
  315|  3.57M|  bufferptr = source->iobuffer;
  316|  20.9M|  for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (316:34): [True: 17.4M, False: 3.57M]
  ------------------
  317|  17.4M|    *ptr++ = rescale[*bufferptr++];
  318|  17.4M|  }
  319|  3.57M|  return 1;
  320|  3.57M|}
rdppm-12.c:get_gray_rgb_row:
  327|  17.8M|{
  328|  17.8M|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  329|  17.8M|  register _JSAMPROW ptr;
  330|  17.8M|  register unsigned char *bufferptr;
  331|  17.8M|  register _JSAMPLE *rescale = source->rescale;
  332|  17.8M|  JDIMENSION col;
  333|  17.8M|  unsigned int maxval = source->maxval;
  334|  17.8M|  register int rindex = rgb_red[cinfo->in_color_space];
  335|  17.8M|  register int gindex = rgb_green[cinfo->in_color_space];
  336|  17.8M|  register int bindex = rgb_blue[cinfo->in_color_space];
  337|  17.8M|  register int aindex = alpha_index[cinfo->in_color_space];
  338|  17.8M|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  339|       |
  340|  17.8M|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  17.8M|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (340:7): [True: 365, False: 17.8M]
  ------------------
  341|    365|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    365|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    365|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  342|  17.8M|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  17.8M|#define _buffer  buffer12
  ------------------
  343|  17.8M|  bufferptr = source->iobuffer;
  344|  17.8M|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (344:7): [True: 0, False: 17.8M]
  ------------------
  345|      0|    if (aindex >= 0)
  ------------------
  |  Branch (345:9): [True: 0, False: 0]
  ------------------
  346|      0|      GRAY_RGB_READ_LOOP(*bufferptr++, ptr[aindex] = (_JSAMPLE)maxval;)
  ------------------
  |  |  149|      0|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|      0|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 0, False: 0]
  |  |  ------------------
  |  |  151|      0|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|      0|    alpha_set_op \
  |  |  153|      0|    ptr += ps; \
  |  |  154|      0|  } \
  |  |  155|      0|}
  ------------------
  347|      0|    else
  348|      0|      GRAY_RGB_READ_LOOP(*bufferptr++, {})
  ------------------
  |  |  149|      0|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|      0|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 0, False: 0]
  |  |  ------------------
  |  |  151|      0|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|      0|    alpha_set_op \
  |  |  153|      0|    ptr += ps; \
  |  |  154|      0|  } \
  |  |  155|      0|}
  ------------------
  349|  17.8M|  } else {
  350|  17.8M|    if (aindex >= 0)
  ------------------
  |  Branch (350:9): [True: 3.57M, False: 14.3M]
  ------------------
  351|  3.57M|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |  149|  3.57M|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|  20.9M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 17.4M, False: 3.57M]
  |  |  ------------------
  |  |  151|  17.4M|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|  17.4M|    alpha_set_op \
  |  |  153|  17.4M|    ptr += ps; \
  |  |  154|  17.4M|  } \
  |  |  155|  3.57M|}
  ------------------
  352|  17.8M|                         ptr[aindex] = (1 << cinfo->data_precision) - 1;)
  353|  14.3M|    else
  354|  14.3M|      GRAY_RGB_READ_LOOP(rescale[*bufferptr++], {})
  ------------------
  |  |  149|  14.3M|#define GRAY_RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  150|  83.9M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (150:34): [True: 69.6M, False: 14.3M]
  |  |  ------------------
  |  |  151|  69.6M|    ptr[rindex] = ptr[gindex] = ptr[bindex] = read_op; \
  |  |  152|  69.6M|    alpha_set_op \
  |  |  153|  69.6M|    ptr += ps; \
  |  |  154|  69.6M|  } \
  |  |  155|  14.3M|}
  ------------------
  355|  17.8M|  }
  356|  17.8M|  return 1;
  357|  17.8M|}
rdppm-12.c:get_gray_cmyk_row:
  364|  3.57M|{
  365|  3.57M|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  366|  3.57M|  register _JSAMPROW ptr;
  367|  3.57M|  register unsigned char *bufferptr;
  368|  3.57M|  register _JSAMPLE *rescale = source->rescale;
  369|  3.57M|  JDIMENSION col;
  370|  3.57M|  unsigned int maxval = source->maxval;
  371|       |
  372|  3.57M|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  3.57M|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (372:7): [True: 73, False: 3.57M]
  ------------------
  373|     73|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     73|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     73|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  374|  3.57M|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  3.57M|#define _buffer  buffer12
  ------------------
  375|  3.57M|  bufferptr = source->iobuffer;
  376|  3.57M|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (376:7): [True: 0, False: 3.57M]
  ------------------
  377|      0|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (377:36): [True: 0, False: 0]
  ------------------
  378|      0|      _JSAMPLE gray = *bufferptr++;
  ------------------
  |  |  108|      0|#define _JSAMPLE  J12SAMPLE
  ------------------
  379|      0|      rgb_to_cmyk(maxval, gray, gray, gray, ptr, ptr + 1, ptr + 2, ptr + 3);
  380|      0|      ptr += 4;
  381|      0|    }
  382|  3.57M|  } else {
  383|  20.9M|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (383:36): [True: 17.4M, False: 3.57M]
  ------------------
  384|  17.4M|      _JSAMPLE gray = rescale[*bufferptr++];
  ------------------
  |  |  108|  17.4M|#define _JSAMPLE  J12SAMPLE
  ------------------
  385|  17.4M|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, gray, gray, gray, ptr,
  386|  17.4M|                  ptr + 1, ptr + 2, ptr + 3);
  387|  17.4M|      ptr += 4;
  388|  17.4M|    }
  389|  3.57M|  }
  390|  3.57M|  return 1;
  391|  3.57M|}
rdppm-12.c:get_word_rgb_row:
  597|  15.7k|{
  598|  15.7k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  599|  15.7k|  register _JSAMPROW ptr;
  600|  15.7k|  register unsigned char *bufferptr;
  601|  15.7k|  register _JSAMPLE *rescale = source->rescale;
  602|  15.7k|  JDIMENSION col;
  603|  15.7k|  unsigned int maxval = source->maxval;
  604|  15.7k|  register int rindex = rgb_red[cinfo->in_color_space];
  605|  15.7k|  register int gindex = rgb_green[cinfo->in_color_space];
  606|  15.7k|  register int bindex = rgb_blue[cinfo->in_color_space];
  607|  15.7k|  register int aindex = alpha_index[cinfo->in_color_space];
  608|  15.7k|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  609|       |
  610|  15.7k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  15.7k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (610:7): [True: 550, False: 15.1k]
  ------------------
  611|    550|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    550|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    550|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  612|  15.7k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  15.7k|#define _buffer  buffer12
  ------------------
  613|  15.7k|  bufferptr = source->iobuffer;
  614|  40.5k|  for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (614:34): [True: 24.8k, False: 15.7k]
  ------------------
  615|  24.8k|    register unsigned int temp;
  616|  24.8k|    temp  = (*bufferptr++) << 8;
  617|  24.8k|    temp |= (*bufferptr++);
  618|  24.8k|    if (temp > maxval)
  ------------------
  |  Branch (618:9): [True: 255, False: 24.5k]
  ------------------
  619|    255|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|    255|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    255|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  620|  24.8k|    ptr[rindex] = rescale[temp];
  621|  24.8k|    temp  = (*bufferptr++) << 8;
  622|  24.8k|    temp |= (*bufferptr++);
  623|  24.8k|    if (temp > maxval)
  ------------------
  |  Branch (623:9): [True: 230, False: 24.6k]
  ------------------
  624|    230|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|    230|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    230|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  625|  24.8k|    ptr[gindex] = rescale[temp];
  626|  24.8k|    temp  = (*bufferptr++) << 8;
  627|  24.8k|    temp |= (*bufferptr++);
  628|  24.8k|    if (temp > maxval)
  ------------------
  |  Branch (628:9): [True: 175, False: 24.6k]
  ------------------
  629|    175|      ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|    175|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    175|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  630|  24.8k|    ptr[bindex] = rescale[temp];
  631|  24.8k|    if (aindex >= 0)
  ------------------
  |  Branch (631:9): [True: 4.83k, False: 19.9k]
  ------------------
  632|  4.83k|      ptr[aindex] = (1 << cinfo->data_precision) - 1;
  633|  24.8k|    ptr += ps;
  634|  24.8k|  }
  635|  15.7k|  return 1;
  636|  15.7k|}
rdppm-12.c:get_word_rgb_cmyk_row:
  642|  3.14k|{
  643|  3.14k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  644|  3.14k|  register _JSAMPROW ptr;
  645|  3.14k|  register unsigned char *bufferptr;
  646|  3.14k|  register _JSAMPLE *rescale = source->rescale;
  647|  3.14k|  JDIMENSION col;
  648|  3.14k|  unsigned int maxval = source->maxval;
  649|       |
  650|  3.14k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  3.14k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (650:7): [True: 110, False: 3.03k]
  ------------------
  651|    110|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    110|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    110|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  652|  3.14k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  3.14k|#define _buffer  buffer12
  ------------------
  653|  3.14k|  bufferptr = source->iobuffer;
  654|  3.14k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (654:7): [True: 786, False: 2.35k]
  ------------------
  655|  2.72k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (655:36): [True: 1.93k, False: 786]
  ------------------
  656|  1.93k|      register unsigned int r, g, b;
  657|  1.93k|      r  = (*bufferptr++) << 8;
  658|  1.93k|      r |= (*bufferptr++);
  659|  1.93k|      if (r > maxval)
  ------------------
  |  Branch (659:11): [True: 16, False: 1.92k]
  ------------------
  660|     16|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     16|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     16|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  661|  1.93k|      g  = (*bufferptr++) << 8;
  662|  1.93k|      g |= (*bufferptr++);
  663|  1.93k|      if (g > maxval)
  ------------------
  |  Branch (663:11): [True: 21, False: 1.91k]
  ------------------
  664|     21|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     21|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     21|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  665|  1.93k|      b  = (*bufferptr++) << 8;
  666|  1.93k|      b |= (*bufferptr++);
  667|  1.93k|      if (b > maxval)
  ------------------
  |  Branch (667:11): [True: 16, False: 1.92k]
  ------------------
  668|     16|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     16|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     16|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  669|  1.93k|      rgb_to_cmyk(maxval, (_JSAMPLE)r, (_JSAMPLE)g, (_JSAMPLE)b, ptr, ptr + 1,
  670|  1.93k|                  ptr + 2, ptr + 3);
  671|  1.93k|      ptr += 4;
  672|  1.93k|    }
  673|  2.35k|  } else {
  674|  5.38k|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (674:36): [True: 3.02k, False: 2.35k]
  ------------------
  675|  3.02k|      register unsigned int r, g, b;
  676|  3.02k|      r  = (*bufferptr++) << 8;
  677|  3.02k|      r |= (*bufferptr++);
  678|  3.02k|      if (r > maxval)
  ------------------
  |  Branch (678:11): [True: 35, False: 2.99k]
  ------------------
  679|     35|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     35|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     35|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  680|  3.02k|      g  = (*bufferptr++) << 8;
  681|  3.02k|      g |= (*bufferptr++);
  682|  3.02k|      if (g > maxval)
  ------------------
  |  Branch (682:11): [True: 25, False: 3.00k]
  ------------------
  683|     25|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     25|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     25|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  684|  3.02k|      b  = (*bufferptr++) << 8;
  685|  3.02k|      b |= (*bufferptr++);
  686|  3.02k|      if (b > maxval)
  ------------------
  |  Branch (686:11): [True: 19, False: 3.00k]
  ------------------
  687|     19|        ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
  ------------------
  |  |  240|     19|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     19|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  688|  3.02k|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, rescale[r], rescale[g],
  689|  3.02k|                  rescale[b], ptr, ptr + 1, ptr + 2, ptr + 3);
  690|  3.02k|      ptr += 4;
  691|  3.02k|    }
  692|  2.35k|  }
  693|  3.14k|  return 1;
  694|  3.14k|}
rdppm-12.c:get_rgb_row:
  397|  4.95M|{
  398|  4.95M|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  399|  4.95M|  register _JSAMPROW ptr;
  400|  4.95M|  register unsigned char *bufferptr;
  401|  4.95M|  register _JSAMPLE *rescale = source->rescale;
  402|  4.95M|  JDIMENSION col;
  403|  4.95M|  unsigned int maxval = source->maxval;
  404|  4.95M|  register int rindex = rgb_red[cinfo->in_color_space];
  405|  4.95M|  register int gindex = rgb_green[cinfo->in_color_space];
  406|  4.95M|  register int bindex = rgb_blue[cinfo->in_color_space];
  407|  4.95M|  register int aindex = alpha_index[cinfo->in_color_space];
  408|  4.95M|  register int ps = rgb_pixelsize[cinfo->in_color_space];
  409|       |
  410|  4.95M|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|  4.95M|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (410:7): [True: 460, False: 4.95M]
  ------------------
  411|    460|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|    460|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    460|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  412|  4.95M|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|  4.95M|#define _buffer  buffer12
  ------------------
  413|  4.95M|  bufferptr = source->iobuffer;
  414|  4.95M|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (414:7): [True: 0, False: 4.95M]
  ------------------
  415|      0|    if (aindex >= 0)
  ------------------
  |  Branch (415:9): [True: 0, False: 0]
  ------------------
  416|      0|      RGB_READ_LOOP(*bufferptr++, ptr[aindex] = (_JSAMPLE)maxval;)
  ------------------
  |  |  223|      0|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|      0|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 0, False: 0]
  |  |  ------------------
  |  |  225|      0|    ptr[rindex] = read_op; \
  |  |  226|      0|    ptr[gindex] = read_op; \
  |  |  227|      0|    ptr[bindex] = read_op; \
  |  |  228|      0|    alpha_set_op \
  |  |  229|      0|    ptr += ps; \
  |  |  230|      0|  } \
  |  |  231|      0|}
  ------------------
  417|      0|    else
  418|      0|      RGB_READ_LOOP(*bufferptr++, {})
  ------------------
  |  |  223|      0|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|      0|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 0, False: 0]
  |  |  ------------------
  |  |  225|      0|    ptr[rindex] = read_op; \
  |  |  226|      0|    ptr[gindex] = read_op; \
  |  |  227|      0|    ptr[bindex] = read_op; \
  |  |  228|      0|    alpha_set_op \
  |  |  229|      0|    ptr += ps; \
  |  |  230|      0|  } \
  |  |  231|      0|}
  ------------------
  419|  4.95M|  } else {
  420|  4.95M|    if (aindex >= 0)
  ------------------
  |  Branch (420:9): [True: 990k, False: 3.96M]
  ------------------
  421|   990k|      RGB_READ_LOOP(rescale[*bufferptr++],
  ------------------
  |  |  223|   990k|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  6.66M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 5.67M, False: 990k]
  |  |  ------------------
  |  |  225|  5.67M|    ptr[rindex] = read_op; \
  |  |  226|  5.67M|    ptr[gindex] = read_op; \
  |  |  227|  5.67M|    ptr[bindex] = read_op; \
  |  |  228|  5.67M|    alpha_set_op \
  |  |  229|  5.67M|    ptr += ps; \
  |  |  230|  5.67M|  } \
  |  |  231|   990k|}
  ------------------
  422|  4.95M|                    ptr[aindex] = (1 << cinfo->data_precision) - 1;)
  423|  3.96M|    else
  424|  3.96M|      RGB_READ_LOOP(rescale[*bufferptr++], {})
  ------------------
  |  |  223|  3.96M|#define RGB_READ_LOOP(read_op, alpha_set_op) { \
  |  |  224|  26.6M|  for (col = cinfo->image_width; col > 0; col--) { \
  |  |  ------------------
  |  |  |  Branch (224:34): [True: 22.6M, False: 3.96M]
  |  |  ------------------
  |  |  225|  22.6M|    ptr[rindex] = read_op; \
  |  |  226|  22.6M|    ptr[gindex] = read_op; \
  |  |  227|  22.6M|    ptr[bindex] = read_op; \
  |  |  228|  22.6M|    alpha_set_op \
  |  |  229|  22.6M|    ptr += ps; \
  |  |  230|  22.6M|  } \
  |  |  231|  3.96M|}
  ------------------
  425|  4.95M|  }
  426|  4.95M|  return 1;
  427|  4.95M|}
rdppm-12.c:get_rgb_cmyk_row:
  434|   990k|{
  435|   990k|  ppm_source_ptr source = (ppm_source_ptr)sinfo;
  436|   990k|  register _JSAMPROW ptr;
  437|   990k|  register unsigned char *bufferptr;
  438|   990k|  register _JSAMPLE *rescale = source->rescale;
  439|   990k|  JDIMENSION col;
  440|   990k|  unsigned int maxval = source->maxval;
  441|       |
  442|   990k|  if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
  ------------------
  |  |   46|   990k|  (fread(buffer, 1, len, file) == ((size_t)(len)))
  ------------------
  |  Branch (442:7): [True: 92, False: 990k]
  ------------------
  443|     92|    ERREXIT(cinfo, JERR_INPUT_EOF);
  ------------------
  |  |  240|     92|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     92|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  444|   990k|  ptr = source->pub._buffer[0];
  ------------------
  |  |  210|   990k|#define _buffer  buffer12
  ------------------
  445|   990k|  bufferptr = source->iobuffer;
  446|   990k|  if (maxval == (1U << cinfo->data_precision) - 1U) {
  ------------------
  |  Branch (446:7): [True: 0, False: 990k]
  ------------------
  447|      0|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (447:36): [True: 0, False: 0]
  ------------------
  448|      0|      _JSAMPLE r = *bufferptr++;
  ------------------
  |  |  108|      0|#define _JSAMPLE  J12SAMPLE
  ------------------
  449|      0|      _JSAMPLE g = *bufferptr++;
  ------------------
  |  |  108|      0|#define _JSAMPLE  J12SAMPLE
  ------------------
  450|      0|      _JSAMPLE b = *bufferptr++;
  ------------------
  |  |  108|      0|#define _JSAMPLE  J12SAMPLE
  ------------------
  451|      0|      rgb_to_cmyk(maxval, r, g, b, ptr, ptr + 1, ptr + 2, ptr + 3);
  452|      0|      ptr += 4;
  453|      0|    }
  454|   990k|  } else {
  455|  6.66M|    for (col = cinfo->image_width; col > 0; col--) {
  ------------------
  |  Branch (455:36): [True: 5.67M, False: 990k]
  ------------------
  456|  5.67M|      _JSAMPLE r = rescale[*bufferptr++];
  ------------------
  |  |  108|  5.67M|#define _JSAMPLE  J12SAMPLE
  ------------------
  457|  5.67M|      _JSAMPLE g = rescale[*bufferptr++];
  ------------------
  |  |  108|  5.67M|#define _JSAMPLE  J12SAMPLE
  ------------------
  458|  5.67M|      _JSAMPLE b = rescale[*bufferptr++];
  ------------------
  |  |  108|  5.67M|#define _JSAMPLE  J12SAMPLE
  ------------------
  459|  5.67M|      rgb_to_cmyk((1 << cinfo->data_precision) - 1, r, g, b, ptr, ptr + 1,
  460|  5.67M|                  ptr + 2, ptr + 3);
  461|  5.67M|      ptr += 4;
  462|  5.67M|    }
  463|   990k|  }
  464|   990k|  return 1;
  465|   990k|}
rdppm-12.c:finish_input_ppm:
  913|  16.1k|{
  914|       |  /* no work */
  915|  16.1k|}

spng_decode_scanline:
 3302|   729k|{
 3303|   729k|    if(ctx == NULL || out == NULL) return 1;
  ------------------
  |  Branch (3303:8): [True: 0, False: 729k]
  |  Branch (3303:23): [True: 0, False: 729k]
  ------------------
 3304|       |
 3305|   729k|    if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI;
  ------------------
  |  Branch (3305:8): [True: 0, False: 729k]
  ------------------
 3306|       |
 3307|   729k|    struct decode_flags f = ctx->decode_flags;
 3308|       |
 3309|   729k|    struct spng_row_info *ri = &ctx->row_info;
 3310|   729k|    const struct spng_subimage *sub = ctx->subimage;
 3311|       |
 3312|   729k|    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|   729k|    unsigned char *trns_px = ctx->trns_px;
 3318|   729k|    const struct spng_sbit *sb = &ctx->decode_sb;
 3319|   729k|    const struct spng_plte_entry *plte = ctx->decode_plte.rgba;
 3320|   729k|    struct spng__iter iter = spng__iter_init(ihdr->bit_depth, ctx->scanline);
 3321|       |
 3322|   729k|    const unsigned char *scanline;
 3323|       |
 3324|   729k|    const int pass = ri->pass;
 3325|   729k|    const int fmt = ctx->fmt;
 3326|   729k|    const size_t scanline_width = sub[pass].scanline_width;
 3327|   729k|    const uint32_t width = sub[pass].width;
 3328|   729k|    uint32_t k;
 3329|   729k|    uint8_t r_8, g_8, b_8, a_8, gray_8;
 3330|   729k|    uint16_t r_16, g_16, b_16, a_16, gray_16;
 3331|   729k|    r_8=0; g_8=0; b_8=0; a_8=0; gray_8=0;
 3332|   729k|    r_16=0; g_16=0; b_16=0; a_16=0; gray_16=0;
 3333|   729k|    size_t pixel_size = 4; /* SPNG_FMT_RGBA8 */
 3334|   729k|    size_t pixel_offset = 0;
 3335|   729k|    unsigned char *pixel;
 3336|   729k|    unsigned processing_depth = ihdr->bit_depth;
 3337|       |
 3338|   729k|    if(f.indexed) processing_depth = 8;
  ------------------
  |  Branch (3338:8): [True: 735, False: 729k]
  ------------------
 3339|       |
 3340|   729k|    if(fmt == SPNG_FMT_RGBA16) pixel_size = 8;
  ------------------
  |  Branch (3340:8): [True: 0, False: 729k]
  ------------------
 3341|   729k|    else if(fmt == SPNG_FMT_RGB8) pixel_size = 3;
  ------------------
  |  Branch (3341:13): [True: 0, False: 729k]
  ------------------
 3342|       |
 3343|   729k|    if(len < sub[pass].out_width) return SPNG_EBUFSIZ;
  ------------------
  |  Branch (3343:8): [True: 0, False: 729k]
  ------------------
 3344|       |
 3345|   729k|    int ret = read_scanline(ctx);
 3346|       |
 3347|   729k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3347:8): [True: 3.66k, False: 726k]
  ------------------
 3348|       |
 3349|   726k|    scanline = ctx->scanline;
 3350|       |
 3351|   726k|    for(k=0; k < width; k++)
  ------------------
  |  Branch (3351:14): [True: 726k, False: 0]
  ------------------
 3352|   726k|    {
 3353|   726k|        pixel = (unsigned char*)out + pixel_offset;
 3354|   726k|        pixel_offset += pixel_size;
 3355|       |
 3356|   726k|        if(f.same_layout)
  ------------------
  |  Branch (3356:12): [True: 726k, False: 0]
  ------------------
 3357|   726k|        {
 3358|   726k|            if(f.zerocopy) break;
  ------------------
  |  Branch (3358:16): [True: 0, False: 726k]
  ------------------
 3359|       |
 3360|   726k|            memcpy(out, scanline, scanline_width - 1);
 3361|   726k|            break;
 3362|   726k|        }
 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|   726k|    if(f.apply_trns) trns_row(out, scanline, trns_px, ctx->bytes_per_pixel, &ctx->ihdr, width, fmt);
  ------------------
  |  Branch (3539:8): [True: 0, False: 726k]
  ------------------
 3540|       |
 3541|   726k|    if(f.do_scaling) scale_row(out, width, fmt, processing_depth, sb);
  ------------------
  |  Branch (3541:8): [True: 0, False: 726k]
  ------------------
 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|   726k|    void *t = ctx->prev_scanline;
 3550|   726k|    ctx->prev_scanline = ctx->scanline;
 3551|   726k|    ctx->scanline = t;
 3552|       |
 3553|   726k|    ret = update_row_info(ctx);
 3554|       |
 3555|   726k|    if(ret == SPNG_EOI)
  ------------------
  |  Branch (3555:8): [True: 2.54k, False: 723k]
  ------------------
 3556|  2.54k|    {
 3557|  2.54k|        if(ctx->cur_chunk_bytes_left) /* zlib stream ended before an IDAT chunk boundary */
  ------------------
  |  Branch (3557:12): [True: 102, False: 2.44k]
  ------------------
 3558|    102|        {/* Discard the rest of the chunk */
 3559|    102|            int error = discard_chunk_bytes(ctx, ctx->cur_chunk_bytes_left);
 3560|    102|            if(error) return decode_err(ctx, error);
  ------------------
  |  Branch (3560:16): [True: 95, False: 7]
  ------------------
 3561|    102|        }
 3562|       |
 3563|  2.44k|        ctx->last_idat = ctx->current_chunk;
 3564|  2.44k|    }
 3565|       |
 3566|   726k|    return ret;
 3567|   726k|}
spng_decode_row:
 3570|   729k|{
 3571|   729k|    if(ctx == NULL || out == NULL) return 1;
  ------------------
  |  Branch (3571:8): [True: 0, False: 729k]
  |  Branch (3571:23): [True: 0, False: 729k]
  ------------------
 3572|   729k|    if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI;
  ------------------
  |  Branch (3572:8): [True: 0, False: 729k]
  ------------------
 3573|   729k|    if(len < ctx->image_width) return SPNG_EBUFSIZ;
  ------------------
  |  Branch (3573:8): [True: 0, False: 729k]
  ------------------
 3574|       |
 3575|   729k|    const struct spng_ihdr *ihdr = &ctx->ihdr;
 3576|   729k|    int ret, pass = ctx->row_info.pass;
 3577|   729k|    unsigned char *outptr = out;
 3578|       |
 3579|   729k|    if(!ihdr->interlace_method || pass == 6) return spng_decode_scanline(ctx, out, len);
  ------------------
  |  Branch (3579:8): [True: 252k, False: 477k]
  |  Branch (3579:35): [True: 126, False: 477k]
  ------------------
 3580|       |
 3581|   477k|    ret = spng_decode_scanline(ctx, ctx->row, ctx->image_width);
 3582|   477k|    if(ret && ret != SPNG_EOI) return ret;
  ------------------
  |  Branch (3582:8): [True: 658, False: 476k]
  |  Branch (3582:15): [True: 658, False: 0]
  ------------------
 3583|       |
 3584|   476k|    uint32_t k;
 3585|   476k|    unsigned pixel_size = 4; /* RGBA8 */
 3586|   476k|    if(ctx->fmt == SPNG_FMT_RGBA16) pixel_size = 8;
  ------------------
  |  Branch (3586:8): [True: 0, False: 476k]
  ------------------
 3587|   476k|    else if(ctx->fmt == SPNG_FMT_RGB8) pixel_size = 3;
  ------------------
  |  Branch (3587:13): [True: 0, False: 476k]
  ------------------
 3588|   476k|    else if(ctx->fmt == SPNG_FMT_G8) pixel_size = 1;
  ------------------
  |  Branch (3588:13): [True: 0, False: 476k]
  ------------------
 3589|   476k|    else if(ctx->fmt == SPNG_FMT_GA8) pixel_size = 2;
  ------------------
  |  Branch (3589:13): [True: 0, False: 476k]
  ------------------
 3590|   476k|    else if(ctx->fmt & (SPNG_FMT_PNG | SPNG_FMT_RAW))
  ------------------
  |  Branch (3590:13): [True: 476k, False: 0]
  ------------------
 3591|   476k|    {
 3592|   476k|        if(ihdr->bit_depth < 8)
  ------------------
  |  Branch (3592:12): [True: 0, False: 476k]
  ------------------
 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|   476k|        else pixel_size = ctx->bytes_per_pixel;
 3614|   476k|    }
 3615|       |
 3616|  23.6M|    for(k=0; k < ctx->subimage[pass].width; k++)
  ------------------
  |  Branch (3616:14): [True: 23.1M, False: 476k]
  ------------------
 3617|  23.1M|    {
 3618|  23.1M|        size_t ioffset = (adam7_x_start[pass] + (size_t) k * adam7_x_delta[pass]) * pixel_size;
 3619|       |
 3620|  23.1M|        memcpy(outptr + ioffset, ctx->row + k * pixel_size, pixel_size);
 3621|  23.1M|    }
 3622|       |
 3623|   476k|    return 0;
 3624|   476k|}
spng_decode_chunks:
 3627|  32.8k|{
 3628|  32.8k|    if(ctx == NULL) return 1;
  ------------------
  |  Branch (3628:8): [True: 0, False: 32.8k]
  ------------------
 3629|  32.8k|    if(ctx->encode_only) return SPNG_ECTXTYPE;
  ------------------
  |  Branch (3629:8): [True: 0, False: 32.8k]
  ------------------
 3630|  32.8k|    if(ctx->state < SPNG_STATE_INPUT) return SPNG_ENOSRC;
  ------------------
  |  Branch (3630:8): [True: 16.4k, False: 16.3k]
  ------------------
 3631|  16.3k|    if(ctx->state == SPNG_STATE_IEND) return 0;
  ------------------
  |  Branch (3631:8): [True: 0, False: 16.3k]
  ------------------
 3632|       |
 3633|  16.3k|    return read_chunks(ctx, 0);
 3634|  16.3k|}
spng_decode_image:
 3637|  18.7k|{
 3638|  18.7k|    if(ctx == NULL) return 1;
  ------------------
  |  Branch (3638:8): [True: 0, False: 18.7k]
  ------------------
 3639|  18.7k|    if(ctx->encode_only) return SPNG_ECTXTYPE;
  ------------------
  |  Branch (3639:8): [True: 0, False: 18.7k]
  ------------------
 3640|  18.7k|    if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI;
  ------------------
  |  Branch (3640:8): [True: 0, False: 18.7k]
  ------------------
 3641|       |
 3642|  18.7k|    const struct spng_ihdr *ihdr = &ctx->ihdr;
 3643|       |
 3644|  18.7k|    int ret = read_chunks(ctx, 0);
 3645|  18.7k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3645:8): [True: 9.16k, False: 9.58k]
  ------------------
 3646|       |
 3647|  9.58k|    ret = check_decode_fmt(ihdr, fmt);
 3648|  9.58k|    if(ret) return ret;
  ------------------
  |  Branch (3648:8): [True: 0, False: 9.58k]
  ------------------
 3649|       |
 3650|  9.58k|    ret = calculate_image_width(ihdr, fmt, &ctx->image_width);
 3651|  9.58k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3651:8): [True: 0, False: 9.58k]
  ------------------
 3652|       |
 3653|  9.58k|    if(ctx->image_width > SIZE_MAX / ihdr->height) ctx->image_size = 0; /* overflow */
  ------------------
  |  Branch (3653:8): [True: 0, False: 9.58k]
  ------------------
 3654|  9.58k|    else ctx->image_size = ctx->image_width * ihdr->height;
 3655|       |
 3656|  9.58k|    if( !(flags & SPNG_DECODE_PROGRESSIVE) )
  ------------------
  |  Branch (3656:9): [True: 0, False: 9.58k]
  ------------------
 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|  9.58k|    uint32_t bytes_read = 0;
 3664|       |
 3665|  9.58k|    ret = read_idat_bytes(ctx, &bytes_read);
 3666|  9.58k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3666:8): [True: 260, False: 9.32k]
  ------------------
 3667|       |
 3668|  9.32k|    if(bytes_read > 1)
  ------------------
  |  Branch (3668:8): [True: 8.51k, False: 807]
  ------------------
 3669|  8.51k|    {
 3670|  8.51k|        int valid = read_u16(ctx->data) % 31 ? 0 : 1;
  ------------------
  |  Branch (3670:21): [True: 65, False: 8.45k]
  ------------------
 3671|       |
 3672|  8.51k|        unsigned flg = ctx->data[1];
 3673|  8.51k|        unsigned flevel = flg >> 6;
 3674|  8.51k|        int compression_level = Z_DEFAULT_COMPRESSION;
  ------------------
  |  |  197|  8.51k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
 3675|       |
 3676|  8.51k|        if(flevel == 0) compression_level = 0; /* fastest */
  ------------------
  |  Branch (3676:12): [True: 206, False: 8.31k]
  ------------------
 3677|  8.31k|        else if(flevel == 1) compression_level = 1; /* fast */
  ------------------
  |  Branch (3677:17): [True: 40, False: 8.27k]
  ------------------
 3678|  8.27k|        else if(flevel == 2) compression_level = 6; /* default */
  ------------------
  |  Branch (3678:17): [True: 4.57k, False: 3.69k]
  ------------------
 3679|  3.69k|        else if(flevel == 3) compression_level = 9; /* slowest, max compression */
  ------------------
  |  Branch (3679:17): [True: 3.69k, False: 0]
  ------------------
 3680|       |
 3681|  8.51k|        if(valid) ctx->image_options.compression_level = compression_level;
  ------------------
  |  Branch (3681:12): [True: 8.45k, False: 65]
  ------------------
 3682|  8.51k|    }
 3683|       |
 3684|  9.32k|    ret = spng__inflate_init(ctx, ctx->image_options.window_bits);
 3685|  9.32k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3685:8): [True: 0, False: 9.32k]
  ------------------
 3686|       |
 3687|  9.32k|    ctx->zstream.avail_in = bytes_read;
 3688|  9.32k|    ctx->zstream.next_in = ctx->data;
 3689|       |
 3690|  9.32k|    size_t scanline_buf_size = ctx->subimage[ctx->widest_pass].scanline_width;
 3691|       |
 3692|  9.32k|    scanline_buf_size += 32;
 3693|       |
 3694|  9.32k|    if(scanline_buf_size < 32) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (3694:8): [True: 0, False: 9.32k]
  ------------------
 3695|       |
 3696|  9.32k|    ctx->scanline_buf = spng__malloc(ctx, scanline_buf_size);
 3697|  9.32k|    ctx->prev_scanline_buf = spng__malloc(ctx, scanline_buf_size);
 3698|       |
 3699|  9.32k|    ctx->scanline = ctx->scanline_buf;
 3700|  9.32k|    ctx->prev_scanline = ctx->prev_scanline_buf;
 3701|       |
 3702|  9.32k|    struct decode_flags f = {0};
 3703|       |
 3704|  9.32k|    ctx->fmt = fmt;
 3705|       |
 3706|  9.32k|    if(ihdr->color_type == SPNG_COLOR_TYPE_INDEXED) f.indexed = 1;
  ------------------
  |  Branch (3706:8): [True: 361, False: 8.96k]
  ------------------
 3707|       |
 3708|  9.32k|    unsigned processing_depth = ihdr->bit_depth;
 3709|       |
 3710|  9.32k|    if(f.indexed) processing_depth = 8;
  ------------------
  |  Branch (3710:8): [True: 361, False: 8.96k]
  ------------------
 3711|       |
 3712|  9.32k|    if(ihdr->interlace_method)
  ------------------
  |  Branch (3712:8): [True: 2.50k, False: 6.81k]
  ------------------
 3713|  2.50k|    {
 3714|  2.50k|        f.interlaced = 1;
 3715|  2.50k|        ctx->row_buf = spng__malloc(ctx, ctx->image_width);
 3716|  2.50k|        ctx->row = ctx->row_buf;
 3717|       |
 3718|  2.50k|        if(ctx->row == NULL) return decode_err(ctx, SPNG_EMEM);
  ------------------
  |  Branch (3718:12): [True: 0, False: 2.50k]
  ------------------
 3719|  2.50k|    }
 3720|       |
 3721|  9.32k|    if(ctx->scanline == NULL || ctx->prev_scanline == NULL)
  ------------------
  |  Branch (3721:8): [True: 0, False: 9.32k]
  |  Branch (3721:33): [True: 0, False: 9.32k]
  ------------------
 3722|      0|    {
 3723|      0|        return decode_err(ctx, SPNG_EMEM);
 3724|      0|    }
 3725|       |
 3726|  9.32k|    f.do_scaling = 1;
 3727|  9.32k|    if(f.indexed) f.do_scaling = 0;
  ------------------
  |  Branch (3727:8): [True: 361, False: 8.96k]
  ------------------
 3728|       |
 3729|  9.32k|    unsigned depth_target = 8; /* FMT_RGBA8, G8 */
 3730|  9.32k|    if(fmt == SPNG_FMT_RGBA16) depth_target = 16;
  ------------------
  |  Branch (3730:8): [True: 0, False: 9.32k]
  ------------------
 3731|       |
 3732|  9.32k|    if(flags & SPNG_DECODE_TRNS && ctx->stored.trns) f.apply_trns = 1;
  ------------------
  |  Branch (3732:8): [True: 0, False: 9.32k]
  |  Branch (3732:36): [True: 0, False: 0]
  ------------------
 3733|  9.32k|    else flags &= ~SPNG_DECODE_TRNS;
 3734|       |
 3735|  9.32k|    if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA ||
  ------------------
  |  Branch (3735:8): [True: 910, False: 8.41k]
  ------------------
 3736|  8.41k|       ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA) flags &= ~SPNG_DECODE_TRNS;
  ------------------
  |  Branch (3736:8): [True: 1.63k, False: 6.77k]
  ------------------
 3737|       |
 3738|  9.32k|    if(flags & SPNG_DECODE_GAMMA && ctx->stored.gama) f.apply_gamma = 1;
  ------------------
  |  Branch (3738:8): [True: 0, False: 9.32k]
  |  Branch (3738:37): [True: 0, False: 0]
  ------------------
 3739|  9.32k|    else flags &= ~SPNG_DECODE_GAMMA;
 3740|       |
 3741|  9.32k|    if(flags & SPNG_DECODE_USE_SBIT && ctx->stored.sbit) f.use_sbit = 1;
  ------------------
  |  Branch (3741:8): [True: 0, False: 9.32k]
  |  Branch (3741:40): [True: 0, False: 0]
  ------------------
 3742|  9.32k|    else flags &= ~SPNG_DECODE_USE_SBIT;
 3743|       |
 3744|  9.32k|    if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGBA16))
  ------------------
  |  Branch (3744:8): [True: 0, False: 9.32k]
  ------------------
 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|  9.32k|    else if(fmt == SPNG_FMT_RGB8)
  ------------------
  |  Branch (3749:13): [True: 0, False: 9.32k]
  ------------------
 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|  9.32k|    else if(fmt & (SPNG_FMT_PNG | SPNG_FMT_RAW))
  ------------------
  |  Branch (3756:13): [True: 9.32k, False: 0]
  ------------------
 3757|  9.32k|    {
 3758|  9.32k|        f.same_layout = 1;
 3759|  9.32k|        f.do_scaling = 0;
 3760|  9.32k|        f.apply_gamma = 0; /* for now */
 3761|  9.32k|        f.apply_trns = 0;
 3762|  9.32k|    }
 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|  9.32k|    struct spng_sbit *sb = &ctx->decode_sb;
 3836|       |
 3837|  9.32k|    sb->red_bits = processing_depth;
 3838|  9.32k|    sb->green_bits = processing_depth;
 3839|  9.32k|    sb->blue_bits = processing_depth;
 3840|  9.32k|    sb->alpha_bits = processing_depth;
 3841|  9.32k|    sb->grayscale_bits = processing_depth;
 3842|       |
 3843|  9.32k|    if(f.use_sbit)
  ------------------
  |  Branch (3843:8): [True: 0, False: 9.32k]
  ------------------
 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|  9.32k|    if(ihdr->bit_depth == 16 && fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGB8))
  ------------------
  |  Branch (3871:8): [True: 3.23k, False: 6.09k]
  |  Branch (3871:33): [True: 0, False: 3.23k]
  ------------------
 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|  9.32k|    if(!depth_target || depth_target > 16 ||
  ------------------
  |  Branch (3883:8): [True: 0, False: 9.32k]
  |  Branch (3883:25): [True: 0, False: 9.32k]
  ------------------
 3884|  9.32k|       !processing_depth || processing_depth > 16 ||
  ------------------
  |  Branch (3884:8): [True: 0, False: 9.32k]
  |  Branch (3884:29): [True: 0, False: 9.32k]
  ------------------
 3885|  9.32k|       !sb->grayscale_bits || sb->grayscale_bits > processing_depth ||
  ------------------
  |  Branch (3885:8): [True: 0, False: 9.32k]
  |  Branch (3885:31): [True: 0, False: 9.32k]
  ------------------
 3886|  9.32k|       !sb->alpha_bits || sb->alpha_bits > processing_depth ||
  ------------------
  |  Branch (3886:8): [True: 0, False: 9.32k]
  |  Branch (3886:27): [True: 0, False: 9.32k]
  ------------------
 3887|  9.32k|       !sb->red_bits || sb->red_bits > processing_depth ||
  ------------------
  |  Branch (3887:8): [True: 0, False: 9.32k]
  |  Branch (3887:25): [True: 0, False: 9.32k]
  ------------------
 3888|  9.32k|       !sb->green_bits || sb->green_bits > processing_depth ||
  ------------------
  |  Branch (3888:8): [True: 0, False: 9.32k]
  |  Branch (3888:27): [True: 0, False: 9.32k]
  ------------------
 3889|  9.32k|       !sb->blue_bits || sb->blue_bits > processing_depth)
  ------------------
  |  Branch (3889:8): [True: 0, False: 9.32k]
  |  Branch (3889:26): [True: 0, False: 9.32k]
  ------------------
 3890|      0|    {
 3891|      0|        return decode_err(ctx, SPNG_ESBIT);
 3892|      0|    }
 3893|       |
 3894|  9.32k|    if(sb->red_bits == sb->green_bits &&
  ------------------
  |  Branch (3894:8): [True: 9.32k, False: 0]
  ------------------
 3895|  9.32k|       sb->green_bits == sb->blue_bits &&
  ------------------
  |  Branch (3895:8): [True: 9.32k, False: 0]
  ------------------
 3896|  9.32k|       sb->blue_bits == sb->alpha_bits &&
  ------------------
  |  Branch (3896:8): [True: 9.32k, False: 0]
  ------------------
 3897|  9.32k|       sb->alpha_bits == processing_depth &&
  ------------------
  |  Branch (3897:8): [True: 9.32k, False: 0]
  ------------------
 3898|  9.32k|       processing_depth == depth_target) f.do_scaling = 0;
  ------------------
  |  Branch (3898:8): [True: 6.09k, False: 3.23k]
  ------------------
 3899|       |
 3900|  9.32k|    struct spng_plte_entry *plte = ctx->decode_plte.rgba;
 3901|       |
 3902|       |    /* Pre-process palette entries */
 3903|  9.32k|    if(f.indexed)
  ------------------
  |  Branch (3903:8): [True: 361, False: 8.96k]
  ------------------
 3904|    361|    {
 3905|    361|        uint8_t red, green, blue, alpha;
 3906|       |
 3907|    361|        uint32_t i;
 3908|  92.7k|        for(i=0; i < 256; i++)
  ------------------
  |  Branch (3908:18): [True: 92.4k, False: 361]
  ------------------
 3909|  92.4k|        {
 3910|  92.4k|            if(f.apply_trns && i < ctx->trns.n_type3_entries)
  ------------------
  |  Branch (3910:16): [True: 0, False: 92.4k]
  |  Branch (3910:32): [True: 0, False: 0]
  ------------------
 3911|      0|                ctx->plte.entries[i].alpha = ctx->trns.type3_alpha[i];
 3912|  92.4k|            else
 3913|  92.4k|                ctx->plte.entries[i].alpha = 255;
 3914|       |
 3915|  92.4k|            red   = sample_to_target(ctx->plte.entries[i].red, 8, sb->red_bits, 8);
 3916|  92.4k|            green = sample_to_target(ctx->plte.entries[i].green, 8, sb->green_bits, 8);
 3917|  92.4k|            blue  = sample_to_target(ctx->plte.entries[i].blue, 8, sb->blue_bits, 8);
 3918|  92.4k|            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|  92.4k|            plte[i].red = red;
 3930|  92.4k|            plte[i].green = green;
 3931|  92.4k|            plte[i].blue = blue;
 3932|  92.4k|            plte[i].alpha = alpha;
 3933|  92.4k|        }
 3934|       |
 3935|    361|        f.apply_trns = 0;
 3936|    361|    }
 3937|       |
 3938|  9.32k|    unsigned char *trns_px = ctx->trns_px;
 3939|       |
 3940|  9.32k|    if(f.apply_trns)
  ------------------
  |  Branch (3940:8): [True: 0, False: 9.32k]
  ------------------
 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|  9.32k|    ctx->decode_flags = f;
 3977|       |
 3978|  9.32k|    ctx->state = SPNG_STATE_DECODE_INIT;
 3979|       |
 3980|  9.32k|    struct spng_row_info *ri = &ctx->row_info;
 3981|  9.32k|    struct spng_subimage *sub = ctx->subimage;
 3982|       |
 3983|  9.32k|    while(!sub[ri->pass].width || !sub[ri->pass].height) ri->pass++;
  ------------------
  |  Branch (3983:11): [True: 0, False: 9.32k]
  |  Branch (3983:35): [True: 0, False: 9.32k]
  ------------------
 3984|       |
 3985|  9.32k|    if(f.interlaced) ri->row_num = adam7_y_start[ri->pass];
  ------------------
  |  Branch (3985:8): [True: 2.50k, False: 6.81k]
  ------------------
 3986|       |
 3987|  9.32k|    unsigned pixel_size = 4; /* SPNG_FMT_RGBA8 */
 3988|       |
 3989|  9.32k|    if(fmt == SPNG_FMT_RGBA16) pixel_size = 8;
  ------------------
  |  Branch (3989:8): [True: 0, False: 9.32k]
  ------------------
 3990|  9.32k|    else if(fmt == SPNG_FMT_RGB8) pixel_size = 3;
  ------------------
  |  Branch (3990:13): [True: 0, False: 9.32k]
  ------------------
 3991|  9.32k|    else if(fmt == SPNG_FMT_G8) pixel_size = 1;
  ------------------
  |  Branch (3991:13): [True: 0, False: 9.32k]
  ------------------
 3992|  9.32k|    else if(fmt == SPNG_FMT_GA8) pixel_size = 2;
  ------------------
  |  Branch (3992:13): [True: 0, False: 9.32k]
  ------------------
 3993|       |
 3994|  9.32k|    int i;
 3995|  33.6k|    for(i=ri->pass; i <= ctx->last_pass; i++)
  ------------------
  |  Branch (3995:21): [True: 24.3k, False: 9.32k]
  ------------------
 3996|  24.3k|    {
 3997|  24.3k|        if(!sub[i].scanline_width) continue;
  ------------------
  |  Branch (3997:12): [True: 228, False: 24.1k]
  ------------------
 3998|       |
 3999|  24.1k|        if(fmt & (SPNG_FMT_PNG | SPNG_FMT_RAW)) sub[i].out_width = sub[i].scanline_width - 1;
  ------------------
  |  Branch (3999:12): [True: 24.1k, False: 0]
  ------------------
 4000|      0|        else sub[i].out_width = (size_t)sub[i].width * pixel_size;
 4001|       |
 4002|  24.1k|        if(sub[i].out_width > UINT32_MAX) return decode_err(ctx, SPNG_EOVERFLOW);
  ------------------
  |  Branch (4002:12): [True: 0, False: 24.1k]
  ------------------
 4003|  24.1k|    }
 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|  9.32k|    ret = read_scanline_bytes(ctx, &ri->filter, 1);
 4010|  9.32k|    if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (4010:8): [True: 1.67k, False: 7.64k]
  ------------------
 4011|       |
 4012|  7.64k|    if(ri->filter > 4) return decode_err(ctx, SPNG_EFILTER);
  ------------------
  |  Branch (4012:8): [True: 32, False: 7.61k]
  ------------------
 4013|       |
 4014|  7.61k|    if(flags & SPNG_DECODE_PROGRESSIVE)
  ------------------
  |  Branch (4014:8): [True: 7.61k, False: 0]
  ------------------
 4015|  7.61k|    {
 4016|  7.61k|        return 0;
 4017|  7.61k|    }
 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|  32.8k|{
 4902|  32.8k|    struct spng_alloc alloc =
 4903|  32.8k|    {
 4904|  32.8k|        .malloc_fn = malloc,
 4905|  32.8k|        .realloc_fn = realloc,
 4906|  32.8k|        .calloc_fn = calloc,
 4907|  32.8k|        .free_fn = free
 4908|  32.8k|    };
 4909|       |
 4910|  32.8k|    return spng_ctx_new2(&alloc, flags);
 4911|  32.8k|}
spng_ctx_new2:
 4914|  32.8k|{
 4915|  32.8k|    if(alloc == NULL) return NULL;
  ------------------
  |  Branch (4915:8): [True: 0, False: 32.8k]
  ------------------
 4916|  32.8k|    if(flags != (flags & SPNG__CTX_FLAGS_ALL)) return NULL;
  ------------------
  |  Branch (4916:8): [True: 0, False: 32.8k]
  ------------------
 4917|       |
 4918|  32.8k|    if(alloc->malloc_fn == NULL) return NULL;
  ------------------
  |  Branch (4918:8): [True: 0, False: 32.8k]
  ------------------
 4919|  32.8k|    if(alloc->realloc_fn == NULL) return NULL;
  ------------------
  |  Branch (4919:8): [True: 0, False: 32.8k]
  ------------------
 4920|  32.8k|    if(alloc->calloc_fn == NULL) return NULL;
  ------------------
  |  Branch (4920:8): [True: 0, False: 32.8k]
  ------------------
 4921|  32.8k|    if(alloc->free_fn == NULL) return NULL;
  ------------------
  |  Branch (4921:8): [True: 0, False: 32.8k]
  ------------------
 4922|       |
 4923|  32.8k|    spng_ctx *ctx = alloc->calloc_fn(1, sizeof(spng_ctx));
 4924|  32.8k|    if(ctx == NULL) return NULL;
  ------------------
  |  Branch (4924:8): [True: 0, False: 32.8k]
  ------------------
 4925|       |
 4926|  32.8k|    ctx->alloc = *alloc;
 4927|       |
 4928|  32.8k|    ctx->max_width = spng_u32max;
 4929|  32.8k|    ctx->max_height = spng_u32max;
 4930|       |
 4931|  32.8k|    ctx->max_chunk_size = spng_u32max;
 4932|  32.8k|    ctx->chunk_cache_limit = SIZE_MAX;
 4933|  32.8k|    ctx->chunk_count_limit = SPNG_MAX_CHUNK_COUNT;
  ------------------
  |  |   32|  32.8k|#define SPNG_MAX_CHUNK_COUNT (1000)
  ------------------
 4934|       |
 4935|  32.8k|    ctx->state = SPNG_STATE_INIT;
 4936|       |
 4937|  32.8k|    ctx->crc_action_critical = SPNG_CRC_ERROR;
 4938|  32.8k|    ctx->crc_action_ancillary = SPNG_CRC_DISCARD;
 4939|       |
 4940|  32.8k|    const struct spng__zlib_options image_defaults =
 4941|  32.8k|    {
 4942|  32.8k|        .compression_level = Z_DEFAULT_COMPRESSION,
  ------------------
  |  |  197|  32.8k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
 4943|  32.8k|        .window_bits = 15,
 4944|  32.8k|        .mem_level = 8,
 4945|  32.8k|        .strategy = Z_FILTERED,
  ------------------
  |  |  200|  32.8k|#define Z_FILTERED            1
  ------------------
 4946|  32.8k|        .data_type = 0 /* Z_BINARY */
 4947|  32.8k|    };
 4948|       |
 4949|  32.8k|    const struct spng__zlib_options text_defaults =
 4950|  32.8k|    {
 4951|  32.8k|        .compression_level = Z_DEFAULT_COMPRESSION,
  ------------------
  |  |  197|  32.8k|#define Z_DEFAULT_COMPRESSION  (-1)
  ------------------
 4952|  32.8k|        .window_bits = 15,
 4953|  32.8k|        .mem_level = 8,
 4954|  32.8k|        .strategy = Z_DEFAULT_STRATEGY,
  ------------------
  |  |  204|  32.8k|#define Z_DEFAULT_STRATEGY    0
  ------------------
 4955|  32.8k|        .data_type = 1 /* Z_TEXT */
 4956|  32.8k|    };
 4957|       |
 4958|  32.8k|    ctx->image_options = image_defaults;
 4959|  32.8k|    ctx->text_options = text_defaults;
 4960|       |
 4961|  32.8k|    ctx->optimize_option = ~0;
 4962|  32.8k|    ctx->encode_flags.filter_choice = SPNG_FILTER_CHOICE_ALL;
 4963|       |
 4964|  32.8k|    ctx->flags = flags;
 4965|       |
 4966|  32.8k|    if(flags & SPNG_CTX_ENCODER) ctx->encode_only = 1;
  ------------------
  |  Branch (4966:8): [True: 0, False: 32.8k]
  ------------------
 4967|       |
 4968|  32.8k|    return ctx;
 4969|  32.8k|}
spng_ctx_free:
 4972|  32.8k|{
 4973|  32.8k|    if(ctx == NULL) return;
  ------------------
  |  Branch (4973:8): [True: 0, False: 32.8k]
  ------------------
 4974|       |
 4975|  32.8k|    if(ctx->streaming && ctx->stream_buf != NULL) spng__free(ctx, ctx->stream_buf);
  ------------------
  |  Branch (4975:8): [True: 32.8k, False: 0]
  |  Branch (4975:26): [True: 32.8k, False: 0]
  ------------------
 4976|       |
 4977|  32.8k|    if(!ctx->user.exif) spng__free(ctx, ctx->exif.data);
  ------------------
  |  Branch (4977:8): [True: 32.8k, False: 0]
  ------------------
 4978|       |
 4979|  32.8k|    if(!ctx->user.iccp) spng__free(ctx, ctx->iccp.profile);
  ------------------
  |  Branch (4979:8): [True: 32.8k, False: 0]
  ------------------
 4980|       |
 4981|  32.8k|    uint32_t i;
 4982|       |
 4983|  32.8k|    if(ctx->splt_list != NULL && !ctx->user.splt)
  ------------------
  |  Branch (4983:8): [True: 2.37k, False: 30.4k]
  |  Branch (4983:34): [True: 2.37k, False: 0]
  ------------------
 4984|  2.37k|    {
 4985|  3.29k|        for(i=0; i < ctx->n_splt; i++)
  ------------------
  |  Branch (4985:18): [True: 924, False: 2.37k]
  ------------------
 4986|    924|        {
 4987|    924|            spng__free(ctx, ctx->splt_list[i].entries);
 4988|    924|        }
 4989|  2.37k|        spng__free(ctx, ctx->splt_list);
 4990|  2.37k|    }
 4991|       |
 4992|  32.8k|    if(ctx->text_list != NULL)
  ------------------
  |  Branch (4992:8): [True: 7.68k, False: 25.1k]
  ------------------
 4993|  7.68k|    {
 4994|  94.3k|        for(i=0; i< ctx->n_text; i++)
  ------------------
  |  Branch (4994:18): [True: 86.7k, False: 7.68k]
  ------------------
 4995|  86.7k|        {
 4996|  86.7k|            if(ctx->user.text) break;
  ------------------
  |  Branch (4996:16): [True: 0, False: 86.7k]
  ------------------
 4997|       |
 4998|  86.7k|            spng__free(ctx, ctx->text_list[i].keyword);
 4999|  86.7k|            if(ctx->text_list[i].compression_flag) spng__free(ctx, ctx->text_list[i].text);
  ------------------
  |  Branch (4999:16): [True: 79.6k, False: 7.04k]
  ------------------
 5000|  86.7k|        }
 5001|  7.68k|        spng__free(ctx, ctx->text_list);
 5002|  7.68k|    }
 5003|       |
 5004|  32.8k|    if(ctx->chunk_list != NULL && !ctx->user.unknown)
  ------------------
  |  Branch (5004:8): [True: 0, False: 32.8k]
  |  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|  32.8k|    if(ctx->deflate) deflateEnd(&ctx->zstream);
  ------------------
  |  |   53|  32.8k|#  define deflate               z_deflate
  ------------------
                  if(ctx->deflate) deflateEnd(&ctx->zstream);
  ------------------
  |  |   57|      0|#  define deflateEnd            z_deflateEnd
  ------------------
  |  Branch (5013:8): [True: 0, False: 32.8k]
  ------------------
 5014|  32.8k|    else inflateEnd(&ctx->zstream);
  ------------------
  |  |  121|  32.8k|#  define inflateEnd            z_inflateEnd
  ------------------
 5015|       |
 5016|  32.8k|    if(!ctx->user_owns_out_png) spng__free(ctx, ctx->out_png);
  ------------------
  |  Branch (5016:8): [True: 32.8k, 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|  32.8k|    spng__free(ctx, ctx->row_buf);
 5024|  32.8k|    spng__free(ctx, ctx->scanline_buf);
 5025|  32.8k|    spng__free(ctx, ctx->prev_scanline_buf);
 5026|  32.8k|    spng__free(ctx, ctx->filtered_scanline_buf);
 5027|       |
 5028|  32.8k|    spng_free_fn *free_fn = ctx->alloc.free_fn;
 5029|       |
 5030|  32.8k|    memset(ctx, 0, sizeof(spng_ctx));
 5031|       |
 5032|  32.8k|    free_fn(ctx);
 5033|  32.8k|}
spng_set_png_stream:
 5094|  32.8k|{
 5095|  32.8k|    if(ctx == NULL || rw_func == NULL) return 1;
  ------------------
  |  Branch (5095:8): [True: 0, False: 32.8k]
  |  Branch (5095:23): [True: 0, False: 32.8k]
  ------------------
 5096|  32.8k|    if(!ctx->state) return SPNG_EBADSTATE;
  ------------------
  |  Branch (5096:8): [True: 0, False: 32.8k]
  ------------------
 5097|       |
 5098|       |    /* SPNG_STATE_OUTPUT shares the same value */
 5099|  32.8k|    if(ctx->state >= SPNG_STATE_INPUT) return SPNG_EBUF_SET;
  ------------------
  |  Branch (5099:8): [True: 0, False: 32.8k]
  ------------------
 5100|       |
 5101|  32.8k|    if(ctx->encode_only)
  ------------------
  |  Branch (5101:8): [True: 0, False: 32.8k]
  ------------------
 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|  32.8k|    else
 5111|  32.8k|    {
 5112|  32.8k|        ctx->stream_buf = spng__malloc(ctx, SPNG_READ_SIZE);
  ------------------
  |  |   30|  32.8k|#define SPNG_READ_SIZE (8192)
  ------------------
 5113|  32.8k|        if(ctx->stream_buf == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (5113:12): [True: 0, False: 32.8k]
  ------------------
 5114|       |
 5115|  32.8k|        ctx->read_fn = rw_func;
 5116|  32.8k|        ctx->data = ctx->stream_buf;
 5117|  32.8k|        ctx->data_size = SPNG_READ_SIZE;
  ------------------
  |  |   30|  32.8k|#define SPNG_READ_SIZE (8192)
  ------------------
 5118|       |
 5119|  32.8k|        ctx->state = SPNG_STATE_INPUT;
 5120|  32.8k|    }
 5121|       |
 5122|  32.8k|    ctx->stream_user_ptr = user;
 5123|       |
 5124|  32.8k|    ctx->streaming = 1;
 5125|       |
 5126|  32.8k|    return 0;
 5127|  32.8k|}
spng_set_png_file:
 5130|  32.8k|{
 5131|  32.8k|    if(file == NULL) return 1;
  ------------------
  |  Branch (5131:8): [True: 0, False: 32.8k]
  ------------------
 5132|       |
 5133|  32.8k|    if(ctx->encode_only) return spng_set_png_stream(ctx, file_write_fn, file);
  ------------------
  |  Branch (5133:8): [True: 0, False: 32.8k]
  ------------------
 5134|       |
 5135|  32.8k|    return spng_set_png_stream(ctx, file_read_fn, file);
 5136|  32.8k|}
spng_get_ihdr:
 5399|  32.8k|{
 5400|  32.8k|    if(ctx == NULL) return 1;
  ------------------
  |  Branch (5400:8): [True: 0, False: 32.8k]
  ------------------
 5401|  32.8k|    int ret = read_chunks(ctx, 1);
 5402|  32.8k|    if(ret) return ret;
  ------------------
  |  Branch (5402:8): [True: 1.33k, False: 31.4k]
  ------------------
 5403|  31.4k|    if(ihdr == NULL) return 1;
  ------------------
  |  Branch (5403:8): [True: 0, False: 31.4k]
  ------------------
 5404|       |
 5405|  31.4k|    *ihdr = ctx->ihdr;
 5406|       |
 5407|  31.4k|    return 0;
 5408|  31.4k|}
spng_get_plte:
 5411|    700|{
 5412|  1.56k|    SPNG_GET_CHUNK_BOILERPLATE(plte);
  ------------------
  |  |  119|    700|    if(ctx == NULL) return 1; \
  |  |  ------------------
  |  |  |  Branch (119:8): [True: 0, False: 700]
  |  |  ------------------
  |  |  120|    700|    int ret = read_chunks(ctx, 0); \
  |  |  121|    700|    if(ret) return ret; \
  |  |  ------------------
  |  |  |  Branch (121:8): [True: 266, False: 434]
  |  |  ------------------
  |  |  122|    700|    if(!ctx->stored.chunk) return SPNG_ECHUNKAVAIL; \
  |  |  ------------------
  |  |  |  Branch (122:8): [True: 0, False: 434]
  |  |  ------------------
  |  |  123|    434|    if(chunk == NULL) return 1
  |  |  ------------------
  |  |  |  Branch (123:8): [True: 0, False: 434]
  |  |  ------------------
  ------------------
 5413|       |
 5414|    434|    *plte = ctx->plte;
 5415|       |
 5416|    434|    return 0;
 5417|  1.56k|}
spng_get_iccp:
 5474|  7.61k|{
 5475|  15.2k|    SPNG_GET_CHUNK_BOILERPLATE(iccp);
  ------------------
  |  |  119|  7.61k|    if(ctx == NULL) return 1; \
  |  |  ------------------
  |  |  |  Branch (119:8): [True: 0, False: 7.61k]
  |  |  ------------------
  |  |  120|  7.61k|    int ret = read_chunks(ctx, 0); \
  |  |  121|  7.61k|    if(ret) return ret; \
  |  |  ------------------
  |  |  |  Branch (121:8): [True: 0, False: 7.61k]
  |  |  ------------------
  |  |  122|  7.61k|    if(!ctx->stored.chunk) return SPNG_ECHUNKAVAIL; \
  |  |  ------------------
  |  |  |  Branch (122:8): [True: 7.61k, False: 7]
  |  |  ------------------
  |  |  123|  7.61k|    if(chunk == NULL) return 1
  |  |  ------------------
  |  |  |  Branch (123:8): [True: 0, False: 7]
  |  |  ------------------
  ------------------
 5476|       |
 5477|      7|    *iccp = ctx->iccp;
 5478|       |
 5479|      7|    return 0;
 5480|  15.2k|}
spng_strerror:
 6067|  16.4k|{
 6068|  16.4k|    switch(err)
 6069|  16.4k|    {
 6070|  10.9k|        case SPNG_IO_EOF: return "end of stream";
  ------------------
  |  Branch (6070:9): [True: 10.9k, False: 5.48k]
  ------------------
 6071|      0|        case SPNG_IO_ERROR: return "stream error";
  ------------------
  |  Branch (6071:9): [True: 0, False: 16.4k]
  ------------------
 6072|      0|        case SPNG_OK: return "success";
  ------------------
  |  Branch (6072:9): [True: 0, False: 16.4k]
  ------------------
 6073|      0|        case SPNG_EINVAL: return "invalid argument";
  ------------------
  |  Branch (6073:9): [True: 0, False: 16.4k]
  ------------------
 6074|      0|        case SPNG_EMEM: return "out of memory";
  ------------------
  |  Branch (6074:9): [True: 0, False: 16.4k]
  ------------------
 6075|     70|        case SPNG_EOVERFLOW: return "arithmetic overflow";
  ------------------
  |  Branch (6075:9): [True: 70, False: 16.4k]
  ------------------
 6076|    168|        case SPNG_ESIGNATURE: return "invalid signature";
  ------------------
  |  Branch (6076:9): [True: 168, False: 16.3k]
  ------------------
 6077|    224|        case SPNG_EWIDTH: return "invalid image width";
  ------------------
  |  Branch (6077:9): [True: 224, False: 16.2k]
  ------------------
 6078|    224|        case SPNG_EHEIGHT: return "invalid image height";
  ------------------
  |  Branch (6078:9): [True: 224, False: 16.2k]
  ------------------
 6079|      0|        case SPNG_EUSER_WIDTH: return "image width exceeds user limit";
  ------------------
  |  Branch (6079:9): [True: 0, False: 16.4k]
  ------------------
 6080|      0|        case SPNG_EUSER_HEIGHT: return "image height exceeds user limit";
  ------------------
  |  Branch (6080:9): [True: 0, False: 16.4k]
  ------------------
 6081|    217|        case SPNG_EBIT_DEPTH: return "invalid bit depth";
  ------------------
  |  Branch (6081:9): [True: 217, False: 16.2k]
  ------------------
 6082|     28|        case SPNG_ECOLOR_TYPE: return "invalid color type";
  ------------------
  |  Branch (6082:9): [True: 28, False: 16.4k]
  ------------------
 6083|     21|        case SPNG_ECOMPRESSION_METHOD: return "invalid compression method";
  ------------------
  |  Branch (6083:9): [True: 21, False: 16.4k]
  ------------------
 6084|     35|        case SPNG_EFILTER_METHOD: return "invalid filter method";
  ------------------
  |  Branch (6084:9): [True: 35, False: 16.4k]
  ------------------
 6085|     21|        case SPNG_EINTERLACE_METHOD: return "invalid interlace method";
  ------------------
  |  Branch (6085:9): [True: 21, False: 16.4k]
  ------------------
 6086|    266|        case SPNG_EIHDR_SIZE: return "invalid IHDR chunk size";
  ------------------
  |  Branch (6086:9): [True: 266, False: 16.2k]
  ------------------
 6087|     42|        case SPNG_ENOIHDR: return "missing IHDR chunk";
  ------------------
  |  Branch (6087:9): [True: 42, False: 16.4k]
  ------------------
 6088|     34|        case SPNG_ECHUNK_POS: return "invalid chunk position";
  ------------------
  |  Branch (6088:9): [True: 34, False: 16.4k]
  ------------------
 6089|     43|        case SPNG_ECHUNK_SIZE: return "invalid chunk length";
  ------------------
  |  Branch (6089:9): [True: 43, False: 16.4k]
  ------------------
 6090|    873|        case SPNG_ECHUNK_CRC: return "invalid chunk checksum";
  ------------------
  |  Branch (6090:9): [True: 873, False: 15.6k]
  ------------------
 6091|      0|        case SPNG_ECHUNK_TYPE: return "invalid chunk type";
  ------------------
  |  Branch (6091:9): [True: 0, False: 16.4k]
  ------------------
 6092|    591|        case SPNG_ECHUNK_UNKNOWN_CRITICAL: return "unknown critical chunk";
  ------------------
  |  Branch (6092:9): [True: 591, False: 15.8k]
  ------------------
 6093|      0|        case SPNG_EDUP_PLTE: return "duplicate PLTE chunk";
  ------------------
  |  Branch (6093:9): [True: 0, False: 16.4k]
  ------------------
 6094|      0|        case SPNG_EDUP_CHRM: return "duplicate cHRM chunk";
  ------------------
  |  Branch (6094:9): [True: 0, False: 16.4k]
  ------------------
 6095|      0|        case SPNG_EDUP_GAMA: return "duplicate gAMA chunk";
  ------------------
  |  Branch (6095:9): [True: 0, False: 16.4k]
  ------------------
 6096|      0|        case SPNG_EDUP_ICCP: return "duplicate iCCP chunk";
  ------------------
  |  Branch (6096:9): [True: 0, False: 16.4k]
  ------------------
 6097|      0|        case SPNG_EDUP_SBIT: return "duplicate sBIT chunk";
  ------------------
  |  Branch (6097:9): [True: 0, False: 16.4k]
  ------------------
 6098|      0|        case SPNG_EDUP_SRGB: return "duplicate sRGB chunk";
  ------------------
  |  Branch (6098:9): [True: 0, False: 16.4k]
  ------------------
 6099|      0|        case SPNG_EDUP_BKGD: return "duplicate bKGD chunk";
  ------------------
  |  Branch (6099:9): [True: 0, False: 16.4k]
  ------------------
 6100|      0|        case SPNG_EDUP_HIST: return "duplicate hIST chunk";
  ------------------
  |  Branch (6100:9): [True: 0, False: 16.4k]
  ------------------
 6101|      0|        case SPNG_EDUP_TRNS: return "duplicate tRNS chunk";
  ------------------
  |  Branch (6101:9): [True: 0, False: 16.4k]
  ------------------
 6102|      0|        case SPNG_EDUP_PHYS: return "duplicate pHYs chunk";
  ------------------
  |  Branch (6102:9): [True: 0, False: 16.4k]
  ------------------
 6103|      0|        case SPNG_EDUP_TIME: return "duplicate tIME chunk";
  ------------------
  |  Branch (6103:9): [True: 0, False: 16.4k]
  ------------------
 6104|      0|        case SPNG_EDUP_OFFS: return "duplicate oFFs chunk";
  ------------------
  |  Branch (6104:9): [True: 0, False: 16.4k]
  ------------------
 6105|      0|        case SPNG_EDUP_EXIF: return "duplicate eXIf chunk";
  ------------------
  |  Branch (6105:9): [True: 0, False: 16.4k]
  ------------------
 6106|      0|        case SPNG_ECHRM: return "invalid cHRM chunk";
  ------------------
  |  Branch (6106:9): [True: 0, False: 16.4k]
  ------------------
 6107|      0|        case SPNG_EPLTE_IDX: return "invalid palette (PLTE) index";
  ------------------
  |  Branch (6107:9): [True: 0, False: 16.4k]
  ------------------
 6108|      0|        case SPNG_ETRNS_COLOR_TYPE: return "tRNS chunk with incompatible color type";
  ------------------
  |  Branch (6108:9): [True: 0, False: 16.4k]
  ------------------
 6109|      0|        case SPNG_ETRNS_NO_PLTE: return "missing palette (PLTE) for tRNS chunk";
  ------------------
  |  Branch (6109:9): [True: 0, False: 16.4k]
  ------------------
 6110|      0|        case SPNG_EGAMA: return "invalid gAMA chunk";
  ------------------
  |  Branch (6110:9): [True: 0, False: 16.4k]
  ------------------
 6111|      0|        case SPNG_EICCP_NAME: return "invalid iCCP profile name";
  ------------------
  |  Branch (6111:9): [True: 0, False: 16.4k]
  ------------------
 6112|      0|        case SPNG_EICCP_COMPRESSION_METHOD: return "invalid iCCP compression method";
  ------------------
  |  Branch (6112:9): [True: 0, False: 16.4k]
  ------------------
 6113|      0|        case SPNG_ESBIT: return "invalid sBIT chunk";
  ------------------
  |  Branch (6113:9): [True: 0, False: 16.4k]
  ------------------
 6114|      0|        case SPNG_ESRGB: return "invalid sRGB chunk";
  ------------------
  |  Branch (6114:9): [True: 0, False: 16.4k]
  ------------------
 6115|      0|        case SPNG_ETEXT: return "invalid tEXt chunk";
  ------------------
  |  Branch (6115:9): [True: 0, False: 16.4k]
  ------------------
 6116|      0|        case SPNG_ETEXT_KEYWORD: return "invalid tEXt keyword";
  ------------------
  |  Branch (6116:9): [True: 0, False: 16.4k]
  ------------------
 6117|      0|        case SPNG_EZTXT: return "invalid zTXt chunk";
  ------------------
  |  Branch (6117:9): [True: 0, False: 16.4k]
  ------------------
 6118|      0|        case SPNG_EZTXT_COMPRESSION_METHOD: return "invalid zTXt compression method";
  ------------------
  |  Branch (6118:9): [True: 0, False: 16.4k]
  ------------------
 6119|      0|        case SPNG_EITXT: return "invalid iTXt chunk";
  ------------------
  |  Branch (6119:9): [True: 0, False: 16.4k]
  ------------------
 6120|      0|        case SPNG_EITXT_COMPRESSION_FLAG: return "invalid iTXt compression flag";
  ------------------
  |  Branch (6120:9): [True: 0, False: 16.4k]
  ------------------
 6121|      0|        case SPNG_EITXT_COMPRESSION_METHOD: return "invalid iTXt compression method";
  ------------------
  |  Branch (6121:9): [True: 0, False: 16.4k]
  ------------------
 6122|      0|        case SPNG_EITXT_LANG_TAG: return "invalid iTXt language tag";
  ------------------
  |  Branch (6122:9): [True: 0, False: 16.4k]
  ------------------
 6123|      0|        case SPNG_EITXT_TRANSLATED_KEY: return "invalid iTXt translated key";
  ------------------
  |  Branch (6123:9): [True: 0, False: 16.4k]
  ------------------
 6124|      0|        case SPNG_EBKGD_NO_PLTE: return "missing palette for bKGD chunk";
  ------------------
  |  Branch (6124:9): [True: 0, False: 16.4k]
  ------------------
 6125|      0|        case SPNG_EBKGD_PLTE_IDX: return "invalid palette index for bKGD chunk";
  ------------------
  |  Branch (6125:9): [True: 0, False: 16.4k]
  ------------------
 6126|      0|        case SPNG_EHIST_NO_PLTE: return "missing palette for hIST chunk";
  ------------------
  |  Branch (6126:9): [True: 0, False: 16.4k]
  ------------------
 6127|      0|        case SPNG_EPHYS: return "invalid pHYs chunk";
  ------------------
  |  Branch (6127:9): [True: 0, False: 16.4k]
  ------------------
 6128|      0|        case SPNG_ESPLT_NAME: return "invalid suggested palette name";
  ------------------
  |  Branch (6128:9): [True: 0, False: 16.4k]
  ------------------
 6129|      0|        case SPNG_ESPLT_DUP_NAME: return "duplicate suggested palette (sPLT) name";
  ------------------
  |  Branch (6129:9): [True: 0, False: 16.4k]
  ------------------
 6130|      0|        case SPNG_ESPLT_DEPTH: return "invalid suggested palette (sPLT) sample depth";
  ------------------
  |  Branch (6130:9): [True: 0, False: 16.4k]
  ------------------
 6131|      0|        case SPNG_ETIME: return "invalid tIME chunk";
  ------------------
  |  Branch (6131:9): [True: 0, False: 16.4k]
  ------------------
 6132|      0|        case SPNG_EOFFS: return "invalid oFFs chunk";
  ------------------
  |  Branch (6132:9): [True: 0, False: 16.4k]
  ------------------
 6133|      0|        case SPNG_EEXIF: return "invalid eXIf chunk";
  ------------------
  |  Branch (6133:9): [True: 0, False: 16.4k]
  ------------------
 6134|    128|        case SPNG_EIDAT_TOO_SHORT: return "IDAT stream too short";
  ------------------
  |  Branch (6134:9): [True: 128, False: 16.3k]
  ------------------
 6135|  1.81k|        case SPNG_EIDAT_STREAM: return "IDAT stream error";
  ------------------
  |  Branch (6135:9): [True: 1.81k, False: 14.6k]
  ------------------
 6136|      0|        case SPNG_EZLIB: return "zlib error";
  ------------------
  |  Branch (6136:9): [True: 0, False: 16.4k]
  ------------------
 6137|    490|        case SPNG_EFILTER: return "invalid scanline filter";
  ------------------
  |  Branch (6137:9): [True: 490, False: 15.9k]
  ------------------
 6138|      0|        case SPNG_EBUFSIZ: return "invalid buffer size";
  ------------------
  |  Branch (6138:9): [True: 0, False: 16.4k]
  ------------------
 6139|      0|        case SPNG_EIO: return "i/o error";
  ------------------
  |  Branch (6139:9): [True: 0, False: 16.4k]
  ------------------
 6140|      0|        case SPNG_EOF: return "end of file";
  ------------------
  |  Branch (6140:9): [True: 0, False: 16.4k]
  ------------------
 6141|      0|        case SPNG_EBUF_SET: return "buffer already set";
  ------------------
  |  Branch (6141:9): [True: 0, False: 16.4k]
  ------------------
 6142|      0|        case SPNG_EBADSTATE: return "non-recoverable state";
  ------------------
  |  Branch (6142:9): [True: 0, False: 16.4k]
  ------------------
 6143|      0|        case SPNG_EFMT: return "invalid format";
  ------------------
  |  Branch (6143:9): [True: 0, False: 16.4k]
  ------------------
 6144|      0|        case SPNG_EFLAGS: return "invalid flags";
  ------------------
  |  Branch (6144:9): [True: 0, False: 16.4k]
  ------------------
 6145|      0|        case SPNG_ECHUNKAVAIL: return "chunk not available";
  ------------------
  |  Branch (6145:9): [True: 0, False: 16.4k]
  ------------------
 6146|      0|        case SPNG_ENCODE_ONLY: return "encode only context";
  ------------------
  |  Branch (6146:9): [True: 0, False: 16.4k]
  ------------------
 6147|      0|        case SPNG_EOI: return "reached end-of-image state";
  ------------------
  |  Branch (6147:9): [True: 0, False: 16.4k]
  ------------------
 6148|      0|        case SPNG_ENOPLTE: return "missing PLTE for indexed image";
  ------------------
  |  Branch (6148:9): [True: 0, False: 16.4k]
  ------------------
 6149|      6|        case SPNG_ECHUNK_LIMITS: return "reached chunk/cache limits";
  ------------------
  |  Branch (6149:9): [True: 6, False: 16.4k]
  ------------------
 6150|      0|        case SPNG_EZLIB_INIT: return "zlib init error";
  ------------------
  |  Branch (6150:9): [True: 0, False: 16.4k]
  ------------------
 6151|    189|        case SPNG_ECHUNK_STDLEN: return "chunk exceeds maximum standard length";
  ------------------
  |  Branch (6151:9): [True: 189, False: 16.2k]
  ------------------
 6152|      0|        case SPNG_EINTERNAL: return "internal error";
  ------------------
  |  Branch (6152:9): [True: 0, False: 16.4k]
  ------------------
 6153|      0|        case SPNG_ECTXTYPE: return "invalid operation for context type";
  ------------------
  |  Branch (6153:9): [True: 0, False: 16.4k]
  ------------------
 6154|      0|        case SPNG_ENOSRC: return "source PNG not set";
  ------------------
  |  Branch (6154:9): [True: 0, False: 16.4k]
  ------------------
 6155|      0|        case SPNG_ENODST: return "PNG output not set";
  ------------------
  |  Branch (6155:9): [True: 0, False: 16.4k]
  ------------------
 6156|      0|        case SPNG_EOPSTATE: return "invalid operation for state";
  ------------------
  |  Branch (6156:9): [True: 0, False: 16.4k]
  ------------------
 6157|      0|        case SPNG_ENOTFINAL: return "PNG not finalized";
  ------------------
  |  Branch (6157:9): [True: 0, False: 16.4k]
  ------------------
 6158|      0|        default: return "unknown error";
  ------------------
  |  Branch (6158:9): [True: 0, False: 16.4k]
  ------------------
 6159|  16.4k|    }
 6160|  16.4k|}
spng.c:spng__iter_init:
  494|   729k|{
  495|   729k|    struct spng__iter iter =
  496|   729k|    {
  497|   729k|        .mask = (uint32_t)(1 << bit_depth) - 1,
  498|   729k|        .shift_amount = 8 - bit_depth,
  499|   729k|        .initial_shift = 8 - bit_depth,
  500|   729k|        .bit_depth = bit_depth,
  501|   729k|        .samples = samples
  502|   729k|    };
  503|       |
  504|   729k|    return iter;
  505|   729k|}
spng.c:read_scanline:
 3229|   729k|{
 3230|   729k|    int ret, pass = ctx->row_info.pass;
 3231|   729k|    struct spng_row_info *ri = &ctx->row_info;
 3232|   729k|    const struct spng_subimage *sub = ctx->subimage;
 3233|   729k|    size_t scanline_width = sub[pass].scanline_width;
 3234|   729k|    uint32_t scanline_idx = ri->scanline_idx;
 3235|       |
 3236|   729k|    uint8_t next_filter = 0;
 3237|       |
 3238|   729k|    if(scanline_idx == (sub[pass].height - 1) && ri->pass == ctx->last_pass)
  ------------------
  |  Branch (3238:8): [True: 10.6k, False: 719k]
  |  Branch (3238:50): [True: 2.76k, False: 7.89k]
  ------------------
 3239|  2.76k|    {
 3240|  2.76k|        ret = read_scanline_bytes(ctx, ctx->scanline, scanline_width - 1);
 3241|  2.76k|    }
 3242|   727k|    else
 3243|   727k|    {
 3244|   727k|        ret = read_scanline_bytes(ctx, ctx->scanline, scanline_width);
 3245|   727k|        if(ret) return ret;
  ------------------
  |  Branch (3245:12): [True: 2.98k, False: 724k]
  ------------------
 3246|       |
 3247|   724k|        next_filter = ctx->scanline[scanline_width - 1];
 3248|   724k|        if(next_filter > 4) ret = SPNG_EFILTER;
  ------------------
  |  Branch (3248:12): [True: 458, False: 723k]
  ------------------
 3249|   724k|    }
 3250|       |
 3251|   726k|    if(ret) return ret;
  ------------------
  |  Branch (3251:8): [True: 676, False: 726k]
  ------------------
 3252|       |
 3253|   726k|    if(!scanline_idx && ri->filter > 1)
  ------------------
  |  Branch (3253:8): [True: 14.8k, False: 711k]
  |  Branch (3253:25): [True: 3.66k, False: 11.2k]
  ------------------
 3254|  3.66k|    {
 3255|       |        /* prev_scanline is all zeros for the first scanline */
 3256|  3.66k|        memset(ctx->prev_scanline, 0, scanline_width);
 3257|  3.66k|    }
 3258|       |
 3259|   726k|    if(ctx->ihdr.bit_depth == 16 && ctx->fmt != SPNG_FMT_RAW) u16_row_to_host(ctx->scanline, scanline_width - 1);
  ------------------
  |  Branch (3259:8): [True: 294k, False: 431k]
  |  Branch (3259:37): [True: 294k, False: 0]
  ------------------
 3260|       |
 3261|   726k|    ret = defilter_scanline(ctx->prev_scanline, ctx->scanline, scanline_width, ctx->bytes_per_pixel, ri->filter);
 3262|   726k|    if(ret) return ret;
  ------------------
  |  Branch (3262:8): [True: 0, False: 726k]
  ------------------
 3263|       |
 3264|   726k|    ri->filter = next_filter;
 3265|       |
 3266|   726k|    return 0;
 3267|   726k|}
spng.c:u16_row_to_host:
  524|   294k|{
  525|   294k|    uint16_t *px = row;
  526|   294k|    size_t i, n = size / 2;
  527|       |
  528|  29.6M|    for(i=0; i < n; i++)
  ------------------
  |  Branch (528:14): [True: 29.3M, False: 294k]
  ------------------
  529|  29.3M|    {
  530|  29.3M|        px[i] = read_u16(&px[i]);
  531|  29.3M|    }
  532|   294k|}
spng.c:defilter_scanline:
 1463|   726k|{
 1464|   726k|    if(prev_scanline == NULL || scanline == NULL || !scanline_width) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1464:8): [True: 0, False: 726k]
  |  Branch (1464:33): [True: 0, False: 726k]
  |  Branch (1464:53): [True: 0, False: 726k]
  ------------------
 1465|       |
 1466|   726k|    size_t i;
 1467|   726k|    scanline_width--;
 1468|       |
 1469|   726k|    if(filter == 0) return 0;
  ------------------
  |  Branch (1469:8): [True: 439k, False: 286k]
  ------------------
 1470|       |
 1471|   286k|#ifndef SPNG_DISABLE_OPT
 1472|   286k|    if(filter == SPNG_FILTER_UP) goto no_opt;
  ------------------
  |  Branch (1472:8): [True: 100k, False: 185k]
  ------------------
 1473|       |
 1474|   185k|    if(bytes_per_pixel == 4)
  ------------------
  |  Branch (1474:8): [True: 9.61k, False: 176k]
  ------------------
 1475|  9.61k|    {
 1476|  9.61k|        if(filter == SPNG_FILTER_SUB)
  ------------------
  |  Branch (1476:12): [True: 1.56k, False: 8.04k]
  ------------------
 1477|  1.56k|            defilter_sub4(scanline_width, scanline);
 1478|  8.04k|        else if(filter == SPNG_FILTER_AVERAGE)
  ------------------
  |  Branch (1478:17): [True: 1.00k, False: 7.04k]
  ------------------
 1479|  1.00k|            defilter_avg4(scanline_width, scanline, prev_scanline);
 1480|  7.04k|        else if(filter == SPNG_FILTER_PAETH)
  ------------------
  |  Branch (1480:17): [True: 7.04k, False: 0]
  ------------------
 1481|  7.04k|            defilter_paeth4(scanline_width, scanline, prev_scanline);
 1482|      0|        else return SPNG_EFILTER;
 1483|       |
 1484|  9.61k|        return 0;
 1485|  9.61k|    }
 1486|   176k|    else if(bytes_per_pixel == 3)
  ------------------
  |  Branch (1486:13): [True: 121k, False: 55.1k]
  ------------------
 1487|   121k|    {
 1488|   121k|        if(filter == SPNG_FILTER_SUB)
  ------------------
  |  Branch (1488:12): [True: 5.02k, False: 115k]
  ------------------
 1489|  5.02k|            defilter_sub3(scanline_width, scanline);
 1490|   115k|        else if(filter == SPNG_FILTER_AVERAGE)
  ------------------
  |  Branch (1490:17): [True: 678, False: 115k]
  ------------------
 1491|    678|            defilter_avg3(scanline_width, scanline, prev_scanline);
 1492|   115k|        else if(filter == SPNG_FILTER_PAETH)
  ------------------
  |  Branch (1492:17): [True: 115k, False: 0]
  ------------------
 1493|   115k|            defilter_paeth3(scanline_width, scanline, prev_scanline);
 1494|      0|        else return SPNG_EFILTER;
 1495|       |
 1496|   121k|        return 0;
 1497|   121k|    }
 1498|   156k|no_opt:
 1499|   156k|#endif
 1500|       |
 1501|   156k|    if(filter == SPNG_FILTER_UP)
  ------------------
  |  Branch (1501:8): [True: 100k, False: 55.1k]
  ------------------
 1502|   100k|    {
 1503|   100k|        defilter_up(scanline_width, scanline, prev_scanline);
 1504|   100k|        return 0;
 1505|   100k|    }
 1506|       |
 1507|  9.40M|    for(i=0; i < scanline_width; i++)
  ------------------
  |  Branch (1507:14): [True: 9.35M, False: 55.1k]
  ------------------
 1508|  9.35M|    {
 1509|  9.35M|        uint8_t x, a, b, c;
 1510|       |
 1511|  9.35M|        if(i >= bytes_per_pixel)
  ------------------
  |  Branch (1511:12): [True: 9.13M, False: 223k]
  ------------------
 1512|  9.13M|        {
 1513|  9.13M|            a = scanline[i - bytes_per_pixel];
 1514|  9.13M|            b = prev_scanline[i];
 1515|  9.13M|            c = prev_scanline[i - bytes_per_pixel];
 1516|  9.13M|        }
 1517|   223k|        else /* First pixel in row */
 1518|   223k|        {
 1519|   223k|            a = 0;
 1520|   223k|            b = prev_scanline[i];
 1521|   223k|            c = 0;
 1522|   223k|        }
 1523|       |
 1524|  9.35M|        x = scanline[i];
 1525|       |
 1526|  9.35M|        switch(filter)
  ------------------
  |  Branch (1526:16): [True: 9.35M, False: 0]
  ------------------
 1527|  9.35M|        {
 1528|  2.44M|            case SPNG_FILTER_SUB:
  ------------------
  |  Branch (1528:13): [True: 2.44M, False: 6.90M]
  ------------------
 1529|  2.44M|            {
 1530|  2.44M|                x = x + a;
 1531|  2.44M|                break;
 1532|      0|            }
 1533|   534k|            case SPNG_FILTER_AVERAGE:
  ------------------
  |  Branch (1533:13): [True: 534k, False: 8.81M]
  ------------------
 1534|   534k|            {
 1535|   534k|                uint16_t avg = (a + b) / 2;
 1536|   534k|                x = x + avg;
 1537|   534k|                break;
 1538|      0|            }
 1539|  6.37M|            case SPNG_FILTER_PAETH:
  ------------------
  |  Branch (1539:13): [True: 6.37M, False: 2.98M]
  ------------------
 1540|  6.37M|            {
 1541|  6.37M|                x = x + paeth(a,b,c);
 1542|  6.37M|                break;
 1543|      0|            }
 1544|  9.35M|        }
 1545|       |
 1546|  9.35M|        scanline[i] = x;
 1547|  9.35M|    }
 1548|       |
 1549|  55.1k|    return 0;
 1550|  55.1k|}
spng.c:defilter_sub4:
 6300|  1.56k|{
 6301|       |    /* The Sub filter predicts each pixel as the previous pixel, a.
 6302|       |     * There is no pixel to the left of the first pixel.  It's encoded directly.
 6303|       |     * That works with our main loop if we just say that left pixel was zero.
 6304|       |     */
 6305|  1.56k|    size_t rb = rowbytes+4;
 6306|       |
 6307|  1.56k|    __m128i a, d = _mm_setzero_si128();
 6308|       |
 6309|   147k|    while(rb > 4)
  ------------------
  |  Branch (6309:11): [True: 146k, False: 1.56k]
  ------------------
 6310|   146k|    {
 6311|   146k|        a = d; d = load4(row);
 6312|   146k|        d = _mm_add_epi8(d, a);
 6313|   146k|        store4(row, d);
 6314|       |
 6315|   146k|        row += 4;
 6316|   146k|        rb  -= 4;
 6317|   146k|    }
 6318|  1.56k|}
spng.c:load4:
 6246|  20.9M|{
 6247|  20.9M|    int tmp;
 6248|  20.9M|    memcpy(&tmp, p, sizeof(tmp));
 6249|  20.9M|    return _mm_cvtsi32_si128(tmp);
 6250|  20.9M|}
spng.c:store4:
 6253|   859k|{
 6254|   859k|    int tmp = _mm_cvtsi128_si32(v);
 6255|   859k|    memcpy(p, &tmp, sizeof(int));
 6256|   859k|}
spng.c:defilter_avg4:
 6372|  1.00k|{
 6373|       |    /* The Avg filter predicts each pixel as the (truncated) average of a and b.
 6374|       |     * There's no pixel to the left of the first pixel.  Luckily, it's
 6375|       |     * predicted to be half of the pixel above it.  So again, this works
 6376|       |     * perfectly with our loop if we make sure a starts at zero.
 6377|       |     */
 6378|  1.00k|    size_t rb = rowbytes+4;
 6379|       |
 6380|  1.00k|    const __m128i zero = _mm_setzero_si128();
 6381|  1.00k|    __m128i    b;
 6382|  1.00k|    __m128i a, d = zero;
 6383|       |
 6384|  52.8k|    while(rb > 4)
  ------------------
  |  Branch (6384:11): [True: 51.8k, False: 1.00k]
  ------------------
 6385|  51.8k|    {
 6386|  51.8k|        __m128i avg;
 6387|  51.8k|               b = load4(prev);
 6388|  51.8k|        a = d; d = load4(row );
 6389|       |
 6390|       |        /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
 6391|  51.8k|        avg = _mm_avg_epu8(a,b);
 6392|       |        /* ...but we can fix it up by subtracting off 1 if it rounded up. */
 6393|  51.8k|        avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a, b),
 6394|  51.8k|                                            _mm_set1_epi8(1)));
 6395|       |
 6396|  51.8k|        d = _mm_add_epi8(d, avg);
 6397|  51.8k|        store4(row, d);
 6398|       |
 6399|  51.8k|        prev += 4;
 6400|  51.8k|        row  += 4;
 6401|  51.8k|        rb   -= 4;
 6402|  51.8k|    }
 6403|  1.00k|}
spng.c:defilter_paeth4:
 6531|  7.04k|{
 6532|       |    /* Paeth tries to predict pixel d using the pixel to the left of it, a,
 6533|       |     * and two pixels from the previous row, b and c:
 6534|       |     *   prev: c b
 6535|       |     *   row:  a d
 6536|       |     * The Paeth function predicts d to be whichever of a, b, or c is nearest to
 6537|       |     * p=a+b-c.
 6538|       |     *
 6539|       |     * The first pixel has no left context, and so uses an Up filter, p = b.
 6540|       |     * This works naturally with our main loop's p = a+b-c if we force a and c
 6541|       |     * to zero.
 6542|       |     * Here we zero b and d, which become c and a respectively at the start of
 6543|       |     * the loop.
 6544|       |     */
 6545|  7.04k|    size_t rb = rowbytes+4;
 6546|       |
 6547|  7.04k|    const __m128i zero = _mm_setzero_si128();
 6548|  7.04k|    __m128i pa, pb, pc, smallest, nearest;
 6549|  7.04k|    __m128i c, b = zero,
 6550|  7.04k|            a, d = zero;
 6551|       |
 6552|   668k|    while(rb > 4)
  ------------------
  |  Branch (6552:11): [True: 660k, False: 7.04k]
  ------------------
 6553|   660k|    {
 6554|       |        /* It's easiest to do this math (particularly, deal with pc) with 16-bit
 6555|       |         * intermediates.
 6556|       |         */
 6557|   660k|        c = b; b = _mm_unpacklo_epi8(load4(prev), zero);
 6558|   660k|        a = d; d = _mm_unpacklo_epi8(load4(row ), zero);
 6559|       |
 6560|       |        /* (p-a) == (a+b-c - a) == (b-c) */
 6561|   660k|        pa = _mm_sub_epi16(b, c);
 6562|       |
 6563|       |        /* (p-b) == (a+b-c - b) == (a-c) */
 6564|   660k|        pb = _mm_sub_epi16(a, c);
 6565|       |
 6566|       |        /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
 6567|   660k|        pc = _mm_add_epi16(pa, pb);
 6568|       |
 6569|   660k|        pa = abs_i16(pa);  /* |p-a| */
 6570|   660k|        pb = abs_i16(pb);  /* |p-b| */
 6571|   660k|        pc = abs_i16(pc);  /* |p-c| */
 6572|       |
 6573|   660k|        smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
 6574|       |
 6575|       |        /* Paeth breaks ties favoring a over b over c. */
 6576|   660k|        nearest  = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
 6577|   660k|                            if_then_else(_mm_cmpeq_epi16(smallest, pb), b, c));
 6578|       |
 6579|       |        /* Note `_epi8`: we need addition to wrap modulo 255. */
 6580|   660k|        d = _mm_add_epi8(d, nearest);
 6581|   660k|        store4(row, _mm_packus_epi16(d, d));
 6582|       |
 6583|   660k|        prev += 4;
 6584|   660k|        row  += 4;
 6585|   660k|        rb   -= 4;
 6586|   660k|    }
 6587|  7.04k|}
spng.c:abs_i16:
 6410|  30.5M|{
 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|  30.5M|    __m128i is_negative = _mm_cmplt_epi16(x, _mm_setzero_si128());
 6418|       |
 6419|       |    /* Flip negative lanes. */
 6420|  30.5M|    x = _mm_xor_si128(x, is_negative);
 6421|       |
 6422|       |    /* +1 to negative lanes, else +0. */
 6423|  30.5M|    x = _mm_sub_epi16(x, is_negative);
 6424|  30.5M|    return x;
 6425|  30.5M|#endif
 6426|  30.5M|}
spng.c:if_then_else:
 6430|  20.3M|{
 6431|       |#if defined(__SSE4_1__) || defined(__AVX__)
 6432|       |    return _mm_blendv_epi8(e, t, c);
 6433|       |#else
 6434|  20.3M|    return _mm_or_si128(_mm_and_si128(c, t), _mm_andnot_si128(c, e));
 6435|  20.3M|#endif
 6436|  20.3M|}
spng.c:defilter_sub3:
 6272|  5.02k|{
 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|  5.02k|    size_t rb = rowbytes;
 6278|       |
 6279|  5.02k|    __m128i a, d = _mm_setzero_si128();
 6280|       |
 6281|   525k|    while(rb >= 4)
  ------------------
  |  Branch (6281:11): [True: 520k, False: 5.02k]
  ------------------
 6282|   520k|    {
 6283|   520k|        a = d; d = load4(row);
 6284|   520k|        d = _mm_add_epi8(d, a);
 6285|   520k|        store3(row, d);
 6286|       |
 6287|   520k|        row += 3;
 6288|   520k|        rb  -= 3;
 6289|   520k|    }
 6290|       |
 6291|  5.02k|    if(rb > 0)
  ------------------
  |  Branch (6291:8): [True: 5.02k, False: 0]
  ------------------
 6292|  5.02k|    {
 6293|  5.02k|        a = d; d = load3(row);
 6294|  5.02k|        d = _mm_add_epi8(d, a);
 6295|  5.02k|        store3(row, d);
 6296|  5.02k|    }
 6297|  5.02k|}
spng.c:store3:
 6266|  10.0M|{
 6267|  10.0M|    int tmp = _mm_cvtsi128_si32(v);
 6268|  10.0M|    memcpy(p, &tmp, 3);
 6269|  10.0M|}
spng.c:load3:
 6259|   237k|{
 6260|   237k|    uint32_t tmp = 0;
 6261|   237k|    memcpy(&tmp, p, 3);
 6262|   237k|    return _mm_cvtsi32_si128(tmp);
 6263|   237k|}
spng.c:defilter_avg3:
 6321|    678|{
 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|    678|    size_t rb = rowbytes;
 6329|       |
 6330|    678|    const __m128i zero = _mm_setzero_si128();
 6331|       |
 6332|    678|    __m128i b;
 6333|    678|    __m128i a, d = zero;
 6334|       |
 6335|  40.4k|    while(rb >= 4)
  ------------------
  |  Branch (6335:11): [True: 39.7k, False: 678]
  ------------------
 6336|  39.7k|    {
 6337|  39.7k|        __m128i avg;
 6338|  39.7k|               b = load4(prev);
 6339|  39.7k|        a = d; d = load4(row );
 6340|       |
 6341|       |        /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
 6342|  39.7k|        avg = _mm_avg_epu8(a,b);
 6343|       |        /* ...but we can fix it up by subtracting off 1 if it rounded up. */
 6344|  39.7k|        avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a, b),
 6345|  39.7k|                                            _mm_set1_epi8(1)));
 6346|  39.7k|        d = _mm_add_epi8(d, avg);
 6347|  39.7k|        store3(row, d);
 6348|       |
 6349|  39.7k|        prev += 3;
 6350|  39.7k|        row  += 3;
 6351|  39.7k|        rb   -= 3;
 6352|  39.7k|    }
 6353|       |
 6354|    678|    if(rb > 0)
  ------------------
  |  Branch (6354:8): [True: 678, False: 0]
  ------------------
 6355|    678|    {
 6356|    678|        __m128i avg;
 6357|    678|               b = load3(prev);
 6358|    678|        a = d; d = load3(row );
 6359|       |
 6360|       |        /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
 6361|    678|        avg = _mm_avg_epu8(a, b);
 6362|       |        /* ...but we can fix it up by subtracting off 1 if it rounded up. */
 6363|    678|        avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a, b),
 6364|    678|                                            _mm_set1_epi8(1)));
 6365|       |
 6366|    678|        d = _mm_add_epi8(d, avg);
 6367|    678|        store3(row, d);
 6368|    678|    }
 6369|    678|}
spng.c:defilter_paeth3:
 6439|   115k|{
 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|   115k|    size_t rb = rowbytes;
 6454|   115k|    const __m128i zero = _mm_setzero_si128();
 6455|   115k|    __m128i c, b = zero,
 6456|   115k|            a, d = zero;
 6457|       |
 6458|  9.51M|    while(rb >= 4)
  ------------------
  |  Branch (6458:11): [True: 9.39M, False: 115k]
  ------------------
 6459|  9.39M|    {
 6460|       |        /* It's easiest to do this math (particularly, deal with pc) with 16-bit
 6461|       |         * intermediates.
 6462|       |         */
 6463|  9.39M|        __m128i pa,pb,pc,smallest,nearest;
 6464|  9.39M|        c = b; b = _mm_unpacklo_epi8(load4(prev), zero);
 6465|  9.39M|        a = d; d = _mm_unpacklo_epi8(load4(row ), zero);
 6466|       |
 6467|       |        /* (p-a) == (a+b-c - a) == (b-c) */
 6468|       |
 6469|  9.39M|        pa = _mm_sub_epi16(b, c);
 6470|       |
 6471|       |        /* (p-b) == (a+b-c - b) == (a-c) */
 6472|  9.39M|        pb = _mm_sub_epi16(a, c);
 6473|       |
 6474|       |        /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
 6475|  9.39M|        pc = _mm_add_epi16(pa, pb);
 6476|       |
 6477|  9.39M|        pa = abs_i16(pa);  /* |p-a| */
 6478|  9.39M|        pb = abs_i16(pb);  /* |p-b| */
 6479|  9.39M|        pc = abs_i16(pc);  /* |p-c| */
 6480|       |
 6481|  9.39M|        smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
 6482|       |
 6483|       |        /* Paeth breaks ties favoring a over b over c. */
 6484|  9.39M|        nearest  = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
 6485|  9.39M|                            if_then_else(_mm_cmpeq_epi16(smallest, pb), b, c));
 6486|       |
 6487|       |        /* Note `_epi8`: we need addition to wrap modulo 255. */
 6488|  9.39M|        d = _mm_add_epi8(d, nearest);
 6489|  9.39M|        store3(row, _mm_packus_epi16(d, d));
 6490|       |
 6491|  9.39M|        prev += 3;
 6492|  9.39M|        row  += 3;
 6493|  9.39M|        rb   -= 3;
 6494|  9.39M|    }
 6495|       |
 6496|   115k|    if(rb > 0)
  ------------------
  |  Branch (6496:8): [True: 115k, False: 0]
  ------------------
 6497|   115k|    {
 6498|       |        /* It's easiest to do this math (particularly, deal with pc) with 16-bit
 6499|       |         * intermediates.
 6500|       |         */
 6501|   115k|        __m128i pa, pb, pc, smallest, nearest;
 6502|   115k|        c = b; b = _mm_unpacklo_epi8(load3(prev), zero);
 6503|   115k|        a = d; d = _mm_unpacklo_epi8(load3(row ), zero);
 6504|       |
 6505|       |        /* (p-a) == (a+b-c - a) == (b-c) */
 6506|   115k|        pa = _mm_sub_epi16(b, c);
 6507|       |
 6508|       |        /* (p-b) == (a+b-c - b) == (a-c) */
 6509|   115k|        pb = _mm_sub_epi16(a, c);
 6510|       |
 6511|       |        /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
 6512|   115k|        pc = _mm_add_epi16(pa, pb);
 6513|       |
 6514|   115k|        pa = abs_i16(pa);  /* |p-a| */
 6515|   115k|        pb = abs_i16(pb);  /* |p-b| */
 6516|   115k|        pc = abs_i16(pc);  /* |p-c| */
 6517|       |
 6518|   115k|        smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
 6519|       |
 6520|       |        /* Paeth breaks ties favoring a over b over c. */
 6521|   115k|        nearest  = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
 6522|   115k|                            if_then_else(_mm_cmpeq_epi16(smallest, pb), b, c));
 6523|       |
 6524|       |        /* Note `_epi8`: we need addition to wrap modulo 255. */
 6525|   115k|        d = _mm_add_epi8(d, nearest);
 6526|   115k|        store3(row, _mm_packus_epi16(d, d));
 6527|   115k|    }
 6528|   115k|}
spng.c:defilter_up:
 1449|   100k|{
 1450|   100k|    size_t i;
 1451|  23.2M|    for(i=0; i < bytes; i++)
  ------------------
  |  Branch (1451:14): [True: 23.1M, False: 100k]
  ------------------
 1452|  23.1M|    {
 1453|  23.1M|        row[i] += prev[i];
 1454|  23.1M|    }
 1455|   100k|}
spng.c:paeth:
 1435|  6.37M|{
 1436|  6.37M|    int16_t p = a + b - c;
 1437|  6.37M|    int16_t pa = abs(p - a);
 1438|  6.37M|    int16_t pb = abs(p - b);
 1439|  6.37M|    int16_t pc = abs(p - c);
 1440|       |
 1441|  6.37M|    if(pa <= pb && pa <= pc) return a;
  ------------------
  |  Branch (1441:8): [True: 5.86M, False: 509k]
  |  Branch (1441:20): [True: 5.83M, False: 26.3k]
  ------------------
 1442|   535k|    else if(pb <= pc) return b;
  ------------------
  |  Branch (1442:13): [True: 490k, False: 45.3k]
  ------------------
 1443|       |
 1444|  45.3k|    return c;
 1445|  6.37M|}
spng.c:decode_err:
  764|  39.6k|{
  765|  39.6k|    ctx->state = SPNG_STATE_INVALID;
  766|       |
  767|  39.6k|    return err;
  768|  39.6k|}
spng.c:update_row_info:
 3270|   726k|{
 3271|   726k|    int interlacing = ctx->ihdr.interlace_method;
 3272|   726k|    struct spng_row_info *ri = &ctx->row_info;
 3273|   726k|    const struct spng_subimage *sub = ctx->subimage;
 3274|       |
 3275|   726k|    if(ri->scanline_idx == (sub[ri->pass].height - 1)) /* Last scanline */
  ------------------
  |  Branch (3275:8): [True: 10.2k, False: 715k]
  ------------------
 3276|  10.2k|    {
 3277|  10.2k|        if(ri->pass == ctx->last_pass)
  ------------------
  |  Branch (3277:12): [True: 2.54k, False: 7.75k]
  ------------------
 3278|  2.54k|        {
 3279|  2.54k|            ctx->state = SPNG_STATE_EOI;
 3280|       |
 3281|  2.54k|            return SPNG_EOI;
 3282|  2.54k|        }
 3283|       |
 3284|  7.75k|        ri->scanline_idx = 0;
 3285|  7.75k|        ri->pass++;
 3286|       |
 3287|       |        /* Skip empty passes */
 3288|  7.87k|        while( (!sub[ri->pass].width || !sub[ri->pass].height) && (ri->pass < ctx->last_pass)) ri->pass++;
  ------------------
  |  Branch (3288:17): [True: 72, False: 7.80k]
  |  Branch (3288:41): [True: 48, False: 7.75k]
  |  Branch (3288:67): [True: 120, False: 0]
  ------------------
 3289|  7.75k|    }
 3290|   715k|    else
 3291|   715k|    {
 3292|   715k|        ri->row_num++;
 3293|   715k|        ri->scanline_idx++;
 3294|   715k|    }
 3295|       |
 3296|   723k|    if(interlacing) ri->row_num = adam7_y_start[ri->pass] + ri->scanline_idx * adam7_y_delta[ri->pass];
  ------------------
  |  Branch (3296:8): [True: 477k, False: 246k]
  ------------------
 3297|       |
 3298|   723k|    return 0;
 3299|   726k|}
spng.c:discard_chunk_bytes:
 1160|   805k|{
 1161|   805k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1161:8): [True: 0, False: 805k]
  ------------------
 1162|   805k|    if(!bytes) return 0;
  ------------------
  |  Branch (1162:8): [True: 741k, False: 64.5k]
  ------------------
 1163|       |
 1164|  64.5k|    int ret;
 1165|       |
 1166|  64.5k|    if(ctx->streaming) /* Do small, consecutive reads */
  ------------------
  |  Branch (1166:8): [True: 64.5k, False: 0]
  ------------------
 1167|  64.5k|    {
 1168|   128k|        while(bytes)
  ------------------
  |  Branch (1168:15): [True: 68.7k, False: 60.0k]
  ------------------
 1169|  68.7k|        {
 1170|  68.7k|            uint32_t len = SPNG_READ_SIZE;
  ------------------
  |  |   30|  68.7k|#define SPNG_READ_SIZE (8192)
  ------------------
 1171|       |
 1172|  68.7k|            if(len > bytes) len = bytes;
  ------------------
  |  Branch (1172:16): [True: 60.9k, False: 7.76k]
  ------------------
 1173|       |
 1174|  68.7k|            ret = read_chunk_bytes(ctx, len);
 1175|  68.7k|            if(ret) return ret;
  ------------------
  |  Branch (1175:16): [True: 4.46k, False: 64.2k]
  ------------------
 1176|       |
 1177|  64.2k|            bytes -= len;
 1178|  64.2k|        }
 1179|  64.5k|    }
 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|  60.0k|    return 0;
 1187|  64.5k|}
spng.c:read_chunk_bytes:
 1106|   454k|{
 1107|   454k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1107:8): [True: 0, False: 454k]
  ------------------
 1108|   454k|    if(!ctx->cur_chunk_bytes_left || !bytes) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1108:8): [True: 16.1k, False: 438k]
  |  Branch (1108:38): [True: 0, False: 438k]
  ------------------
 1109|   438k|    if(bytes > ctx->cur_chunk_bytes_left) return SPNG_EINTERNAL; /* XXX: more specific error? */
  ------------------
  |  Branch (1109:8): [True: 0, False: 438k]
  ------------------
 1110|       |
 1111|   438k|    int ret;
 1112|       |
 1113|   438k|    ret = read_data(ctx, bytes);
 1114|   438k|    if(ret) return ret;
  ------------------
  |  Branch (1114:8): [True: 7.29k, False: 431k]
  ------------------
 1115|       |
 1116|   431k|    if(!ctx->skip_crc) ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, ctx->data, bytes);
  ------------------
  |  |   46|   431k|#  define crc32                 z_crc32
  ------------------
  |  Branch (1116:8): [True: 431k, False: 0]
  ------------------
 1117|       |
 1118|   431k|    ctx->cur_chunk_bytes_left -= bytes;
 1119|       |
 1120|   431k|    return ret;
 1121|   438k|}
spng.c:read_data:
  778|  2.19M|{
  779|  2.19M|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (779:8): [True: 0, False: 2.19M]
  ------------------
  780|  2.19M|    if(!bytes) return 0;
  ------------------
  |  Branch (780:8): [True: 0, False: 2.19M]
  ------------------
  781|       |
  782|  2.19M|    if(ctx->streaming && (bytes > SPNG_READ_SIZE)) return SPNG_EINTERNAL;
  ------------------
  |  |   30|  2.19M|#define SPNG_READ_SIZE (8192)
  ------------------
  |  Branch (782:8): [True: 2.19M, False: 0]
  |  Branch (782:26): [True: 0, False: 2.19M]
  ------------------
  783|       |
  784|  2.19M|    int ret = ctx->read_fn(ctx, ctx->stream_user_ptr, ctx->stream_buf, bytes);
  785|       |
  786|  2.19M|    if(ret)
  ------------------
  |  Branch (786:8): [True: 34.5k, False: 2.16M]
  ------------------
  787|  34.5k|    {
  788|  34.5k|        if(ret > 0 || ret < SPNG_IO_ERROR) ret = SPNG_IO_ERROR;
  ------------------
  |  Branch (788:12): [True: 0, False: 34.5k]
  |  Branch (788:23): [True: 0, False: 34.5k]
  ------------------
  789|       |
  790|  34.5k|        return ret;
  791|  34.5k|    }
  792|       |
  793|  2.16M|    ctx->bytes_read += bytes;
  794|  2.16M|    if(ctx->bytes_read < bytes) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (794:8): [True: 0, False: 2.16M]
  ------------------
  795|       |
  796|  2.16M|    return 0;
  797|  2.16M|}
spng.c:read_chunks:
 3117|  76.1k|{
 3118|  76.1k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (3118:8): [True: 0, False: 76.1k]
  ------------------
 3119|  76.1k|    if(!ctx->state) return SPNG_EBADSTATE;
  ------------------
  |  Branch (3119:8): [True: 0, False: 76.1k]
  ------------------
 3120|  76.1k|    if(ctx->data == NULL)
  ------------------
  |  Branch (3120:8): [True: 0, False: 76.1k]
  ------------------
 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|  76.1k|    int ret = 0;
 3127|       |
 3128|  76.1k|    if(ctx->state == SPNG_STATE_INPUT)
  ------------------
  |  Branch (3128:8): [True: 32.8k, False: 43.3k]
  ------------------
 3129|  32.8k|    {
 3130|  32.8k|        ret = read_ihdr(ctx);
 3131|       |
 3132|  32.8k|        if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3132:12): [True: 1.33k, False: 31.4k]
  ------------------
 3133|       |
 3134|  31.4k|        ctx->state = SPNG_STATE_IHDR;
 3135|  31.4k|    }
 3136|       |
 3137|  74.8k|    if(only_ihdr) return 0;
  ------------------
  |  Branch (3137:8): [True: 31.4k, False: 43.3k]
  ------------------
 3138|       |
 3139|  43.3k|    if(ctx->state == SPNG_STATE_EOI)
  ------------------
  |  Branch (3139:8): [True: 2.44k, False: 40.9k]
  ------------------
 3140|  2.44k|    {
 3141|  2.44k|        ctx->state = SPNG_STATE_AFTER_IDAT;
 3142|  2.44k|        ctx->prev_was_idat = 1;
 3143|  2.44k|    }
 3144|       |
 3145|   728k|    while(ctx->state < SPNG_STATE_FIRST_IDAT || ctx->state == SPNG_STATE_AFTER_IDAT)
  ------------------
  |  Branch (3145:11): [True: 688k, False: 39.8k]
  |  Branch (3145:49): [True: 19.9k, False: 19.9k]
  ------------------
 3146|   708k|    {
 3147|   708k|        ret = read_non_idat_chunks(ctx);
 3148|       |
 3149|   708k|        if(!ret)
  ------------------
  |  Branch (3149:12): [True: 10.4k, False: 698k]
  ------------------
 3150|  10.4k|        {
 3151|  10.4k|            if(ctx->state < SPNG_STATE_FIRST_IDAT) ctx->state = SPNG_STATE_FIRST_IDAT;
  ------------------
  |  Branch (3151:16): [True: 10.4k, False: 52]
  ------------------
 3152|     52|            else if(ctx->state == SPNG_STATE_AFTER_IDAT) ctx->state = SPNG_STATE_IEND;
  ------------------
  |  Branch (3152:21): [True: 52, False: 0]
  ------------------
 3153|  10.4k|        }
 3154|   698k|        else
 3155|   698k|        {
 3156|   698k|            switch(ret)
 3157|   698k|            {
 3158|  22.8k|                case SPNG_ECHUNK_POS:
  ------------------
  |  Branch (3158:17): [True: 22.8k, False: 675k]
  ------------------
 3159|   401k|                case SPNG_ECHUNK_SIZE: /* size != expected size, SPNG_ECHUNK_STDLEN = invalid size */
  ------------------
  |  Branch (3159:17): [True: 378k, False: 319k]
  ------------------
 3160|   401k|                case SPNG_EDUP_PLTE:
  ------------------
  |  Branch (3160:17): [True: 0, False: 698k]
  ------------------
 3161|   401k|                case SPNG_EDUP_CHRM:
  ------------------
  |  Branch (3161:17): [True: 392, False: 697k]
  ------------------
 3162|   402k|                case SPNG_EDUP_GAMA:
  ------------------
  |  Branch (3162:17): [True: 735, False: 697k]
  ------------------
 3163|   417k|                case SPNG_EDUP_ICCP:
  ------------------
  |  Branch (3163:17): [True: 14.6k, False: 683k]
  ------------------
 3164|   418k|                case SPNG_EDUP_SBIT:
  ------------------
  |  Branch (3164:17): [True: 1.00k, False: 697k]
  ------------------
 3165|   419k|                case SPNG_EDUP_SRGB:
  ------------------
  |  Branch (3165:17): [True: 728, False: 697k]
  ------------------
 3166|   428k|                case SPNG_EDUP_BKGD:
  ------------------
  |  Branch (3166:17): [True: 9.21k, False: 688k]
  ------------------
 3167|   428k|                case SPNG_EDUP_HIST:
  ------------------
  |  Branch (3167:17): [True: 308, False: 697k]
  ------------------
 3168|   434k|                case SPNG_EDUP_TRNS:
  ------------------
  |  Branch (3168:17): [True: 6.06k, False: 692k]
  ------------------
 3169|   436k|                case SPNG_EDUP_PHYS:
  ------------------
  |  Branch (3169:17): [True: 2.13k, False: 696k]
  ------------------
 3170|   439k|                case SPNG_EDUP_TIME:
  ------------------
  |  Branch (3170:17): [True: 2.56k, False: 695k]
  ------------------
 3171|   440k|                case SPNG_EDUP_OFFS:
  ------------------
  |  Branch (3171:17): [True: 735, False: 697k]
  ------------------
 3172|   445k|                case SPNG_EDUP_EXIF:
  ------------------
  |  Branch (3172:17): [True: 5.50k, False: 692k]
  ------------------
 3173|   446k|                case SPNG_ECHRM:
  ------------------
  |  Branch (3173:17): [True: 1.27k, False: 696k]
  ------------------
 3174|   447k|                case SPNG_ETRNS_COLOR_TYPE:
  ------------------
  |  Branch (3174:17): [True: 434, False: 697k]
  ------------------
 3175|   447k|                case SPNG_ETRNS_NO_PLTE:
  ------------------
  |  Branch (3175:17): [True: 0, False: 698k]
  ------------------
 3176|   447k|                case SPNG_EGAMA:
  ------------------
  |  Branch (3176:17): [True: 434, False: 697k]
  ------------------
 3177|   447k|                case SPNG_EICCP_NAME:
  ------------------
  |  Branch (3177:17): [True: 119, False: 698k]
  ------------------
 3178|   447k|                case SPNG_EICCP_COMPRESSION_METHOD:
  ------------------
  |  Branch (3178:17): [True: 105, False: 698k]
  ------------------
 3179|   452k|                case SPNG_ESBIT:
  ------------------
  |  Branch (3179:17): [True: 4.09k, False: 694k]
  ------------------
 3180|   452k|                case SPNG_ESRGB:
  ------------------
  |  Branch (3180:17): [True: 455, False: 697k]
  ------------------
 3181|   452k|                case SPNG_ETEXT:
  ------------------
  |  Branch (3181:17): [True: 0, False: 698k]
  ------------------
 3182|   496k|                case SPNG_ETEXT_KEYWORD:
  ------------------
  |  Branch (3182:17): [True: 43.9k, False: 654k]
  ------------------
 3183|   513k|                case SPNG_EZTXT:
  ------------------
  |  Branch (3183:17): [True: 17.3k, False: 680k]
  ------------------
 3184|   518k|                case SPNG_EZTXT_COMPRESSION_METHOD:
  ------------------
  |  Branch (3184:17): [True: 4.83k, False: 693k]
  ------------------
 3185|   522k|                case SPNG_EITXT:
  ------------------
  |  Branch (3185:17): [True: 3.49k, False: 694k]
  ------------------
 3186|   524k|                case SPNG_EITXT_COMPRESSION_FLAG:
  ------------------
  |  Branch (3186:17): [True: 2.10k, False: 696k]
  ------------------
 3187|   525k|                case SPNG_EITXT_COMPRESSION_METHOD:
  ------------------
  |  Branch (3187:17): [True: 1.33k, False: 696k]
  ------------------
 3188|   525k|                case SPNG_EITXT_LANG_TAG:
  ------------------
  |  Branch (3188:17): [True: 273, False: 697k]
  ------------------
 3189|   525k|                case SPNG_EITXT_TRANSLATED_KEY:
  ------------------
  |  Branch (3189:17): [True: 0, False: 698k]
  ------------------
 3190|   527k|                case SPNG_EBKGD_NO_PLTE:
  ------------------
  |  Branch (3190:17): [True: 1.99k, False: 696k]
  ------------------
 3191|   529k|                case SPNG_EBKGD_PLTE_IDX:
  ------------------
  |  Branch (3191:17): [True: 1.63k, False: 696k]
  ------------------
 3192|   533k|                case SPNG_EHIST_NO_PLTE:
  ------------------
  |  Branch (3192:17): [True: 3.52k, False: 694k]
  ------------------
 3193|   536k|                case SPNG_EPHYS:
  ------------------
  |  Branch (3193:17): [True: 3.22k, False: 694k]
  ------------------
 3194|   610k|                case SPNG_ESPLT_NAME:
  ------------------
  |  Branch (3194:17): [True: 74.5k, False: 623k]
  ------------------
 3195|   612k|                case SPNG_ESPLT_DUP_NAME:
  ------------------
  |  Branch (3195:17): [True: 1.47k, False: 696k]
  ------------------
 3196|   614k|                case SPNG_ESPLT_DEPTH:
  ------------------
  |  Branch (3196:17): [True: 2.21k, False: 695k]
  ------------------
 3197|   621k|                case SPNG_ETIME:
  ------------------
  |  Branch (3197:17): [True: 6.50k, False: 691k]
  ------------------
 3198|   621k|                case SPNG_EOFFS:
  ------------------
  |  Branch (3198:17): [True: 168, False: 697k]
  ------------------
 3199|   622k|                case SPNG_EEXIF:
  ------------------
  |  Branch (3199:17): [True: 833, False: 697k]
  ------------------
 3200|   677k|                case SPNG_EZLIB:
  ------------------
  |  Branch (3200:17): [True: 55.9k, False: 642k]
  ------------------
 3201|   677k|                {
 3202|   677k|                    if(!ctx->strict && !is_critical_chunk(&ctx->current_chunk))
  ------------------
  |  Branch (3202:24): [True: 677k, False: 0]
  |  Branch (3202:40): [True: 677k, False: 322]
  ------------------
 3203|   677k|                    {
 3204|   677k|                        ret = discard_chunk_bytes(ctx, ctx->cur_chunk_bytes_left);
 3205|   677k|                        if(ret) return decode_err(ctx, ret);
  ------------------
  |  Branch (3205:28): [True: 2.94k, False: 674k]
  ------------------
 3206|       |
 3207|   674k|                        if(ctx->undo) ctx->undo(ctx);
  ------------------
  |  Branch (3207:28): [True: 221k, False: 452k]
  ------------------
 3208|       |
 3209|   674k|                        ctx->stored = ctx->prev_stored;
 3210|       |
 3211|   674k|                        ctx->discard = 0;
 3212|   674k|                        ctx->undo = NULL;
 3213|       |
 3214|   674k|                        continue;
 3215|   677k|                    }
 3216|    322|                    else return decode_err(ctx, ret);
 3217|       |
 3218|      0|                    break;
 3219|   677k|                }
 3220|  20.1k|                default: return decode_err(ctx, ret);
  ------------------
  |  Branch (3220:17): [True: 20.1k, False: 677k]
  ------------------
 3221|   698k|            }
 3222|   698k|        }
 3223|   708k|    }
 3224|       |
 3225|  19.9k|    return ret;
 3226|  43.3k|}
spng.c:read_ihdr:
 2278|  32.8k|{
 2279|  32.8k|    int ret;
 2280|  32.8k|    struct spng_chunk *chunk = &ctx->current_chunk;
 2281|  32.8k|    const unsigned char *data;
 2282|       |
 2283|  32.8k|    chunk->offset = 8;
 2284|  32.8k|    chunk->length = 13;
 2285|  32.8k|    size_t sizeof_sig_ihdr = 29;
 2286|       |
 2287|  32.8k|    ret = read_data(ctx, sizeof_sig_ihdr);
 2288|  32.8k|    if(ret) return ret;
  ------------------
  |  Branch (2288:8): [True: 14, False: 32.7k]
  ------------------
 2289|       |
 2290|  32.7k|    data = ctx->data;
 2291|       |
 2292|  32.7k|    if(memcmp(data, spng_signature, sizeof(spng_signature))) return SPNG_ESIGNATURE;
  ------------------
  |  Branch (2292:8): [True: 168, False: 32.6k]
  ------------------
 2293|       |
 2294|  32.6k|    chunk->length = read_u32(data + 8);
 2295|  32.6k|    memcpy(&chunk->type, data + 12, 4);
 2296|       |
 2297|  32.6k|    if(chunk->length != 13) return SPNG_EIHDR_SIZE;
  ------------------
  |  Branch (2297:8): [True: 266, False: 32.3k]
  ------------------
 2298|  32.3k|    if(memcmp(chunk->type, type_ihdr, 4)) return SPNG_ENOIHDR;
  ------------------
  |  Branch (2298:8): [True: 42, False: 32.3k]
  ------------------
 2299|       |
 2300|  32.3k|    ctx->cur_actual_crc = crc32(0, NULL, 0);
  ------------------
  |  |   46|  32.3k|#  define crc32                 z_crc32
  ------------------
 2301|  32.3k|    ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, data + 12, 17);
  ------------------
  |  |   46|  32.3k|#  define crc32                 z_crc32
  ------------------
 2302|       |
 2303|  32.3k|    ctx->ihdr.width = read_u32(data + 16);
 2304|  32.3k|    ctx->ihdr.height = read_u32(data + 20);
 2305|  32.3k|    ctx->ihdr.bit_depth = data[24];
 2306|  32.3k|    ctx->ihdr.color_type = data[25];
 2307|  32.3k|    ctx->ihdr.compression_method = data[26];
 2308|  32.3k|    ctx->ihdr.filter_method = data[27];
 2309|  32.3k|    ctx->ihdr.interlace_method = data[28];
 2310|       |
 2311|  32.3k|    ret = check_ihdr(&ctx->ihdr, ctx->max_width, ctx->max_height);
 2312|  32.3k|    if(ret) return ret;
  ------------------
  |  Branch (2312:8): [True: 770, False: 31.5k]
  ------------------
 2313|       |
 2314|  31.5k|    ctx->file.ihdr = 1;
 2315|  31.5k|    ctx->stored.ihdr = 1;
 2316|       |
 2317|  31.5k|    if(ctx->ihdr.bit_depth < 8) ctx->bytes_per_pixel = 1;
  ------------------
  |  Branch (2317:8): [True: 9.66k, False: 21.8k]
  ------------------
 2318|  21.8k|    else ctx->bytes_per_pixel = num_channels(&ctx->ihdr) * (ctx->ihdr.bit_depth / 8);
 2319|       |
 2320|  31.5k|    ret = calculate_subimages(ctx);
 2321|  31.5k|    if(ret) return ret;
  ------------------
  |  Branch (2321:8): [True: 70, False: 31.4k]
  ------------------
 2322|       |
 2323|  31.4k|    return 0;
 2324|  31.5k|}
spng.c:read_u32:
  454|  1.81M|{
  455|  1.81M|    const unsigned char *data = src;
  456|       |
  457|  1.81M|    return (data[0] & 0xFFUL) << 24 | (data[1] & 0xFFUL) << 16 |
  458|  1.81M|           (data[2] & 0xFFUL) << 8  | (data[3] & 0xFFUL);
  459|  1.81M|}
spng.c:read_non_idat_chunks:
 2371|   708k|{
 2372|   708k|    int ret;
 2373|   708k|    struct spng_chunk chunk;
 2374|   708k|    const unsigned char *data;
 2375|       |
 2376|   708k|    ctx->discard = 0;
 2377|   708k|    ctx->undo = NULL;
 2378|   708k|    ctx->prev_stored = ctx->stored;
 2379|       |
 2380|   840k|    while( !(ret = read_header(ctx)))
  ------------------
  |  Branch (2380:12): [True: 827k, False: 13.4k]
  ------------------
 2381|   827k|    {
 2382|   827k|        if(ctx->discard)
  ------------------
  |  Branch (2382:12): [True: 262k, False: 564k]
  ------------------
 2383|   262k|        {
 2384|   262k|            if(ctx->undo) ctx->undo(ctx);
  ------------------
  |  Branch (2384:16): [True: 9.35k, False: 253k]
  ------------------
 2385|       |
 2386|   262k|            ctx->stored = ctx->prev_stored;
 2387|   262k|        }
 2388|       |
 2389|   827k|        ctx->discard = 0;
 2390|   827k|        ctx->undo = NULL;
 2391|       |
 2392|   827k|        ctx->prev_stored = ctx->stored;
 2393|   827k|        chunk = ctx->current_chunk;
 2394|       |
 2395|   827k|        if(!memcmp(chunk.type, type_idat, 4))
  ------------------
  |  Branch (2395:12): [True: 10.9k, False: 816k]
  ------------------
 2396|  10.9k|        {
 2397|  10.9k|            if(ctx->state < SPNG_STATE_FIRST_IDAT)
  ------------------
  |  Branch (2397:16): [True: 10.4k, False: 524]
  ------------------
 2398|  10.4k|            {
 2399|  10.4k|                if(ctx->ihdr.color_type == 3 && !ctx->stored.plte) return SPNG_ENOPLTE;
  ------------------
  |  Branch (2399:20): [True: 441, False: 10.0k]
  |  Branch (2399:49): [True: 7, False: 434]
  ------------------
 2400|       |
 2401|  10.4k|                ctx->first_idat = chunk;
 2402|  10.4k|                return 0;
 2403|  10.4k|            }
 2404|       |
 2405|    524|            if(ctx->prev_was_idat)
  ------------------
  |  Branch (2405:16): [True: 517, False: 7]
  ------------------
 2406|    517|            {
 2407|       |                /* Ignore extra IDAT's */
 2408|    517|                ret = discard_chunk_bytes(ctx, chunk.length);
 2409|    517|                if(ret) return ret;
  ------------------
  |  Branch (2409:20): [True: 287, False: 230]
  ------------------
 2410|       |
 2411|    230|                continue;
 2412|    517|            }
 2413|      7|            else return SPNG_ECHUNK_POS; /* IDAT chunk not at the end of the IDAT sequence */
 2414|    524|        }
 2415|       |
 2416|   816k|        ctx->prev_was_idat = 0;
 2417|       |
 2418|   816k|        if(is_small_chunk(chunk.type))
  ------------------
  |  Branch (2418:12): [True: 100k, False: 715k]
  ------------------
 2419|   100k|        {
 2420|       |            /* None of the known chunks can be zero length */
 2421|   100k|            if(!chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2421:16): [True: 553, False: 99.8k]
  ------------------
 2422|       |
 2423|       |            /* The largest of these chunks is PLTE with 256 entries */
 2424|  99.8k|            ret = read_chunk_bytes(ctx, chunk.length > 768 ? 768 : chunk.length);
  ------------------
  |  Branch (2424:41): [True: 2.12k, False: 97.7k]
  ------------------
 2425|  99.8k|            if(ret) return ret;
  ------------------
  |  Branch (2425:16): [True: 378, False: 99.4k]
  ------------------
 2426|  99.8k|        }
 2427|       |
 2428|   815k|        data = ctx->data;
 2429|       |
 2430|   815k|        if(is_critical_chunk(&chunk))
  ------------------
  |  Branch (2430:12): [True: 4.33k, False: 811k]
  ------------------
 2431|  4.33k|        {
 2432|  4.33k|            if(!memcmp(chunk.type, type_plte, 4))
  ------------------
  |  Branch (2432:16): [True: 2.30k, False: 2.02k]
  ------------------
 2433|  2.30k|            {
 2434|  2.30k|                if(ctx->file.trns || ctx->file.hist || ctx->file.bkgd) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2434:20): [True: 7, False: 2.29k]
  |  Branch (2434:38): [True: 7, False: 2.28k]
  |  Branch (2434:56): [True: 7, False: 2.28k]
  ------------------
 2435|  2.28k|                if(chunk.length % 3 != 0) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2435:20): [True: 7, False: 2.27k]
  ------------------
 2436|       |
 2437|  2.27k|                ctx->plte.n_entries = chunk.length / 3;
 2438|       |
 2439|  2.27k|                if(check_plte(&ctx->plte, &ctx->ihdr)) return SPNG_ECHUNK_SIZE; /* XXX: EPLTE? */
  ------------------
  |  Branch (2439:20): [True: 91, False: 2.18k]
  ------------------
 2440|       |
 2441|  2.18k|                size_t i;
 2442|  75.0k|                for(i=0; i < ctx->plte.n_entries; i++)
  ------------------
  |  Branch (2442:26): [True: 72.9k, False: 2.18k]
  ------------------
 2443|  72.9k|                {
 2444|  72.9k|                    ctx->plte.entries[i].red   = data[i * 3];
 2445|  72.9k|                    ctx->plte.entries[i].green = data[i * 3 + 1];
 2446|  72.9k|                    ctx->plte.entries[i].blue  = data[i * 3 + 2];
 2447|  72.9k|                }
 2448|       |
 2449|  2.18k|                ctx->file.plte = 1;
 2450|  2.18k|                ctx->stored.plte = 1;
 2451|  2.18k|            }
 2452|  2.02k|            else if(!memcmp(chunk.type, type_iend, 4))
  ------------------
  |  Branch (2452:21): [True: 544, False: 1.48k]
  ------------------
 2453|    544|            {
 2454|    544|                if(ctx->state == SPNG_STATE_AFTER_IDAT)
  ------------------
  |  Branch (2454:20): [True: 523, False: 21]
  ------------------
 2455|    523|                {
 2456|    523|                    if(chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2456:24): [True: 161, False: 362]
  ------------------
 2457|       |
 2458|    362|                    ret = read_and_check_crc(ctx);
 2459|    362|                    if(ret == -SPNG_CRC_DISCARD) ret = 0;
  ------------------
  |  Branch (2459:24): [True: 7, False: 355]
  ------------------
 2460|       |
 2461|    362|                    return ret;
 2462|    523|                }
 2463|     21|                else return SPNG_ECHUNK_POS;
 2464|    544|            }
 2465|  1.48k|            else if(!memcmp(chunk.type, type_ihdr, 4)) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2465:21): [True: 14, False: 1.47k]
  ------------------
 2466|  1.47k|            else return SPNG_ECHUNK_UNKNOWN_CRITICAL;
 2467|  4.33k|        }
 2468|   811k|        else if(!memcmp(chunk.type, type_chrm, 4)) /* Ancillary chunks */
  ------------------
  |  Branch (2468:17): [True: 2.47k, False: 808k]
  ------------------
 2469|  2.47k|        {
 2470|  2.47k|            if(ctx->file.plte) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2470:16): [True: 77, False: 2.40k]
  ------------------
 2471|  2.40k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2471:16): [True: 77, False: 2.32k]
  ------------------
 2472|  2.32k|            if(ctx->file.chrm) return SPNG_EDUP_CHRM;
  ------------------
  |  Branch (2472:16): [True: 392, False: 1.93k]
  ------------------
 2473|       |
 2474|  1.93k|            if(chunk.length != 32) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2474:16): [True: 301, False: 1.63k]
  ------------------
 2475|       |
 2476|  1.63k|            ctx->chrm_int.white_point_x = read_u32(data);
 2477|  1.63k|            ctx->chrm_int.white_point_y = read_u32(data + 4);
 2478|  1.63k|            ctx->chrm_int.red_x = read_u32(data + 8);
 2479|  1.63k|            ctx->chrm_int.red_y = read_u32(data + 12);
 2480|  1.63k|            ctx->chrm_int.green_x = read_u32(data + 16);
 2481|  1.63k|            ctx->chrm_int.green_y = read_u32(data + 20);
 2482|  1.63k|            ctx->chrm_int.blue_x = read_u32(data + 24);
 2483|  1.63k|            ctx->chrm_int.blue_y = read_u32(data + 28);
 2484|       |
 2485|  1.63k|            if(check_chrm_int(&ctx->chrm_int)) return SPNG_ECHRM;
  ------------------
  |  Branch (2485:16): [True: 1.27k, False: 357]
  ------------------
 2486|       |
 2487|    357|            ctx->file.chrm = 1;
 2488|    357|            ctx->stored.chrm = 1;
 2489|    357|        }
 2490|   808k|        else if(!memcmp(chunk.type, type_gama, 4))
  ------------------
  |  Branch (2490:17): [True: 13.3k, False: 795k]
  ------------------
 2491|  13.3k|        {
 2492|  13.3k|            if(ctx->file.plte) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2492:16): [True: 4.83k, False: 8.55k]
  ------------------
 2493|  8.55k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2493:16): [True: 546, False: 8.00k]
  ------------------
 2494|  8.00k|            if(ctx->file.gama) return SPNG_EDUP_GAMA;
  ------------------
  |  Branch (2494:16): [True: 735, False: 7.27k]
  ------------------
 2495|       |
 2496|  7.27k|            if(chunk.length != 4) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2496:16): [True: 6.18k, False: 1.09k]
  ------------------
 2497|       |
 2498|  1.09k|            ctx->gama = read_u32(data);
 2499|       |
 2500|  1.09k|            if(!ctx->gama) return SPNG_EGAMA;
  ------------------
  |  Branch (2500:16): [True: 77, False: 1.01k]
  ------------------
 2501|  1.01k|            if(ctx->gama > spng_u32max) return SPNG_EGAMA;
  ------------------
  |  Branch (2501:16): [True: 357, False: 658]
  ------------------
 2502|       |
 2503|    658|            ctx->file.gama = 1;
 2504|    658|            ctx->stored.gama = 1;
 2505|    658|        }
 2506|   795k|        else if(!memcmp(chunk.type, type_sbit, 4))
  ------------------
  |  Branch (2506:17): [True: 9.12k, False: 786k]
  ------------------
 2507|  9.12k|        {
 2508|  9.12k|            if(ctx->file.plte) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2508:16): [True: 469, False: 8.65k]
  ------------------
 2509|  8.65k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2509:16): [True: 217, False: 8.43k]
  ------------------
 2510|  8.43k|            if(ctx->file.sbit) return SPNG_EDUP_SBIT;
  ------------------
  |  Branch (2510:16): [True: 1.00k, False: 7.42k]
  ------------------
 2511|       |
 2512|  7.42k|            if(ctx->ihdr.color_type == 0)
  ------------------
  |  Branch (2512:16): [True: 2.77k, False: 4.64k]
  ------------------
 2513|  2.77k|            {
 2514|  2.77k|                if(chunk.length != 1) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2514:20): [True: 1.40k, False: 1.37k]
  ------------------
 2515|       |
 2516|  1.37k|                ctx->sbit.grayscale_bits = data[0];
 2517|  1.37k|            }
 2518|  4.64k|            else if(ctx->ihdr.color_type == 2 || ctx->ihdr.color_type == 3)
  ------------------
  |  Branch (2518:21): [True: 882, False: 3.76k]
  |  Branch (2518:50): [True: 1.16k, False: 2.59k]
  ------------------
 2519|  2.05k|            {
 2520|  2.05k|                if(chunk.length != 3) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2520:20): [True: 1.07k, False: 980]
  ------------------
 2521|       |
 2522|    980|                ctx->sbit.red_bits = data[0];
 2523|    980|                ctx->sbit.green_bits = data[1];
 2524|    980|                ctx->sbit.blue_bits = data[2];
 2525|    980|            }
 2526|  2.59k|            else if(ctx->ihdr.color_type == 4)
  ------------------
  |  Branch (2526:21): [True: 735, False: 1.86k]
  ------------------
 2527|    735|            {
 2528|    735|                if(chunk.length != 2) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2528:20): [True: 140, False: 595]
  ------------------
 2529|       |
 2530|    595|                ctx->sbit.grayscale_bits = data[0];
 2531|    595|                ctx->sbit.alpha_bits = data[1];
 2532|    595|            }
 2533|  1.86k|            else if(ctx->ihdr.color_type == 6)
  ------------------
  |  Branch (2533:21): [True: 1.86k, False: 0]
  ------------------
 2534|  1.86k|            {
 2535|  1.86k|                if(chunk.length != 4) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2535:20): [True: 609, False: 1.25k]
  ------------------
 2536|       |
 2537|  1.25k|                ctx->sbit.red_bits = data[0];
 2538|  1.25k|                ctx->sbit.green_bits = data[1];
 2539|  1.25k|                ctx->sbit.blue_bits = data[2];
 2540|  1.25k|                ctx->sbit.alpha_bits = data[3];
 2541|  1.25k|            }
 2542|       |
 2543|  4.20k|            if(check_sbit(&ctx->sbit, &ctx->ihdr)) return SPNG_ESBIT;
  ------------------
  |  Branch (2543:16): [True: 4.09k, False: 105]
  ------------------
 2544|       |
 2545|    105|            ctx->file.sbit = 1;
 2546|    105|            ctx->stored.sbit = 1;
 2547|    105|        }
 2548|   786k|        else if(!memcmp(chunk.type, type_srgb, 4))
  ------------------
  |  Branch (2548:17): [True: 2.33k, False: 783k]
  ------------------
 2549|  2.33k|        {
 2550|  2.33k|            if(ctx->file.plte) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2550:16): [True: 210, False: 2.12k]
  ------------------
 2551|  2.12k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2551:16): [True: 210, False: 1.91k]
  ------------------
 2552|  1.91k|            if(ctx->file.srgb) return SPNG_EDUP_SRGB;
  ------------------
  |  Branch (2552:16): [True: 728, False: 1.18k]
  ------------------
 2553|       |
 2554|  1.18k|            if(chunk.length != 1) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2554:16): [True: 644, False: 539]
  ------------------
 2555|       |
 2556|    539|            ctx->srgb_rendering_intent = data[0];
 2557|       |
 2558|    539|            if(ctx->srgb_rendering_intent > 3) return SPNG_ESRGB;
  ------------------
  |  Branch (2558:16): [True: 455, False: 84]
  ------------------
 2559|       |
 2560|     84|            ctx->file.srgb = 1;
 2561|     84|            ctx->stored.srgb = 1;
 2562|     84|        }
 2563|   783k|        else if(!memcmp(chunk.type, type_bkgd, 4))
  ------------------
  |  Branch (2563:17): [True: 20.4k, False: 763k]
  ------------------
 2564|  20.4k|        {
 2565|  20.4k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2565:16): [True: 1.52k, False: 18.9k]
  ------------------
 2566|  18.9k|            if(ctx->file.bkgd) return SPNG_EDUP_BKGD;
  ------------------
  |  Branch (2566:16): [True: 9.21k, False: 9.73k]
  ------------------
 2567|       |
 2568|  9.73k|            if(ctx->ihdr.color_type == 0 || ctx->ihdr.color_type == 4)
  ------------------
  |  Branch (2568:16): [True: 2.07k, False: 7.65k]
  |  Branch (2568:45): [True: 511, False: 7.14k]
  ------------------
 2569|  2.58k|            {
 2570|  2.58k|                if(chunk.length != 2) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2570:20): [True: 1.88k, False: 700]
  ------------------
 2571|       |
 2572|    700|                ctx->bkgd.gray = read_u16(data);
 2573|    700|            }
 2574|  7.14k|            else if(ctx->ihdr.color_type == 2 || ctx->ihdr.color_type == 6)
  ------------------
  |  Branch (2574:21): [True: 1.14k, False: 6.00k]
  |  Branch (2574:50): [True: 1.00k, False: 4.99k]
  ------------------
 2575|  2.14k|            {
 2576|  2.14k|                if(chunk.length != 6) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2576:20): [True: 1.87k, False: 273]
  ------------------
 2577|       |
 2578|    273|                ctx->bkgd.red = read_u16(data);
 2579|    273|                ctx->bkgd.green = read_u16(data + 2);
 2580|    273|                ctx->bkgd.blue = read_u16(data + 4);
 2581|    273|            }
 2582|  4.99k|            else if(ctx->ihdr.color_type == 3)
  ------------------
  |  Branch (2582:21): [True: 4.99k, False: 0]
  ------------------
 2583|  4.99k|            {
 2584|  4.99k|                if(chunk.length != 1) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2584:20): [True: 1.24k, False: 3.75k]
  ------------------
 2585|  3.75k|                if(!ctx->file.plte) return SPNG_EBKGD_NO_PLTE;
  ------------------
  |  Branch (2585:20): [True: 1.99k, False: 1.75k]
  ------------------
 2586|       |
 2587|  1.75k|                ctx->bkgd.plte_index = data[0];
 2588|  1.75k|                if(ctx->bkgd.plte_index >= ctx->plte.n_entries) return SPNG_EBKGD_PLTE_IDX;
  ------------------
  |  Branch (2588:20): [True: 1.63k, False: 119]
  ------------------
 2589|  1.75k|            }
 2590|       |
 2591|  1.09k|            ctx->file.bkgd = 1;
 2592|  1.09k|            ctx->stored.bkgd = 1;
 2593|  1.09k|        }
 2594|   763k|        else if(!memcmp(chunk.type, type_trns, 4))
  ------------------
  |  Branch (2594:17): [True: 24.5k, False: 738k]
  ------------------
 2595|  24.5k|        {
 2596|  24.5k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2596:16): [True: 406, False: 24.1k]
  ------------------
 2597|  24.1k|            if(ctx->file.trns) return SPNG_EDUP_TRNS;
  ------------------
  |  Branch (2597:16): [True: 6.06k, False: 18.0k]
  ------------------
 2598|  18.0k|            if(!chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2598:16): [True: 0, False: 18.0k]
  ------------------
 2599|       |
 2600|  18.0k|            if(ctx->ihdr.color_type == 0)
  ------------------
  |  Branch (2600:16): [True: 280, False: 17.8k]
  ------------------
 2601|    280|            {
 2602|    280|                if(chunk.length != 2) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2602:20): [True: 189, False: 91]
  ------------------
 2603|       |
 2604|     91|                ctx->trns.gray = read_u16(data);
 2605|     91|            }
 2606|  17.8k|            else if(ctx->ihdr.color_type == 2)
  ------------------
  |  Branch (2606:21): [True: 16.2k, False: 1.53k]
  ------------------
 2607|  16.2k|            {
 2608|  16.2k|                if(chunk.length != 6) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2608:20): [True: 16.2k, 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|  1.53k|            else if(ctx->ihdr.color_type == 3)
  ------------------
  |  Branch (2614:21): [True: 1.09k, False: 434]
  ------------------
 2615|  1.09k|            {
 2616|  1.09k|                if(chunk.length > ctx->plte.n_entries) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2616:20): [True: 882, False: 217]
  ------------------
 2617|    217|                if(!ctx->file.plte) return SPNG_ETRNS_NO_PLTE;
  ------------------
  |  Branch (2617:20): [True: 0, False: 217]
  ------------------
 2618|       |
 2619|    217|                memcpy(ctx->trns.type3_alpha, data, chunk.length);
 2620|    217|                ctx->trns.n_type3_entries = chunk.length;
 2621|    217|            }
 2622|       |
 2623|    756|            if(ctx->ihdr.color_type == 4 || ctx->ihdr.color_type == 6)  return SPNG_ETRNS_COLOR_TYPE;
  ------------------
  |  Branch (2623:16): [True: 210, False: 546]
  |  Branch (2623:45): [True: 224, False: 322]
  ------------------
 2624|       |
 2625|    322|            ctx->file.trns = 1;
 2626|    322|            ctx->stored.trns = 1;
 2627|    322|        }
 2628|   738k|        else if(!memcmp(chunk.type, type_hist, 4))
  ------------------
  |  Branch (2628:17): [True: 6.74k, False: 731k]
  ------------------
 2629|  6.74k|        {
 2630|  6.74k|            if(!ctx->file.plte) return SPNG_EHIST_NO_PLTE;
  ------------------
  |  Branch (2630:16): [True: 3.52k, False: 3.22k]
  ------------------
 2631|  3.22k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2631:16): [True: 112, False: 3.10k]
  ------------------
 2632|  3.10k|            if(ctx->file.hist) return SPNG_EDUP_HIST;
  ------------------
  |  Branch (2632:16): [True: 308, False: 2.80k]
  ------------------
 2633|       |
 2634|  2.80k|            if( (chunk.length / 2) != (ctx->plte.n_entries) ) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2634:17): [True: 2.73k, False: 70]
  ------------------
 2635|       |
 2636|     70|            size_t k;
 2637|    476|            for(k=0; k < (chunk.length / 2); k++)
  ------------------
  |  Branch (2637:22): [True: 406, False: 70]
  ------------------
 2638|    406|            {
 2639|    406|                ctx->hist.frequency[k] = read_u16(data + k*2);
 2640|    406|            }
 2641|       |
 2642|     70|            ctx->file.hist = 1;
 2643|     70|            ctx->stored.hist = 1;
 2644|     70|        }
 2645|   731k|        else if(!memcmp(chunk.type, type_phys, 4))
  ------------------
  |  Branch (2645:17): [True: 6.74k, False: 725k]
  ------------------
 2646|  6.74k|        {
 2647|  6.74k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2647:16): [True: 693, False: 6.05k]
  ------------------
 2648|  6.05k|            if(ctx->file.phys) return SPNG_EDUP_PHYS;
  ------------------
  |  Branch (2648:16): [True: 2.13k, False: 3.92k]
  ------------------
 2649|       |
 2650|  3.92k|            if(chunk.length != 9) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2650:16): [True: 336, False: 3.58k]
  ------------------
 2651|       |
 2652|  3.58k|            ctx->phys.ppu_x = read_u32(data);
 2653|  3.58k|            ctx->phys.ppu_y = read_u32(data + 4);
 2654|  3.58k|            ctx->phys.unit_specifier = data[8];
 2655|       |
 2656|  3.58k|            if(check_phys(&ctx->phys)) return SPNG_EPHYS;
  ------------------
  |  Branch (2656:16): [True: 3.22k, False: 357]
  ------------------
 2657|       |
 2658|    357|            ctx->file.phys = 1;
 2659|    357|            ctx->stored.phys = 1;
 2660|    357|        }
 2661|   725k|        else if(!memcmp(chunk.type, type_time, 4))
  ------------------
  |  Branch (2661:17): [True: 9.76k, False: 715k]
  ------------------
 2662|  9.76k|        {
 2663|  9.76k|            if(ctx->file.time) return SPNG_EDUP_TIME;
  ------------------
  |  Branch (2663:16): [True: 2.56k, False: 7.19k]
  ------------------
 2664|       |
 2665|  7.19k|            if(chunk.length != 7) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2665:16): [True: 350, False: 6.84k]
  ------------------
 2666|       |
 2667|  6.84k|            struct spng_time time;
 2668|       |
 2669|  6.84k|            time.year = read_u16(data);
 2670|  6.84k|            time.month = data[2];
 2671|  6.84k|            time.day = data[3];
 2672|  6.84k|            time.hour = data[4];
 2673|  6.84k|            time.minute = data[5];
 2674|  6.84k|            time.second = data[6];
 2675|       |
 2676|  6.84k|            if(check_time(&time)) return SPNG_ETIME;
  ------------------
  |  Branch (2676:16): [True: 6.50k, False: 343]
  ------------------
 2677|       |
 2678|    343|            ctx->file.time = 1;
 2679|       |
 2680|    343|            if(!ctx->user.time) ctx->time = time;
  ------------------
  |  Branch (2680:16): [True: 343, False: 0]
  ------------------
 2681|       |
 2682|    343|            ctx->stored.time = 1;
 2683|    343|        }
 2684|   715k|        else if(!memcmp(chunk.type, type_offs, 4))
  ------------------
  |  Branch (2684:17): [True: 1.56k, False: 713k]
  ------------------
 2685|  1.56k|        {
 2686|  1.56k|            if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2686:16): [True: 287, False: 1.28k]
  ------------------
 2687|  1.28k|            if(ctx->file.offs) return SPNG_EDUP_OFFS;
  ------------------
  |  Branch (2687:16): [True: 735, False: 546]
  ------------------
 2688|       |
 2689|    546|            if(chunk.length != 9) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2689:16): [True: 287, False: 259]
  ------------------
 2690|       |
 2691|    259|            ctx->offs.x = read_s32(data);
 2692|    259|            ctx->offs.y = read_s32(data + 4);
 2693|    259|            ctx->offs.unit_specifier = data[8];
 2694|       |
 2695|    259|            if(check_offs(&ctx->offs)) return SPNG_EOFFS;
  ------------------
  |  Branch (2695:16): [True: 168, False: 91]
  ------------------
 2696|       |
 2697|     91|            ctx->file.offs = 1;
 2698|     91|            ctx->stored.offs = 1;
 2699|     91|        }
 2700|   713k|        else /* Arbitrary-length chunk */
 2701|   713k|        {
 2702|       |
 2703|   713k|            if(!memcmp(chunk.type, type_exif, 4))
  ------------------
  |  Branch (2703:16): [True: 6.72k, False: 707k]
  ------------------
 2704|  6.72k|            {
 2705|  6.72k|                if(ctx->file.exif) return SPNG_EDUP_EXIF;
  ------------------
  |  Branch (2705:20): [True: 5.50k, False: 1.21k]
  ------------------
 2706|  1.21k|                if(!chunk.length) return SPNG_EEXIF;
  ------------------
  |  Branch (2706:20): [True: 406, False: 812]
  ------------------
 2707|       |
 2708|    812|                ctx->file.exif = 1;
 2709|       |
 2710|    812|                if(ctx->user.exif) goto discard;
  ------------------
  |  Branch (2710:20): [True: 0, False: 812]
  ------------------
 2711|       |
 2712|    812|                if(increase_cache_usage(ctx, chunk.length, 1)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (2712:20): [True: 0, False: 812]
  ------------------
 2713|       |
 2714|    812|                struct spng_exif exif;
 2715|       |
 2716|    812|                exif.length = chunk.length;
 2717|       |
 2718|    812|                exif.data = spng__malloc(ctx, chunk.length);
 2719|    812|                if(exif.data == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2719:20): [True: 0, False: 812]
  ------------------
 2720|       |
 2721|    812|                ret = read_chunk_bytes2(ctx, exif.data, chunk.length);
 2722|    812|                if(ret)
  ------------------
  |  Branch (2722:20): [True: 371, False: 441]
  ------------------
 2723|    371|                {
 2724|    371|                    spng__free(ctx, exif.data);
 2725|    371|                    return ret;
 2726|    371|                }
 2727|       |
 2728|    441|                if(check_exif(&exif))
  ------------------
  |  Branch (2728:20): [True: 427, False: 14]
  ------------------
 2729|    427|                {
 2730|    427|                    spng__free(ctx, exif.data);
 2731|    427|                    return SPNG_EEXIF;
 2732|    427|                }
 2733|       |
 2734|     14|                ctx->exif = exif;
 2735|       |
 2736|     14|                ctx->stored.exif = 1;
 2737|     14|            }
 2738|   707k|            else if(!memcmp(chunk.type, type_iccp, 4))
  ------------------
  |  Branch (2738:21): [True: 22.2k, False: 684k]
  ------------------
 2739|  22.2k|            {/* TODO: add test file with color profile */
 2740|  22.2k|                if(ctx->file.plte) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2740:20): [True: 1.02k, False: 21.2k]
  ------------------
 2741|  21.2k|                if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2741:20): [True: 2.39k, False: 18.8k]
  ------------------
 2742|  18.8k|                if(ctx->file.iccp) return SPNG_EDUP_ICCP;
  ------------------
  |  Branch (2742:20): [True: 14.6k, False: 4.20k]
  ------------------
 2743|  4.20k|                if(!chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2743:20): [True: 644, False: 3.56k]
  ------------------
 2744|       |
 2745|  3.56k|                ctx->file.iccp = 1;
 2746|       |
 2747|  3.56k|                uint32_t peek_bytes =  81 > chunk.length ? chunk.length : 81;
  ------------------
  |  Branch (2747:40): [True: 686, False: 2.87k]
  ------------------
 2748|       |
 2749|  3.56k|                ret = read_chunk_bytes(ctx, peek_bytes);
 2750|  3.56k|                if(ret) return ret;
  ------------------
  |  Branch (2750:20): [True: 252, False: 3.31k]
  ------------------
 2751|       |
 2752|  3.31k|                unsigned char *keyword_nul = memchr(ctx->data, '\0', peek_bytes);
 2753|  3.31k|                if(keyword_nul == NULL) return SPNG_EICCP_NAME;
  ------------------
  |  Branch (2753:20): [True: 7, False: 3.30k]
  ------------------
 2754|       |
 2755|  3.30k|                uint32_t keyword_len = keyword_nul - ctx->data;
 2756|       |
 2757|  3.30k|                if(keyword_len > 79) return SPNG_EICCP_NAME;
  ------------------
  |  Branch (2757:20): [True: 7, False: 3.29k]
  ------------------
 2758|       |
 2759|  3.29k|                memcpy(ctx->iccp.profile_name, ctx->data, keyword_len);
 2760|       |
 2761|  3.29k|                if(check_png_keyword(ctx->iccp.profile_name)) return SPNG_EICCP_NAME;
  ------------------
  |  Branch (2761:20): [True: 105, False: 3.19k]
  ------------------
 2762|       |
 2763|  3.19k|                if(chunk.length < (keyword_len + 2)) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2763:20): [True: 35, False: 3.15k]
  ------------------
 2764|       |
 2765|  3.15k|                if(ctx->data[keyword_len + 1] != 0) return SPNG_EICCP_COMPRESSION_METHOD;
  ------------------
  |  Branch (2765:20): [True: 105, False: 3.05k]
  ------------------
 2766|       |
 2767|  3.05k|                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|  3.05k|                if(ret) return ret;
  ------------------
  |  Branch (2769:20): [True: 2.99k, False: 56]
  ------------------
 2770|       |
 2771|     56|                ctx->stored.iccp = 1;
 2772|     56|            }
 2773|   684k|             else if(!memcmp(chunk.type, type_text, 4) ||
  ------------------
  |  Branch (2773:22): [True: 140k, False: 544k]
  ------------------
 2774|   544k|                     !memcmp(chunk.type, type_ztxt, 4) ||
  ------------------
  |  Branch (2774:22): [True: 248k, False: 295k]
  ------------------
 2775|   295k|                     !memcmp(chunk.type, type_itxt, 4))
  ------------------
  |  Branch (2775:22): [True: 127k, False: 168k]
  ------------------
 2776|   516k|            {
 2777|   516k|                if(!chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2777:20): [True: 297k, False: 218k]
  ------------------
 2778|       |
 2779|   218k|                ctx->file.text = 1;
 2780|       |
 2781|   218k|                if(ctx->user.text) goto discard;
  ------------------
  |  Branch (2781:20): [True: 0, False: 218k]
  ------------------
 2782|       |
 2783|   218k|                if(increase_cache_usage(ctx, sizeof(struct spng_text2), 1)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (2783:20): [True: 7, False: 218k]
  ------------------
 2784|       |
 2785|   218k|                ctx->n_text++;
 2786|   218k|                if(ctx->n_text < 1) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (2786:20): [True: 0, False: 218k]
  ------------------
 2787|   218k|                if(sizeof(struct spng_text2) > SIZE_MAX / ctx->n_text) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (2787:20): [True: 0, False: 218k]
  ------------------
 2788|       |
 2789|   218k|                void *buf = spng__realloc(ctx, ctx->text_list, ctx->n_text * sizeof(struct spng_text2));
 2790|   218k|                if(buf == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2790:20): [True: 0, False: 218k]
  ------------------
 2791|   218k|                ctx->text_list = buf;
 2792|       |
 2793|   218k|                struct spng_text2 *text = &ctx->text_list[ctx->n_text - 1];
 2794|   218k|                memset(text, 0, sizeof(struct spng_text2));
 2795|       |
 2796|   218k|                ctx->undo = text_undo;
 2797|       |
 2798|   218k|                uint32_t text_offset = 0, language_tag_offset = 0, translated_keyword_offset = 0;
 2799|   218k|                uint32_t peek_bytes = 256; /* enough for 3 80-byte keywords and some text bytes */
 2800|   218k|                uint32_t keyword_len;
 2801|       |
 2802|   218k|                if(peek_bytes > chunk.length) peek_bytes = chunk.length;
  ------------------
  |  Branch (2802:20): [True: 210k, False: 8.65k]
  ------------------
 2803|       |
 2804|   218k|                ret = read_chunk_bytes(ctx, peek_bytes);
 2805|   218k|                if(ret) return ret;
  ------------------
  |  Branch (2805:20): [True: 551, False: 218k]
  ------------------
 2806|       |
 2807|   218k|                data = ctx->data;
 2808|       |
 2809|   218k|                const unsigned char *zlib_stream = NULL;
 2810|   218k|                const unsigned char *peek_end = data + peek_bytes;
 2811|   218k|                const unsigned char *keyword_nul = memchr(data, 0, chunk.length > 80 ? 80 : chunk.length);
  ------------------
  |  Branch (2811:68): [True: 8.58k, False: 209k]
  ------------------
 2812|       |
 2813|   218k|                if(keyword_nul == NULL) return SPNG_ETEXT_KEYWORD;
  ------------------
  |  Branch (2813:20): [True: 21.3k, False: 197k]
  ------------------
 2814|       |
 2815|   197k|                keyword_len = keyword_nul - data;
 2816|       |
 2817|   197k|                if(!memcmp(chunk.type, type_text, 4))
  ------------------
  |  Branch (2817:20): [True: 21.5k, False: 175k]
  ------------------
 2818|  21.5k|                {
 2819|  21.5k|                    text->type = SPNG_TEXT;
 2820|       |
 2821|  21.5k|                    text->text_length = chunk.length - keyword_len - 1;
 2822|       |
 2823|  21.5k|                    text_offset = keyword_len;
 2824|       |
 2825|       |                    /* increment past nul if there is a text field */
 2826|  21.5k|                    if(text->text_length) text_offset++;
  ------------------
  |  Branch (2826:24): [True: 12.9k, False: 8.62k]
  ------------------
 2827|  21.5k|                }
 2828|   175k|                else if(!memcmp(chunk.type, type_ztxt, 4))
  ------------------
  |  Branch (2828:25): [True: 157k, False: 18.3k]
  ------------------
 2829|   157k|                {
 2830|   157k|                    text->type = SPNG_ZTXT;
 2831|       |
 2832|   157k|                    if((peek_bytes - keyword_len) <= 2) return SPNG_EZTXT;
  ------------------
  |  Branch (2832:24): [True: 17.3k, False: 139k]
  ------------------
 2833|       |
 2834|   139k|                    if(keyword_nul[1]) return SPNG_EZTXT_COMPRESSION_METHOD;
  ------------------
  |  Branch (2834:24): [True: 4.83k, False: 134k]
  ------------------
 2835|       |
 2836|   134k|                    text->compression_flag = 1;
 2837|       |
 2838|   134k|                    text_offset = keyword_len + 2;
 2839|   134k|                }
 2840|  18.3k|                else if(!memcmp(chunk.type, type_itxt, 4))
  ------------------
  |  Branch (2840:25): [True: 18.3k, False: 0]
  ------------------
 2841|  18.3k|                {
 2842|  18.3k|                    text->type = SPNG_ITXT;
 2843|       |
 2844|       |                    /* at least two 1-byte fields, two >=0 length strings, and one byte of (compressed) text */
 2845|  18.3k|                    if((peek_bytes - keyword_len) < 5) return SPNG_EITXT;
  ------------------
  |  Branch (2845:24): [True: 1.51k, False: 16.8k]
  ------------------
 2846|       |
 2847|  16.8k|                    text->compression_flag = keyword_nul[1];
 2848|       |
 2849|  16.8k|                    if(text->compression_flag > 1) return SPNG_EITXT_COMPRESSION_FLAG;
  ------------------
  |  Branch (2849:24): [True: 2.10k, False: 14.7k]
  ------------------
 2850|       |
 2851|  14.7k|                    if(keyword_nul[2]) return SPNG_EITXT_COMPRESSION_METHOD;
  ------------------
  |  Branch (2851:24): [True: 1.33k, False: 13.3k]
  ------------------
 2852|       |
 2853|  13.3k|                    language_tag_offset = keyword_len + 3;
 2854|       |
 2855|  13.3k|                    const unsigned char *term;
 2856|  13.3k|                    term = memchr(data + language_tag_offset, 0, peek_bytes - language_tag_offset);
 2857|  13.3k|                    if(term == NULL) return SPNG_EITXT_LANG_TAG;
  ------------------
  |  Branch (2857:24): [True: 273, False: 13.0k]
  ------------------
 2858|       |
 2859|  13.0k|                    if((peek_end - term) < 2) return SPNG_EITXT;
  ------------------
  |  Branch (2859:24): [True: 1.40k, False: 11.6k]
  ------------------
 2860|       |
 2861|  11.6k|                    translated_keyword_offset = term - data + 1;
 2862|       |
 2863|  11.6k|                    zlib_stream = memchr(data + translated_keyword_offset, 0, peek_bytes - translated_keyword_offset);
 2864|  11.6k|                    if(zlib_stream == NULL) return SPNG_EITXT;
  ------------------
  |  Branch (2864:24): [True: 567, False: 11.1k]
  ------------------
 2865|  11.1k|                    if(zlib_stream == peek_end) return SPNG_EITXT;
  ------------------
  |  Branch (2865:24): [True: 0, False: 11.1k]
  ------------------
 2866|       |
 2867|  11.1k|                    text_offset = zlib_stream - data + 1;
 2868|  11.1k|                    text->text_length = chunk.length - text_offset;
 2869|  11.1k|                }
 2870|      0|                else return SPNG_EINTERNAL;
 2871|       |
 2872|       |
 2873|   167k|                if(text->compression_flag)
  ------------------
  |  Branch (2873:20): [True: 136k, False: 31.3k]
  ------------------
 2874|   136k|                {
 2875|       |                    /* cache usage = peek_bytes + decompressed text size + nul */
 2876|   136k|                    if(increase_cache_usage(ctx, peek_bytes, 0)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (2876:24): [True: 0, False: 136k]
  ------------------
 2877|       |
 2878|   136k|                    text->keyword = spng__calloc(ctx, 1, peek_bytes);
 2879|   136k|                    if(text->keyword == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2879:24): [True: 0, False: 136k]
  ------------------
 2880|       |
 2881|   136k|                    memcpy(text->keyword, data, peek_bytes);
 2882|       |
 2883|   136k|                    zlib_stream = ctx->data + text_offset;
 2884|       |
 2885|   136k|                    ret = spng__inflate_stream(ctx, &text->text, &text->text_length, 1, zlib_stream, peek_bytes - text_offset);
 2886|       |
 2887|   136k|                    if(ret) return ret;
  ------------------
  |  Branch (2887:24): [True: 54.1k, False: 82.1k]
  ------------------
 2888|       |
 2889|  82.1k|                    text->text[text->text_length - 1] = '\0';
 2890|  82.1k|                    text->cache_usage = text->text_length + peek_bytes;
 2891|  82.1k|                }
 2892|  31.3k|                else
 2893|  31.3k|                {
 2894|  31.3k|                    if(increase_cache_usage(ctx, chunk.length + 1, 0)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (2894:24): [True: 0, False: 31.3k]
  ------------------
 2895|       |
 2896|  31.3k|                    text->keyword = spng__malloc(ctx, chunk.length + 1);
 2897|  31.3k|                    if(text->keyword == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2897:24): [True: 0, False: 31.3k]
  ------------------
 2898|       |
 2899|  31.3k|                    memcpy(text->keyword, data, peek_bytes);
 2900|       |
 2901|  31.3k|                    if(chunk.length > peek_bytes)
  ------------------
  |  Branch (2901:24): [True: 784, False: 30.5k]
  ------------------
 2902|    784|                    {
 2903|    784|                        ret = read_chunk_bytes2(ctx, text->keyword + peek_bytes, chunk.length - peek_bytes);
 2904|    784|                        if(ret) return ret;
  ------------------
  |  Branch (2904:28): [True: 441, False: 343]
  ------------------
 2905|    784|                    }
 2906|       |
 2907|  30.9k|                    text->text = text->keyword + text_offset;
 2908|       |
 2909|  30.9k|                    text->text_length = chunk.length - text_offset;
 2910|       |
 2911|  30.9k|                    text->text[text->text_length] = '\0';
 2912|  30.9k|                    text->cache_usage = chunk.length + 1;
 2913|  30.9k|                }
 2914|       |
 2915|   113k|                if(check_png_keyword(text->keyword)) return SPNG_ETEXT_KEYWORD;
  ------------------
  |  Branch (2915:20): [True: 22.5k, False: 90.4k]
  ------------------
 2916|       |
 2917|  90.4k|                text->text_length = strlen(text->text);
 2918|       |
 2919|  90.4k|                if(text->type != SPNG_ITXT)
  ------------------
  |  Branch (2919:20): [True: 83.7k, False: 6.68k]
  ------------------
 2920|  83.7k|                {
 2921|  83.7k|                    language_tag_offset = keyword_len;
 2922|  83.7k|                    translated_keyword_offset = keyword_len;
 2923|       |
 2924|  83.7k|                    if(ctx->strict && check_png_text(text->text, text->text_length))
  ------------------
  |  Branch (2924:24): [True: 0, False: 83.7k]
  |  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|  83.7k|                }
 2930|       |
 2931|  90.4k|                text->language_tag = text->keyword + language_tag_offset;
 2932|  90.4k|                text->translated_keyword = text->keyword + translated_keyword_offset;
 2933|       |
 2934|  90.4k|                ctx->stored.text = 1;
 2935|  90.4k|            }
 2936|   168k|            else if(!memcmp(chunk.type, type_splt, 4))
  ------------------
  |  Branch (2936:21): [True: 135k, False: 32.3k]
  ------------------
 2937|   135k|            {
 2938|   135k|                if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS;
  ------------------
  |  Branch (2938:20): [True: 9.70k, False: 126k]
  ------------------
 2939|   126k|                if(ctx->user.splt) goto discard; /* XXX: could check profile names for uniqueness */
  ------------------
  |  Branch (2939:20): [True: 0, False: 126k]
  ------------------
 2940|   126k|                if(!chunk.length) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2940:20): [True: 26.4k, False: 99.7k]
  ------------------
 2941|       |
 2942|  99.7k|                ctx->file.splt = 1;
 2943|       |
 2944|       |                /* chunk.length + sizeof(struct spng_splt) + splt->n_entries * sizeof(struct spng_splt_entry) */
 2945|  99.7k|                if(increase_cache_usage(ctx, chunk.length + sizeof(struct spng_splt), 1)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (2945:20): [True: 7, False: 99.7k]
  ------------------
 2946|       |
 2947|  99.7k|                ctx->n_splt++;
 2948|  99.7k|                if(ctx->n_splt < 1) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (2948:20): [True: 0, False: 99.7k]
  ------------------
 2949|  99.7k|                if(sizeof(struct spng_splt) > SIZE_MAX / ctx->n_splt) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (2949:20): [True: 0, False: 99.7k]
  ------------------
 2950|       |
 2951|  99.7k|                void *buf = spng__realloc(ctx, ctx->splt_list, ctx->n_splt * sizeof(struct spng_splt));
 2952|  99.7k|                if(buf == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2952:20): [True: 0, False: 99.7k]
  ------------------
 2953|  99.7k|                ctx->splt_list = buf;
 2954|       |
 2955|  99.7k|                struct spng_splt *splt = &ctx->splt_list[ctx->n_splt - 1];
 2956|       |
 2957|  99.7k|                memset(splt, 0, sizeof(struct spng_splt));
 2958|       |
 2959|  99.7k|                ctx->undo = splt_undo;
 2960|       |
 2961|  99.7k|                void *t = spng__malloc(ctx, chunk.length);
 2962|  99.7k|                if(t == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (2962:20): [True: 0, False: 99.7k]
  ------------------
 2963|       |
 2964|  99.7k|                splt->entries = t; /* simplifies error handling */
 2965|  99.7k|                data = t;
 2966|       |
 2967|  99.7k|                ret = read_chunk_bytes2(ctx, t, chunk.length);
 2968|  99.7k|                if(ret) return ret;
  ------------------
  |  Branch (2968:20): [True: 287, False: 99.4k]
  ------------------
 2969|       |
 2970|  99.4k|                uint32_t keyword_len = chunk.length < 80 ? chunk.length : 80;
  ------------------
  |  Branch (2970:40): [True: 90.8k, False: 8.67k]
  ------------------
 2971|       |
 2972|  99.4k|                const unsigned char *keyword_nul = memchr(data, 0, keyword_len);
 2973|  99.4k|                if(keyword_nul == NULL) return SPNG_ESPLT_NAME;
  ------------------
  |  Branch (2973:20): [True: 17.1k, False: 82.3k]
  ------------------
 2974|       |
 2975|  82.3k|                keyword_len = keyword_nul - data;
 2976|       |
 2977|  82.3k|                memcpy(splt->name, data, keyword_len);
 2978|       |
 2979|  82.3k|                if(check_png_keyword(splt->name)) return SPNG_ESPLT_NAME;
  ------------------
  |  Branch (2979:20): [True: 57.4k, False: 24.8k]
  ------------------
 2980|       |
 2981|  24.8k|                uint32_t j;
 2982|  28.3k|                for(j=0; j < (ctx->n_splt - 1); j++)
  ------------------
  |  Branch (2982:26): [True: 4.94k, False: 23.4k]
  ------------------
 2983|  4.94k|                {
 2984|  4.94k|                    if(!strcmp(ctx->splt_list[j].name, splt->name)) return SPNG_ESPLT_DUP_NAME;
  ------------------
  |  Branch (2984:24): [True: 1.47k, False: 3.47k]
  ------------------
 2985|  4.94k|                }
 2986|       |
 2987|  23.4k|                if( (chunk.length - keyword_len) <= 2) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2987:21): [True: 15.9k, False: 7.49k]
  ------------------
 2988|       |
 2989|  7.49k|                splt->sample_depth = data[keyword_len + 1];
 2990|       |
 2991|  7.49k|                uint32_t entries_len = chunk.length - keyword_len - 2;
 2992|  7.49k|                if(!entries_len) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2992:20): [True: 0, False: 7.49k]
  ------------------
 2993|       |
 2994|  7.49k|                if(splt->sample_depth == 16)
  ------------------
  |  Branch (2994:20): [True: 1.16k, False: 6.32k]
  ------------------
 2995|  1.16k|                {
 2996|  1.16k|                    if(entries_len % 10 != 0) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2996:24): [True: 490, False: 672]
  ------------------
 2997|    672|                    splt->n_entries = entries_len / 10;
 2998|    672|                }
 2999|  6.32k|                else if(splt->sample_depth == 8)
  ------------------
  |  Branch (2999:25): [True: 4.11k, False: 2.21k]
  ------------------
 3000|  4.11k|                {
 3001|  4.11k|                    if(entries_len % 6 != 0) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (3001:24): [True: 280, False: 3.83k]
  ------------------
 3002|  3.83k|                    splt->n_entries = entries_len / 6;
 3003|  3.83k|                }
 3004|  2.21k|                else return SPNG_ESPLT_DEPTH;
 3005|       |
 3006|  4.50k|                if(!splt->n_entries) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (3006:20): [True: 0, False: 4.50k]
  ------------------
 3007|       |
 3008|  4.50k|                size_t list_size = splt->n_entries;
 3009|       |
 3010|  4.50k|                if(list_size > SIZE_MAX / sizeof(struct spng_splt_entry)) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (3010:20): [True: 0, False: 4.50k]
  ------------------
 3011|       |
 3012|  4.50k|                list_size *= sizeof(struct spng_splt_entry);
 3013|       |
 3014|  4.50k|                if(increase_cache_usage(ctx, list_size, 0)) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (3014:20): [True: 0, False: 4.50k]
  ------------------
 3015|       |
 3016|  4.50k|                splt->entries = spng__malloc(ctx, list_size);
 3017|  4.50k|                if(splt->entries == NULL)
  ------------------
  |  Branch (3017:20): [True: 0, False: 4.50k]
  ------------------
 3018|      0|                {
 3019|      0|                    spng__free(ctx, t);
 3020|      0|                    return SPNG_EMEM;
 3021|      0|                }
 3022|       |
 3023|  4.50k|                data = (unsigned char*)t + keyword_len + 2;
 3024|       |
 3025|  4.50k|                uint32_t k;
 3026|  4.50k|                if(splt->sample_depth == 16)
  ------------------
  |  Branch (3026:20): [True: 672, False: 3.83k]
  ------------------
 3027|    672|                {
 3028|  2.25k|                    for(k=0; k < splt->n_entries; k++)
  ------------------
  |  Branch (3028:30): [True: 1.58k, False: 672]
  ------------------
 3029|  1.58k|                    {
 3030|  1.58k|                        splt->entries[k].red =   read_u16(data + k * 10);
 3031|  1.58k|                        splt->entries[k].green = read_u16(data + k * 10 + 2);
 3032|  1.58k|                        splt->entries[k].blue =  read_u16(data + k * 10 + 4);
 3033|  1.58k|                        splt->entries[k].alpha = read_u16(data + k * 10 + 6);
 3034|  1.58k|                        splt->entries[k].frequency = read_u16(data + k * 10 + 8);
 3035|  1.58k|                    }
 3036|    672|                }
 3037|  3.83k|                else if(splt->sample_depth == 8)
  ------------------
  |  Branch (3037:25): [True: 3.83k, False: 0]
  ------------------
 3038|  3.83k|                {
 3039|  27.8k|                    for(k=0; k < splt->n_entries; k++)
  ------------------
  |  Branch (3039:30): [True: 24.0k, False: 3.83k]
  ------------------
 3040|  24.0k|                    {
 3041|  24.0k|                        splt->entries[k].red =   data[k * 6];
 3042|  24.0k|                        splt->entries[k].green = data[k * 6 + 1];
 3043|  24.0k|                        splt->entries[k].blue =  data[k * 6 + 2];
 3044|  24.0k|                        splt->entries[k].alpha = data[k * 6 + 3];
 3045|  24.0k|                        splt->entries[k].frequency = read_u16(data + k * 6 + 4);
 3046|  24.0k|                    }
 3047|  3.83k|                }
 3048|       |
 3049|  4.50k|                spng__free(ctx, t);
 3050|  4.50k|                decrease_cache_usage(ctx, chunk.length);
 3051|       |
 3052|  4.50k|                ctx->stored.splt = 1;
 3053|  4.50k|            }
 3054|  32.3k|            else /* Unknown chunk */
 3055|  32.3k|            {
 3056|  32.3k|                ctx->file.unknown = 1;
 3057|       |
 3058|  32.3k|                if(!ctx->keep_unknown) goto discard;
  ------------------
  |  Branch (3058:20): [True: 32.3k, 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|   127k|discard:
 3106|   127k|            ret = discard_chunk_bytes(ctx, ctx->cur_chunk_bytes_left);
 3107|   127k|            if(ret) return ret;
  ------------------
  |  Branch (3107:16): [True: 1.13k, False: 126k]
  ------------------
 3108|   127k|        }
 3109|       |
 3110|   815k|    }
 3111|       |
 3112|  13.4k|    return ret;
 3113|   708k|}
spng.c:read_header:
 1060|   864k|{
 1061|   864k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1061:8): [True: 0, False: 864k]
  ------------------
 1062|       |
 1063|   864k|    int ret;
 1064|   864k|    struct spng_chunk chunk = { 0 };
 1065|       |
 1066|   864k|    ret = read_and_check_crc(ctx);
 1067|   864k|    if(ret)
  ------------------
  |  Branch (1067:8): [True: 278k, False: 585k]
  ------------------
 1068|   278k|    {
 1069|   278k|        if(ret == -SPNG_CRC_DISCARD)
  ------------------
  |  Branch (1069:12): [True: 277k, False: 1.25k]
  ------------------
 1070|   277k|        {
 1071|   277k|            ctx->discard = 1;
 1072|   277k|        }
 1073|  1.25k|        else return ret;
 1074|   278k|    }
 1075|       |
 1076|   863k|    ret = read_data(ctx, 8);
 1077|   863k|    if(ret) return ret;
  ------------------
  |  Branch (1077:8): [True: 14.4k, False: 848k]
  ------------------
 1078|       |
 1079|   848k|    chunk.offset = ctx->bytes_read - 8;
 1080|       |
 1081|   848k|    chunk.length = read_u32(ctx->data);
 1082|       |
 1083|   848k|    memcpy(&chunk.type, ctx->data + 4, 4);
 1084|       |
 1085|   848k|    if(chunk.length > spng_u32max) return SPNG_ECHUNK_STDLEN;
  ------------------
  |  Branch (1085:8): [True: 504, False: 848k]
  ------------------
 1086|       |
 1087|   848k|    ctx->cur_chunk_bytes_left = chunk.length;
 1088|       |
 1089|   848k|    if(is_critical_chunk(&chunk) && ctx->crc_action_critical == SPNG_CRC_USE) ctx->skip_crc = 1;
  ------------------
  |  Branch (1089:8): [True: 36.1k, False: 811k]
  |  Branch (1089:37): [True: 0, False: 36.1k]
  ------------------
 1090|   848k|    else if(ctx->crc_action_ancillary == SPNG_CRC_USE) ctx->skip_crc = 1;
  ------------------
  |  Branch (1090:13): [True: 0, False: 848k]
  ------------------
 1091|   848k|    else ctx->skip_crc = 0;
 1092|       |
 1093|   848k|    if(!ctx->skip_crc)
  ------------------
  |  Branch (1093:8): [True: 848k, False: 0]
  ------------------
 1094|   848k|    {
 1095|   848k|        ctx->cur_actual_crc = crc32(0, NULL, 0);
  ------------------
  |  |   46|   848k|#  define crc32                 z_crc32
  ------------------
 1096|   848k|        ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, chunk.type, 4);
  ------------------
  |  |   46|   848k|#  define crc32                 z_crc32
  ------------------
 1097|   848k|    }
 1098|       |
 1099|   848k|    ctx->current_chunk = chunk;
 1100|       |
 1101|   848k|    return 0;
 1102|   848k|}
spng.c:is_small_chunk:
 2262|   816k|{
 2263|   816k|    if(!memcmp(type, type_plte, 4)) return 1;
  ------------------
  |  Branch (2263:8): [True: 2.33k, False: 814k]
  ------------------
 2264|   814k|    else if(!memcmp(type, type_chrm, 4)) return 1;
  ------------------
  |  Branch (2264:13): [True: 2.50k, False: 811k]
  ------------------
 2265|   811k|    else if(!memcmp(type, type_gama, 4)) return 1;
  ------------------
  |  Branch (2265:13): [True: 13.4k, False: 798k]
  ------------------
 2266|   798k|    else if(!memcmp(type, type_sbit, 4)) return 1;
  ------------------
  |  Branch (2266:13): [True: 9.13k, False: 788k]
  ------------------
 2267|   788k|    else if(!memcmp(type, type_srgb, 4)) return 1;
  ------------------
  |  Branch (2267:13): [True: 2.33k, False: 786k]
  ------------------
 2268|   786k|    else if(!memcmp(type, type_bkgd, 4)) return 1;
  ------------------
  |  Branch (2268:13): [True: 20.5k, False: 766k]
  ------------------
 2269|   766k|    else if(!memcmp(type, type_trns, 4)) return 1;
  ------------------
  |  Branch (2269:13): [True: 25.1k, False: 740k]
  ------------------
 2270|   740k|    else if(!memcmp(type, type_hist, 4)) return 1;
  ------------------
  |  Branch (2270:13): [True: 6.76k, False: 734k]
  ------------------
 2271|   734k|    else if(!memcmp(type, type_phys, 4)) return 1;
  ------------------
  |  Branch (2271:13): [True: 6.77k, False: 727k]
  ------------------
 2272|   727k|    else if(!memcmp(type, type_time, 4)) return 1;
  ------------------
  |  Branch (2272:13): [True: 9.84k, False: 717k]
  ------------------
 2273|   717k|    else if(!memcmp(type, type_offs, 4)) return 1;
  ------------------
  |  Branch (2273:13): [True: 1.60k, False: 715k]
  ------------------
 2274|   715k|    else return 0;
 2275|   816k|}
spng.c:read_and_check_crc:
 1029|   864k|{
 1030|   864k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1030:8): [True: 0, False: 864k]
  ------------------
 1031|       |
 1032|   864k|    int ret;
 1033|   864k|    ret = read_data(ctx, 4);
 1034|   864k|    if(ret) return ret;
  ------------------
  |  Branch (1034:8): [True: 12.8k, False: 851k]
  ------------------
 1035|       |
 1036|   851k|    ctx->current_chunk.crc = read_u32(ctx->data);
 1037|       |
 1038|   851k|    if(ctx->skip_crc) return 0;
  ------------------
  |  Branch (1038:8): [True: 0, False: 851k]
  ------------------
 1039|       |
 1040|   851k|    if(ctx->cur_actual_crc != ctx->current_chunk.crc)
  ------------------
  |  Branch (1040:8): [True: 266k, False: 585k]
  ------------------
 1041|   266k|    {
 1042|   266k|        if(is_critical_chunk(&ctx->current_chunk))
  ------------------
  |  Branch (1042:12): [True: 1.56k, False: 264k]
  ------------------
 1043|  1.56k|        {
 1044|  1.56k|            if(ctx->crc_action_critical == SPNG_CRC_USE) return 0;
  ------------------
  |  Branch (1044:16): [True: 0, False: 1.56k]
  ------------------
 1045|  1.56k|        }
 1046|   264k|        else
 1047|   264k|        {
 1048|   264k|            if(ctx->crc_action_ancillary == SPNG_CRC_USE) return 0;
  ------------------
  |  Branch (1048:16): [True: 0, False: 264k]
  ------------------
 1049|   264k|            if(ctx->crc_action_ancillary == SPNG_CRC_DISCARD) return -SPNG_CRC_DISCARD;
  ------------------
  |  Branch (1049:16): [True: 264k, False: 0]
  ------------------
 1050|   264k|        }
 1051|       |
 1052|  1.56k|        return SPNG_ECHUNK_CRC;
 1053|   266k|    }
 1054|       |
 1055|   585k|    return 0;
 1056|   851k|}
spng.c:read_s32:
  462|    518|{
  463|    518|    int32_t ret = (int32_t)read_u32(src);
  464|       |
  465|    518|    return ret;
  466|    518|}
spng.c:increase_cache_usage:
  723|   573k|{
  724|   573k|    if(ctx == NULL || !bytes) return SPNG_EINTERNAL;
  ------------------
  |  Branch (724:8): [True: 0, False: 573k]
  |  Branch (724:23): [True: 0, False: 573k]
  ------------------
  725|       |
  726|   573k|    if(new_chunk)
  ------------------
  |  Branch (726:8): [True: 319k, False: 254k]
  ------------------
  727|   319k|    {
  728|   319k|        ctx->chunk_count_total++;
  729|   319k|        if(ctx->chunk_count_total < 1) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (729:12): [True: 0, False: 319k]
  ------------------
  730|       |
  731|   319k|        if(ctx->chunk_count_total > ctx->chunk_count_limit) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (731:12): [True: 14, False: 319k]
  ------------------
  732|   319k|    }
  733|       |
  734|   573k|    size_t new_usage = ctx->chunk_cache_usage + bytes;
  735|       |
  736|   573k|    if(new_usage < ctx->chunk_cache_usage) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (736:8): [True: 0, False: 573k]
  ------------------
  737|       |
  738|   573k|    if(new_usage > ctx->chunk_cache_limit) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (738:8): [True: 0, False: 573k]
  ------------------
  739|       |
  740|   573k|    ctx->chunk_cache_usage = new_usage;
  741|       |
  742|   573k|    return 0;
  743|   573k|}
spng.c:read_chunk_bytes2:
 1125|   101k|{
 1126|   101k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1126:8): [True: 0, False: 101k]
  ------------------
 1127|   101k|    if(!ctx->cur_chunk_bytes_left || !bytes) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1127:8): [True: 0, False: 101k]
  |  Branch (1127:38): [True: 0, False: 101k]
  ------------------
 1128|   101k|    if(bytes > ctx->cur_chunk_bytes_left) return SPNG_EINTERNAL; /* XXX: more specific error? */
  ------------------
  |  Branch (1128:8): [True: 0, False: 101k]
  ------------------
 1129|       |
 1130|   101k|    int ret;
 1131|   101k|    uint32_t len = bytes;
 1132|       |
 1133|   101k|    if(ctx->streaming && len > SPNG_READ_SIZE) len = SPNG_READ_SIZE;
  ------------------
  |  |   30|   101k|#define SPNG_READ_SIZE (8192)
  ------------------
                  if(ctx->streaming && len > SPNG_READ_SIZE) len = SPNG_READ_SIZE;
  ------------------
  |  |   30|  1.19k|#define SPNG_READ_SIZE (8192)
  ------------------
  |  Branch (1133:8): [True: 101k, False: 0]
  |  Branch (1133:26): [True: 1.19k, False: 100k]
  ------------------
 1134|       |
 1135|   207k|    while(bytes)
  ------------------
  |  Branch (1135:11): [True: 107k, False: 100k]
  ------------------
 1136|   107k|    {
 1137|   107k|        if(len > bytes) len = bytes;
  ------------------
  |  Branch (1137:12): [True: 350, False: 106k]
  ------------------
 1138|       |
 1139|   107k|        ret = ctx->read_fn(ctx, ctx->stream_user_ptr, out, len);
 1140|   107k|        if(ret) return ret;
  ------------------
  |  Branch (1140:12): [True: 1.09k, False: 106k]
  ------------------
 1141|       |
 1142|   106k|        if(!ctx->streaming) memcpy(out, ctx->data, len);
  ------------------
  |  Branch (1142:12): [True: 0, False: 106k]
  ------------------
 1143|       |
 1144|   106k|        ctx->bytes_read += len;
 1145|   106k|        if(ctx->bytes_read < len) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (1145:12): [True: 0, False: 106k]
  ------------------
 1146|       |
 1147|   106k|        if(!ctx->skip_crc) ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, out, len);
  ------------------
  |  |   46|   106k|#  define crc32                 z_crc32
  ------------------
  |  Branch (1147:12): [True: 106k, False: 0]
  ------------------
 1148|       |
 1149|   106k|        ctx->cur_chunk_bytes_left -= len;
 1150|       |
 1151|   106k|        out = (char*)out + len;
 1152|   106k|        bytes -= len;
 1153|   106k|        len = SPNG_READ_SIZE;
  ------------------
  |  |   30|   106k|#define SPNG_READ_SIZE (8192)
  ------------------
 1154|   106k|    }
 1155|       |
 1156|   100k|    return 0;
 1157|   101k|}
spng.c:spng__inflate_stream:
 1254|   139k|{
 1255|   139k|    int ret = spng__inflate_init(ctx, 15);
 1256|   139k|    if(ret) return ret;
  ------------------
  |  Branch (1256:8): [True: 0, False: 139k]
  ------------------
 1257|       |
 1258|   139k|    size_t max = ctx->chunk_cache_limit - ctx->chunk_cache_usage;
 1259|       |
 1260|   139k|    if(ctx->max_chunk_size < max) max = ctx->max_chunk_size;
  ------------------
  |  Branch (1260:8): [True: 139k, False: 0]
  ------------------
 1261|       |
 1262|   139k|    if(extra > max) return SPNG_ECHUNK_LIMITS;
  ------------------
  |  Branch (1262:8): [True: 0, False: 139k]
  ------------------
 1263|   139k|    max -= extra;
 1264|       |
 1265|   139k|    uint32_t read_size;
 1266|   139k|    size_t size = 8 * 1024;
 1267|   139k|    void *t, *buf = spng__malloc(ctx, size);
 1268|       |
 1269|   139k|    if(buf == NULL) return SPNG_EMEM;
  ------------------
  |  Branch (1269:8): [True: 0, False: 139k]
  ------------------
 1270|       |
 1271|   139k|    z_stream *stream = &ctx->zstream;
 1272|       |
 1273|   139k|    if(start_buf != NULL && start_len)
  ------------------
  |  Branch (1273:8): [True: 139k, False: 0]
  |  Branch (1273:29): [True: 137k, False: 1.34k]
  ------------------
 1274|   137k|    {
 1275|   137k|        stream->avail_in = (uInt)start_len;
 1276|   137k|        stream->next_in = start_buf;
 1277|   137k|    }
 1278|  1.34k|    else
 1279|  1.34k|    {
 1280|  1.34k|        stream->avail_in = 0;
 1281|  1.34k|        stream->next_in = NULL;
 1282|  1.34k|    }
 1283|       |
 1284|   139k|    stream->avail_out = (uInt)size;
 1285|   139k|    stream->next_out = buf;
 1286|       |
 1287|   187k|    while(ret != Z_STREAM_END)
  ------------------
  |  |  182|   187k|#define Z_STREAM_END    1
  ------------------
  |  Branch (1287:11): [True: 187k, False: 0]
  ------------------
 1288|   187k|    {
 1289|   187k|        ret = inflate(stream, Z_NO_FLUSH);
  ------------------
  |  |  114|   187k|#  define inflate               z_inflate
  ------------------
                      ret = inflate(stream, Z_NO_FLUSH);
  ------------------
  |  |  172|   187k|#define Z_NO_FLUSH      0
  ------------------
 1290|       |
 1291|   187k|        if(ret == Z_STREAM_END) break;
  ------------------
  |  |  182|   187k|#define Z_STREAM_END    1
  ------------------
  |  Branch (1291:12): [True: 82.9k, False: 104k]
  ------------------
 1292|       |
 1293|   104k|        if(ret != Z_OK && ret != Z_BUF_ERROR)
  ------------------
  |  |  181|   209k|#define Z_OK            0
  ------------------
                      if(ret != Z_OK && ret != Z_BUF_ERROR)
  ------------------
  |  |  188|  40.2k|#define Z_BUF_ERROR    (-5)
  ------------------
  |  Branch (1293:12): [True: 40.2k, False: 64.3k]
  |  Branch (1293:27): [True: 38.9k, False: 1.35k]
  ------------------
 1294|  38.9k|        {
 1295|  38.9k|            ret = SPNG_EZLIB;
 1296|  38.9k|            goto err;
 1297|  38.9k|        }
 1298|       |
 1299|  65.7k|        if(!stream->avail_out) /* Resize buffer */
  ------------------
  |  Branch (1299:12): [True: 32.7k, False: 33.0k]
  ------------------
 1300|  32.7k|        {
 1301|       |            /* overflow or reached chunk/cache limit */
 1302|  32.7k|            if( (2 > SIZE_MAX / size) || (size > max / 2) )
  ------------------
  |  Branch (1302:17): [True: 0, False: 32.7k]
  |  Branch (1302:42): [True: 0, False: 32.7k]
  ------------------
 1303|      0|            {
 1304|      0|                ret = SPNG_ECHUNK_LIMITS;
 1305|      0|                goto err;
 1306|      0|            }
 1307|       |
 1308|  32.7k|            size *= 2;
 1309|       |
 1310|  32.7k|            t = spng__realloc(ctx, buf, size);
 1311|  32.7k|            if(t == NULL) goto mem;
  ------------------
  |  Branch (1311:16): [True: 0, False: 32.7k]
  ------------------
 1312|       |
 1313|  32.7k|            buf = t;
 1314|       |
 1315|  32.7k|            stream->avail_out = (uInt)size / 2;
 1316|  32.7k|            stream->next_out = (unsigned char*)buf + size / 2;
 1317|  32.7k|        }
 1318|  33.0k|        else if(!stream->avail_in) /* Read more chunk bytes */
  ------------------
  |  Branch (1318:17): [True: 33.0k, False: 0]
  ------------------
 1319|  33.0k|        {
 1320|  33.0k|            read_size = ctx->cur_chunk_bytes_left;
 1321|  33.0k|            if(ctx->streaming && read_size > SPNG_READ_SIZE) read_size = SPNG_READ_SIZE;
  ------------------
  |  |   30|  33.0k|#define SPNG_READ_SIZE (8192)
  ------------------
                          if(ctx->streaming && read_size > SPNG_READ_SIZE) read_size = SPNG_READ_SIZE;
  ------------------
  |  |   30|  10.8k|#define SPNG_READ_SIZE (8192)
  ------------------
  |  Branch (1321:16): [True: 33.0k, False: 0]
  |  Branch (1321:34): [True: 10.8k, False: 22.2k]
  ------------------
 1322|       |
 1323|  33.0k|            ret = read_chunk_bytes(ctx, read_size);
 1324|       |
 1325|  33.0k|            if(ret)
  ------------------
  |  Branch (1325:16): [True: 17.3k, False: 15.6k]
  ------------------
 1326|  17.3k|            {
 1327|  17.3k|                if(!read_size) ret = SPNG_EZLIB;
  ------------------
  |  Branch (1327:20): [True: 16.1k, False: 1.19k]
  ------------------
 1328|       |
 1329|  17.3k|                goto err;
 1330|  17.3k|            }
 1331|       |
 1332|  15.6k|            stream->avail_in = read_size;
 1333|  15.6k|            stream->next_in = ctx->data;
 1334|  15.6k|        }
 1335|  65.7k|    }
 1336|       |
 1337|  82.9k|    size = stream->total_out;
 1338|       |
 1339|  82.9k|    if(!size)
  ------------------
  |  Branch (1339:8): [True: 812, False: 82.1k]
  ------------------
 1340|    812|    {
 1341|    812|        ret = SPNG_EZLIB;
 1342|    812|        goto err;
 1343|    812|    }
 1344|       |
 1345|  82.1k|    size += extra;
 1346|  82.1k|    if(size < extra) goto mem;
  ------------------
  |  Branch (1346:8): [True: 0, False: 82.1k]
  ------------------
 1347|       |
 1348|  82.1k|    t = spng__realloc(ctx, buf, size);
 1349|  82.1k|    if(t == NULL) goto mem;
  ------------------
  |  Branch (1349:8): [True: 0, False: 82.1k]
  ------------------
 1350|       |
 1351|  82.1k|    buf = t;
 1352|       |
 1353|  82.1k|    (void)increase_cache_usage(ctx, size, 0);
 1354|       |
 1355|  82.1k|    *out = buf;
 1356|  82.1k|    *len = size;
 1357|       |
 1358|  82.1k|    return 0;
 1359|       |
 1360|      0|mem:
 1361|      0|    ret = SPNG_EMEM;
 1362|  57.1k|err:
 1363|  57.1k|    spng__free(ctx, buf);
 1364|  57.1k|    return ret;
 1365|      0|}
spng.c:spng__realloc:
  416|   433k|{
  417|   433k|    return ctx->alloc.realloc_fn(ptr, size);
  418|   433k|}
spng.c:text_undo:
 2341|   132k|{
 2342|   132k|    struct spng_text2 *text = &ctx->text_list[ctx->n_text - 1];
 2343|       |
 2344|   132k|    spng__free(ctx, text->keyword);
 2345|   132k|    if(text->compression_flag) spng__free(ctx, text->text);
  ------------------
  |  Branch (2345:8): [True: 58.9k, False: 73.2k]
  ------------------
 2346|       |
 2347|   132k|    decrease_cache_usage(ctx, text->cache_usage);
 2348|   132k|    decrease_cache_usage(ctx, sizeof(struct spng_text2));
 2349|       |
 2350|   132k|    text->keyword = NULL;
 2351|   132k|    text->text = NULL;
 2352|       |
 2353|   132k|    ctx->n_text--;
 2354|   132k|}
spng.c:splt_undo:
 2327|  98.8k|{
 2328|  98.8k|    struct spng_splt *splt = &ctx->splt_list[ctx->n_splt - 1];
 2329|       |
 2330|  98.8k|    spng__free(ctx, splt->entries);
 2331|       |
 2332|  98.8k|    decrease_cache_usage(ctx, sizeof(struct spng_splt));
 2333|  98.8k|    decrease_cache_usage(ctx, splt->n_entries * sizeof(struct spng_splt_entry));
 2334|       |
 2335|  98.8k|    splt->entries = NULL;
 2336|       |
 2337|  98.8k|    ctx->n_splt--;
 2338|  98.8k|}
spng.c:decrease_cache_usage:
  746|   466k|{
  747|   466k|    if(ctx == NULL || !usage) return SPNG_EINTERNAL;
  ------------------
  |  Branch (747:8): [True: 0, False: 466k]
  |  Branch (747:23): [True: 199k, False: 267k]
  ------------------
  748|   267k|    if(usage > ctx->chunk_cache_usage) return SPNG_EINTERNAL;
  ------------------
  |  Branch (748:8): [True: 0, False: 267k]
  ------------------
  749|       |
  750|   267k|    ctx->chunk_cache_usage -= usage;
  751|       |
  752|   267k|    return 0;
  753|   267k|}
spng.c:is_critical_chunk:
  756|  2.75M|{
  757|  2.75M|    if(chunk == NULL) return 0;
  ------------------
  |  Branch (757:8): [True: 0, False: 2.75M]
  ------------------
  758|  2.75M|    if((chunk->type[0] & (1 << 5)) == 0) return 1;
  ------------------
  |  Branch (758:8): [True: 51.7k, False: 2.70M]
  ------------------
  759|       |
  760|  2.70M|    return 0;
  761|  2.75M|}
spng.c:check_decode_fmt:
  639|  9.58k|{
  640|  9.58k|    switch(fmt)
  641|  9.58k|    {
  642|      0|        case SPNG_FMT_RGBA8:
  ------------------
  |  Branch (642:9): [True: 0, False: 9.58k]
  ------------------
  643|      0|        case SPNG_FMT_RGBA16:
  ------------------
  |  Branch (643:9): [True: 0, False: 9.58k]
  ------------------
  644|      0|        case SPNG_FMT_RGB8:
  ------------------
  |  Branch (644:9): [True: 0, False: 9.58k]
  ------------------
  645|  9.58k|        case SPNG_FMT_PNG:
  ------------------
  |  Branch (645:9): [True: 9.58k, False: 0]
  ------------------
  646|  9.58k|        case SPNG_FMT_RAW:
  ------------------
  |  Branch (646:9): [True: 0, False: 9.58k]
  ------------------
  647|  9.58k|            return 0;
  648|      0|        case SPNG_FMT_G8:
  ------------------
  |  Branch (648:9): [True: 0, False: 9.58k]
  ------------------
  649|      0|        case SPNG_FMT_GA8:
  ------------------
  |  Branch (649:9): [True: 0, False: 9.58k]
  ------------------
  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: 9.58k]
  ------------------
  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: 9.58k]
  ------------------
  656|  9.58k|    }
  657|  9.58k|}
spng.c:calculate_image_width:
  660|  9.58k|{
  661|  9.58k|    if(ihdr == NULL || len == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (661:8): [True: 0, False: 9.58k]
  |  Branch (661:24): [True: 0, False: 9.58k]
  ------------------
  662|       |
  663|  9.58k|    size_t res = ihdr->width;
  664|  9.58k|    unsigned bytes_per_pixel;
  665|       |
  666|  9.58k|    switch(fmt)
  667|  9.58k|    {
  668|      0|        case SPNG_FMT_RGBA8:
  ------------------
  |  Branch (668:9): [True: 0, False: 9.58k]
  ------------------
  669|      0|        case SPNG_FMT_GA16:
  ------------------
  |  Branch (669:9): [True: 0, False: 9.58k]
  ------------------
  670|      0|            bytes_per_pixel = 4;
  671|      0|            break;
  672|      0|        case SPNG_FMT_RGBA16:
  ------------------
  |  Branch (672:9): [True: 0, False: 9.58k]
  ------------------
  673|      0|            bytes_per_pixel = 8;
  674|      0|            break;
  675|      0|        case SPNG_FMT_RGB8:
  ------------------
  |  Branch (675:9): [True: 0, False: 9.58k]
  ------------------
  676|      0|            bytes_per_pixel = 3;
  677|      0|            break;
  678|  9.58k|        case SPNG_FMT_PNG:
  ------------------
  |  Branch (678:9): [True: 9.58k, False: 0]
  ------------------
  679|  9.58k|        case SPNG_FMT_RAW:
  ------------------
  |  Branch (679:9): [True: 0, False: 9.58k]
  ------------------
  680|  9.58k|        {
  681|  9.58k|            int ret = calculate_scanline_width(ihdr, ihdr->width, &res);
  682|  9.58k|            if(ret) return ret;
  ------------------
  |  Branch (682:16): [True: 0, False: 9.58k]
  ------------------
  683|       |
  684|  9.58k|            res -= 1; /* exclude filter byte */
  685|  9.58k|            bytes_per_pixel = 1;
  686|  9.58k|            break;
  687|  9.58k|        }
  688|      0|        case SPNG_FMT_G8:
  ------------------
  |  Branch (688:9): [True: 0, False: 9.58k]
  ------------------
  689|      0|            bytes_per_pixel = 1;
  690|      0|            break;
  691|      0|        case SPNG_FMT_GA8:
  ------------------
  |  Branch (691:9): [True: 0, False: 9.58k]
  ------------------
  692|      0|            bytes_per_pixel = 2;
  693|      0|            break;
  694|      0|        default: return SPNG_EINTERNAL;
  ------------------
  |  Branch (694:9): [True: 0, False: 9.58k]
  ------------------
  695|  9.58k|    }
  696|       |
  697|  9.58k|    if(res > SIZE_MAX / bytes_per_pixel) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (697:8): [True: 0, False: 9.58k]
  ------------------
  698|  9.58k|    res = res * bytes_per_pixel;
  699|       |
  700|  9.58k|    *len = res;
  701|       |
  702|  9.58k|    return 0;
  703|  9.58k|}
spng.c:calculate_scanline_width:
  571|  78.0k|{
  572|  78.0k|    if(ihdr == NULL || !width) return SPNG_EINTERNAL;
  ------------------
  |  Branch (572:8): [True: 0, False: 78.0k]
  |  Branch (572:24): [True: 0, False: 78.0k]
  ------------------
  573|       |
  574|  78.0k|    size_t res = num_channels(ihdr) * ihdr->bit_depth;
  575|       |
  576|  78.0k|    if(res > SIZE_MAX / width) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (576:8): [True: 0, False: 78.0k]
  ------------------
  577|  78.0k|    res = res * width;
  578|       |
  579|  78.0k|    res += 15; /* Filter byte + 7 for rounding */
  580|       |
  581|  78.0k|    if(res < 15) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (581:8): [True: 0, False: 78.0k]
  ------------------
  582|       |
  583|  78.0k|    res /= 8;
  584|       |
  585|  78.0k|    if(res > UINT32_MAX) return SPNG_EOVERFLOW;
  ------------------
  |  Branch (585:8): [True: 70, False: 77.9k]
  ------------------
  586|       |
  587|  77.9k|    *scanline_width = res;
  588|       |
  589|  77.9k|    return 0;
  590|  78.0k|}
spng.c:read_idat_bytes:
 1369|  33.3k|{
 1370|  33.3k|    if(ctx == NULL || bytes_read == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1370:8): [True: 0, False: 33.3k]
  |  Branch (1370:23): [True: 0, False: 33.3k]
  ------------------
 1371|  33.3k|    if(memcmp(ctx->current_chunk.type, type_idat, 4)) return SPNG_EIDAT_TOO_SHORT;
  ------------------
  |  Branch (1371:8): [True: 0, False: 33.3k]
  ------------------
 1372|       |
 1373|  33.3k|    int ret;
 1374|  33.3k|    uint32_t len;
 1375|       |
 1376|  54.1k|    while(!ctx->cur_chunk_bytes_left)
  ------------------
  |  Branch (1376:11): [True: 23.5k, False: 30.5k]
  ------------------
 1377|  23.5k|    {
 1378|  23.5k|        ret = read_header(ctx);
 1379|  23.5k|        if(ret) return ret;
  ------------------
  |  Branch (1379:12): [True: 2.74k, False: 20.8k]
  ------------------
 1380|       |
 1381|  20.8k|        if(memcmp(ctx->current_chunk.type, type_idat, 4)) return SPNG_EIDAT_TOO_SHORT;
  ------------------
  |  Branch (1381:12): [True: 109, False: 20.7k]
  ------------------
 1382|  20.8k|    }
 1383|       |
 1384|  30.5k|    if(ctx->streaming)
  ------------------
  |  Branch (1384:8): [True: 30.5k, False: 0]
  ------------------
 1385|  30.5k|    {/* TODO: estimate bytes to read for progressive reads */
 1386|  30.5k|        len = SPNG_READ_SIZE;
  ------------------
  |  |   30|  30.5k|#define SPNG_READ_SIZE (8192)
  ------------------
 1387|  30.5k|        if(len > ctx->cur_chunk_bytes_left) len = ctx->cur_chunk_bytes_left;
  ------------------
  |  Branch (1387:12): [True: 29.6k, False: 894]
  ------------------
 1388|  30.5k|    }
 1389|      0|    else len = ctx->current_chunk.length;
 1390|       |
 1391|  30.5k|    ret = read_chunk_bytes(ctx, len);
 1392|       |
 1393|  30.5k|    *bytes_read = len;
 1394|       |
 1395|  30.5k|    return ret;
 1396|  33.3k|}
spng.c:read_u16:
  447|  29.3M|{
  448|  29.3M|    const unsigned char *data = src;
  449|       |
  450|  29.3M|    return (data[0] & 0xFFU) << 8 | (data[1] & 0xFFU);
  451|  29.3M|}
spng.c:spng__inflate_init:
 1190|   148k|{
 1191|   148k|    if(ctx->zstream.state) inflateEnd(&ctx->zstream);
  ------------------
  |  |  121|   132k|#  define inflateEnd            z_inflateEnd
  ------------------
  |  Branch (1191:8): [True: 132k, False: 16.5k]
  ------------------
 1192|       |
 1193|   148k|    ctx->inflate = 1;
  ------------------
  |  |  114|   148k|#  define inflate               z_inflate
  ------------------
 1194|       |
 1195|   148k|    ctx->zstream.zalloc = spng__zalloc;
 1196|   148k|    ctx->zstream.zfree = spng__zfree;
 1197|   148k|    ctx->zstream.opaque = ctx;
 1198|       |
 1199|   148k|    if(inflateInit2(&ctx->zstream, window_bits) != Z_OK) return SPNG_EZLIB_INIT;
  ------------------
  |  |  125|   148k|#  define inflateInit2          z_inflateInit2
  |  |  ------------------
  |  |  |  | 1926|   148k|          inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
  |  |  |  |  ------------------
  |  |  |  |  |  |  126|   148k|#  define inflateInit2_         z_inflateInit2_
  |  |  |  |  ------------------
  |  |  |  |                         inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
  |  |  |  |  ------------------
  |  |  |  |  |  |   44|   148k|#define ZLIB_VERSION "1.3.2"
  |  |  |  |  ------------------
  |  |  |  | 1927|   148k|                        (int)sizeof(z_stream))
  |  |  ------------------
  ------------------
                  if(inflateInit2(&ctx->zstream, window_bits) != Z_OK) return SPNG_EZLIB_INIT;
  ------------------
  |  |  181|   148k|#define Z_OK            0
  ------------------
  |  Branch (1199:8): [True: 0, False: 148k]
  ------------------
 1200|       |
 1201|   148k|#if ZLIB_VERNUM >= 0x1290 && !defined(SPNG_USE_MINIZ)
 1202|       |
 1203|   148k|    int validate = 1;
 1204|       |
 1205|   148k|    if(ctx->flags & SPNG_CTX_IGNORE_ADLER32) validate = 0;
  ------------------
  |  Branch (1205:8): [True: 0, False: 148k]
  ------------------
 1206|       |
 1207|   148k|    if(is_critical_chunk(&ctx->current_chunk))
  ------------------
  |  Branch (1207:8): [True: 9.32k, False: 139k]
  ------------------
 1208|  9.32k|    {
 1209|  9.32k|        if(ctx->crc_action_critical == SPNG_CRC_USE) validate = 0;
  ------------------
  |  Branch (1209:12): [True: 0, False: 9.32k]
  ------------------
 1210|  9.32k|    }
 1211|   139k|    else /* ancillary */
 1212|   139k|    {
 1213|   139k|        if(ctx->crc_action_ancillary == SPNG_CRC_USE) validate = 0;
  ------------------
  |  Branch (1213:12): [True: 0, False: 139k]
  ------------------
 1214|   139k|    }
 1215|       |
 1216|   148k|    if(inflateValidate(&ctx->zstream, validate)) return SPNG_EZLIB_INIT;
  ------------------
  |  |  137|   148k|#  define inflateValidate       z_inflateValidate
  ------------------
  |  Branch (1216:8): [True: 0, False: 148k]
  ------------------
 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|   148k|    return 0;
 1225|   148k|}
spng.c:spng__zalloc:
  430|   173k|{
  431|   173k|    spng_ctx *ctx = opaque;
  432|       |
  433|   173k|    if(size > SIZE_MAX / items) return NULL;
  ------------------
  |  Branch (433:8): [True: 0, False: 173k]
  ------------------
  434|       |
  435|   173k|    size_t len = (size_t)items * size;
  436|       |
  437|   173k|    return spng__malloc(ctx, len);
  438|   173k|}
spng.c:spng__zfree:
  441|   173k|{
  442|   173k|    spng_ctx *ctx = opqaue;
  443|   173k|    spng__free(ctx, ptr);
  444|   173k|}
spng.c:spng__malloc:
  406|   503k|{
  407|   503k|    return ctx->alloc.malloc_fn(size);
  408|   503k|}
spng.c:sample_to_target:
 1722|   369k|{
 1723|   369k|    if(bit_depth == sbits)
  ------------------
  |  Branch (1723:8): [True: 369k, False: 0]
  ------------------
 1724|   369k|    {
 1725|   369k|        if(target == sbits) return sample; /* No scaling */
  ------------------
  |  Branch (1725:12): [True: 369k, False: 0]
  ------------------
 1726|   369k|    }/* 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|   739k|{
 1400|   739k|    if(ctx == NULL || dest == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (1400:8): [True: 0, False: 739k]
  |  Branch (1400:23): [True: 0, False: 739k]
  ------------------
 1401|       |
 1402|   739k|    int ret = Z_OK;
  ------------------
  |  |  181|   739k|#define Z_OK            0
  ------------------
 1403|   739k|    uint32_t bytes_read;
 1404|       |
 1405|   739k|    z_stream *zstream = &ctx->zstream;
 1406|       |
 1407|   739k|    zstream->avail_out = (uInt)len;
 1408|   739k|    zstream->next_out = dest;
 1409|       |
 1410|  1.51M|    while(zstream->avail_out != 0)
  ------------------
  |  Branch (1410:11): [True: 783k, False: 734k]
  ------------------
 1411|   783k|    {
 1412|   783k|        ret = inflate(zstream, Z_NO_FLUSH);
  ------------------
  |  |  114|   783k|#  define inflate               z_inflate
  ------------------
                      ret = inflate(zstream, Z_NO_FLUSH);
  ------------------
  |  |  172|   783k|#define Z_NO_FLUSH      0
  ------------------
 1413|       |
 1414|   783k|        if(ret == Z_OK) continue;
  ------------------
  |  |  181|   783k|#define Z_OK            0
  ------------------
  |  Branch (1414:12): [True: 756k, False: 27.0k]
  ------------------
 1415|       |
 1416|  27.0k|        if(ret == Z_STREAM_END) /* Reached an end-marker */
  ------------------
  |  |  182|  27.0k|#define Z_STREAM_END    1
  ------------------
  |  Branch (1416:12): [True: 1.40k, False: 25.6k]
  ------------------
 1417|  1.40k|        {
 1418|  1.40k|            if(zstream->avail_out != 0) return SPNG_EIDAT_TOO_SHORT;
  ------------------
  |  Branch (1418:16): [True: 19, False: 1.38k]
  ------------------
 1419|  1.40k|        }
 1420|  25.6k|        else if(ret == Z_BUF_ERROR) /* Read more IDAT bytes */
  ------------------
  |  |  188|  25.6k|#define Z_BUF_ERROR    (-5)
  ------------------
  |  Branch (1420:17): [True: 23.8k, False: 1.81k]
  ------------------
 1421|  23.8k|        {
 1422|  23.8k|            ret = read_idat_bytes(ctx, &bytes_read);
 1423|  23.8k|            if(ret) return ret;
  ------------------
  |  Branch (1423:16): [True: 3.04k, False: 20.7k]
  ------------------
 1424|       |
 1425|  20.7k|            zstream->avail_in = bytes_read;
 1426|  20.7k|            zstream->next_in = ctx->data;
 1427|  20.7k|        }
 1428|  1.81k|        else return SPNG_EIDAT_STREAM;
 1429|  27.0k|    }
 1430|       |
 1431|   734k|    return 0;
 1432|   739k|}
spng.c:calculate_subimages:
  593|  31.5k|{
  594|  31.5k|    if(ctx == NULL) return SPNG_EINTERNAL;
  ------------------
  |  Branch (594:8): [True: 0, False: 31.5k]
  ------------------
  595|       |
  596|  31.5k|    struct spng_ihdr *ihdr = &ctx->ihdr;
  597|  31.5k|    struct spng_subimage *sub = ctx->subimage;
  598|       |
  599|  31.5k|    if(ihdr->interlace_method == 1)
  ------------------
  |  Branch (599:8): [True: 6.39k, False: 25.1k]
  ------------------
  600|  6.39k|    {
  601|  6.39k|        sub[0].width = (ihdr->width + 7) >> 3;
  602|  6.39k|        sub[0].height = (ihdr->height + 7) >> 3;
  603|  6.39k|        sub[1].width = (ihdr->width + 3) >> 3;
  604|  6.39k|        sub[1].height = (ihdr->height + 7) >> 3;
  605|  6.39k|        sub[2].width = (ihdr->width + 3) >> 2;
  606|  6.39k|        sub[2].height = (ihdr->height + 3) >> 3;
  607|  6.39k|        sub[3].width = (ihdr->width + 1) >> 2;
  608|  6.39k|        sub[3].height = (ihdr->height + 3) >> 2;
  609|  6.39k|        sub[4].width = (ihdr->width + 1) >> 1;
  610|  6.39k|        sub[4].height = (ihdr->height + 1) >> 2;
  611|  6.39k|        sub[5].width = ihdr->width >> 1;
  612|  6.39k|        sub[5].height = (ihdr->height + 1) >> 1;
  613|  6.39k|        sub[6].width = ihdr->width;
  614|  6.39k|        sub[6].height = ihdr->height >> 1;
  615|  6.39k|    }
  616|  25.1k|    else
  617|  25.1k|    {
  618|  25.1k|        sub[0].width = ihdr->width;
  619|  25.1k|        sub[0].height = ihdr->height;
  620|  25.1k|    }
  621|       |
  622|  31.5k|    int i;
  623|   252k|    for(i=0; i < 7; i++)
  ------------------
  |  Branch (623:14): [True: 220k, False: 31.4k]
  ------------------
  624|   220k|    {
  625|   220k|        if(sub[i].width == 0 || sub[i].height == 0) continue;
  ------------------
  |  Branch (625:12): [True: 152k, False: 68.6k]
  |  Branch (625:33): [True: 252, False: 68.4k]
  ------------------
  626|       |
  627|  68.4k|        int ret = calculate_scanline_width(ihdr, sub[i].width, &sub[i].scanline_width);
  628|  68.4k|        if(ret) return ret;
  ------------------
  |  Branch (628:12): [True: 70, False: 68.3k]
  ------------------
  629|       |
  630|  68.3k|        if(sub[ctx->widest_pass].scanline_width < sub[i].scanline_width) ctx->widest_pass = i;
  ------------------
  |  Branch (630:12): [True: 17.3k, False: 50.9k]
  ------------------
  631|       |
  632|  68.3k|        ctx->last_pass = i;
  633|  68.3k|    }
  634|       |
  635|  31.4k|    return 0;
  636|  31.5k|}
spng.c:num_channels:
  556|  99.8k|{
  557|  99.8k|    switch(ihdr->color_type)
  558|  99.8k|    {
  559|  39.7k|        case SPNG_COLOR_TYPE_TRUECOLOR: return 3;
  ------------------
  |  Branch (559:9): [True: 39.7k, False: 60.1k]
  ------------------
  560|  4.58k|        case SPNG_COLOR_TYPE_GRAYSCALE_ALPHA: return 2;
  ------------------
  |  Branch (560:9): [True: 4.58k, False: 95.2k]
  ------------------
  561|  14.6k|        case SPNG_COLOR_TYPE_TRUECOLOR_ALPHA: return 4;
  ------------------
  |  Branch (561:9): [True: 14.6k, False: 85.2k]
  ------------------
  562|  32.2k|        case SPNG_COLOR_TYPE_GRAYSCALE:
  ------------------
  |  Branch (562:9): [True: 32.2k, False: 67.6k]
  ------------------
  563|  40.8k|        case SPNG_COLOR_TYPE_INDEXED:
  ------------------
  |  Branch (563:9): [True: 8.60k, False: 91.2k]
  ------------------
  564|  40.8k|            return 1;
  565|      0|        default: return 0;
  ------------------
  |  Branch (565:9): [True: 0, False: 99.8k]
  ------------------
  566|  99.8k|    }
  567|  99.8k|}
spng.c:spng__free:
  421|   965k|{
  422|   965k|    ctx->alloc.free_fn(ptr);
  423|   965k|}
spng.c:file_read_fn:
 5050|  2.30M|{
 5051|  2.30M|    FILE *file = user;
 5052|  2.30M|    (void)ctx;
 5053|       |
 5054|  2.30M|    if(fread(data, n, 1, file) != 1)
  ------------------
  |  Branch (5054:8): [True: 35.6k, False: 2.27M]
  ------------------
 5055|  35.6k|    {
 5056|  35.6k|        if(feof(file)) return SPNG_IO_EOF;
  ------------------
  |  Branch (5056:12): [True: 35.6k, False: 0]
  ------------------
 5057|      0|        else return SPNG_IO_ERROR;
 5058|  35.6k|    }
 5059|       |
 5060|  2.27M|    return 0;
 5061|  2.30M|}
spng.c:check_ihdr:
 2043|  32.3k|{
 2044|  32.3k|    if(ihdr->width > spng_u32max || !ihdr->width) return SPNG_EWIDTH;
  ------------------
  |  Branch (2044:8): [True: 217, False: 32.0k]
  |  Branch (2044:37): [True: 7, False: 32.0k]
  ------------------
 2045|  32.0k|    if(ihdr->height > spng_u32max || !ihdr->height) return SPNG_EHEIGHT;
  ------------------
  |  Branch (2045:8): [True: 210, False: 31.8k]
  |  Branch (2045:38): [True: 14, False: 31.8k]
  ------------------
 2046|       |
 2047|  31.8k|    if(ihdr->width > max_width) return SPNG_EUSER_WIDTH;
  ------------------
  |  Branch (2047:8): [True: 0, False: 31.8k]
  ------------------
 2048|  31.8k|    if(ihdr->height > max_height) return SPNG_EUSER_HEIGHT;
  ------------------
  |  Branch (2048:8): [True: 0, False: 31.8k]
  ------------------
 2049|       |
 2050|  31.8k|    switch(ihdr->color_type)
 2051|  31.8k|    {
 2052|  13.0k|        case SPNG_COLOR_TYPE_GRAYSCALE:
  ------------------
  |  Branch (2052:9): [True: 13.0k, False: 18.7k]
  ------------------
 2053|  13.0k|        {
 2054|  13.0k|            if( !(ihdr->bit_depth == 1 || ihdr->bit_depth == 2 ||
  ------------------
  |  Branch (2054:19): [True: 2.77k, False: 10.3k]
  |  Branch (2054:43): [True: 1.30k, False: 9.02k]
  ------------------
 2055|  9.02k|                  ihdr->bit_depth == 4 || ihdr->bit_depth == 8 ||
  ------------------
  |  Branch (2055:19): [True: 1.92k, False: 7.09k]
  |  Branch (2055:43): [True: 5.77k, False: 1.32k]
  ------------------
 2056|  1.32k|                  ihdr->bit_depth == 16) )
  ------------------
  |  Branch (2056:19): [True: 1.23k, False: 91]
  ------------------
 2057|     91|                  return SPNG_EBIT_DEPTH;
 2058|       |
 2059|  13.0k|            break;
 2060|  13.0k|        }
 2061|  13.0k|        case SPNG_COLOR_TYPE_TRUECOLOR:
  ------------------
  |  Branch (2061:9): [True: 9.33k, False: 22.5k]
  ------------------
 2062|  10.7k|        case SPNG_COLOR_TYPE_GRAYSCALE_ALPHA:
  ------------------
  |  Branch (2062:9): [True: 1.44k, False: 30.4k]
  ------------------
 2063|  14.2k|        case SPNG_COLOR_TYPE_TRUECOLOR_ALPHA:
  ------------------
  |  Branch (2063:9): [True: 3.44k, False: 28.4k]
  ------------------
 2064|  14.2k|        {
 2065|  14.2k|            if( !(ihdr->bit_depth == 8 || ihdr->bit_depth == 16) )
  ------------------
  |  Branch (2065:19): [True: 9.06k, False: 5.15k]
  |  Branch (2065:43): [True: 5.11k, False: 49]
  ------------------
 2066|     49|                return SPNG_EBIT_DEPTH;
 2067|       |
 2068|  14.1k|            break;
 2069|  14.2k|        }
 2070|  14.1k|        case SPNG_COLOR_TYPE_INDEXED:
  ------------------
  |  Branch (2070:9): [True: 4.51k, False: 27.3k]
  ------------------
 2071|  4.51k|        {
 2072|  4.51k|            if( !(ihdr->bit_depth == 1 || ihdr->bit_depth == 2 ||
  ------------------
  |  Branch (2072:19): [True: 1.31k, False: 3.19k]
  |  Branch (2072:43): [True: 581, False: 2.61k]
  ------------------
 2073|  2.61k|                  ihdr->bit_depth == 4 || ihdr->bit_depth == 8) )
  ------------------
  |  Branch (2073:19): [True: 1.81k, False: 805]
  |  Branch (2073:43): [True: 728, False: 77]
  ------------------
 2074|     77|                return SPNG_EBIT_DEPTH;
 2075|       |
 2076|  4.43k|            break;
 2077|  4.51k|        }
 2078|  4.43k|        default: return SPNG_ECOLOR_TYPE;
  ------------------
  |  Branch (2078:9): [True: 28, False: 31.8k]
  ------------------
 2079|  31.8k|    }
 2080|       |
 2081|  31.6k|    if(ihdr->compression_method) return SPNG_ECOMPRESSION_METHOD;
  ------------------
  |  Branch (2081:8): [True: 21, False: 31.5k]
  ------------------
 2082|  31.5k|    if(ihdr->filter_method) return SPNG_EFILTER_METHOD;
  ------------------
  |  Branch (2082:8): [True: 35, False: 31.5k]
  ------------------
 2083|       |
 2084|  31.5k|    if(ihdr->interlace_method > 1) return SPNG_EINTERLACE_METHOD;
  ------------------
  |  Branch (2084:8): [True: 21, False: 31.5k]
  ------------------
 2085|       |
 2086|  31.5k|    return 0;
 2087|  31.5k|}
spng.c:check_plte:
 2090|  2.27k|{
 2091|  2.27k|    if(plte == NULL || ihdr == NULL) return 1;
  ------------------
  |  Branch (2091:8): [True: 0, False: 2.27k]
  |  Branch (2091:24): [True: 0, False: 2.27k]
  ------------------
 2092|       |
 2093|  2.27k|    if(plte->n_entries == 0) return 1;
  ------------------
  |  Branch (2093:8): [True: 0, False: 2.27k]
  ------------------
 2094|  2.27k|    if(plte->n_entries > 256) return 1;
  ------------------
  |  Branch (2094:8): [True: 84, False: 2.19k]
  ------------------
 2095|       |
 2096|  2.19k|    if(ihdr->color_type == SPNG_COLOR_TYPE_INDEXED)
  ------------------
  |  Branch (2096:8): [True: 1.37k, False: 812]
  ------------------
 2097|  1.37k|    {
 2098|  1.37k|        if(plte->n_entries > (1U << ihdr->bit_depth)) return 1;
  ------------------
  |  Branch (2098:12): [True: 7, False: 1.37k]
  ------------------
 2099|  1.37k|    }
 2100|       |
 2101|  2.18k|    return 0;
 2102|  2.19k|}
spng.c:check_chrm_int:
 2152|  1.63k|{
 2153|  1.63k|    if(chrm_int == NULL) return 1;
  ------------------
  |  Branch (2153:8): [True: 0, False: 1.63k]
  ------------------
 2154|       |
 2155|  1.63k|    if(chrm_int->white_point_x > spng_u32max ||
  ------------------
  |  Branch (2155:8): [True: 119, False: 1.51k]
  ------------------
 2156|  1.51k|       chrm_int->white_point_y > spng_u32max ||
  ------------------
  |  Branch (2156:8): [True: 119, False: 1.39k]
  ------------------
 2157|  1.39k|       chrm_int->red_x > spng_u32max ||
  ------------------
  |  Branch (2157:8): [True: 161, False: 1.23k]
  ------------------
 2158|  1.23k|       chrm_int->red_y > spng_u32max ||
  ------------------
  |  Branch (2158:8): [True: 119, False: 1.11k]
  ------------------
 2159|  1.11k|       chrm_int->green_x  > spng_u32max ||
  ------------------
  |  Branch (2159:8): [True: 119, False: 994]
  ------------------
 2160|    994|       chrm_int->green_y  > spng_u32max ||
  ------------------
  |  Branch (2160:8): [True: 252, False: 742]
  ------------------
 2161|    742|       chrm_int->blue_x > spng_u32max ||
  ------------------
  |  Branch (2161:8): [True: 133, False: 609]
  ------------------
 2162|  1.27k|       chrm_int->blue_y > spng_u32max) return SPNG_ECHRM;
  ------------------
  |  Branch (2162:8): [True: 252, False: 357]
  ------------------
 2163|       |
 2164|    357|    return 0;
 2165|  1.63k|}
spng.c:check_png_keyword:
 2219|   198k|{
 2220|   198k|    if(str == NULL) return 1;
  ------------------
  |  Branch (2220:8): [True: 0, False: 198k]
  ------------------
 2221|   198k|    size_t len = strlen(str);
 2222|   198k|    const char *end = str + len;
 2223|       |
 2224|   198k|    if(!len) return 1;
  ------------------
  |  Branch (2224:8): [True: 67.2k, False: 131k]
  ------------------
 2225|   131k|    if(len > 79) return 1;
  ------------------
  |  Branch (2225:8): [True: 0, False: 131k]
  ------------------
 2226|   131k|    if(str[0] == ' ') return 1; /* Leading space */
  ------------------
  |  Branch (2226:8): [True: 98, False: 131k]
  ------------------
 2227|   131k|    if(end[-1] == ' ') return 1; /* Trailing space */
  ------------------
  |  Branch (2227:8): [True: 224, False: 131k]
  ------------------
 2228|   131k|    if(strstr(str, "  ") != NULL) return 1; /* Consecutive spaces */
  ------------------
  |  Branch (2228:8): [True: 2.53k, False: 128k]
  ------------------
 2229|       |
 2230|   128k|    uint8_t c;
 2231|   439k|    while(str != end)
  ------------------
  |  Branch (2231:11): [True: 321k, False: 118k]
  ------------------
 2232|   321k|    {
 2233|   321k|        memcpy(&c, str, 1);
 2234|       |
 2235|   321k|        if( (c >= 32 && c <= 126) || (c >= 161) ) str++;
  ------------------
  |  Branch (2235:14): [True: 312k, False: 8.07k]
  |  Branch (2235:25): [True: 233k, False: 79.6k]
  |  Branch (2235:38): [True: 77.7k, False: 9.96k]
  ------------------
 2236|  9.96k|        else return 1; /* Invalid character */
 2237|   321k|    }
 2238|       |
 2239|   118k|    return 0;
 2240|   128k|}
spng.c:check_sbit:
 2105|  4.20k|{
 2106|  4.20k|    if(sbit == NULL || ihdr == NULL) return 1;
  ------------------
  |  Branch (2106:8): [True: 0, False: 4.20k]
  |  Branch (2106:24): [True: 0, False: 4.20k]
  ------------------
 2107|       |
 2108|  4.20k|    if(ihdr->color_type == 0)
  ------------------
  |  Branch (2108:8): [True: 1.37k, False: 2.82k]
  ------------------
 2109|  1.37k|    {
 2110|  1.37k|        if(sbit->grayscale_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2110:12): [True: 658, False: 714]
  ------------------
 2111|    714|        if(sbit->grayscale_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2111:12): [True: 693, False: 21]
  ------------------
 2112|    714|    }
 2113|  2.82k|    else if(ihdr->color_type == 2 || ihdr->color_type == 3)
  ------------------
  |  Branch (2113:13): [True: 273, False: 2.55k]
  |  Branch (2113:38): [True: 707, False: 1.84k]
  ------------------
 2114|    980|    {
 2115|    980|        if(sbit->red_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2115:12): [True: 329, False: 651]
  ------------------
 2116|    651|        if(sbit->green_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2116:12): [True: 84, False: 567]
  ------------------
 2117|    567|        if(sbit->blue_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2117:12): [True: 42, False: 525]
  ------------------
 2118|       |
 2119|    525|        uint8_t bit_depth;
 2120|    525|        if(ihdr->color_type == 3) bit_depth = 8;
  ------------------
  |  Branch (2120:12): [True: 385, False: 140]
  ------------------
 2121|    140|        else bit_depth = ihdr->bit_depth;
 2122|       |
 2123|    525|        if(sbit->red_bits > bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2123:12): [True: 133, False: 392]
  ------------------
 2124|    392|        if(sbit->green_bits > bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2124:12): [True: 245, False: 147]
  ------------------
 2125|    147|        if(sbit->blue_bits > bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2125:12): [True: 119, False: 28]
  ------------------
 2126|    147|    }
 2127|  1.84k|    else if(ihdr->color_type == 4)
  ------------------
  |  Branch (2127:13): [True: 595, False: 1.25k]
  ------------------
 2128|    595|    {
 2129|    595|        if(sbit->grayscale_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2129:12): [True: 210, False: 385]
  ------------------
 2130|    385|        if(sbit->alpha_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2130:12): [True: 98, False: 287]
  ------------------
 2131|       |
 2132|    287|        if(sbit->grayscale_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2132:12): [True: 147, False: 140]
  ------------------
 2133|    140|        if(sbit->alpha_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2133:12): [True: 133, False: 7]
  ------------------
 2134|    140|    }
 2135|  1.25k|    else if(ihdr->color_type == 6)
  ------------------
  |  Branch (2135:13): [True: 1.25k, False: 0]
  ------------------
 2136|  1.25k|    {
 2137|  1.25k|        if(sbit->red_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2137:12): [True: 511, False: 742]
  ------------------
 2138|    742|        if(sbit->green_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2138:12): [True: 77, False: 665]
  ------------------
 2139|    665|        if(sbit->blue_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2139:12): [True: 77, False: 588]
  ------------------
 2140|    588|        if(sbit->alpha_bits == 0) return SPNG_ESBIT;
  ------------------
  |  Branch (2140:12): [True: 77, False: 511]
  ------------------
 2141|       |
 2142|    511|        if(sbit->red_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2142:12): [True: 119, False: 392]
  ------------------
 2143|    392|        if(sbit->green_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2143:12): [True: 119, False: 273]
  ------------------
 2144|    273|        if(sbit->blue_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2144:12): [True: 140, False: 133]
  ------------------
 2145|    133|        if(sbit->alpha_bits > ihdr->bit_depth) return SPNG_ESBIT;
  ------------------
  |  Branch (2145:12): [True: 84, False: 49]
  ------------------
 2146|    133|    }
 2147|       |
 2148|    105|    return 0;
 2149|  4.20k|}
spng.c:spng__calloc:
  411|   136k|{
  412|   136k|    return ctx->alloc.calloc_fn(nmemb, size);
  413|   136k|}
spng.c:check_phys:
 2168|  3.58k|{
 2169|  3.58k|    if(phys == NULL) return 1;
  ------------------
  |  Branch (2169:8): [True: 0, False: 3.58k]
  ------------------
 2170|       |
 2171|  3.58k|    if(phys->unit_specifier > 1) return SPNG_EPHYS;
  ------------------
  |  Branch (2171:8): [True: 2.94k, False: 637]
  ------------------
 2172|       |
 2173|    637|    if(phys->ppu_x > spng_u32max) return SPNG_EPHYS;
  ------------------
  |  Branch (2173:8): [True: 147, False: 490]
  ------------------
 2174|    490|    if(phys->ppu_y > spng_u32max) return SPNG_EPHYS;
  ------------------
  |  Branch (2174:8): [True: 133, False: 357]
  ------------------
 2175|       |
 2176|    357|    return 0;
 2177|    490|}
spng.c:check_time:
 2180|  6.84k|{
 2181|  6.84k|    if(time == NULL) return 1;
  ------------------
  |  Branch (2181:8): [True: 0, False: 6.84k]
  ------------------
 2182|       |
 2183|  6.84k|    if(time->month == 0 || time->month > 12) return 1;
  ------------------
  |  Branch (2183:8): [True: 5.72k, False: 1.12k]
  |  Branch (2183:28): [True: 224, False: 896]
  ------------------
 2184|    896|    if(time->day == 0 || time->day > 31) return 1;
  ------------------
  |  Branch (2184:8): [True: 147, False: 749]
  |  Branch (2184:26): [True: 133, False: 616]
  ------------------
 2185|    616|    if(time->hour > 23) return 1;
  ------------------
  |  Branch (2185:8): [True: 126, False: 490]
  ------------------
 2186|    490|    if(time->minute > 59) return 1;
  ------------------
  |  Branch (2186:8): [True: 42, False: 448]
  ------------------
 2187|    448|    if(time->second > 60) return 1;
  ------------------
  |  Branch (2187:8): [True: 105, False: 343]
  ------------------
 2188|       |
 2189|    343|    return 0;
 2190|    448|}
spng.c:check_offs:
 2193|    259|{
 2194|    259|    if(offs == NULL) return 1;
  ------------------
  |  Branch (2194:8): [True: 0, False: 259]
  ------------------
 2195|       |
 2196|    259|    if(offs->unit_specifier > 1) return 1;
  ------------------
  |  Branch (2196:8): [True: 168, False: 91]
  ------------------
 2197|       |
 2198|     91|    return 0;
 2199|    259|}
spng.c:check_exif:
 2202|    441|{
 2203|    441|    if(exif == NULL) return 1;
  ------------------
  |  Branch (2203:8): [True: 0, False: 441]
  ------------------
 2204|    441|    if(exif->data == NULL) return 1;
  ------------------
  |  Branch (2204:8): [True: 0, False: 441]
  ------------------
 2205|       |
 2206|    441|    if(exif->length < 4) return SPNG_ECHUNK_SIZE;
  ------------------
  |  Branch (2206:8): [True: 35, False: 406]
  ------------------
 2207|    406|    if(exif->length > spng_u32max) return SPNG_ECHUNK_STDLEN;
  ------------------
  |  Branch (2207:8): [True: 0, False: 406]
  ------------------
 2208|       |
 2209|    406|    const uint8_t exif_le[4] = { 73, 73, 42, 0 };
 2210|    406|    const uint8_t exif_be[4] = { 77, 77, 0, 42 };
 2211|       |
 2212|    406|    if(memcmp(exif->data, exif_le, 4) && memcmp(exif->data, exif_be, 4)) return 1;
  ------------------
  |  Branch (2212:8): [True: 399, False: 7]
  |  Branch (2212:42): [True: 392, False: 7]
  ------------------
 2213|       |
 2214|     14|    return 0;
 2215|    406|}

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

z_crc32_z:
  626|  2.29M|uLong ZEXPORT crc32_z(uLong crc, const unsigned char FAR *buf, z_size_t len) {
  627|       |    /* Return initial CRC, if requested. */
  628|  2.29M|    if (buf == Z_NULL) return 0;
  ------------------
  |  |  216|  2.29M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (628:9): [True: 880k, False: 1.41M]
  ------------------
  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|  1.41M|    crc = (~crc) & 0xffffffff;
  636|       |
  637|  1.41M|#ifdef W
  638|       |
  639|       |    /* If provided enough bytes, do a braided CRC calculation. */
  640|  1.41M|    if (len >= N * W + W - 1) {
  ------------------
  |  |   64|  1.41M|#  define N 5
  ------------------
                  if (len >= N * W + W - 1) {
  ------------------
  |  |   90|  1.41M|#      define W 8
  ------------------
                  if (len >= N * W + W - 1) {
  ------------------
  |  |   90|  1.41M|#      define W 8
  ------------------
  |  Branch (640:9): [True: 77.3k, False: 1.34M]
  ------------------
  641|  77.3k|        z_size_t blks;
  642|  77.3k|        z_word_t const *words;
  643|  77.3k|        unsigned endian;
  644|  77.3k|        int k;
  645|       |
  646|       |        /* Compute the CRC up to a z_word_t boundary. */
  647|  77.3k|        while (len && ((z_size_t)buf & (W - 1)) != 0) {
  ------------------
  |  |   90|  77.3k|#      define W 8
  ------------------
  |  Branch (647:16): [True: 77.3k, False: 0]
  |  Branch (647:23): [True: 0, False: 77.3k]
  ------------------
  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|  77.3k|        blks = len / (N * W);
  ------------------
  |  |   64|  77.3k|#  define N 5
  ------------------
                      blks = len / (N * W);
  ------------------
  |  |   90|  77.3k|#      define W 8
  ------------------
  654|  77.3k|        len -= blks * N * W;
  ------------------
  |  |   64|  77.3k|#  define N 5
  ------------------
                      len -= blks * N * W;
  ------------------
  |  |   90|  77.3k|#      define W 8
  ------------------
  655|  77.3k|        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|  77.3k|        endian = 1;
  662|  77.3k|        if (*(unsigned char *)&endian) {
  ------------------
  |  Branch (662:13): [True: 77.3k, False: 0]
  ------------------
  663|       |            /* Little endian. */
  664|       |
  665|  77.3k|            z_crc_t crc0;
  666|  77.3k|            z_word_t word0;
  667|  77.3k|#if N > 1
  668|  77.3k|            z_crc_t crc1;
  669|  77.3k|            z_word_t word1;
  670|  77.3k|#if N > 2
  671|  77.3k|            z_crc_t crc2;
  672|  77.3k|            z_word_t word2;
  673|  77.3k|#if N > 3
  674|  77.3k|            z_crc_t crc3;
  675|  77.3k|            z_word_t word3;
  676|  77.3k|#if N > 4
  677|  77.3k|            z_crc_t crc4;
  678|  77.3k|            z_word_t word4;
  679|       |#if N > 5
  680|       |            z_crc_t crc5;
  681|       |            z_word_t word5;
  682|       |#endif
  683|  77.3k|#endif
  684|  77.3k|#endif
  685|  77.3k|#endif
  686|  77.3k|#endif
  687|       |
  688|       |            /* Initialize the CRC for each braid. */
  689|  77.3k|            crc0 = crc;
  690|  77.3k|#if N > 1
  691|  77.3k|            crc1 = 0;
  692|  77.3k|#if N > 2
  693|  77.3k|            crc2 = 0;
  694|  77.3k|#if N > 3
  695|  77.3k|            crc3 = 0;
  696|  77.3k|#if N > 4
  697|  77.3k|            crc4 = 0;
  698|       |#if N > 5
  699|       |            crc5 = 0;
  700|       |#endif
  701|  77.3k|#endif
  702|  77.3k|#endif
  703|  77.3k|#endif
  704|  77.3k|#endif
  705|       |
  706|       |            /*
  707|       |              Process the first blks-1 blocks, computing the CRCs on each braid
  708|       |              independently.
  709|       |             */
  710|  4.55M|            while (--blks) {
  ------------------
  |  Branch (710:20): [True: 4.47M, False: 77.3k]
  ------------------
  711|       |                /* Load the word for each braid into registers. */
  712|  4.47M|                word0 = crc0 ^ words[0];
  713|  4.47M|#if N > 1
  714|  4.47M|                word1 = crc1 ^ words[1];
  715|  4.47M|#if N > 2
  716|  4.47M|                word2 = crc2 ^ words[2];
  717|  4.47M|#if N > 3
  718|  4.47M|                word3 = crc3 ^ words[3];
  719|  4.47M|#if N > 4
  720|  4.47M|                word4 = crc4 ^ words[4];
  721|       |#if N > 5
  722|       |                word5 = crc5 ^ words[5];
  723|       |#endif
  724|  4.47M|#endif
  725|  4.47M|#endif
  726|  4.47M|#endif
  727|  4.47M|#endif
  728|  4.47M|                words += N;
  ------------------
  |  |   64|  4.47M|#  define N 5
  ------------------
  729|       |
  730|       |                /* Compute and update the CRC for each word. The loop should
  731|       |                   get unrolled. */
  732|  4.47M|                crc0 = crc_braid_table[0][word0 & 0xff];
  733|  4.47M|#if N > 1
  734|  4.47M|                crc1 = crc_braid_table[0][word1 & 0xff];
  735|  4.47M|#if N > 2
  736|  4.47M|                crc2 = crc_braid_table[0][word2 & 0xff];
  737|  4.47M|#if N > 3
  738|  4.47M|                crc3 = crc_braid_table[0][word3 & 0xff];
  739|  4.47M|#if N > 4
  740|  4.47M|                crc4 = crc_braid_table[0][word4 & 0xff];
  741|       |#if N > 5
  742|       |                crc5 = crc_braid_table[0][word5 & 0xff];
  743|       |#endif
  744|  4.47M|#endif
  745|  4.47M|#endif
  746|  4.47M|#endif
  747|  4.47M|#endif
  748|  35.8M|                for (k = 1; k < W; k++) {
  ------------------
  |  |   90|  35.8M|#      define W 8
  ------------------
  |  Branch (748:29): [True: 31.3M, False: 4.47M]
  ------------------
  749|  31.3M|                    crc0 ^= crc_braid_table[k][(word0 >> (k << 3)) & 0xff];
  750|  31.3M|#if N > 1
  751|  31.3M|                    crc1 ^= crc_braid_table[k][(word1 >> (k << 3)) & 0xff];
  752|  31.3M|#if N > 2
  753|  31.3M|                    crc2 ^= crc_braid_table[k][(word2 >> (k << 3)) & 0xff];
  754|  31.3M|#if N > 3
  755|  31.3M|                    crc3 ^= crc_braid_table[k][(word3 >> (k << 3)) & 0xff];
  756|  31.3M|#if N > 4
  757|  31.3M|                    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|  31.3M|#endif
  762|  31.3M|#endif
  763|  31.3M|#endif
  764|  31.3M|#endif
  765|  31.3M|                }
  766|  4.47M|            }
  767|       |
  768|       |            /*
  769|       |              Process the last block, combining the CRCs of the N braids at the
  770|       |              same time.
  771|       |             */
  772|  77.3k|            crc = crc_word(crc0 ^ words[0]);
  773|  77.3k|#if N > 1
  774|  77.3k|            crc = crc_word(crc1 ^ words[1] ^ crc);
  775|  77.3k|#if N > 2
  776|  77.3k|            crc = crc_word(crc2 ^ words[2] ^ crc);
  777|  77.3k|#if N > 3
  778|  77.3k|            crc = crc_word(crc3 ^ words[3] ^ crc);
  779|  77.3k|#if N > 4
  780|  77.3k|            crc = crc_word(crc4 ^ words[4] ^ crc);
  781|       |#if N > 5
  782|       |            crc = crc_word(crc5 ^ words[5] ^ crc);
  783|       |#endif
  784|  77.3k|#endif
  785|  77.3k|#endif
  786|  77.3k|#endif
  787|  77.3k|#endif
  788|  77.3k|            words += N;
  ------------------
  |  |   64|  77.3k|#  define N 5
  ------------------
  789|  77.3k|        }
  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|  77.3k|        buf = (unsigned char const *)words;
  918|  77.3k|    }
  919|       |
  920|  1.41M|#endif /* W */
  921|       |
  922|       |    /* Complete the computation of the CRC on any remaining bytes. */
  923|  1.98M|    while (len >= 8) {
  ------------------
  |  Branch (923:12): [True: 570k, False: 1.41M]
  ------------------
  924|   570k|        len -= 8;
  925|   570k|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  926|   570k|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  927|   570k|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  928|   570k|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  929|   570k|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  930|   570k|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  931|   570k|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  932|   570k|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  933|   570k|    }
  934|  6.55M|    while (len) {
  ------------------
  |  Branch (934:12): [True: 5.13M, False: 1.41M]
  ------------------
  935|  5.13M|        len--;
  936|  5.13M|        crc = (crc >> 8) ^ crc_table[(crc ^ *buf++) & 0xff];
  937|  5.13M|    }
  938|       |
  939|       |    /* Return the CRC, post-conditioned. */
  940|  1.41M|    return crc ^ 0xffffffff;
  941|  2.29M|}
z_crc32:
  946|  2.29M|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|  2.29M|    return crc32_z(crc, buf, len);
  ------------------
  |  |   52|  2.29M|#  define crc32_z               z_crc32_z
  ------------------
  951|  2.29M|}
crc32.c:crc_word:
  608|   386k|local z_crc_t crc_word(z_word_t data) {
  609|   386k|    int k;
  610|  3.48M|    for (k = 0; k < W; k++)
  ------------------
  |  |   90|  3.48M|#      define W 8
  ------------------
  |  Branch (610:17): [True: 3.09M, False: 386k]
  ------------------
  611|  3.09M|        data = (data >> 8) ^ crc_table[data & 0xff];
  612|   386k|    return (z_crc_t)data;
  613|   386k|}

z_inflate_fast:
   50|   452k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|   452k|    struct inflate_state FAR *state;
   52|   452k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|   452k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|   452k|    unsigned char FAR *out;     /* local strm->next_out */
   55|   452k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|   452k|    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|   452k|    unsigned wsize;             /* window size or zero if not using window */
   61|   452k|    unsigned whave;             /* valid bytes in the window */
   62|   452k|    unsigned wnext;             /* window write index */
   63|   452k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|   452k|    unsigned long hold;         /* local strm->hold */
   65|   452k|    unsigned bits;              /* local strm->bits */
   66|   452k|    code const FAR *lcode;      /* local strm->lencode */
   67|   452k|    code const FAR *dcode;      /* local strm->distcode */
   68|   452k|    unsigned lmask;             /* mask for first level of length codes */
   69|   452k|    unsigned dmask;             /* mask for first level of distance codes */
   70|   452k|    code const *here;           /* retrieved table entry */
   71|   452k|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|   452k|    unsigned len;               /* match length, unused bytes */
   74|   452k|    unsigned dist;              /* match distance */
   75|   452k|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|   452k|    state = (struct inflate_state FAR *)strm->state;
   79|   452k|    in = strm->next_in;
   80|   452k|    last = in + (strm->avail_in - 5);
   81|   452k|    out = strm->next_out;
   82|   452k|    beg = out - (start - strm->avail_out);
   83|   452k|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|   452k|    wsize = state->wsize;
   88|   452k|    whave = state->whave;
   89|   452k|    wnext = state->wnext;
   90|   452k|    window = state->window;
   91|   452k|    hold = state->hold;
   92|   452k|    bits = state->bits;
   93|   452k|    lcode = state->lencode;
   94|   452k|    dcode = state->distcode;
   95|   452k|    lmask = (1U << state->lenbits) - 1;
   96|   452k|    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|  75.1M|    do {
  101|  75.1M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 23.4M, False: 51.7M]
  ------------------
  102|  23.4M|            hold += (unsigned long)(*in++) << bits;
  103|  23.4M|            bits += 8;
  104|  23.4M|            hold += (unsigned long)(*in++) << bits;
  105|  23.4M|            bits += 8;
  106|  23.4M|        }
  107|  75.1M|        here = lcode + (hold & lmask);
  108|  83.0M|      dolen:
  109|  83.0M|        op = (unsigned)(here->bits);
  110|  83.0M|        hold >>= op;
  111|  83.0M|        bits -= op;
  112|  83.0M|        op = (unsigned)(here->op);
  113|  83.0M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 23.9M, False: 59.1M]
  ------------------
  114|  23.9M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|  23.9M|                    "inflate:         literal '%c'\n" :
  116|  23.9M|                    "inflate:         literal 0x%02x\n", here->val));
  117|  23.9M|            *out++ = (unsigned char)(here->val);
  118|  23.9M|        }
  119|  59.1M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 51.1M, False: 8.06M]
  ------------------
  120|  51.1M|            len = (unsigned)(here->val);
  121|  51.1M|            op &= 15;                           /* number of extra bits */
  122|  51.1M|            if (op) {
  ------------------
  |  Branch (122:17): [True: 19.9M, False: 31.1M]
  ------------------
  123|  19.9M|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 3.45k, False: 19.9M]
  ------------------
  124|  3.45k|                    hold += (unsigned long)(*in++) << bits;
  125|  3.45k|                    bits += 8;
  126|  3.45k|                }
  127|  19.9M|                len += (unsigned)hold & ((1U << op) - 1);
  128|  19.9M|                hold >>= op;
  129|  19.9M|                bits -= op;
  130|  19.9M|            }
  131|  51.1M|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|  51.1M|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 19.7M, False: 31.3M]
  ------------------
  133|  19.7M|                hold += (unsigned long)(*in++) << bits;
  134|  19.7M|                bits += 8;
  135|  19.7M|                hold += (unsigned long)(*in++) << bits;
  136|  19.7M|                bits += 8;
  137|  19.7M|            }
  138|  51.1M|            here = dcode + (hold & dmask);
  139|  57.3M|          dodist:
  140|  57.3M|            op = (unsigned)(here->bits);
  141|  57.3M|            hold >>= op;
  142|  57.3M|            bits -= op;
  143|  57.3M|            op = (unsigned)(here->op);
  144|  57.3M|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (144:17): [True: 51.1M, False: 6.24M]
  ------------------
  145|  51.1M|                dist = (unsigned)(here->val);
  146|  51.1M|                op &= 15;                       /* number of extra bits */
  147|  51.1M|                if (bits < op) {
  ------------------
  |  Branch (147:21): [True: 13.8k, False: 51.0M]
  ------------------
  148|  13.8k|                    hold += (unsigned long)(*in++) << bits;
  149|  13.8k|                    bits += 8;
  150|  13.8k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 280, False: 13.5k]
  ------------------
  151|    280|                        hold += (unsigned long)(*in++) << bits;
  152|    280|                        bits += 8;
  153|    280|                    }
  154|  13.8k|                }
  155|  51.1M|                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|  51.1M|                hold >>= op;
  165|  51.1M|                bits -= op;
  166|  51.1M|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  167|  51.1M|                op = (unsigned)(out - beg);     /* max distance in output */
  168|  51.1M|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (168:21): [True: 231k, False: 50.8M]
  ------------------
  169|   231k|                    op = dist - op;             /* distance back in window */
  170|   231k|                    if (op > whave) {
  ------------------
  |  Branch (170:25): [True: 1.11k, False: 230k]
  ------------------
  171|  1.11k|                        if (state->sane) {
  ------------------
  |  Branch (171:29): [True: 1.11k, False: 0]
  ------------------
  172|  1.11k|                            strm->msg = (z_const char *)
  173|  1.11k|                                "invalid distance too far back";
  174|  1.11k|                            state->mode = BAD;
  175|  1.11k|                            break;
  176|  1.11k|                        }
  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|  1.11k|                    }
  197|   230k|                    from = window;
  198|   230k|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (198:25): [True: 95.0k, False: 135k]
  ------------------
  199|  95.0k|                        from += wsize - op;
  200|  95.0k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (200:29): [True: 7.01k, False: 88.0k]
  ------------------
  201|  7.01k|                            len -= op;
  202|   432k|                            do {
  203|   432k|                                *out++ = *from++;
  204|   432k|                            } while (--op);
  ------------------
  |  Branch (204:38): [True: 425k, False: 7.01k]
  ------------------
  205|  7.01k|                            from = out - dist;  /* rest from output */
  206|  7.01k|                        }
  207|  95.0k|                    }
  208|   135k|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (208:30): [True: 20.1k, False: 115k]
  ------------------
  209|  20.1k|                        from += wsize + wnext - op;
  210|  20.1k|                        op -= wnext;
  211|  20.1k|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (211:29): [True: 429, False: 19.7k]
  ------------------
  212|    429|                            len -= op;
  213|  44.0k|                            do {
  214|  44.0k|                                *out++ = *from++;
  215|  44.0k|                            } while (--op);
  ------------------
  |  Branch (215:38): [True: 43.5k, False: 429]
  ------------------
  216|    429|                            from = window;
  217|    429|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (217:33): [True: 181, False: 248]
  ------------------
  218|    181|                                op = wnext;
  219|    181|                                len -= op;
  220|  11.7k|                                do {
  221|  11.7k|                                    *out++ = *from++;
  222|  11.7k|                                } while (--op);
  ------------------
  |  Branch (222:42): [True: 11.5k, False: 181]
  ------------------
  223|    181|                                from = out - dist;      /* rest from output */
  224|    181|                            }
  225|    429|                        }
  226|  20.1k|                    }
  227|   115k|                    else {                      /* contiguous in window */
  228|   115k|                        from += wnext - op;
  229|   115k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (229:29): [True: 9.24k, False: 105k]
  ------------------
  230|  9.24k|                            len -= op;
  231|   909k|                            do {
  232|   909k|                                *out++ = *from++;
  233|   909k|                            } while (--op);
  ------------------
  |  Branch (233:38): [True: 900k, False: 9.24k]
  ------------------
  234|  9.24k|                            from = out - dist;  /* rest from output */
  235|  9.24k|                        }
  236|   115k|                    }
  237|  6.67M|                    while (len > 2) {
  ------------------
  |  Branch (237:28): [True: 6.44M, False: 230k]
  ------------------
  238|  6.44M|                        *out++ = *from++;
  239|  6.44M|                        *out++ = *from++;
  240|  6.44M|                        *out++ = *from++;
  241|  6.44M|                        len -= 3;
  242|  6.44M|                    }
  243|   230k|                    if (len) {
  ------------------
  |  Branch (243:25): [True: 146k, False: 83.7k]
  ------------------
  244|   146k|                        *out++ = *from++;
  245|   146k|                        if (len > 1)
  ------------------
  |  Branch (245:29): [True: 115k, False: 31.1k]
  ------------------
  246|   115k|                            *out++ = *from++;
  247|   146k|                    }
  248|   230k|                }
  249|  50.8M|                else {
  250|  50.8M|                    from = out - dist;          /* copy direct from output */
  251|  2.93G|                    do {                        /* minimum length is three */
  252|  2.93G|                        *out++ = *from++;
  253|  2.93G|                        *out++ = *from++;
  254|  2.93G|                        *out++ = *from++;
  255|  2.93G|                        len -= 3;
  256|  2.93G|                    } while (len > 2);
  ------------------
  |  Branch (256:30): [True: 2.88G, False: 50.8M]
  ------------------
  257|  50.8M|                    if (len) {
  ------------------
  |  Branch (257:25): [True: 19.7M, False: 31.1M]
  ------------------
  258|  19.7M|                        *out++ = *from++;
  259|  19.7M|                        if (len > 1)
  ------------------
  |  Branch (259:29): [True: 19.6M, False: 103k]
  ------------------
  260|  19.6M|                            *out++ = *from++;
  261|  19.7M|                    }
  262|  50.8M|                }
  263|  51.1M|            }
  264|  6.24M|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (264:22): [True: 6.24M, False: 280]
  ------------------
  265|  6.24M|                here = dcode + here->val + (hold & ((1U << op) - 1));
  266|  6.24M|                goto dodist;
  267|  6.24M|            }
  268|    280|            else {
  269|    280|                strm->msg = (z_const char *)"invalid distance code";
  270|    280|                state->mode = BAD;
  271|    280|                break;
  272|    280|            }
  273|  57.3M|        }
  274|  8.06M|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (274:18): [True: 7.96M, False: 100k]
  ------------------
  275|  7.96M|            here = lcode + here->val + (hold & ((1U << op) - 1));
  276|  7.96M|            goto dolen;
  277|  7.96M|        }
  278|   100k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (278:18): [True: 100k, False: 133]
  ------------------
  279|   100k|            Tracevv((stderr, "inflate:         end of block\n"));
  280|   100k|            state->mode = TYPE;
  281|   100k|            break;
  282|   100k|        }
  283|    133|        else {
  284|    133|            strm->msg = (z_const char *)"invalid literal/length code";
  285|    133|            state->mode = BAD;
  286|    133|            break;
  287|    133|        }
  288|  83.0M|    } while (in < last && out < end);
  ------------------
  |  Branch (288:14): [True: 74.9M, False: 123k]
  |  Branch (288:27): [True: 74.6M, False: 226k]
  ------------------
  289|       |
  290|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  291|   452k|    len = bits >> 3;
  292|   452k|    in -= len;
  293|   452k|    bits -= len << 3;
  294|   452k|    hold &= (1U << bits) - 1;
  295|       |
  296|       |    /* update state and return */
  297|   452k|    strm->next_in = in;
  298|   452k|    strm->next_out = out;
  299|   452k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (299:33): [True: 414k, False: 38.2k]
  ------------------
  300|   452k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (300:34): [True: 224k, False: 227k]
  ------------------
  301|   227k|                                 257 + (end - out) : 257 - (out - end));
  302|   452k|    state->hold = hold;
  303|   452k|    state->bits = bits;
  304|   452k|    return;
  305|   452k|}

z_inflateResetKeep:
  100|   148k|int ZEXPORT inflateResetKeep(z_streamp strm) {
  101|   148k|    struct inflate_state FAR *state;
  102|       |
  103|   148k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (103:9): [True: 0, False: 148k]
  ------------------
  104|   148k|    state = (struct inflate_state FAR *)strm->state;
  105|   148k|    strm->total_in = strm->total_out = state->total = 0;
  106|   148k|    strm->msg = Z_NULL;
  ------------------
  |  |  216|   148k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  107|   148k|    strm->data_type = 0;
  108|   148k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (108:9): [True: 148k, False: 0]
  ------------------
  109|   148k|        strm->adler = state->wrap & 1;
  110|   148k|    state->mode = HEAD;
  111|   148k|    state->last = 0;
  112|   148k|    state->havedict = 0;
  113|   148k|    state->flags = -1;
  114|   148k|    state->dmax = 32768U;
  115|   148k|    state->head = Z_NULL;
  ------------------
  |  |  216|   148k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  116|   148k|    state->hold = 0;
  117|   148k|    state->bits = 0;
  118|   148k|    state->lencode = state->distcode = state->next = state->codes;
  119|   148k|    state->sane = 1;
  120|   148k|    state->back = -1;
  121|   148k|    Tracev((stderr, "inflate: reset\n"));
  122|   148k|    return Z_OK;
  ------------------
  |  |  181|   148k|#define Z_OK            0
  ------------------
  123|   148k|}
z_inflateReset:
  125|   148k|int ZEXPORT inflateReset(z_streamp strm) {
  126|   148k|    struct inflate_state FAR *state;
  127|       |
  128|   148k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (128:9): [True: 0, False: 148k]
  ------------------
  129|   148k|    state = (struct inflate_state FAR *)strm->state;
  130|   148k|    state->wsize = 0;
  131|   148k|    state->whave = 0;
  132|   148k|    state->wnext = 0;
  133|   148k|    return inflateResetKeep(strm);
  ------------------
  |  |  132|   148k|#  define inflateResetKeep      z_inflateResetKeep
  ------------------
  134|   148k|}
z_inflateReset2:
  136|   148k|int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
  137|   148k|    int wrap;
  138|   148k|    struct inflate_state FAR *state;
  139|       |
  140|       |    /* get the state */
  141|   148k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (141:9): [True: 0, False: 148k]
  ------------------
  142|   148k|    state = (struct inflate_state FAR *)strm->state;
  143|       |
  144|       |    /* extract wrap request from windowBits parameter */
  145|   148k|    if (windowBits < 0) {
  ------------------
  |  Branch (145:9): [True: 0, False: 148k]
  ------------------
  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|   148k|    else {
  152|   148k|        wrap = (windowBits >> 4) + 5;
  153|       |#ifdef GUNZIP
  154|       |        if (windowBits < 48)
  155|       |            windowBits &= 15;
  156|       |#endif
  157|   148k|    }
  158|       |
  159|       |    /* set number of window bits, free window if different */
  160|   148k|    if (windowBits && (windowBits < 8 || windowBits > 15))
  ------------------
  |  Branch (160:9): [True: 148k, False: 0]
  |  Branch (160:24): [True: 0, False: 148k]
  |  Branch (160:42): [True: 0, False: 148k]
  ------------------
  161|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  162|   148k|    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
  ------------------
  |  |  216|   297k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (162:9): [True: 0, False: 148k]
  |  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|   148k|    state->wrap = wrap;
  169|   148k|    state->wbits = (unsigned)windowBits;
  170|   148k|    return inflateReset(strm);
  ------------------
  |  |  130|   148k|#  define inflateReset          z_inflateReset
  ------------------
  171|   148k|}
z_inflateInit2_:
  174|   148k|                          const char *version, int stream_size) {
  175|   148k|    int ret;
  176|   148k|    struct inflate_state FAR *state;
  177|       |
  178|   148k|    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |  216|   297k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |   44|   148k|#define ZLIB_VERSION "1.3.2"
  ------------------
  |  Branch (178:9): [True: 0, False: 148k]
  |  Branch (178:30): [True: 0, False: 148k]
  ------------------
  179|   148k|        stream_size != (int)(sizeof(z_stream)))
  ------------------
  |  Branch (179:9): [True: 0, False: 148k]
  ------------------
  180|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  189|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  181|   148k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  216|   148k|#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: 148k]
  ------------------
  182|   148k|    strm->msg = Z_NULL;                 /* in case we return an error */
  ------------------
  |  |  216|   148k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  183|   148k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (183:9): [True: 0, False: 148k]
  ------------------
  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|   148k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (191:9): [True: 0, False: 148k]
  ------------------
  192|       |#ifdef Z_SOLO
  193|       |        return Z_STREAM_ERROR;
  194|       |#else
  195|      0|        strm->zfree = zcfree;
  ------------------
  |  |  151|      0|#    define zcfree                z_zcfree
  ------------------
  196|   148k|#endif
  197|   148k|    state = (struct inflate_state FAR *)
  198|   148k|            ZALLOC(strm, 1, sizeof(struct inflate_state));
  ------------------
  |  |  253|   148k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  199|   148k|    if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  216|   148k|#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: 148k]
  ------------------
  200|   148k|    zmemzero(state, sizeof(struct inflate_state));
  ------------------
  |  |  218|   148k|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  201|   148k|    Tracev((stderr, "inflate: allocated\n"));
  202|   148k|    strm->state = (struct internal_state FAR *)state;
  203|   148k|    state->strm = strm;
  204|   148k|    state->window = Z_NULL;
  ------------------
  |  |  216|   148k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  205|   148k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  206|   148k|    ret = inflateReset2(strm, windowBits);
  ------------------
  |  |  131|   148k|#  define inflateReset2         z_inflateReset2
  ------------------
  207|   148k|    if (ret != Z_OK) {
  ------------------
  |  |  181|   148k|#define Z_OK            0
  ------------------
  |  Branch (207:9): [True: 0, False: 148k]
  ------------------
  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|   148k|    return ret;
  212|   148k|}
z_inflate:
  474|   971k|int ZEXPORT inflate(z_streamp strm, int flush) {
  475|   971k|    struct inflate_state FAR *state;
  476|   971k|    z_const unsigned char FAR *next;    /* next input */
  477|   971k|    unsigned char FAR *put;     /* next output */
  478|   971k|    unsigned have, left;        /* available input and output */
  479|   971k|    unsigned long hold;         /* bit buffer */
  480|   971k|    unsigned bits;              /* bits in bit buffer */
  481|   971k|    unsigned in, out;           /* save starting available input and output */
  482|   971k|    unsigned copy;              /* number of stored or match bytes to copy */
  483|   971k|    unsigned char FAR *from;    /* where to copy match bytes from */
  484|   971k|    code here;                  /* current decoding table entry */
  485|   971k|    code last;                  /* parent table entry */
  486|   971k|    unsigned len;               /* length to copy for repeats, bits to drop */
  487|   971k|    int ret;                    /* return code */
  488|       |#ifdef GUNZIP
  489|       |    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  490|       |#endif
  491|   971k|    static const unsigned short order[19] = /* permutation of code lengths */
  492|   971k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  493|       |
  494|   971k|    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
  ------------------
  |  |  216|  1.94M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (494:9): [True: 0, False: 971k]
  |  Branch (494:36): [True: 0, False: 971k]
  ------------------
  495|   971k|        (strm->next_in == Z_NULL && strm->avail_in != 0))
  ------------------
  |  |  216|  1.94M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (495:10): [True: 1.34k, False: 969k]
  |  Branch (495:37): [True: 0, False: 1.34k]
  ------------------
  496|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  497|       |
  498|   971k|    state = (struct inflate_state FAR *)strm->state;
  499|   971k|    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
  ------------------
  |  Branch (499:9): [True: 560, False: 970k]
  ------------------
  500|   971k|    LOAD();
  ------------------
  |  |  329|   971k|    do { \
  |  |  330|   971k|        put = strm->next_out; \
  |  |  331|   971k|        left = strm->avail_out; \
  |  |  332|   971k|        next = strm->next_in; \
  |  |  333|   971k|        have = strm->avail_in; \
  |  |  334|   971k|        hold = state->hold; \
  |  |  335|   971k|        bits = state->bits; \
  |  |  336|   971k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (336:14): [Folded, False: 971k]
  |  |  ------------------
  ------------------
  501|   971k|    in = have;
  502|   971k|    out = left;
  503|   971k|    ret = Z_OK;
  ------------------
  |  |  181|   971k|#define Z_OK            0
  ------------------
  504|   971k|    for (;;)
  505|  4.81M|        switch (state->mode) {
  506|   150k|        case HEAD:
  ------------------
  |  Branch (506:9): [True: 150k, False: 4.66M]
  ------------------
  507|   150k|            if (state->wrap == 0) {
  ------------------
  |  Branch (507:17): [True: 0, False: 150k]
  ------------------
  508|      0|                state->mode = TYPEDO;
  509|      0|                break;
  510|      0|            }
  511|   150k|            NEEDBITS(16);
  ------------------
  |  |  369|   150k|    do { \
  |  |  370|   443k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 297k, False: 146k]
  |  |  ------------------
  |  |  371|   297k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   297k|    do { \
  |  |  |  |  360|   297k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 3.48k, False: 293k]
  |  |  |  |  ------------------
  |  |  |  |  361|   297k|        have--; \
  |  |  |  |  362|   293k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   293k|        bits += 8; \
  |  |  |  |  364|   293k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 293k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   150k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 146k]
  |  |  ------------------
  ------------------
  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|   146k|            if (
  527|   146k|#endif
  528|   146k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  376|   146k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  |  Branch (528:17): [True: 9.50k, False: 137k]
  ------------------
  529|  9.50k|                strm->msg = (z_const char *)"incorrect header check";
  530|  9.50k|                state->mode = BAD;
  531|  9.50k|                break;
  532|  9.50k|            }
  533|   137k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  376|   137k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  213|   137k|#define Z_DEFLATED   8
  ------------------
  |  Branch (533:17): [True: 727, False: 136k]
  ------------------
  534|    727|                strm->msg = (z_const char *)"unknown compression method";
  535|    727|                state->mode = BAD;
  536|    727|                break;
  537|    727|            }
  538|   136k|            DROPBITS(4);
  ------------------
  |  |  380|   136k|    do { \
  |  |  381|   136k|        hold >>= (n); \
  |  |  382|   136k|        bits -= (unsigned)(n); \
  |  |  383|   136k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 136k]
  |  |  ------------------
  ------------------
  539|   136k|            len = BITS(4) + 8;
  ------------------
  |  |  376|   136k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  540|   136k|            if (state->wbits == 0)
  ------------------
  |  Branch (540:17): [True: 0, False: 136k]
  ------------------
  541|      0|                state->wbits = len;
  542|   136k|            if (len > 15 || len > state->wbits) {
  ------------------
  |  Branch (542:17): [True: 77, False: 136k]
  |  Branch (542:29): [True: 0, False: 136k]
  ------------------
  543|     77|                strm->msg = (z_const char *)"invalid window size";
  544|     77|                state->mode = BAD;
  545|     77|                break;
  546|     77|            }
  547|   136k|            state->dmax = 1U << len;
  548|   136k|            state->flags = 0;               /* indicate zlib header */
  549|   136k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  550|   136k|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |   34|   136k|#  define adler32               z_adler32
  ------------------
                          strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|   136k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  551|   136k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (551:27): [True: 170, False: 136k]
  ------------------
  552|   136k|            INITBITS();
  ------------------
  |  |  351|   136k|    do { \
  |  |  352|   136k|        hold = 0; \
  |  |  353|   136k|        bits = 0; \
  |  |  354|   136k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 136k]
  |  |  ------------------
  ------------------
  553|   136k|            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|    230|        case DICTID:
  ------------------
  |  Branch (694:9): [True: 230, False: 4.81M]
  ------------------
  695|    230|            NEEDBITS(32);
  ------------------
  |  |  369|    230|    do { \
  |  |  370|    817|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 685, False: 132]
  |  |  ------------------
  |  |  371|    685|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|    685|    do { \
  |  |  |  |  360|    685|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 98, False: 587]
  |  |  |  |  ------------------
  |  |  |  |  361|    685|        have--; \
  |  |  |  |  362|    587|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|    587|        bits += 8; \
  |  |  |  |  364|    587|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 587]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|    230|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 132]
  |  |  ------------------
  ------------------
  696|    132|            strm->adler = state->check = ZSWAP32(hold);
  ------------------
  |  |  258|    132|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|    132|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
  697|    132|            INITBITS();
  ------------------
  |  |  351|    132|    do { \
  |  |  352|    132|        hold = 0; \
  |  |  353|    132|        bits = 0; \
  |  |  354|    132|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 132]
  |  |  ------------------
  ------------------
  698|    132|            state->mode = DICT;
  699|       |                /* fallthrough */
  700|    132|        case DICT:
  ------------------
  |  Branch (700:9): [True: 0, False: 4.81M]
  ------------------
  701|    132|            if (state->havedict == 0) {
  ------------------
  |  Branch (701:17): [True: 132, False: 0]
  ------------------
  702|    132|                RESTORE();
  ------------------
  |  |  340|    132|    do { \
  |  |  341|    132|        strm->next_out = put; \
  |  |  342|    132|        strm->avail_out = left; \
  |  |  343|    132|        strm->next_in = next; \
  |  |  344|    132|        strm->avail_in = have; \
  |  |  345|    132|        state->hold = hold; \
  |  |  346|    132|        state->bits = bits; \
  |  |  347|    132|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 132]
  |  |  ------------------
  ------------------
  703|    132|                return Z_NEED_DICT;
  ------------------
  |  |  183|    132|#define Z_NEED_DICT     2
  ------------------
  704|    132|            }
  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|   239k|        case TYPE:
  ------------------
  |  Branch (708:9): [True: 239k, False: 4.57M]
  ------------------
  709|   239k|            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  177|   479k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|   239k|#define Z_TREES         6
  ------------------
  |  Branch (709:17): [True: 0, False: 239k]
  |  Branch (709:37): [True: 0, False: 239k]
  ------------------
  710|       |                /* fallthrough */
  711|   240k|        case TYPEDO:
  ------------------
  |  Branch (711:9): [True: 1.09k, False: 4.81M]
  ------------------
  712|   240k|            if (state->last) {
  ------------------
  |  Branch (712:17): [True: 95.3k, False: 145k]
  ------------------
  713|  95.3k|                BYTEBITS();
  ------------------
  |  |  387|  95.3k|    do { \
  |  |  388|  95.3k|        hold >>= bits & 7; \
  |  |  389|  95.3k|        bits -= bits & 7; \
  |  |  390|  95.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (390:14): [Folded, False: 95.3k]
  |  |  ------------------
  ------------------
  714|  95.3k|                state->mode = CHECK;
  715|  95.3k|                break;
  716|  95.3k|            }
  717|   145k|            NEEDBITS(3);
  ------------------
  |  |  369|   145k|    do { \
  |  |  370|   282k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 138k, False: 144k]
  |  |  ------------------
  |  |  371|   145k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   138k|    do { \
  |  |  |  |  360|   138k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 1.13k, False: 137k]
  |  |  |  |  ------------------
  |  |  |  |  361|   138k|        have--; \
  |  |  |  |  362|   137k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   137k|        bits += 8; \
  |  |  |  |  364|   137k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 137k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   145k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 144k]
  |  |  ------------------
  ------------------
  718|   144k|            state->last = BITS(1);
  ------------------
  |  |  376|   144k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  719|   144k|            DROPBITS(1);
  ------------------
  |  |  380|   144k|    do { \
  |  |  381|   144k|        hold >>= (n); \
  |  |  382|   144k|        bits -= (unsigned)(n); \
  |  |  383|   144k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 144k]
  |  |  ------------------
  ------------------
  720|   144k|            switch (BITS(2)) {
  ------------------
  |  |  376|   144k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  721|  7.90k|            case 0:                             /* stored block */
  ------------------
  |  Branch (721:13): [True: 7.90k, False: 136k]
  ------------------
  722|  7.90k|                Tracev((stderr, "inflate:     stored block%s\n",
  723|  7.90k|                        state->last ? " (last)" : ""));
  724|  7.90k|                state->mode = STORED;
  725|  7.90k|                break;
  726|   112k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (726:13): [True: 112k, False: 31.8k]
  ------------------
  727|   112k|                inflate_fixed(state);
  ------------------
  |  |  141|   112k|#  define inflate_fixed         z_inflate_fixed
  ------------------
  728|   112k|                Tracev((stderr, "inflate:     fixed codes block%s\n",
  729|   112k|                        state->last ? " (last)" : ""));
  730|   112k|                state->mode = LEN_;             /* decode codes */
  731|   112k|                if (flush == Z_TREES) {
  ------------------
  |  |  178|   112k|#define Z_TREES         6
  ------------------
  |  Branch (731:21): [True: 0, False: 112k]
  ------------------
  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|   112k|                break;
  736|   112k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (736:13): [True: 23.3k, False: 121k]
  ------------------
  737|  23.3k|                Tracev((stderr, "inflate:     dynamic codes block%s\n",
  738|  23.3k|                        state->last ? " (last)" : ""));
  739|  23.3k|                state->mode = TABLE;
  740|  23.3k|                break;
  741|    516|            default:
  ------------------
  |  Branch (741:13): [True: 516, False: 143k]
  ------------------
  742|    516|                strm->msg = (z_const char *)"invalid block type";
  743|    516|                state->mode = BAD;
  744|   144k|            }
  745|   144k|            DROPBITS(2);
  ------------------
  |  |  380|   144k|    do { \
  |  |  381|   144k|        hold >>= (n); \
  |  |  382|   144k|        bits -= (unsigned)(n); \
  |  |  383|   144k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 144k]
  |  |  ------------------
  ------------------
  746|   144k|            break;
  747|  7.99k|        case STORED:
  ------------------
  |  Branch (747:9): [True: 7.99k, False: 4.80M]
  ------------------
  748|  7.99k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  387|  7.99k|    do { \
  |  |  388|  7.99k|        hold >>= bits & 7; \
  |  |  389|  7.99k|        bits -= bits & 7; \
  |  |  390|  7.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (390:14): [Folded, False: 7.99k]
  |  |  ------------------
  ------------------
  749|  7.99k|            NEEDBITS(32);
  ------------------
  |  |  369|  7.99k|    do { \
  |  |  370|  39.2k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 31.4k, False: 7.77k]
  |  |  ------------------
  |  |  371|  31.4k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  31.4k|    do { \
  |  |  |  |  360|  31.4k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 217, False: 31.2k]
  |  |  |  |  ------------------
  |  |  |  |  361|  31.4k|        have--; \
  |  |  |  |  362|  31.2k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  31.2k|        bits += 8; \
  |  |  |  |  364|  31.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 31.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  7.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 7.77k]
  |  |  ------------------
  ------------------
  750|  7.77k|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (750:17): [True: 6.70k, False: 1.06k]
  ------------------
  751|  6.70k|                strm->msg = (z_const char *)"invalid stored block lengths";
  752|  6.70k|                state->mode = BAD;
  753|  6.70k|                break;
  754|  6.70k|            }
  755|  1.06k|            state->length = (unsigned)hold & 0xffff;
  756|  1.06k|            Tracev((stderr, "inflate:       stored length %u\n",
  757|  1.06k|                    state->length));
  758|  1.06k|            INITBITS();
  ------------------
  |  |  351|  1.06k|    do { \
  |  |  352|  1.06k|        hold = 0; \
  |  |  353|  1.06k|        bits = 0; \
  |  |  354|  1.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 1.06k]
  |  |  ------------------
  ------------------
  759|  1.06k|            state->mode = COPY_;
  760|  1.06k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  1.06k|#define Z_TREES         6
  ------------------
  |  Branch (760:17): [True: 0, False: 1.06k]
  ------------------
  761|       |                /* fallthrough */
  762|  1.06k|        case COPY_:
  ------------------
  |  Branch (762:9): [True: 0, False: 4.81M]
  ------------------
  763|  1.06k|            state->mode = COPY;
  764|       |                /* fallthrough */
  765|  23.0k|        case COPY:
  ------------------
  |  Branch (765:9): [True: 22.0k, False: 4.79M]
  ------------------
  766|  23.0k|            copy = state->length;
  767|  23.0k|            if (copy) {
  ------------------
  |  Branch (767:17): [True: 22.4k, False: 664]
  ------------------
  768|  22.4k|                if (copy > have) copy = have;
  ------------------
  |  Branch (768:21): [True: 21.3k, False: 1.08k]
  ------------------
  769|  22.4k|                if (copy > left) copy = left;
  ------------------
  |  Branch (769:21): [True: 20.6k, False: 1.77k]
  ------------------
  770|  22.4k|                if (copy == 0) goto inf_leave;
  ------------------
  |  Branch (770:21): [True: 11.2k, False: 11.1k]
  ------------------
  771|  11.1k|                zmemcpy(put, next, copy);
  ------------------
  |  |  216|  11.1k|#    define zmemcpy memcpy
  ------------------
  772|  11.1k|                have -= copy;
  773|  11.1k|                next += copy;
  774|  11.1k|                left -= copy;
  775|  11.1k|                put += copy;
  776|  11.1k|                state->length -= copy;
  777|  11.1k|                break;
  778|  22.4k|            }
  779|    664|            Tracev((stderr, "inflate:       stored end\n"));
  780|    664|            state->mode = TYPE;
  781|    664|            break;
  782|  25.3k|        case TABLE:
  ------------------
  |  Branch (782:9): [True: 25.3k, False: 4.78M]
  ------------------
  783|  25.3k|            NEEDBITS(14);
  ------------------
  |  |  369|  25.3k|    do { \
  |  |  370|  72.0k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 48.7k, False: 23.3k]
  |  |  ------------------
  |  |  371|  48.7k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  48.7k|    do { \
  |  |  |  |  360|  48.7k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 2.00k, False: 46.7k]
  |  |  |  |  ------------------
  |  |  |  |  361|  48.7k|        have--; \
  |  |  |  |  362|  46.7k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  46.7k|        bits += 8; \
  |  |  |  |  364|  46.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 46.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  25.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 23.3k]
  |  |  ------------------
  ------------------
  784|  23.3k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  376|  23.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  785|  23.3k|            DROPBITS(5);
  ------------------
  |  |  380|  23.3k|    do { \
  |  |  381|  23.3k|        hold >>= (n); \
  |  |  382|  23.3k|        bits -= (unsigned)(n); \
  |  |  383|  23.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 23.3k]
  |  |  ------------------
  ------------------
  786|  23.3k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  376|  23.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  787|  23.3k|            DROPBITS(5);
  ------------------
  |  |  380|  23.3k|    do { \
  |  |  381|  23.3k|        hold >>= (n); \
  |  |  382|  23.3k|        bits -= (unsigned)(n); \
  |  |  383|  23.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 23.3k]
  |  |  ------------------
  ------------------
  788|  23.3k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  376|  23.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  789|  23.3k|            DROPBITS(4);
  ------------------
  |  |  380|  23.3k|    do { \
  |  |  381|  23.3k|        hold >>= (n); \
  |  |  382|  23.3k|        bits -= (unsigned)(n); \
  |  |  383|  23.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 23.3k]
  |  |  ------------------
  ------------------
  790|  23.3k|#ifndef PKZIP_BUG_WORKAROUND
  791|  23.3k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (791:17): [True: 32, False: 23.3k]
  |  Branch (791:38): [True: 1.25k, False: 22.0k]
  ------------------
  792|  1.28k|                strm->msg = (z_const char *)
  793|  1.28k|                    "too many length or distance symbols";
  794|  1.28k|                state->mode = BAD;
  795|  1.28k|                break;
  796|  1.28k|            }
  797|  22.0k|#endif
  798|  22.0k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  799|  22.0k|            state->have = 0;
  800|  22.0k|            state->mode = LENLENS;
  801|       |                /* fallthrough */
  802|  26.9k|        case LENLENS:
  ------------------
  |  Branch (802:9): [True: 4.84k, False: 4.80M]
  ------------------
  803|   336k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (803:20): [True: 314k, False: 21.9k]
  ------------------
  804|   314k|                NEEDBITS(3);
  ------------------
  |  |  369|   314k|    do { \
  |  |  370|   417k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 107k, False: 310k]
  |  |  ------------------
  |  |  371|   314k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   107k|    do { \
  |  |  |  |  360|   107k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 4.94k, False: 102k]
  |  |  |  |  ------------------
  |  |  |  |  361|   107k|        have--; \
  |  |  |  |  362|   102k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   102k|        bits += 8; \
  |  |  |  |  364|   102k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 102k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   314k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 310k]
  |  |  ------------------
  ------------------
  805|   310k|                state->lens[order[state->have++]] = (unsigned short)BITS(3);
  ------------------
  |  |  376|   310k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  806|   310k|                DROPBITS(3);
  ------------------
  |  |  380|   310k|    do { \
  |  |  381|   310k|        hold >>= (n); \
  |  |  382|   310k|        bits -= (unsigned)(n); \
  |  |  383|   310k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 310k]
  |  |  ------------------
  ------------------
  807|   310k|            }
  808|   129k|            while (state->have < 19)
  ------------------
  |  Branch (808:20): [True: 107k, False: 21.9k]
  ------------------
  809|   107k|                state->lens[order[state->have++]] = 0;
  810|  21.9k|            state->next = state->codes;
  811|  21.9k|            state->lencode = state->distcode = (const code FAR *)(state->next);
  812|  21.9k|            state->lenbits = 7;
  813|  21.9k|            ret = inflate_table(CODES, state->lens, 19, &(state->next),
  ------------------
  |  |  140|  21.9k|#  define inflate_table         z_inflate_table
  ------------------
  814|  21.9k|                                &(state->lenbits), state->work);
  815|  21.9k|            if (ret) {
  ------------------
  |  Branch (815:17): [True: 2.37k, False: 19.5k]
  ------------------
  816|  2.37k|                strm->msg = (z_const char *)"invalid code lengths set";
  817|  2.37k|                state->mode = BAD;
  818|  2.37k|                break;
  819|  2.37k|            }
  820|  19.5k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  821|  19.5k|            state->have = 0;
  822|  19.5k|            state->mode = CODELENS;
  823|       |                /* fallthrough */
  824|  35.2k|        case CODELENS:
  ------------------
  |  Branch (824:9): [True: 15.6k, False: 4.79M]
  ------------------
  825|  1.23M|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (825:20): [True: 1.22M, False: 14.5k]
  ------------------
  826|  1.59M|                for (;;) {
  827|  1.59M|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  376|  1.59M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  828|  1.59M|                    if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (828:25): [True: 1.21M, False: 386k]
  ------------------
  829|   386k|                    PULLBYTE();
  ------------------
  |  |  359|   386k|    do { \
  |  |  360|   386k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 11.9k, False: 374k]
  |  |  ------------------
  |  |  361|   386k|        have--; \
  |  |  362|   374k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   374k|        bits += 8; \
  |  |  364|   374k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 374k]
  |  |  ------------------
  ------------------
  830|   386k|                }
  831|  1.21M|                if (here.val < 16) {
  ------------------
  |  Branch (831:21): [True: 1.05M, False: 156k]
  ------------------
  832|  1.05M|                    DROPBITS(here.bits);
  ------------------
  |  |  380|  1.05M|    do { \
  |  |  381|  1.05M|        hold >>= (n); \
  |  |  382|  1.05M|        bits -= (unsigned)(n); \
  |  |  383|  1.05M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 1.05M]
  |  |  ------------------
  ------------------
  833|  1.05M|                    state->lens[state->have++] = here.val;
  834|  1.05M|                }
  835|   156k|                else {
  836|   156k|                    if (here.val == 16) {
  ------------------
  |  Branch (836:25): [True: 49.6k, False: 107k]
  ------------------
  837|  49.6k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  369|  49.6k|    do { \
  |  |  370|  64.5k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 16.4k, False: 48.1k]
  |  |  ------------------
  |  |  371|  49.6k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  16.4k|    do { \
  |  |  |  |  360|  16.4k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 1.55k, False: 14.9k]
  |  |  |  |  ------------------
  |  |  |  |  361|  16.4k|        have--; \
  |  |  |  |  362|  14.9k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  14.9k|        bits += 8; \
  |  |  |  |  364|  14.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 14.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  49.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 48.1k]
  |  |  ------------------
  ------------------
  838|  48.1k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  48.1k|    do { \
  |  |  381|  48.1k|        hold >>= (n); \
  |  |  382|  48.1k|        bits -= (unsigned)(n); \
  |  |  383|  48.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 48.1k]
  |  |  ------------------
  ------------------
  839|  48.1k|                        if (state->have == 0) {
  ------------------
  |  Branch (839:29): [True: 84, False: 48.0k]
  ------------------
  840|     84|                            strm->msg = (z_const char *)
  841|     84|                                "invalid bit length repeat";
  842|     84|                            state->mode = BAD;
  843|     84|                            break;
  844|     84|                        }
  845|  48.0k|                        len = state->lens[state->have - 1];
  846|  48.0k|                        copy = 3 + BITS(2);
  ------------------
  |  |  376|  48.0k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  847|  48.0k|                        DROPBITS(2);
  ------------------
  |  |  380|  48.0k|    do { \
  |  |  381|  48.0k|        hold >>= (n); \
  |  |  382|  48.0k|        bits -= (unsigned)(n); \
  |  |  383|  48.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 48.0k]
  |  |  ------------------
  ------------------
  848|  48.0k|                    }
  849|   107k|                    else if (here.val == 17) {
  ------------------
  |  Branch (849:30): [True: 34.5k, False: 72.7k]
  ------------------
  850|  34.5k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  369|  34.5k|    do { \
  |  |  370|  51.0k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 17.5k, False: 33.4k]
  |  |  ------------------
  |  |  371|  34.5k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  17.5k|    do { \
  |  |  |  |  360|  17.5k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 1.04k, False: 16.5k]
  |  |  |  |  ------------------
  |  |  |  |  361|  17.5k|        have--; \
  |  |  |  |  362|  16.5k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  16.5k|        bits += 8; \
  |  |  |  |  364|  16.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 16.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  34.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 33.4k]
  |  |  ------------------
  ------------------
  851|  33.4k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  33.4k|    do { \
  |  |  381|  33.4k|        hold >>= (n); \
  |  |  382|  33.4k|        bits -= (unsigned)(n); \
  |  |  383|  33.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 33.4k]
  |  |  ------------------
  ------------------
  852|  33.4k|                        len = 0;
  853|  33.4k|                        copy = 3 + BITS(3);
  ------------------
  |  |  376|  33.4k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  854|  33.4k|                        DROPBITS(3);
  ------------------
  |  |  380|  33.4k|    do { \
  |  |  381|  33.4k|        hold >>= (n); \
  |  |  382|  33.4k|        bits -= (unsigned)(n); \
  |  |  383|  33.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 33.4k]
  |  |  ------------------
  ------------------
  855|  33.4k|                    }
  856|  72.7k|                    else {
  857|  72.7k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  369|  72.7k|    do { \
  |  |  370|   132k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 61.3k, False: 70.8k]
  |  |  ------------------
  |  |  371|  72.7k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  61.3k|    do { \
  |  |  |  |  360|  61.3k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 1.88k, False: 59.4k]
  |  |  |  |  ------------------
  |  |  |  |  361|  61.3k|        have--; \
  |  |  |  |  362|  59.4k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  59.4k|        bits += 8; \
  |  |  |  |  364|  59.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 59.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  72.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 70.8k]
  |  |  ------------------
  ------------------
  858|  70.8k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  70.8k|    do { \
  |  |  381|  70.8k|        hold >>= (n); \
  |  |  382|  70.8k|        bits -= (unsigned)(n); \
  |  |  383|  70.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 70.8k]
  |  |  ------------------
  ------------------
  859|  70.8k|                        len = 0;
  860|  70.8k|                        copy = 11 + BITS(7);
  ------------------
  |  |  376|  70.8k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  861|  70.8k|                        DROPBITS(7);
  ------------------
  |  |  380|  70.8k|    do { \
  |  |  381|  70.8k|        hold >>= (n); \
  |  |  382|  70.8k|        bits -= (unsigned)(n); \
  |  |  383|  70.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 70.8k]
  |  |  ------------------
  ------------------
  862|  70.8k|                    }
  863|   152k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (863:25): [True: 4.20k, False: 148k]
  ------------------
  864|  4.20k|                        strm->msg = (z_const char *)
  865|  4.20k|                            "invalid bit length repeat";
  866|  4.20k|                        state->mode = BAD;
  867|  4.20k|                        break;
  868|  4.20k|                    }
  869|  4.69M|                    while (copy--)
  ------------------
  |  Branch (869:28): [True: 4.54M, False: 148k]
  ------------------
  870|  4.54M|                        state->lens[state->have++] = (unsigned short)len;
  871|   148k|                }
  872|  1.21M|            }
  873|       |
  874|       |            /* handle error breaks in while */
  875|  18.8k|            if (state->mode == BAD) break;
  ------------------
  |  Branch (875:17): [True: 4.29k, False: 14.5k]
  ------------------
  876|       |
  877|       |            /* check for end-of-block code (better have one) */
  878|  14.5k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (878:17): [True: 171, False: 14.3k]
  ------------------
  879|    171|                strm->msg = (z_const char *)
  880|    171|                    "invalid code -- missing end-of-block";
  881|    171|                state->mode = BAD;
  882|    171|                break;
  883|    171|            }
  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|  14.3k|            state->next = state->codes;
  889|  14.3k|            state->lencode = (const code FAR *)(state->next);
  890|  14.3k|            state->lenbits = 9;
  891|  14.3k|            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
  ------------------
  |  |  140|  14.3k|#  define inflate_table         z_inflate_table
  ------------------
  892|  14.3k|                                &(state->lenbits), state->work);
  893|  14.3k|            if (ret) {
  ------------------
  |  Branch (893:17): [True: 1.14k, False: 13.2k]
  ------------------
  894|  1.14k|                strm->msg = (z_const char *)"invalid literal/lengths set";
  895|  1.14k|                state->mode = BAD;
  896|  1.14k|                break;
  897|  1.14k|            }
  898|  13.2k|            state->distcode = (const code FAR *)(state->next);
  899|  13.2k|            state->distbits = 6;
  900|  13.2k|            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  ------------------
  |  |  140|  13.2k|#  define inflate_table         z_inflate_table
  ------------------
  901|  13.2k|                            &(state->next), &(state->distbits), state->work);
  902|  13.2k|            if (ret) {
  ------------------
  |  Branch (902:17): [True: 490, False: 12.7k]
  ------------------
  903|    490|                strm->msg = (z_const char *)"invalid distances set";
  904|    490|                state->mode = BAD;
  905|    490|                break;
  906|    490|            }
  907|  12.7k|            Tracev((stderr, "inflate:       codes ok\n"));
  908|  12.7k|            state->mode = LEN_;
  909|  12.7k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  12.7k|#define Z_TREES         6
  ------------------
  |  Branch (909:17): [True: 0, False: 12.7k]
  ------------------
  910|       |                /* fallthrough */
  911|   125k|        case LEN_:
  ------------------
  |  Branch (911:9): [True: 112k, False: 4.69M]
  ------------------
  912|   125k|            state->mode = LEN;
  913|       |                /* fallthrough */
  914|  1.69M|        case LEN:
  ------------------
  |  Branch (914:9): [True: 1.56M, False: 3.24M]
  ------------------
  915|  1.69M|            if (have >= 6 && left >= 258) {
  ------------------
  |  Branch (915:17): [True: 1.37M, False: 318k]
  |  Branch (915:30): [True: 452k, False: 923k]
  ------------------
  916|   452k|                RESTORE();
  ------------------
  |  |  340|   452k|    do { \
  |  |  341|   452k|        strm->next_out = put; \
  |  |  342|   452k|        strm->avail_out = left; \
  |  |  343|   452k|        strm->next_in = next; \
  |  |  344|   452k|        strm->avail_in = have; \
  |  |  345|   452k|        state->hold = hold; \
  |  |  346|   452k|        state->bits = bits; \
  |  |  347|   452k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 452k]
  |  |  ------------------
  ------------------
  917|   452k|                inflate_fast(strm, out);
  ------------------
  |  |  139|   452k|#  define inflate_fast          z_inflate_fast
  ------------------
  918|   452k|                LOAD();
  ------------------
  |  |  329|   452k|    do { \
  |  |  330|   452k|        put = strm->next_out; \
  |  |  331|   452k|        left = strm->avail_out; \
  |  |  332|   452k|        next = strm->next_in; \
  |  |  333|   452k|        have = strm->avail_in; \
  |  |  334|   452k|        hold = state->hold; \
  |  |  335|   452k|        bits = state->bits; \
  |  |  336|   452k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (336:14): [Folded, False: 452k]
  |  |  ------------------
  ------------------
  919|   452k|                if (state->mode == TYPE)
  ------------------
  |  Branch (919:21): [True: 100k, False: 351k]
  ------------------
  920|   100k|                    state->back = -1;
  921|   452k|                break;
  922|   452k|            }
  923|  1.24M|            state->back = 0;
  924|  1.68M|            for (;;) {
  925|  1.68M|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  376|  1.68M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  926|  1.68M|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (926:21): [True: 1.22M, False: 455k]
  ------------------
  927|   455k|                PULLBYTE();
  ------------------
  |  |  359|   455k|    do { \
  |  |  360|   455k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 17.4k, False: 438k]
  |  |  ------------------
  |  |  361|   455k|        have--; \
  |  |  362|   438k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   438k|        bits += 8; \
  |  |  364|   438k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 438k]
  |  |  ------------------
  ------------------
  928|   455k|            }
  929|  1.22M|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (929:17): [True: 877k, False: 347k]
  |  Branch (929:28): [True: 24.2k, False: 852k]
  ------------------
  930|  24.2k|                last = here;
  931|  29.3k|                for (;;) {
  932|  29.3k|                    here = state->lencode[last.val +
  933|  29.3k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  376|  29.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  934|  29.3k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (934:25): [True: 23.8k, False: 5.49k]
  ------------------
  935|  5.49k|                    PULLBYTE();
  ------------------
  |  |  359|  5.49k|    do { \
  |  |  360|  5.49k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 350, False: 5.14k]
  |  |  ------------------
  |  |  361|  5.49k|        have--; \
  |  |  362|  5.14k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|  5.14k|        bits += 8; \
  |  |  364|  5.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 5.14k]
  |  |  ------------------
  ------------------
  936|  5.49k|                }
  937|  23.8k|                DROPBITS(last.bits);
  ------------------
  |  |  380|  23.8k|    do { \
  |  |  381|  23.8k|        hold >>= (n); \
  |  |  382|  23.8k|        bits -= (unsigned)(n); \
  |  |  383|  23.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 23.8k]
  |  |  ------------------
  ------------------
  938|  23.8k|                state->back += last.bits;
  939|  23.8k|            }
  940|  1.22M|            DROPBITS(here.bits);
  ------------------
  |  |  380|  1.22M|    do { \
  |  |  381|  1.22M|        hold >>= (n); \
  |  |  382|  1.22M|        bits -= (unsigned)(n); \
  |  |  383|  1.22M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 1.22M]
  |  |  ------------------
  ------------------
  941|  1.22M|            state->back += here.bits;
  942|  1.22M|            state->length = (unsigned)here.val;
  943|  1.22M|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (943:17): [True: 356k, False: 867k]
  ------------------
  944|   356k|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
  945|   356k|                        "inflate:         literal '%c'\n" :
  946|   356k|                        "inflate:         literal 0x%02x\n", here.val));
  947|   356k|                state->mode = LIT;
  948|   356k|                break;
  949|   356k|            }
  950|   867k|            if (here.op & 32) {
  ------------------
  |  Branch (950:17): [True: 2.52k, False: 864k]
  ------------------
  951|  2.52k|                Tracevv((stderr, "inflate:         end of block\n"));
  952|  2.52k|                state->back = -1;
  953|  2.52k|                state->mode = TYPE;
  954|  2.52k|                break;
  955|  2.52k|            }
  956|   864k|            if (here.op & 64) {
  ------------------
  |  Branch (956:17): [True: 98, False: 864k]
  ------------------
  957|     98|                strm->msg = (z_const char *)"invalid literal/length code";
  958|     98|                state->mode = BAD;
  959|     98|                break;
  960|     98|            }
  961|   864k|            state->extra = (unsigned)(here.op) & 15;
  962|   864k|            state->mode = LENEXT;
  963|       |                /* fallthrough */
  964|   868k|        case LENEXT:
  ------------------
  |  Branch (964:9): [True: 4.03k, False: 4.80M]
  ------------------
  965|   868k|            if (state->extra) {
  ------------------
  |  Branch (965:17): [True: 124k, False: 744k]
  ------------------
  966|   124k|                NEEDBITS(state->extra);
  ------------------
  |  |  369|   124k|    do { \
  |  |  370|   173k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 53.0k, False: 120k]
  |  |  ------------------
  |  |  371|   124k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  53.0k|    do { \
  |  |  |  |  360|  53.0k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 4.30k, False: 48.7k]
  |  |  |  |  ------------------
  |  |  |  |  361|  53.0k|        have--; \
  |  |  |  |  362|  48.7k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  48.7k|        bits += 8; \
  |  |  |  |  364|  48.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 48.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   124k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 120k]
  |  |  ------------------
  ------------------
  967|   120k|                state->length += BITS(state->extra);
  ------------------
  |  |  376|   120k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  968|   120k|                DROPBITS(state->extra);
  ------------------
  |  |  380|   120k|    do { \
  |  |  381|   120k|        hold >>= (n); \
  |  |  382|   120k|        bits -= (unsigned)(n); \
  |  |  383|   120k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 120k]
  |  |  ------------------
  ------------------
  969|   120k|                state->back += state->extra;
  970|   120k|            }
  971|   864k|            Tracevv((stderr, "inflate:         length %u\n", state->length));
  972|   864k|            state->was = state->length;
  973|   864k|            state->mode = DIST;
  974|       |                /* fallthrough */
  975|   874k|        case DIST:
  ------------------
  |  Branch (975:9): [True: 10.0k, False: 4.80M]
  ------------------
  976|  1.06M|            for (;;) {
  977|  1.06M|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  376|  1.06M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  978|  1.06M|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (978:21): [True: 852k, False: 209k]
  ------------------
  979|   209k|                PULLBYTE();
  ------------------
  |  |  359|   209k|    do { \
  |  |  360|   209k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 21.5k, False: 188k]
  |  |  ------------------
  |  |  361|   209k|        have--; \
  |  |  362|   188k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   188k|        bits += 8; \
  |  |  364|   188k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 188k]
  |  |  ------------------
  ------------------
  980|   209k|            }
  981|   852k|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (981:17): [True: 36.0k, False: 816k]
  ------------------
  982|  36.0k|                last = here;
  983|  52.5k|                for (;;) {
  984|  52.5k|                    here = state->distcode[last.val +
  985|  52.5k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  376|  52.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  986|  52.5k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (986:25): [True: 35.2k, False: 17.2k]
  ------------------
  987|  17.2k|                    PULLBYTE();
  ------------------
  |  |  359|  17.2k|    do { \
  |  |  360|  17.2k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 783, False: 16.4k]
  |  |  ------------------
  |  |  361|  17.2k|        have--; \
  |  |  362|  16.4k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|  16.4k|        bits += 8; \
  |  |  364|  16.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 16.4k]
  |  |  ------------------
  ------------------
  988|  17.2k|                }
  989|  35.2k|                DROPBITS(last.bits);
  ------------------
  |  |  380|  35.2k|    do { \
  |  |  381|  35.2k|        hold >>= (n); \
  |  |  382|  35.2k|        bits -= (unsigned)(n); \
  |  |  383|  35.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 35.2k]
  |  |  ------------------
  ------------------
  990|  35.2k|                state->back += last.bits;
  991|  35.2k|            }
  992|   852k|            DROPBITS(here.bits);
  ------------------
  |  |  380|   852k|    do { \
  |  |  381|   852k|        hold >>= (n); \
  |  |  382|   852k|        bits -= (unsigned)(n); \
  |  |  383|   852k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 852k]
  |  |  ------------------
  ------------------
  993|   852k|            state->back += here.bits;
  994|   852k|            if (here.op & 64) {
  ------------------
  |  Branch (994:17): [True: 117, False: 851k]
  ------------------
  995|    117|                strm->msg = (z_const char *)"invalid distance code";
  996|    117|                state->mode = BAD;
  997|    117|                break;
  998|    117|            }
  999|   851k|            state->offset = (unsigned)here.val;
 1000|   851k|            state->extra = (unsigned)(here.op) & 15;
 1001|   851k|            state->mode = DISTEXT;
 1002|       |                /* fallthrough */
 1003|   857k|        case DISTEXT:
  ------------------
  |  Branch (1003:9): [True: 5.77k, False: 4.80M]
  ------------------
 1004|   857k|            if (state->extra) {
  ------------------
  |  Branch (1004:17): [True: 169k, False: 688k]
  ------------------
 1005|   169k|                NEEDBITS(state->extra);
  ------------------
  |  |  369|   169k|    do { \
  |  |  370|   314k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 152k, False: 162k]
  |  |  ------------------
  |  |  371|   169k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   152k|    do { \
  |  |  |  |  360|   152k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 6.64k, False: 145k]
  |  |  |  |  ------------------
  |  |  |  |  361|   152k|        have--; \
  |  |  |  |  362|   145k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   145k|        bits += 8; \
  |  |  |  |  364|   145k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 145k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   169k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 162k]
  |  |  ------------------
  ------------------
 1006|   162k|                state->offset += BITS(state->extra);
  ------------------
  |  |  376|   162k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1007|   162k|                DROPBITS(state->extra);
  ------------------
  |  |  380|   162k|    do { \
  |  |  381|   162k|        hold >>= (n); \
  |  |  382|   162k|        bits -= (unsigned)(n); \
  |  |  383|   162k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 162k]
  |  |  ------------------
  ------------------
 1008|   162k|                state->back += state->extra;
 1009|   162k|            }
 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|   851k|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1018|   851k|            state->mode = MATCH;
 1019|       |                /* fallthrough */
 1020|  2.99M|        case MATCH:
  ------------------
  |  Branch (1020:9): [True: 2.14M, False: 2.66M]
  ------------------
 1021|  2.99M|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1021:17): [True: 746k, False: 2.24M]
  ------------------
 1022|  2.24M|            copy = out - left;
 1023|  2.24M|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1023:17): [True: 847k, False: 1.39M]
  ------------------
 1024|   847k|                copy = state->offset - copy;
 1025|   847k|                if (copy > state->whave) {
  ------------------
  |  Branch (1025:21): [True: 872, False: 846k]
  ------------------
 1026|    872|                    if (state->sane) {
  ------------------
  |  Branch (1026:25): [True: 872, False: 0]
  ------------------
 1027|    872|                        strm->msg = (z_const char *)
 1028|    872|                            "invalid distance too far back";
 1029|    872|                        state->mode = BAD;
 1030|    872|                        break;
 1031|    872|                    }
 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|    872|                }
 1046|   846k|                if (copy > state->wnext) {
  ------------------
  |  Branch (1046:21): [True: 36.3k, False: 810k]
  ------------------
 1047|  36.3k|                    copy -= state->wnext;
 1048|  36.3k|                    from = state->window + (state->wsize - copy);
 1049|  36.3k|                }
 1050|   810k|                else
 1051|   810k|                    from = state->window + (state->wnext - copy);
 1052|   846k|                if (copy > state->length) copy = state->length;
  ------------------
  |  Branch (1052:21): [True: 174k, False: 672k]
  ------------------
 1053|   846k|            }
 1054|  1.39M|            else {                              /* copy from output */
 1055|  1.39M|                from = put - state->offset;
 1056|  1.39M|                copy = state->length;
 1057|  1.39M|            }
 1058|  2.24M|            if (copy > left) copy = left;
  ------------------
  |  Branch (1058:17): [True: 737k, False: 1.50M]
  ------------------
 1059|  2.24M|            left -= copy;
 1060|  2.24M|            state->length -= copy;
 1061|   189M|            do {
 1062|   189M|                *put++ = *from++;
 1063|   189M|            } while (--copy);
  ------------------
  |  Branch (1063:22): [True: 187M, False: 2.24M]
  ------------------
 1064|  2.24M|            if (state->length == 0) state->mode = LEN;
  ------------------
  |  Branch (1064:17): [True: 847k, False: 1.39M]
  ------------------
 1065|  2.24M|            break;
 1066|   364k|        case LIT:
  ------------------
  |  Branch (1066:9): [True: 364k, False: 4.44M]
  ------------------
 1067|   364k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1067:17): [True: 8.08k, False: 356k]
  ------------------
 1068|   356k|            *put++ = (unsigned char)(state->length);
 1069|   356k|            left--;
 1070|   356k|            state->mode = LEN;
 1071|   356k|            break;
 1072|  95.4k|        case CHECK:
  ------------------
  |  Branch (1072:9): [True: 95.4k, False: 4.71M]
  ------------------
 1073|  95.4k|            if (state->wrap) {
  ------------------
  |  Branch (1073:17): [True: 95.4k, False: 0]
  ------------------
 1074|  95.4k|                NEEDBITS(32);
  ------------------
  |  |  369|  95.4k|    do { \
  |  |  370|   476k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 381k, False: 95.1k]
  |  |  ------------------
  |  |  371|   381k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|   381k|    do { \
  |  |  |  |  360|   381k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 386, False: 381k]
  |  |  |  |  ------------------
  |  |  |  |  361|   381k|        have--; \
  |  |  |  |  362|   381k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|   381k|        bits += 8; \
  |  |  |  |  364|   381k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 381k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  95.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 95.1k]
  |  |  ------------------
  ------------------
 1075|  95.1k|                out -= left;
 1076|  95.1k|                strm->total_out += out;
 1077|  95.1k|                state->total += out;
 1078|  95.1k|                if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1078:21): [True: 95.1k, False: 0]
  |  Branch (1078:42): [True: 94.0k, False: 1.04k]
  ------------------
 1079|  94.0k|                    strm->adler = state->check =
 1080|  94.0k|                        UPDATE_CHECK(state->check, put - out, out);
  ------------------
  |  |  305|  94.0k|#  define UPDATE_CHECK(check, buf, len) adler32(check, buf, len)
  |  |  ------------------
  |  |  |  |   34|  94.0k|#  define adler32               z_adler32
  |  |  ------------------
  ------------------
 1081|  95.1k|                out = left;
 1082|  95.1k|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1082:21): [True: 95.1k, False: 0]
  |  Branch (1082:42): [True: 10.7k, False: 84.3k]
  ------------------
 1083|       |#ifdef GUNZIP
 1084|       |                     state->flags ? hold :
 1085|       |#endif
 1086|  95.1k|                     ZSWAP32(hold)) != state->check) {
  ------------------
  |  |  258|  95.1k|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|  95.1k|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
 1087|  10.7k|                    strm->msg = (z_const char *)"incorrect data check";
 1088|  10.7k|                    state->mode = BAD;
 1089|  10.7k|                    break;
 1090|  10.7k|                }
 1091|  84.3k|                INITBITS();
  ------------------
  |  |  351|  84.3k|    do { \
  |  |  352|  84.3k|        hold = 0; \
  |  |  353|  84.3k|        bits = 0; \
  |  |  354|  84.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 84.3k]
  |  |  ------------------
  ------------------
 1092|  84.3k|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1093|  84.3k|            }
 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|  84.3k|            state->mode = DONE;
 1110|       |                /* fallthrough */
 1111|  84.3k|        case DONE:
  ------------------
  |  Branch (1111:9): [True: 7, False: 4.81M]
  ------------------
 1112|  84.3k|            ret = Z_STREAM_END;
  ------------------
  |  |  182|  84.3k|#define Z_STREAM_END    1
  ------------------
 1113|  84.3k|            goto inf_leave;
 1114|  40.6k|        case BAD:
  ------------------
  |  Branch (1114:9): [True: 40.6k, False: 4.77M]
  ------------------
 1115|  40.6k|            ret = Z_DATA_ERROR;
  ------------------
  |  |  186|  40.6k|#define Z_DATA_ERROR   (-3)
  ------------------
 1116|  40.6k|            goto inf_leave;
 1117|      0|        case MEM:
  ------------------
  |  Branch (1117:9): [True: 0, False: 4.81M]
  ------------------
 1118|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1119|      0|        case SYNC:
  ------------------
  |  Branch (1119:9): [True: 0, False: 4.81M]
  ------------------
 1120|       |                /* fallthrough */
 1121|      0|        default:
  ------------------
  |  Branch (1121:9): [True: 0, False: 4.81M]
  ------------------
 1122|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1123|  4.81M|        }
 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|   970k|  inf_leave:
 1132|   970k|    RESTORE();
  ------------------
  |  |  340|   970k|    do { \
  |  |  341|   970k|        strm->next_out = put; \
  |  |  342|   970k|        strm->avail_out = left; \
  |  |  343|   970k|        strm->next_in = next; \
  |  |  344|   970k|        strm->avail_in = have; \
  |  |  345|   970k|        state->hold = hold; \
  |  |  346|   970k|        state->bits = bits; \
  |  |  347|   970k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 970k]
  |  |  ------------------
  ------------------
 1133|   970k|    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1133:9): [True: 797k, False: 173k]
  |  Branch (1133:26): [True: 33.3k, False: 140k]
  |  Branch (1133:52): [True: 24.9k, False: 8.36k]
  ------------------
 1134|  24.9k|            (state->mode < CHECK || flush != Z_FINISH)))
  ------------------
  |  |  176|    154|#define Z_FINISH        4
  ------------------
  |  Branch (1134:14): [True: 24.8k, False: 154]
  |  Branch (1134:37): [True: 154, False: 0]
  ------------------
 1135|   822k|        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
  ------------------
  |  Branch (1135:13): [True: 0, False: 822k]
  ------------------
 1136|      0|            state->mode = MEM;
 1137|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1138|      0|        }
 1139|   970k|    in -= strm->avail_in;
 1140|   970k|    out -= strm->avail_out;
 1141|   970k|    strm->total_in += in;
 1142|   970k|    strm->total_out += out;
 1143|   970k|    state->total += out;
 1144|   970k|    if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1144:9): [True: 970k, False: 0]
  |  Branch (1144:30): [True: 812k, False: 158k]
  ------------------
 1145|   812k|        strm->adler = state->check =
 1146|   812k|            UPDATE_CHECK(state->check, strm->next_out - out, out);
  ------------------
  |  |  305|   812k|#  define UPDATE_CHECK(check, buf, len) adler32(check, buf, len)
  |  |  ------------------
  |  |  |  |   34|   812k|#  define adler32               z_adler32
  |  |  ------------------
  ------------------
 1147|   970k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1147:43): [True: 920k, False: 50.7k]
  ------------------
 1148|   970k|                      (state->mode == TYPE ? 128 : 0) +
  ------------------
  |  Branch (1148:24): [True: 588, False: 970k]
  ------------------
 1149|   970k|                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1149:24): [True: 0, False: 970k]
  |  Branch (1149:47): [True: 0, False: 970k]
  ------------------
 1150|   970k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  176|   945k|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  181|  25.2k|#define Z_OK            0
  ------------------
  |  Branch (1150:11): [True: 481k, False: 489k]
  |  Branch (1150:22): [True: 25.2k, False: 456k]
  |  Branch (1150:35): [True: 0, False: 945k]
  |  Branch (1150:57): [True: 25.1k, False: 109]
  ------------------
 1151|  25.1k|        ret = Z_BUF_ERROR;
  ------------------
  |  |  188|  25.1k|#define Z_BUF_ERROR    (-5)
  ------------------
 1152|   970k|    return ret;
 1153|   970k|}
z_inflateEnd:
 1155|   164k|int ZEXPORT inflateEnd(z_streamp strm) {
 1156|   164k|    struct inflate_state FAR *state;
 1157|   164k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1157:9): [True: 16.2k, False: 148k]
  ------------------
 1158|  16.2k|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|  16.2k|#define Z_STREAM_ERROR (-2)
  ------------------
 1159|   148k|    state = (struct inflate_state FAR *)strm->state;
 1160|   148k|    if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  216|   148k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  254|  24.9k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  |  Branch (1160:9): [True: 24.9k, False: 123k]
  ------------------
 1161|   148k|    ZFREE(strm, strm->state);
  ------------------
  |  |  254|   148k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1162|   148k|    strm->state = Z_NULL;
  ------------------
  |  |  216|   148k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1163|   148k|    Tracev((stderr, "inflate: end\n"));
 1164|   148k|    return Z_OK;
  ------------------
  |  |  181|   148k|#define Z_OK            0
  ------------------
 1165|   164k|}
z_inflateValidate:
 1385|   148k|int ZEXPORT inflateValidate(z_streamp strm, int check) {
 1386|   148k|    struct inflate_state FAR *state;
 1387|       |
 1388|   148k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (1388:9): [True: 0, False: 148k]
  ------------------
 1389|   148k|    state = (struct inflate_state FAR *)strm->state;
 1390|   148k|    if (check && state->wrap)
  ------------------
  |  Branch (1390:9): [True: 148k, False: 0]
  |  Branch (1390:18): [True: 148k, False: 0]
  ------------------
 1391|   148k|        state->wrap |= 4;
 1392|      0|    else
 1393|      0|        state->wrap &= ~4;
 1394|   148k|    return Z_OK;
  ------------------
  |  |  181|   148k|#define Z_OK            0
  ------------------
 1395|   148k|}
inflate.c:inflateStateCheck:
   88|  1.73M|local int inflateStateCheck(z_streamp strm) {
   89|  1.73M|    struct inflate_state FAR *state;
   90|  1.73M|    if (strm == Z_NULL ||
  ------------------
  |  |  216|  3.46M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (90:9): [True: 0, False: 1.73M]
  ------------------
   91|  1.73M|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (91:9): [True: 16.2k, False: 1.71M]
  |  Branch (91:42): [True: 0, False: 1.71M]
  ------------------
   92|  16.2k|        return 1;
   93|  1.71M|    state = (struct inflate_state FAR *)strm->state;
   94|  1.71M|    if (state == Z_NULL || state->strm != strm ||
  ------------------
  |  |  216|  3.42M|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (94:9): [True: 0, False: 1.71M]
  |  Branch (94:28): [True: 0, False: 1.71M]
  ------------------
   95|  1.71M|        state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (95:9): [True: 0, False: 1.71M]
  |  Branch (95:31): [True: 0, False: 1.71M]
  ------------------
   96|      0|        return 1;
   97|  1.71M|    return 0;
   98|  1.71M|}
inflate.c:updatewindow:
  252|   822k|local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
  253|   822k|    struct inflate_state FAR *state;
  254|   822k|    unsigned dist;
  255|       |
  256|   822k|    state = (struct inflate_state FAR *)strm->state;
  257|       |
  258|       |    /* if it hasn't been done already, allocate space for the window */
  259|   822k|    if (state->window == Z_NULL) {
  ------------------
  |  |  216|   822k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (259:9): [True: 24.9k, False: 797k]
  ------------------
  260|  24.9k|        state->window = (unsigned char FAR *)
  261|  24.9k|                        ZALLOC(strm, 1U << state->wbits,
  ------------------
  |  |  253|  24.9k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  262|  24.9k|                               sizeof(unsigned char));
  263|  24.9k|        if (state->window == Z_NULL) return 1;
  ------------------
  |  |  216|  24.9k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (263:13): [True: 0, False: 24.9k]
  ------------------
  264|  24.9k|    }
  265|       |
  266|       |    /* if window not in use yet, initialize */
  267|   822k|    if (state->wsize == 0) {
  ------------------
  |  Branch (267:9): [True: 24.9k, False: 797k]
  ------------------
  268|  24.9k|        state->wsize = 1U << state->wbits;
  269|  24.9k|        state->wnext = 0;
  270|  24.9k|        state->whave = 0;
  271|  24.9k|    }
  272|       |
  273|       |    /* copy state->wsize or less output bytes into the circular window */
  274|   822k|    if (copy >= state->wsize) {
  ------------------
  |  Branch (274:9): [True: 20.7k, False: 801k]
  ------------------
  275|  20.7k|        zmemcpy(state->window, end - state->wsize, state->wsize);
  ------------------
  |  |  216|  20.7k|#    define zmemcpy memcpy
  ------------------
  276|  20.7k|        state->wnext = 0;
  277|  20.7k|        state->whave = state->wsize;
  278|  20.7k|    }
  279|   801k|    else {
  280|   801k|        dist = state->wsize - state->wnext;
  281|   801k|        if (dist > copy) dist = copy;
  ------------------
  |  Branch (281:13): [True: 786k, False: 14.3k]
  ------------------
  282|   801k|        zmemcpy(state->window + state->wnext, end - copy, dist);
  ------------------
  |  |  216|   801k|#    define zmemcpy memcpy
  ------------------
  283|   801k|        copy -= dist;
  284|   801k|        if (copy) {
  ------------------
  |  Branch (284:13): [True: 7.84k, False: 793k]
  ------------------
  285|  7.84k|            zmemcpy(state->window, end - copy, copy);
  ------------------
  |  |  216|  7.84k|#    define zmemcpy memcpy
  ------------------
  286|  7.84k|            state->wnext = copy;
  287|  7.84k|            state->whave = state->wsize;
  288|  7.84k|        }
  289|   793k|        else {
  290|   793k|            state->wnext += dist;
  291|   793k|            if (state->wnext == state->wsize) state->wnext = 0;
  ------------------
  |  Branch (291:17): [True: 6.47k, False: 786k]
  ------------------
  292|   793k|            if (state->whave < state->wsize) state->whave += dist;
  ------------------
  |  Branch (292:17): [True: 509k, False: 283k]
  ------------------
  293|   793k|        }
  294|   801k|    }
  295|   822k|    return 0;
  296|   822k|}

z_inflate_table:
   48|  49.5k|                                unsigned FAR *bits, unsigned short FAR *work) {
   49|  49.5k|    unsigned len;               /* a code's length in bits */
   50|  49.5k|    unsigned sym;               /* index of code symbols */
   51|  49.5k|    unsigned min, max;          /* minimum and maximum code lengths */
   52|  49.5k|    unsigned root;              /* number of index bits for root table */
   53|  49.5k|    unsigned curr;              /* number of index bits for current table */
   54|  49.5k|    unsigned drop;              /* code bits to drop for sub-table */
   55|  49.5k|    int left;                   /* number of prefix codes available */
   56|  49.5k|    unsigned used;              /* code entries in table used */
   57|  49.5k|    unsigned huff;              /* Huffman code */
   58|  49.5k|    unsigned incr;              /* for incrementing code, index */
   59|  49.5k|    unsigned fill;              /* index for replicating entries */
   60|  49.5k|    unsigned low;               /* low bits for current root entry */
   61|  49.5k|    unsigned mask;              /* mask for low root bits */
   62|  49.5k|    code here;                  /* table entry for duplication */
   63|  49.5k|    code FAR *next;             /* next available space in table */
   64|  49.5k|    const unsigned short FAR *base = NULL;  /* base value table to use */
   65|  49.5k|    const unsigned short FAR *extra = NULL; /* extra bits table to use */
   66|  49.5k|    unsigned match = 0;         /* use base and extra for symbol >= match */
   67|  49.5k|    unsigned short count[MAXBITS+1];    /* number of codes of each length */
   68|  49.5k|    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
   69|  49.5k|    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
   70|  49.5k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   71|  49.5k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   72|  49.5k|    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
   73|  49.5k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   74|  49.5k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 75};
   75|  49.5k|    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
   76|  49.5k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   77|  49.5k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   78|  49.5k|        8193, 12289, 16385, 24577, 0, 0};
   79|  49.5k|    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
   80|  49.5k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   81|  49.5k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   82|  49.5k|        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|   842k|    for (len = 0; len <= MAXBITS; len++)
  ------------------
  |  |   23|   842k|#define MAXBITS 15
  ------------------
  |  Branch (116:19): [True: 792k, False: 49.5k]
  ------------------
  117|   792k|        count[len] = 0;
  118|  4.83M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (118:19): [True: 4.78M, False: 49.5k]
  ------------------
  119|  4.78M|        count[lens[sym]]++;
  120|       |
  121|       |    /* bound code lengths, force root to be within code lengths */
  122|  49.5k|    root = *bits;
  123|   513k|    for (max = MAXBITS; max >= 1; max--)
  ------------------
  |  |   23|  49.5k|#define MAXBITS 15
  ------------------
  |  Branch (123:25): [True: 512k, False: 226]
  ------------------
  124|   512k|        if (count[max] != 0) break;
  ------------------
  |  Branch (124:13): [True: 49.3k, False: 463k]
  ------------------
  125|  49.5k|    if (root > max) root = max;
  ------------------
  |  Branch (125:9): [True: 36.1k, False: 13.4k]
  ------------------
  126|  49.5k|    if (max == 0) {                     /* no symbols to code at all */
  ------------------
  |  Branch (126:9): [True: 226, False: 49.3k]
  ------------------
  127|    226|        here.op = (unsigned char)64;    /* invalid code marker */
  128|    226|        here.bits = (unsigned char)1;
  129|    226|        here.val = (unsigned short)0;
  130|    226|        *(*table)++ = here;             /* make a table to force an error */
  131|    226|        *(*table)++ = here;
  132|    226|        *bits = 1;
  133|    226|        return 0;     /* no symbols, but wait for decoding to report error */
  134|    226|    }
  135|  79.7k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (135:19): [True: 78.5k, False: 1.22k]
  ------------------
  136|  78.5k|        if (count[min] != 0) break;
  ------------------
  |  Branch (136:13): [True: 48.0k, False: 30.4k]
  ------------------
  137|  49.3k|    if (root < min) root = min;
  ------------------
  |  Branch (137:9): [True: 110, False: 49.2k]
  ------------------
  138|       |
  139|       |    /* check for an over-subscribed or incomplete set of lengths */
  140|  49.3k|    left = 1;
  141|   759k|    for (len = 1; len <= MAXBITS; len++) {
  ------------------
  |  |   23|   759k|#define MAXBITS 15
  ------------------
  |  Branch (141:19): [True: 712k, False: 46.8k]
  ------------------
  142|   712k|        left <<= 1;
  143|   712k|        left -= count[len];
  144|   712k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (144:13): [True: 2.49k, False: 710k]
  ------------------
  145|   712k|    }
  146|  46.8k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (146:9): [True: 1.79k, False: 45.0k]
  |  Branch (146:22): [True: 398, False: 1.39k]
  |  Branch (146:39): [True: 1.11k, False: 279]
  ------------------
  147|  1.51k|        return -1;                      /* incomplete set */
  148|       |
  149|       |    /* generate offsets into symbol table for each length for sorting */
  150|  45.3k|    offs[1] = 0;
  151|   679k|    for (len = 1; len < MAXBITS; len++)
  ------------------
  |  |   23|   679k|#define MAXBITS 15
  ------------------
  |  Branch (151:19): [True: 634k, False: 45.3k]
  ------------------
  152|   634k|        offs[len + 1] = offs[len] + count[len];
  153|       |
  154|       |    /* sort symbols by length, by symbol order within each length */
  155|  4.45M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (155:19): [True: 4.41M, False: 45.3k]
  ------------------
  156|  4.41M|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
  ------------------
  |  Branch (156:13): [True: 927k, False: 3.48M]
  ------------------
  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|  45.3k|    switch (type) {
  ------------------
  |  Branch (190:13): [True: 45.3k, False: 0]
  ------------------
  191|  19.3k|    case CODES:
  ------------------
  |  Branch (191:5): [True: 19.3k, False: 25.9k]
  ------------------
  192|  19.3k|        match = 20;
  193|  19.3k|        break;
  194|  13.2k|    case LENS:
  ------------------
  |  Branch (194:5): [True: 13.2k, False: 32.0k]
  ------------------
  195|  13.2k|        base = lbase;
  196|  13.2k|        extra = lext;
  197|  13.2k|        match = 257;
  198|  13.2k|        break;
  199|  12.7k|    case DISTS:
  ------------------
  |  Branch (199:5): [True: 12.7k, False: 32.5k]
  ------------------
  200|  12.7k|        base = dbase;
  201|  12.7k|        extra = dext;
  202|  45.3k|    }
  203|       |
  204|       |    /* initialize state for loop */
  205|  45.3k|    huff = 0;                   /* starting code */
  206|  45.3k|    sym = 0;                    /* starting code symbol */
  207|  45.3k|    len = min;                  /* starting code length */
  208|  45.3k|    next = *table;              /* current table to fill in */
  209|  45.3k|    curr = root;                /* current table index bits */
  210|  45.3k|    drop = 0;                   /* current bits to drop from code for index */
  211|  45.3k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  212|  45.3k|    used = 1U << root;          /* use root table entries */
  213|  45.3k|    mask = used - 1;            /* mask for comparing low */
  214|       |
  215|       |    /* check available table space */
  216|  45.3k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   49|  13.2k|#define ENOUGH_LENS 852
  ------------------
  |  Branch (216:10): [True: 13.2k, False: 32.0k]
  |  Branch (216:26): [True: 0, False: 13.2k]
  ------------------
  217|  45.3k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   50|  12.7k|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (217:10): [True: 12.7k, False: 32.5k]
  |  Branch (217:27): [True: 0, False: 12.7k]
  ------------------
  218|      0|        return 1;
  219|       |
  220|       |    /* process all codes and make table entries */
  221|   927k|    for (;;) {
  222|       |        /* create table entry */
  223|   927k|        here.bits = (unsigned char)(len - drop);
  224|   927k|        if (work[sym] + 1U < match) {
  ------------------
  |  Branch (224:13): [True: 634k, False: 292k]
  ------------------
  225|   634k|            here.op = (unsigned char)0;
  226|   634k|            here.val = work[sym];
  227|   634k|        }
  228|   292k|        else if (work[sym] >= match) {
  ------------------
  |  Branch (228:18): [True: 279k, False: 13.2k]
  ------------------
  229|   279k|            here.op = (unsigned char)(extra[work[sym] - match]);
  230|   279k|            here.val = base[work[sym] - match];
  231|   279k|        }
  232|  13.2k|        else {
  233|  13.2k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  234|  13.2k|            here.val = 0;
  235|  13.2k|        }
  236|       |
  237|       |        /* replicate for those indices with low len bits equal to huff */
  238|   927k|        incr = 1U << (len - drop);
  239|   927k|        fill = 1U << curr;
  240|   927k|        min = fill;                 /* save offset to next table */
  241|  3.67M|        do {
  242|  3.67M|            fill -= incr;
  243|  3.67M|            next[(huff >> drop) + fill] = here;
  244|  3.67M|        } while (fill != 0);
  ------------------
  |  Branch (244:18): [True: 2.74M, False: 927k]
  ------------------
  245|       |
  246|       |        /* backwards increment the len-bit code huff */
  247|   927k|        incr = 1U << (len - 1);
  248|  1.80M|        while (huff & incr)
  ------------------
  |  Branch (248:16): [True: 881k, False: 927k]
  ------------------
  249|   881k|            incr >>= 1;
  250|   927k|        if (incr != 0) {
  ------------------
  |  Branch (250:13): [True: 882k, False: 45.0k]
  ------------------
  251|   882k|            huff &= incr - 1;
  252|   882k|            huff += incr;
  253|   882k|        }
  254|  45.0k|        else
  255|  45.0k|            huff = 0;
  256|       |
  257|       |        /* go to next symbol, update count, len */
  258|   927k|        sym++;
  259|   927k|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (259:13): [True: 209k, False: 717k]
  ------------------
  260|   209k|            if (len == max) break;
  ------------------
  |  Branch (260:17): [True: 45.3k, False: 163k]
  ------------------
  261|   163k|            len = lens[work[sym]];
  262|   163k|        }
  263|       |
  264|       |        /* create new sub-table if needed */
  265|   881k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (265:13): [True: 84.2k, False: 797k]
  |  Branch (265:27): [True: 29.9k, False: 54.2k]
  ------------------
  266|       |            /* if first time, transition to sub-tables */
  267|  29.9k|            if (drop == 0)
  ------------------
  |  Branch (267:17): [True: 7.20k, False: 22.7k]
  ------------------
  268|  7.20k|                drop = root;
  269|       |
  270|       |            /* increment past last table */
  271|  29.9k|            next += min;            /* here min is 1 << curr */
  272|       |
  273|       |            /* determine length of next table */
  274|  29.9k|            curr = len - drop;
  275|  29.9k|            left = (int)(1 << curr);
  276|  35.1k|            while (curr + drop < max) {
  ------------------
  |  Branch (276:20): [True: 25.6k, False: 9.46k]
  ------------------
  277|  25.6k|                left -= count[curr + drop];
  278|  25.6k|                if (left <= 0) break;
  ------------------
  |  Branch (278:21): [True: 20.4k, False: 5.20k]
  ------------------
  279|  5.20k|                curr++;
  280|  5.20k|                left <<= 1;
  281|  5.20k|            }
  282|       |
  283|       |            /* check for enough space */
  284|  29.9k|            used += 1U << curr;
  285|  29.9k|            if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   49|  19.1k|#define ENOUGH_LENS 852
  ------------------
  |  Branch (285:18): [True: 19.1k, False: 10.8k]
  |  Branch (285:34): [True: 0, False: 19.1k]
  ------------------
  286|  29.9k|                (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   50|  10.8k|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (286:18): [True: 10.8k, False: 19.1k]
  |  Branch (286:35): [True: 0, False: 10.8k]
  ------------------
  287|      0|                return 1;
  288|       |
  289|       |            /* point entry in root table to sub-table */
  290|  29.9k|            low = huff & mask;
  291|  29.9k|            (*table)[low].op = (unsigned char)curr;
  292|  29.9k|            (*table)[low].bits = (unsigned char)root;
  293|  29.9k|            (*table)[low].val = (unsigned short)(next - *table);
  294|  29.9k|        }
  295|   881k|    }
  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|  45.3k|    if (huff != 0) {
  ------------------
  |  Branch (300:9): [True: 279, False: 45.0k]
  ------------------
  301|    279|        here.op = (unsigned char)64;            /* invalid code marker */
  302|    279|        here.bits = (unsigned char)(len - drop);
  303|    279|        here.val = (unsigned short)0;
  304|    279|        next[huff] = here;
  305|    279|    }
  306|       |
  307|       |    /* set return parameters */
  308|  45.3k|    *table += used;
  309|  45.3k|    *bits = root;
  310|  45.3k|    return 0;
  311|  45.3k|}
z_inflate_fixed:
  364|   112k|void inflate_fixed(struct inflate_state FAR *state) {
  365|       |#ifdef BUILDFIXED
  366|       |    z_once(&built, buildtables);
  367|       |#endif /* BUILDFIXED */
  368|   112k|    state->lencode = lenfix;
  369|   112k|    state->lenbits = 9;
  370|   112k|    state->distcode = distfix;
  371|   112k|    state->distbits = 5;
  372|   112k|}

tj3Compress12:
   80|  22.3k|{
   81|  22.3k|  static const char FUNCTION_NAME[] = GET_STRING(tj3Compress, BITS_IN_JSAMPLE);
  ------------------
  |  |   71|  22.3k|#define GET_STRING(name, suffix)  _GET_STRING(name, suffix)
  |  |  ------------------
  |  |  |  |   70|  22.3k|#define _GET_STRING(name, suffix)  #name #suffix
  |  |  ------------------
  ------------------
   82|  22.3k|  int i, retval = 0;
   83|  22.3k|  boolean alloc = TRUE;
  ------------------
  |  |  210|  22.3k|#define TRUE    1
  ------------------
   84|  22.3k|  _JSAMPROW *row_pointer = NULL;
  ------------------
  |  |   46|  22.3k|#define _JSAMPROW  J12SAMPROW
  ------------------
   85|       |
   86|  22.3k|  GET_CINSTANCE(handle)
  ------------------
  |  |  326|  22.3k|  tjinstance *this = (tjinstance *)handle; \
  |  |  327|  22.3k|  j_compress_ptr cinfo = NULL; \
  |  |  328|  22.3k|  \
  |  |  329|  22.3k|  if (!this) { \
  |  |  ------------------
  |  |  |  Branch (329:7): [True: 0, False: 22.3k]
  |  |  ------------------
  |  |  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|  22.3k|  cinfo = &this->cinfo; \
  |  |  334|  22.3k|  this->jerr.warning = FALSE; \
  |  |  ------------------
  |  |  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  335|  22.3k|  this->isInstanceError = FALSE;
  |  |  ------------------
  |  |  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  ------------------
   87|  22.3k|  if ((this->init & COMPRESS) == 0)
  ------------------
  |  Branch (87:7): [True: 0, False: 22.3k]
  ------------------
   88|  22.3k|    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|  22.3k|  if (srcBuf == NULL || width <= 0 || pitch < 0 || height <= 0 ||
  ------------------
  |  Branch (90:7): [True: 0, False: 22.3k]
  |  Branch (90:25): [True: 0, False: 22.3k]
  |  Branch (90:39): [True: 0, False: 22.3k]
  |  Branch (90:52): [True: 0, False: 22.3k]
  ------------------
   91|  22.3k|      pixelFormat < 0 || pixelFormat >= TJ_NUMPF || jpegBuf == NULL ||
  ------------------
  |  |  283|  44.7k|#define TJ_NUMPF  12
  ------------------
  |  Branch (91:7): [True: 0, False: 22.3k]
  |  Branch (91:26): [True: 0, False: 22.3k]
  |  Branch (91:53): [True: 0, False: 22.3k]
  ------------------
   92|  22.3k|      jpegSize == NULL)
  ------------------
  |  Branch (92:7): [True: 0, False: 22.3k]
  ------------------
   93|  22.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|}
  |  |  ------------------
  ------------------
   94|       |
   95|  22.3k|  if (!this->lossless && this->quality == -1)
  ------------------
  |  Branch (95:7): [True: 22.3k, False: 0]
  |  Branch (95:26): [True: 0, False: 22.3k]
  ------------------
   96|  22.3k|    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|  22.3k|  if (!this->lossless && this->subsamp == TJSAMP_UNKNOWN)
  ------------------
  |  Branch (97:7): [True: 22.3k, False: 0]
  |  Branch (97:26): [True: 0, False: 22.3k]
  ------------------
   98|  22.3k|    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|  22.3k|  if (pitch == 0) pitch = width * tjPixelSize[pixelFormat];
  ------------------
  |  Branch (100:7): [True: 22.3k, False: 0]
  ------------------
  101|      0|  else if (pitch < width * tjPixelSize[pixelFormat])
  ------------------
  |  Branch (101:12): [True: 0, False: 0]
  ------------------
  102|  22.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|}
  |  |  ------------------
  ------------------
  103|       |
  104|  22.3k|  if ((row_pointer = (_JSAMPROW *)malloc(sizeof(_JSAMPROW) * height)) == NULL)
  ------------------
  |  Branch (104:7): [True: 0, False: 22.3k]
  ------------------
  105|  22.3k|    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|  22.3k|  CATCH_LIBJPEG(this);
  ------------------
  |  |  293|  22.3k|#define CATCH_LIBJPEG(this) { \
  |  |  294|  22.3k|  if (setjmp(this->jerr.setjmp_buffer)) { \
  |  |  295|      4|    /* If we get here, the JPEG code has signaled an error. */ \
  |  |  296|      4|    retval = -1;  goto bailout; \
  |  |  297|      4|  } \
  |  |  298|  22.3k|}
  ------------------
  |  Branch (107:3): [True: 4, False: 22.3k]
  ------------------
  108|       |
  109|  22.3k|  cinfo->image_width = width;
  110|  22.3k|  cinfo->image_height = height;
  111|  22.3k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  | 1270|  22.3k|#define BITS_IN_JSAMPLE  12
  ------------------
  112|       |#if BITS_IN_JSAMPLE == 8
  113|       |  if (this->lossless && this->precision >= 2 &&
  114|       |      this->precision <= BITS_IN_JSAMPLE)
  115|       |#else
  116|  22.3k|  if (this->lossless && this->precision >= BITS_IN_JSAMPLE - 3 &&
  ------------------
  |  | 1270|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (116:7): [True: 0, False: 22.3k]
  |  Branch (116:25): [True: 0, False: 0]
  ------------------
  117|      0|      this->precision <= BITS_IN_JSAMPLE)
  ------------------
  |  | 1270|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (117:7): [True: 0, False: 0]
  ------------------
  118|      0|#endif
  119|      0|    cinfo->data_precision = this->precision;
  120|       |
  121|  22.3k|  setCompDefaults(this, pixelFormat, FALSE);
  ------------------
  |  |  207|  22.3k|#define FALSE   0               /* values of boolean */
  ------------------
  122|  22.3k|  if (this->noRealloc) alloc = FALSE;
  ------------------
  |  |  207|  3.16k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (122:7): [True: 3.16k, False: 19.1k]
  ------------------
  123|  22.3k|  jpeg_mem_dest_tj(cinfo, jpegBuf, jpegSize, alloc);
  124|       |
  125|  22.3k|  jpeg_start_compress(cinfo, TRUE);
  ------------------
  |  |  210|  22.3k|#define TRUE    1
  ------------------
  126|  22.3k|  if (this->iccBuf != NULL && this->iccSize != 0)
  ------------------
  |  Branch (126:7): [True: 18.8k, False: 3.53k]
  |  Branch (126:31): [True: 18.8k, False: 0]
  ------------------
  127|  18.8k|    jpeg_write_icc_profile(cinfo, this->iccBuf, (unsigned int)this->iccSize);
  128|  31.8M|  for (i = 0; i < height; i++) {
  ------------------
  |  Branch (128:15): [True: 31.8M, False: 22.3k]
  ------------------
  129|  31.8M|    if (this->bottomUp)
  ------------------
  |  Branch (129:9): [True: 4.69M, False: 27.1M]
  ------------------
  130|  4.69M|      row_pointer[i] = (_JSAMPROW)&srcBuf[(height - i - 1) * (size_t)pitch];
  131|  27.1M|    else
  132|  27.1M|      row_pointer[i] = (_JSAMPROW)&srcBuf[i * (size_t)pitch];
  133|  31.8M|  }
  134|  44.7k|  while (cinfo->next_scanline < cinfo->image_height)
  ------------------
  |  Branch (134:10): [True: 22.3k, False: 22.3k]
  ------------------
  135|  22.3k|    _jpeg_write_scanlines(cinfo, &row_pointer[cinfo->next_scanline],
  ------------------
  |  |   55|  22.3k|#define _jpeg_write_scanlines  jpeg12_write_scanlines
  ------------------
  136|  22.3k|                          cinfo->image_height - cinfo->next_scanline);
  137|  22.3k|  jpeg_finish_compress(cinfo);
  138|       |
  139|  22.3k|bailout:
  140|  22.3k|  if (cinfo->global_state > CSTATE_START && alloc)
  ------------------
  |  |   44|  44.7k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (140:7): [True: 4, False: 22.3k]
  |  Branch (140:45): [True: 4, False: 0]
  ------------------
  141|      4|    (*cinfo->dest->term_destination) (cinfo);
  142|  22.3k|  if (cinfo->global_state > CSTATE_START || retval == -1)
  ------------------
  |  |   44|  44.7k|#define CSTATE_START     100    /* after create_compress */
  ------------------
  |  Branch (142:7): [True: 4, False: 22.3k]
  |  Branch (142:45): [True: 0, False: 22.3k]
  ------------------
  143|      4|    jpeg_abort_compress(cinfo);
  144|  22.3k|  free(row_pointer);
  145|  22.3k|  if (this->jerr.warning) retval = -1;
  ------------------
  |  Branch (145:7): [True: 0, False: 22.3k]
  ------------------
  146|  22.3k|  return retval;
  147|  22.3k|}
_tj3LoadImageFromFileHandle12:
  306|  49.6k|{
  307|  49.6k|  static const char FUNCTION_NAME[] =
  308|  49.6k|    GET_STRING(tj3LoadImage, BITS_IN_JSAMPLE);
  ------------------
  |  |   71|  49.6k|#define GET_STRING(name, suffix)  _GET_STRING(name, suffix)
  |  |  ------------------
  |  |  |  |   70|  49.6k|#define _GET_STRING(name, suffix)  #name #suffix
  |  |  ------------------
  ------------------
  309|       |
  310|  49.6k|  int retval = 0, tempc;
  311|  49.6k|  size_t pitch;
  312|  49.6k|  tjhandle handle2 = NULL;
  313|  49.6k|  tjinstance *this2;
  314|  49.6k|  j_compress_ptr cinfo = NULL;
  315|  49.6k|  cjpeg_source_ptr src = NULL;
  316|  49.6k|  _JSAMPLE *dstBuf = NULL;
  ------------------
  |  |   45|  49.6k|#define _JSAMPLE  J12SAMPLE
  ------------------
  317|  49.6k|  boolean invert;
  318|       |
  319|  49.6k|  GET_TJINSTANCE(handle, NULL)
  ------------------
  |  |  350|  49.6k|  tjinstance *this = (tjinstance *)handle; \
  |  |  351|  49.6k|  \
  |  |  352|  49.6k|  if (!this) { \
  |  |  ------------------
  |  |  |  Branch (352:7): [True: 0, False: 49.6k]
  |  |  ------------------
  |  |  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|  49.6k|  this->jerr.warning = FALSE; \
  |  |  ------------------
  |  |  |  |  207|  49.6k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  357|  49.6k|  this->isInstanceError = FALSE;
  |  |  ------------------
  |  |  |  |  207|  49.6k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  ------------------
  320|       |
  321|  49.6k|  if (!file || !width || align < 1 || !height || !pixelFormat ||
  ------------------
  |  Branch (321:7): [True: 0, False: 49.6k]
  |  Branch (321:16): [True: 0, False: 49.6k]
  |  Branch (321:26): [True: 0, False: 49.6k]
  |  Branch (321:39): [True: 0, False: 49.6k]
  |  Branch (321:50): [True: 0, False: 49.6k]
  ------------------
  322|  49.6k|      *pixelFormat < TJPF_UNKNOWN || *pixelFormat >= TJ_NUMPF)
  ------------------
  |  |  283|  49.6k|#define TJ_NUMPF  12
  ------------------
  |  Branch (322:7): [True: 0, False: 49.6k]
  |  Branch (322:38): [True: 0, False: 49.6k]
  ------------------
  323|  49.6k|    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|  49.6k|  if ((align & (align - 1)) != 0)
  ------------------
  |  Branch (324:7): [True: 0, False: 49.6k]
  ------------------
  325|  49.6k|    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|  49.6k|  if ((handle2 = tj3Init(TJINIT_COMPRESS)) == NULL) return NULL;
  ------------------
  |  Branch (330:7): [True: 0, False: 49.6k]
  ------------------
  331|  49.6k|  this2 = (tjinstance *)handle2;
  332|  49.6k|  cinfo = &this2->cinfo;
  333|       |
  334|  49.6k|  if ((tempc = getc(file)) < 0 || ungetc(tempc, file) == EOF)
  ------------------
  |  Branch (334:7): [True: 0, False: 49.6k]
  |  Branch (334:35): [True: 0, False: 49.6k]
  ------------------
  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|  49.6k|  else if (tempc == EOF)
  ------------------
  |  Branch (336:12): [True: 0, False: 49.6k]
  ------------------
  337|  49.6k|    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|  49.6k|  CATCH_LIBJPEG2();
  ------------------
  |  |  303|  49.6k|#define CATCH_LIBJPEG2() { \
  |  |  304|  49.6k|  if (setjmp(this2->jerr.setjmp_buffer)) { \
  |  |  305|     28|    memcpy(this->errStr, this2->errStr, JMSG_LENGTH_MAX); \
  |  |  ------------------
  |  |  |  |  792|     28|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  306|     28|    this->jerr.warning = this2->jerr.warning; \
  |  |  307|     28|    this->isInstanceError = this2->isInstanceError; \
  |  |  308|     28|    retval = -1;  goto bailout; \
  |  |  309|     28|  } \
  |  |  310|  49.6k|}
  ------------------
  |  Branch (339:3): [True: 28, False: 49.6k]
  ------------------
  340|       |
  341|  49.6k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  | 1270|  49.6k|#define BITS_IN_JSAMPLE  12
  ------------------
  342|  49.6k|  if (*pixelFormat == TJPF_UNKNOWN) cinfo->in_color_space = JCS_UNKNOWN;
  ------------------
  |  Branch (342:7): [True: 0, False: 49.6k]
  ------------------
  343|  49.6k|  else cinfo->in_color_space = pf2cs[*pixelFormat];
  344|  49.6k|  if (tempc == 'B') {
  ------------------
  |  Branch (344:7): [True: 28, False: 49.6k]
  ------------------
  345|     28|    if ((src = jinit_read_bmp(cinfo, FALSE)) == NULL)
  ------------------
  |  |  207|     28|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (345:9): [True: 0, False: 28]
  ------------------
  346|     28|      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|     28|    invert = !this->bottomUp;
  348|  49.6k|  } else if (tempc == 0x89) {
  ------------------
  |  Branch (348:14): [True: 32.8k, False: 16.8k]
  ------------------
  349|       |#if BITS_IN_JSAMPLE == 8
  350|       |    if (this->precision >= 2 && this->precision <= BITS_IN_JSAMPLE)
  351|       |#else
  352|  32.8k|    if (this->precision >= BITS_IN_JSAMPLE - 3 &&
  ------------------
  |  | 1270|  32.8k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (352:9): [True: 0, False: 32.8k]
  ------------------
  353|      0|        this->precision <= BITS_IN_JSAMPLE)
  ------------------
  |  | 1270|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (353:9): [True: 0, False: 0]
  ------------------
  354|      0|#endif
  355|      0|      cinfo->data_precision = this->precision;
  356|  32.8k|    if ((src = _jinit_read_png(cinfo)) == NULL)
  ------------------
  |  |   48|  32.8k|#define _jinit_read_png  j12init_read_png
  ------------------
  |  Branch (356:9): [True: 0, False: 32.8k]
  ------------------
  357|  32.8k|      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|  32.8k|    invert = this->bottomUp;
  359|  32.8k|  } else if (tempc == 'P') {
  ------------------
  |  Branch (359:14): [True: 16.1k, False: 693]
  ------------------
  360|       |#if BITS_IN_JSAMPLE == 8
  361|       |    if (this->precision >= 2 && this->precision <= BITS_IN_JSAMPLE)
  362|       |#else
  363|  16.1k|    if (this->precision >= BITS_IN_JSAMPLE - 3 &&
  ------------------
  |  | 1270|  16.1k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (363:9): [True: 0, False: 16.1k]
  ------------------
  364|      0|        this->precision <= BITS_IN_JSAMPLE)
  ------------------
  |  | 1270|      0|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (364:9): [True: 0, False: 0]
  ------------------
  365|      0|#endif
  366|      0|      cinfo->data_precision = this->precision;
  367|  16.1k|    if ((src = _jinit_read_ppm(cinfo)) == NULL)
  ------------------
  |  |   50|  16.1k|#define _jinit_read_ppm  j12init_read_ppm
  ------------------
  |  Branch (367:9): [True: 0, False: 16.1k]
  ------------------
  368|  16.1k|      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|  16.1k|    invert = this->bottomUp;
  370|  16.1k|  } else
  371|  48.9k|    THROW("Unsupported file type");
  ------------------
  |  |  283|    693|#define THROW(m)  THROWRV(m, -1)
  |  |  ------------------
  |  |  |  |  279|    693|#define THROWRV(m, rv) { \
  |  |  |  |  280|    693|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    693|#define SNPRINTF  snprintf
  |  |  |  |  ------------------
  |  |  |  |                 SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  792|    693|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  ------------------
  |  |  |  |  281|    693|  this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  210|    693|#define TRUE    1
  |  |  |  |  ------------------
  |  |  |  |                 this->isInstanceError = TRUE;  THROWG(m, rv) \
  |  |  |  |  ------------------
  |  |  |  |  |  |  254|    693|#define THROWG(m, rv) { \
  |  |  |  |  |  |  255|    693|  SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    693|#define SNPRINTF  snprintf
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 SNPRINTF(errStr, JMSG_LENGTH_MAX, "%s(): %s", FUNCTION_NAME, m); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  792|    693|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  256|    693|  retval = rv;  goto bailout; \
  |  |  |  |  |  |  257|    693|}
  |  |  |  |  ------------------
  |  |  |  |  282|    693|}
  |  |  ------------------
  ------------------
  372|       |
  373|  48.9k|  CATCH_LIBJPEG2();
  ------------------
  |  |  303|  48.9k|#define CATCH_LIBJPEG2() { \
  |  |  304|  48.9k|  if (setjmp(this2->jerr.setjmp_buffer)) { \
  |  |  305|  27.3k|    memcpy(this->errStr, this2->errStr, JMSG_LENGTH_MAX); \
  |  |  ------------------
  |  |  |  |  792|  27.3k|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  306|  27.3k|    this->jerr.warning = this2->jerr.warning; \
  |  |  307|  27.3k|    this->isInstanceError = this2->isInstanceError; \
  |  |  308|  27.3k|    retval = -1;  goto bailout; \
  |  |  309|  27.3k|  } \
  |  |  310|  48.9k|}
  ------------------
  |  Branch (373:3): [True: 27.3k, False: 21.5k]
  ------------------
  374|       |
  375|  21.5k|  cinfo->mem->max_memory_to_use = (long)this->maxMemory * 1048576L;
  376|       |
  377|  21.5k|  src->input_file = file;
  378|       |  /* Refuse to load images larger than the specified size. */
  379|  21.5k|  src->max_pixels = this->maxPixels;
  380|  21.5k|  (*src->start_input) (cinfo, src);
  381|  21.5k|  if (tempc == 'B') {
  ------------------
  |  Branch (381:7): [True: 0, False: 21.5k]
  ------------------
  382|      0|    if (cinfo->X_density && cinfo->Y_density) {
  ------------------
  |  Branch (382:9): [True: 0, False: 0]
  |  Branch (382:29): [True: 0, False: 0]
  ------------------
  383|      0|      this->xDensity = cinfo->X_density;
  384|      0|      this->yDensity = cinfo->Y_density;
  385|      0|      this->densityUnits = cinfo->density_unit;
  386|      0|    }
  387|  21.5k|  } else if (tempc == 0x89 && (this->init & COMPRESS) &&
  ------------------
  |  Branch (387:14): [True: 7.61k, False: 13.9k]
  |  Branch (387:31): [True: 7.61k, False: 0]
  ------------------
  388|  7.61k|             (this->saveMarkers == 2 || this->saveMarkers == 4)) {
  ------------------
  |  Branch (388:15): [True: 7.61k, False: 0]
  |  Branch (388:41): [True: 0, False: 0]
  ------------------
  389|  7.61k|    JOCTET *iccBuf = NULL;
  390|  7.61k|    unsigned int iccLen = 0;
  391|       |
  392|  7.61k|    if ((*src->read_icc_profile) (cinfo, src, &iccBuf, &iccLen) && iccBuf &&
  ------------------
  |  Branch (392:9): [True: 7, False: 7.61k]
  |  Branch (392:68): [True: 7, False: 0]
  ------------------
  393|      7|        iccLen)
  ------------------
  |  Branch (393:9): [True: 7, False: 0]
  ------------------
  394|      7|      tj3SetICCProfile(handle, (unsigned char *)iccBuf, iccLen);
  395|  7.61k|  }
  396|  21.5k|  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
  397|       |
  398|  21.5k|  *width = cinfo->image_width;  *height = cinfo->image_height;
  399|  21.5k|  *pixelFormat = cs2pf[cinfo->in_color_space];
  400|       |
  401|  21.5k|  pitch = PAD((*width) * tjPixelSize[*pixelFormat], align);
  ------------------
  |  |   57|  21.5k|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
  402|       |
  403|  21.5k|  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|  21.5k|      (dstBuf = (_JSAMPLE *)malloc(pitch * (*height) *
  ------------------
  |  Branch (409:7): [True: 0, False: 21.5k]
  ------------------
  410|  21.5k|                                   sizeof(_JSAMPLE))) == NULL)
  411|  21.5k|    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|  21.5k|  CATCH_LIBJPEG2();
  ------------------
  |  |  303|  21.5k|#define CATCH_LIBJPEG2() { \
  |  |  304|  21.5k|  if (setjmp(this2->jerr.setjmp_buffer)) { \
  |  |  305|  9.40k|    memcpy(this->errStr, this2->errStr, JMSG_LENGTH_MAX); \
  |  |  ------------------
  |  |  |  |  792|  9.40k|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  |  |  ------------------
  |  |  306|  9.40k|    this->jerr.warning = this2->jerr.warning; \
  |  |  307|  9.40k|    this->isInstanceError = this2->isInstanceError; \
  |  |  308|  9.40k|    retval = -1;  goto bailout; \
  |  |  309|  9.40k|  } \
  |  |  310|  21.5k|}
  ------------------
  |  Branch (413:3): [True: 9.40k, False: 12.1k]
  ------------------
  414|       |
  415|  32.0M|  while (cinfo->next_scanline < cinfo->image_height) {
  ------------------
  |  Branch (415:10): [True: 31.9M, False: 12.1k]
  ------------------
  416|  31.9M|    int i, nlines = (*src->get_pixel_rows) (cinfo, src);
  417|       |
  418|  63.9M|    for (i = 0; i < nlines; i++) {
  ------------------
  |  Branch (418:17): [True: 31.9M, False: 31.9M]
  ------------------
  419|  31.9M|      _JSAMPLE *dstptr;
  ------------------
  |  |   45|  31.9M|#define _JSAMPLE  J12SAMPLE
  ------------------
  420|  31.9M|      int row;
  421|       |
  422|  31.9M|      row = cinfo->next_scanline + i;
  423|  31.9M|      if (invert) dstptr = &dstBuf[((*height) - row - 1) * pitch];
  ------------------
  |  Branch (423:11): [True: 4.72M, False: 27.2M]
  ------------------
  424|  27.2M|      else dstptr = &dstBuf[row * pitch];
  425|  31.9M|      memcpy(dstptr, src->_buffer[i],
  ------------------
  |  |   47|  31.9M|#define _buffer  buffer12
  ------------------
  426|  31.9M|             (*width) * tjPixelSize[*pixelFormat] * sizeof(_JSAMPLE));
  427|  31.9M|    }
  428|  31.9M|    cinfo->next_scanline += nlines;
  429|  31.9M|  }
  430|       |
  431|  49.6k|bailout:
  432|  49.6k|  if (src)
  ------------------
  |  Branch (432:7): [True: 48.9k, False: 749]
  ------------------
  433|  48.9k|    (*src->finish_input) (cinfo, src);
  434|  49.6k|  tj3Destroy(handle2);
  435|  49.6k|  if (retval < 0) { free(dstBuf);  dstBuf = NULL; }
  ------------------
  |  Branch (435:7): [True: 37.5k, False: 12.1k]
  ------------------
  436|  49.6k|  return dstBuf;
  437|  12.1k|}

tj3InitVersion:
  596|  56.7k|{
  597|  56.7k|  static const char FUNCTION_NAME[] = "tj3Init";
  598|  56.7k|  tjinstance *this = NULL;
  599|  56.7k|  tjhandle retval = NULL;
  600|       |
  601|  56.7k|  if (initType < 0 || initType >= TJ_NUMINIT || apiVersion < 1000000 ||
  ------------------
  |  |   86|   113k|#define TJ_NUMINIT  3
  ------------------
  |  Branch (601:7): [True: 0, False: 56.7k]
  |  Branch (601:23): [True: 0, False: 56.7k]
  |  Branch (601:49): [True: 0, False: 56.7k]
  ------------------
  602|  56.7k|      apiVersion > 999999999)
  ------------------
  |  Branch (602:7): [True: 0, False: 56.7k]
  ------------------
  603|  56.7k|    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|  56.7k|  if ((this = (tjinstance *)malloc(sizeof(tjinstance))) == NULL)
  ------------------
  |  Branch (605:7): [True: 0, False: 56.7k]
  ------------------
  606|  56.7k|    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|  56.7k|  memset(this, 0, sizeof(tjinstance));
  608|  56.7k|  SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "No error");
  ------------------
  |  |   42|  56.7k|#define SNPRINTF  snprintf
  ------------------
                SNPRINTF(this->errStr, JMSG_LENGTH_MAX, "No error");
  ------------------
  |  |  792|  56.7k|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  609|       |
  610|  56.7k|  this->quality = -1;
  611|  56.7k|  this->subsamp = TJSAMP_UNKNOWN;
  612|  56.7k|  this->jpegWidth = -1;
  613|  56.7k|  this->jpegHeight = -1;
  614|  56.7k|  this->precision = 8;
  615|  56.7k|  this->colorspace = TJCS_DEFAULT;
  616|  56.7k|  this->losslessPSV = 1;
  617|  56.7k|  this->xDensity = 1;
  618|  56.7k|  this->yDensity = 1;
  619|  56.7k|  this->scalingFactor = TJUNSCALED;
  620|  56.7k|  this->saveMarkers = 2;
  621|       |
  622|  56.7k|  this->apiVersion = apiVersion;
  623|  56.7k|  this->numSamp = apiVersion >= 3002000 ? TJ_NUMSAMP : 7;
  ------------------
  |  |  111|  7.09k|#define TJ_NUMSAMP  9
  ------------------
  |  Branch (623:19): [True: 7.09k, False: 49.6k]
  ------------------
  624|       |
  625|  56.7k|  switch (initType) {
  ------------------
  |  Branch (625:11): [True: 56.7k, False: 0]
  ------------------
  626|  56.7k|  case TJINIT_COMPRESS:  return _tjInitCompress(this);
  ------------------
  |  Branch (626:3): [True: 56.7k, False: 0]
  ------------------
  627|      0|  case TJINIT_DECOMPRESS:  return _tjInitDecompress(this);
  ------------------
  |  Branch (627:3): [True: 0, False: 56.7k]
  ------------------
  628|      0|  case TJINIT_TRANSFORM:
  ------------------
  |  Branch (628:3): [True: 0, False: 56.7k]
  ------------------
  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|  56.7k|  }
  634|       |
  635|      0|bailout:
  636|      0|  return retval;
  637|  56.7k|}
tj3Init:
  641|  49.6k|{
  642|  49.6k|  return tj3InitVersion(initType, 3001000);
  643|  49.6k|}
tj3Destroy:
  648|  56.7k|{
  649|  56.7k|  tjinstance *this = (tjinstance *)handle;
  650|  56.7k|  j_compress_ptr cinfo = NULL;
  651|  56.7k|  j_decompress_ptr dinfo = NULL;
  652|       |
  653|  56.7k|  if (!this) return;
  ------------------
  |  Branch (653:7): [True: 0, False: 56.7k]
  ------------------
  654|       |
  655|  56.7k|  cinfo = &this->cinfo;  dinfo = &this->dinfo;
  656|  56.7k|  this->jerr.warning = FALSE;
  ------------------
  |  |  207|  56.7k|#define FALSE   0               /* values of boolean */
  ------------------
  657|  56.7k|  this->isInstanceError = FALSE;
  ------------------
  |  |  207|  56.7k|#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|  56.7k|  if (setjmp(this->jerr.setjmp_buffer)) goto destroy_decompress;
  ------------------
  |  Branch (661:7): [True: 0, False: 56.7k]
  ------------------
  662|  56.7k|  if (this->init & COMPRESS) jpeg_destroy_compress(cinfo);
  ------------------
  |  Branch (662:7): [True: 56.7k, False: 0]
  ------------------
  663|  56.7k|destroy_decompress:
  664|  56.7k|  if (setjmp(this->jerr.setjmp_buffer)) goto bailout;
  ------------------
  |  Branch (664:7): [True: 0, False: 56.7k]
  ------------------
  665|  56.7k|  if (this->init & DECOMPRESS) jpeg_destroy_decompress(dinfo);
  ------------------
  |  Branch (665:7): [True: 0, False: 56.7k]
  ------------------
  666|  56.7k|bailout:
  667|  56.7k|  free(this->iccBuf);
  668|  56.7k|  free(this->decompICCBuf);
  669|  56.7k|  free(this);
  670|  56.7k|}
tj3Set:
  744|   442k|{
  745|   442k|  static const char FUNCTION_NAME[] = "tj3Set";
  746|   442k|  int retval = 0;
  747|       |
  748|   442k|  GET_TJINSTANCE(handle, -1);
  ------------------
  |  |  350|   442k|  tjinstance *this = (tjinstance *)handle; \
  |  |  351|   442k|  \
  |  |  352|   442k|  if (!this) { \
  |  |  ------------------
  |  |  |  Branch (352:7): [True: 0, False: 442k]
  |  |  ------------------
  |  |  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|   442k|  this->jerr.warning = FALSE; \
  |  |  ------------------
  |  |  |  |  207|   442k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  357|   442k|  this->isInstanceError = FALSE;
  |  |  ------------------
  |  |  |  |  207|   442k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  ------------------
  749|       |
  750|   442k|  switch (param) {
  751|      0|  case TJPARAM_STOPONWARNING:
  ------------------
  |  Branch (751:3): [True: 0, False: 442k]
  ------------------
  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|  49.6k|  case TJPARAM_BOTTOMUP:
  ------------------
  |  Branch (754:3): [True: 49.6k, False: 392k]
  ------------------
  755|  49.6k|    SET_BOOL_PARAM(bottomUp);
  ------------------
  |  |  736|  49.6k|#define SET_BOOL_PARAM(field) { \
  |  |  737|  49.6k|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 49.6k]
  |  |  |  Branch (737:20): [True: 0, False: 49.6k]
  |  |  ------------------
  |  |  738|  49.6k|    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|  49.6k|  this->field = (boolean)value; \
  |  |  740|  49.6k|}
  ------------------
  756|  49.6k|    break;
  757|  49.6k|  case TJPARAM_NOREALLOC:
  ------------------
  |  Branch (757:3): [True: 49.6k, False: 392k]
  ------------------
  758|  49.6k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (758:9): [True: 0, False: 49.6k]
  ------------------
  759|  49.6k|      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|  49.6k|    SET_BOOL_PARAM(noRealloc);
  ------------------
  |  |  736|  49.6k|#define SET_BOOL_PARAM(field) { \
  |  |  737|  49.6k|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 49.6k]
  |  |  |  Branch (737:20): [True: 0, False: 49.6k]
  |  |  ------------------
  |  |  738|  49.6k|    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|  49.6k|  this->field = (boolean)value; \
  |  |  740|  49.6k|}
  ------------------
  761|  49.6k|    break;
  762|  22.3k|  case TJPARAM_QUALITY:
  ------------------
  |  Branch (762:3): [True: 22.3k, False: 419k]
  ------------------
  763|  22.3k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (763:9): [True: 0, False: 22.3k]
  ------------------
  764|  22.3k|      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|  22.3k|    SET_PARAM(quality, 1, 100);
  ------------------
  |  |  730|  22.3k|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|  22.3k|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 22.3k]
  |  |  |  Branch (731:28): [True: 22.3k, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 22.3k]
  |  |  ------------------
  |  |  732|  22.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|  22.3k|  this->field = value; \
  |  |  734|  22.3k|}
  ------------------
  766|  22.3k|    break;
  767|  22.3k|  case TJPARAM_SUBSAMP:
  ------------------
  |  Branch (767:3): [True: 22.3k, False: 419k]
  ------------------
  768|  22.3k|    SET_PARAM(subsamp, 0, this->numSamp - 1);
  ------------------
  |  |  730|  22.3k|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|  22.3k|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 22.3k]
  |  |  |  Branch (731:28): [True: 22.3k, False: 0]
  |  |  |  Branch (731:44): [True: 0, False: 22.3k]
  |  |  ------------------
  |  |  732|  22.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|  22.3k|  this->field = value; \
  |  |  734|  22.3k|}
  ------------------
  769|  22.3k|    break;
  770|      0|  case TJPARAM_JPEGWIDTH:
  ------------------
  |  Branch (770:3): [True: 0, False: 442k]
  ------------------
  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: 442k]
  ------------------
  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|      0|  case TJPARAM_PRECISION:
  ------------------
  |  Branch (780:3): [True: 0, False: 442k]
  ------------------
  781|      0|    SET_PARAM(precision, 2, 16);
  ------------------
  |  |  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|}
  ------------------
  782|      0|    break;
  783|  49.6k|  case TJPARAM_COLORSPACE:
  ------------------
  |  Branch (783:3): [True: 49.6k, False: 392k]
  ------------------
  784|  49.6k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (784:9): [True: 0, False: 49.6k]
  ------------------
  785|  49.6k|      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|  49.6k|    SET_PARAM(colorspace, TJCS_DEFAULT, TJ_NUMCS - 1);
  ------------------
  |  |  730|  49.6k|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|  49.6k|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 49.6k]
  |  |  |  Branch (731:28): [True: 49.6k, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 49.6k]
  |  |  ------------------
  |  |  732|  49.6k|    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|  49.6k|  this->field = value; \
  |  |  734|  49.6k|}
  ------------------
  787|  49.6k|    break;
  788|      0|  case TJPARAM_FASTUPSAMPLE:
  ------------------
  |  Branch (788:3): [True: 0, False: 442k]
  ------------------
  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|  49.6k|  case TJPARAM_FASTDCT:
  ------------------
  |  Branch (793:3): [True: 49.6k, False: 392k]
  ------------------
  794|  49.6k|    SET_BOOL_PARAM(fastDCT);
  ------------------
  |  |  736|  49.6k|#define SET_BOOL_PARAM(field) { \
  |  |  737|  49.6k|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 49.6k]
  |  |  |  Branch (737:20): [True: 0, False: 49.6k]
  |  |  ------------------
  |  |  738|  49.6k|    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|  49.6k|  this->field = (boolean)value; \
  |  |  740|  49.6k|}
  ------------------
  795|  49.6k|    break;
  796|      0|  case TJPARAM_OPTIMIZE:
  ------------------
  |  Branch (796:3): [True: 0, False: 442k]
  ------------------
  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|  49.6k|  case TJPARAM_PROGRESSIVE:
  ------------------
  |  Branch (801:3): [True: 49.6k, False: 392k]
  ------------------
  802|  49.6k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (802:9): [True: 0, False: 49.6k]
  ------------------
  803|  49.6k|      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|  49.6k|    SET_BOOL_PARAM(progressive);
  ------------------
  |  |  736|  49.6k|#define SET_BOOL_PARAM(field) { \
  |  |  737|  49.6k|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 49.6k]
  |  |  |  Branch (737:20): [True: 0, False: 49.6k]
  |  |  ------------------
  |  |  738|  49.6k|    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|  49.6k|  this->field = (boolean)value; \
  |  |  740|  49.6k|}
  ------------------
  805|  49.6k|    break;
  806|      0|  case TJPARAM_SCANLIMIT:
  ------------------
  |  Branch (806:3): [True: 0, False: 442k]
  ------------------
  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|  49.6k|  case TJPARAM_ARITHMETIC:
  ------------------
  |  Branch (811:3): [True: 49.6k, False: 392k]
  ------------------
  812|  49.6k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (812:9): [True: 0, False: 49.6k]
  ------------------
  813|  49.6k|      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|  49.6k|    SET_BOOL_PARAM(arithmetic);
  ------------------
  |  |  736|  49.6k|#define SET_BOOL_PARAM(field) { \
  |  |  737|  49.6k|  if (value < 0 || value > 1) \
  |  |  ------------------
  |  |  |  Branch (737:7): [True: 0, False: 49.6k]
  |  |  |  Branch (737:20): [True: 0, False: 49.6k]
  |  |  ------------------
  |  |  738|  49.6k|    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|  49.6k|  this->field = (boolean)value; \
  |  |  740|  49.6k|}
  ------------------
  815|  49.6k|    break;
  816|      0|  case TJPARAM_LOSSLESS:
  ------------------
  |  Branch (816:3): [True: 0, False: 442k]
  ------------------
  817|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (817:9): [True: 0, False: 0]
  ------------------
  818|      0|      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|      0|    SET_BOOL_PARAM(lossless);
  ------------------
  |  |  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|}
  ------------------
  820|      0|    break;
  821|      0|  case TJPARAM_LOSSLESSPSV:
  ------------------
  |  Branch (821:3): [True: 0, False: 442k]
  ------------------
  822|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (822:9): [True: 0, False: 0]
  ------------------
  823|      0|      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|      0|    SET_PARAM(losslessPSV, 1, 7);
  ------------------
  |  |  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|}
  ------------------
  825|      0|    break;
  826|      0|  case TJPARAM_LOSSLESSPT:
  ------------------
  |  Branch (826:3): [True: 0, False: 442k]
  ------------------
  827|      0|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (827:9): [True: 0, False: 0]
  ------------------
  828|      0|      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|      0|    SET_PARAM(losslessPt, 0, 15);
  ------------------
  |  |  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|}
  ------------------
  830|      0|    break;
  831|      0|  case TJPARAM_RESTARTBLOCKS:
  ------------------
  |  Branch (831:3): [True: 0, False: 442k]
  ------------------
  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|  49.6k|  case TJPARAM_RESTARTROWS:
  ------------------
  |  Branch (837:3): [True: 49.6k, False: 392k]
  ------------------
  838|  49.6k|    if (!(this->init & COMPRESS))
  ------------------
  |  Branch (838:9): [True: 0, False: 49.6k]
  ------------------
  839|  49.6k|      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|  49.6k|    SET_PARAM(restartIntervalRows, 0, 65535);
  ------------------
  |  |  730|  49.6k|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|  49.6k|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 49.6k]
  |  |  |  Branch (731:28): [True: 49.6k, Folded]
  |  |  |  Branch (731:44): [True: 0, False: 49.6k]
  |  |  ------------------
  |  |  732|  49.6k|    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|  49.6k|  this->field = value; \
  |  |  734|  49.6k|}
  ------------------
  841|  49.6k|    if (value != 0) this->restartIntervalBlocks = 0;
  ------------------
  |  Branch (841:9): [True: 14.1k, False: 35.4k]
  ------------------
  842|  49.6k|    break;
  843|      0|  case TJPARAM_XDENSITY:
  ------------------
  |  Branch (843:3): [True: 0, False: 442k]
  ------------------
  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: 442k]
  ------------------
  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: 442k]
  ------------------
  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: 442k]
  ------------------
  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|  49.6k|  case TJPARAM_MAXPIXELS:
  ------------------
  |  Branch (861:3): [True: 49.6k, False: 392k]
  ------------------
  862|  49.6k|    SET_PARAM(maxPixels, 0, -1);
  ------------------
  |  |  730|  49.6k|#define SET_PARAM(field, minValue, maxValue) { \
  |  |  731|  49.6k|  if (value < minValue || (maxValue > 0 && value > maxValue)) \
  |  |  ------------------
  |  |  |  Branch (731:7): [True: 0, False: 49.6k]
  |  |  |  Branch (731:28): [Folded, False: 49.6k]
  |  |  |  Branch (731:44): [True: 0, False: 0]
  |  |  ------------------
  |  |  732|  49.6k|    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|  49.6k|  this->field = value; \
  |  |  734|  49.6k|}
  ------------------
  863|  49.6k|    break;
  864|      0|  case TJPARAM_SAVEMARKERS:
  ------------------
  |  Branch (864:3): [True: 0, False: 442k]
  ------------------
  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: 442k]
  ------------------
  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|   442k|  }
  870|       |
  871|   442k|bailout:
  872|   442k|  return retval;
  873|   442k|}
tj3Get:
  878|  22.3k|{
  879|  22.3k|  tjinstance *this = (tjinstance *)handle;
  880|  22.3k|  if (!this) return -1;
  ------------------
  |  Branch (880:7): [True: 0, False: 22.3k]
  ------------------
  881|       |
  882|  22.3k|  switch (param) {
  ------------------
  |  Branch (882:11): [True: 22.3k, False: 0]
  ------------------
  883|      0|  case TJPARAM_STOPONWARNING:
  ------------------
  |  Branch (883:3): [True: 0, False: 22.3k]
  ------------------
  884|      0|    return this->jerr.stopOnWarning;
  885|      0|  case TJPARAM_BOTTOMUP:
  ------------------
  |  Branch (885:3): [True: 0, False: 22.3k]
  ------------------
  886|      0|    return this->bottomUp;
  887|  22.3k|  case TJPARAM_NOREALLOC:
  ------------------
  |  Branch (887:3): [True: 22.3k, False: 0]
  ------------------
  888|  22.3k|    return this->noRealloc;
  889|      0|  case TJPARAM_QUALITY:
  ------------------
  |  Branch (889:3): [True: 0, False: 22.3k]
  ------------------
  890|      0|    return this->quality;
  891|      0|  case TJPARAM_SUBSAMP:
  ------------------
  |  Branch (891:3): [True: 0, False: 22.3k]
  ------------------
  892|      0|    return this->subsamp;
  893|      0|  case TJPARAM_JPEGWIDTH:
  ------------------
  |  Branch (893:3): [True: 0, False: 22.3k]
  ------------------
  894|      0|    return this->jpegWidth;
  895|      0|  case TJPARAM_JPEGHEIGHT:
  ------------------
  |  Branch (895:3): [True: 0, False: 22.3k]
  ------------------
  896|      0|    return this->jpegHeight;
  897|      0|  case TJPARAM_PRECISION:
  ------------------
  |  Branch (897:3): [True: 0, False: 22.3k]
  ------------------
  898|      0|    return this->precision;
  899|      0|  case TJPARAM_COLORSPACE:
  ------------------
  |  Branch (899:3): [True: 0, False: 22.3k]
  ------------------
  900|      0|    return this->colorspace;
  901|      0|  case TJPARAM_FASTUPSAMPLE:
  ------------------
  |  Branch (901:3): [True: 0, False: 22.3k]
  ------------------
  902|      0|    return this->fastUpsample;
  903|      0|  case TJPARAM_FASTDCT:
  ------------------
  |  Branch (903:3): [True: 0, False: 22.3k]
  ------------------
  904|      0|    return this->fastDCT;
  905|      0|  case TJPARAM_OPTIMIZE:
  ------------------
  |  Branch (905:3): [True: 0, False: 22.3k]
  ------------------
  906|      0|    return this->optimize;
  907|      0|  case TJPARAM_PROGRESSIVE:
  ------------------
  |  Branch (907:3): [True: 0, False: 22.3k]
  ------------------
  908|      0|    return this->progressive;
  909|      0|  case TJPARAM_SCANLIMIT:
  ------------------
  |  Branch (909:3): [True: 0, False: 22.3k]
  ------------------
  910|      0|    return this->scanLimit;
  911|      0|  case TJPARAM_ARITHMETIC:
  ------------------
  |  Branch (911:3): [True: 0, False: 22.3k]
  ------------------
  912|      0|    return this->arithmetic;
  913|      0|  case TJPARAM_LOSSLESS:
  ------------------
  |  Branch (913:3): [True: 0, False: 22.3k]
  ------------------
  914|      0|    return this->lossless;
  915|      0|  case TJPARAM_LOSSLESSPSV:
  ------------------
  |  Branch (915:3): [True: 0, False: 22.3k]
  ------------------
  916|      0|    return this->losslessPSV;
  917|      0|  case TJPARAM_LOSSLESSPT:
  ------------------
  |  Branch (917:3): [True: 0, False: 22.3k]
  ------------------
  918|      0|    return this->losslessPt;
  919|      0|  case TJPARAM_RESTARTBLOCKS:
  ------------------
  |  Branch (919:3): [True: 0, False: 22.3k]
  ------------------
  920|      0|    return this->restartIntervalBlocks;
  921|      0|  case TJPARAM_RESTARTROWS:
  ------------------
  |  Branch (921:3): [True: 0, False: 22.3k]
  ------------------
  922|      0|    return this->restartIntervalRows;
  923|      0|  case TJPARAM_XDENSITY:
  ------------------
  |  Branch (923:3): [True: 0, False: 22.3k]
  ------------------
  924|      0|    return this->xDensity;
  925|      0|  case TJPARAM_YDENSITY:
  ------------------
  |  Branch (925:3): [True: 0, False: 22.3k]
  ------------------
  926|      0|    return this->yDensity;
  927|      0|  case TJPARAM_DENSITYUNITS:
  ------------------
  |  Branch (927:3): [True: 0, False: 22.3k]
  ------------------
  928|      0|    return this->densityUnits;
  929|      0|  case TJPARAM_MAXMEMORY:
  ------------------
  |  Branch (929:3): [True: 0, False: 22.3k]
  ------------------
  930|      0|    return this->maxMemory;
  931|      0|  case TJPARAM_MAXPIXELS:
  ------------------
  |  Branch (931:3): [True: 0, False: 22.3k]
  ------------------
  932|      0|    return this->maxPixels;
  933|      0|  case TJPARAM_SAVEMARKERS:
  ------------------
  |  Branch (933:3): [True: 0, False: 22.3k]
  ------------------
  934|      0|    return this->saveMarkers;
  935|  22.3k|  }
  936|       |
  937|      0|  return -1;
  938|  22.3k|}
tj3Alloc:
  948|  3.16k|{
  949|  3.16k|  return MALLOC(bytes);
  ------------------
  |  |  520|  3.16k|#define MALLOC(size)  malloc(size)
  ------------------
  950|  3.16k|}
tj3Free:
  961|  58.9k|{
  962|  58.9k|  free(buf);
  963|  58.9k|}
tj3JPEGBufSize:
  974|  22.3k|{
  975|  22.3k|  static const char FUNCTION_NAME[] = "tj3JPEGBufSize";
  976|  22.3k|  unsigned long long retval = 0;
  977|  22.3k|  int mcuw, mcuh, chromasf;
  978|       |
  979|  22.3k|  if (width < 1 || height < 1 || jpegSubsamp < TJSAMP_UNKNOWN ||
  ------------------
  |  Branch (979:7): [True: 0, False: 22.3k]
  |  Branch (979:20): [True: 0, False: 22.3k]
  |  Branch (979:34): [True: 0, False: 22.3k]
  ------------------
  980|  22.3k|      jpegSubsamp >= TJ_NUMSAMP)
  ------------------
  |  |  111|  22.3k|#define TJ_NUMSAMP  9
  ------------------
  |  Branch (980:7): [True: 0, False: 22.3k]
  ------------------
  981|  22.3k|    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|  22.3k|  if (jpegSubsamp == TJSAMP_UNKNOWN)
  ------------------
  |  Branch (983:7): [True: 0, False: 22.3k]
  ------------------
  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|  22.3k|  mcuw = tjMCUWidth[jpegSubsamp];
  990|  22.3k|  mcuh = tjMCUHeight[jpegSubsamp];
  991|  22.3k|  chromasf = jpegSubsamp == TJSAMP_GRAY ? 0 : 4 * 64 / (mcuw * mcuh);
  ------------------
  |  Branch (991:14): [True: 6.80k, False: 15.5k]
  ------------------
  992|  22.3k|  retval = (unsigned long long)PAD(width, mcuw) * PAD(height, mcuh) *
  ------------------
  |  |   57|  22.3k|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
                retval = (unsigned long long)PAD(width, mcuw) * PAD(height, mcuh) *
  ------------------
  |  |   57|  22.3k|#define PAD(v, p)  ((v + (p) - 1) & (~((p) - 1)))
  ------------------
  993|  22.3k|           (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|  22.3k|bailout:
 1000|  22.3k|  return (size_t)retval;
 1001|  22.3k|}
tj3SetICCProfile:
 1240|  18.8k|{
 1241|  18.8k|  static const char FUNCTION_NAME[] = "tj3SetICCProfile";
 1242|  18.8k|  int retval = 0;
 1243|       |
 1244|  18.8k|  GET_TJINSTANCE(handle, -1)
  ------------------
  |  |  350|  18.8k|  tjinstance *this = (tjinstance *)handle; \
  |  |  351|  18.8k|  \
  |  |  352|  18.8k|  if (!this) { \
  |  |  ------------------
  |  |  |  Branch (352:7): [True: 0, False: 18.8k]
  |  |  ------------------
  |  |  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|  18.8k|  this->jerr.warning = FALSE; \
  |  |  ------------------
  |  |  |  |  207|  18.8k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  |  |  357|  18.8k|  this->isInstanceError = FALSE;
  |  |  ------------------
  |  |  |  |  207|  18.8k|#define FALSE   0               /* values of boolean */
  |  |  ------------------
  ------------------
 1245|  18.8k|  if ((this->init & COMPRESS) == 0)
  ------------------
  |  Branch (1245:7): [True: 0, False: 18.8k]
  ------------------
 1246|  18.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|}
  |  |  ------------------
  ------------------
 1247|       |
 1248|  18.8k|  if (iccBuf == this->iccBuf && iccSize == this->iccSize)
  ------------------
  |  Branch (1248:7): [True: 0, False: 18.8k]
  |  Branch (1248:33): [True: 0, False: 0]
  ------------------
 1249|      0|    return 0;
 1250|       |
 1251|  18.8k|  free(this->iccBuf);
 1252|  18.8k|  this->iccBuf = NULL;
 1253|  18.8k|  this->iccSize = 0;
 1254|  18.8k|  if (iccBuf && iccSize) {
  ------------------
  |  Branch (1254:7): [True: 18.8k, False: 0]
  |  Branch (1254:17): [True: 18.8k, False: 0]
  ------------------
 1255|  18.8k|    if ((this->iccBuf = (unsigned char *)malloc(iccSize)) == NULL)
  ------------------
  |  Branch (1255:9): [True: 0, False: 18.8k]
  ------------------
 1256|  18.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|}
  |  |  ------------------
  ------------------
 1257|  18.8k|    memcpy(this->iccBuf, iccBuf, iccSize);
 1258|  18.8k|    this->iccSize = iccSize;
 1259|  18.8k|  }
 1260|       |
 1261|  18.8k|bailout:
 1262|  18.8k|  return retval;
 1263|  18.8k|}
turbojpeg.c:_tjInitCompress:
 1200|  56.7k|{
 1201|  56.7k|  static unsigned char buffer[1];
 1202|  56.7k|  unsigned char *buf = buffer;
 1203|  56.7k|  size_t size = 1;
 1204|       |
 1205|       |  /* This is also straight out of example.c */
 1206|  56.7k|  this->cinfo.err = jpeg_std_error(&this->jerr.pub);
 1207|  56.7k|  this->jerr.pub.error_exit = my_error_exit;
 1208|  56.7k|  this->jerr.pub.output_message = my_output_message;
 1209|  56.7k|  this->jerr.emit_message = this->jerr.pub.emit_message;
 1210|  56.7k|  this->jerr.pub.emit_message = my_emit_message;
 1211|  56.7k|  this->jerr.pub.addon_message_table = turbojpeg_message_table;
 1212|  56.7k|  this->jerr.pub.first_addon_message = JMSG_FIRSTADDONCODE;
 1213|  56.7k|  this->jerr.pub.last_addon_message = JMSG_LASTADDONCODE;
 1214|  56.7k|  this->jerr.tjHandle = (tjhandle)this;
 1215|       |
 1216|  56.7k|  if (setjmp(this->jerr.setjmp_buffer)) {
  ------------------
  |  Branch (1216:7): [True: 0, False: 56.7k]
  ------------------
 1217|       |    /* If we get here, the JPEG code has signaled an error. */
 1218|      0|    free(this);
 1219|      0|    return NULL;
 1220|      0|  }
 1221|       |
 1222|  56.7k|  jpeg_create_compress(&this->cinfo);
  ------------------
  |  |  969|  56.7k|  jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \
  |  |  ------------------
  |  |  |  |    4|  56.7k|#define JPEG_LIB_VERSION  62
  |  |  ------------------
  |  |  970|  56.7k|                      (size_t)sizeof(struct jpeg_compress_struct))
  ------------------
 1223|       |  /* Make an initial call so it will create the destination manager */
 1224|  56.7k|  jpeg_mem_dest_tj(&this->cinfo, &buf, &size, 0);
 1225|       |
 1226|  56.7k|  this->init |= COMPRESS;
 1227|  56.7k|  return (tjhandle)this;
 1228|  56.7k|}
turbojpeg.c:my_error_exit:
   81|  36.8k|{
   82|  36.8k|  my_error_ptr myerr = (my_error_ptr)cinfo->err;
   83|       |
   84|  36.8k|  (*cinfo->err->output_message) (cinfo);
   85|  36.8k|  longjmp(myerr->setjmp_buffer, 1);
   86|  36.8k|}
turbojpeg.c:my_output_message:
  149|  36.8k|{
  150|  36.8k|  my_error_ptr myerr = (my_error_ptr)cinfo->err;
  151|  36.8k|  tjinstance *this = (tjinstance *)myerr->tjHandle;
  152|       |
  153|  36.8k|  if (this) {
  ------------------
  |  Branch (153:7): [True: 36.8k, False: 0]
  ------------------
  154|  36.8k|    this->isInstanceError = TRUE;
  ------------------
  |  |  210|  36.8k|#define TRUE    1
  ------------------
  155|  36.8k|    (*cinfo->err->format_message) (cinfo, this->errStr);
  156|  36.8k|  } else
  157|      0|    (*cinfo->err->format_message) (cinfo, errStr);
  158|  36.8k|}
turbojpeg.c:my_emit_message:
   89|  35.4k|{
   90|  35.4k|  my_error_ptr myerr = (my_error_ptr)cinfo->err;
   91|       |
   92|  35.4k|  myerr->emit_message(cinfo, msg_level);
   93|  35.4k|  if (msg_level < 0) {
  ------------------
  |  Branch (93:7): [True: 0, False: 35.4k]
  ------------------
   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|  35.4k|}
turbojpeg.c:setCompDefaults:
  379|  22.3k|{
  380|  22.3k|  int colorspace = yuv ? TJCS_DEFAULT : this->colorspace;
  ------------------
  |  Branch (380:20): [True: 0, False: 22.3k]
  ------------------
  381|       |
  382|  22.3k|  this->cinfo.in_color_space = pf2cs[pixelFormat];
  383|  22.3k|  this->cinfo.input_components = tjPixelSize[pixelFormat];
  384|  22.3k|  jpeg_set_defaults(&this->cinfo);
  385|       |
  386|  22.3k|  this->cinfo.restart_interval = this->restartIntervalBlocks;
  387|  22.3k|  this->cinfo.restart_in_rows = this->restartIntervalRows;
  388|  22.3k|  this->cinfo.X_density = (UINT16)this->xDensity;
  389|  22.3k|  this->cinfo.Y_density = (UINT16)this->yDensity;
  390|  22.3k|  this->cinfo.density_unit = (UINT8)this->densityUnits;
  391|  22.3k|  this->cinfo.mem->max_memory_to_use = (long)this->maxMemory * 1048576L;
  392|       |
  393|  22.3k|  if (this->lossless && !yuv) {
  ------------------
  |  Branch (393:7): [True: 0, False: 22.3k]
  |  Branch (393:25): [True: 0, False: 0]
  ------------------
  394|      0|#ifdef C_LOSSLESS_SUPPORTED
  395|      0|    jpeg_enable_lossless(&this->cinfo, this->losslessPSV, this->losslessPt);
  396|      0|#endif
  397|      0|    return;
  398|      0|  }
  399|       |
  400|  22.3k|  jpeg_set_quality(&this->cinfo, this->quality, TRUE);
  ------------------
  |  |  210|  22.3k|#define TRUE    1
  ------------------
  401|  22.3k|  this->cinfo.dct_method = this->fastDCT ? JDCT_FASTEST : JDCT_ISLOW;
  ------------------
  |  |  304|  3.16k|#define JDCT_FASTEST  JDCT_IFAST
  ------------------
  |  Branch (401:28): [True: 3.16k, False: 19.2k]
  ------------------
  402|       |
  403|  22.3k|  switch (colorspace) {
  404|  3.07k|  case TJCS_RGB:
  ------------------
  |  Branch (404:3): [True: 3.07k, False: 19.2k]
  ------------------
  405|  3.07k|    jpeg_set_colorspace(&this->cinfo, JCS_RGB);  break;
  406|  3.16k|  case TJCS_YCbCr:
  ------------------
  |  Branch (406:3): [True: 3.16k, False: 19.2k]
  ------------------
  407|  3.16k|    jpeg_set_colorspace(&this->cinfo, JCS_YCbCr);  break;
  408|  3.07k|  case TJCS_GRAY:
  ------------------
  |  Branch (408:3): [True: 3.07k, False: 19.2k]
  ------------------
  409|  3.07k|    jpeg_set_colorspace(&this->cinfo, JCS_GRAYSCALE);  break;
  410|      0|  case TJCS_CMYK:
  ------------------
  |  Branch (410:3): [True: 0, False: 22.3k]
  ------------------
  411|      0|    jpeg_set_colorspace(&this->cinfo, JCS_CMYK);  break;
  412|  3.07k|  case TJCS_YCCK:
  ------------------
  |  Branch (412:3): [True: 3.07k, False: 19.2k]
  ------------------
  413|  3.07k|    jpeg_set_colorspace(&this->cinfo, JCS_YCCK);  break;
  414|  9.97k|  default:
  ------------------
  |  Branch (414:3): [True: 9.97k, False: 12.3k]
  ------------------
  415|  9.97k|    if (this->subsamp == TJSAMP_GRAY)
  ------------------
  |  Branch (415:9): [True: 3.73k, False: 6.24k]
  ------------------
  416|  3.73k|      jpeg_set_colorspace(&this->cinfo, JCS_GRAYSCALE);
  417|  6.24k|    else if (pixelFormat == TJPF_CMYK)
  ------------------
  |  Branch (417:14): [True: 0, False: 6.24k]
  ------------------
  418|      0|      jpeg_set_colorspace(&this->cinfo, JCS_YCCK);
  419|  6.24k|    else
  420|  6.24k|      jpeg_set_colorspace(&this->cinfo, JCS_YCbCr);
  421|  22.3k|  }
  422|       |
  423|  22.3k|  if (this->cinfo.data_precision == 8)
  ------------------
  |  Branch (423:7): [True: 0, False: 22.3k]
  ------------------
  424|      0|    this->cinfo.optimize_coding = this->optimize;
  425|  22.3k|#ifdef C_PROGRESSIVE_SUPPORTED
  426|  22.3k|  if (this->progressive) jpeg_simple_progression(&this->cinfo);
  ------------------
  |  Branch (426:7): [True: 6.80k, False: 15.5k]
  ------------------
  427|  22.3k|#endif
  428|  22.3k|  this->cinfo.arith_code = this->arithmetic;
  429|       |
  430|  22.3k|  this->cinfo.comp_info[0].h_samp_factor = tjMCUWidth[this->subsamp] / 8;
  431|  22.3k|  this->cinfo.comp_info[1].h_samp_factor = 1;
  432|  22.3k|  this->cinfo.comp_info[2].h_samp_factor = 1;
  433|  22.3k|  if (this->cinfo.num_components > 3)
  ------------------
  |  Branch (433:7): [True: 3.07k, False: 19.2k]
  ------------------
  434|  3.07k|    this->cinfo.comp_info[3].h_samp_factor = tjMCUWidth[this->subsamp] / 8;
  435|  22.3k|  this->cinfo.comp_info[0].v_samp_factor = tjMCUHeight[this->subsamp] / 8;
  436|  22.3k|  this->cinfo.comp_info[1].v_samp_factor = 1;
  437|  22.3k|  this->cinfo.comp_info[2].v_samp_factor = 1;
  438|  22.3k|  if (this->cinfo.num_components > 3)
  ------------------
  |  Branch (438:7): [True: 3.07k, False: 19.2k]
  ------------------
  439|  3.07k|    this->cinfo.comp_info[3].v_samp_factor = tjMCUHeight[this->subsamp] / 8;
  440|  22.3k|}

