jsimd_set_ycc_rgb:
  241|  12.7k|{
  242|  12.7k|  init_simd((j_common_ptr)cinfo);
  243|       |
  244|  12.7k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  12.7k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (244:7): [Folded, False: 12.7k]
  ------------------
  245|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  246|  12.7k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (246:7): [Folded, False: 12.7k]
  ------------------
  247|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  248|  12.7k|  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  302|  12.7k|#define RGB_PIXELSIZE   3       /* JSAMPLEs per RGB scanline element */
  ------------------
                if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  302|      0|#define RGB_PIXELSIZE   3       /* JSAMPLEs per RGB scanline element */
  ------------------
  |  Branch (248:7): [Folded, False: 12.7k]
  |  Branch (248:31): [True: 0, Folded]
  ------------------
  249|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  250|  12.7k|  if (!cinfo->cconvert)
  ------------------
  |  Branch (250:7): [True: 0, False: 12.7k]
  ------------------
  251|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  252|       |
  253|  12.7k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  254|  12.7k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  12.7k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (254:7): [True: 12.7k, False: 0]
  ------------------
  255|  12.7k|      IS_ALIGNED_AVX(jconst_ycc_rgb_convert_avx2)) {
  ------------------
  |  |   46|  12.7k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   43|  12.7k|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (46:30): [True: 12.7k, False: 0]
  |  |  ------------------
  ------------------
  256|  12.7k|    SET_SIMD_EXTRGB_COLOR_DECONVERTER(avx2);
  ------------------
  |  |  128|  12.7k|#define SET_SIMD_EXTRGB_COLOR_DECONVERTER(instrset) { \
  |  |  129|  12.7k|  switch (cinfo->out_color_space) { \
  |  |  130|      0|    case JCS_EXT_RGB: \
  |  |  ------------------
  |  |  |  Branch (130:5): [True: 0, False: 12.7k]
  |  |  ------------------
  |  |  131|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  132|      0|        jsimd_ycc_extrgb_convert_##instrset; \
  |  |  133|      0|      break; \
  |  |  134|      0|    case JCS_EXT_RGBX: \
  |  |  ------------------
  |  |  |  Branch (134:5): [True: 0, False: 12.7k]
  |  |  ------------------
  |  |  135|      0|    case JCS_EXT_RGBA: \
  |  |  ------------------
  |  |  |  Branch (135:5): [True: 0, False: 12.7k]
  |  |  ------------------
  |  |  136|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  137|      0|        jsimd_ycc_extrgbx_convert_##instrset; \
  |  |  138|      0|      break; \
  |  |  139|      0|    case JCS_EXT_BGR: \
  |  |  ------------------
  |  |  |  Branch (139:5): [True: 0, False: 12.7k]
  |  |  ------------------
  |  |  140|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  141|      0|        jsimd_ycc_extbgr_convert_##instrset; \
  |  |  142|      0|      break; \
  |  |  143|      0|    case JCS_EXT_BGRX: \
  |  |  ------------------
  |  |  |  Branch (143:5): [True: 0, False: 12.7k]
  |  |  ------------------
  |  |  144|      0|    case JCS_EXT_BGRA: \
  |  |  ------------------
  |  |  |  Branch (144:5): [True: 0, False: 12.7k]
  |  |  ------------------
  |  |  145|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  146|      0|        jsimd_ycc_extbgrx_convert_##instrset; \
  |  |  147|      0|      break; \
  |  |  148|      0|    case JCS_EXT_XBGR: \
  |  |  ------------------
  |  |  |  Branch (148:5): [True: 0, False: 12.7k]
  |  |  ------------------
  |  |  149|      0|    case JCS_EXT_ABGR: \
  |  |  ------------------
  |  |  |  Branch (149:5): [True: 0, False: 12.7k]
  |  |  ------------------
  |  |  150|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  151|      0|        jsimd_ycc_extxbgr_convert_##instrset; \
  |  |  152|      0|      break; \
  |  |  153|      0|    case JCS_EXT_XRGB: \
  |  |  ------------------
  |  |  |  Branch (153:5): [True: 0, False: 12.7k]
  |  |  ------------------
  |  |  154|      0|    case JCS_EXT_ARGB: \
  |  |  ------------------
  |  |  |  Branch (154:5): [True: 0, False: 12.7k]
  |  |  ------------------
  |  |  155|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  156|      0|        jsimd_ycc_extxrgb_convert_##instrset; \
  |  |  157|      0|      break; \
  |  |  158|  12.7k|    default: \
  |  |  ------------------
  |  |  |  Branch (158:5): [True: 12.7k, False: 0]
  |  |  ------------------
  |  |  159|  12.7k|      cinfo->cconvert->color_convert_simd = \
  |  |  160|  12.7k|        jsimd_ycc_rgb_convert_##instrset; \
  |  |  161|  12.7k|  } \
  |  |  162|  12.7k|}
  ------------------
  257|  12.7k|    return JSIMD_AVX2;
  ------------------
  |  |   46|  12.7k|#define JSIMD_AVX2       0x80
  ------------------
  258|  12.7k|  }
  259|      0|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (259:7): [True: 0, False: 0]
  ------------------
  260|      0|      IS_ALIGNED_SSE(jconst_ycc_rgb_convert_sse2)) {
  ------------------
  |  |   45|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   43|      0|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (45:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  261|      0|    SET_SIMD_EXTRGB_COLOR_DECONVERTER(sse2);
  ------------------
  |  |  128|      0|#define SET_SIMD_EXTRGB_COLOR_DECONVERTER(instrset) { \
  |  |  129|      0|  switch (cinfo->out_color_space) { \
  |  |  130|      0|    case JCS_EXT_RGB: \
  |  |  ------------------
  |  |  |  Branch (130:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  131|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  132|      0|        jsimd_ycc_extrgb_convert_##instrset; \
  |  |  133|      0|      break; \
  |  |  134|      0|    case JCS_EXT_RGBX: \
  |  |  ------------------
  |  |  |  Branch (134:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  135|      0|    case JCS_EXT_RGBA: \
  |  |  ------------------
  |  |  |  Branch (135:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  136|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  137|      0|        jsimd_ycc_extrgbx_convert_##instrset; \
  |  |  138|      0|      break; \
  |  |  139|      0|    case JCS_EXT_BGR: \
  |  |  ------------------
  |  |  |  Branch (139:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  140|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  141|      0|        jsimd_ycc_extbgr_convert_##instrset; \
  |  |  142|      0|      break; \
  |  |  143|      0|    case JCS_EXT_BGRX: \
  |  |  ------------------
  |  |  |  Branch (143:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  144|      0|    case JCS_EXT_BGRA: \
  |  |  ------------------
  |  |  |  Branch (144:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  145|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  146|      0|        jsimd_ycc_extbgrx_convert_##instrset; \
  |  |  147|      0|      break; \
  |  |  148|      0|    case JCS_EXT_XBGR: \
  |  |  ------------------
  |  |  |  Branch (148:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|    case JCS_EXT_ABGR: \
  |  |  ------------------
  |  |  |  Branch (149:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  150|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  151|      0|        jsimd_ycc_extxbgr_convert_##instrset; \
  |  |  152|      0|      break; \
  |  |  153|      0|    case JCS_EXT_XRGB: \
  |  |  ------------------
  |  |  |  Branch (153:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  154|      0|    case JCS_EXT_ARGB: \
  |  |  ------------------
  |  |  |  Branch (154:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  155|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  156|      0|        jsimd_ycc_extxrgb_convert_##instrset; \
  |  |  157|      0|      break; \
  |  |  158|      0|    default: \
  |  |  ------------------
  |  |  |  Branch (158:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  159|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  160|      0|        jsimd_ycc_rgb_convert_##instrset; \
  |  |  161|      0|  } \
  |  |  162|      0|}
  ------------------
  262|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  263|      0|  }
  264|       |#if SIMD_ARCHITECTURE == I386
  265|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  266|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(mmx);
  267|       |    return JSIMD_MMX;
  268|       |  }
  269|       |#endif
  270|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  271|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  272|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(neon);
  273|       |    return JSIMD_NEON;
  274|       |  }
  275|       |#elif SIMD_ARCHITECTURE == POWERPC
  276|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  277|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(altivec);
  278|       |    return JSIMD_ALTIVEC;
  279|       |  }
  280|       |#elif SIMD_ARCHITECTURE == RISCV64
  281|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  282|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(rvv);
  283|       |    return JSIMD_RVV;
  284|       |  }
  285|       |#elif SIMD_ARCHITECTURE == MIPS64
  286|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
  287|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(mmi);
  288|       |    return JSIMD_MMI;
  289|       |  }
  290|       |#endif
  291|       |
  292|      0|  return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  293|      0|}
jsimd_color_deconvert:
  323|   535k|{
  324|   535k|  cinfo->cconvert->color_convert_simd(cinfo->output_width, input_buf,
  325|   535k|                                      input_row, output_buf, num_rows);
  326|   535k|}
jsimd_set_h2v1_upsample:
  456|  1.02k|{
  457|  1.02k|  init_simd((j_common_ptr)cinfo);
  458|       |
  459|  1.02k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  1.02k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (459:7): [Folded, False: 1.02k]
  ------------------
  460|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  461|  1.02k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (461:7): [Folded, False: 1.02k]
  ------------------
  462|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  463|  1.02k|  if (!cinfo->upsample)
  ------------------
  |  Branch (463:7): [True: 0, False: 1.02k]
  ------------------
  464|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  465|       |
  466|  1.02k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  467|  1.02k|  if (cinfo->master->simd_support & JSIMD_AVX2) {
  ------------------
  |  |   46|  1.02k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (467:7): [True: 1.02k, False: 0]
  ------------------
  468|  1.02k|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_avx2;
  469|  1.02k|    return JSIMD_AVX2;
  ------------------
  |  |   46|  1.02k|#define JSIMD_AVX2       0x80
  ------------------
  470|  1.02k|  }
  471|      0|  if (cinfo->master->simd_support & JSIMD_SSE2) {
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (471:7): [True: 0, False: 0]
  ------------------
  472|      0|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_sse2;
  473|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  474|      0|  }
  475|       |#if SIMD_ARCHITECTURE == I386
  476|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  477|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_mmx;
  478|       |    return JSIMD_MMX;
  479|       |  }
  480|       |#endif
  481|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  482|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  483|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_neon;
  484|       |    return JSIMD_NEON;
  485|       |  }
  486|       |#elif SIMD_ARCHITECTURE == POWERPC
  487|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  488|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_altivec;
  489|       |    return JSIMD_ALTIVEC;
  490|       |  }
  491|       |#elif SIMD_ARCHITECTURE == RISCV64
  492|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  493|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_rvv;
  494|       |    return JSIMD_RVV;
  495|       |  }
  496|       |#endif
  497|       |
  498|      0|  return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  499|      0|}
jsimd_h2v1_upsample:
  505|  51.6k|{
  506|  51.6k|  cinfo->upsample->h2v1_upsample_simd(cinfo->max_v_samp_factor,
  507|  51.6k|                                      cinfo->output_width, input_data,
  508|  51.6k|                                      output_data_ptr);
  509|  51.6k|}
jsimd_set_h2v2_upsample:
  514|  1.56k|{
  515|  1.56k|  init_simd((j_common_ptr)cinfo);
  516|       |
  517|  1.56k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  1.56k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (517:7): [Folded, False: 1.56k]
  ------------------
  518|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  519|  1.56k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (519:7): [Folded, False: 1.56k]
  ------------------
  520|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  521|  1.56k|  if (!cinfo->upsample)
  ------------------
  |  Branch (521:7): [True: 0, False: 1.56k]
  ------------------
  522|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  523|       |
  524|  1.56k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  525|  1.56k|  if (cinfo->master->simd_support & JSIMD_AVX2) {
  ------------------
  |  |   46|  1.56k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (525:7): [True: 1.56k, False: 0]
  ------------------
  526|  1.56k|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_avx2;
  527|  1.56k|    return JSIMD_AVX2;
  ------------------
  |  |   46|  1.56k|#define JSIMD_AVX2       0x80
  ------------------
  528|  1.56k|  }
  529|      0|  if (cinfo->master->simd_support & JSIMD_SSE2) {
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (529:7): [True: 0, False: 0]
  ------------------
  530|      0|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_sse2;
  531|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  532|      0|  }
  533|       |#if SIMD_ARCHITECTURE == I386
  534|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  535|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_mmx;
  536|       |    return JSIMD_MMX;
  537|       |  }
  538|       |#endif
  539|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  540|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  541|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_neon;
  542|       |    return JSIMD_NEON;
  543|       |  }
  544|       |#elif SIMD_ARCHITECTURE == POWERPC
  545|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  546|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_altivec;
  547|       |    return JSIMD_ALTIVEC;
  548|       |  }
  549|       |#elif SIMD_ARCHITECTURE == RISCV64
  550|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  551|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_rvv;
  552|       |    return JSIMD_RVV;
  553|       |  }
  554|       |#endif
  555|       |
  556|      0|  return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  557|      0|}
jsimd_h2v2_upsample:
  563|  42.2k|{
  564|  42.2k|  cinfo->upsample->h2v2_upsample_simd(cinfo->max_v_samp_factor,
  565|  42.2k|                                      cinfo->output_width, input_data,
  566|  42.2k|                                      output_data_ptr);
  567|  42.2k|}
jsimd_set_h2v1_fancy_upsample:
  572|  6.83k|{
  573|  6.83k|  init_simd((j_common_ptr)cinfo);
  574|       |
  575|  6.83k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  6.83k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (575:7): [Folded, False: 6.83k]
  ------------------
  576|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  577|  6.83k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (577:7): [Folded, False: 6.83k]
  ------------------
  578|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  579|  6.83k|  if (!cinfo->upsample)
  ------------------
  |  Branch (579:7): [True: 0, False: 6.83k]
  ------------------
  580|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  581|       |
  582|  6.83k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  583|  6.83k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  6.83k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (583:7): [True: 6.83k, False: 0]
  ------------------
  584|  6.83k|      IS_ALIGNED_AVX(jconst_fancy_upsample_avx2)) {
  ------------------
  |  |   46|  6.83k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   43|  6.83k|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (46:30): [True: 6.83k, False: 0]
  |  |  ------------------
  ------------------
  585|  6.83k|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_avx2;
  586|  6.83k|    return JSIMD_AVX2;
  ------------------
  |  |   46|  6.83k|#define JSIMD_AVX2       0x80
  ------------------
  587|  6.83k|  }
  588|      0|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (588:7): [True: 0, False: 0]
  ------------------
  589|      0|      IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) {
  ------------------
  |  |   45|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   43|      0|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (45:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  590|      0|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_sse2;
  591|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  592|      0|  }
  593|       |#if SIMD_ARCHITECTURE == I386
  594|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  595|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_mmx;
  596|       |    return JSIMD_MMX;
  597|       |  }
  598|       |#endif
  599|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  600|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  601|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_neon;
  602|       |    return JSIMD_NEON;
  603|       |  }
  604|       |#elif SIMD_ARCHITECTURE == POWERPC
  605|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  606|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_altivec;
  607|       |    return JSIMD_ALTIVEC;
  608|       |  }
  609|       |#elif SIMD_ARCHITECTURE == RISCV64
  610|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  611|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_rvv;
  612|       |    return JSIMD_RVV;
  613|       |  }
  614|       |#elif SIMD_ARCHITECTURE == MIPS64
  615|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
  616|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_mmi;
  617|       |    return JSIMD_MMI;
  618|       |  }
  619|       |#endif
  620|       |
  621|      0|  return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  622|      0|}
jsimd_h2v1_fancy_upsample:
  628|  34.4k|{
  629|  34.4k|  cinfo->upsample->h2v1_upsample_simd(cinfo->max_v_samp_factor,
  630|  34.4k|                                      compptr->downsampled_width, input_data,
  631|  34.4k|                                      output_data_ptr);
  632|  34.4k|}
jsimd_set_h2v2_fancy_upsample:
  637|  8.64k|{
  638|  8.64k|  init_simd((j_common_ptr)cinfo);
  639|       |
  640|  8.64k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  8.64k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (640:7): [Folded, False: 8.64k]
  ------------------
  641|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  642|  8.64k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (642:7): [Folded, False: 8.64k]
  ------------------
  643|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  644|  8.64k|  if (!cinfo->upsample)
  ------------------
  |  Branch (644:7): [True: 0, False: 8.64k]
  ------------------
  645|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  646|       |
  647|  8.64k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  648|  8.64k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  8.64k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (648:7): [True: 8.64k, False: 0]
  ------------------
  649|  8.64k|      IS_ALIGNED_AVX(jconst_fancy_upsample_avx2)) {
  ------------------
  |  |   46|  8.64k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   43|  8.64k|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (46:30): [True: 8.64k, False: 0]
  |  |  ------------------
  ------------------
  650|  8.64k|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_avx2;
  651|  8.64k|    return JSIMD_AVX2;
  ------------------
  |  |   46|  8.64k|#define JSIMD_AVX2       0x80
  ------------------
  652|  8.64k|  }
  653|      0|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (653:7): [True: 0, False: 0]
  ------------------
  654|      0|      IS_ALIGNED_SSE(jconst_fancy_upsample_sse2)) {
  ------------------
  |  |   45|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   43|      0|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (45:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  655|      0|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_sse2;
  656|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  657|      0|  }
  658|       |#if SIMD_ARCHITECTURE == I386
  659|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  660|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_mmx;
  661|       |    return JSIMD_MMX;
  662|       |  }
  663|       |#endif
  664|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  665|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  666|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_neon;
  667|       |    return JSIMD_NEON;
  668|       |  }
  669|       |#elif SIMD_ARCHITECTURE == POWERPC
  670|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  671|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_altivec;
  672|       |    return JSIMD_ALTIVEC;
  673|       |  }
  674|       |#elif SIMD_ARCHITECTURE == RISCV64
  675|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  676|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_rvv;
  677|       |    return JSIMD_RVV;
  678|       |  }
  679|       |#elif SIMD_ARCHITECTURE == MIPS64
  680|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
  681|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_mmi;
  682|       |    return JSIMD_MMI;
  683|       |  }
  684|       |#endif
  685|       |
  686|      0|  return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  687|      0|}
jsimd_h2v2_fancy_upsample:
  693|   319k|{
  694|   319k|  cinfo->upsample->h2v2_upsample_simd(cinfo->max_v_samp_factor,
  695|   319k|                                      compptr->downsampled_width, input_data,
  696|   319k|                                      output_data_ptr);
  697|   319k|}
jsimd_set_idct_islow:
 1153|  85.0k|{
 1154|  85.0k|  init_simd((j_common_ptr)cinfo);
 1155|       |
 1156|  85.0k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1156:7): [Folded, False: 85.0k]
  ------------------
 1157|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1158|  85.0k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  85.0k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (1158:7): [Folded, False: 85.0k]
  ------------------
 1159|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1160|  85.0k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (1160:7): [Folded, False: 85.0k]
  ------------------
 1161|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1162|  85.0k|  if (sizeof(ISLOW_MULT_TYPE) != 2)
  ------------------
  |  Branch (1162:7): [Folded, False: 85.0k]
  ------------------
 1163|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1164|  85.0k|  if (!cinfo->idct)
  ------------------
  |  Branch (1164:7): [True: 0, False: 85.0k]
  ------------------
 1165|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1166|       |
 1167|  85.0k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
 1168|  85.0k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  85.0k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (1168:7): [True: 85.0k, False: 0]
  ------------------
 1169|  85.0k|      IS_ALIGNED_AVX(jconst_idct_islow_avx2)) {
  ------------------
  |  |   46|  85.0k|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   43|  85.0k|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (46:30): [True: 85.0k, False: 0]
  |  |  ------------------
  ------------------
 1170|  85.0k|    cinfo->idct->idct_simd = jsimd_idct_islow_avx2;
 1171|  85.0k|    return JSIMD_AVX2;
  ------------------
  |  |   46|  85.0k|#define JSIMD_AVX2       0x80
  ------------------
 1172|  85.0k|  }
 1173|      0|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (1173:7): [True: 0, False: 0]
  ------------------
 1174|      0|      IS_ALIGNED_SSE(jconst_idct_islow_sse2)) {
  ------------------
  |  |   45|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   43|      0|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (45:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1175|      0|    cinfo->idct->idct_simd = jsimd_idct_islow_sse2;
 1176|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
 1177|      0|  }
 1178|       |#if SIMD_ARCHITECTURE == I386
 1179|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
 1180|       |    cinfo->idct->idct_simd = jsimd_idct_islow_mmx;
 1181|       |    return JSIMD_MMX;
 1182|       |  }
 1183|       |#endif
 1184|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
 1185|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
 1186|       |    cinfo->idct->idct_simd = jsimd_idct_islow_neon;
 1187|       |    return JSIMD_NEON;
 1188|       |  }
 1189|       |#elif SIMD_ARCHITECTURE == POWERPC
 1190|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
 1191|       |    cinfo->idct->idct_simd = jsimd_idct_islow_altivec;
 1192|       |    return JSIMD_ALTIVEC;
 1193|       |  }
 1194|       |#elif SIMD_ARCHITECTURE == RISCV64
 1195|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
 1196|       |    cinfo->idct->idct_simd = jsimd_idct_islow_rvv;
 1197|       |    return JSIMD_RVV;
 1198|       |  }
 1199|       |#elif SIMD_ARCHITECTURE == MIPS64
 1200|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
 1201|       |    cinfo->idct->idct_simd = jsimd_idct_islow_mmi;
 1202|       |    return JSIMD_MMI;
 1203|       |  }
 1204|       |#endif
 1205|       |
 1206|      0|  return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1207|      0|}
jsimd_idct_islow:
 1214|   126M|{
 1215|   126M|  cinfo->idct->idct_simd(compptr->dct_table, coef_block, output_buf,
 1216|   126M|                         output_col);
 1217|   126M|}
jsimd.c:init_simd:
   56|   115k|{
   57|   115k|#ifndef NO_GETENV
   58|   115k|  char env[2] = { 0 };
   59|   115k|#endif
   60|   115k|  unsigned int simd_support = cinfo->is_decompressor ?
  ------------------
  |  Branch (60:31): [True: 115k, False: 0]
  ------------------
   61|   115k|                              ((j_decompress_ptr)cinfo)->master->simd_support :
   62|   115k|                              ((j_compress_ptr)cinfo)->master->simd_support;
   63|   115k|  unsigned int simd_huffman = cinfo->is_decompressor ?
  ------------------
  |  Branch (63:31): [True: 115k, False: 0]
  ------------------
   64|   115k|                              ((j_decompress_ptr)cinfo)->master->simd_huffman :
   65|   115k|                              ((j_compress_ptr)cinfo)->master->simd_huffman;
   66|       |
   67|   115k|  if (simd_support != JSIMD_UNDEFINED)
  ------------------
  |  |   49|   115k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|   115k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  |  Branch (67:7): [True: 79.6k, False: 36.2k]
  ------------------
   68|  79.6k|    return;
   69|       |
   70|  36.2k|  simd_support = jpeg_simd_cpu_support();
   71|       |
   72|  36.2k|#ifndef NO_GETENV
   73|       |  /* Force different settings through environment variables */
   74|  36.2k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
   75|  36.2k|  if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1"))
  ------------------
  |  Branch (75:7): [True: 36.2k, False: 0]
  |  Branch (75:47): [True: 0, False: 36.2k]
  ------------------
   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|  36.2k|  if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
  ------------------
  |  Branch (95:7): [True: 36.2k, False: 0]
  |  Branch (95:47): [True: 0, False: 36.2k]
  ------------------
   96|      0|    simd_support = 0;
   97|       |#ifdef WITH_SIMDE
   98|       |  if (!GETENV_S(env, 2, "JSIMD_HUFFENC") && !strcmp(env, "1"))
   99|       |    simd_huffman = 1;
  100|       |#else
  101|  36.2k|  if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
  ------------------
  |  Branch (101:7): [True: 36.2k, False: 0]
  |  Branch (101:47): [True: 0, False: 36.2k]
  ------------------
  102|      0|    simd_huffman = 0;
  103|  36.2k|#endif
  104|  36.2k|#endif
  105|       |
  106|  36.2k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (106:7): [True: 36.2k, False: 0]
  ------------------
  107|  36.2k|    ((j_decompress_ptr)cinfo)->master->simd_support = simd_support;
  108|  36.2k|    ((j_decompress_ptr)cinfo)->master->simd_huffman = simd_huffman;
  109|  36.2k|  } else {
  110|      0|    ((j_compress_ptr)cinfo)->master->simd_support = simd_support;
  111|      0|    ((j_compress_ptr)cinfo)->master->simd_huffman = simd_huffman;
  112|      0|  }
  113|  36.2k|}

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

jpeg_CreateDecompress:
   40|  37.3k|{
   41|  37.3k|  int i;
   42|       |
   43|       |  /* Guard against version mismatches between library and caller. */
   44|  37.3k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   45|  37.3k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  37.3k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (45:7): [True: 0, False: 37.3k]
  ------------------
   46|      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)))
  ------------------
   47|  37.3k|  if (structsize != sizeof(struct jpeg_decompress_struct))
  ------------------
  |  Branch (47:7): [True: 0, False: 37.3k]
  ------------------
   48|      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)))
  ------------------
   49|  37.3k|             (int)sizeof(struct jpeg_decompress_struct), (int)structsize);
   50|       |
   51|       |  /* For debugging purposes, we zero the whole master structure.
   52|       |   * But the application has already set the err pointer, and may have set
   53|       |   * client_data, so we have to save and restore those fields.
   54|       |   * Note: if application hasn't set client_data, tools like Purify may
   55|       |   * complain here.
   56|       |   */
   57|  37.3k|  {
   58|  37.3k|    struct jpeg_error_mgr *err = cinfo->err;
   59|  37.3k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   60|  37.3k|    memset(cinfo, 0, sizeof(struct jpeg_decompress_struct));
   61|  37.3k|    cinfo->err = err;
   62|  37.3k|    cinfo->client_data = client_data;
   63|  37.3k|  }
   64|  37.3k|  cinfo->is_decompressor = TRUE;
  ------------------
  |  |  210|  37.3k|#define TRUE    1
  ------------------
   65|       |
   66|       |  /* Initialize a memory manager instance for this object */
   67|  37.3k|  jinit_memory_mgr((j_common_ptr)cinfo);
   68|       |
   69|       |  /* Zero out pointers to permanent structures. */
   70|  37.3k|  cinfo->progress = NULL;
   71|  37.3k|  cinfo->src = NULL;
   72|       |
   73|   186k|  for (i = 0; i < NUM_QUANT_TBLS; i++)
  ------------------
  |  |   68|   186k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (73:15): [True: 149k, False: 37.3k]
  ------------------
   74|   149k|    cinfo->quant_tbl_ptrs[i] = NULL;
   75|       |
   76|   186k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|   186k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (76:15): [True: 149k, False: 37.3k]
  ------------------
   77|   149k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   78|   149k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   79|   149k|  }
   80|       |
   81|       |  /* Initialize marker processor so application can override methods
   82|       |   * for COM, APPn markers before calling jpeg_read_header.
   83|       |   */
   84|  37.3k|  cinfo->marker_list = NULL;
   85|  37.3k|  jinit_marker_reader(cinfo);
   86|       |
   87|       |  /* And initialize the overall input controller. */
   88|  37.3k|  jinit_input_controller(cinfo);
   89|       |
   90|  37.3k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|  37.3k|#define BITS_IN_JSAMPLE  8
  ------------------
   91|       |
   92|       |  /* OK, I'm ready */
   93|  37.3k|  cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|  37.3k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
   94|       |
   95|       |  /* The master struct is used to store extension parameters, so we allocate it
   96|       |   * here.
   97|       |   */
   98|  37.3k|  cinfo->master = (struct jpeg_decomp_master *)
   99|  37.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  37.3k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  100|  37.3k|                                sizeof(my_decomp_master));
  101|  37.3k|  memset(cinfo->master, 0, sizeof(my_decomp_master));
  102|  37.3k|#ifdef WITH_SIMD
  103|  37.3k|  cinfo->master->simd_support = JSIMD_UNDEFINED;
  ------------------
  |  |   49|  37.3k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|  37.3k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  104|  37.3k|#ifndef WITH_SIMDE
  105|  37.3k|  cinfo->master->simd_huffman = 1;
  106|  37.3k|#endif
  107|  37.3k|#endif
  108|  37.3k|}
jpeg_read_header:
  277|   176k|{
  278|   176k|  int retcode;
  279|       |
  280|   176k|  if (cinfo->global_state != DSTATE_START &&
  ------------------
  |  |   48|   352k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (280:7): [True: 1, False: 176k]
  ------------------
  281|      1|      cinfo->global_state != DSTATE_INHEADER)
  ------------------
  |  |   49|      1|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (281:7): [True: 1, False: 0]
  ------------------
  282|      1|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  283|       |
  284|   176k|  retcode = jpeg_consume_input(cinfo);
  285|       |
  286|   176k|  switch (retcode) {
  ------------------
  |  Branch (286:11): [True: 83.4k, False: 92.6k]
  ------------------
  287|  78.5k|  case JPEG_REACHED_SOS:
  ------------------
  |  | 1111|  78.5k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (287:3): [True: 78.5k, False: 97.6k]
  ------------------
  288|  78.5k|    retcode = JPEG_HEADER_OK;
  ------------------
  |  | 1066|  78.5k|#define JPEG_HEADER_OK           1 /* Found valid image datastream */
  ------------------
  289|  78.5k|    break;
  290|  4.96k|  case JPEG_REACHED_EOI:
  ------------------
  |  | 1112|  4.96k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (290:3): [True: 4.96k, False: 171k]
  ------------------
  291|  4.96k|    if (require_image)          /* Complain if application wanted an image */
  ------------------
  |  Branch (291:9): [True: 4.22k, False: 736]
  ------------------
  292|  4.22k|      ERREXIT(cinfo, JERR_NO_IMAGE);
  ------------------
  |  |  240|  4.22k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  4.22k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  293|       |    /* Reset to start state; it would be safer to require the application to
  294|       |     * call jpeg_abort, but we can't change it now for compatibility reasons.
  295|       |     * A side effect is to free any temporary memory (there shouldn't be any).
  296|       |     */
  297|  4.96k|    jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */
  298|  4.96k|    retcode = JPEG_HEADER_TABLES_ONLY;
  ------------------
  |  | 1067|  4.96k|#define JPEG_HEADER_TABLES_ONLY  2 /* Found valid table-specs-only datastream */
  ------------------
  299|  4.96k|    break;
  300|      0|  case JPEG_SUSPENDED:
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (300:3): [True: 0, False: 176k]
  ------------------
  301|       |    /* no work */
  302|      0|    break;
  303|   176k|  }
  304|       |
  305|  79.2k|  return retcode;
  306|   176k|}
jpeg_consume_input:
  323|   176k|{
  324|   176k|  int retcode = JPEG_SUSPENDED;
  ------------------
  |  | 1065|   176k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  325|       |
  326|       |  /* NB: every possible DSTATE value should be listed in this switch */
  327|   176k|  switch (cinfo->global_state) {
  328|   176k|  case DSTATE_START:
  ------------------
  |  |   48|   176k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (328:3): [True: 176k, False: 0]
  ------------------
  329|       |    /* Start-of-datastream actions: reset appropriate modules */
  330|   176k|    (*cinfo->inputctl->reset_input_controller) (cinfo);
  331|       |    /* Initialize application's data source module */
  332|   176k|    (*cinfo->src->init_source) (cinfo);
  333|   176k|    cinfo->global_state = DSTATE_INHEADER;
  ------------------
  |  |   49|   176k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  334|   176k|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|   176k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  335|   176k|  case DSTATE_INHEADER:
  ------------------
  |  |   49|   176k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (335:3): [True: 0, False: 176k]
  ------------------
  336|   176k|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  337|   176k|    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
  ------------------
  |  | 1111|   176k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (337:9): [True: 78.5k, False: 97.6k]
  ------------------
  338|       |      /* Set up default parameters based on header data */
  339|  78.5k|      default_decompress_parms(cinfo);
  340|       |      /* Set global state: ready for start_decompress */
  341|  78.5k|      cinfo->global_state = DSTATE_READY;
  ------------------
  |  |   50|  78.5k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  342|  78.5k|    }
  343|   176k|    break;
  344|      0|  case DSTATE_READY:
  ------------------
  |  |   50|      0|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (344:3): [True: 0, False: 176k]
  ------------------
  345|       |    /* Can't advance past first SOS until start_decompress is called */
  346|      0|    retcode = JPEG_REACHED_SOS;
  ------------------
  |  | 1111|      0|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  347|      0|    break;
  348|      0|  case DSTATE_PRELOAD:
  ------------------
  |  |   51|      0|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (348:3): [True: 0, False: 176k]
  ------------------
  349|      0|  case DSTATE_PRESCAN:
  ------------------
  |  |   52|      0|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (349:3): [True: 0, False: 176k]
  ------------------
  350|      0|  case DSTATE_SCANNING:
  ------------------
  |  |   53|      0|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (350:3): [True: 0, False: 176k]
  ------------------
  351|      0|  case DSTATE_RAW_OK:
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (351:3): [True: 0, False: 176k]
  ------------------
  352|      0|  case DSTATE_BUFIMAGE:
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (352:3): [True: 0, False: 176k]
  ------------------
  353|      0|  case DSTATE_BUFPOST:
  ------------------
  |  |   56|      0|#define DSTATE_BUFPOST   208    /* looking for SOS/EOI in jpeg_finish_output */
  ------------------
  |  Branch (353:3): [True: 0, False: 176k]
  ------------------
  354|      0|  case DSTATE_STOPPING:
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (354:3): [True: 0, False: 176k]
  ------------------
  355|      0|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  356|      0|    break;
  357|      0|  default:
  ------------------
  |  Branch (357:3): [True: 0, False: 176k]
  ------------------
  358|      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)))
  ------------------
  359|   176k|  }
  360|  83.4k|  return retcode;
  361|   176k|}
jpeg_has_multiple_scans:
  385|  39.8k|{
  386|       |  /* Only valid after jpeg_read_header completes */
  387|  39.8k|  if (cinfo->global_state < DSTATE_READY ||
  ------------------
  |  |   50|  79.7k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (387:7): [True: 0, False: 39.8k]
  ------------------
  388|  39.8k|      cinfo->global_state > DSTATE_STOPPING)
  ------------------
  |  |   58|  39.8k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (388:7): [True: 0, False: 39.8k]
  ------------------
  389|      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)))
  ------------------
  390|  39.8k|  return cinfo->inputctl->has_multiple_scans;
  391|  39.8k|}
jpeg_finish_decompress:
  405|  29.5k|{
  406|  29.5k|  if ((cinfo->global_state == DSTATE_SCANNING ||
  ------------------
  |  |   53|  59.1k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (406:8): [True: 29.5k, False: 0]
  ------------------
  407|  29.5k|       cinfo->global_state == DSTATE_RAW_OK) && !cinfo->buffered_image) {
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (407:8): [True: 0, False: 0]
  |  Branch (407:49): [True: 29.5k, False: 0]
  ------------------
  408|       |    /* Terminate final pass of non-buffered mode */
  409|  29.5k|    if (cinfo->output_scanline < cinfo->output_height)
  ------------------
  |  Branch (409:9): [True: 0, False: 29.5k]
  ------------------
  410|      0|      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  411|  29.5k|    (*cinfo->master->finish_output_pass) (cinfo);
  412|  29.5k|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|  29.5k|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  413|  29.5k|  } else if (cinfo->global_state == DSTATE_BUFIMAGE) {
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (413:14): [True: 0, False: 0]
  ------------------
  414|       |    /* Finishing after a buffered-image operation */
  415|      0|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  416|      0|  } else if (cinfo->global_state != DSTATE_STOPPING) {
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (416:14): [True: 0, False: 0]
  ------------------
  417|       |    /* STOPPING = repeat call after a suspension, anything else is error */
  418|      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)))
  ------------------
  419|      0|  }
  420|       |  /* Read until EOI */
  421|  43.8k|  while (!cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (421:10): [True: 14.2k, False: 29.5k]
  ------------------
  422|  14.2k|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|  14.2k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (422:9): [True: 0, False: 14.2k]
  ------------------
  423|      0|      return FALSE;             /* Suspend, come back later */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  424|  14.2k|  }
  425|       |  /* Do final cleanup */
  426|  29.5k|  (*cinfo->src->term_source) (cinfo);
  427|       |  /* We can use jpeg_abort to release memory and reset global_state */
  428|  29.5k|  jpeg_abort((j_common_ptr)cinfo);
  429|  29.5k|  return TRUE;
  ------------------
  |  |  210|  29.5k|#define TRUE    1
  ------------------
  430|  29.5k|}
jdapimin.c:default_decompress_parms:
  140|  78.5k|{
  141|       |  /* Guess the input colorspace, and set output colorspace accordingly. */
  142|       |  /* (Wish JPEG committee had provided a real way to specify this...) */
  143|       |  /* Note application may override our guesses. */
  144|  78.5k|  switch (cinfo->num_components) {
  145|  61.9k|  case 1:
  ------------------
  |  Branch (145:3): [True: 61.9k, False: 16.5k]
  ------------------
  146|  61.9k|    cinfo->jpeg_color_space = JCS_GRAYSCALE;
  147|  61.9k|    cinfo->out_color_space = JCS_GRAYSCALE;
  148|  61.9k|    break;
  149|       |
  150|  15.7k|  case 3:
  ------------------
  |  Branch (150:3): [True: 15.7k, False: 62.7k]
  ------------------
  151|  15.7k|    if (cinfo->saw_JFIF_marker) {
  ------------------
  |  Branch (151:9): [True: 274, False: 15.5k]
  ------------------
  152|    274|      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
  153|  15.5k|    } else if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (153:16): [True: 1.05k, False: 14.4k]
  ------------------
  154|  1.05k|      switch (cinfo->Adobe_transform) {
  155|    265|      case 0:
  ------------------
  |  Branch (155:7): [True: 265, False: 785]
  ------------------
  156|    265|        cinfo->jpeg_color_space = JCS_RGB;
  157|    265|        break;
  158|    217|      case 1:
  ------------------
  |  Branch (158:7): [True: 217, False: 833]
  ------------------
  159|    217|        cinfo->jpeg_color_space = JCS_YCbCr;
  160|    217|        break;
  161|    568|      default:
  ------------------
  |  Branch (161:7): [True: 568, False: 482]
  ------------------
  162|    568|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|    568|  ((cinfo)->err->msg_code = (code), \
  |  |  287|    568|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|    568|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  163|    568|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  164|    568|        break;
  165|  1.05k|      }
  166|  14.4k|    } else {
  167|       |      /* Saw no special markers, try to guess from the component IDs */
  168|  14.4k|      int cid0 = cinfo->comp_info[0].component_id;
  169|  14.4k|      int cid1 = cinfo->comp_info[1].component_id;
  170|  14.4k|      int cid2 = cinfo->comp_info[2].component_id;
  171|       |
  172|  14.4k|      if (cid0 == 1 && cid1 == 2 && cid2 == 3) {
  ------------------
  |  Branch (172:11): [True: 7.38k, False: 7.08k]
  |  Branch (172:24): [True: 959, False: 6.42k]
  |  Branch (172:37): [True: 503, False: 456]
  ------------------
  173|    503|#ifdef D_LOSSLESS_SUPPORTED
  174|    503|        if (cinfo->master->lossless)
  ------------------
  |  Branch (174:13): [True: 283, False: 220]
  ------------------
  175|    283|          cinfo->jpeg_color_space = JCS_RGB; /* assume RGB w/out marker */
  176|    220|        else
  177|    220|#endif
  178|    220|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
  179|  13.9k|      } else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
  ------------------
  |  Branch (179:18): [True: 5.59k, False: 8.36k]
  |  Branch (179:32): [True: 5.36k, False: 232]
  |  Branch (179:46): [True: 4.89k, False: 472]
  ------------------
  180|  4.89k|        cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
  181|  9.06k|      else {
  182|  9.06k|        TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
  ------------------
  |  |  309|  9.06k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  9.06k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 9.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  9.06k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  9.06k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  9.06k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  183|  9.06k|#ifdef D_LOSSLESS_SUPPORTED
  184|  9.06k|        if (cinfo->master->lossless)
  ------------------
  |  Branch (184:13): [True: 243, False: 8.82k]
  ------------------
  185|    243|          cinfo->jpeg_color_space = JCS_RGB; /* assume it's RGB */
  186|  8.82k|        else
  187|  8.82k|#endif
  188|  8.82k|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  189|  9.06k|      }
  190|  14.4k|    }
  191|       |    /* Always guess RGB is proper output colorspace. */
  192|  15.7k|    cinfo->out_color_space = JCS_RGB;
  193|  15.7k|    break;
  194|       |
  195|    783|  case 4:
  ------------------
  |  Branch (195:3): [True: 783, False: 77.7k]
  ------------------
  196|    783|    if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (196:9): [True: 248, False: 535]
  ------------------
  197|    248|      switch (cinfo->Adobe_transform) {
  198|     89|      case 0:
  ------------------
  |  Branch (198:7): [True: 89, False: 159]
  ------------------
  199|     89|        cinfo->jpeg_color_space = JCS_CMYK;
  200|     89|        break;
  201|     78|      case 2:
  ------------------
  |  Branch (201:7): [True: 78, False: 170]
  ------------------
  202|     78|        cinfo->jpeg_color_space = JCS_YCCK;
  203|     78|        break;
  204|     81|      default:
  ------------------
  |  Branch (204:7): [True: 81, False: 167]
  ------------------
  205|     81|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|     81|  ((cinfo)->err->msg_code = (code), \
  |  |  287|     81|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|     81|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  206|     81|        cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
  207|     81|        break;
  208|    248|      }
  209|    535|    } else {
  210|       |      /* No special markers, assume straight CMYK. */
  211|    535|      cinfo->jpeg_color_space = JCS_CMYK;
  212|    535|    }
  213|    783|    cinfo->out_color_space = JCS_CMYK;
  214|    783|    break;
  215|       |
  216|      3|  default:
  ------------------
  |  Branch (216:3): [True: 3, False: 78.5k]
  ------------------
  217|      3|    cinfo->jpeg_color_space = JCS_UNKNOWN;
  218|      3|    cinfo->out_color_space = JCS_UNKNOWN;
  219|      3|    break;
  220|  78.5k|  }
  221|       |
  222|       |  /* Set defaults for other decompression parameters. */
  223|  78.5k|  cinfo->scale_num = 1;         /* 1:1 scaling */
  224|  78.5k|  cinfo->scale_denom = 1;
  225|  78.5k|  cinfo->output_gamma = 1.0;
  226|  78.5k|  cinfo->buffered_image = FALSE;
  ------------------
  |  |  207|  78.5k|#define FALSE   0               /* values of boolean */
  ------------------
  227|  78.5k|  cinfo->raw_data_out = FALSE;
  ------------------
  |  |  207|  78.5k|#define FALSE   0               /* values of boolean */
  ------------------
  228|  78.5k|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  301|  78.5k|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  229|  78.5k|  cinfo->do_fancy_upsampling = TRUE;
  ------------------
  |  |  210|  78.5k|#define TRUE    1
  ------------------
  230|  78.5k|  cinfo->do_block_smoothing = TRUE;
  ------------------
  |  |  210|  78.5k|#define TRUE    1
  ------------------
  231|  78.5k|  cinfo->quantize_colors = FALSE;
  ------------------
  |  |  207|  78.5k|#define FALSE   0               /* values of boolean */
  ------------------
  232|       |  /* We set these in case application only sets quantize_colors. */
  233|  78.5k|  cinfo->dither_mode = JDITHER_FS;
  234|  78.5k|#ifdef QUANT_2PASS_SUPPORTED
  235|  78.5k|  cinfo->two_pass_quantize = TRUE;
  ------------------
  |  |  210|  78.5k|#define TRUE    1
  ------------------
  236|       |#else
  237|       |  cinfo->two_pass_quantize = FALSE;
  238|       |#endif
  239|  78.5k|  cinfo->desired_number_of_colors = 256;
  240|  78.5k|  cinfo->colormap = NULL;
  241|       |  /* Initialize for no mode change in buffered-image mode. */
  242|  78.5k|  cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  207|  78.5k|#define FALSE   0               /* values of boolean */
  ------------------
  243|  78.5k|  cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|  78.5k|#define FALSE   0               /* values of boolean */
  ------------------
  244|  78.5k|  cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|  78.5k|#define FALSE   0               /* values of boolean */
  ------------------
  245|  78.5k|}

jpeg_start_decompress:
   56|  74.7k|{
   57|  74.7k|  if (cinfo->global_state == DSTATE_READY) {
  ------------------
  |  |   50|  74.7k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (57:7): [True: 74.7k, False: 0]
  ------------------
   58|       |    /* First call: initialize master control, select active modules */
   59|  74.7k|    jinit_master_decompress(cinfo);
   60|  74.7k|    if (cinfo->buffered_image) {
  ------------------
  |  Branch (60:9): [True: 0, False: 74.7k]
  ------------------
   61|       |      /* No more work here; expecting jpeg_start_output next */
   62|      0|      cinfo->global_state = DSTATE_BUFIMAGE;
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
   63|      0|      return TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
   64|      0|    }
   65|  74.7k|    cinfo->global_state = DSTATE_PRELOAD;
  ------------------
  |  |   51|  74.7k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
   66|  74.7k|  }
   67|  74.7k|  if (cinfo->global_state == DSTATE_PRELOAD) {
  ------------------
  |  |   51|  74.7k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (67:7): [True: 71.1k, False: 3.59k]
  ------------------
   68|       |    /* If file has multiple scans, absorb them all into the coef buffer */
   69|  71.1k|    if (cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (69:9): [True: 21.5k, False: 49.6k]
  ------------------
   70|  21.5k|#ifdef D_MULTISCAN_FILES_SUPPORTED
   71|  1.24M|      for (;;) {
   72|  1.24M|        int retcode;
   73|       |        /* Call progress monitor hook if present */
   74|  1.24M|        if (cinfo->progress != NULL)
  ------------------
  |  Branch (74:13): [True: 1.24M, False: 0]
  ------------------
   75|  1.24M|          (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
   76|       |        /* Absorb some more input */
   77|  1.24M|        retcode = (*cinfo->inputctl->consume_input) (cinfo);
   78|  1.24M|        if (retcode == JPEG_SUSPENDED)
  ------------------
  |  | 1065|  1.24M|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (78:13): [True: 0, False: 1.24M]
  ------------------
   79|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   80|  1.24M|        if (retcode == JPEG_REACHED_EOI)
  ------------------
  |  | 1112|  1.24M|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (80:13): [True: 15.6k, False: 1.22M]
  ------------------
   81|  15.6k|          break;
   82|       |        /* Advance progress counter if appropriate */
   83|  1.22M|        if (cinfo->progress != NULL &&
  ------------------
  |  Branch (83:13): [True: 1.21M, False: 5.85k]
  ------------------
   84|  1.21M|            (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1113|  2.43M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
                          (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1111|  36.0k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (84:14): [True: 1.18M, False: 36.0k]
  |  Branch (84:47): [True: 7.26k, False: 28.8k]
  ------------------
   85|  1.19M|          if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
  ------------------
  |  Branch (85:15): [True: 1.20k, False: 1.18M]
  ------------------
   86|       |            /* jdmaster underestimated number of scans; ratchet up one scan */
   87|  1.20k|            cinfo->progress->pass_limit += (long)cinfo->total_iMCU_rows;
   88|  1.20k|          }
   89|  1.19M|        }
   90|  1.22M|      }
   91|       |#else
   92|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
   93|       |#endif /* D_MULTISCAN_FILES_SUPPORTED */
   94|  21.5k|    }
   95|  71.1k|    cinfo->output_scan_number = cinfo->input_scan_number;
   96|  71.1k|  } else if (cinfo->global_state != DSTATE_PRESCAN)
  ------------------
  |  |   52|  3.59k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (96:14): [True: 0, False: 3.59k]
  ------------------
   97|      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)))
  ------------------
   98|       |  /* Perform any dummy output passes, and set up for the final pass */
   99|  74.7k|  return output_pass_setup(cinfo);
  100|  74.7k|}
jpeg_read_scanlines:
  328|  96.6M|{
  329|  96.6M|#if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED)
  330|  96.6M|  JDIMENSION row_ctr;
  331|       |
  332|  96.6M|#ifdef D_LOSSLESS_SUPPORTED
  333|  96.6M|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (333:7): [True: 75.6k, False: 96.5M]
  ------------------
  334|  75.6k|#if BITS_IN_JSAMPLE == 8
  335|  75.6k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|   151k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (335:9): [True: 0, False: 75.6k]
  |  Branch (335:52): [True: 0, False: 75.6k]
  ------------------
  336|       |#else
  337|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  338|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  339|       |#endif
  340|      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)))
  ------------------
  341|  75.6k|  } else
  342|  96.5M|#endif
  343|  96.5M|  {
  344|  96.5M|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  96.5M|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (344:9): [True: 0, False: 96.5M]
  ------------------
  345|      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)))
  ------------------
  346|  96.5M|  }
  347|       |
  348|  96.6M|  if (cinfo->global_state != DSTATE_SCANNING)
  ------------------
  |  |   53|  96.6M|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (348:7): [True: 6, False: 96.6M]
  ------------------
  349|      6|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      6|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  350|  96.6M|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (350:7): [True: 86.3M, False: 10.2M]
  ------------------
  351|  86.3M|    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
  ------------------
  |  |  283|  86.3M|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  86.3M|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  352|  86.3M|    return 0;
  353|  86.3M|  }
  354|       |
  355|       |  /* Call progress monitor hook if present */
  356|  10.2M|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (356:7): [True: 3.11M, False: 7.16M]
  ------------------
  357|  3.11M|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  358|  3.11M|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  359|  3.11M|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  360|  3.11M|  }
  361|       |
  362|       |  /* Process some data */
  363|  10.2M|  row_ctr = 0;
  364|  10.2M|  if (cinfo->main->_process_data == NULL)
  ------------------
  |  |  256|  10.2M|#define _process_data  process_data
  ------------------
  |  Branch (364:7): [True: 0, False: 10.2M]
  ------------------
  365|      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)))
  ------------------
  366|  10.2M|  (*cinfo->main->_process_data) (cinfo, scanlines, &row_ctr, max_lines);
  ------------------
  |  |  256|  10.2M|#define _process_data  process_data
  ------------------
  367|  10.2M|  cinfo->output_scanline += row_ctr;
  368|  10.2M|  return row_ctr;
  369|       |#else
  370|       |  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  371|       |  return 0;
  372|       |#endif
  373|  96.6M|}
jpeg_read_raw_data:
  720|  1.02M|{
  721|  1.02M|  JDIMENSION lines_per_iMCU_row;
  722|       |
  723|  1.02M|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.02M|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (723:7): [True: 0, False: 1.02M]
  ------------------
  724|      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)))
  ------------------
  725|       |
  726|  1.02M|  if (cinfo->master->lossless)
  ------------------
  |  Branch (726:7): [True: 0, False: 1.02M]
  ------------------
  727|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  728|       |
  729|  1.02M|  if (cinfo->global_state != DSTATE_RAW_OK)
  ------------------
  |  |   54|  1.02M|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (729:7): [True: 0, False: 1.02M]
  ------------------
  730|      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)))
  ------------------
  731|  1.02M|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (731:7): [True: 43.6k, False: 980k]
  ------------------
  732|  43.6k|    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
  ------------------
  |  |  283|  43.6k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  43.6k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  733|  43.6k|    return 0;
  734|  43.6k|  }
  735|       |
  736|       |  /* Call progress monitor hook if present */
  737|   980k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (737:7): [True: 0, False: 980k]
  ------------------
  738|      0|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  739|      0|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  740|      0|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  741|      0|  }
  742|       |
  743|       |  /* Verify that at least one iMCU row can be returned. */
  744|   980k|  lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|   980k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  745|   980k|  if (max_lines < lines_per_iMCU_row)
  ------------------
  |  Branch (745:7): [True: 0, False: 980k]
  ------------------
  746|      0|    ERREXIT(cinfo, JERR_BUFFER_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  747|       |
  748|       |  /* Decompress directly into user's buffer. */
  749|   980k|  if (cinfo->coef->_decompress_data == NULL)
  ------------------
  |  |  258|   980k|#define _decompress_data  decompress_data
  ------------------
  |  Branch (749:7): [True: 0, False: 980k]
  ------------------
  750|      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)))
  ------------------
  751|   980k|  if (!(*cinfo->coef->_decompress_data) (cinfo, data))
  ------------------
  |  |  258|   980k|#define _decompress_data  decompress_data
  ------------------
  |  Branch (751:7): [True: 0, False: 980k]
  ------------------
  752|      0|    return 0;                   /* suspension forced, can do nothing more */
  753|       |
  754|       |  /* OK, we processed one iMCU row. */
  755|   980k|  cinfo->output_scanline += lines_per_iMCU_row;
  756|   980k|  return lines_per_iMCU_row;
  757|   980k|}
jdapistd-8.c:output_pass_setup:
  113|  65.3k|{
  114|  65.3k|  if (cinfo->global_state != DSTATE_PRESCAN) {
  ------------------
  |  |   52|  65.3k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (114:7): [True: 65.3k, False: 0]
  ------------------
  115|       |    /* First call: do pass setup */
  116|  65.3k|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  117|  65.3k|    cinfo->output_scanline = 0;
  118|  65.3k|    cinfo->global_state = DSTATE_PRESCAN;
  ------------------
  |  |   52|  65.3k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  119|  65.3k|  }
  120|       |  /* Loop over any required dummy passes */
  121|  65.3k|  while (cinfo->master->is_dummy_pass) {
  ------------------
  |  Branch (121:10): [True: 0, False: 65.3k]
  ------------------
  122|      0|#ifdef QUANT_2PASS_SUPPORTED
  123|       |    /* Crank through the dummy pass */
  124|      0|    while (cinfo->output_scanline < cinfo->output_height) {
  ------------------
  |  Branch (124:12): [True: 0, False: 0]
  ------------------
  125|      0|      JDIMENSION last_scanline;
  126|       |      /* Call progress monitor hook if present */
  127|      0|      if (cinfo->progress != NULL) {
  ------------------
  |  Branch (127:11): [True: 0, False: 0]
  ------------------
  128|      0|        cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  129|      0|        cinfo->progress->pass_limit = (long)cinfo->output_height;
  130|      0|        (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  131|      0|      }
  132|       |      /* Process some data */
  133|      0|      last_scanline = cinfo->output_scanline;
  134|      0|      if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (134:11): [True: 0, False: 0]
  ------------------
  135|      0|        if (cinfo->main->process_data == NULL)
  ------------------
  |  Branch (135:13): [True: 0, False: 0]
  ------------------
  136|      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)))
  ------------------
  137|      0|        (*cinfo->main->process_data) (cinfo, (JSAMPARRAY)NULL,
  138|      0|                                      &cinfo->output_scanline, (JDIMENSION)0);
  139|      0|      } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (139:18): [True: 0, False: 0]
  ------------------
  140|      0|        if (cinfo->main->process_data_12 == NULL)
  ------------------
  |  Branch (140:13): [True: 0, False: 0]
  ------------------
  141|      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)))
  ------------------
  142|      0|        (*cinfo->main->process_data_12) (cinfo, (J12SAMPARRAY)NULL,
  143|      0|                                         &cinfo->output_scanline,
  144|      0|                                         (JDIMENSION)0);
  145|      0|      } else {
  146|      0|#ifdef D_LOSSLESS_SUPPORTED
  147|      0|        if (cinfo->main->process_data_16 == NULL)
  ------------------
  |  Branch (147:13): [True: 0, False: 0]
  ------------------
  148|      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)))
  ------------------
  149|      0|        (*cinfo->main->process_data_16) (cinfo, (J16SAMPARRAY)NULL,
  150|      0|                                         &cinfo->output_scanline,
  151|      0|                                         (JDIMENSION)0);
  152|       |#else
  153|       |        ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  154|       |#endif
  155|      0|      }
  156|      0|      if (cinfo->output_scanline == last_scanline)
  ------------------
  |  Branch (156:11): [True: 0, False: 0]
  ------------------
  157|      0|        return FALSE;           /* No progress made, must suspend */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  158|      0|    }
  159|       |    /* Finish up dummy pass, and set up for another one */
  160|      0|    (*cinfo->master->finish_output_pass) (cinfo);
  161|      0|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  162|      0|    cinfo->output_scanline = 0;
  163|       |#else
  164|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  165|       |#endif /* QUANT_2PASS_SUPPORTED */
  166|      0|  }
  167|       |  /* Ready for application to drive output pass through
  168|       |   * _jpeg_read_scanlines or _jpeg_read_raw_data.
  169|       |   */
  170|  65.3k|  cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
  ------------------
  |  |   54|    940|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
                cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
  ------------------
  |  |   53|   129k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (170:25): [True: 940, False: 64.3k]
  ------------------
  171|  65.3k|  return TRUE;
  ------------------
  |  |  210|  65.3k|#define TRUE    1
  ------------------
  172|  65.3k|}
jpeg12_read_scanlines:
  328|  1.74M|{
  329|  1.74M|#if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED)
  330|  1.74M|  JDIMENSION row_ctr;
  331|       |
  332|  1.74M|#ifdef D_LOSSLESS_SUPPORTED
  333|  1.74M|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (333:7): [True: 113k, False: 1.63M]
  ------------------
  334|       |#if BITS_IN_JSAMPLE == 8
  335|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  336|       |#else
  337|   113k|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|   226k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (337:9): [True: 0, False: 113k]
  ------------------
  338|   113k|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|   113k|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (338:9): [True: 0, False: 113k]
  ------------------
  339|      0|#endif
  340|      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)))
  ------------------
  341|   113k|  } else
  342|  1.63M|#endif
  343|  1.63M|  {
  344|  1.63M|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.63M|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (344:9): [True: 0, False: 1.63M]
  ------------------
  345|      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)))
  ------------------
  346|  1.63M|  }
  347|       |
  348|  1.74M|  if (cinfo->global_state != DSTATE_SCANNING)
  ------------------
  |  |   53|  1.74M|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (348:7): [True: 197, False: 1.74M]
  ------------------
  349|    197|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|    197|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    197|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    197|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  350|  1.74M|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (350:7): [True: 0, False: 1.74M]
  ------------------
  351|      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))
  ------------------
  352|      0|    return 0;
  353|      0|  }
  354|       |
  355|       |  /* Call progress monitor hook if present */
  356|  1.74M|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (356:7): [True: 1.74M, False: 197]
  ------------------
  357|  1.74M|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  358|  1.74M|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  359|  1.74M|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  360|  1.74M|  }
  361|       |
  362|       |  /* Process some data */
  363|  1.74M|  row_ctr = 0;
  364|  1.74M|  if (cinfo->main->_process_data == NULL)
  ------------------
  |  |  140|  1.74M|#define _process_data  process_data_12
  ------------------
  |  Branch (364:7): [True: 0, False: 1.74M]
  ------------------
  365|      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)))
  ------------------
  366|  1.74M|  (*cinfo->main->_process_data) (cinfo, scanlines, &row_ctr, max_lines);
  ------------------
  |  |  140|  1.74M|#define _process_data  process_data_12
  ------------------
  367|  1.74M|  cinfo->output_scanline += row_ctr;
  368|  1.74M|  return row_ctr;
  369|       |#else
  370|       |  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  371|       |  return 0;
  372|       |#endif
  373|  1.74M|}

jinit_arith_decoder:
  751|  18.0k|{
  752|  18.0k|  arith_entropy_ptr entropy;
  753|  18.0k|  int i;
  754|       |
  755|  18.0k|  entropy = (arith_entropy_ptr)
  756|  18.0k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  18.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  757|  18.0k|                                sizeof(arith_entropy_decoder));
  758|  18.0k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  759|  18.0k|  entropy->pub.start_pass = start_pass;
  760|       |
  761|       |  /* Mark tables unallocated */
  762|   306k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|   306k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 288k, False: 18.0k]
  ------------------
  763|   288k|    entropy->dc_stats[i] = NULL;
  764|   288k|    entropy->ac_stats[i] = NULL;
  765|   288k|  }
  766|       |
  767|       |  /* Initialize index for fixed probability estimation */
  768|  18.0k|  entropy->fixed_bin[0] = 113;
  769|       |
  770|  18.0k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (770:7): [True: 12.0k, False: 5.95k]
  ------------------
  771|       |    /* Create progression status table */
  772|  12.0k|    int *coef_bit_ptr, ci;
  773|  12.0k|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|  12.0k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  12.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|  12.0k|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|  12.0k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|  12.0k|                                  sizeof(int));
  777|  12.0k|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|  37.6k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 25.5k, False: 12.0k]
  ------------------
  779|  1.66M|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  1.66M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 1.63M, False: 25.5k]
  ------------------
  780|  1.63M|        *coef_bit_ptr++ = -1;
  781|  12.0k|  }
  782|  18.0k|}
jdarith.c:start_pass:
  633|  21.5k|{
  634|  21.5k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|  21.5k|  int ci, tbl;
  636|  21.5k|  jpeg_component_info *compptr;
  637|       |
  638|  21.5k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 15.5k, False: 5.97k]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|  15.5k|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 10.6k, False: 4.91k]
  ------------------
  641|  10.6k|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 141, False: 10.4k]
  ------------------
  642|    141|        goto bad;
  643|  10.6k|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|  4.91k|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   67|  4.77k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 142, False: 4.77k]
  |  Branch (645:36): [True: 218, False: 4.55k]
  ------------------
  646|    360|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|  4.55k|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 243, False: 4.31k]
  ------------------
  649|    243|        goto bad;
  650|  4.55k|    }
  651|  14.8k|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 5.32k, False: 9.48k]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|  5.32k|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 185, False: 5.13k]
  ------------------
  654|    185|        goto bad;
  655|  5.32k|    }
  656|  14.6k|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 259, False: 14.3k]
  ------------------
  657|  1.18k|bad:
  658|  1.18k|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|  1.18k|  ((cinfo)->err->msg_code = (code), \
  |  |  259|  1.18k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|  1.18k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|  1.18k|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|  1.18k|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|  1.18k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|  1.18k|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|  1.18k|    }
  661|       |    /* Update progression status, and verify that scan order is legal.
  662|       |     * Note that inter-scan inconsistencies are treated as warnings
  663|       |     * not fatal errors ... not clear if this is right way to behave.
  664|       |     */
  665|  37.2k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 21.6k, False: 15.5k]
  ------------------
  666|  21.6k|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|  21.6k|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|  21.6k|      int *prev_coef_bit_ptr =
  669|  21.6k|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|  21.6k|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 4.14k, False: 17.5k]
  |  Branch (670:24): [True: 3.49k, False: 655]
  ------------------
  671|  3.49k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|  3.49k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  3.49k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  3.49k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  3.49k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  672|   370k|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|  21.6k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 17.5k, False: 4.14k]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|   370k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 169k, False: 201k]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 348k, False: 21.6k]
  ------------------
  673|   348k|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 68.7k, False: 279k]
  ------------------
  674|  68.7k|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|   279k|        else
  676|   279k|          prev_coef_bit_ptr[coefi] = 0;
  677|   348k|      }
  678|   140k|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 119k, False: 21.6k]
  ------------------
  679|   119k|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 104k, False: 14.5k]
  ------------------
  680|   119k|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 37.5k, False: 81.4k]
  ------------------
  681|  37.5k|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|  37.5k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  37.5k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  37.5k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  37.5k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  682|   119k|        coef_bit_ptr[coefi] = cinfo->Al;
  683|   119k|      }
  684|  21.6k|    }
  685|       |    /* Select MCU decoding routine */
  686|  15.5k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 9.47k, False: 6.07k]
  ------------------
  687|  9.47k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 6.88k, False: 2.59k]
  ------------------
  688|  6.88k|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|  2.59k|      else
  690|  2.59k|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|  9.47k|    } else {
  692|  6.07k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 3.33k, False: 2.74k]
  ------------------
  693|  3.33k|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|  2.74k|      else
  695|  2.74k|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|  6.07k|    }
  697|  15.5k|  } else {
  698|       |    /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
  699|       |     * This ought to be an error condition, but we make it a warning.
  700|       |     */
  701|  5.97k|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|  3.70k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 2.26k, False: 3.70k]
  |  Branch (701:27): [True: 3.17k, False: 535]
  ------------------
  702|    535|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 386, False: 149]
  |  Branch (702:27): [True: 21, False: 128]
  ------------------
  703|  5.84k|      WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|  5.84k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  5.84k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  704|       |    /* Select MCU decoding routine */
  705|  5.97k|    entropy->pub.decode_mcu = decode_mcu;
  706|  5.97k|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|  49.4k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 27.9k, False: 21.5k]
  ------------------
  710|  27.9k|    compptr = cinfo->cur_comp_info[ci];
  711|  27.9k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 6.25k, False: 21.6k]
  |  Branch (711:38): [True: 17.5k, False: 4.14k]
  |  Branch (711:56): [True: 12.6k, False: 4.94k]
  ------------------
  712|  18.8k|      tbl = compptr->dc_tbl_no;
  713|  18.8k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  18.8k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 18.8k]
  |  Branch (713:22): [True: 0, False: 18.8k]
  ------------------
  714|      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)))
  ------------------
  715|  18.8k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 12.0k, False: 6.80k]
  ------------------
  716|  12.0k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|  12.0k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  889|  12.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  12.0k|#define DC_STAT_BINS  64
  ------------------
  718|  18.8k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  18.8k|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|  18.8k|      entropy->last_dc_val[ci] = 0;
  721|  18.8k|      entropy->dc_context[ci] = 0;
  722|  18.8k|    }
  723|  27.9k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 6.25k, False: 21.6k]
  |  Branch (723:37): [True: 4.14k, False: 17.5k]
  ------------------
  724|  10.4k|      tbl = compptr->ac_tbl_no;
  725|  10.4k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  10.4k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 10.4k]
  |  Branch (725:22): [True: 0, False: 10.4k]
  ------------------
  726|      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)))
  ------------------
  727|  10.4k|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 9.97k, False: 422]
  ------------------
  728|  9.97k|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|  9.97k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  889|  9.97k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|  9.97k|#define AC_STAT_BINS  256
  ------------------
  730|  10.4k|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  10.4k|#define AC_STAT_BINS  256
  ------------------
  731|  10.4k|    }
  732|  27.9k|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|  21.5k|  entropy->c = 0;
  736|  21.5k|  entropy->a = 0;
  737|  21.5k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|  21.5k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  21.5k|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|  21.5k|  entropy->restarts_to_go = cinfo->restart_interval;
  742|  21.5k|}
jdarith.c:decode_mcu_DC_first:
  251|  16.2M|{
  252|  16.2M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  253|  16.2M|  JBLOCKROW block;
  254|  16.2M|  unsigned char *st;
  255|  16.2M|  int blkn, ci, tbl, sign;
  256|  16.2M|  int v, m;
  257|       |
  258|       |  /* Process restart marker if needed */
  259|  16.2M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (259:7): [True: 70.9k, False: 16.1M]
  ------------------
  260|  70.9k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (260:9): [True: 49.8k, False: 21.1k]
  ------------------
  261|  49.8k|      process_restart(cinfo);
  262|  70.9k|    entropy->restarts_to_go--;
  263|  70.9k|  }
  264|       |
  265|  16.2M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|   467k|#define TRUE    1
  ------------------
  |  Branch (265:7): [True: 467k, False: 15.7M]
  ------------------
  266|       |
  267|       |  /* Outer loop handles each block in the MCU */
  268|       |
  269|  31.7M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (269:18): [True: 16.0M, False: 15.7M]
  ------------------
  270|  16.0M|    block = MCU_data[blkn];
  271|  16.0M|    ci = cinfo->MCU_membership[blkn];
  272|  16.0M|    tbl = cinfo->cur_comp_info[ci]->dc_tbl_no;
  273|       |
  274|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  275|       |
  276|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  277|  16.0M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  278|       |
  279|       |    /* Figure F.19: Decode_DC_DIFF */
  280|  16.0M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (280:9): [True: 6.22M, False: 9.77M]
  ------------------
  281|  6.22M|      entropy->dc_context[ci] = 0;
  282|  9.77M|    else {
  283|       |      /* Figure F.21: Decoding nonzero value v */
  284|       |      /* Figure F.22: Decoding the sign of v */
  285|  9.77M|      sign = arith_decode(cinfo, st + 1);
  286|  9.77M|      st += 2;  st += sign;
  287|       |      /* Figure F.23: Decoding the magnitude category of v */
  288|  9.77M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (288:11): [True: 4.58M, False: 5.18M]
  ------------------
  289|  4.58M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  290|  10.1M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (290:16): [True: 5.59M, False: 4.58M]
  ------------------
  291|  5.59M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (291:15): [True: 264, False: 5.59M]
  ------------------
  292|    264|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    264|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    264|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  293|    264|            entropy->ct = -1;                   /* magnitude overflow */
  294|    264|            return TRUE;
  ------------------
  |  |  210|    264|#define TRUE    1
  ------------------
  295|    264|          }
  296|  5.59M|          st += 1;
  297|  5.59M|        }
  298|  4.58M|      }
  299|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  300|  9.77M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (300:11): [True: 0, False: 9.77M]
  ------------------
  301|      0|        entropy->dc_context[ci] = 0;               /* zero diff category */
  302|  9.77M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (302:16): [True: 2.48M, False: 7.29M]
  ------------------
  303|  2.48M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  304|  7.29M|      else
  305|  7.29M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  306|  9.77M|      v = m;
  307|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  308|  9.77M|      st += 14;
  309|  15.3M|      while (m >>= 1)
  ------------------
  |  Branch (309:14): [True: 5.59M, False: 9.77M]
  ------------------
  310|  5.59M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (310:13): [True: 2.44M, False: 3.14M]
  ------------------
  311|  9.77M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (311:20): [True: 3.96M, False: 5.80M]
  ------------------
  312|  9.77M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  313|  9.77M|    }
  314|       |
  315|       |    /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
  316|  15.9M|    (*block)[0] = (JCOEF)LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
  ------------------
  |  |   85|  15.9M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  317|  15.9M|  }
  318|       |
  319|  15.7M|  return TRUE;
  ------------------
  |  |  210|  15.7M|#define TRUE    1
  ------------------
  320|  15.7M|}
jdarith.c:process_restart:
  200|  98.5k|{
  201|  98.5k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  202|  98.5k|  int ci;
  203|  98.5k|  jpeg_component_info *compptr;
  204|       |
  205|       |  /* Advance past the RSTn marker */
  206|  98.5k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (206:7): [True: 0, False: 98.5k]
  ------------------
  207|      0|    ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  208|       |
  209|       |  /* Re-initialize statistics areas */
  210|   299k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (210:16): [True: 200k, False: 98.5k]
  ------------------
  211|   200k|    compptr = cinfo->cur_comp_info[ci];
  212|   200k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (212:9): [True: 1.92k, False: 198k]
  |  Branch (212:38): [True: 151k, False: 47.1k]
  |  Branch (212:56): [True: 149k, False: 2.33k]
  ------------------
  213|   151k|      memset(entropy->dc_stats[compptr->dc_tbl_no], 0, DC_STAT_BINS);
  ------------------
  |  |   69|   151k|#define DC_STAT_BINS  64
  ------------------
  214|       |      /* Reset DC predictions to 0 */
  215|   151k|      entropy->last_dc_val[ci] = 0;
  216|   151k|      entropy->dc_context[ci] = 0;
  217|   151k|    }
  218|   200k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (218:9): [True: 1.92k, False: 198k]
  |  Branch (218:37): [True: 47.1k, False: 151k]
  ------------------
  219|  49.1k|      memset(entropy->ac_stats[compptr->ac_tbl_no], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  49.1k|#define AC_STAT_BINS  256
  ------------------
  220|  49.1k|    }
  221|   200k|  }
  222|       |
  223|       |  /* Reset arithmetic decoding variables */
  224|  98.5k|  entropy->c = 0;
  225|  98.5k|  entropy->a = 0;
  226|  98.5k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  227|       |
  228|       |  /* Reset restart counter */
  229|  98.5k|  entropy->restarts_to_go = cinfo->restart_interval;
  230|  98.5k|}
jdarith.c:arith_decode:
  116|   160M|{
  117|   160M|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  118|   160M|  register unsigned char nl, nm;
  119|   160M|  register JLONG qe, temp;
  120|   160M|  register int sv, data;
  121|       |
  122|       |  /* Renormalization & data input per section D.2.6 */
  123|   221M|  while (e->a < 0x8000L) {
  ------------------
  |  Branch (123:10): [True: 60.9M, False: 160M]
  ------------------
  124|  60.9M|    if (--e->ct < 0) {
  ------------------
  |  Branch (124:9): [True: 7.90M, False: 53.0M]
  ------------------
  125|       |      /* Need to fetch next data byte */
  126|  7.90M|      if (cinfo->unread_marker)
  ------------------
  |  Branch (126:11): [True: 7.57M, False: 336k]
  ------------------
  127|  7.57M|        data = 0;               /* stuff zero data */
  128|   336k|      else {
  129|   336k|        data = get_byte(cinfo); /* read next input byte */
  130|   336k|        if (data == 0xFF) {     /* zero stuff or marker code */
  ------------------
  |  Branch (130:13): [True: 15.3k, False: 320k]
  ------------------
  131|  46.0k|          do data = get_byte(cinfo);
  132|  46.0k|          while (data == 0xFF); /* swallow extra 0xFF bytes */
  ------------------
  |  Branch (132:18): [True: 30.7k, False: 15.3k]
  ------------------
  133|  15.3k|          if (data == 0)
  ------------------
  |  Branch (133:15): [True: 3.39k, False: 11.9k]
  ------------------
  134|  3.39k|            data = 0xFF;        /* discard stuffed zero byte */
  135|  11.9k|          else {
  136|       |            /* Note: Different from the Huffman decoder, hitting
  137|       |             * a marker while processing the compressed data
  138|       |             * segment is legal in arithmetic coding.
  139|       |             * The convention is to supply zero data
  140|       |             * then until decoding is complete.
  141|       |             */
  142|  11.9k|            cinfo->unread_marker = data;
  143|  11.9k|            data = 0;
  144|  11.9k|          }
  145|  15.3k|        }
  146|   336k|      }
  147|  7.90M|      e->c = (e->c << 8) | data; /* insert data into C register */
  148|  7.90M|      if ((e->ct += 8) < 0)      /* update bit shift counter */
  ------------------
  |  Branch (148:11): [True: 237k, False: 7.66M]
  ------------------
  149|       |        /* Need more initial bytes */
  150|   237k|        if (++e->ct == 0)
  ------------------
  |  Branch (150:13): [True: 118k, False: 118k]
  ------------------
  151|       |          /* Got 2 initial bytes -> re-init A and exit loop */
  152|   118k|          e->a = 0x8000L; /* => e->a = 0x10000L after loop exit */
  153|  7.90M|    }
  154|  60.9M|    e->a <<= 1;
  155|  60.9M|  }
  156|       |
  157|       |  /* Fetch values from our compact representation of Table D.2:
  158|       |   * Qe values and probability estimation state machine
  159|       |   */
  160|   160M|  sv = *st;
  161|   160M|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  162|   160M|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  163|   160M|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  164|       |
  165|       |  /* Decode & estimation procedures per sections D.2.4 & D.2.5 */
  166|   160M|  temp = e->a - qe;
  167|   160M|  e->a = temp;
  168|   160M|  temp <<= e->ct;
  169|   160M|  if (e->c >= temp) {
  ------------------
  |  Branch (169:7): [True: 20.4M, False: 140M]
  ------------------
  170|  20.4M|    e->c -= temp;
  171|       |    /* Conditional LPS (less probable symbol) exchange */
  172|  20.4M|    if (e->a < qe) {
  ------------------
  |  Branch (172:9): [True: 5.64M, False: 14.8M]
  ------------------
  173|  5.64M|      e->a = qe;
  174|  5.64M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  175|  14.8M|    } else {
  176|  14.8M|      e->a = qe;
  177|  14.8M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  178|  14.8M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  179|  14.8M|    }
  180|   140M|  } else if (e->a < 0x8000L) {
  ------------------
  |  Branch (180:14): [True: 24.2M, False: 115M]
  ------------------
  181|       |    /* Conditional MPS (more probable symbol) exchange */
  182|  24.2M|    if (e->a < qe) {
  ------------------
  |  Branch (182:9): [True: 6.91M, False: 17.3M]
  ------------------
  183|  6.91M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  184|  6.91M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  185|  17.3M|    } else {
  186|  17.3M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  187|  17.3M|    }
  188|  24.2M|  }
  189|       |
  190|   160M|  return sv >> 7;
  191|   160M|}
jdarith.c:get_byte:
   76|   382k|{
   77|   382k|  struct jpeg_source_mgr *src = cinfo->src;
   78|       |
   79|   382k|  if (src->bytes_in_buffer == 0)
  ------------------
  |  Branch (79:7): [True: 4.34k, False: 377k]
  ------------------
   80|  4.34k|    if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (80:9): [True: 0, False: 4.34k]
  ------------------
   81|      0|      ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   82|   382k|  src->bytes_in_buffer--;
   83|   382k|  return *src->next_input_byte++;
   84|   382k|}
jdarith.c:decode_mcu_AC_first:
  330|  3.53M|{
  331|  3.53M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  332|  3.53M|  JBLOCKROW block;
  333|  3.53M|  unsigned char *st;
  334|  3.53M|  int tbl, sign, k;
  335|  3.53M|  int v, m;
  336|       |
  337|       |  /* Process restart marker if needed */
  338|  3.53M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (338:7): [True: 0, False: 3.53M]
  ------------------
  339|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (339:9): [True: 0, False: 0]
  ------------------
  340|      0|      process_restart(cinfo);
  341|      0|    entropy->restarts_to_go--;
  342|      0|  }
  343|       |
  344|  3.53M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|   904k|#define TRUE    1
  ------------------
  |  Branch (344:7): [True: 904k, False: 2.63M]
  ------------------
  345|       |
  346|       |  /* There is always only one block per MCU */
  347|  2.63M|  block = MCU_data[0];
  348|  2.63M|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  349|       |
  350|       |  /* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */
  351|       |
  352|       |  /* Figure F.20: Decode_AC_coefficients */
  353|  5.81M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (353:23): [True: 5.80M, False: 10.4k]
  ------------------
  354|  5.80M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  355|  5.80M|    if (arith_decode(cinfo, st)) break;         /* EOB flag */
  ------------------
  |  Branch (355:9): [True: 2.62M, False: 3.18M]
  ------------------
  356|  5.74M|    while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (356:12): [True: 2.56M, False: 3.18M]
  ------------------
  357|  2.56M|      st += 3;  k++;
  358|  2.56M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (358:11): [True: 476, False: 2.56M]
  ------------------
  359|    476|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    476|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    476|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  360|    476|        entropy->ct = -1;                       /* spectral overflow */
  361|    476|        return TRUE;
  ------------------
  |  |  210|    476|#define TRUE    1
  ------------------
  362|    476|      }
  363|  2.56M|    }
  364|       |    /* Figure F.21: Decoding nonzero value v */
  365|       |    /* Figure F.22: Decoding the sign of v */
  366|  3.18M|    sign = arith_decode(cinfo, entropy->fixed_bin);
  367|  3.18M|    st += 2;
  368|       |    /* Figure F.23: Decoding the magnitude category of v */
  369|  3.18M|    if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (369:9): [True: 1.81M, False: 1.36M]
  ------------------
  370|  1.81M|      if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (370:11): [True: 1.68M, False: 136k]
  ------------------
  371|  1.68M|        m <<= 1;
  372|  1.68M|        st = entropy->ac_stats[tbl] +
  373|  1.68M|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (373:15): [True: 1.26M, False: 416k]
  ------------------
  374|  3.42M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (374:16): [True: 1.74M, False: 1.68M]
  ------------------
  375|  1.74M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (375:15): [True: 255, False: 1.74M]
  ------------------
  376|    255|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    255|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    255|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  377|    255|            entropy->ct = -1;                   /* magnitude overflow */
  378|    255|            return TRUE;
  ------------------
  |  |  210|    255|#define TRUE    1
  ------------------
  379|    255|          }
  380|  1.74M|          st += 1;
  381|  1.74M|        }
  382|  1.68M|      }
  383|  1.81M|    }
  384|  3.18M|    v = m;
  385|       |    /* Figure F.24: Decoding the magnitude bit pattern of v */
  386|  3.18M|    st += 14;
  387|  6.60M|    while (m >>= 1)
  ------------------
  |  Branch (387:12): [True: 3.42M, False: 3.18M]
  ------------------
  388|  3.42M|      if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (388:11): [True: 1.16M, False: 2.25M]
  ------------------
  389|  3.18M|    v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (389:18): [True: 1.73M, False: 1.45M]
  ------------------
  390|       |    /* Scale and output coefficient in natural (dezigzagged) order */
  391|  3.18M|    (*block)[jpeg_natural_order[k]] = (JCOEF)((unsigned)v << cinfo->Al);
  392|  3.18M|  }
  393|       |
  394|  2.63M|  return TRUE;
  ------------------
  |  |  210|  2.63M|#define TRUE    1
  ------------------
  395|  2.63M|}
jdarith.c:decode_mcu_DC_refine:
  404|   380k|{
  405|   380k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  406|   380k|  unsigned char *st;
  407|   380k|  int p1, blkn;
  408|       |
  409|       |  /* Process restart marker if needed */
  410|   380k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (410:7): [True: 38.0k, False: 342k]
  ------------------
  411|  38.0k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (411:9): [True: 905, False: 37.1k]
  ------------------
  412|    905|      process_restart(cinfo);
  413|  38.0k|    entropy->restarts_to_go--;
  414|  38.0k|  }
  415|       |
  416|   380k|  st = entropy->fixed_bin;      /* use fixed probability estimation */
  417|   380k|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  418|       |
  419|       |  /* Outer loop handles each block in the MCU */
  420|       |
  421|   811k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (421:18): [True: 430k, False: 380k]
  ------------------
  422|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  423|   430k|    if (arith_decode(cinfo, st))
  ------------------
  |  Branch (423:9): [True: 231k, False: 198k]
  ------------------
  424|   231k|      MCU_data[blkn][0][0] |= p1;
  425|   430k|  }
  426|       |
  427|   380k|  return TRUE;
  ------------------
  |  |  210|   380k|#define TRUE    1
  ------------------
  428|   380k|}
jdarith.c:decode_mcu_AC_refine:
  437|   842k|{
  438|   842k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  439|   842k|  JBLOCKROW block;
  440|   842k|  JCOEFPTR thiscoef;
  441|   842k|  unsigned char *st;
  442|   842k|  int tbl, k, kex;
  443|   842k|  int p1, m1;
  444|       |
  445|       |  /* Process restart marker if needed */
  446|   842k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (446:7): [True: 258k, False: 583k]
  ------------------
  447|   258k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (447:9): [True: 47.1k, False: 211k]
  ------------------
  448|  47.1k|      process_restart(cinfo);
  449|   258k|    entropy->restarts_to_go--;
  450|   258k|  }
  451|       |
  452|   842k|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|   332k|#define TRUE    1
  ------------------
  |  Branch (452:7): [True: 332k, False: 510k]
  ------------------
  453|       |
  454|       |  /* There is always only one block per MCU */
  455|   510k|  block = MCU_data[0];
  456|   510k|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  457|       |
  458|   510k|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  459|   510k|  m1 = (NEG_1) << cinfo->Al;    /* -1 in the bit position being coded */
  ------------------
  |  |   27|   510k|#define NEG_1  ((unsigned int)-1)
  ------------------
  460|       |
  461|       |  /* Establish EOBx (previous stage end-of-block) index */
  462|  21.5M|  for (kex = cinfo->Se; kex > 0; kex--)
  ------------------
  |  Branch (462:25): [True: 21.0M, False: 503k]
  ------------------
  463|  21.0M|    if ((*block)[jpeg_natural_order[kex]]) break;
  ------------------
  |  Branch (463:9): [True: 7.03k, False: 20.9M]
  ------------------
  464|       |
  465|   915k|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (465:23): [True: 907k, False: 7.77k]
  ------------------
  466|   907k|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  467|   907k|    if (k > kex)
  ------------------
  |  Branch (467:9): [True: 892k, False: 14.8k]
  ------------------
  468|   892k|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (468:11): [True: 502k, False: 390k]
  ------------------
  469|   680k|    for (;;) {
  470|   680k|      thiscoef = *block + jpeg_natural_order[k];
  471|   680k|      if (*thiscoef) {                          /* previously nonzero coef */
  ------------------
  |  Branch (471:11): [True: 11.0k, False: 669k]
  ------------------
  472|  11.0k|        if (arith_decode(cinfo, st + 2)) {
  ------------------
  |  Branch (472:13): [True: 6.10k, False: 4.97k]
  ------------------
  473|  6.10k|          if (*thiscoef < 0)
  ------------------
  |  Branch (473:15): [True: 2.47k, False: 3.62k]
  ------------------
  474|  2.47k|            *thiscoef += (JCOEF)m1;
  475|  3.62k|          else
  476|  3.62k|            *thiscoef += (JCOEF)p1;
  477|  6.10k|        }
  478|  11.0k|        break;
  479|  11.0k|      }
  480|   669k|      if (arith_decode(cinfo, st + 1)) {        /* newly nonzero coef */
  ------------------
  |  Branch (480:11): [True: 394k, False: 275k]
  ------------------
  481|   394k|        if (arith_decode(cinfo, entropy->fixed_bin))
  ------------------
  |  Branch (481:13): [True: 233k, False: 160k]
  ------------------
  482|   233k|          *thiscoef = (JCOEF)m1;
  483|   160k|        else
  484|   160k|          *thiscoef = (JCOEF)p1;
  485|   394k|        break;
  486|   394k|      }
  487|   275k|      st += 3;  k++;
  488|   275k|      if (k > cinfo->Se) {
  ------------------
  |  Branch (488:11): [True: 173, False: 274k]
  ------------------
  489|    173|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    173|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    173|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  490|    173|        entropy->ct = -1;                       /* spectral overflow */
  491|    173|        return TRUE;
  ------------------
  |  |  210|    173|#define TRUE    1
  ------------------
  492|    173|      }
  493|   275k|    }
  494|   405k|  }
  495|       |
  496|   510k|  return TRUE;
  ------------------
  |  |  210|   510k|#define TRUE    1
  ------------------
  497|   510k|}
jdarith.c:decode_mcu:
  506|  7.37M|{
  507|  7.37M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  508|  7.37M|  jpeg_component_info *compptr;
  509|  7.37M|  JBLOCKROW block;
  510|  7.37M|  unsigned char *st;
  511|  7.37M|  int blkn, ci, tbl, sign, k;
  512|  7.37M|  int v, m;
  513|       |
  514|       |  /* Process restart marker if needed */
  515|  7.37M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (515:7): [True: 9.09k, False: 7.36M]
  ------------------
  516|  9.09k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (516:9): [True: 649, False: 8.44k]
  ------------------
  517|    649|      process_restart(cinfo);
  518|  9.09k|    entropy->restarts_to_go--;
  519|  9.09k|  }
  520|       |
  521|  7.37M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|   680k|#define TRUE    1
  ------------------
  |  Branch (521:7): [True: 680k, False: 6.69M]
  ------------------
  522|       |
  523|       |  /* Outer loop handles each block in the MCU */
  524|       |
  525|  13.4M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (525:18): [True: 6.71M, False: 6.69M]
  ------------------
  526|  6.71M|    block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (526:13): [True: 6.71M, False: 0]
  ------------------
  527|  6.71M|    ci = cinfo->MCU_membership[blkn];
  528|  6.71M|    compptr = cinfo->cur_comp_info[ci];
  529|       |
  530|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  531|       |
  532|  6.71M|    tbl = compptr->dc_tbl_no;
  533|       |
  534|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  535|  6.71M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  536|       |
  537|       |    /* Figure F.19: Decode_DC_DIFF */
  538|  6.71M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (538:9): [True: 3.28M, False: 3.43M]
  ------------------
  539|  3.28M|      entropy->dc_context[ci] = 0;
  540|  3.43M|    else {
  541|       |      /* Figure F.21: Decoding nonzero value v */
  542|       |      /* Figure F.22: Decoding the sign of v */
  543|  3.43M|      sign = arith_decode(cinfo, st + 1);
  544|  3.43M|      st += 2;  st += sign;
  545|       |      /* Figure F.23: Decoding the magnitude category of v */
  546|  3.43M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (546:11): [True: 2.08M, False: 1.34M]
  ------------------
  547|  2.08M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  548|  6.77M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (548:16): [True: 4.69M, False: 2.08M]
  ------------------
  549|  4.69M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (549:15): [True: 133, False: 4.69M]
  ------------------
  550|    133|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    133|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    133|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  551|    133|            entropy->ct = -1;                   /* magnitude overflow */
  552|    133|            return TRUE;
  ------------------
  |  |  210|    133|#define TRUE    1
  ------------------
  553|    133|          }
  554|  4.69M|          st += 1;
  555|  4.69M|        }
  556|  2.08M|      }
  557|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  558|  3.43M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (558:11): [True: 0, False: 3.43M]
  ------------------
  559|      0|        entropy->dc_context[ci] = 0;               /* zero diff category */
  560|  3.43M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (560:16): [True: 1.62M, False: 1.81M]
  ------------------
  561|  1.62M|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  562|  1.81M|      else
  563|  1.81M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  564|  3.43M|      v = m;
  565|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  566|  3.43M|      st += 14;
  567|  8.12M|      while (m >>= 1)
  ------------------
  |  Branch (567:14): [True: 4.69M, False: 3.43M]
  ------------------
  568|  4.69M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (568:13): [True: 799k, False: 3.89M]
  ------------------
  569|  3.43M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (569:20): [True: 1.87M, False: 1.55M]
  ------------------
  570|  3.43M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  571|  3.43M|    }
  572|       |
  573|  6.71M|    if (block)
  ------------------
  |  Branch (573:9): [True: 6.71M, False: 0]
  ------------------
  574|  6.71M|      (*block)[0] = (JCOEF)entropy->last_dc_val[ci];
  575|       |
  576|       |    /* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */
  577|       |
  578|  6.71M|    tbl = compptr->ac_tbl_no;
  579|       |
  580|       |    /* Figure F.20: Decode_AC_coefficients */
  581|  13.5M|    for (k = 1; k <= DCTSIZE2 - 1; k++) {
  ------------------
  |  |   67|  13.5M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (581:17): [True: 13.5M, False: 192]
  ------------------
  582|  13.5M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  583|  13.5M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (583:11): [True: 6.71M, False: 6.85M]
  ------------------
  584|  14.7M|      while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (584:14): [True: 7.85M, False: 6.85M]
  ------------------
  585|  7.85M|        st += 3;  k++;
  586|  7.85M|        if (k > DCTSIZE2 - 1) {
  ------------------
  |  |   67|  7.85M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (586:13): [True: 253, False: 7.85M]
  ------------------
  587|    253|          WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    253|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    253|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  588|    253|          entropy->ct = -1;                     /* spectral overflow */
  589|    253|          return TRUE;
  ------------------
  |  |  210|    253|#define TRUE    1
  ------------------
  590|    253|        }
  591|  7.85M|      }
  592|       |      /* Figure F.21: Decoding nonzero value v */
  593|       |      /* Figure F.22: Decoding the sign of v */
  594|  6.85M|      sign = arith_decode(cinfo, entropy->fixed_bin);
  595|  6.85M|      st += 2;
  596|       |      /* Figure F.23: Decoding the magnitude category of v */
  597|  6.85M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (597:11): [True: 3.47M, False: 3.38M]
  ------------------
  598|  3.47M|        if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (598:13): [True: 2.52M, False: 945k]
  ------------------
  599|  2.52M|          m <<= 1;
  600|  2.52M|          st = entropy->ac_stats[tbl] +
  601|  2.52M|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (601:17): [True: 2.05M, False: 468k]
  ------------------
  602|  4.85M|          while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (602:18): [True: 2.32M, False: 2.52M]
  ------------------
  603|  2.32M|            if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (603:17): [True: 185, False: 2.32M]
  ------------------
  604|    185|              WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|    185|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    185|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  605|    185|              entropy->ct = -1;                 /* magnitude overflow */
  606|    185|              return TRUE;
  ------------------
  |  |  210|    185|#define TRUE    1
  ------------------
  607|    185|            }
  608|  2.32M|            st += 1;
  609|  2.32M|          }
  610|  2.52M|        }
  611|  3.47M|      }
  612|  6.85M|      v = m;
  613|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  614|  6.85M|      st += 14;
  615|  11.7M|      while (m >>= 1)
  ------------------
  |  Branch (615:14): [True: 4.84M, False: 6.85M]
  ------------------
  616|  4.84M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (616:13): [True: 2.15M, False: 2.69M]
  ------------------
  617|  6.85M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (617:20): [True: 2.97M, False: 3.88M]
  ------------------
  618|  6.85M|      if (block)
  ------------------
  |  Branch (618:11): [True: 6.85M, False: 0]
  ------------------
  619|  6.85M|        (*block)[jpeg_natural_order[k]] = (JCOEF)v;
  620|  6.85M|    }
  621|  6.71M|  }
  622|       |
  623|  6.69M|  return TRUE;
  ------------------
  |  |  210|  6.69M|#define TRUE    1
  ------------------
  624|  6.69M|}

jinit_d_coef_controller:
  869|  70.5k|{
  870|  70.5k|  my_coef_ptr coef;
  871|       |
  872|  70.5k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  70.5k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (872:7): [True: 0, False: 70.5k]
  ------------------
  873|      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)))
  ------------------
  874|       |
  875|  70.5k|  coef = (my_coef_ptr)
  876|  70.5k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  70.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|  70.5k|                                sizeof(my_coef_controller));
  878|  70.5k|  memset(coef, 0, sizeof(my_coef_controller));
  879|  70.5k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|  70.5k|  coef->pub.start_input_pass = start_input_pass;
  881|  70.5k|  coef->pub.start_output_pass = start_output_pass;
  882|  70.5k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|  70.5k|  coef->coef_bits_latch = NULL;
  884|  70.5k|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|  70.5k|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 22.1k, False: 48.4k]
  ------------------
  888|  22.1k|#ifdef D_MULTISCAN_FILES_SUPPORTED
  889|       |    /* Allocate a full-image virtual array for each component, */
  890|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  891|       |    /* Note we ask for a pre-zeroed array. */
  892|  22.1k|    int ci, access_rows;
  893|  22.1k|    jpeg_component_info *compptr;
  894|       |
  895|  69.4k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 47.3k, False: 22.1k]
  ------------------
  896|  47.3k|         ci++, compptr++) {
  897|  47.3k|      access_rows = compptr->v_samp_factor;
  898|  47.3k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|  47.3k|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 41.2k, False: 6.09k]
  ------------------
  901|  41.2k|        access_rows *= 5;
  902|  47.3k|#endif
  903|  47.3k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|  47.3k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|  47.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|  47.3k|#define TRUE    1
  ------------------
  905|  47.3k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|  47.3k|                               (long)compptr->h_samp_factor),
  907|  47.3k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|  47.3k|                               (long)compptr->v_samp_factor),
  909|  47.3k|         (JDIMENSION)access_rows);
  910|  47.3k|    }
  911|  22.1k|    coef->pub.consume_data = consume_data;
  912|  22.1k|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|  22.1k|#define _decompress_data  decompress_data
  ------------------
  913|  22.1k|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|  48.4k|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|  48.4k|    JBLOCKROW buffer;
  920|  48.4k|    int i;
  921|       |
  922|  48.4k|    buffer = (JBLOCKROW)
  923|  48.4k|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  48.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|  48.4k|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|  48.4k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|   532k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|   532k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 484k, False: 48.4k]
  ------------------
  926|   484k|      coef->MCU_buffer[i] = buffer + i;
  927|   484k|    }
  928|  48.4k|    coef->pub.consume_data = dummy_consume_data;
  929|  48.4k|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  258|  48.4k|#define _decompress_data  decompress_data
  ------------------
  930|  48.4k|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|  48.4k|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|  70.5k|  coef->workspace = (JCOEF *)
  935|  70.5k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  70.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|  70.5k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|  70.5k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|  70.5k|}
jdcoefct-8.c:start_input_pass:
   50|  75.0k|{
   51|  75.0k|  cinfo->input_iMCU_row = 0;
   52|  75.0k|  start_iMCU_row(cinfo);
   53|  75.0k|}
jdcoefct-8.c:start_output_pass:
   62|  63.0k|{
   63|  63.0k|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|  63.0k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   65|       |
   66|       |  /* If multipass, check to see whether to use block smoothing on this pass */
   67|  63.0k|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 15.2k, False: 47.8k]
  ------------------
   68|  15.2k|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 15.2k, False: 0]
  |  Branch (68:38): [True: 2.43k, False: 12.7k]
  ------------------
   69|  2.43k|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  258|  2.43k|#define _decompress_data  decompress_data
  ------------------
   70|  12.7k|    else
   71|  12.7k|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|  12.7k|#define _decompress_data  decompress_data
  ------------------
   72|  15.2k|  }
   73|  63.0k|#endif
   74|  63.0k|  cinfo->output_iMCU_row = 0;
   75|  63.0k|}
jdcoefct-8.c:smoothing_ok:
  405|  15.2k|{
  406|  15.2k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|  15.2k|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|  15.2k|#define FALSE   0               /* values of boolean */
  ------------------
  408|  15.2k|  int ci, coefi;
  409|  15.2k|  jpeg_component_info *compptr;
  410|  15.2k|  JQUANT_TBL *qtable;
  411|  15.2k|  int *coef_bits, *prev_coef_bits;
  412|  15.2k|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|  15.2k|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 1.83k, False: 13.3k]
  |  Branch (414:35): [True: 0, False: 13.3k]
  ------------------
  415|  1.83k|    return FALSE;
  ------------------
  |  |  207|  1.83k|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|  13.3k|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 13.3k, False: 0]
  ------------------
  419|  13.3k|    coef->coef_bits_latch = (int *)
  420|  13.3k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  13.3k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|  13.3k|                                  cinfo->num_components * 2 *
  422|  13.3k|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|  13.3k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|  13.3k|  coef_bits_latch = coef->coef_bits_latch;
  424|  13.3k|  prev_coef_bits_latch =
  425|  13.3k|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|  13.3k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|  19.4k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 16.8k, False: 2.56k]
  ------------------
  428|  16.8k|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|  16.8k|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 631, False: 16.2k]
  ------------------
  431|    631|      return FALSE;
  ------------------
  |  |  207|    631|#define FALSE   0               /* values of boolean */
  ------------------
  432|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  433|  16.2k|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 2.87k, False: 13.3k]
  ------------------
  434|  13.3k|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|  13.3k|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 402, False: 12.9k]
  ------------------
  435|  12.9k|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|  12.9k|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 865, False: 12.0k]
  ------------------
  436|  12.0k|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|  12.0k|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 1.95k, False: 10.1k]
  ------------------
  437|  10.1k|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|  10.1k|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 512, False: 9.60k]
  ------------------
  438|  9.60k|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|  9.60k|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 525, False: 9.07k]
  ------------------
  439|  9.07k|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|  9.07k|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 498, False: 8.57k]
  ------------------
  440|  8.57k|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|  8.57k|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 401, False: 8.17k]
  ------------------
  441|  8.17k|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|  8.17k|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 408, False: 7.76k]
  ------------------
  442|  7.76k|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|  7.76k|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 671, False: 7.09k]
  ------------------
  443|  9.10k|      return FALSE;
  ------------------
  |  |  207|  9.10k|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|  7.09k|    coef_bits = cinfo->coef_bits[ci];
  446|  7.09k|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|  7.09k|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 1.07k, False: 6.02k]
  ------------------
  448|  1.07k|      return FALSE;
  ------------------
  |  |  207|  1.07k|#define FALSE   0               /* values of boolean */
  ------------------
  449|  6.02k|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|  60.2k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  60.2k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 54.2k, False: 6.02k]
  ------------------
  452|  54.2k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 12.2k, False: 41.9k]
  ------------------
  453|  12.2k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|  41.9k|      else
  455|  41.9k|        prev_coef_bits_latch[coefi] = -1;
  456|  54.2k|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|  54.2k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 51.3k, False: 2.86k]
  ------------------
  458|  51.3k|        smoothing_useful = TRUE;
  ------------------
  |  |  210|  51.3k|#define TRUE    1
  ------------------
  459|  54.2k|    }
  460|  6.02k|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|  6.02k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|  6.02k|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|  6.02k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|  6.02k|  }
  463|       |
  464|  2.56k|  return smoothing_useful;
  465|  13.3k|}
jdcoefct-8.c:decompress_smooth_data:
  474|  28.3k|{
  475|  28.3k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  476|  28.3k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  477|  28.3k|  JDIMENSION block_num, last_block_column;
  478|  28.3k|  int ci, block_row, block_rows, access_rows, image_block_row,
  479|  28.3k|    image_block_rows;
  480|  28.3k|  JBLOCKARRAY buffer;
  481|  28.3k|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  482|  28.3k|  JBLOCKROW next_block_row, next_next_block_row;
  483|  28.3k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  28.3k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  484|  28.3k|  JDIMENSION output_col;
  485|  28.3k|  jpeg_component_info *compptr;
  486|  28.3k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  28.3k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  487|  28.3k|  boolean change_dc;
  488|  28.3k|  JCOEF *workspace;
  489|  28.3k|  int *coef_bits;
  490|  28.3k|  JQUANT_TBL *quanttbl;
  491|  28.3k|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  492|  28.3k|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  493|  28.3k|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  494|  28.3k|      DC25;
  495|  28.3k|  int Al, pred;
  496|       |
  497|       |  /* Keep a local variable to avoid looking it up more than once */
  498|  28.3k|  workspace = coef->workspace;
  499|       |
  500|       |  /* Force some input to be done if we are getting ahead of the input. */
  501|  28.3k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (501:10): [True: 28.3k, False: 0]
  ------------------
  502|  28.3k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (502:10): [True: 0, False: 28.3k]
  ------------------
  503|      0|    if (cinfo->input_scan_number == cinfo->output_scan_number) {
  ------------------
  |  Branch (503:9): [True: 0, False: 0]
  ------------------
  504|       |      /* If input is working on current scan, we ordinarily want it to
  505|       |       * have completed the current row.  But if input scan is DC,
  506|       |       * we want it to keep two rows ahead so that next two block rows' DC
  507|       |       * values are up to date.
  508|       |       */
  509|      0|      JDIMENSION delta = (cinfo->Ss == 0) ? 2 : 0;
  ------------------
  |  Branch (509:26): [True: 0, False: 0]
  ------------------
  510|      0|      if (cinfo->input_iMCU_row > cinfo->output_iMCU_row + delta)
  ------------------
  |  Branch (510:11): [True: 0, False: 0]
  ------------------
  511|      0|        break;
  512|      0|    }
  513|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (513:9): [True: 0, False: 0]
  ------------------
  514|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  515|      0|  }
  516|       |
  517|       |  /* OK, output from the virtual arrays. */
  518|  60.9k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (518:44): [True: 32.5k, False: 28.3k]
  ------------------
  519|  32.5k|       ci++, compptr++) {
  520|       |    /* Don't bother to IDCT an uninteresting component. */
  521|  32.5k|    if (!compptr->component_needed)
  ------------------
  |  Branch (521:9): [True: 0, False: 32.5k]
  ------------------
  522|      0|      continue;
  523|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  524|  32.5k|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (524:9): [True: 25.6k, False: 6.90k]
  ------------------
  525|  25.6k|      block_rows = compptr->v_samp_factor;
  526|  25.6k|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  527|  25.6k|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (527:16): [True: 1.35k, False: 5.54k]
  ------------------
  528|  1.35k|      block_rows = compptr->v_samp_factor;
  529|  1.35k|      access_rows = block_rows * 2; /* this and next iMCU row */
  530|  5.54k|    } else {
  531|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  532|  5.54k|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  533|  5.54k|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (533:11): [True: 5.25k, False: 286]
  ------------------
  534|  5.54k|      access_rows = block_rows; /* this iMCU row only */
  535|  5.54k|    }
  536|       |    /* Align the virtual buffer for this component. */
  537|  32.5k|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (537:9): [True: 25.6k, False: 6.90k]
  ------------------
  538|  25.6k|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  539|  25.6k|      buffer = (*cinfo->mem->access_virt_barray)
  540|  25.6k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  541|  25.6k|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  542|  25.6k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  25.6k|#define FALSE   0               /* values of boolean */
  ------------------
  543|  25.6k|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  544|  25.6k|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (544:16): [True: 1.35k, False: 5.54k]
  ------------------
  545|  1.35k|      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
  546|  1.35k|      buffer = (*cinfo->mem->access_virt_barray)
  547|  1.35k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  548|  1.35k|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  549|  1.35k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  1.35k|#define FALSE   0               /* values of boolean */
  ------------------
  550|  1.35k|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  551|  5.54k|    } else {
  552|  5.54k|      buffer = (*cinfo->mem->access_virt_barray)
  553|  5.54k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  554|  5.54k|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  5.54k|#define FALSE   0               /* values of boolean */
  ------------------
  555|  5.54k|    }
  556|       |    /* Fetch component-dependent info.
  557|       |     * If the current scan is incomplete, then we use the component-dependent
  558|       |     * info from the previous scan.
  559|       |     */
  560|  32.5k|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (560:9): [True: 8.01k, False: 24.5k]
  ------------------
  561|  8.01k|      coef_bits =
  562|  8.01k|        coef->coef_bits_latch + ((ci + cinfo->num_components) * SAVED_COEFS);
  ------------------
  |  |   58|  8.01k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  563|  24.5k|    else
  564|  24.5k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   58|  24.5k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  565|       |
  566|       |    /* We only do DC interpolation if no AC coefficient data is available. */
  567|  32.5k|    change_dc =
  568|  32.5k|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (568:7): [True: 30.1k, False: 2.43k]
  |  Branch (568:29): [True: 30.0k, False: 58]
  |  Branch (568:51): [True: 29.7k, False: 340]
  ------------------
  569|  29.7k|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (569:7): [True: 29.7k, False: 0]
  |  Branch (569:29): [True: 29.7k, False: 0]
  |  Branch (569:51): [True: 29.7k, False: 0]
  ------------------
  570|  29.7k|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (570:7): [True: 29.7k, False: 0]
  |  Branch (570:29): [True: 29.7k, False: 0]
  |  Branch (570:51): [True: 29.7k, False: 0]
  ------------------
  571|       |
  572|  32.5k|    quanttbl = compptr->quant_table;
  573|  32.5k|    Q00 = quanttbl->quantval[0];
  574|  32.5k|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  385|  32.5k|#define Q01_POS  1
  ------------------
  575|  32.5k|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  386|  32.5k|#define Q10_POS  8
  ------------------
  576|  32.5k|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  387|  32.5k|#define Q20_POS  16
  ------------------
  577|  32.5k|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  388|  32.5k|#define Q11_POS  9
  ------------------
  578|  32.5k|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  389|  32.5k|#define Q02_POS  2
  ------------------
  579|  32.5k|    if (change_dc) {
  ------------------
  |  Branch (579:9): [True: 29.7k, False: 2.83k]
  ------------------
  580|  29.7k|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  390|  29.7k|#define Q03_POS  3
  ------------------
  581|  29.7k|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  391|  29.7k|#define Q12_POS  10
  ------------------
  582|  29.7k|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  392|  29.7k|#define Q21_POS  17
  ------------------
  583|  29.7k|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  393|  29.7k|#define Q30_POS  24
  ------------------
  584|  29.7k|    }
  585|  32.5k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|  32.5k|#define _inverse_DCT  inverse_DCT
  ------------------
  586|  32.5k|    output_ptr = output_buf[ci];
  587|       |    /* Loop over all DCT blocks to be processed. */
  588|  32.5k|    image_block_rows = block_rows * cinfo->total_iMCU_rows;
  589|  65.5k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (589:25): [True: 32.9k, False: 32.5k]
  ------------------
  590|  32.9k|      image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
  591|  32.9k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  592|       |
  593|  32.9k|      if (image_block_row > 0)
  ------------------
  |  Branch (593:11): [True: 27.4k, False: 5.54k]
  ------------------
  594|  27.4k|        prev_block_row =
  595|  27.4k|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  596|  5.54k|      else
  597|  5.54k|        prev_block_row = buffer_ptr;
  598|       |
  599|  32.9k|      if (image_block_row > 1)
  ------------------
  |  Branch (599:11): [True: 26.0k, False: 6.90k]
  ------------------
  600|  26.0k|        prev_prev_block_row =
  601|  26.0k|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  602|  6.90k|      else
  603|  6.90k|        prev_prev_block_row = prev_block_row;
  604|       |
  605|  32.9k|      if (image_block_row < image_block_rows - 1)
  ------------------
  |  Branch (605:11): [True: 27.4k, False: 5.54k]
  ------------------
  606|  27.4k|        next_block_row =
  607|  27.4k|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  608|  5.54k|      else
  609|  5.54k|        next_block_row = buffer_ptr;
  610|       |
  611|  32.9k|      if (image_block_row < image_block_rows - 2)
  ------------------
  |  Branch (611:11): [True: 26.1k, False: 6.82k]
  ------------------
  612|  26.1k|        next_next_block_row =
  613|  26.1k|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  614|  6.82k|      else
  615|  6.82k|        next_next_block_row = next_block_row;
  616|       |
  617|       |      /* We fetch the surrounding DC values using a sliding-register approach.
  618|       |       * Initialize all 25 here so as to do the right thing on narrow pics.
  619|       |       */
  620|  32.9k|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  621|  32.9k|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  622|  32.9k|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  623|  32.9k|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  624|  32.9k|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  625|  32.9k|      output_col = 0;
  626|  32.9k|      last_block_column = compptr->width_in_blocks - 1;
  627|  32.9k|      for (block_num = cinfo->master->first_MCU_col[ci];
  628|  5.41M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (628:12): [True: 5.38M, False: 32.9k]
  ------------------
  629|       |        /* Fetch current DCT block into workspace so we can modify it. */
  630|  5.38M|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  631|       |        /* Update DC values */
  632|  5.38M|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (632:13): [True: 32.9k, False: 5.35M]
  ------------------
  633|  32.9k|            block_num < last_block_column) {
  ------------------
  |  Branch (633:13): [True: 29.8k, False: 3.12k]
  ------------------
  634|  29.8k|          DC04 = DC05 = (int)prev_prev_block_row[1][0];
  635|  29.8k|          DC09 = DC10 = (int)prev_block_row[1][0];
  636|  29.8k|          DC14 = DC15 = (int)buffer_ptr[1][0];
  637|  29.8k|          DC19 = DC20 = (int)next_block_row[1][0];
  638|  29.8k|          DC24 = DC25 = (int)next_next_block_row[1][0];
  639|  29.8k|        }
  640|  5.38M|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (640:13): [True: 5.32M, False: 62.8k]
  ------------------
  641|  5.32M|          DC05 = (int)prev_prev_block_row[2][0];
  642|  5.32M|          DC10 = (int)prev_block_row[2][0];
  643|  5.32M|          DC15 = (int)buffer_ptr[2][0];
  644|  5.32M|          DC20 = (int)next_block_row[2][0];
  645|  5.32M|          DC25 = (int)next_next_block_row[2][0];
  646|  5.32M|        }
  647|       |        /* If DC interpolation is enabled, compute coefficient estimates using
  648|       |         * a Gaussian-like kernel, keeping the averages of the DC values.
  649|       |         *
  650|       |         * If DC interpolation is disabled, compute coefficient estimates using
  651|       |         * an algorithm similar to the one described in Section K.8 of the JPEG
  652|       |         * standard, except applied to a 5x5 window rather than a 3x3 window.
  653|       |         *
  654|       |         * An estimate is applied only if the coefficient is still zero and is
  655|       |         * not known to be fully accurate.
  656|       |         */
  657|       |        /* AC01 */
  658|  5.38M|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (658:13): [True: 5.38M, False: 0]
  |  Branch (658:41): [True: 5.33M, False: 48.9k]
  ------------------
  659|  5.33M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (659:24): [True: 4.98M, False: 347k]
  ------------------
  660|  4.98M|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  661|  4.98M|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  662|  4.98M|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  663|  4.98M|                 DC21 - DC22 + DC24 + DC25) :
  664|  5.33M|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  665|  5.33M|          if (num >= 0) {
  ------------------
  |  Branch (665:15): [True: 2.13M, False: 3.19M]
  ------------------
  666|  2.13M|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  667|  2.13M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (667:17): [True: 109k, False: 2.02M]
  |  Branch (667:27): [True: 11.1k, False: 98.7k]
  ------------------
  668|  11.1k|              pred = (1 << Al) - 1;
  669|  3.19M|          } else {
  670|  3.19M|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  671|  3.19M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (671:17): [True: 231k, False: 2.96M]
  |  Branch (671:27): [True: 20.0k, False: 211k]
  ------------------
  672|  20.0k|              pred = (1 << Al) - 1;
  673|  3.19M|            pred = -pred;
  674|  3.19M|          }
  675|  5.33M|          workspace[1] = (JCOEF)pred;
  676|  5.33M|        }
  677|       |        /* AC10 */
  678|  5.38M|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (678:13): [True: 5.38M, False: 928]
  |  Branch (678:41): [True: 5.32M, False: 61.9k]
  ------------------
  679|  5.32M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (679:24): [True: 4.98M, False: 333k]
  ------------------
  680|  4.98M|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  681|  4.98M|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  682|  4.98M|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  683|  4.98M|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  684|  5.32M|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  685|  5.32M|          if (num >= 0) {
  ------------------
  |  Branch (685:15): [True: 2.56M, False: 2.75M]
  ------------------
  686|  2.56M|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  687|  2.56M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (687:17): [True: 21.2k, False: 2.54M]
  |  Branch (687:27): [True: 21.2k, False: 0]
  ------------------
  688|  21.2k|              pred = (1 << Al) - 1;
  689|  2.75M|          } else {
  690|  2.75M|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  691|  2.75M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (691:17): [True: 203k, False: 2.55M]
  |  Branch (691:27): [True: 203k, False: 0]
  ------------------
  692|   203k|              pred = (1 << Al) - 1;
  693|  2.75M|            pred = -pred;
  694|  2.75M|          }
  695|  5.32M|          workspace[8] = (JCOEF)pred;
  696|  5.32M|        }
  697|       |        /* AC20 */
  698|  5.38M|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (698:13): [True: 5.37M, False: 6.70k]
  |  Branch (698:41): [True: 5.32M, False: 50.2k]
  ------------------
  699|  5.32M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (699:24): [True: 4.98M, False: 339k]
  ------------------
  700|  4.98M|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  701|  4.98M|                 5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
  702|  5.32M|                (-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
  703|  5.32M|          if (num >= 0) {
  ------------------
  |  Branch (703:15): [True: 3.55M, False: 1.76M]
  ------------------
  704|  3.55M|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  705|  3.55M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (705:17): [True: 125k, False: 3.43M]
  |  Branch (705:27): [True: 107k, False: 18.1k]
  ------------------
  706|   107k|              pred = (1 << Al) - 1;
  707|  3.55M|          } else {
  708|  1.76M|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  709|  1.76M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (709:17): [True: 110k, False: 1.65M]
  |  Branch (709:27): [True: 97.4k, False: 13.1k]
  ------------------
  710|  97.4k|              pred = (1 << Al) - 1;
  711|  1.76M|            pred = -pred;
  712|  1.76M|          }
  713|  5.32M|          workspace[16] = (JCOEF)pred;
  714|  5.32M|        }
  715|       |        /* AC11 */
  716|  5.38M|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (716:13): [True: 5.37M, False: 6.70k]
  |  Branch (716:41): [True: 5.34M, False: 29.4k]
  ------------------
  717|  5.34M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (717:24): [True: 4.98M, False: 360k]
  ------------------
  718|  4.98M|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  719|  4.98M|                 9 * DC19 + DC21 - DC25) :
  720|  5.34M|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  721|   360k|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  722|  5.34M|          if (num >= 0) {
  ------------------
  |  Branch (722:15): [True: 3.74M, False: 1.60M]
  ------------------
  723|  3.74M|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  724|  3.74M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (724:17): [True: 138k, False: 3.60M]
  |  Branch (724:27): [True: 773, False: 137k]
  ------------------
  725|    773|              pred = (1 << Al) - 1;
  726|  3.74M|          } else {
  727|  1.60M|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  728|  1.60M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (728:17): [True: 118k, False: 1.48M]
  |  Branch (728:27): [True: 796, False: 117k]
  ------------------
  729|    796|              pred = (1 << Al) - 1;
  730|  1.60M|            pred = -pred;
  731|  1.60M|          }
  732|  5.34M|          workspace[9] = (JCOEF)pred;
  733|  5.34M|        }
  734|       |        /* AC02 */
  735|  5.38M|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (735:13): [True: 5.37M, False: 6.70k]
  |  Branch (735:41): [True: 5.37M, False: 504]
  ------------------
  736|  5.37M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (736:24): [True: 4.98M, False: 389k]
  ------------------
  737|  4.98M|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  738|  4.98M|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  739|  5.37M|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  740|  5.37M|          if (num >= 0) {
  ------------------
  |  Branch (740:15): [True: 3.41M, False: 1.96M]
  ------------------
  741|  3.41M|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  742|  3.41M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (742:17): [True: 141k, False: 3.27M]
  |  Branch (742:27): [True: 324, False: 141k]
  ------------------
  743|    324|              pred = (1 << Al) - 1;
  744|  3.41M|          } else {
  745|  1.96M|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  746|  1.96M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (746:17): [True: 144k, False: 1.81M]
  |  Branch (746:27): [True: 324, False: 144k]
  ------------------
  747|    324|              pred = (1 << Al) - 1;
  748|  1.96M|            pred = -pred;
  749|  1.96M|          }
  750|  5.37M|          workspace[2] = (JCOEF)pred;
  751|  5.37M|        }
  752|  5.38M|        if (change_dc) {
  ------------------
  |  Branch (752:13): [True: 4.98M, False: 396k]
  ------------------
  753|       |          /* AC03 */
  754|  4.98M|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (754:15): [True: 4.98M, False: 0]
  |  Branch (754:43): [True: 4.98M, False: 0]
  ------------------
  755|  4.98M|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  756|  4.98M|            if (num >= 0) {
  ------------------
  |  Branch (756:17): [True: 2.36M, False: 2.62M]
  ------------------
  757|  2.36M|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  758|  2.36M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (758:19): [True: 0, False: 2.36M]
  |  Branch (758:29): [True: 0, False: 0]
  ------------------
  759|      0|                pred = (1 << Al) - 1;
  760|  2.62M|            } else {
  761|  2.62M|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  762|  2.62M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (762:19): [True: 0, False: 2.62M]
  |  Branch (762:29): [True: 0, False: 0]
  ------------------
  763|      0|                pred = (1 << Al) - 1;
  764|  2.62M|              pred = -pred;
  765|  2.62M|            }
  766|  4.98M|            workspace[3] = (JCOEF)pred;
  767|  4.98M|          }
  768|       |          /* AC12 */
  769|  4.98M|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (769:15): [True: 4.98M, False: 0]
  |  Branch (769:43): [True: 4.98M, False: 0]
  ------------------
  770|  4.98M|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  771|  4.98M|            if (num >= 0) {
  ------------------
  |  Branch (771:17): [True: 2.75M, False: 2.23M]
  ------------------
  772|  2.75M|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  773|  2.75M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (773:19): [True: 0, False: 2.75M]
  |  Branch (773:29): [True: 0, False: 0]
  ------------------
  774|      0|                pred = (1 << Al) - 1;
  775|  2.75M|            } else {
  776|  2.23M|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  777|  2.23M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (777:19): [True: 0, False: 2.23M]
  |  Branch (777:29): [True: 0, False: 0]
  ------------------
  778|      0|                pred = (1 << Al) - 1;
  779|  2.23M|              pred = -pred;
  780|  2.23M|            }
  781|  4.98M|            workspace[10] = (JCOEF)pred;
  782|  4.98M|          }
  783|       |          /* AC21 */
  784|  4.98M|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (784:15): [True: 4.98M, False: 0]
  |  Branch (784:43): [True: 4.98M, False: 0]
  ------------------
  785|  4.98M|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  786|  4.98M|            if (num >= 0) {
  ------------------
  |  Branch (786:17): [True: 3.76M, False: 1.22M]
  ------------------
  787|  3.76M|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  788|  3.76M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (788:19): [True: 0, False: 3.76M]
  |  Branch (788:29): [True: 0, False: 0]
  ------------------
  789|      0|                pred = (1 << Al) - 1;
  790|  3.76M|            } else {
  791|  1.22M|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  792|  1.22M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (792:19): [True: 0, False: 1.22M]
  |  Branch (792:29): [True: 0, False: 0]
  ------------------
  793|      0|                pred = (1 << Al) - 1;
  794|  1.22M|              pred = -pred;
  795|  1.22M|            }
  796|  4.98M|            workspace[17] = (JCOEF)pred;
  797|  4.98M|          }
  798|       |          /* AC30 */
  799|  4.98M|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (799:15): [True: 4.98M, False: 0]
  |  Branch (799:43): [True: 4.98M, False: 0]
  ------------------
  800|  4.98M|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  801|  4.98M|            if (num >= 0) {
  ------------------
  |  Branch (801:17): [True: 2.72M, False: 2.26M]
  ------------------
  802|  2.72M|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  803|  2.72M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (803:19): [True: 0, False: 2.72M]
  |  Branch (803:29): [True: 0, False: 0]
  ------------------
  804|      0|                pred = (1 << Al) - 1;
  805|  2.72M|            } else {
  806|  2.26M|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  807|  2.26M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (807:19): [True: 0, False: 2.26M]
  |  Branch (807:29): [True: 0, False: 0]
  ------------------
  808|      0|                pred = (1 << Al) - 1;
  809|  2.26M|              pred = -pred;
  810|  2.26M|            }
  811|  4.98M|            workspace[24] = (JCOEF)pred;
  812|  4.98M|          }
  813|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  814|       |           * be called.
  815|       |           */
  816|  4.98M|          num = Q00 *
  817|  4.98M|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  818|  4.98M|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  819|  4.98M|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  820|  4.98M|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  821|  4.98M|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  822|  4.98M|          if (num >= 0) {
  ------------------
  |  Branch (822:15): [True: 2.65M, False: 2.33M]
  ------------------
  823|  2.65M|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  824|  2.65M|          } else {
  825|  2.33M|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  826|  2.33M|            pred = -pred;
  827|  2.33M|          }
  828|  4.98M|          workspace[0] = (JCOEF)pred;
  829|  4.98M|        }  /* change_dc */
  830|       |
  831|       |        /* OK, do the IDCT */
  832|       |#ifdef WITH_PROFILE
  833|       |        cinfo->master->start = getTime();
  834|       |#endif
  835|  5.38M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  836|  5.38M|                        output_col);
  837|       |#ifdef WITH_PROFILE
  838|       |        cinfo->master->idct_elapsed += getTime() - cinfo->master->start;
  839|       |        cinfo->master->idct_mcoeffs += (double)DCTSIZE2 / 1000000.;
  840|       |#endif
  841|       |        /* Advance for next column */
  842|  5.38M|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  843|  5.38M|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  844|  5.38M|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  845|  5.38M|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  846|  5.38M|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  847|  5.38M|        buffer_ptr++, prev_block_row++, next_block_row++,
  848|  5.38M|          prev_prev_block_row++, next_next_block_row++;
  849|  5.38M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  5.38M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  850|  5.38M|      }
  851|  32.9k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  32.9k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  852|  32.9k|    }
  853|  32.5k|  }
  854|       |
  855|  28.3k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (855:7): [True: 25.9k, False: 2.42k]
  ------------------
  856|  25.9k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  25.9k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  857|  2.42k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  2.42k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  858|  28.3k|}
jdcoefct-8.c:consume_data:
  218|   257k|{
  219|   257k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|   257k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|   257k|  int blkn, ci, xindex, yindex, yoffset;
  222|   257k|  JDIMENSION start_col;
  223|   257k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|   257k|  JBLOCKROW buffer_ptr;
  225|   257k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|   613k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 356k, False: 257k]
  ------------------
  229|   356k|    compptr = cinfo->cur_comp_info[ci];
  230|   356k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|   356k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|   356k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|   356k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|   356k|#define TRUE    1
  ------------------
  234|       |    /* Note: entropy decoder expects buffer to be zeroed,
  235|       |     * but this is handled automatically by the memory manager
  236|       |     * because we requested a pre-zeroed array.
  237|       |     */
  238|   356k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|   542k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 285k, False: 257k]
  ------------------
  242|   285k|       yoffset++) {
  243|  17.0M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 16.7M, False: 285k]
  ------------------
  244|  16.7M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|  16.7M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|  33.7M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 16.9M, False: 16.7M]
  ------------------
  248|  16.9M|        compptr = cinfo->cur_comp_info[ci];
  249|  16.9M|        start_col = MCU_col_num * compptr->MCU_width;
  250|  33.9M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 16.9M, False: 16.9M]
  ------------------
  251|  16.9M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|  34.0M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 17.0M, False: 16.9M]
  ------------------
  253|  17.0M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|  17.0M|          }
  255|  16.9M|        }
  256|  16.9M|      }
  257|  16.7M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 15.1M, False: 1.53M]
  ------------------
  258|  15.1M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  259|       |      /* Try to fetch the MCU. */
  260|       |#ifdef WITH_PROFILE
  261|       |      cinfo->master->start = getTime();
  262|       |#endif
  263|  16.7M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 16.7M]
  ------------------
  264|       |        /* Suspension forced; update state counters and exit */
  265|      0|        coef->MCU_vert_offset = yoffset;
  266|      0|        coef->MCU_ctr = MCU_col_num;
  267|       |#ifdef WITH_PROFILE
  268|       |        cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  269|       |        cinfo->master->entropy_mcoeffs +=
  270|       |          (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  271|       |#endif
  272|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  273|      0|      }
  274|       |#ifdef WITH_PROFILE
  275|       |      cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  276|       |      cinfo->master->entropy_mcoeffs +=
  277|       |        (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  278|       |#endif
  279|  16.7M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|   285k|    coef->MCU_ctr = 0;
  282|   285k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|   257k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 230k, False: 27.1k]
  ------------------
  285|   230k|    start_iMCU_row(cinfo);
  286|   230k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   230k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|   230k|  }
  288|       |  /* Completed the scan */
  289|  27.1k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|  27.1k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  27.1k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|   257k|}
jdcoefct-8.c:decompress_data:
  304|   107k|{
  305|   107k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  306|   107k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  307|   107k|  JDIMENSION block_num;
  308|   107k|  int ci, block_row, block_rows;
  309|   107k|  JBLOCKARRAY buffer;
  310|   107k|  JBLOCKROW buffer_ptr;
  311|   107k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|   107k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  312|   107k|  JDIMENSION output_col;
  313|   107k|  jpeg_component_info *compptr;
  314|   107k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|   107k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  315|       |
  316|       |  /* Force some input to be done if we are getting ahead of the input. */
  317|   107k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (317:10): [True: 0, False: 107k]
  ------------------
  318|   107k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (318:11): [True: 107k, False: 0]
  ------------------
  319|   107k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (319:11): [True: 0, False: 107k]
  ------------------
  320|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (320:9): [True: 0, False: 0]
  ------------------
  321|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  322|      0|  }
  323|       |
  324|       |  /* OK, output from the virtual arrays. */
  325|   309k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (325:44): [True: 201k, False: 107k]
  ------------------
  326|   201k|       ci++, compptr++) {
  327|       |    /* Don't bother to IDCT an uninteresting component. */
  328|   201k|    if (!compptr->component_needed)
  ------------------
  |  Branch (328:9): [True: 0, False: 201k]
  ------------------
  329|      0|      continue;
  330|       |    /* Align the virtual buffer for this component. */
  331|   201k|    buffer = (*cinfo->mem->access_virt_barray)
  332|   201k|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  333|   201k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  334|   201k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|   201k|#define FALSE   0               /* values of boolean */
  ------------------
  335|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  336|   201k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (336:9): [True: 172k, False: 29.3k]
  ------------------
  337|   172k|      block_rows = compptr->v_samp_factor;
  338|  29.3k|    else {
  339|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  340|  29.3k|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  341|  29.3k|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (341:11): [True: 25.6k, False: 3.71k]
  ------------------
  342|  29.3k|    }
  343|   201k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|   201k|#define _inverse_DCT  inverse_DCT
  ------------------
  344|   201k|    output_ptr = output_buf[ci];
  345|       |    /* Loop over all DCT blocks to be processed. */
  346|   433k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (346:25): [True: 231k, False: 201k]
  ------------------
  347|   231k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  348|   231k|      output_col = 0;
  349|   231k|      for (block_num = cinfo->master->first_MCU_col[ci];
  350|  3.61M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (350:12): [True: 3.37M, False: 231k]
  ------------------
  351|       |#ifdef WITH_PROFILE
  352|       |        cinfo->master->start = getTime();
  353|       |#endif
  354|  3.37M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  355|  3.37M|                        output_col);
  356|       |#ifdef WITH_PROFILE
  357|       |        cinfo->master->idct_elapsed += getTime() - cinfo->master->start;
  358|       |        cinfo->master->idct_mcoeffs += (double)DCTSIZE2 / 1000000.;
  359|       |#endif
  360|  3.37M|        buffer_ptr++;
  361|  3.37M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  3.37M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  362|  3.37M|      }
  363|   231k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   231k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  364|   231k|    }
  365|   201k|  }
  366|       |
  367|   107k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (367:7): [True: 95.2k, False: 12.7k]
  ------------------
  368|  95.2k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  95.2k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  369|  12.7k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  12.7k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  370|   107k|}
jdcoefct-8.c:decompress_onepass:
   90|  2.12M|{
   91|  2.12M|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   92|  2.12M|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   93|  2.12M|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   94|  2.12M|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   95|  2.12M|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   96|  2.12M|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  2.12M|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
   97|  2.12M|  JDIMENSION start_col, output_col;
   98|  2.12M|  jpeg_component_info *compptr;
   99|  2.12M|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  2.12M|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  100|       |
  101|       |  /* Loop to process as much as one whole iMCU row */
  102|  4.24M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (102:41): [True: 2.12M, False: 2.12M]
  ------------------
  103|  2.12M|       yoffset++) {
  104|   114M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (104:39): [True: 112M, False: 2.12M]
  ------------------
  105|   112M|         MCU_col_num++) {
  106|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  107|   112M|      jzero_far((void *)coef->MCU_buffer[0],
  108|   112M|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  109|   112M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (109:11): [True: 7.89M, False: 104M]
  ------------------
  110|  7.89M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  111|       |#ifdef WITH_PROFILE
  112|       |      cinfo->master->start = getTime();
  113|       |#endif
  114|   112M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (114:11): [True: 0, False: 112M]
  ------------------
  115|       |        /* Suspension forced; update state counters and exit */
  116|      0|        coef->MCU_vert_offset = yoffset;
  117|      0|        coef->MCU_ctr = MCU_col_num;
  118|       |#ifdef WITH_PROFILE
  119|       |        cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  120|       |        cinfo->master->entropy_mcoeffs +=
  121|       |          (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  122|       |#endif
  123|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  124|      0|      }
  125|       |#ifdef WITH_PROFILE
  126|       |      cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  127|       |      cinfo->master->entropy_mcoeffs +=
  128|       |        (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  129|       |#endif
  130|       |
  131|       |      /* Only perform the IDCT on blocks that are contained within the desired
  132|       |       * cropping region.
  133|       |       */
  134|   112M|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (134:11): [True: 112M, False: 5.29k]
  ------------------
  135|   112M|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (135:11): [True: 112M, False: 0]
  ------------------
  136|       |        /* Determine where data should go in output_buf and do the IDCT thing.
  137|       |         * We skip dummy blocks at the right and bottom edges (but blkn gets
  138|       |         * incremented past them!).  Note the inner loop relies on having
  139|       |         * allocated the MCU_buffer[] blocks sequentially.
  140|       |         */
  141|   112M|        blkn = 0;               /* index of current DCT block within MCU */
  142|   229M|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (142:22): [True: 116M, False: 112M]
  ------------------
  143|   116M|          compptr = cinfo->cur_comp_info[ci];
  144|       |          /* Don't bother to IDCT an uninteresting component. */
  145|   116M|          if (!compptr->component_needed) {
  ------------------
  |  Branch (145:15): [True: 0, False: 116M]
  ------------------
  146|      0|            blkn += compptr->MCU_blocks;
  147|      0|            continue;
  148|      0|          }
  149|   116M|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  263|   116M|#define _inverse_DCT  inverse_DCT
  ------------------
  150|   116M|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (150:26): [True: 112M, False: 4.07M]
  ------------------
  151|   112M|                         compptr->MCU_width : compptr->last_col_width;
  152|   116M|          output_ptr = output_buf[compptr->component_index] +
  153|   116M|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   116M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|   116M|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  155|   116M|                      compptr->MCU_sample_width;
  156|   233M|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (156:28): [True: 117M, False: 116M]
  ------------------
  157|   117M|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (157:17): [True: 113M, False: 3.32M]
  ------------------
  158|   116M|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (158:17): [True: 3.31M, False: 6.44k]
  ------------------
  159|   116M|              output_col = start_col;
  160|   234M|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (160:32): [True: 117M, False: 116M]
  ------------------
  161|       |#ifdef WITH_PROFILE
  162|       |                cinfo->master->start = getTime();
  163|       |#endif
  164|   117M|                (*inverse_DCT) (cinfo, compptr,
  165|   117M|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  166|   117M|                                output_ptr, output_col);
  167|       |#ifdef WITH_PROFILE
  168|       |                cinfo->master->idct_elapsed +=
  169|       |                  getTime() - cinfo->master->start;
  170|       |                cinfo->master->idct_mcoeffs += (double)DCTSIZE2 / 1000000.;
  171|       |#endif
  172|   117M|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   117M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  173|   117M|              }
  174|   116M|            }
  175|   117M|            blkn += compptr->MCU_width;
  176|   117M|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   117M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  177|   117M|          }
  178|   116M|        }
  179|   112M|      }
  180|   112M|    }
  181|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  182|  2.12M|    coef->MCU_ctr = 0;
  183|  2.12M|  }
  184|       |  /* Completed the iMCU row, advance counters for next one */
  185|  2.12M|  cinfo->output_iMCU_row++;
  186|  2.12M|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (186:7): [True: 2.07M, False: 49.5k]
  ------------------
  187|  2.07M|    start_iMCU_row(cinfo);
  188|  2.07M|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  2.07M|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  189|  2.07M|  }
  190|       |  /* Completed the scan */
  191|  49.5k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  192|  49.5k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  49.5k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  193|  2.12M|}
j12init_d_coef_controller:
  869|    486|{
  870|    486|  my_coef_ptr coef;
  871|       |
  872|    486|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    486|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (872:7): [True: 0, False: 486]
  ------------------
  873|      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)))
  ------------------
  874|       |
  875|    486|  coef = (my_coef_ptr)
  876|    486|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    486|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|    486|                                sizeof(my_coef_controller));
  878|    486|  memset(coef, 0, sizeof(my_coef_controller));
  879|    486|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|    486|  coef->pub.start_input_pass = start_input_pass;
  881|    486|  coef->pub.start_output_pass = start_output_pass;
  882|    486|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|    486|  coef->coef_bits_latch = NULL;
  884|    486|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|    486|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 444, False: 42]
  ------------------
  888|    444|#ifdef D_MULTISCAN_FILES_SUPPORTED
  889|       |    /* Allocate a full-image virtual array for each component, */
  890|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  891|       |    /* Note we ask for a pre-zeroed array. */
  892|    444|    int ci, access_rows;
  893|    444|    jpeg_component_info *compptr;
  894|       |
  895|    888|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 444, False: 444]
  ------------------
  896|    444|         ci++, compptr++) {
  897|    444|      access_rows = compptr->v_samp_factor;
  898|    444|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|    444|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 444, False: 0]
  ------------------
  901|    444|        access_rows *= 5;
  902|    444|#endif
  903|    444|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|    444|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|    444|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|    444|#define TRUE    1
  ------------------
  905|    444|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|    444|                               (long)compptr->h_samp_factor),
  907|    444|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|    444|                               (long)compptr->v_samp_factor),
  909|    444|         (JDIMENSION)access_rows);
  910|    444|    }
  911|    444|    coef->pub.consume_data = consume_data;
  912|    444|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|    444|#define _decompress_data  decompress_data_12
  ------------------
  913|    444|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|    444|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|     42|    JBLOCKROW buffer;
  920|     42|    int i;
  921|       |
  922|     42|    buffer = (JBLOCKROW)
  923|     42|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     42|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|     42|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|     42|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|    462|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|    462|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 420, False: 42]
  ------------------
  926|    420|      coef->MCU_buffer[i] = buffer + i;
  927|    420|    }
  928|     42|    coef->pub.consume_data = dummy_consume_data;
  929|     42|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  142|     42|#define _decompress_data  decompress_data_12
  ------------------
  930|     42|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|     42|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|    486|  coef->workspace = (JCOEF *)
  935|    486|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    486|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|    486|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|    486|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|    486|}
jdcoefct-12.c:start_input_pass:
   50|    907|{
   51|    907|  cinfo->input_iMCU_row = 0;
   52|    907|  start_iMCU_row(cinfo);
   53|    907|}
jdcoefct-12.c:start_output_pass:
   62|    479|{
   63|    479|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|    479|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   65|       |
   66|       |  /* If multipass, check to see whether to use block smoothing on this pass */
   67|    479|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 437, False: 42]
  ------------------
   68|    437|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 437, False: 0]
  |  Branch (68:38): [True: 298, False: 139]
  ------------------
   69|    298|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  142|    298|#define _decompress_data  decompress_data_12
  ------------------
   70|    139|    else
   71|    139|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|    139|#define _decompress_data  decompress_data_12
  ------------------
   72|    437|  }
   73|    479|#endif
   74|    479|  cinfo->output_iMCU_row = 0;
   75|    479|}
jdcoefct-12.c:smoothing_ok:
  405|    437|{
  406|    437|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|    437|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|    437|#define FALSE   0               /* values of boolean */
  ------------------
  408|    437|  int ci, coefi;
  409|    437|  jpeg_component_info *compptr;
  410|    437|  JQUANT_TBL *qtable;
  411|    437|  int *coef_bits, *prev_coef_bits;
  412|    437|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|    437|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 0, False: 437]
  |  Branch (414:35): [True: 0, False: 437]
  ------------------
  415|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|    437|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 437, False: 0]
  ------------------
  419|    437|    coef->coef_bits_latch = (int *)
  420|    437|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    437|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|    437|                                  cinfo->num_components * 2 *
  422|    437|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|    437|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|    437|  coef_bits_latch = coef->coef_bits_latch;
  424|    437|  prev_coef_bits_latch =
  425|    437|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|    437|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|    741|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 437, False: 304]
  ------------------
  428|    437|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|    437|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 0, False: 437]
  ------------------
  431|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  432|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  433|    437|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 6, False: 431]
  ------------------
  434|    431|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|    431|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 7, False: 424]
  ------------------
  435|    424|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|    424|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 7, False: 417]
  ------------------
  436|    417|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|    417|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 7, False: 410]
  ------------------
  437|    410|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|    410|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 10, False: 400]
  ------------------
  438|    400|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|    400|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 16, False: 384]
  ------------------
  439|    384|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|    384|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 11, False: 373]
  ------------------
  440|    373|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|    373|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 7, False: 366]
  ------------------
  441|    366|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|    366|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 7, False: 359]
  ------------------
  442|    359|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|    359|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 9, False: 350]
  ------------------
  443|     87|      return FALSE;
  ------------------
  |  |  207|     87|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|    350|    coef_bits = cinfo->coef_bits[ci];
  446|    350|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|    350|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 46, False: 304]
  ------------------
  448|     46|      return FALSE;
  ------------------
  |  |  207|     46|#define FALSE   0               /* values of boolean */
  ------------------
  449|    304|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|  3.04k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  3.04k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 2.73k, False: 304]
  ------------------
  452|  2.73k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 1.59k, False: 1.14k]
  ------------------
  453|  1.59k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|  1.14k|      else
  455|  1.14k|        prev_coef_bits_latch[coefi] = -1;
  456|  2.73k|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|  2.73k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 2.46k, False: 272]
  ------------------
  458|  2.46k|        smoothing_useful = TRUE;
  ------------------
  |  |  210|  2.46k|#define TRUE    1
  ------------------
  459|  2.73k|    }
  460|    304|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    304|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|    304|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    304|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|    304|  }
  463|       |
  464|    304|  return smoothing_useful;
  465|    437|}
jdcoefct-12.c:decompress_smooth_data:
  474|   144k|{
  475|   144k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  476|   144k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  477|   144k|  JDIMENSION block_num, last_block_column;
  478|   144k|  int ci, block_row, block_rows, access_rows, image_block_row,
  479|   144k|    image_block_rows;
  480|   144k|  JBLOCKARRAY buffer;
  481|   144k|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  482|   144k|  JBLOCKROW next_block_row, next_next_block_row;
  483|   144k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  114|   144k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  484|   144k|  JDIMENSION output_col;
  485|   144k|  jpeg_component_info *compptr;
  486|   144k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  146|   144k|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
  487|   144k|  boolean change_dc;
  488|   144k|  JCOEF *workspace;
  489|   144k|  int *coef_bits;
  490|   144k|  JQUANT_TBL *quanttbl;
  491|   144k|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  492|   144k|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  493|   144k|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  494|   144k|      DC25;
  495|   144k|  int Al, pred;
  496|       |
  497|       |  /* Keep a local variable to avoid looking it up more than once */
  498|   144k|  workspace = coef->workspace;
  499|       |
  500|       |  /* Force some input to be done if we are getting ahead of the input. */
  501|   144k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (501:10): [True: 144k, False: 0]
  ------------------
  502|   144k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (502:10): [True: 0, False: 144k]
  ------------------
  503|      0|    if (cinfo->input_scan_number == cinfo->output_scan_number) {
  ------------------
  |  Branch (503:9): [True: 0, False: 0]
  ------------------
  504|       |      /* If input is working on current scan, we ordinarily want it to
  505|       |       * have completed the current row.  But if input scan is DC,
  506|       |       * we want it to keep two rows ahead so that next two block rows' DC
  507|       |       * values are up to date.
  508|       |       */
  509|      0|      JDIMENSION delta = (cinfo->Ss == 0) ? 2 : 0;
  ------------------
  |  Branch (509:26): [True: 0, False: 0]
  ------------------
  510|      0|      if (cinfo->input_iMCU_row > cinfo->output_iMCU_row + delta)
  ------------------
  |  Branch (510:11): [True: 0, False: 0]
  ------------------
  511|      0|        break;
  512|      0|    }
  513|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (513:9): [True: 0, False: 0]
  ------------------
  514|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  515|      0|  }
  516|       |
  517|       |  /* OK, output from the virtual arrays. */
  518|   289k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (518:44): [True: 144k, False: 144k]
  ------------------
  519|   144k|       ci++, compptr++) {
  520|       |    /* Don't bother to IDCT an uninteresting component. */
  521|   144k|    if (!compptr->component_needed)
  ------------------
  |  Branch (521:9): [True: 0, False: 144k]
  ------------------
  522|      0|      continue;
  523|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  524|   144k|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (524:9): [True: 144k, False: 111]
  ------------------
  525|   144k|      block_rows = compptr->v_samp_factor;
  526|   144k|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  527|   144k|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (527:16): [True: 50, False: 61]
  ------------------
  528|     50|      block_rows = compptr->v_samp_factor;
  529|     50|      access_rows = block_rows * 2; /* this and next iMCU row */
  530|     61|    } else {
  531|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  532|     61|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  533|     61|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (533:11): [True: 61, False: 0]
  ------------------
  534|     61|      access_rows = block_rows; /* this iMCU row only */
  535|     61|    }
  536|       |    /* Align the virtual buffer for this component. */
  537|   144k|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (537:9): [True: 144k, False: 554]
  ------------------
  538|   144k|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  539|   144k|      buffer = (*cinfo->mem->access_virt_barray)
  540|   144k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  541|   144k|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  542|   144k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|   144k|#define FALSE   0               /* values of boolean */
  ------------------
  543|   144k|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  544|   144k|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (544:16): [True: 256, False: 298]
  ------------------
  545|    256|      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
  546|    256|      buffer = (*cinfo->mem->access_virt_barray)
  547|    256|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  548|    256|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  549|    256|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    256|#define FALSE   0               /* values of boolean */
  ------------------
  550|    256|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  551|    298|    } else {
  552|    298|      buffer = (*cinfo->mem->access_virt_barray)
  553|    298|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  554|    298|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    298|#define FALSE   0               /* values of boolean */
  ------------------
  555|    298|    }
  556|       |    /* Fetch component-dependent info.
  557|       |     * If the current scan is incomplete, then we use the component-dependent
  558|       |     * info from the previous scan.
  559|       |     */
  560|   144k|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (560:9): [True: 2.64k, False: 142k]
  ------------------
  561|  2.64k|      coef_bits =
  562|  2.64k|        coef->coef_bits_latch + ((ci + cinfo->num_components) * SAVED_COEFS);
  ------------------
  |  |   58|  2.64k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  563|   142k|    else
  564|   142k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   58|   142k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  565|       |
  566|       |    /* We only do DC interpolation if no AC coefficient data is available. */
  567|   144k|    change_dc =
  568|   144k|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (568:7): [True: 79.6k, False: 65.2k]
  |  Branch (568:29): [True: 78.0k, False: 1.60k]
  |  Branch (568:51): [True: 74.5k, False: 3.51k]
  ------------------
  569|  74.5k|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (569:7): [True: 71.9k, False: 2.57k]
  |  Branch (569:29): [True: 68.5k, False: 3.36k]
  |  Branch (569:51): [True: 66.4k, False: 2.11k]
  ------------------
  570|  66.4k|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (570:7): [True: 64.8k, False: 1.59k]
  |  Branch (570:29): [True: 64.1k, False: 744]
  |  Branch (570:51): [True: 62.9k, False: 1.14k]
  ------------------
  571|       |
  572|   144k|    quanttbl = compptr->quant_table;
  573|   144k|    Q00 = quanttbl->quantval[0];
  574|   144k|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  385|   144k|#define Q01_POS  1
  ------------------
  575|   144k|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  386|   144k|#define Q10_POS  8
  ------------------
  576|   144k|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  387|   144k|#define Q20_POS  16
  ------------------
  577|   144k|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  388|   144k|#define Q11_POS  9
  ------------------
  578|   144k|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  389|   144k|#define Q02_POS  2
  ------------------
  579|   144k|    if (change_dc) {
  ------------------
  |  Branch (579:9): [True: 62.9k, False: 81.9k]
  ------------------
  580|  62.9k|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  390|  62.9k|#define Q03_POS  3
  ------------------
  581|  62.9k|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  391|  62.9k|#define Q12_POS  10
  ------------------
  582|  62.9k|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  392|  62.9k|#define Q21_POS  17
  ------------------
  583|  62.9k|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  393|  62.9k|#define Q30_POS  24
  ------------------
  584|  62.9k|    }
  585|   144k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  147|   144k|#define _inverse_DCT  inverse_DCT_12
  ------------------
  586|   144k|    output_ptr = output_buf[ci];
  587|       |    /* Loop over all DCT blocks to be processed. */
  588|   144k|    image_block_rows = block_rows * cinfo->total_iMCU_rows;
  589|   289k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (589:25): [True: 144k, False: 144k]
  ------------------
  590|   144k|      image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
  591|   144k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  592|       |
  593|   144k|      if (image_block_row > 0)
  ------------------
  |  Branch (593:11): [True: 144k, False: 298]
  ------------------
  594|   144k|        prev_block_row =
  595|   144k|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  596|    298|      else
  597|    298|        prev_block_row = buffer_ptr;
  598|       |
  599|   144k|      if (image_block_row > 1)
  ------------------
  |  Branch (599:11): [True: 144k, False: 554]
  ------------------
  600|   144k|        prev_prev_block_row =
  601|   144k|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  602|    554|      else
  603|    554|        prev_prev_block_row = prev_block_row;
  604|       |
  605|   144k|      if (image_block_row < image_block_rows - 1)
  ------------------
  |  Branch (605:11): [True: 144k, False: 61]
  ------------------
  606|   144k|        next_block_row =
  607|   144k|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  608|     61|      else
  609|     61|        next_block_row = buffer_ptr;
  610|       |
  611|   144k|      if (image_block_row < image_block_rows - 2)
  ------------------
  |  Branch (611:11): [True: 144k, False: 111]
  ------------------
  612|   144k|        next_next_block_row =
  613|   144k|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  614|    111|      else
  615|    111|        next_next_block_row = next_block_row;
  616|       |
  617|       |      /* We fetch the surrounding DC values using a sliding-register approach.
  618|       |       * Initialize all 25 here so as to do the right thing on narrow pics.
  619|       |       */
  620|   144k|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  621|   144k|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  622|   144k|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  623|   144k|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  624|   144k|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  625|   144k|      output_col = 0;
  626|   144k|      last_block_column = compptr->width_in_blocks - 1;
  627|   144k|      for (block_num = cinfo->master->first_MCU_col[ci];
  628|  3.25M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (628:12): [True: 3.10M, False: 144k]
  ------------------
  629|       |        /* Fetch current DCT block into workspace so we can modify it. */
  630|  3.10M|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  631|       |        /* Update DC values */
  632|  3.10M|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (632:13): [True: 144k, False: 2.96M]
  ------------------
  633|   144k|            block_num < last_block_column) {
  ------------------
  |  Branch (633:13): [True: 144k, False: 114]
  ------------------
  634|   144k|          DC04 = DC05 = (int)prev_prev_block_row[1][0];
  635|   144k|          DC09 = DC10 = (int)prev_block_row[1][0];
  636|   144k|          DC14 = DC15 = (int)buffer_ptr[1][0];
  637|   144k|          DC19 = DC20 = (int)next_block_row[1][0];
  638|   144k|          DC24 = DC25 = (int)next_next_block_row[1][0];
  639|   144k|        }
  640|  3.10M|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (640:13): [True: 2.81M, False: 289k]
  ------------------
  641|  2.81M|          DC05 = (int)prev_prev_block_row[2][0];
  642|  2.81M|          DC10 = (int)prev_block_row[2][0];
  643|  2.81M|          DC15 = (int)buffer_ptr[2][0];
  644|  2.81M|          DC20 = (int)next_block_row[2][0];
  645|  2.81M|          DC25 = (int)next_next_block_row[2][0];
  646|  2.81M|        }
  647|       |        /* If DC interpolation is enabled, compute coefficient estimates using
  648|       |         * a Gaussian-like kernel, keeping the averages of the DC values.
  649|       |         *
  650|       |         * If DC interpolation is disabled, compute coefficient estimates using
  651|       |         * an algorithm similar to the one described in Section K.8 of the JPEG
  652|       |         * standard, except applied to a 5x5 window rather than a 3x3 window.
  653|       |         *
  654|       |         * An estimate is applied only if the coefficient is still zero and is
  655|       |         * not known to be fully accurate.
  656|       |         */
  657|       |        /* AC01 */
  658|  3.10M|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (658:13): [True: 3.10M, False: 353]
  |  Branch (658:41): [True: 2.88M, False: 216k]
  ------------------
  659|  2.88M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (659:24): [True: 2.53M, False: 355k]
  ------------------
  660|  2.53M|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  661|  2.53M|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  662|  2.53M|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  663|  2.53M|                 DC21 - DC22 + DC24 + DC25) :
  664|  2.88M|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  665|  2.88M|          if (num >= 0) {
  ------------------
  |  Branch (665:15): [True: 2.60M, False: 288k]
  ------------------
  666|  2.60M|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  667|  2.60M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (667:17): [True: 180k, False: 2.42M]
  |  Branch (667:27): [True: 136k, False: 43.5k]
  ------------------
  668|   136k|              pred = (1 << Al) - 1;
  669|  2.60M|          } else {
  670|   288k|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  671|   288k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (671:17): [True: 59.9k, False: 228k]
  |  Branch (671:27): [True: 53.2k, False: 6.68k]
  ------------------
  672|  53.2k|              pred = (1 << Al) - 1;
  673|   288k|            pred = -pred;
  674|   288k|          }
  675|  2.88M|          workspace[1] = (JCOEF)pred;
  676|  2.88M|        }
  677|       |        /* AC10 */
  678|  3.10M|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (678:13): [True: 3.10M, False: 430]
  |  Branch (678:41): [True: 2.99M, False: 114k]
  ------------------
  679|  2.99M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (679:24): [True: 2.53M, False: 457k]
  ------------------
  680|  2.53M|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  681|  2.53M|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  682|  2.53M|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  683|  2.53M|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  684|  2.99M|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  685|  2.99M|          if (num >= 0) {
  ------------------
  |  Branch (685:15): [True: 2.66M, False: 322k]
  ------------------
  686|  2.66M|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  687|  2.66M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (687:17): [True: 263k, False: 2.40M]
  |  Branch (687:27): [True: 180k, False: 82.5k]
  ------------------
  688|   180k|              pred = (1 << Al) - 1;
  689|  2.66M|          } else {
  690|   322k|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  691|   322k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (691:17): [True: 89.4k, False: 233k]
  |  Branch (691:27): [True: 54.1k, False: 35.2k]
  ------------------
  692|  54.1k|              pred = (1 << Al) - 1;
  693|   322k|            pred = -pred;
  694|   322k|          }
  695|  2.99M|          workspace[8] = (JCOEF)pred;
  696|  2.99M|        }
  697|       |        /* AC20 */
  698|  3.10M|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (698:13): [True: 3.08M, False: 24.4k]
  |  Branch (698:41): [True: 2.97M, False: 105k]
  ------------------
  699|  2.97M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (699:24): [True: 2.53M, False: 442k]
  ------------------
  700|  2.53M|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  701|  2.53M|                 5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
  702|  2.97M|                (-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
  703|  2.97M|          if (num >= 0) {
  ------------------
  |  Branch (703:15): [True: 2.60M, False: 367k]
  ------------------
  704|  2.60M|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  705|  2.60M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (705:17): [True: 209k, False: 2.39M]
  |  Branch (705:27): [True: 54.2k, False: 155k]
  ------------------
  706|  54.2k|              pred = (1 << Al) - 1;
  707|  2.60M|          } else {
  708|   367k|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  709|   367k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (709:17): [True: 144k, False: 223k]
  |  Branch (709:27): [True: 54.5k, False: 89.7k]
  ------------------
  710|  54.5k|              pred = (1 << Al) - 1;
  711|   367k|            pred = -pred;
  712|   367k|          }
  713|  2.97M|          workspace[16] = (JCOEF)pred;
  714|  2.97M|        }
  715|       |        /* AC11 */
  716|  3.10M|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (716:13): [True: 3.08M, False: 24.2k]
  |  Branch (716:41): [True: 3.03M, False: 45.4k]
  ------------------
  717|  3.03M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (717:24): [True: 2.53M, False: 502k]
  ------------------
  718|  2.53M|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  719|  2.53M|                 9 * DC19 + DC21 - DC25) :
  720|  3.03M|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  721|   502k|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  722|  3.03M|          if (num >= 0) {
  ------------------
  |  Branch (722:15): [True: 2.70M, False: 329k]
  ------------------
  723|  2.70M|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  724|  2.70M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (724:17): [True: 290k, False: 2.41M]
  |  Branch (724:27): [True: 52.3k, False: 237k]
  ------------------
  725|  52.3k|              pred = (1 << Al) - 1;
  726|  2.70M|          } else {
  727|   329k|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  728|   329k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (728:17): [True: 142k, False: 187k]
  |  Branch (728:27): [True: 53.0k, False: 89.3k]
  ------------------
  729|  53.0k|              pred = (1 << Al) - 1;
  730|   329k|            pred = -pred;
  731|   329k|          }
  732|  3.03M|          workspace[9] = (JCOEF)pred;
  733|  3.03M|        }
  734|       |        /* AC02 */
  735|  3.10M|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (735:13): [True: 3.07M, False: 32.1k]
  |  Branch (735:41): [True: 3.03M, False: 38.7k]
  ------------------
  736|  3.03M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (736:24): [True: 2.53M, False: 501k]
  ------------------
  737|  2.53M|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  738|  2.53M|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  739|  3.03M|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  740|  3.03M|          if (num >= 0) {
  ------------------
  |  Branch (740:15): [True: 2.64M, False: 386k]
  ------------------
  741|  2.64M|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  742|  2.64M|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (742:17): [True: 267k, False: 2.38M]
  |  Branch (742:27): [True: 53.9k, False: 213k]
  ------------------
  743|  53.9k|              pred = (1 << Al) - 1;
  744|  2.64M|          } else {
  745|   386k|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  746|   386k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (746:17): [True: 186k, False: 199k]
  |  Branch (746:27): [True: 55.4k, False: 131k]
  ------------------
  747|  55.4k|              pred = (1 << Al) - 1;
  748|   386k|            pred = -pred;
  749|   386k|          }
  750|  3.03M|          workspace[2] = (JCOEF)pred;
  751|  3.03M|        }
  752|  3.10M|        if (change_dc) {
  ------------------
  |  Branch (752:13): [True: 2.53M, False: 572k]
  ------------------
  753|       |          /* AC03 */
  754|  2.53M|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (754:15): [True: 2.53M, False: 0]
  |  Branch (754:43): [True: 2.53M, False: 23]
  ------------------
  755|  2.53M|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  756|  2.53M|            if (num >= 0) {
  ------------------
  |  Branch (756:17): [True: 2.36M, False: 171k]
  ------------------
  757|  2.36M|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  758|  2.36M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (758:19): [True: 0, False: 2.36M]
  |  Branch (758:29): [True: 0, False: 0]
  ------------------
  759|      0|                pred = (1 << Al) - 1;
  760|  2.36M|            } else {
  761|   171k|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  762|   171k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (762:19): [True: 0, False: 171k]
  |  Branch (762:29): [True: 0, False: 0]
  ------------------
  763|      0|                pred = (1 << Al) - 1;
  764|   171k|              pred = -pred;
  765|   171k|            }
  766|  2.53M|            workspace[3] = (JCOEF)pred;
  767|  2.53M|          }
  768|       |          /* AC12 */
  769|  2.53M|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (769:15): [True: 2.53M, False: 0]
  |  Branch (769:43): [True: 2.53M, False: 22]
  ------------------
  770|  2.53M|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  771|  2.53M|            if (num >= 0) {
  ------------------
  |  Branch (771:17): [True: 2.36M, False: 168k]
  ------------------
  772|  2.36M|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  773|  2.36M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (773:19): [True: 0, False: 2.36M]
  |  Branch (773:29): [True: 0, False: 0]
  ------------------
  774|      0|                pred = (1 << Al) - 1;
  775|  2.36M|            } else {
  776|   168k|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  777|   168k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (777:19): [True: 0, False: 168k]
  |  Branch (777:29): [True: 0, False: 0]
  ------------------
  778|      0|                pred = (1 << Al) - 1;
  779|   168k|              pred = -pred;
  780|   168k|            }
  781|  2.53M|            workspace[10] = (JCOEF)pred;
  782|  2.53M|          }
  783|       |          /* AC21 */
  784|  2.53M|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (784:15): [True: 2.53M, False: 0]
  |  Branch (784:43): [True: 2.53M, False: 22]
  ------------------
  785|  2.53M|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  786|  2.53M|            if (num >= 0) {
  ------------------
  |  Branch (786:17): [True: 2.36M, False: 172k]
  ------------------
  787|  2.36M|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  788|  2.36M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (788:19): [True: 0, False: 2.36M]
  |  Branch (788:29): [True: 0, False: 0]
  ------------------
  789|      0|                pred = (1 << Al) - 1;
  790|  2.36M|            } else {
  791|   172k|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  792|   172k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (792:19): [True: 0, False: 172k]
  |  Branch (792:29): [True: 0, False: 0]
  ------------------
  793|      0|                pred = (1 << Al) - 1;
  794|   172k|              pred = -pred;
  795|   172k|            }
  796|  2.53M|            workspace[17] = (JCOEF)pred;
  797|  2.53M|          }
  798|       |          /* AC30 */
  799|  2.53M|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (799:15): [True: 2.53M, False: 0]
  |  Branch (799:43): [True: 2.53M, False: 22]
  ------------------
  800|  2.53M|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  801|  2.53M|            if (num >= 0) {
  ------------------
  |  Branch (801:17): [True: 2.34M, False: 191k]
  ------------------
  802|  2.34M|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  803|  2.34M|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (803:19): [True: 0, False: 2.34M]
  |  Branch (803:29): [True: 0, False: 0]
  ------------------
  804|      0|                pred = (1 << Al) - 1;
  805|  2.34M|            } else {
  806|   191k|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  807|   191k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (807:19): [True: 0, False: 191k]
  |  Branch (807:29): [True: 0, False: 0]
  ------------------
  808|      0|                pred = (1 << Al) - 1;
  809|   191k|              pred = -pred;
  810|   191k|            }
  811|  2.53M|            workspace[24] = (JCOEF)pred;
  812|  2.53M|          }
  813|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  814|       |           * be called.
  815|       |           */
  816|  2.53M|          num = Q00 *
  817|  2.53M|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  818|  2.53M|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  819|  2.53M|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  820|  2.53M|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  821|  2.53M|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  822|  2.53M|          if (num >= 0) {
  ------------------
  |  Branch (822:15): [True: 2.35M, False: 173k]
  ------------------
  823|  2.35M|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  824|  2.35M|          } else {
  825|   173k|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  826|   173k|            pred = -pred;
  827|   173k|          }
  828|  2.53M|          workspace[0] = (JCOEF)pred;
  829|  2.53M|        }  /* change_dc */
  830|       |
  831|       |        /* OK, do the IDCT */
  832|       |#ifdef WITH_PROFILE
  833|       |        cinfo->master->start = getTime();
  834|       |#endif
  835|  3.10M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  836|  3.10M|                        output_col);
  837|       |#ifdef WITH_PROFILE
  838|       |        cinfo->master->idct_elapsed += getTime() - cinfo->master->start;
  839|       |        cinfo->master->idct_mcoeffs += (double)DCTSIZE2 / 1000000.;
  840|       |#endif
  841|       |        /* Advance for next column */
  842|  3.10M|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  843|  3.10M|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  844|  3.10M|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  845|  3.10M|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  846|  3.10M|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  847|  3.10M|        buffer_ptr++, prev_block_row++, next_block_row++,
  848|  3.10M|          prev_prev_block_row++, next_next_block_row++;
  849|  3.10M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  3.10M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  850|  3.10M|      }
  851|   144k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   144k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  852|   144k|    }
  853|   144k|  }
  854|       |
  855|   144k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (855:7): [True: 144k, False: 61]
  ------------------
  856|   144k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   144k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  857|     61|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|     61|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  858|   144k|}
jdcoefct-12.c:consume_data:
  218|   864k|{
  219|   864k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|   864k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|   864k|  int blkn, ci, xindex, yindex, yoffset;
  222|   864k|  JDIMENSION start_col;
  223|   864k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|   864k|  JBLOCKROW buffer_ptr;
  225|   864k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|  1.72M|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 864k, False: 864k]
  ------------------
  229|   864k|    compptr = cinfo->cur_comp_info[ci];
  230|   864k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|   864k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|   864k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|   864k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|   864k|#define TRUE    1
  ------------------
  234|       |    /* Note: entropy decoder expects buffer to be zeroed,
  235|       |     * but this is handled automatically by the memory manager
  236|       |     * because we requested a pre-zeroed array.
  237|       |     */
  238|   864k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|  1.72M|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 864k, False: 864k]
  ------------------
  242|   864k|       yoffset++) {
  243|  9.00M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 8.13M, False: 864k]
  ------------------
  244|  8.13M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|  8.13M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|  16.2M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 8.13M, False: 8.13M]
  ------------------
  248|  8.13M|        compptr = cinfo->cur_comp_info[ci];
  249|  8.13M|        start_col = MCU_col_num * compptr->MCU_width;
  250|  16.2M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 8.13M, False: 8.13M]
  ------------------
  251|  8.13M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|  16.2M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 8.13M, False: 8.13M]
  ------------------
  253|  8.13M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|  8.13M|          }
  255|  8.13M|        }
  256|  8.13M|      }
  257|  8.13M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 5.99M, False: 2.13M]
  ------------------
  258|  5.99M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  259|       |      /* Try to fetch the MCU. */
  260|       |#ifdef WITH_PROFILE
  261|       |      cinfo->master->start = getTime();
  262|       |#endif
  263|  8.13M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 8.13M]
  ------------------
  264|       |        /* Suspension forced; update state counters and exit */
  265|      0|        coef->MCU_vert_offset = yoffset;
  266|      0|        coef->MCU_ctr = MCU_col_num;
  267|       |#ifdef WITH_PROFILE
  268|       |        cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  269|       |        cinfo->master->entropy_mcoeffs +=
  270|       |          (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  271|       |#endif
  272|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  273|      0|      }
  274|       |#ifdef WITH_PROFILE
  275|       |      cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  276|       |      cinfo->master->entropy_mcoeffs +=
  277|       |        (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  278|       |#endif
  279|  8.13M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|   864k|    coef->MCU_ctr = 0;
  282|   864k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|   864k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 863k, False: 865]
  ------------------
  285|   863k|    start_iMCU_row(cinfo);
  286|   863k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   863k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|   863k|  }
  288|       |  /* Completed the scan */
  289|    865|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|    865|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    865|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|   864k|}
jdcoefct-12.c:decompress_data:
  304|  46.6k|{
  305|  46.6k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  306|  46.6k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  307|  46.6k|  JDIMENSION block_num;
  308|  46.6k|  int ci, block_row, block_rows;
  309|  46.6k|  JBLOCKARRAY buffer;
  310|  46.6k|  JBLOCKROW buffer_ptr;
  311|  46.6k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  114|  46.6k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  312|  46.6k|  JDIMENSION output_col;
  313|  46.6k|  jpeg_component_info *compptr;
  314|  46.6k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  146|  46.6k|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
  315|       |
  316|       |  /* Force some input to be done if we are getting ahead of the input. */
  317|  46.6k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (317:10): [True: 0, False: 46.6k]
  ------------------
  318|  46.6k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (318:11): [True: 46.6k, False: 0]
  ------------------
  319|  46.6k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (319:11): [True: 0, False: 46.6k]
  ------------------
  320|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (320:9): [True: 0, False: 0]
  ------------------
  321|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  322|      0|  }
  323|       |
  324|       |  /* OK, output from the virtual arrays. */
  325|  93.2k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (325:44): [True: 46.6k, False: 46.6k]
  ------------------
  326|  46.6k|       ci++, compptr++) {
  327|       |    /* Don't bother to IDCT an uninteresting component. */
  328|  46.6k|    if (!compptr->component_needed)
  ------------------
  |  Branch (328:9): [True: 0, False: 46.6k]
  ------------------
  329|      0|      continue;
  330|       |    /* Align the virtual buffer for this component. */
  331|  46.6k|    buffer = (*cinfo->mem->access_virt_barray)
  332|  46.6k|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  333|  46.6k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  334|  46.6k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  46.6k|#define FALSE   0               /* values of boolean */
  ------------------
  335|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  336|  46.6k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (336:9): [True: 46.5k, False: 64]
  ------------------
  337|  46.5k|      block_rows = compptr->v_samp_factor;
  338|     64|    else {
  339|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  340|     64|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  341|     64|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (341:11): [True: 64, False: 0]
  ------------------
  342|     64|    }
  343|  46.6k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  147|  46.6k|#define _inverse_DCT  inverse_DCT_12
  ------------------
  344|  46.6k|    output_ptr = output_buf[ci];
  345|       |    /* Loop over all DCT blocks to be processed. */
  346|  93.2k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (346:25): [True: 46.6k, False: 46.6k]
  ------------------
  347|  46.6k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  348|  46.6k|      output_col = 0;
  349|  46.6k|      for (block_num = cinfo->master->first_MCU_col[ci];
  350|   372k|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (350:12): [True: 326k, False: 46.6k]
  ------------------
  351|       |#ifdef WITH_PROFILE
  352|       |        cinfo->master->start = getTime();
  353|       |#endif
  354|   326k|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  355|   326k|                        output_col);
  356|       |#ifdef WITH_PROFILE
  357|       |        cinfo->master->idct_elapsed += getTime() - cinfo->master->start;
  358|       |        cinfo->master->idct_mcoeffs += (double)DCTSIZE2 / 1000000.;
  359|       |#endif
  360|   326k|        buffer_ptr++;
  361|   326k|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   326k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  362|   326k|      }
  363|  46.6k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  46.6k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  364|  46.6k|    }
  365|  46.6k|  }
  366|       |
  367|  46.6k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (367:7): [True: 46.5k, False: 64]
  ------------------
  368|  46.5k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  46.5k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  369|     64|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|     64|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  370|  46.6k|}
jdcoefct-12.c:decompress_onepass:
   90|  13.1k|{
   91|  13.1k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   92|  13.1k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   93|  13.1k|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   94|  13.1k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   95|  13.1k|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   96|  13.1k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  114|  13.1k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
   97|  13.1k|  JDIMENSION start_col, output_col;
   98|  13.1k|  jpeg_component_info *compptr;
   99|  13.1k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  146|  13.1k|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
  100|       |
  101|       |  /* Loop to process as much as one whole iMCU row */
  102|  26.2k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (102:41): [True: 13.1k, False: 13.1k]
  ------------------
  103|  13.1k|       yoffset++) {
  104|   112k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (104:39): [True: 99.8k, False: 13.1k]
  ------------------
  105|  99.8k|         MCU_col_num++) {
  106|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  107|  99.8k|      jzero_far((void *)coef->MCU_buffer[0],
  108|  99.8k|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  109|  99.8k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (109:11): [True: 30.2k, False: 69.6k]
  ------------------
  110|  30.2k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  111|       |#ifdef WITH_PROFILE
  112|       |      cinfo->master->start = getTime();
  113|       |#endif
  114|  99.8k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (114:11): [True: 0, False: 99.8k]
  ------------------
  115|       |        /* Suspension forced; update state counters and exit */
  116|      0|        coef->MCU_vert_offset = yoffset;
  117|      0|        coef->MCU_ctr = MCU_col_num;
  118|       |#ifdef WITH_PROFILE
  119|       |        cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  120|       |        cinfo->master->entropy_mcoeffs +=
  121|       |          (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  122|       |#endif
  123|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  124|      0|      }
  125|       |#ifdef WITH_PROFILE
  126|       |      cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  127|       |      cinfo->master->entropy_mcoeffs +=
  128|       |        (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  129|       |#endif
  130|       |
  131|       |      /* Only perform the IDCT on blocks that are contained within the desired
  132|       |       * cropping region.
  133|       |       */
  134|  99.8k|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (134:11): [True: 99.8k, False: 0]
  ------------------
  135|  99.8k|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (135:11): [True: 99.8k, False: 0]
  ------------------
  136|       |        /* Determine where data should go in output_buf and do the IDCT thing.
  137|       |         * We skip dummy blocks at the right and bottom edges (but blkn gets
  138|       |         * incremented past them!).  Note the inner loop relies on having
  139|       |         * allocated the MCU_buffer[] blocks sequentially.
  140|       |         */
  141|  99.8k|        blkn = 0;               /* index of current DCT block within MCU */
  142|   199k|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (142:22): [True: 99.8k, False: 99.8k]
  ------------------
  143|  99.8k|          compptr = cinfo->cur_comp_info[ci];
  144|       |          /* Don't bother to IDCT an uninteresting component. */
  145|  99.8k|          if (!compptr->component_needed) {
  ------------------
  |  Branch (145:15): [True: 0, False: 99.8k]
  ------------------
  146|      0|            blkn += compptr->MCU_blocks;
  147|      0|            continue;
  148|      0|          }
  149|  99.8k|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  147|  99.8k|#define _inverse_DCT  inverse_DCT_12
  ------------------
  150|  99.8k|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (150:26): [True: 86.7k, False: 13.1k]
  ------------------
  151|  86.7k|                         compptr->MCU_width : compptr->last_col_width;
  152|  99.8k|          output_ptr = output_buf[compptr->component_index] +
  153|  99.8k|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  99.8k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|  99.8k|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  155|  99.8k|                      compptr->MCU_sample_width;
  156|   199k|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (156:28): [True: 99.8k, False: 99.8k]
  ------------------
  157|  99.8k|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (157:17): [True: 91.5k, False: 8.32k]
  ------------------
  158|  99.8k|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (158:17): [True: 8.32k, False: 0]
  ------------------
  159|  99.8k|              output_col = start_col;
  160|   199k|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (160:32): [True: 99.8k, False: 99.8k]
  ------------------
  161|       |#ifdef WITH_PROFILE
  162|       |                cinfo->master->start = getTime();
  163|       |#endif
  164|  99.8k|                (*inverse_DCT) (cinfo, compptr,
  165|  99.8k|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  166|  99.8k|                                output_ptr, output_col);
  167|       |#ifdef WITH_PROFILE
  168|       |                cinfo->master->idct_elapsed +=
  169|       |                  getTime() - cinfo->master->start;
  170|       |                cinfo->master->idct_mcoeffs += (double)DCTSIZE2 / 1000000.;
  171|       |#endif
  172|  99.8k|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  99.8k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  173|  99.8k|              }
  174|  99.8k|            }
  175|  99.8k|            blkn += compptr->MCU_width;
  176|  99.8k|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  99.8k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  177|  99.8k|          }
  178|  99.8k|        }
  179|  99.8k|      }
  180|  99.8k|    }
  181|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  182|  13.1k|    coef->MCU_ctr = 0;
  183|  13.1k|  }
  184|       |  /* Completed the iMCU row, advance counters for next one */
  185|  13.1k|  cinfo->output_iMCU_row++;
  186|  13.1k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (186:7): [True: 13.0k, False: 31]
  ------------------
  187|  13.0k|    start_iMCU_row(cinfo);
  188|  13.0k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  13.0k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  189|  13.0k|  }
  190|       |  /* Completed the scan */
  191|     31|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  192|     31|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|     31|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  193|  13.1k|}

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

jinit_color_deconverter:
  625|  72.9k|{
  626|  72.9k|  my_cconvert_ptr cconvert;
  627|  72.9k|  int ci;
  628|       |
  629|  72.9k|#ifdef D_LOSSLESS_SUPPORTED
  630|  72.9k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 3.44k, False: 69.5k]
  ------------------
  631|  3.44k|#if BITS_IN_JSAMPLE == 8
  632|  3.44k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  6.88k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (632:9): [True: 0, False: 3.44k]
  |  Branch (632:52): [True: 0, False: 3.44k]
  ------------------
  633|       |#else
  634|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  635|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  636|       |#endif
  637|      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)))
  ------------------
  638|  3.44k|  } else
  639|  69.5k|#endif
  640|  69.5k|  {
  641|  69.5k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  69.5k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (641:9): [True: 0, False: 69.5k]
  ------------------
  642|      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)))
  ------------------
  643|  69.5k|  }
  644|       |
  645|  72.9k|  cconvert = (my_cconvert_ptr)
  646|  72.9k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  72.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|  72.9k|                                sizeof(my_color_deconverter));
  648|  72.9k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|  72.9k|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|  72.9k|  switch (cinfo->jpeg_color_space) {
  653|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 0, False: 72.9k]
  ------------------
  654|      0|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 0]
  ------------------
  655|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  656|      0|    break;
  657|       |
  658|      1|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 1, False: 72.9k]
  ------------------
  659|  12.7k|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 12.7k, False: 60.2k]
  ------------------
  660|  12.7k|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 12.7k]
  ------------------
  661|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  662|  12.7k|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 72.9k]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 72.9k]
  ------------------
  666|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 0]
  ------------------
  667|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  668|      0|    break;
  669|       |
  670|  60.2k|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 60.2k, False: 12.7k]
  ------------------
  671|  60.2k|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (671:9): [True: 0, False: 60.2k]
  ------------------
  672|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  673|  60.2k|    break;
  674|  72.9k|  }
  675|       |
  676|       |  /* Set out_color_components and conversion method based on requested space.
  677|       |   * Also clear the component_needed flags for any unused components,
  678|       |   * so that earlier pipeline stages can avoid useless computation.
  679|       |   * NOTE: We do not allow any lossy color conversion algorithms in lossless
  680|       |   * mode.
  681|       |   */
  682|       |
  683|  72.9k|  switch (cinfo->out_color_space) {
  684|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 0, False: 72.9k]
  ------------------
  685|      0|#ifdef D_LOSSLESS_SUPPORTED
  686|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 0, False: 0]
  ------------------
  687|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 0]
  ------------------
  688|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  689|      0|#endif
  690|      0|    cinfo->out_color_components = 1;
  691|      0|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 0, False: 0]
  ------------------
  692|      0|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|      0|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|      0|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 0]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (697:16): [True: 0, False: 0]
  ------------------
  698|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  699|      0|      build_rgb_y_table(cinfo);
  700|      0|    } else
  701|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  702|      0|    break;
  703|       |
  704|  12.7k|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 12.7k, False: 60.2k]
  ------------------
  705|  12.7k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 72.9k]
  ------------------
  706|  12.7k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 72.9k]
  ------------------
  707|  12.7k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 72.9k]
  ------------------
  708|  12.7k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 72.9k]
  ------------------
  709|  12.7k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 72.9k]
  ------------------
  710|  12.7k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 72.9k]
  ------------------
  711|  12.7k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 72.9k]
  ------------------
  712|  12.7k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 72.9k]
  ------------------
  713|  12.7k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 72.9k]
  ------------------
  714|  12.7k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 72.9k]
  ------------------
  715|  12.7k|#ifdef D_LOSSLESS_SUPPORTED
  716|  12.7k|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 11, False: 12.7k]
  |  Branch (716:36): [True: 10, False: 1]
  ------------------
  717|     10|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     10|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|  12.7k|#endif
  719|  12.7k|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|  12.7k|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 12.7k, False: 11]
  ------------------
  721|  12.7k|#ifdef WITH_SIMD
  722|  12.7k|      if (jsimd_set_ycc_rgb(cinfo))
  ------------------
  |  Branch (722:11): [True: 12.7k, False: 0]
  ------------------
  723|  12.7k|        cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|  12.7k|#define _color_convert  color_convert
  ------------------
  724|      0|      else
  725|      0|#endif
  726|      0|      {
  727|      0|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 0]
  ------------------
  729|      0|          cconvert->pub._color_convert = ycc_extrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  730|      0|          break;
  731|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (731:9): [True: 0, False: 0]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 0]
  ------------------
  733|      0|          cconvert->pub._color_convert = ycc_extrgbx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  734|      0|          break;
  735|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (735:9): [True: 0, False: 0]
  ------------------
  736|      0|          cconvert->pub._color_convert = ycc_extbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  737|      0|          break;
  738|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (738:9): [True: 0, False: 0]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 0]
  ------------------
  740|      0|          cconvert->pub._color_convert = ycc_extbgrx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  741|      0|          break;
  742|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (742:9): [True: 0, False: 0]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 0]
  ------------------
  744|      0|          cconvert->pub._color_convert = ycc_extxbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  745|      0|          break;
  746|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (746:9): [True: 0, False: 0]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 0]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  749|      0|          break;
  750|      0|        default:
  ------------------
  |  Branch (750:9): [True: 0, False: 0]
  ------------------
  751|      0|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  752|      0|        }
  753|      0|        build_ycc_rgb_table(cinfo);
  754|      0|      }
  755|  12.7k|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 11]
  ------------------
  756|      0|      switch (cinfo->out_color_space) {
  757|      0|      case JCS_EXT_RGB:
  ------------------
  |  Branch (757:7): [True: 0, False: 0]
  ------------------
  758|      0|        cconvert->pub._color_convert = gray_extrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  759|      0|        break;
  760|      0|      case JCS_EXT_RGBX:
  ------------------
  |  Branch (760:7): [True: 0, False: 0]
  ------------------
  761|      0|      case JCS_EXT_RGBA:
  ------------------
  |  Branch (761:7): [True: 0, False: 0]
  ------------------
  762|      0|        cconvert->pub._color_convert = gray_extrgbx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  763|      0|        break;
  764|      0|      case JCS_EXT_BGR:
  ------------------
  |  Branch (764:7): [True: 0, False: 0]
  ------------------
  765|      0|        cconvert->pub._color_convert = gray_extbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  766|      0|        break;
  767|      0|      case JCS_EXT_BGRX:
  ------------------
  |  Branch (767:7): [True: 0, False: 0]
  ------------------
  768|      0|      case JCS_EXT_BGRA:
  ------------------
  |  Branch (768:7): [True: 0, False: 0]
  ------------------
  769|      0|        cconvert->pub._color_convert = gray_extbgrx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  770|      0|        break;
  771|      0|      case JCS_EXT_XBGR:
  ------------------
  |  Branch (771:7): [True: 0, False: 0]
  ------------------
  772|      0|      case JCS_EXT_ABGR:
  ------------------
  |  Branch (772:7): [True: 0, False: 0]
  ------------------
  773|      0|        cconvert->pub._color_convert = gray_extxbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  774|      0|        break;
  775|      0|      case JCS_EXT_XRGB:
  ------------------
  |  Branch (775:7): [True: 0, False: 0]
  ------------------
  776|      0|      case JCS_EXT_ARGB:
  ------------------
  |  Branch (776:7): [True: 0, False: 0]
  ------------------
  777|      0|        cconvert->pub._color_convert = gray_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  778|      0|        break;
  779|      0|      default:
  ------------------
  |  Branch (779:7): [True: 0, False: 0]
  ------------------
  780|      0|        cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  781|      0|      }
  782|     11|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 1, False: 10]
  ------------------
  783|      1|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 1, False: 0]
  ------------------
  784|      1|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 1, False: 0]
  ------------------
  785|      1|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 1, False: 0]
  ------------------
  786|      1|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 1, False: 0]
  ------------------
  787|      1|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      1|#define _color_convert  color_convert
  ------------------
  788|      0|      else {
  789|      0|        switch (cinfo->out_color_space) {
  790|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (790:9): [True: 0, False: 0]
  ------------------
  791|      0|          cconvert->pub._color_convert = rgb_extrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  792|      0|          break;
  793|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (793:9): [True: 0, False: 0]
  ------------------
  794|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (794:9): [True: 0, False: 0]
  ------------------
  795|      0|          cconvert->pub._color_convert = rgb_extrgbx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  796|      0|          break;
  797|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  ------------------
  798|      0|          cconvert->pub._color_convert = rgb_extbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  799|      0|          break;
  800|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (800:9): [True: 0, False: 0]
  ------------------
  801|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (801:9): [True: 0, False: 0]
  ------------------
  802|      0|          cconvert->pub._color_convert = rgb_extbgrx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  803|      0|          break;
  804|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (804:9): [True: 0, False: 0]
  ------------------
  805|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  ------------------
  806|      0|          cconvert->pub._color_convert = rgb_extxbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  807|      0|          break;
  808|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (808:9): [True: 0, False: 0]
  ------------------
  809|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (809:9): [True: 0, False: 0]
  ------------------
  810|      0|          cconvert->pub._color_convert = rgb_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  811|      0|          break;
  812|      0|        default:
  ------------------
  |  Branch (812:9): [True: 0, False: 0]
  ------------------
  813|      0|          cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  814|      0|        }
  815|      0|      }
  816|      1|    } else
  817|     10|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     10|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|  12.7k|    break;
  819|       |
  820|  12.7k|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 72.9k]
  ------------------
  821|      0|#ifdef D_LOSSLESS_SUPPORTED
  822|      0|    if (cinfo->master->lossless)
  ------------------
  |  Branch (822:9): [True: 0, False: 0]
  ------------------
  823|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  824|      0|#endif
  825|      0|    cinfo->out_color_components = 3;
  826|      0|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (826:9): [True: 0, False: 0]
  ------------------
  827|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (827:11): [True: 0, False: 0]
  ------------------
  828|      0|#ifdef WITH_SIMD
  829|      0|        if (jsimd_set_ycc_rgb565(cinfo))
  ------------------
  |  Branch (829:13): [True: 0, False: 0]
  ------------------
  830|      0|          cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  831|      0|        else
  832|      0|#endif
  833|      0|        {
  834|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  835|      0|          build_ycc_rgb_table(cinfo);
  836|      0|        }
  837|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (837:18): [True: 0, False: 0]
  ------------------
  838|      0|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  839|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (839:18): [True: 0, False: 0]
  ------------------
  840|      0|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  841|      0|      } else
  842|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  843|      0|    } else {
  844|       |      /* only ordered dithering is supported */
  845|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (845:11): [True: 0, False: 0]
  ------------------
  846|      0|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  847|      0|        build_ycc_rgb_table(cinfo);
  848|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (848:18): [True: 0, False: 0]
  ------------------
  849|      0|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  850|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (850:18): [True: 0, False: 0]
  ------------------
  851|      0|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  852|      0|      } else
  853|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  854|      0|    }
  855|      0|    break;
  856|       |
  857|      0|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 0, False: 72.9k]
  ------------------
  858|      0|#ifdef D_LOSSLESS_SUPPORTED
  859|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 0, False: 0]
  ------------------
  860|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 0, False: 0]
  ------------------
  861|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|      0|#endif
  863|      0|    cinfo->out_color_components = 4;
  864|      0|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  866|      0|      build_ycc_rgb_table(cinfo);
  867|      0|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 0, False: 0]
  ------------------
  868|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  869|      0|    } else
  870|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|      0|    break;
  872|       |
  873|  60.2k|  default:
  ------------------
  |  Branch (873:3): [True: 60.2k, False: 12.7k]
  ------------------
  874|       |    /* Permit null conversion to same output space */
  875|  60.2k|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (875:9): [True: 60.2k, False: 0]
  ------------------
  876|  60.2k|      cinfo->out_color_components = cinfo->num_components;
  877|  60.2k|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|  60.2k|#define _color_convert  color_convert
  ------------------
  878|  60.2k|    } else                      /* unsupported non-null conversion */
  879|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  880|  60.2k|    break;
  881|  72.9k|  }
  882|       |
  883|  72.9k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 72.9k]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|  72.9k|  else
  886|  72.9k|    cinfo->output_components = cinfo->out_color_components;
  887|  72.9k|}
jdcolor-8.c:start_pass_dcolor:
  614|  63.5k|{
  615|       |  /* no work needed */
  616|  63.5k|}
jdcolor-8.c:null_convert:
  336|  9.73M|{
  337|  9.73M|  register _JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  338|  9.73M|  register JDIMENSION col;
  339|  9.73M|  register int num_components = cinfo->num_components;
  340|  9.73M|  JDIMENSION num_cols = cinfo->output_width;
  341|  9.73M|  int ci;
  342|       |
  343|  9.73M|  if (num_components == 3) {
  ------------------
  |  Branch (343:7): [True: 73.0k, False: 9.66M]
  ------------------
  344|   146k|    while (--num_rows >= 0) {
  ------------------
  |  Branch (344:12): [True: 73.0k, False: 73.0k]
  ------------------
  345|  73.0k|      inptr0 = input_buf[0][input_row];
  346|  73.0k|      inptr1 = input_buf[1][input_row];
  347|  73.0k|      inptr2 = input_buf[2][input_row];
  348|  73.0k|      input_row++;
  349|  73.0k|      outptr = *output_buf++;
  350|  1.46M|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (350:21): [True: 1.39M, False: 73.0k]
  ------------------
  351|  1.39M|        *outptr++ = inptr0[col];
  352|  1.39M|        *outptr++ = inptr1[col];
  353|  1.39M|        *outptr++ = inptr2[col];
  354|  1.39M|      }
  355|  73.0k|    }
  356|  9.66M|  } else if (num_components == 4) {
  ------------------
  |  Branch (356:14): [True: 310, False: 9.66M]
  ------------------
  357|    620|    while (--num_rows >= 0) {
  ------------------
  |  Branch (357:12): [True: 310, False: 310]
  ------------------
  358|    310|      inptr0 = input_buf[0][input_row];
  359|    310|      inptr1 = input_buf[1][input_row];
  360|    310|      inptr2 = input_buf[2][input_row];
  361|    310|      inptr3 = input_buf[3][input_row];
  362|    310|      input_row++;
  363|    310|      outptr = *output_buf++;
  364|  37.8k|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (364:21): [True: 37.5k, False: 310]
  ------------------
  365|  37.5k|        *outptr++ = inptr0[col];
  366|  37.5k|        *outptr++ = inptr1[col];
  367|  37.5k|        *outptr++ = inptr2[col];
  368|  37.5k|        *outptr++ = inptr3[col];
  369|  37.5k|      }
  370|    310|    }
  371|  9.66M|  } else {
  372|  19.3M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (372:12): [True: 9.66M, False: 9.66M]
  ------------------
  373|  19.3M|      for (ci = 0; ci < num_components; ci++) {
  ------------------
  |  Branch (373:20): [True: 9.66M, False: 9.66M]
  ------------------
  374|  9.66M|        inptr = input_buf[ci][input_row];
  375|  9.66M|        outptr = *output_buf;
  376|  7.44G|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (376:23): [True: 7.43G, False: 9.66M]
  ------------------
  377|  7.43G|          outptr[ci] = inptr[col];
  378|  7.43G|          outptr += num_components;
  379|  7.43G|        }
  380|  9.66M|      }
  381|  9.66M|      output_buf++;
  382|  9.66M|      input_row++;
  383|  9.66M|    }
  384|  9.66M|  }
  385|  9.73M|}
j12init_color_deconverter:
  625|    797|{
  626|    797|  my_cconvert_ptr cconvert;
  627|    797|  int ci;
  628|       |
  629|    797|#ifdef D_LOSSLESS_SUPPORTED
  630|    797|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 311, False: 486]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|    311|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    622|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (634:9): [True: 0, False: 311]
  ------------------
  635|    311|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    311|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (635:9): [True: 0, False: 311]
  ------------------
  636|      0|#endif
  637|      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)))
  ------------------
  638|    311|  } else
  639|    486|#endif
  640|    486|  {
  641|    486|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    486|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (641:9): [True: 0, False: 486]
  ------------------
  642|      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)))
  ------------------
  643|    486|  }
  644|       |
  645|    797|  cconvert = (my_cconvert_ptr)
  646|    797|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    797|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|    797|                                sizeof(my_color_deconverter));
  648|    797|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|    797|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|    797|  switch (cinfo->jpeg_color_space) {
  653|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 0, False: 797]
  ------------------
  654|      0|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 0]
  ------------------
  655|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  656|      0|    break;
  657|       |
  658|      0|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 0, False: 797]
  ------------------
  659|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 0, False: 797]
  ------------------
  660|      0|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 0]
  ------------------
  661|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  662|      0|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 797]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 797]
  ------------------
  666|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 0]
  ------------------
  667|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  668|      0|    break;
  669|       |
  670|    797|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 797, False: 0]
  ------------------
  671|    797|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (671:9): [True: 0, False: 797]
  ------------------
  672|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  673|    797|    break;
  674|    797|  }
  675|       |
  676|       |  /* Set out_color_components and conversion method based on requested space.
  677|       |   * Also clear the component_needed flags for any unused components,
  678|       |   * so that earlier pipeline stages can avoid useless computation.
  679|       |   * NOTE: We do not allow any lossy color conversion algorithms in lossless
  680|       |   * mode.
  681|       |   */
  682|       |
  683|    797|  switch (cinfo->out_color_space) {
  684|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 0, False: 797]
  ------------------
  685|      0|#ifdef D_LOSSLESS_SUPPORTED
  686|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 0, False: 0]
  ------------------
  687|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 0]
  ------------------
  688|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  689|      0|#endif
  690|      0|    cinfo->out_color_components = 1;
  691|      0|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 0, False: 0]
  ------------------
  692|      0|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|      0|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|      0|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 0]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (697:16): [True: 0, False: 0]
  ------------------
  698|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  699|      0|      build_rgb_y_table(cinfo);
  700|      0|    } else
  701|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  702|      0|    break;
  703|       |
  704|      0|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 0, False: 797]
  ------------------
  705|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 797]
  ------------------
  706|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 797]
  ------------------
  707|      0|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 797]
  ------------------
  708|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 797]
  ------------------
  709|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 797]
  ------------------
  710|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 797]
  ------------------
  711|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 797]
  ------------------
  712|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 797]
  ------------------
  713|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 797]
  ------------------
  714|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 797]
  ------------------
  715|      0|#ifdef D_LOSSLESS_SUPPORTED
  716|      0|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 0, False: 0]
  |  Branch (716:36): [True: 0, False: 0]
  ------------------
  717|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|      0|#endif
  719|      0|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|      0|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 0, False: 0]
  ------------------
  721|       |#ifdef WITH_SIMD
  722|       |      if (jsimd_set_ycc_rgb(cinfo))
  723|       |        cconvert->pub._color_convert = jsimd_color_deconvert;
  724|       |      else
  725|       |#endif
  726|      0|      {
  727|      0|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 0]
  ------------------
  729|      0|          cconvert->pub._color_convert = ycc_extrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  730|      0|          break;
  731|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (731:9): [True: 0, False: 0]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 0]
  ------------------
  733|      0|          cconvert->pub._color_convert = ycc_extrgbx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  734|      0|          break;
  735|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (735:9): [True: 0, False: 0]
  ------------------
  736|      0|          cconvert->pub._color_convert = ycc_extbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  737|      0|          break;
  738|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (738:9): [True: 0, False: 0]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 0]
  ------------------
  740|      0|          cconvert->pub._color_convert = ycc_extbgrx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  741|      0|          break;
  742|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (742:9): [True: 0, False: 0]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 0]
  ------------------
  744|      0|          cconvert->pub._color_convert = ycc_extxbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  745|      0|          break;
  746|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (746:9): [True: 0, False: 0]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 0]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  749|      0|          break;
  750|      0|        default:
  ------------------
  |  Branch (750:9): [True: 0, False: 0]
  ------------------
  751|      0|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  752|      0|        }
  753|      0|        build_ycc_rgb_table(cinfo);
  754|      0|      }
  755|      0|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 0]
  ------------------
  756|      0|      switch (cinfo->out_color_space) {
  757|      0|      case JCS_EXT_RGB:
  ------------------
  |  Branch (757:7): [True: 0, False: 0]
  ------------------
  758|      0|        cconvert->pub._color_convert = gray_extrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  759|      0|        break;
  760|      0|      case JCS_EXT_RGBX:
  ------------------
  |  Branch (760:7): [True: 0, False: 0]
  ------------------
  761|      0|      case JCS_EXT_RGBA:
  ------------------
  |  Branch (761:7): [True: 0, False: 0]
  ------------------
  762|      0|        cconvert->pub._color_convert = gray_extrgbx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  763|      0|        break;
  764|      0|      case JCS_EXT_BGR:
  ------------------
  |  Branch (764:7): [True: 0, False: 0]
  ------------------
  765|      0|        cconvert->pub._color_convert = gray_extbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  766|      0|        break;
  767|      0|      case JCS_EXT_BGRX:
  ------------------
  |  Branch (767:7): [True: 0, False: 0]
  ------------------
  768|      0|      case JCS_EXT_BGRA:
  ------------------
  |  Branch (768:7): [True: 0, False: 0]
  ------------------
  769|      0|        cconvert->pub._color_convert = gray_extbgrx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  770|      0|        break;
  771|      0|      case JCS_EXT_XBGR:
  ------------------
  |  Branch (771:7): [True: 0, False: 0]
  ------------------
  772|      0|      case JCS_EXT_ABGR:
  ------------------
  |  Branch (772:7): [True: 0, False: 0]
  ------------------
  773|      0|        cconvert->pub._color_convert = gray_extxbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  774|      0|        break;
  775|      0|      case JCS_EXT_XRGB:
  ------------------
  |  Branch (775:7): [True: 0, False: 0]
  ------------------
  776|      0|      case JCS_EXT_ARGB:
  ------------------
  |  Branch (776:7): [True: 0, False: 0]
  ------------------
  777|      0|        cconvert->pub._color_convert = gray_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  778|      0|        break;
  779|      0|      default:
  ------------------
  |  Branch (779:7): [True: 0, False: 0]
  ------------------
  780|      0|        cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  781|      0|      }
  782|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 0, False: 0]
  ------------------
  783|      0|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 0, False: 0]
  ------------------
  784|      0|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 0, False: 0]
  ------------------
  785|      0|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 0, False: 0]
  ------------------
  786|      0|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 0, False: 0]
  ------------------
  787|      0|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  788|      0|      else {
  789|      0|        switch (cinfo->out_color_space) {
  790|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (790:9): [True: 0, False: 0]
  ------------------
  791|      0|          cconvert->pub._color_convert = rgb_extrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  792|      0|          break;
  793|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (793:9): [True: 0, False: 0]
  ------------------
  794|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (794:9): [True: 0, False: 0]
  ------------------
  795|      0|          cconvert->pub._color_convert = rgb_extrgbx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  796|      0|          break;
  797|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  ------------------
  798|      0|          cconvert->pub._color_convert = rgb_extbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  799|      0|          break;
  800|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (800:9): [True: 0, False: 0]
  ------------------
  801|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (801:9): [True: 0, False: 0]
  ------------------
  802|      0|          cconvert->pub._color_convert = rgb_extbgrx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  803|      0|          break;
  804|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (804:9): [True: 0, False: 0]
  ------------------
  805|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  ------------------
  806|      0|          cconvert->pub._color_convert = rgb_extxbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  807|      0|          break;
  808|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (808:9): [True: 0, False: 0]
  ------------------
  809|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (809:9): [True: 0, False: 0]
  ------------------
  810|      0|          cconvert->pub._color_convert = rgb_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  811|      0|          break;
  812|      0|        default:
  ------------------
  |  Branch (812:9): [True: 0, False: 0]
  ------------------
  813|      0|          cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  814|      0|        }
  815|      0|      }
  816|      0|    } else
  817|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|      0|    break;
  819|       |
  820|      0|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 797]
  ------------------
  821|      0|#ifdef D_LOSSLESS_SUPPORTED
  822|      0|    if (cinfo->master->lossless)
  ------------------
  |  Branch (822:9): [True: 0, False: 0]
  ------------------
  823|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  824|      0|#endif
  825|      0|    cinfo->out_color_components = 3;
  826|      0|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (826:9): [True: 0, False: 0]
  ------------------
  827|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (827:11): [True: 0, False: 0]
  ------------------
  828|       |#ifdef WITH_SIMD
  829|       |        if (jsimd_set_ycc_rgb565(cinfo))
  830|       |          cconvert->pub._color_convert = jsimd_color_deconvert;
  831|       |        else
  832|       |#endif
  833|      0|        {
  834|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  835|      0|          build_ycc_rgb_table(cinfo);
  836|      0|        }
  837|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (837:18): [True: 0, False: 0]
  ------------------
  838|      0|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  839|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (839:18): [True: 0, False: 0]
  ------------------
  840|      0|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  841|      0|      } else
  842|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  843|      0|    } else {
  844|       |      /* only ordered dithering is supported */
  845|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (845:11): [True: 0, False: 0]
  ------------------
  846|      0|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  847|      0|        build_ycc_rgb_table(cinfo);
  848|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (848:18): [True: 0, False: 0]
  ------------------
  849|      0|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  850|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (850:18): [True: 0, False: 0]
  ------------------
  851|      0|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  852|      0|      } else
  853|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  854|      0|    }
  855|      0|    break;
  856|       |
  857|      0|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 0, False: 797]
  ------------------
  858|      0|#ifdef D_LOSSLESS_SUPPORTED
  859|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 0, False: 0]
  ------------------
  860|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 0, False: 0]
  ------------------
  861|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|      0|#endif
  863|      0|    cinfo->out_color_components = 4;
  864|      0|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  866|      0|      build_ycc_rgb_table(cinfo);
  867|      0|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 0, False: 0]
  ------------------
  868|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  869|      0|    } else
  870|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|      0|    break;
  872|       |
  873|    797|  default:
  ------------------
  |  Branch (873:3): [True: 797, False: 0]
  ------------------
  874|       |    /* Permit null conversion to same output space */
  875|    797|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (875:9): [True: 797, False: 0]
  ------------------
  876|    797|      cinfo->out_color_components = cinfo->num_components;
  877|    797|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|    797|#define _color_convert  color_convert_12
  ------------------
  878|    797|    } else                      /* unsupported non-null conversion */
  879|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  880|    797|    break;
  881|    797|  }
  882|       |
  883|    797|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 797]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|    797|  else
  886|    797|    cinfo->output_components = cinfo->out_color_components;
  887|    797|}
jdcolor-12.c:start_pass_dcolor:
  614|    781|{
  615|       |  /* no work needed */
  616|    781|}
jdcolor-12.c:null_convert:
  336|  1.74M|{
  337|  1.74M|  register _JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  338|  1.74M|  register JDIMENSION col;
  339|  1.74M|  register int num_components = cinfo->num_components;
  340|  1.74M|  JDIMENSION num_cols = cinfo->output_width;
  341|  1.74M|  int ci;
  342|       |
  343|  1.74M|  if (num_components == 3) {
  ------------------
  |  Branch (343:7): [True: 0, False: 1.74M]
  ------------------
  344|      0|    while (--num_rows >= 0) {
  ------------------
  |  Branch (344:12): [True: 0, False: 0]
  ------------------
  345|      0|      inptr0 = input_buf[0][input_row];
  346|      0|      inptr1 = input_buf[1][input_row];
  347|      0|      inptr2 = input_buf[2][input_row];
  348|      0|      input_row++;
  349|      0|      outptr = *output_buf++;
  350|      0|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (350:21): [True: 0, False: 0]
  ------------------
  351|      0|        *outptr++ = inptr0[col];
  352|      0|        *outptr++ = inptr1[col];
  353|      0|        *outptr++ = inptr2[col];
  354|      0|      }
  355|      0|    }
  356|  1.74M|  } else if (num_components == 4) {
  ------------------
  |  Branch (356:14): [True: 0, False: 1.74M]
  ------------------
  357|      0|    while (--num_rows >= 0) {
  ------------------
  |  Branch (357:12): [True: 0, False: 0]
  ------------------
  358|      0|      inptr0 = input_buf[0][input_row];
  359|      0|      inptr1 = input_buf[1][input_row];
  360|      0|      inptr2 = input_buf[2][input_row];
  361|      0|      inptr3 = input_buf[3][input_row];
  362|      0|      input_row++;
  363|      0|      outptr = *output_buf++;
  364|      0|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (364:21): [True: 0, False: 0]
  ------------------
  365|      0|        *outptr++ = inptr0[col];
  366|      0|        *outptr++ = inptr1[col];
  367|      0|        *outptr++ = inptr2[col];
  368|      0|        *outptr++ = inptr3[col];
  369|      0|      }
  370|      0|    }
  371|  1.74M|  } else {
  372|  3.49M|    while (--num_rows >= 0) {
  ------------------
  |  Branch (372:12): [True: 1.74M, False: 1.74M]
  ------------------
  373|  3.49M|      for (ci = 0; ci < num_components; ci++) {
  ------------------
  |  Branch (373:20): [True: 1.74M, False: 1.74M]
  ------------------
  374|  1.74M|        inptr = input_buf[ci][input_row];
  375|  1.74M|        outptr = *output_buf;
  376|   218M|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (376:23): [True: 217M, False: 1.74M]
  ------------------
  377|   217M|          outptr[ci] = inptr[col];
  378|   217M|          outptr += num_components;
  379|   217M|        }
  380|  1.74M|      }
  381|  1.74M|      output_buf++;
  382|  1.74M|      input_row++;
  383|  1.74M|    }
  384|  1.74M|  }
  385|  1.74M|}

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

jinit_d_diff_controller:
  348|  3.15k|{
  349|  3.15k|  my_diff_ptr diff;
  350|  3.15k|  int ci;
  351|  3.15k|  jpeg_component_info *compptr;
  352|       |
  353|  3.15k|#if BITS_IN_JSAMPLE == 8
  354|  3.15k|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  6.30k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (354:7): [True: 0, False: 3.15k]
  |  Branch (354:50): [True: 0, False: 3.15k]
  ------------------
  355|       |#else
  356|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  357|       |      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  358|       |#endif
  359|      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)))
  ------------------
  360|       |
  361|  3.15k|  diff = (my_diff_ptr)
  362|  3.15k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.15k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|  3.15k|                                sizeof(my_diff_controller));
  364|  3.15k|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|  3.15k|  diff->pub.start_input_pass = start_input_pass;
  366|  3.15k|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|  6.54k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 3.39k, False: 3.15k]
  ------------------
  370|  3.39k|       ci++, compptr++) {
  371|  3.39k|    diff->diff_buf[ci] =
  372|  3.39k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  3.39k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  3.39k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  3.39k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|  3.39k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|  3.39k|                                         (long)compptr->h_samp_factor),
  375|  3.39k|                   (JDIMENSION)compptr->v_samp_factor);
  376|  3.39k|    diff->undiff_buf[ci] =
  377|  3.39k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  3.39k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  3.39k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  3.39k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|  3.39k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|  3.39k|                                         (long)compptr->h_samp_factor),
  380|  3.39k|                   (JDIMENSION)compptr->v_samp_factor);
  381|  3.39k|  }
  382|       |
  383|  3.15k|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 90, False: 3.06k]
  ------------------
  384|     90|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|     90|    int access_rows;
  387|       |
  388|    360|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 270, False: 90]
  ------------------
  389|    270|         ci++, compptr++) {
  390|    270|      access_rows = compptr->v_samp_factor;
  391|    270|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|    270|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|    270|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|    270|#define FALSE   0               /* values of boolean */
  ------------------
  393|    270|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|    270|                               (long)compptr->h_samp_factor),
  395|    270|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|    270|                               (long)compptr->v_samp_factor),
  397|    270|         (JDIMENSION)access_rows);
  398|    270|    }
  399|     90|    diff->pub.consume_data = consume_data;
  400|     90|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  258|     90|#define _decompress_data  decompress_data
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|  3.06k|  } else {
  405|  3.06k|    diff->pub.consume_data = dummy_consume_data;
  406|  3.06k|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|  3.06k|#define _decompress_data  decompress_data
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|  3.06k|  }
  409|  3.15k|}
jddiffct-8.c:start_input_pass:
   94|  3.41k|{
   95|  3.41k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   96|       |
   97|       |  /* Because it is hitching a ride on the jpeg_inverse_dct struct,
   98|       |   * start_pass_lossless() will be called at the start of the output pass.
   99|       |   * This ensures that it will be called at the start of the input pass as
  100|       |   * well.
  101|       |   */
  102|  3.41k|  (*cinfo->idct->start_pass) (cinfo);
  103|       |
  104|       |  /* Check that the restart interval is an integer multiple of the number
  105|       |   * of MCUs in an MCU row.
  106|       |   */
  107|  3.41k|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 18, False: 3.39k]
  ------------------
  108|     18|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  247|     18|  ((cinfo)->err->msg_code = (code), \
  |  |  248|     18|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|     18|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|     18|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|  3.41k|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|  3.41k|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|  3.41k|  cinfo->input_iMCU_row = 0;
  115|  3.41k|  start_iMCU_row(cinfo);
  116|  3.41k|}
jddiffct-8.c:start_iMCU_row:
   67|   164k|{
   68|   164k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   69|       |
   70|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   71|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   72|       |   * But at the bottom of the image, process only what's left.
   73|       |   */
   74|   164k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 22.3k, False: 142k]
  ------------------
   75|  22.3k|    diff->MCU_rows_per_iMCU_row = 1;
   76|   142k|  } else {
   77|   142k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 140k, False: 1.50k]
  ------------------
   78|   140k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|  1.50k|    else
   80|  1.50k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|   142k|  }
   82|       |
   83|   164k|  diff->MCU_ctr = 0;
   84|   164k|  diff->MCU_vert_offset = 0;
   85|   164k|}
jddiffct-8.c:start_output_pass:
  147|  1.43k|{
  148|  1.43k|  cinfo->output_iMCU_row = 0;
  149|  1.43k|}
jddiffct-8.c:consume_data:
  266|  90.9k|{
  267|  90.9k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  268|  90.9k|  int ci, compi;
  269|  90.9k|  _JSAMPARRAY buffer[MAX_COMPS_IN_SCAN];
  ------------------
  |  |  230|  90.9k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  270|  90.9k|  jpeg_component_info *compptr;
  271|       |
  272|       |  /* Align the virtual buffers for the components used in this scan. */
  273|   225k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (273:16): [True: 134k, False: 90.9k]
  ------------------
  274|   134k|    compptr = cinfo->cur_comp_info[ci];
  275|   134k|    compi = compptr->component_index;
  276|   134k|    buffer[compi] = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  277|   134k|      ((j_common_ptr)cinfo, diff->whole_image[compi],
  278|   134k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  279|   134k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|   134k|#define TRUE    1
  ------------------
  280|   134k|  }
  281|       |
  282|  90.9k|  return decompress_data(cinfo, buffer);
  283|  90.9k|}
jddiffct-8.c:output_data:
  296|  2.08k|{
  297|  2.08k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  298|  2.08k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  299|  2.08k|  int ci, samp_rows, row;
  300|  2.08k|  _JSAMPARRAY buffer;
  ------------------
  |  |  230|  2.08k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  301|  2.08k|  jpeg_component_info *compptr;
  302|       |
  303|       |  /* Force some input to be done if we are getting ahead of the input. */
  304|  2.08k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (304:10): [True: 0, False: 2.08k]
  ------------------
  305|  2.08k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (305:11): [True: 2.08k, False: 0]
  ------------------
  306|  2.08k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (306:11): [True: 0, False: 2.08k]
  ------------------
  307|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (307:9): [True: 0, False: 0]
  ------------------
  308|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  309|      0|  }
  310|       |
  311|       |  /* OK, output from the virtual arrays. */
  312|  8.32k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (312:44): [True: 6.23k, False: 2.08k]
  ------------------
  313|  6.23k|       ci++, compptr++) {
  314|       |    /* Align the virtual buffer for this component. */
  315|  6.23k|    buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  316|  6.23k|      ((j_common_ptr)cinfo, diff->whole_image[ci],
  317|  6.23k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  318|  6.23k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  6.23k|#define FALSE   0               /* values of boolean */
  ------------------
  319|       |
  320|  6.23k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (320:9): [True: 6.11k, False: 114]
  ------------------
  321|  6.11k|      samp_rows = compptr->v_samp_factor;
  322|    114|    else {
  323|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  324|    114|      samp_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  325|    114|      if (samp_rows == 0) samp_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (325:11): [True: 91, False: 23]
  ------------------
  326|    114|    }
  327|       |
  328|  12.4k|    for (row = 0; row < samp_rows; row++) {
  ------------------
  |  Branch (328:19): [True: 6.21k, False: 6.23k]
  ------------------
  329|  6.21k|      memcpy(output_buf[ci][row], buffer[row],
  330|  6.21k|             compptr->width_in_blocks * sizeof(_JSAMPLE));
  331|  6.21k|    }
  332|  6.23k|  }
  333|       |
  334|  2.08k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (334:7): [True: 2.03k, False: 52]
  ------------------
  335|  2.03k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  2.03k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  336|     52|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|     52|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  337|  2.08k|}
jddiffct-8.c:decompress_data:
  164|   164k|{
  165|   164k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|   164k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|   164k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|   164k|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|   164k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|   164k|  int ci, compi, row, prev_row;
  171|   164k|  unsigned int yoffset;
  172|   164k|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|   329k|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 164k, False: 164k]
  ------------------
  176|   164k|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|   164k|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 30.4k, False: 134k]
  ------------------
  180|  30.4k|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 1.98k, False: 28.5k]
  ------------------
  181|  1.98k|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 1.98k]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|  30.4k|    }
  184|       |
  185|   164k|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|   164k|    MCU_count =
  188|   164k|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|   164k|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|   164k|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|   164k|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 164k]
  ------------------
  192|       |      /* Suspension forced; update state counters and exit */
  193|      0|      diff->MCU_vert_offset = yoffset;
  194|      0|      diff->MCU_ctr += MCU_count;
  195|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  196|      0|    }
  197|       |
  198|       |    /* Account for restart interval (no-op if not using restarts) */
  199|   164k|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 30.4k, False: 134k]
  ------------------
  200|  30.4k|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|   164k|    diff->MCU_ctr = 0;
  204|   164k|  }
  205|       |
  206|       |  /*
  207|       |   * Undifference and scale each scanline of the disassembled MCU row
  208|       |   * separately.  We do not process dummy samples at the end of a scanline
  209|       |   * or dummy rows at the end of the image.
  210|       |   */
  211|   373k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 209k, False: 164k]
  ------------------
  212|   209k|    compptr = cinfo->cur_comp_info[ci];
  213|   209k|    compi = compptr->component_index;
  214|   209k|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|   418k|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 209k, False: 209k]
  |  Branch (215:17): [True: 7.02k, False: 411k]
  ------------------
  216|   411k|                compptr->last_row_height : compptr->v_samp_factor);
  217|   209k|         prev_row = row, row++) {
  218|   209k|      (*losslessd->predict_undifference[compi])
  219|   209k|        (cinfo, compi, diff->diff_buf[compi][row],
  220|   209k|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|   209k|          compptr->width_in_blocks);
  222|   209k|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|   209k|                                  output_buf[compi][row],
  224|   209k|                                  compptr->width_in_blocks);
  225|   209k|    }
  226|   209k|  }
  227|       |
  228|       |  /* Completed the iMCU row, advance counters for next one.
  229|       |   *
  230|       |   * NB: output_data will increment output_iMCU_row.
  231|       |   * This counter is not needed for the single-pass case
  232|       |   * or the input side of the multi-pass case.
  233|       |   */
  234|   164k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 162k, False: 2.17k]
  ------------------
  235|   162k|    start_iMCU_row(cinfo);
  236|   162k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   162k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|   162k|  }
  238|       |  /* Completed the scan */
  239|  2.17k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|  2.17k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  2.17k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|   164k|}
jddiffct-8.c:process_restart:
  126|  1.98k|{
  127|  1.98k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  128|       |
  129|  1.98k|  if (!(*cinfo->entropy->process_restart) (cinfo))
  ------------------
  |  Branch (129:7): [True: 0, False: 1.98k]
  ------------------
  130|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  131|       |
  132|  1.98k|  (*cinfo->idct->start_pass) (cinfo);
  133|       |
  134|       |  /* Reset restart counter */
  135|  1.98k|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  136|       |
  137|  1.98k|  return TRUE;
  ------------------
  |  |  210|  1.98k|#define TRUE    1
  ------------------
  138|  1.98k|}
j12init_d_diff_controller:
  348|    311|{
  349|    311|  my_diff_ptr diff;
  350|    311|  int ci;
  351|    311|  jpeg_component_info *compptr;
  352|       |
  353|       |#if BITS_IN_JSAMPLE == 8
  354|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  355|       |#else
  356|    311|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    622|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (356:7): [True: 0, False: 311]
  ------------------
  357|    311|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    311|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (357:7): [True: 0, False: 311]
  ------------------
  358|      0|#endif
  359|      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)))
  ------------------
  360|       |
  361|    311|  diff = (my_diff_ptr)
  362|    311|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    311|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|    311|                                sizeof(my_diff_controller));
  364|    311|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|    311|  diff->pub.start_input_pass = start_input_pass;
  366|    311|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|    622|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 311, False: 311]
  ------------------
  370|    311|       ci++, compptr++) {
  371|    311|    diff->diff_buf[ci] =
  372|    311|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|    311|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|    311|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|    311|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|    311|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|    311|                                         (long)compptr->h_samp_factor),
  375|    311|                   (JDIMENSION)compptr->v_samp_factor);
  376|    311|    diff->undiff_buf[ci] =
  377|    311|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|    311|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|    311|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|    311|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|    311|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|    311|                                         (long)compptr->h_samp_factor),
  380|    311|                   (JDIMENSION)compptr->v_samp_factor);
  381|    311|  }
  382|       |
  383|    311|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 0, False: 311]
  ------------------
  384|      0|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|      0|    int access_rows;
  387|       |
  388|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 0, False: 0]
  ------------------
  389|      0|         ci++, compptr++) {
  390|      0|      access_rows = compptr->v_samp_factor;
  391|      0|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  393|      0|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|      0|                               (long)compptr->h_samp_factor),
  395|      0|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|      0|                               (long)compptr->v_samp_factor),
  397|      0|         (JDIMENSION)access_rows);
  398|      0|    }
  399|      0|    diff->pub.consume_data = consume_data;
  400|      0|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  142|      0|#define _decompress_data  decompress_data_12
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|    311|  } else {
  405|    311|    diff->pub.consume_data = dummy_consume_data;
  406|    311|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|    311|#define _decompress_data  decompress_data_12
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|    311|  }
  409|    311|}
jddiffct-12.c:start_input_pass:
   94|    309|{
   95|    309|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   96|       |
   97|       |  /* Because it is hitching a ride on the jpeg_inverse_dct struct,
   98|       |   * start_pass_lossless() will be called at the start of the output pass.
   99|       |   * This ensures that it will be called at the start of the input pass as
  100|       |   * well.
  101|       |   */
  102|    309|  (*cinfo->idct->start_pass) (cinfo);
  103|       |
  104|       |  /* Check that the restart interval is an integer multiple of the number
  105|       |   * of MCUs in an MCU row.
  106|       |   */
  107|    309|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 2, False: 307]
  ------------------
  108|      2|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  247|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      2|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|    309|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|    309|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|    309|  cinfo->input_iMCU_row = 0;
  115|    309|  start_iMCU_row(cinfo);
  116|    309|}
jddiffct-12.c:start_iMCU_row:
   67|   113k|{
   68|   113k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   69|       |
   70|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   71|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   72|       |   * But at the bottom of the image, process only what's left.
   73|       |   */
   74|   113k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 0, False: 113k]
  ------------------
   75|      0|    diff->MCU_rows_per_iMCU_row = 1;
   76|   113k|  } else {
   77|   113k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 112k, False: 264]
  ------------------
   78|   112k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|    264|    else
   80|    264|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|   113k|  }
   82|       |
   83|   113k|  diff->MCU_ctr = 0;
   84|   113k|  diff->MCU_vert_offset = 0;
   85|   113k|}
jddiffct-12.c:start_output_pass:
  147|    302|{
  148|    302|  cinfo->output_iMCU_row = 0;
  149|    302|}
jddiffct-12.c:decompress_data:
  164|   112k|{
  165|   112k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|   112k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|   112k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|   112k|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|   112k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|   112k|  int ci, compi, row, prev_row;
  171|   112k|  unsigned int yoffset;
  172|   112k|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|   225k|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 112k, False: 112k]
  ------------------
  176|   112k|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|   112k|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 16.4k, False: 96.5k]
  ------------------
  180|  16.4k|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 408, False: 16.0k]
  ------------------
  181|    408|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 408]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|  16.4k|    }
  184|       |
  185|   112k|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|   112k|    MCU_count =
  188|   112k|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|   112k|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|   112k|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|   112k|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 112k]
  ------------------
  192|       |      /* Suspension forced; update state counters and exit */
  193|      0|      diff->MCU_vert_offset = yoffset;
  194|      0|      diff->MCU_ctr += MCU_count;
  195|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  196|      0|    }
  197|       |
  198|       |    /* Account for restart interval (no-op if not using restarts) */
  199|   112k|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 16.4k, False: 96.5k]
  ------------------
  200|  16.4k|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|   112k|    diff->MCU_ctr = 0;
  204|   112k|  }
  205|       |
  206|       |  /*
  207|       |   * Undifference and scale each scanline of the disassembled MCU row
  208|       |   * separately.  We do not process dummy samples at the end of a scanline
  209|       |   * or dummy rows at the end of the image.
  210|       |   */
  211|   225k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 112k, False: 112k]
  ------------------
  212|   112k|    compptr = cinfo->cur_comp_info[ci];
  213|   112k|    compi = compptr->component_index;
  214|   112k|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|   225k|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 112k, False: 112k]
  |  Branch (215:17): [True: 528, False: 225k]
  ------------------
  216|   225k|                compptr->last_row_height : compptr->v_samp_factor);
  217|   112k|         prev_row = row, row++) {
  218|   112k|      (*losslessd->predict_undifference[compi])
  219|   112k|        (cinfo, compi, diff->diff_buf[compi][row],
  220|   112k|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|   112k|          compptr->width_in_blocks);
  222|   112k|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|   112k|                                  output_buf[compi][row],
  224|   112k|                                  compptr->width_in_blocks);
  225|   112k|    }
  226|   112k|  }
  227|       |
  228|       |  /* Completed the iMCU row, advance counters for next one.
  229|       |   *
  230|       |   * NB: output_data will increment output_iMCU_row.
  231|       |   * This counter is not needed for the single-pass case
  232|       |   * or the input side of the multi-pass case.
  233|       |   */
  234|   112k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 112k, False: 264]
  ------------------
  235|   112k|    start_iMCU_row(cinfo);
  236|   112k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|   112k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|   112k|  }
  238|       |  /* Completed the scan */
  239|    264|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|    264|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    264|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|   112k|}
jddiffct-12.c:process_restart:
  126|    408|{
  127|    408|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  128|       |
  129|    408|  if (!(*cinfo->entropy->process_restart) (cinfo))
  ------------------
  |  Branch (129:7): [True: 0, False: 408]
  ------------------
  130|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  131|       |
  132|    408|  (*cinfo->idct->start_pass) (cinfo);
  133|       |
  134|       |  /* Reset restart counter */
  135|    408|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  136|       |
  137|    408|  return TRUE;
  ------------------
  |  |  210|    408|#define TRUE    1
  ------------------
  138|    408|}

jpeg_make_d_derived_tbl:
  145|   112k|{
  146|   112k|  JHUFF_TBL *htbl;
  147|   112k|  d_derived_tbl *dtbl;
  148|   112k|  int p, i, l, si, numsymbols;
  149|   112k|  int lookbits, ctr;
  150|   112k|  char huffsize[257];
  151|   112k|  unsigned int huffcode[257];
  152|   112k|  unsigned int code;
  153|       |
  154|       |  /* Note that huffsize[] and huffcode[] are filled in code-length order,
  155|       |   * paralleling the order of the symbols themselves in htbl->huffval[].
  156|       |   */
  157|       |
  158|       |  /* Find the input Huffman table */
  159|   112k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|   112k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 112k]
  |  Branch (159:20): [True: 375, False: 111k]
  ------------------
  160|    375|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|    375|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    375|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    375|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|   112k|  htbl =
  162|   112k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 59.1k, False: 52.9k]
  ------------------
  163|   112k|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 197, False: 111k]
  ------------------
  164|    197|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|    197|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    197|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    197|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  165|       |
  166|       |  /* Allocate a workspace if we haven't already done so. */
  167|   112k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 98.0k, False: 14.0k]
  ------------------
  168|  98.0k|    *pdtbl = (d_derived_tbl *)
  169|  98.0k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  98.0k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|  98.0k|                                  sizeof(d_derived_tbl));
  171|   112k|  dtbl = *pdtbl;
  172|   112k|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|   112k|  p = 0;
  177|  1.89M|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 1.78M, False: 112k]
  ------------------
  178|  1.78M|    i = (int)htbl->bits[l];
  179|  1.78M|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 1.78M]
  |  Branch (179:18): [True: 0, False: 1.78M]
  ------------------
  180|      0|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  181|  9.10M|    while (i--)
  ------------------
  |  Branch (181:12): [True: 7.32M, False: 1.78M]
  ------------------
  182|  7.32M|      huffsize[p++] = (char)l;
  183|  1.78M|  }
  184|   112k|  huffsize[p] = 0;
  185|   112k|  numsymbols = p;
  186|       |
  187|       |  /* Figure C.2: generate the codes themselves */
  188|       |  /* We also validate that the counts represent a legal Huffman code tree. */
  189|       |
  190|   112k|  code = 0;
  191|   112k|  si = huffsize[0];
  192|   112k|  p = 0;
  193|  1.32M|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 1.20M, False: 112k]
  ------------------
  194|  8.52M|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 7.31M, False: 1.20M]
  ------------------
  195|  7.31M|      huffcode[p++] = code;
  196|  7.31M|      code++;
  197|  7.31M|    }
  198|       |    /* code is now 1 more than the last code used for codelength si; but
  199|       |     * it must still fit in si bits, since no code is allowed to be all ones.
  200|       |     */
  201|  1.20M|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 187, False: 1.20M]
  ------------------
  202|    187|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|    187|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    187|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|  1.20M|    code <<= 1;
  204|  1.20M|    si++;
  205|  1.20M|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|   112k|  p = 0;
  210|  1.89M|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 1.78M, False: 112k]
  ------------------
  211|  1.78M|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 820k, False: 961k]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|   820k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|   820k|      p += htbl->bits[l];
  217|   820k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|   961k|    } else {
  219|   961k|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|   961k|    }
  221|  1.78M|  }
  222|   112k|  dtbl->valoffset[17] = 0;
  223|   112k|  dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */
  224|       |
  225|       |  /* Compute lookahead tables to speed up decoding.
  226|       |   * First we set all the table entries to 0, indicating "too long";
  227|       |   * then we iterate through the Huffman codes that are short enough and
  228|       |   * fill in all the entries that correspond to bit sequences starting
  229|       |   * with that code.
  230|       |   */
  231|       |
  232|  28.6M|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|  28.6M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 28.5M, False: 112k]
  ------------------
  233|  28.5M|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  28.5M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  28.5M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|   112k|  p = 0;
  236|  1.00M|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|  1.00M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 890k, False: 112k]
  ------------------
  237|  2.44M|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 1.55M, False: 890k]
  ------------------
  238|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  239|       |      /* Generate left-justified code followed by all possible bit sequences */
  240|  1.55M|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|  1.55M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|  17.2M|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|  1.55M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 15.6M, False: 1.55M]
  ------------------
  242|  15.6M|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|  15.6M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|  15.6M|        lookbits++;
  244|  15.6M|      }
  245|  1.55M|    }
  246|   890k|  }
  247|       |
  248|       |  /* Validate symbols as being reasonable.
  249|       |   * For AC tables, we make no check, but accept all byte values 0..255.
  250|       |   * For DC tables, we require the symbols to be in range 0..15 in lossy mode
  251|       |   * and 0..16 in lossless mode.  (Tighter bounds could be applied depending on
  252|       |   * the data depth and mode, but this is sufficient to ensure safe decoding.)
  253|       |   */
  254|   112k|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 58.8k, False: 53.2k]
  ------------------
  255|   817k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 758k, False: 58.8k]
  ------------------
  256|   758k|      int sym = htbl->huffval[i];
  257|   758k|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 758k]
  |  Branch (257:22): [True: 252, False: 758k]
  |  Branch (257:29): [True: 45.5k, False: 712k]
  ------------------
  258|    252|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|    252|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    252|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  259|   758k|    }
  260|  58.8k|  }
  261|   112k|}
jpeg_fill_bit_buffer:
  291|   576k|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|   576k|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|   576k|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|   576k|  j_decompress_ptr cinfo = state->cinfo;
  296|       |
  297|       |  /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */
  298|       |  /* (It is assumed that no request will be for more than that many bits.) */
  299|       |  /* We fail to do so only if we hit a marker or are forced to suspend. */
  300|       |
  301|   576k|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 251k, False: 325k]
  ------------------
  302|  1.86M|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|  1.86M|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  1.86M|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 1.66M, False: 203k]
  ------------------
  303|  1.66M|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|  1.66M|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 48.0k, False: 1.61M]
  ------------------
  307|  48.0k|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 48.0k]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|  48.0k|        next_input_byte = cinfo->src->next_input_byte;
  310|  48.0k|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|  48.0k|      }
  312|  1.66M|      bytes_in_buffer--;
  313|  1.66M|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|  1.66M|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 80.4k, False: 1.58M]
  ------------------
  317|       |        /* Loop here to discard any padding FF's on terminating marker,
  318|       |         * so that we can save a valid unread_marker value.  NOTE: we will
  319|       |         * accept multiple FF's followed by a 0 as meaning a single FF data
  320|       |         * byte.  This data pattern is not valid according to the standard.
  321|       |         */
  322|   174k|        do {
  323|   174k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 1.71k, False: 172k]
  ------------------
  324|  1.71k|            if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (324:17): [True: 0, False: 1.71k]
  ------------------
  325|      0|              return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  326|  1.71k|            next_input_byte = cinfo->src->next_input_byte;
  327|  1.71k|            bytes_in_buffer = cinfo->src->bytes_in_buffer;
  328|  1.71k|          }
  329|   174k|          bytes_in_buffer--;
  330|   174k|          c = *next_input_byte++;
  331|   174k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 93.8k, False: 80.4k]
  ------------------
  332|       |
  333|  80.4k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 32.2k, False: 48.2k]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  32.2k|          c = 0xFF;
  336|  48.2k|        } else {
  337|       |          /* Oops, it's actually a marker indicating end of compressed data.
  338|       |           * Save the marker code for later use.
  339|       |           * Fine point: it might appear that we should save the marker into
  340|       |           * bitread working state, not straight into permanent state.  But
  341|       |           * once we have hit a marker, we cannot need to suspend within the
  342|       |           * current MCU, because we will read no more bytes from the data
  343|       |           * source.  So it is OK to update permanent state right away.
  344|       |           */
  345|  48.2k|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|  48.2k|          goto no_more_bytes;
  348|  48.2k|        }
  349|  80.4k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|  1.61M|      get_buffer = (get_buffer << 8) | c;
  353|  1.61M|      bits_left += 8;
  354|  1.61M|    } /* end while */
  355|   325k|  } else {
  356|   373k|no_more_bytes:
  357|       |    /* We get here if we've read the marker that terminates the compressed
  358|       |     * data segment.  There should be enough bits in the buffer register
  359|       |     * to satisfy the request; if so, no problem.
  360|       |     */
  361|   373k|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 150k, False: 222k]
  ------------------
  362|       |      /* Uh-oh.  Report corrupted data to user and stuff zeroes into
  363|       |       * the data stream, so that we can produce some kind of image.
  364|       |       * We use a nonvolatile flag to ensure that only one warning message
  365|       |       * appears per data segment.
  366|       |       */
  367|   150k|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 47.7k, False: 103k]
  ------------------
  368|  47.7k|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|  47.7k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  47.7k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|  47.7k|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  210|  47.7k|#define TRUE    1
  ------------------
  370|  47.7k|      }
  371|       |      /* Fill the buffer with zero bits */
  372|   150k|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|   150k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|   150k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|   150k|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|   150k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|   150k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|   150k|    }
  375|   373k|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|   576k|  state->next_input_byte = next_input_byte;
  379|   576k|  state->bytes_in_buffer = bytes_in_buffer;
  380|   576k|  state->get_buffer = get_buffer;
  381|   576k|  state->bits_left = bits_left;
  382|       |
  383|   576k|  return TRUE;
  ------------------
  |  |  210|   576k|#define TRUE    1
  ------------------
  384|   576k|}
jpeg_huff_decode:
  439|   490k|{
  440|   490k|  register int l = min_bits;
  441|   490k|  register JLONG code;
  442|       |
  443|       |  /* HUFF_DECODE has determined that the code is at least min_bits */
  444|       |  /* bits long, so fetch that many bits in one swoop. */
  445|       |
  446|   490k|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|   490k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   490k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 35.2k, False: 455k]
  |  |  ------------------
  |  |  162|  35.2k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 35.2k]
  |  |  ------------------
  |  |  163|  35.2k|      { action; } \
  |  |  164|  35.2k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  35.2k|  } \
  |  |  166|   490k|}
  ------------------
  447|   490k|  code = GET_BITS(l);
  ------------------
  |  |  169|   490k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  448|       |
  449|       |  /* Collect the rest of the Huffman code one bit at a time. */
  450|       |  /* This is per Figure F.16. */
  451|       |
  452|  2.99M|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 2.50M, False: 490k]
  ------------------
  453|  2.50M|    code <<= 1;
  454|  2.50M|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|  2.50M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  2.50M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 90.9k, False: 2.41M]
  |  |  ------------------
  |  |  162|  90.9k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 90.9k]
  |  |  ------------------
  |  |  163|  90.9k|      { action; } \
  |  |  164|  90.9k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  90.9k|  } \
  |  |  166|  2.50M|}
  ------------------
  455|  2.50M|    code |= GET_BITS(1);
  ------------------
  |  |  169|  2.50M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|  2.50M|    l++;
  457|  2.50M|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|   490k|  state->get_buffer = get_buffer;
  461|   490k|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|   490k|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 236k, False: 253k]
  ------------------
  466|   236k|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|   236k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|   236k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|   236k|    return 0;                   /* fake a zero as the safest result */
  468|   236k|  }
  469|       |
  470|   253k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|   490k|}
jinit_huff_decoder:
  815|  44.5k|{
  816|  44.5k|  huff_entropy_ptr entropy;
  817|  44.5k|  int i;
  818|       |
  819|       |  /* Motion JPEG frames typically do not include the Huffman tables if they
  820|       |     are the default tables.  Thus, if the tables are not set by the time
  821|       |     the Huffman decoder is initialized (usually within the body of
  822|       |     jpeg_start_decompress()), we set them to default values. */
  823|  44.5k|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|  44.5k|  entropy = (huff_entropy_ptr)
  826|  44.5k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  44.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  827|  44.5k|                                sizeof(huff_entropy_decoder));
  828|  44.5k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|  44.5k|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|  44.5k|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|   222k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|   222k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 178k, False: 44.5k]
  ------------------
  834|       |    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|   178k|  }
  836|  44.5k|}
jdhuff.c:start_pass_huff_decoder:
   80|  46.2k|{
   81|  46.2k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|  46.2k|  int ci, blkn, dctbl, actbl;
   83|  46.2k|  d_derived_tbl **pdtbl;
   84|  46.2k|  jpeg_component_info *compptr;
   85|       |
   86|       |  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
   87|       |   * This ought to be an error condition, but we make it a warning because
   88|       |   * there are some baseline files out there with all zeroes in these bytes.
   89|       |   */
   90|  46.2k|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|  43.0k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 3.22k, False: 43.0k]
  |  Branch (90:25): [True: 7.24k, False: 35.8k]
  ------------------
   91|  35.8k|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 188, False: 35.6k]
  |  Branch (91:25): [True: 260, False: 35.3k]
  ------------------
   92|  10.9k|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|  10.9k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  10.9k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   93|       |
   94|  95.0k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 48.7k, False: 46.2k]
  ------------------
   95|  48.7k|    compptr = cinfo->cur_comp_info[ci];
   96|  48.7k|    dctbl = compptr->dc_tbl_no;
   97|  48.7k|    actbl = compptr->ac_tbl_no;
   98|       |    /* Compute derived values for Huffman tables */
   99|       |    /* We may do this more than once for a table, but it's not expensive */
  100|  48.7k|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|  48.7k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  210|  48.7k|#define TRUE    1
  ------------------
  102|  48.7k|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|  48.7k|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  207|  48.7k|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|  48.7k|    entropy->saved.last_dc_val[ci] = 0;
  106|  48.7k|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|  94.7k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 48.4k, False: 46.2k]
  ------------------
  110|  48.4k|    ci = cinfo->MCU_membership[blkn];
  111|  48.4k|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|  48.4k|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|  48.4k|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  115|       |    /* Decide whether we really care about the coefficient values */
  116|  48.4k|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 48.4k, False: 0]
  ------------------
  117|  48.4k|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  210|  48.4k|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|  48.4k|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|  48.4k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|  48.4k|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|  48.4k|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|  46.2k|  entropy->bitstate.bits_left = 0;
  127|  46.2k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|  46.2k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  46.2k|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|  46.2k|  entropy->restarts_to_go = cinfo->restart_interval;
  132|  46.2k|}
jdhuff.c:decode_mcu:
  771|   105M|{
  772|   105M|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|   105M|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|   105M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 5.59M, False: 99.5M]
  ------------------
  777|  5.59M|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (777:9): [True: 3.86k, False: 5.58M]
  ------------------
  778|  3.86k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (778:11): [True: 0, False: 3.86k]
  ------------------
  779|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  780|  5.59M|    usefast = 0;
  781|  5.59M|  }
  782|       |
  783|   105M|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|   105M|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   67|   105M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 71.0M, False: 34.0M]
  ------------------
  784|  34.0M|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 33.9M, False: 95.7k]
  ------------------
  785|   105M|    usefast = 0;
  786|       |
  787|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  788|       |   * This way, we return uniform gray for the remainder of the segment.
  789|       |   */
  790|   105M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 569k, False: 104M]
  ------------------
  791|       |
  792|   569k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 94.8k, False: 474k]
  ------------------
  793|  94.8k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 5.82k, False: 89.0k]
  ------------------
  794|   474k|    } else {
  795|   480k|use_slow:
  796|   480k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 480k]
  ------------------
  797|   480k|    }
  798|       |
  799|   569k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|   105M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 5.58M, False: 99.5M]
  ------------------
  803|  5.58M|    entropy->restarts_to_go--;
  804|       |
  805|   105M|  return TRUE;
  ------------------
  |  |  210|   105M|#define TRUE    1
  ------------------
  806|   105M|}
jdhuff.c:process_restart:
  513|  3.86k|{
  514|  3.86k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  515|  3.86k|  int ci;
  516|       |
  517|       |  /* Throw away any unused bits remaining in bit buffer; */
  518|       |  /* include any full bytes in next_marker's count of discarded bytes */
  519|  3.86k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  520|  3.86k|  entropy->bitstate.bits_left = 0;
  521|       |
  522|       |  /* Advance past the RSTn marker */
  523|  3.86k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (523:7): [True: 0, False: 3.86k]
  ------------------
  524|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  525|       |
  526|       |  /* Re-initialize DC predictions to 0 */
  527|  6.91k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (527:16): [True: 3.04k, False: 3.86k]
  ------------------
  528|  3.04k|    entropy->saved.last_dc_val[ci] = 0;
  529|       |
  530|       |  /* Reset restart counter */
  531|  3.86k|  entropy->restarts_to_go = cinfo->restart_interval;
  532|       |
  533|       |  /* Reset out-of-data flag, unless read_restart_marker left us smack up
  534|       |   * against a marker.  In that case we will end up treating the next data
  535|       |   * segment as empty, and we can avoid producing bogus output pixels by
  536|       |   * leaving the flag set.
  537|       |   */
  538|  3.86k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (538:7): [True: 2.27k, False: 1.59k]
  ------------------
  539|  2.27k|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  2.27k|#define FALSE   0               /* values of boolean */
  ------------------
  540|       |
  541|  3.86k|  return TRUE;
  ------------------
  |  |  210|  3.86k|#define TRUE    1
  ------------------
  542|  3.86k|}
jdhuff.c:decode_mcu_fast:
  664|  94.8k|{
  665|  94.8k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|  94.8k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  94.8k|  register bit_buf_type get_buffer; \
  |  |  126|  94.8k|  register int bits_left; \
  |  |  127|  94.8k|  bitread_working_state br_state
  ------------------
  667|  94.8k|  JOCTET *buffer;
  668|  94.8k|  int blkn;
  669|  94.8k|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|  94.8k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  94.8k|  br_state.cinfo = cinfop; \
  |  |  131|  94.8k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  94.8k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  94.8k|  get_buffer = permstate.get_buffer; \
  |  |  134|  94.8k|  bits_left = permstate.bits_left;
  ------------------
  674|  94.8k|  buffer = (JOCTET *)br_state.next_input_byte;
  675|  94.8k|  state = entropy->saved;
  676|       |
  677|   191k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 96.5k, False: 94.8k]
  ------------------
  678|  96.5k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 96.5k, False: 0]
  ------------------
  679|  96.5k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|  96.5k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|  96.5k|    register int s, k, r, l;
  682|       |
  683|  96.5k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|  96.5k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|  96.5k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 17.6k, False: 78.9k]
  |  |  |  |  ------------------
  |  |  |  |  416|  17.6k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  17.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  17.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  17.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  17.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  17.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  17.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  17.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  17.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.29k, False: 16.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.29k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.29k|    buffer++; \
  |  |  |  |  |  |  401|  1.29k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 650, False: 646]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    650|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    650|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    650|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    650|      buffer -= 2; \
  |  |  |  |  |  |  406|    650|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    650|    } \
  |  |  |  |  |  |  408|  1.29k|  } \
  |  |  |  |  |  |  409|  17.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  17.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  17.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  17.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  17.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  17.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  17.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  17.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  17.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.56k, False: 16.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.56k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.56k|    buffer++; \
  |  |  |  |  |  |  401|  1.56k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.02k, False: 540]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.02k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.02k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.02k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.02k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.02k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.02k|    } \
  |  |  |  |  |  |  408|  1.56k|  } \
  |  |  |  |  |  |  409|  17.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  17.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  17.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  17.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  17.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  17.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  17.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  17.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  17.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.77k, False: 13.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.77k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.77k|    buffer++; \
  |  |  |  |  |  |  401|  3.77k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 2.69k, False: 1.08k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  2.69k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  2.69k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  2.69k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  2.69k|      buffer -= 2; \
  |  |  |  |  |  |  406|  2.69k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  2.69k|    } \
  |  |  |  |  |  |  408|  3.77k|  } \
  |  |  |  |  |  |  409|  17.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  17.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  17.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  17.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  17.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  17.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  17.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  17.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  17.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.31k, False: 14.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.31k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.31k|    buffer++; \
  |  |  |  |  |  |  401|  3.31k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.02k, False: 294]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.02k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.02k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.02k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.02k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.02k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.02k|    } \
  |  |  |  |  |  |  408|  3.31k|  } \
  |  |  |  |  |  |  409|  17.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  17.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  17.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  17.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  17.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  17.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  17.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  17.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  17.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.93k, False: 13.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.93k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.93k|    buffer++; \
  |  |  |  |  |  |  401|  3.93k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.12k, False: 807]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.12k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.12k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.12k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.12k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.12k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.12k|    } \
  |  |  |  |  |  |  408|  3.93k|  } \
  |  |  |  |  |  |  409|  17.6k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  17.6k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  17.6k|  register int c0, c1; \
  |  |  |  |  |  |  393|  17.6k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  17.6k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  17.6k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  17.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  17.6k|  bits_left += 8; \
  |  |  |  |  |  |  398|  17.6k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.54k, False: 14.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.54k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.54k|    buffer++; \
  |  |  |  |  |  |  401|  3.54k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.20k, False: 341]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.20k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.20k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.20k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.20k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.20k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.20k|    } \
  |  |  |  |  |  |  408|  3.54k|  } \
  |  |  |  |  |  |  409|  17.6k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  17.6k|  }
  |  |  ------------------
  |  |  225|  96.5k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  96.5k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|  96.5k|  s = htbl->lookup[s]; \
  |  |  227|  96.5k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|  96.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|  96.5k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|  96.5k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  96.5k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|  96.5k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  96.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|  96.5k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   193k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 18.8k, False: 77.7k]
  |  |  ------------------
  |  |  232|  18.8k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  18.8k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  18.8k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   158k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 139k, False: 18.8k]
  |  |  ------------------
  |  |  236|   139k|      s <<= 1; \
  |  |  237|   139k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|   139k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|   139k|      nb++; \
  |  |  239|   139k|    } \
  |  |  240|  18.8k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 17.4k, False: 1.40k]
  |  |  ------------------
  |  |  241|  18.8k|      s = 0; \
  |  |  242|  18.8k|    else \
  |  |  243|  18.8k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  18.8k|  }
  ------------------
  684|  96.5k|    if (s) {
  ------------------
  |  Branch (684:9): [True: 8.16k, False: 88.3k]
  ------------------
  685|  8.16k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  8.16k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 3.08k, False: 5.07k]
  |  |  ------------------
  |  |  416|  3.08k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.08k|#define GET_BYTE { \
  |  |  |  |  392|  3.08k|  register int c0, c1; \
  |  |  |  |  393|  3.08k|  c0 = *buffer++; \
  |  |  |  |  394|  3.08k|  c1 = *buffer; \
  |  |  |  |  395|  3.08k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.08k|  bits_left += 8; \
  |  |  |  |  398|  3.08k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 685, False: 2.40k]
  |  |  |  |  ------------------
  |  |  |  |  399|    685|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    685|    buffer++; \
  |  |  |  |  401|    685|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 361, False: 324]
  |  |  |  |  ------------------
  |  |  |  |  402|    361|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    361|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    361|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    361|      buffer -= 2; \
  |  |  |  |  406|    361|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    361|    } \
  |  |  |  |  408|    685|  } \
  |  |  |  |  409|  3.08k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.08k|#define GET_BYTE { \
  |  |  |  |  392|  3.08k|  register int c0, c1; \
  |  |  |  |  393|  3.08k|  c0 = *buffer++; \
  |  |  |  |  394|  3.08k|  c1 = *buffer; \
  |  |  |  |  395|  3.08k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.08k|  bits_left += 8; \
  |  |  |  |  398|  3.08k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 759, False: 2.33k]
  |  |  |  |  ------------------
  |  |  |  |  399|    759|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    759|    buffer++; \
  |  |  |  |  401|    759|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 380, False: 379]
  |  |  |  |  ------------------
  |  |  |  |  402|    380|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    380|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    380|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    380|      buffer -= 2; \
  |  |  |  |  406|    380|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    380|    } \
  |  |  |  |  408|    759|  } \
  |  |  |  |  409|  3.08k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.08k|#define GET_BYTE { \
  |  |  |  |  392|  3.08k|  register int c0, c1; \
  |  |  |  |  393|  3.08k|  c0 = *buffer++; \
  |  |  |  |  394|  3.08k|  c1 = *buffer; \
  |  |  |  |  395|  3.08k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.08k|  bits_left += 8; \
  |  |  |  |  398|  3.08k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 918, False: 2.17k]
  |  |  |  |  ------------------
  |  |  |  |  399|    918|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    918|    buffer++; \
  |  |  |  |  401|    918|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 432, False: 486]
  |  |  |  |  ------------------
  |  |  |  |  402|    432|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    432|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    432|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    432|      buffer -= 2; \
  |  |  |  |  406|    432|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    432|    } \
  |  |  |  |  408|    918|  } \
  |  |  |  |  409|  3.08k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.08k|#define GET_BYTE { \
  |  |  |  |  392|  3.08k|  register int c0, c1; \
  |  |  |  |  393|  3.08k|  c0 = *buffer++; \
  |  |  |  |  394|  3.08k|  c1 = *buffer; \
  |  |  |  |  395|  3.08k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.08k|  bits_left += 8; \
  |  |  |  |  398|  3.08k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 777, False: 2.31k]
  |  |  |  |  ------------------
  |  |  |  |  399|    777|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    777|    buffer++; \
  |  |  |  |  401|    777|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 439, False: 338]
  |  |  |  |  ------------------
  |  |  |  |  402|    439|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    439|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    439|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    439|      buffer -= 2; \
  |  |  |  |  406|    439|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    439|    } \
  |  |  |  |  408|    777|  } \
  |  |  |  |  409|  3.08k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.08k|#define GET_BYTE { \
  |  |  |  |  392|  3.08k|  register int c0, c1; \
  |  |  |  |  393|  3.08k|  c0 = *buffer++; \
  |  |  |  |  394|  3.08k|  c1 = *buffer; \
  |  |  |  |  395|  3.08k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.08k|  bits_left += 8; \
  |  |  |  |  398|  3.08k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.46k, False: 1.62k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.46k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.46k|    buffer++; \
  |  |  |  |  401|  1.46k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 440, False: 1.02k]
  |  |  |  |  ------------------
  |  |  |  |  402|    440|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    440|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    440|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    440|      buffer -= 2; \
  |  |  |  |  406|    440|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    440|    } \
  |  |  |  |  408|  1.46k|  } \
  |  |  |  |  409|  3.08k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  3.08k|#define GET_BYTE { \
  |  |  |  |  392|  3.08k|  register int c0, c1; \
  |  |  |  |  393|  3.08k|  c0 = *buffer++; \
  |  |  |  |  394|  3.08k|  c1 = *buffer; \
  |  |  |  |  395|  3.08k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  3.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  3.08k|  bits_left += 8; \
  |  |  |  |  398|  3.08k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 854, False: 2.23k]
  |  |  |  |  ------------------
  |  |  |  |  399|    854|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    854|    buffer++; \
  |  |  |  |  401|    854|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 441, False: 413]
  |  |  |  |  ------------------
  |  |  |  |  402|    441|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    441|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    441|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    441|      buffer -= 2; \
  |  |  |  |  406|    441|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    441|    } \
  |  |  |  |  408|    854|  } \
  |  |  |  |  409|  3.08k|}
  |  |  ------------------
  |  |  417|  3.08k|  }
  ------------------
  686|  8.16k|      r = GET_BITS(s);
  ------------------
  |  |  169|  8.16k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|  8.16k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  8.16k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  8.16k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|  8.16k|    }
  689|       |
  690|  96.5k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 96.5k, False: 0]
  ------------------
  691|  96.5k|      int ci = cinfo->MCU_membership[blkn];
  692|       |      /* Refer to the comment in decode_mcu_slow() regarding the supression of
  693|       |       * a UBSan integer overflow error in this line of code.
  694|       |       */
  695|  96.5k|      s += state.last_dc_val[ci];
  696|  96.5k|      state.last_dc_val[ci] = s;
  697|  96.5k|      if (block)
  ------------------
  |  Branch (697:11): [True: 96.5k, False: 0]
  ------------------
  698|  96.5k|        (*block)[0] = (JCOEF)s;
  699|  96.5k|    }
  700|       |
  701|  96.5k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 96.5k, False: 0]
  |  Branch (701:37): [True: 96.5k, False: 0]
  ------------------
  702|       |
  703|   253k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|   253k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 251k, False: 1.91k]
  ------------------
  704|   251k|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|   251k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   251k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 16.1k, False: 235k]
  |  |  |  |  ------------------
  |  |  |  |  416|  16.1k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  16.1k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  16.1k|  register int c0, c1; \
  |  |  |  |  |  |  393|  16.1k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  16.1k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  16.1k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  16.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  16.1k|  bits_left += 8; \
  |  |  |  |  |  |  398|  16.1k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 4.19k, False: 11.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  4.19k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  4.19k|    buffer++; \
  |  |  |  |  |  |  401|  4.19k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.65k, False: 549]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.65k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.65k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.65k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.65k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.65k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.65k|    } \
  |  |  |  |  |  |  408|  4.19k|  } \
  |  |  |  |  |  |  409|  16.1k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  16.1k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  16.1k|  register int c0, c1; \
  |  |  |  |  |  |  393|  16.1k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  16.1k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  16.1k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  16.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  16.1k|  bits_left += 8; \
  |  |  |  |  |  |  398|  16.1k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 4.25k, False: 11.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  4.25k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  4.25k|    buffer++; \
  |  |  |  |  |  |  401|  4.25k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 3.83k, False: 420]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  3.83k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  3.83k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  3.83k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  3.83k|      buffer -= 2; \
  |  |  |  |  |  |  406|  3.83k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  3.83k|    } \
  |  |  |  |  |  |  408|  4.25k|  } \
  |  |  |  |  |  |  409|  16.1k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  16.1k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  16.1k|  register int c0, c1; \
  |  |  |  |  |  |  393|  16.1k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  16.1k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  16.1k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  16.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  16.1k|  bits_left += 8; \
  |  |  |  |  |  |  398|  16.1k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5.69k, False: 10.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  5.69k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  5.69k|    buffer++; \
  |  |  |  |  |  |  401|  5.69k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 4.54k, False: 1.15k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  4.54k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  4.54k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  4.54k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  4.54k|      buffer -= 2; \
  |  |  |  |  |  |  406|  4.54k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  4.54k|    } \
  |  |  |  |  |  |  408|  5.69k|  } \
  |  |  |  |  |  |  409|  16.1k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  16.1k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  16.1k|  register int c0, c1; \
  |  |  |  |  |  |  393|  16.1k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  16.1k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  16.1k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  16.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  16.1k|  bits_left += 8; \
  |  |  |  |  |  |  398|  16.1k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5.45k, False: 10.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  5.45k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  5.45k|    buffer++; \
  |  |  |  |  |  |  401|  5.45k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 4.64k, False: 807]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  4.64k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  4.64k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  4.64k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  4.64k|      buffer -= 2; \
  |  |  |  |  |  |  406|  4.64k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  4.64k|    } \
  |  |  |  |  |  |  408|  5.45k|  } \
  |  |  |  |  |  |  409|  16.1k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  16.1k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  16.1k|  register int c0, c1; \
  |  |  |  |  |  |  393|  16.1k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  16.1k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  16.1k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  16.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  16.1k|  bits_left += 8; \
  |  |  |  |  |  |  398|  16.1k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5.44k, False: 10.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  5.44k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  5.44k|    buffer++; \
  |  |  |  |  |  |  401|  5.44k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 4.73k, False: 717]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  4.73k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  4.73k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  4.73k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  4.73k|      buffer -= 2; \
  |  |  |  |  |  |  406|  4.73k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  4.73k|    } \
  |  |  |  |  |  |  408|  5.44k|  } \
  |  |  |  |  |  |  409|  16.1k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  16.1k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  16.1k|  register int c0, c1; \
  |  |  |  |  |  |  393|  16.1k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  16.1k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  16.1k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  16.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  16.1k|  bits_left += 8; \
  |  |  |  |  |  |  398|  16.1k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 5.23k, False: 10.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  5.23k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  5.23k|    buffer++; \
  |  |  |  |  |  |  401|  5.23k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 4.76k, False: 467]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  4.76k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  4.76k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  4.76k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  4.76k|      buffer -= 2; \
  |  |  |  |  |  |  406|  4.76k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  4.76k|    } \
  |  |  |  |  |  |  408|  5.23k|  } \
  |  |  |  |  |  |  409|  16.1k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  16.1k|  }
  |  |  ------------------
  |  |  225|   251k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   251k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   251k|  s = htbl->lookup[s]; \
  |  |  227|   251k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   251k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   251k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   251k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   251k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   251k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   251k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   251k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   502k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 44.4k, False: 206k]
  |  |  ------------------
  |  |  232|  44.4k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  44.4k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  44.4k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   278k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 233k, False: 44.4k]
  |  |  ------------------
  |  |  236|   233k|      s <<= 1; \
  |  |  237|   233k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|   233k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|   233k|      nb++; \
  |  |  239|   233k|    } \
  |  |  240|  44.4k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 26.1k, False: 18.3k]
  |  |  ------------------
  |  |  241|  44.4k|      s = 0; \
  |  |  242|  44.4k|    else \
  |  |  243|  44.4k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  44.4k|  }
  ------------------
  705|   251k|        r = s >> 4;
  706|   251k|        s &= 15;
  707|       |
  708|   251k|        if (s) {
  ------------------
  |  Branch (708:13): [True: 156k, False: 95.1k]
  ------------------
  709|   156k|          k += r;
  710|   156k|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|   156k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 11.7k, False: 144k]
  |  |  ------------------
  |  |  416|  11.7k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  11.7k|#define GET_BYTE { \
  |  |  |  |  392|  11.7k|  register int c0, c1; \
  |  |  |  |  393|  11.7k|  c0 = *buffer++; \
  |  |  |  |  394|  11.7k|  c1 = *buffer; \
  |  |  |  |  395|  11.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  11.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  11.7k|  bits_left += 8; \
  |  |  |  |  398|  11.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.94k, False: 7.81k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.94k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.94k|    buffer++; \
  |  |  |  |  401|  3.94k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.11k, False: 835]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.11k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.11k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.11k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.11k|      buffer -= 2; \
  |  |  |  |  406|  3.11k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.11k|    } \
  |  |  |  |  408|  3.94k|  } \
  |  |  |  |  409|  11.7k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  11.7k|#define GET_BYTE { \
  |  |  |  |  392|  11.7k|  register int c0, c1; \
  |  |  |  |  393|  11.7k|  c0 = *buffer++; \
  |  |  |  |  394|  11.7k|  c1 = *buffer; \
  |  |  |  |  395|  11.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  11.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  11.7k|  bits_left += 8; \
  |  |  |  |  398|  11.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.54k, False: 8.22k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.54k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.54k|    buffer++; \
  |  |  |  |  401|  3.54k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.14k, False: 403]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.14k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.14k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.14k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.14k|      buffer -= 2; \
  |  |  |  |  406|  3.14k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.14k|    } \
  |  |  |  |  408|  3.54k|  } \
  |  |  |  |  409|  11.7k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  11.7k|#define GET_BYTE { \
  |  |  |  |  392|  11.7k|  register int c0, c1; \
  |  |  |  |  393|  11.7k|  c0 = *buffer++; \
  |  |  |  |  394|  11.7k|  c1 = *buffer; \
  |  |  |  |  395|  11.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  11.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  11.7k|  bits_left += 8; \
  |  |  |  |  398|  11.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.34k, False: 7.42k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.34k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.34k|    buffer++; \
  |  |  |  |  401|  4.34k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.47k, False: 869]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.47k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.47k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.47k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.47k|      buffer -= 2; \
  |  |  |  |  406|  3.47k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.47k|    } \
  |  |  |  |  408|  4.34k|  } \
  |  |  |  |  409|  11.7k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  11.7k|#define GET_BYTE { \
  |  |  |  |  392|  11.7k|  register int c0, c1; \
  |  |  |  |  393|  11.7k|  c0 = *buffer++; \
  |  |  |  |  394|  11.7k|  c1 = *buffer; \
  |  |  |  |  395|  11.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  11.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  11.7k|  bits_left += 8; \
  |  |  |  |  398|  11.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.60k, False: 7.16k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.60k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.60k|    buffer++; \
  |  |  |  |  401|  4.60k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.62k, False: 973]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.62k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.62k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.62k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.62k|      buffer -= 2; \
  |  |  |  |  406|  3.62k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.62k|    } \
  |  |  |  |  408|  4.60k|  } \
  |  |  |  |  409|  11.7k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  11.7k|#define GET_BYTE { \
  |  |  |  |  392|  11.7k|  register int c0, c1; \
  |  |  |  |  393|  11.7k|  c0 = *buffer++; \
  |  |  |  |  394|  11.7k|  c1 = *buffer; \
  |  |  |  |  395|  11.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  11.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  11.7k|  bits_left += 8; \
  |  |  |  |  398|  11.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.20k, False: 7.55k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.20k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.20k|    buffer++; \
  |  |  |  |  401|  4.20k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.64k, False: 559]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.64k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.64k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.64k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.64k|      buffer -= 2; \
  |  |  |  |  406|  3.64k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.64k|    } \
  |  |  |  |  408|  4.20k|  } \
  |  |  |  |  409|  11.7k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  11.7k|#define GET_BYTE { \
  |  |  |  |  392|  11.7k|  register int c0, c1; \
  |  |  |  |  393|  11.7k|  c0 = *buffer++; \
  |  |  |  |  394|  11.7k|  c1 = *buffer; \
  |  |  |  |  395|  11.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  11.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  11.7k|  bits_left += 8; \
  |  |  |  |  398|  11.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.39k, False: 7.36k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.39k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.39k|    buffer++; \
  |  |  |  |  401|  4.39k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.67k, False: 727]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.67k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.67k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.67k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.67k|      buffer -= 2; \
  |  |  |  |  406|  3.67k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.67k|    } \
  |  |  |  |  408|  4.39k|  } \
  |  |  |  |  409|  11.7k|}
  |  |  ------------------
  |  |  417|  11.7k|  }
  ------------------
  711|   156k|          r = GET_BITS(s);
  ------------------
  |  |  169|   156k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|   156k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   156k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   156k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|   156k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|   156k|        } else {
  715|  95.1k|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 94.6k, False: 503]
  ------------------
  716|    503|          k += 15;
  717|    503|        }
  718|   251k|      }
  719|       |
  720|  96.5k|    } else {
  721|       |
  722|      0|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (722:19): [True: 0, False: 0]
  ------------------
  723|      0|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|      0|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|      0|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|      0|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |  417|      0|  }
  |  |  ------------------
  |  |  225|      0|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|      0|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|      0|  s = htbl->lookup[s]; \
  |  |  227|      0|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|      0|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|      0|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|      0|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|      0|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|      0|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  232|      0|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|      0|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|      0|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|      0|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  236|      0|      s <<= 1; \
  |  |  237|      0|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|      0|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|      0|      nb++; \
  |  |  239|      0|    } \
  |  |  240|      0|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  241|      0|      s = 0; \
  |  |  242|      0|    else \
  |  |  243|      0|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|      0|  }
  ------------------
  724|      0|        r = s >> 4;
  725|      0|        s &= 15;
  726|       |
  727|      0|        if (s) {
  ------------------
  |  Branch (727:13): [True: 0, False: 0]
  ------------------
  728|      0|          k += r;
  729|      0|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|      0|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  416|      0|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |  417|      0|  }
  ------------------
  730|      0|          DROP_BITS(s);
  ------------------
  |  |  175|      0|  (bits_left -= (nbits))
  ------------------
  731|      0|        } else {
  732|      0|          if (r != 15) break;
  ------------------
  |  Branch (732:15): [True: 0, False: 0]
  ------------------
  733|      0|          k += 15;
  734|      0|        }
  735|      0|      }
  736|      0|    }
  737|  96.5k|  }
  738|       |
  739|  94.8k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 5.82k, False: 89.0k]
  ------------------
  740|  5.82k|    cinfo->unread_marker = 0;
  741|  5.82k|    return FALSE;
  ------------------
  |  |  207|  5.82k|#define FALSE   0               /* values of boolean */
  ------------------
  742|  5.82k|  }
  743|       |
  744|  89.0k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|  89.0k|  br_state.next_input_byte = buffer;
  746|  89.0k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  89.0k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  89.0k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  89.0k|  permstate.get_buffer = get_buffer; \
  |  |  140|  89.0k|  permstate.bits_left = bits_left
  ------------------
  747|  89.0k|  entropy->saved = state;
  748|  89.0k|  return TRUE;
  ------------------
  |  |  210|  89.0k|#define TRUE    1
  ------------------
  749|  94.8k|}
jdhuff.c:decode_mcu_slow:
  553|   480k|{
  554|   480k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|   480k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   480k|  register bit_buf_type get_buffer; \
  |  |  126|   480k|  register int bits_left; \
  |  |  127|   480k|  bitread_working_state br_state
  ------------------
  556|   480k|  int blkn;
  557|   480k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|   480k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   480k|  br_state.cinfo = cinfop; \
  |  |  131|   480k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   480k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   480k|  get_buffer = permstate.get_buffer; \
  |  |  134|   480k|  bits_left = permstate.bits_left;
  ------------------
  562|   480k|  state = entropy->saved;
  563|       |
  564|   962k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 486k, False: 476k]
  ------------------
  565|   486k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 486k, False: 0]
  ------------------
  566|   486k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|   486k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|   486k|    register int s, k, r;
  569|       |
  570|       |    /* Decode a single block's worth of coefficients */
  571|       |
  572|       |    /* Section F.2.2.1: decode the DC coefficient difference */
  573|   486k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|   486k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   486k|  register int nb, look; \
  |  |  202|   486k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   486k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 99.8k, False: 386k]
  |  |  ------------------
  |  |  203|  99.8k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 99.8k]
  |  |  ------------------
  |  |  204|  99.8k|      { failaction; } \
  |  |  205|  99.8k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  99.8k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  99.8k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 17.1k, False: 82.6k]
  |  |  ------------------
  |  |  207|  17.1k|      nb = 1;  goto slowlabel; \
  |  |  208|  17.1k|    } \
  |  |  209|  99.8k|  } \
  |  |  210|   486k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   469k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   469k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   469k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   469k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 388k, False: 80.8k]
  |  |  ------------------
  |  |  212|   388k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   388k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   388k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   388k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   388k|  } else { \
  |  |  215|  94.8k|slowlabel: \
  |  |  216|  94.8k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 94.8k]
  |  |  ------------------
  |  |  217|  94.8k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  94.8k|      { failaction; } \
  |  |  219|  94.8k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  94.8k|  } \
  |  |  221|   469k|}
  ------------------
  574|   483k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 87.3k, False: 395k]
  ------------------
  575|  87.3k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  87.3k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  87.3k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 3.05k, False: 84.3k]
  |  |  ------------------
  |  |  162|  3.05k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 3.05k]
  |  |  ------------------
  |  |  163|  3.05k|      { action; } \
  |  |  164|  3.05k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  3.05k|  } \
  |  |  166|  87.3k|}
  ------------------
  576|  87.3k|      r = GET_BITS(s);
  ------------------
  |  |  169|  87.3k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|  87.3k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  87.3k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  87.3k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|  87.3k|    }
  579|       |
  580|   483k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 483k, False: 0]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|   483k|      int ci = cinfo->MCU_membership[blkn];
  583|       |      /* Certain malformed JPEG images produce repeated DC coefficient
  584|       |       * differences of 2047 or -2047, which causes state.last_dc_val[ci] to
  585|       |       * grow until it overflows or underflows a 32-bit signed integer.  This
  586|       |       * behavior is, to the best of our understanding, innocuous, and it is
  587|       |       * unclear how to work around it without potentially affecting
  588|       |       * performance.  Thus, we (hopefully temporarily) suppress UBSan integer
  589|       |       * overflow errors for this function and decode_mcu_fast().
  590|       |       */
  591|   483k|      s += state.last_dc_val[ci];
  592|   483k|      state.last_dc_val[ci] = s;
  593|   483k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 483k, False: 0]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|   483k|        (*block)[0] = (JCOEF)s;
  596|   483k|      }
  597|   483k|    }
  598|       |
  599|   483k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 483k, False: 0]
  |  Branch (599:37): [True: 483k, False: 0]
  ------------------
  600|       |
  601|       |      /* Section F.2.2.2: decode the AC coefficients */
  602|       |      /* Since zeroes are skipped, output area must be cleared beforehand */
  603|  2.14M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  2.14M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 2.11M, False: 28.4k]
  ------------------
  604|  2.11M|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|  2.11M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  2.11M|  register int nb, look; \
  |  |  202|  2.11M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.11M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 229k, False: 1.88M]
  |  |  ------------------
  |  |  203|   229k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 229k]
  |  |  ------------------
  |  |  204|   229k|      { failaction; } \
  |  |  205|   229k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|   229k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   229k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 149k, False: 80.2k]
  |  |  ------------------
  |  |  207|   149k|      nb = 1;  goto slowlabel; \
  |  |  208|   149k|    } \
  |  |  209|   229k|  } \
  |  |  210|  2.11M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  1.96M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  1.96M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.96M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.96M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 1.75M, False: 209k]
  |  |  ------------------
  |  |  212|  1.75M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  1.75M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  1.75M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  1.75M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  1.75M|  } else { \
  |  |  215|   358k|slowlabel: \
  |  |  216|   358k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 358k]
  |  |  ------------------
  |  |  217|   358k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|   358k|      { failaction; } \
  |  |  219|   358k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|   358k|  } \
  |  |  221|  1.96M|}
  ------------------
  605|       |
  606|  2.11M|        r = s >> 4;
  607|  2.11M|        s &= 15;
  608|       |
  609|  2.11M|        if (s) {
  ------------------
  |  Branch (609:13): [True: 1.65M, False: 457k]
  ------------------
  610|  1.65M|          k += r;
  611|  1.65M|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  1.65M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.65M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 56.3k, False: 1.60M]
  |  |  ------------------
  |  |  162|  56.3k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 56.3k]
  |  |  ------------------
  |  |  163|  56.3k|      { action; } \
  |  |  164|  56.3k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  56.3k|  } \
  |  |  166|  1.65M|}
  ------------------
  612|  1.65M|          r = GET_BITS(s);
  ------------------
  |  |  169|  1.65M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|  1.65M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  1.65M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  1.65M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  614|       |          /* Output coefficient in natural (dezigzagged) order.
  615|       |           * Note: the extra entries in jpeg_natural_order[] will save us
  616|       |           * if k >= DCTSIZE2, which could happen if the data is corrupted.
  617|       |           */
  618|  1.65M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|  1.65M|        } else {
  620|   457k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 454k, False: 3.07k]
  ------------------
  621|   454k|            break;
  622|  3.07k|          k += 15;
  623|  3.07k|        }
  624|  2.11M|      }
  625|       |
  626|   483k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|      0|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 0, False: 0]
  ------------------
  631|      0|        HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
  ------------------
  |  |  200|      0|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|      0|  register int nb, look; \
  |  |  202|      0|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  203|      0|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  204|      0|      { failaction; } \
  |  |  205|      0|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|      0|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  207|      0|      nb = 1;  goto slowlabel; \
  |  |  208|      0|    } \
  |  |  209|      0|  } \
  |  |  210|      0|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|      0|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|      0|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  212|      0|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|      0|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|      0|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|      0|  } else { \
  |  |  215|      0|slowlabel: \
  |  |  216|      0|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  217|      0|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|      0|      { failaction; } \
  |  |  219|      0|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|      0|  } \
  |  |  221|      0|}
  ------------------
  632|       |
  633|      0|        r = s >> 4;
  634|      0|        s &= 15;
  635|       |
  636|      0|        if (s) {
  ------------------
  |  Branch (636:13): [True: 0, False: 0]
  ------------------
  637|      0|          k += r;
  638|      0|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|      0|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|      0|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  162|      0|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  163|      0|      { action; } \
  |  |  164|      0|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|      0|  } \
  |  |  166|      0|}
  ------------------
  639|      0|          DROP_BITS(s);
  ------------------
  |  |  175|      0|  (bits_left -= (nbits))
  ------------------
  640|      0|        } else {
  641|      0|          if (r != 15)
  ------------------
  |  Branch (641:15): [True: 0, False: 0]
  ------------------
  642|      0|            break;
  643|      0|          k += 15;
  644|      0|        }
  645|      0|      }
  646|      0|    }
  647|   483k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|   476k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   476k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   476k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   476k|  permstate.get_buffer = get_buffer; \
  |  |  140|   476k|  permstate.bits_left = bits_left
  ------------------
  651|   476k|  entropy->saved = state;
  652|   476k|  return TRUE;
  ------------------
  |  |  210|   476k|#define TRUE    1
  ------------------
  653|   480k|}

jinit_input_controller:
  405|  37.3k|{
  406|  37.3k|  my_inputctl_ptr inputctl;
  407|       |
  408|       |  /* Create subobject in permanent pool */
  409|  37.3k|  inputctl = (my_inputctl_ptr)
  410|  37.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  37.3k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  411|  37.3k|                                sizeof(my_input_controller));
  412|  37.3k|  cinfo->inputctl = (struct jpeg_input_controller *)inputctl;
  413|       |  /* Initialize method pointers */
  414|  37.3k|  inputctl->pub.consume_input = consume_markers;
  415|  37.3k|  inputctl->pub.reset_input_controller = reset_input_controller;
  416|  37.3k|  inputctl->pub.start_input_pass = start_input_pass;
  417|  37.3k|  inputctl->pub.finish_input_pass = finish_input_pass;
  418|       |  /* Initialize state: can't use reset_input_controller since we don't
  419|       |   * want to try to reset other modules yet.
  420|       |   */
  421|  37.3k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|  37.3k|#define FALSE   0               /* values of boolean */
  ------------------
  422|  37.3k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|  37.3k|#define FALSE   0               /* values of boolean */
  ------------------
  423|  37.3k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|  37.3k|#define TRUE    1
  ------------------
  424|  37.3k|}
jdinput.c:consume_markers:
  332|   219k|{
  333|   219k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  334|   219k|  int val;
  335|       |
  336|   219k|  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
  ------------------
  |  Branch (336:7): [True: 0, False: 219k]
  ------------------
  337|      0|    return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  338|       |
  339|   219k|  val = (*cinfo->marker->read_markers) (cinfo);
  340|       |
  341|   219k|  switch (val) {
  ------------------
  |  Branch (341:11): [True: 121k, False: 97.7k]
  ------------------
  342|  91.0k|  case JPEG_REACHED_SOS:        /* Found SOS */
  ------------------
  |  | 1111|  91.0k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (342:3): [True: 91.0k, False: 128k]
  ------------------
  343|  91.0k|    if (inputctl->inheaders) {  /* 1st SOS */
  ------------------
  |  Branch (343:9): [True: 81.0k, False: 10.0k]
  ------------------
  344|  81.0k|      initial_setup(cinfo);
  345|  81.0k|      inputctl->inheaders = FALSE;
  ------------------
  |  |  207|  81.0k|#define FALSE   0               /* values of boolean */
  ------------------
  346|       |      /* Note: start_input_pass must be called by jdmaster.c
  347|       |       * before any more input can be consumed.  jdapimin.c is
  348|       |       * responsible for enforcing this sequencing.
  349|       |       */
  350|  81.0k|    } else {                    /* 2nd or later SOS marker */
  351|  10.0k|      if (!inputctl->pub.has_multiple_scans)
  ------------------
  |  Branch (351:11): [True: 420, False: 9.58k]
  ------------------
  352|    420|        ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
  ------------------
  |  |  240|    420|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    420|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  353|  10.0k|      start_input_pass(cinfo);
  354|  10.0k|    }
  355|  91.0k|    break;
  356|  30.4k|  case JPEG_REACHED_EOI:        /* Found EOI */
  ------------------
  |  | 1112|  30.4k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (356:3): [True: 30.4k, False: 188k]
  ------------------
  357|  30.4k|    inputctl->pub.eoi_reached = TRUE;
  ------------------
  |  |  210|  30.4k|#define TRUE    1
  ------------------
  358|  30.4k|    if (inputctl->inheaders) {  /* Tables-only datastream, apparently */
  ------------------
  |  Branch (358:9): [True: 6.14k, False: 24.3k]
  ------------------
  359|  6.14k|      if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (359:11): [True: 1.18k, False: 4.96k]
  ------------------
  360|  1.18k|        ERREXIT(cinfo, JERR_SOF_NO_SOS);
  ------------------
  |  |  240|  1.18k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.18k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  361|  24.3k|    } else {
  362|       |      /* Prevent infinite loop in coef ctlr's decompress_data routine
  363|       |       * if user set output_scan_number larger than number of scans.
  364|       |       */
  365|  24.3k|      if (cinfo->output_scan_number > cinfo->input_scan_number)
  ------------------
  |  Branch (365:11): [True: 162, False: 24.1k]
  ------------------
  366|    162|        cinfo->output_scan_number = cinfo->input_scan_number;
  367|  24.3k|    }
  368|  30.4k|    break;
  369|      0|  case JPEG_SUSPENDED:
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (369:3): [True: 0, False: 219k]
  ------------------
  370|      0|    break;
  371|   219k|  }
  372|       |
  373|   115k|  return val;
  374|   219k|}
jdinput.c:initial_setup:
   49|  81.0k|{
   50|  81.0k|  int ci;
   51|  81.0k|  jpeg_component_info *compptr;
   52|  81.0k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  73.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (52:19): [True: 7.10k, False: 73.9k]
  ------------------
   53|       |
   54|       |  /* Make sure image isn't bigger than I can handle */
   55|  81.0k|  if ((long)cinfo->image_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  158|   162k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (55:7): [True: 273, False: 80.7k]
  ------------------
   56|  80.7k|      (long)cinfo->image_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  80.7k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (56:7): [True: 205, False: 80.5k]
  ------------------
   57|    478|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|    478|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    478|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    478|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   58|       |
   59|       |  /* Lossy JPEG images must have 8 or 12 bits per sample.  Lossless JPEG images
   60|       |   * can have 2 to 16 bits per sample.
   61|       |   */
   62|  81.0k|#ifdef D_LOSSLESS_SUPPORTED
   63|  81.0k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (63:7): [True: 6.90k, False: 74.1k]
  ------------------
   64|  6.90k|    if (cinfo->data_precision < 2 || cinfo->data_precision > 16)
  ------------------
  |  Branch (64:9): [True: 224, False: 6.67k]
  |  Branch (64:38): [True: 231, False: 6.44k]
  ------------------
   65|    455|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|    455|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    455|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    455|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   66|  6.90k|  } else
   67|  74.1k|#endif
   68|  74.1k|  {
   69|  74.1k|    if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
  ------------------
  |  Branch (69:9): [True: 1.15k, False: 72.9k]
  |  Branch (69:39): [True: 260, False: 894]
  ------------------
   70|    260|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|    260|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    260|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    260|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   71|  74.1k|  }
   72|       |
   73|       |  /* Check that number of components won't exceed internal array sizes */
   74|  81.0k|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   30|  81.0k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (74:7): [True: 235, False: 80.7k]
  ------------------
   75|    235|    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  247|    235|  ((cinfo)->err->msg_code = (code), \
  |  |  248|    235|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|    235|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|    235|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   76|  81.0k|             MAX_COMPONENTS);
   77|       |
   78|       |  /* Compute maximum sampling factors; check factor validity */
   79|  81.0k|  cinfo->max_h_samp_factor = 1;
   80|  81.0k|  cinfo->max_v_samp_factor = 1;
   81|   195k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (81:44): [True: 114k, False: 81.0k]
  ------------------
   82|   114k|       ci++, compptr++) {
   83|   114k|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (83:9): [True: 271, False: 113k]
  ------------------
   84|   113k|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   72|   227k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (84:9): [True: 239, False: 113k]
  ------------------
   85|   113k|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (85:9): [True: 287, False: 113k]
  ------------------
   86|   113k|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   72|   113k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (86:9): [True: 254, False: 113k]
  ------------------
   87|  1.05k|      ERREXIT(cinfo, JERR_BAD_SAMPLING);
  ------------------
  |  |  240|  1.05k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.05k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   88|   114k|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  513|   114k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 27.6k, False: 86.4k]
  |  |  ------------------
  ------------------
   89|   114k|                                   compptr->h_samp_factor);
   90|   114k|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  513|   114k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 23.0k, False: 90.9k]
  |  |  ------------------
  ------------------
   91|   114k|                                   compptr->v_samp_factor);
   92|   114k|  }
   93|       |
   94|       |#if JPEG_LIB_VERSION >= 80
   95|       |  cinfo->block_size = data_unit;
   96|       |  cinfo->natural_order = jpeg_natural_order;
   97|       |  cinfo->lim_Se = DCTSIZE2 - 1;
   98|       |#endif
   99|       |
  100|       |  /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE in lossy
  101|       |   * mode.  In the full decompressor, this will be overridden by jdmaster.c;
  102|       |   * but in the transcoder, jdmaster.c is not used, so we must do it here.
  103|       |   */
  104|       |#if JPEG_LIB_VERSION >= 70
  105|       |  cinfo->min_DCT_h_scaled_size = cinfo->min_DCT_v_scaled_size = data_unit;
  106|       |#else
  107|  81.0k|  cinfo->min_DCT_scaled_size = data_unit;
  108|  81.0k|#endif
  109|       |
  110|       |  /* Compute dimensions of components */
  111|   193k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (111:44): [True: 112k, False: 81.0k]
  ------------------
  112|   112k|       ci++, compptr++) {
  113|       |#if JPEG_LIB_VERSION >= 70
  114|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = data_unit;
  115|       |#else
  116|   112k|    compptr->DCT_scaled_size = data_unit;
  117|   112k|#endif
  118|       |    /* Size in data units */
  119|   112k|    compptr->width_in_blocks = (JDIMENSION)
  120|   112k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  121|   112k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  122|   112k|    compptr->height_in_blocks = (JDIMENSION)
  123|   112k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  124|   112k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  125|       |    /* Set the first and last MCU columns to decompress from multi-scan images.
  126|       |     * By default, decompress all of the MCU columns.
  127|       |     */
  128|   112k|    cinfo->master->first_MCU_col[ci] = 0;
  129|   112k|    cinfo->master->last_MCU_col[ci] = compptr->width_in_blocks - 1;
  130|       |    /* downsampled_width and downsampled_height will also be overridden by
  131|       |     * jdmaster.c if we are doing full decompression.  The transcoder library
  132|       |     * doesn't use these values, but the calling application might.
  133|       |     */
  134|       |    /* Size in samples */
  135|   112k|    compptr->downsampled_width = (JDIMENSION)
  136|   112k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  137|   112k|                    (long)cinfo->max_h_samp_factor);
  138|   112k|    compptr->downsampled_height = (JDIMENSION)
  139|   112k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  140|   112k|                    (long)cinfo->max_v_samp_factor);
  141|       |    /* Mark component needed, until color conversion says otherwise */
  142|   112k|    compptr->component_needed = TRUE;
  ------------------
  |  |  210|   112k|#define TRUE    1
  ------------------
  143|       |    /* Mark no quantization table yet saved for component */
  144|   112k|    compptr->quant_table = NULL;
  145|   112k|  }
  146|       |
  147|       |  /* Compute number of fully interleaved MCU rows. */
  148|  81.0k|  cinfo->total_iMCU_rows = (JDIMENSION)
  149|  81.0k|    jdiv_round_up((long)cinfo->image_height,
  150|  81.0k|                  (long)(cinfo->max_v_samp_factor * data_unit));
  151|       |
  152|       |  /* Decide whether file contains multiple scans */
  153|  81.0k|  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
  ------------------
  |  Branch (153:7): [True: 13.3k, False: 67.6k]
  |  Branch (153:55): [True: 14.5k, False: 53.1k]
  ------------------
  154|  25.3k|    cinfo->inputctl->has_multiple_scans = TRUE;
  ------------------
  |  |  210|  25.3k|#define TRUE    1
  ------------------
  155|  55.6k|  else
  156|  55.6k|    cinfo->inputctl->has_multiple_scans = FALSE;
  ------------------
  |  |  207|  55.6k|#define FALSE   0               /* values of boolean */
  ------------------
  157|  81.0k|}
jdinput.c:reset_input_controller:
  383|   176k|{
  384|   176k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  385|       |
  386|   176k|  inputctl->pub.consume_input = consume_markers;
  387|   176k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|   176k|#define FALSE   0               /* values of boolean */
  ------------------
  388|   176k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|   176k|#define FALSE   0               /* values of boolean */
  ------------------
  389|   176k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|   176k|#define TRUE    1
  ------------------
  390|       |  /* Reset other modules */
  391|   176k|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
  392|   176k|  (*cinfo->marker->reset_marker_reader) (cinfo);
  393|       |  /* Reset progression state -- would be cleaner if entropy decoder did this */
  394|       |  cinfo->coef_bits = NULL;
  395|   176k|}
jdinput.c:start_input_pass:
  297|  84.0k|{
  298|  84.0k|  per_scan_setup(cinfo);
  299|  84.0k|  if (!cinfo->master->lossless)
  ------------------
  |  Branch (299:7): [True: 79.8k, False: 4.18k]
  ------------------
  300|  79.8k|    latch_quant_tables(cinfo);
  301|  84.0k|  (*cinfo->entropy->start_pass) (cinfo);
  302|  84.0k|  (*cinfo->coef->start_input_pass) (cinfo);
  303|  84.0k|  cinfo->inputctl->consume_input = cinfo->coef->consume_data;
  304|  84.0k|}
jdinput.c:per_scan_setup:
  164|  84.0k|{
  165|  84.0k|  int ci, mcublks, tmp;
  166|  84.0k|  jpeg_component_info *compptr;
  167|  84.0k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  79.8k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (167:19): [True: 4.17k, False: 79.8k]
  ------------------
  168|       |
  169|  84.0k|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (169:7): [True: 75.9k, False: 8.05k]
  ------------------
  170|       |
  171|       |    /* Noninterleaved (single-component) scan */
  172|  75.9k|    compptr = cinfo->cur_comp_info[0];
  173|       |
  174|       |    /* Overall image size in MCUs */
  175|  75.9k|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  176|  75.9k|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  177|       |
  178|       |    /* For noninterleaved scan, always one data unit per MCU */
  179|  75.9k|    compptr->MCU_width = 1;
  180|  75.9k|    compptr->MCU_height = 1;
  181|  75.9k|    compptr->MCU_blocks = 1;
  182|  75.9k|    compptr->MCU_sample_width = compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  75.9k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  183|  75.9k|    compptr->last_col_width = 1;
  184|       |    /* For noninterleaved scans, it is convenient to define last_row_height
  185|       |     * as the number of data unit rows present in the last iMCU row.
  186|       |     */
  187|  75.9k|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  188|  75.9k|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (188:9): [True: 72.1k, False: 3.84k]
  ------------------
  189|  75.9k|    compptr->last_row_height = tmp;
  190|       |
  191|       |    /* Prepare array describing MCU composition */
  192|  75.9k|    cinfo->blocks_in_MCU = 1;
  193|  75.9k|    cinfo->MCU_membership[0] = 0;
  194|       |
  195|  75.9k|  } else {
  196|       |
  197|       |    /* Interleaved (multi-component) scan */
  198|  8.05k|    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  8.05k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (198:9): [True: 0, False: 8.05k]
  |  Branch (198:38): [True: 0, False: 8.05k]
  ------------------
  199|      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)))
  ------------------
  200|  8.05k|               MAX_COMPS_IN_SCAN);
  201|       |
  202|       |    /* Overall image size in MCUs */
  203|  8.05k|    cinfo->MCUs_per_row = (JDIMENSION)
  204|  8.05k|      jdiv_round_up((long)cinfo->image_width,
  205|  8.05k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  206|  8.05k|    cinfo->MCU_rows_in_scan = (JDIMENSION)
  207|  8.05k|      jdiv_round_up((long)cinfo->image_height,
  208|  8.05k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  209|       |
  210|  8.05k|    cinfo->blocks_in_MCU = 0;
  211|       |
  212|  32.2k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (212:18): [True: 24.1k, False: 8.05k]
  ------------------
  213|  24.1k|      compptr = cinfo->cur_comp_info[ci];
  214|       |      /* Sampling factors give # of data units of component in each MCU */
  215|  24.1k|      compptr->MCU_width = compptr->h_samp_factor;
  216|  24.1k|      compptr->MCU_height = compptr->v_samp_factor;
  217|  24.1k|      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
  218|  24.1k|      compptr->MCU_sample_width = compptr->MCU_width *
  219|  24.1k|                                  compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  24.1k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  220|       |      /* Figure number of non-dummy data units in last MCU column & row */
  221|  24.1k|      tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
  222|  24.1k|      if (tmp == 0) tmp = compptr->MCU_width;
  ------------------
  |  Branch (222:11): [True: 22.1k, False: 2.06k]
  ------------------
  223|  24.1k|      compptr->last_col_width = tmp;
  224|  24.1k|      tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
  225|  24.1k|      if (tmp == 0) tmp = compptr->MCU_height;
  ------------------
  |  Branch (225:11): [True: 23.1k, False: 974]
  ------------------
  226|  24.1k|      compptr->last_row_height = tmp;
  227|       |      /* Prepare array describing MCU composition */
  228|  24.1k|      mcublks = compptr->MCU_blocks;
  229|  24.1k|      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
  ------------------
  |  |   82|  24.1k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (229:11): [True: 5, False: 24.1k]
  ------------------
  230|      5|        ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  231|  58.8k|      while (mcublks-- > 0) {
  ------------------
  |  Branch (231:14): [True: 34.7k, False: 24.1k]
  ------------------
  232|  34.7k|        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
  233|  34.7k|      }
  234|  24.1k|    }
  235|       |
  236|  8.05k|  }
  237|  84.0k|}
jdinput.c:latch_quant_tables:
  263|  79.8k|{
  264|  79.8k|  int ci, qtblno;
  265|  79.8k|  jpeg_component_info *compptr;
  266|  79.8k|  JQUANT_TBL *qtbl;
  267|       |
  268|   174k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (268:16): [True: 94.5k, False: 79.8k]
  ------------------
  269|  94.5k|    compptr = cinfo->cur_comp_info[ci];
  270|       |    /* No work if we already saved Q-table for this component */
  271|  94.5k|    if (compptr->quant_table != NULL)
  ------------------
  |  Branch (271:9): [True: 12.0k, False: 82.5k]
  ------------------
  272|  12.0k|      continue;
  273|       |    /* Make sure specified quantization table is present */
  274|  82.5k|    qtblno = compptr->quant_tbl_no;
  275|  82.5k|    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
  ------------------
  |  |   68|   165k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (275:9): [True: 0, False: 82.5k]
  |  Branch (275:23): [True: 221, False: 82.2k]
  ------------------
  276|  82.2k|        cinfo->quant_tbl_ptrs[qtblno] == NULL)
  ------------------
  |  Branch (276:9): [True: 289, False: 81.9k]
  ------------------
  277|    510|      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
  ------------------
  |  |  243|    510|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    510|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    510|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |    /* OK, save away the quantization table */
  279|  82.5k|    qtbl = (JQUANT_TBL *)
  280|  82.5k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  82.5k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  281|  82.5k|                                  sizeof(JQUANT_TBL));
  282|  82.5k|    memcpy(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL));
  283|  82.5k|    compptr->quant_table = qtbl;
  284|  82.5k|  }
  285|  79.8k|}
jdinput.c:finish_input_pass:
  315|  74.7k|{
  316|  74.7k|  cinfo->inputctl->consume_input = consume_markers;
  317|  74.7k|}

jinit_lhuff_decoder:
  284|  3.46k|{
  285|  3.46k|  lhuff_entropy_ptr entropy;
  286|  3.46k|  int i;
  287|       |
  288|  3.46k|  entropy = (lhuff_entropy_ptr)
  289|  3.46k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.46k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  290|  3.46k|                                sizeof(lhuff_entropy_decoder));
  291|  3.46k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  292|  3.46k|  entropy->pub.start_pass = start_pass_lhuff_decoder;
  293|  3.46k|  entropy->pub.decode_mcus = decode_mcus;
  294|  3.46k|  entropy->pub.process_restart = process_restart;
  295|       |
  296|       |  /* Mark tables unallocated */
  297|  17.3k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  17.3k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (297:15): [True: 13.8k, False: 3.46k]
  ------------------
  298|       |    entropy->derived_tbls[i] = NULL;
  299|  13.8k|  }
  300|  3.46k|}
jdlhuff.c:start_pass_lhuff_decoder:
   84|  4.17k|{
   85|  4.17k|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
   86|  4.17k|  int ci, dctbl, sampn, ptrn, yoffset, xoffset;
   87|  4.17k|  jpeg_component_info *compptr;
   88|       |
   89|  9.72k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (89:16): [True: 5.54k, False: 4.17k]
  ------------------
   90|  5.54k|    compptr = cinfo->cur_comp_info[ci];
   91|  5.54k|    dctbl = compptr->dc_tbl_no;
   92|       |    /* Make sure requested tables are present */
   93|  5.54k|    if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS ||
  ------------------
  |  |   69|  11.0k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (93:9): [True: 0, False: 5.54k]
  |  Branch (93:22): [True: 211, False: 5.33k]
  ------------------
   94|  5.33k|        cinfo->dc_huff_tbl_ptrs[dctbl] == NULL)
  ------------------
  |  Branch (94:9): [True: 243, False: 5.09k]
  ------------------
   95|    454|      ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
  ------------------
  |  |  243|    454|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    454|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    454|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   96|       |    /* Compute derived values for Huffman tables */
   97|       |    /* We may do this more than once for a table, but it's not expensive */
   98|  5.54k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
  ------------------
  |  |  210|  5.54k|#define TRUE    1
  ------------------
   99|  5.54k|                            &entropy->derived_tbls[dctbl]);
  100|  5.54k|  }
  101|       |
  102|       |  /* Precalculate decoding info for each sample in an MCU of this scan */
  103|  9.26k|  for (sampn = 0, ptrn = 0; sampn < cinfo->blocks_in_MCU;) {
  ------------------
  |  Branch (103:29): [True: 5.08k, False: 4.17k]
  ------------------
  104|  5.08k|    compptr = cinfo->cur_comp_info[cinfo->MCU_membership[sampn]];
  105|  5.08k|    ci = compptr->component_index;
  106|  10.1k|    for (yoffset = 0; yoffset < compptr->MCU_height; yoffset++, ptrn++) {
  ------------------
  |  Branch (106:23): [True: 5.10k, False: 5.08k]
  ------------------
  107|       |      /* Precalculate the setup info for each output pointer */
  108|  5.10k|      entropy->output_ptr_info[ptrn].ci = ci;
  109|  5.10k|      entropy->output_ptr_info[ptrn].yoffset = yoffset;
  110|  5.10k|      entropy->output_ptr_info[ptrn].MCU_width = compptr->MCU_width;
  111|  10.2k|      for (xoffset = 0; xoffset < compptr->MCU_width; xoffset++, sampn++) {
  ------------------
  |  Branch (111:25): [True: 5.12k, False: 5.10k]
  ------------------
  112|       |        /* Precalculate the output pointer index for each sample */
  113|  5.12k|        entropy->output_ptr_index[sampn] = ptrn;
  114|       |        /* Precalculate which table to use for each sample */
  115|  5.12k|        entropy->cur_tbls[sampn] = entropy->derived_tbls[compptr->dc_tbl_no];
  116|  5.12k|      }
  117|  5.10k|    }
  118|  5.08k|  }
  119|  4.17k|  entropy->num_output_ptrs = ptrn;
  120|       |
  121|       |  /* Initialize bitread state variables */
  122|  4.17k|  entropy->bitstate.bits_left = 0;
  123|  4.17k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  124|  4.17k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  4.17k|#define FALSE   0               /* values of boolean */
  ------------------
  125|  4.17k|}
jdlhuff.c:decode_mcus:
  209|   277k|{
  210|   277k|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
  211|   277k|  int sampn, ci, yoffset, MCU_width, ptrn;
  212|   277k|  JDIMENSION mcu_num;
  213|   277k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   277k|  register bit_buf_type get_buffer; \
  |  |  126|   277k|  register int bits_left; \
  |  |  127|   277k|  bitread_working_state br_state
  ------------------
  214|       |
  215|       |  /* Set output pointer locations based on MCU_col_num */
  216|   599k|  for (ptrn = 0; ptrn < entropy->num_output_ptrs; ptrn++) {
  ------------------
  |  Branch (216:18): [True: 322k, False: 277k]
  ------------------
  217|   322k|    ci = entropy->output_ptr_info[ptrn].ci;
  218|   322k|    yoffset = entropy->output_ptr_info[ptrn].yoffset;
  219|   322k|    MCU_width = entropy->output_ptr_info[ptrn].MCU_width;
  220|   322k|    entropy->output_ptr[ptrn] =
  221|   322k|      diff_buf[ci][MCU_row_num + yoffset] + (MCU_col_num * MCU_width);
  222|   322k|  }
  223|       |
  224|       |  /*
  225|       |   * If we've run out of data, zero out the buffers and return.
  226|       |   * By resetting the undifferencer, the output samples will be CENTERJSAMPLE.
  227|       |   *
  228|       |   * NB: We should find a way to do this without interacting with the
  229|       |   * undifferencer module directly.
  230|       |   */
  231|   277k|  if (entropy->pub.insufficient_data) {
  ------------------
  |  Branch (231:7): [True: 255k, False: 21.6k]
  ------------------
  232|   548k|    for (ptrn = 0; ptrn < entropy->num_output_ptrs; ptrn++)
  ------------------
  |  Branch (232:20): [True: 292k, False: 255k]
  ------------------
  233|   292k|      jzero_far((void FAR *)entropy->output_ptr[ptrn],
  234|   292k|                nMCU * entropy->output_ptr_info[ptrn].MCU_width *
  235|   292k|                sizeof(JDIFF));
  236|       |
  237|   255k|    (*cinfo->idct->start_pass) (cinfo);
  238|       |
  239|   255k|  } else {
  240|       |
  241|       |    /* Load up working state */
  242|  21.6k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  21.6k|  br_state.cinfo = cinfop; \
  |  |  131|  21.6k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  21.6k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  21.6k|  get_buffer = permstate.get_buffer; \
  |  |  134|  21.6k|  bits_left = permstate.bits_left;
  ------------------
  243|       |
  244|       |    /* Outer loop handles the number of MCUs requested */
  245|       |
  246|   197k|    for (mcu_num = 0; mcu_num < nMCU; mcu_num++) {
  ------------------
  |  Branch (246:23): [True: 176k, False: 21.6k]
  ------------------
  247|       |
  248|       |      /* Inner loop handles the samples in the MCU */
  249|   420k|      for (sampn = 0; sampn < cinfo->blocks_in_MCU; sampn++) {
  ------------------
  |  Branch (249:23): [True: 244k, False: 176k]
  ------------------
  250|   244k|        d_derived_tbl *dctbl = entropy->cur_tbls[sampn];
  251|   244k|        register int s, r;
  252|       |
  253|       |        /* Section H.2.2: decode the sample difference */
  254|   244k|        HUFF_DECODE(s, br_state, dctbl, return mcu_num, label1);
  ------------------
  |  |  200|   244k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   244k|  register int nb, look; \
  |  |  202|   244k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   244k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 18.9k, False: 225k]
  |  |  ------------------
  |  |  203|  18.9k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 18.9k]
  |  |  ------------------
  |  |  204|  18.9k|      { failaction; } \
  |  |  205|  18.9k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  18.9k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  18.9k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 6.48k, False: 12.4k]
  |  |  ------------------
  |  |  207|  6.48k|      nb = 1;  goto slowlabel; \
  |  |  208|  6.48k|    } \
  |  |  209|  18.9k|  } \
  |  |  210|   244k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   238k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   238k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   238k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   238k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 227k, False: 10.9k]
  |  |  ------------------
  |  |  212|   227k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   227k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   227k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   227k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   227k|  } else { \
  |  |  215|  17.4k|slowlabel: \
  |  |  216|  17.4k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 17.4k]
  |  |  ------------------
  |  |  217|  17.4k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  17.4k|      { failaction; } \
  |  |  219|  17.4k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  17.4k|  } \
  |  |  221|   238k|}
  ------------------
  255|   244k|        if (s) {
  ------------------
  |  Branch (255:13): [True: 64.7k, False: 179k]
  ------------------
  256|  64.7k|          if (s == 16)  /* special case: always output 32768 */
  ------------------
  |  Branch (256:15): [True: 2.92k, False: 61.8k]
  ------------------
  257|  2.92k|            s = 32768;
  258|  61.8k|          else {        /* normal case: fetch subsequent bits */
  259|  61.8k|            CHECK_BIT_BUFFER(br_state, s, return mcu_num);
  ------------------
  |  |  160|  61.8k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  61.8k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 3.68k, False: 58.1k]
  |  |  ------------------
  |  |  162|  3.68k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 3.68k]
  |  |  ------------------
  |  |  163|  3.68k|      { action; } \
  |  |  164|  3.68k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  3.68k|  } \
  |  |  166|  61.8k|}
  ------------------
  260|  61.8k|            r = GET_BITS(s);
  ------------------
  |  |  169|  61.8k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  261|  61.8k|            s = HUFF_EXTEND(r, s);
  ------------------
  |  |  138|  61.8k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  136|  61.8k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  262|  61.8k|          }
  263|  64.7k|        }
  264|       |
  265|       |        /* Output the sample difference */
  266|   244k|        *entropy->output_ptr[entropy->output_ptr_index[sampn]]++ = (JDIFF)s;
  267|   244k|      }
  268|       |
  269|       |      /* Completed MCU, so update state */
  270|   176k|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   176k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   176k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   176k|  permstate.get_buffer = get_buffer; \
  |  |  140|   176k|  permstate.bits_left = bits_left
  ------------------
  271|   176k|    }
  272|  21.6k|  }
  273|       |
  274|   277k| return nMCU;
  275|   277k|}
jdlhuff.c:process_restart:
  167|  2.38k|{
  168|  2.38k|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
  169|       |
  170|       |  /* Throw away any unused bits remaining in bit buffer; */
  171|       |  /* include any full bytes in next_marker's count of discarded bytes */
  172|  2.38k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  173|  2.38k|  entropy->bitstate.bits_left = 0;
  174|       |
  175|       |  /* Advance past the RSTn marker */
  176|  2.38k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (176:7): [True: 0, False: 2.38k]
  ------------------
  177|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  178|       |
  179|       |  /* Reset out-of-data flag, unless read_restart_marker left us smack up
  180|       |   * against a marker.  In that case we will end up treating the next data
  181|       |   * segment as empty, and we can avoid producing bogus output pixels by
  182|       |   * leaving the flag set.
  183|       |   */
  184|  2.38k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (184:7): [True: 185, False: 2.20k]
  ------------------
  185|    185|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|    185|#define FALSE   0               /* values of boolean */
  ------------------
  186|       |
  187|  2.38k|  return TRUE;
  ------------------
  |  |  210|  2.38k|#define TRUE    1
  ------------------
  188|  2.38k|}

jinit_lossless_decompressor:
  281|  3.42k|{
  282|  3.42k|  lossless_decomp_ptr losslessd;
  283|       |
  284|  3.42k|#if BITS_IN_JSAMPLE == 8
  285|  3.42k|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  6.85k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (285:7): [True: 0, False: 3.42k]
  |  Branch (285:50): [True: 0, False: 3.42k]
  ------------------
  286|       |#else
  287|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  288|       |      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  289|       |#endif
  290|      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)))
  ------------------
  291|       |
  292|       |  /* Create subobject in permanent pool */
  293|  3.42k|  losslessd = (lossless_decomp_ptr)
  294|  3.42k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  3.42k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|  3.42k|                                sizeof(jpeg_lossless_decompressor));
  296|  3.42k|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|  3.42k|  losslessd->pub.start_pass = start_pass_lossless;
  298|  3.42k|}
jdlossls-8.c:start_pass_lossless:
  243|   158k|{
  244|   158k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|   158k|  int ci;
  246|       |
  247|       |  /* Check that the scan parameters Ss, Se, Ah, Al are OK for lossless JPEG.
  248|       |   *
  249|       |   * Ss is the predictor selection value (psv).  Legal values for sequential
  250|       |   * lossless JPEG are: 1 <= psv <= 7.
  251|       |   *
  252|       |   * Se and Ah are not used and should be zero.
  253|       |   *
  254|       |   * Al specifies the point transform (Pt).
  255|       |   * Legal values are: 0 <= Pt <= (data precision - 1).
  256|       |   */
  257|   158k|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 300, False: 157k]
  |  Branch (257:24): [True: 268, False: 157k]
  ------------------
  258|   157k|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 219, False: 157k]
  |  Branch (258:25): [True: 221, False: 156k]
  ------------------
  259|   156k|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 156k]
  |  Branch (259:24): [True: 210, False: 156k]
  ------------------
  260|  1.21k|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|  1.21k|  ((cinfo)->err->msg_code = (code), \
  |  |  259|  1.21k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|  1.21k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|  1.21k|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|  1.21k|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|  1.21k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|   158k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|   488k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 330k, False: 158k]
  ------------------
  265|   330k|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|   158k|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 25.0k, False: 132k]
  ------------------
  269|  25.0k|    losslessd->scaler_scale = simple_upscale;
  270|   132k|  else
  271|   132k|    losslessd->scaler_scale = noscale;
  272|   158k|}
jdlossls-8.c:jpeg_undifference_first_row:
  177|   191k|{
  178|   191k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|   191k|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|   191k|  int Ra; \
  |  |   60|   191k|  \
  |  |   61|   191k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|   191k|  *undiff_buf++ = Ra; \
  |  |   63|   191k|  \
  |  |   64|  11.3M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 11.1M, False: 191k]
  |  |  ------------------
  |  |   65|  11.1M|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  11.1M|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  11.1M|    *undiff_buf++ = Ra; \
  |  |   67|  11.1M|  }
  ------------------
  181|       |
  182|       |  /*
  183|       |   * Now that we have undifferenced the first row, we want to use the
  184|       |   * undifferencer that corresponds to the predictor specified in the
  185|       |   * scan header.
  186|       |   */
  187|   191k|  switch (cinfo->Ss) {
  188|  4.71k|  case 1:
  ------------------
  |  Branch (188:3): [True: 4.71k, False: 186k]
  ------------------
  189|  4.71k|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|  4.71k|    break;
  191|  7.30k|  case 2:
  ------------------
  |  Branch (191:3): [True: 7.30k, False: 184k]
  ------------------
  192|  7.30k|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|  7.30k|    break;
  194|  95.4k|  case 3:
  ------------------
  |  Branch (194:3): [True: 95.4k, False: 96.0k]
  ------------------
  195|  95.4k|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|  95.4k|    break;
  197|  48.8k|  case 4:
  ------------------
  |  Branch (197:3): [True: 48.8k, False: 142k]
  ------------------
  198|  48.8k|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|  48.8k|    break;
  200|  2.56k|  case 5:
  ------------------
  |  Branch (200:3): [True: 2.56k, False: 188k]
  ------------------
  201|  2.56k|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|  2.56k|    break;
  203|  2.61k|  case 6:
  ------------------
  |  Branch (203:3): [True: 2.61k, False: 188k]
  ------------------
  204|  2.61k|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|  2.61k|    break;
  206|  30.0k|  case 7:
  ------------------
  |  Branch (206:3): [True: 30.0k, False: 161k]
  ------------------
  207|  30.0k|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|  30.0k|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 191k]
  ------------------
  210|      0|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      0|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      0|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  211|   191k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|   191k|  }
  213|   191k|}
jdlossls-8.c:jpeg_undifference1:
  111|    921|{
  112|    921|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|    921|  int Ra; \
  |  |   60|    921|  \
  |  |   61|    921|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|    921|  *undiff_buf++ = Ra; \
  |  |   63|    921|  \
  |  |   64|  8.91k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 7.99k, False: 921]
  |  |  ------------------
  |  |   65|  7.99k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  7.99k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  7.99k|    *undiff_buf++ = Ra; \
  |  |   67|  7.99k|  }
  ------------------
  113|    921|}
jdlossls-8.c:jpeg_undifference2:
  119|    812|{
  120|    812|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|    812|  int Ra, Rb, Rc; \
  |  |   87|    812|  \
  |  |   88|    812|  Rb = *prev_row++; \
  |  |   89|    812|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    812|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    812|  *undiff_buf++ = Ra; \
  |  |   91|    812|  \
  |  |   92|  10.2k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 9.42k, False: 812]
  |  |  ------------------
  |  |   93|  9.42k|    Rc = Rb; \
  |  |   94|  9.42k|    Rb = *prev_row++; \
  |  |   95|  9.42k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  9.42k|    *undiff_buf++ = Ra; \
  |  |   97|  9.42k|  }
  ------------------
  121|    812|  (void)(Rc);
  122|    812|}
jdlossls-8.c:jpeg_undifference3:
  128|  5.24k|{
  129|  5.24k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  5.24k|  int Ra, Rb, Rc; \
  |  |   87|  5.24k|  \
  |  |   88|  5.24k|  Rb = *prev_row++; \
  |  |   89|  5.24k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  5.24k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  5.24k|  *undiff_buf++ = Ra; \
  |  |   91|  5.24k|  \
  |  |   92|  14.8k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 9.59k, False: 5.24k]
  |  |  ------------------
  |  |   93|  9.59k|    Rc = Rb; \
  |  |   94|  9.59k|    Rb = *prev_row++; \
  |  |   95|  9.59k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  9.59k|    *undiff_buf++ = Ra; \
  |  |   97|  9.59k|  }
  ------------------
  130|  5.24k|}
jdlossls-8.c:jpeg_undifference4:
  136|  8.94k|{
  137|  8.94k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  8.94k|  int Ra, Rb, Rc; \
  |  |   87|  8.94k|  \
  |  |   88|  8.94k|  Rb = *prev_row++; \
  |  |   89|  8.94k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  8.94k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  8.94k|  *undiff_buf++ = Ra; \
  |  |   91|  8.94k|  \
  |  |   92|  80.5k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 71.5k, False: 8.94k]
  |  |  ------------------
  |  |   93|  71.5k|    Rc = Rb; \
  |  |   94|  71.5k|    Rb = *prev_row++; \
  |  |   95|  71.5k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  71.5k|    *undiff_buf++ = Ra; \
  |  |   97|  71.5k|  }
  ------------------
  138|  8.94k|}
jdlossls-8.c:jpeg_undifference5:
  144|    799|{
  145|    799|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|    799|  int Ra, Rb, Rc; \
  |  |   87|    799|  \
  |  |   88|    799|  Rb = *prev_row++; \
  |  |   89|    799|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    799|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    799|  *undiff_buf++ = Ra; \
  |  |   91|    799|  \
  |  |   92|    799|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 0, False: 799]
  |  |  ------------------
  |  |   93|      0|    Rc = Rb; \
  |  |   94|      0|    Rb = *prev_row++; \
  |  |   95|      0|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|      0|    *undiff_buf++ = Ra; \
  |  |   97|      0|  }
  ------------------
  146|    799|}
jdlossls-8.c:jpeg_undifference6:
  152|    313|{
  153|    313|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|    313|  int Ra, Rb, Rc; \
  |  |   87|    313|  \
  |  |   88|    313|  Rb = *prev_row++; \
  |  |   89|    313|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    313|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    313|  *undiff_buf++ = Ra; \
  |  |   91|    313|  \
  |  |   92|  3.66k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 3.35k, False: 313]
  |  |  ------------------
  |  |   93|  3.35k|    Rc = Rb; \
  |  |   94|  3.35k|    Rb = *prev_row++; \
  |  |   95|  3.35k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  3.35k|    *undiff_buf++ = Ra; \
  |  |   97|  3.35k|  }
  ------------------
  154|    313|}
jdlossls-8.c:jpeg_undifference7:
  160|    652|{
  161|    652|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|    652|  int Ra, Rb, Rc; \
  |  |   87|    652|  \
  |  |   88|    652|  Rb = *prev_row++; \
  |  |   89|    652|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    652|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    652|  *undiff_buf++ = Ra; \
  |  |   91|    652|  \
  |  |   92|  1.95k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 1.30k, False: 652]
  |  |  ------------------
  |  |   93|  1.30k|    Rc = Rb; \
  |  |   94|  1.30k|    Rb = *prev_row++; \
  |  |   95|  1.30k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  1.30k|    *undiff_buf++ = Ra; \
  |  |   97|  1.30k|  }
  ------------------
  162|    652|  (void)(Rc);
  163|    652|}
jdlossls-8.c:simple_upscale:
  221|  71.4k|{
  222|   598k|  do {
  223|   598k|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|   598k|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 527k, False: 71.4k]
  ------------------
  225|  71.4k|}
jdlossls-8.c:noscale:
  230|   137k|{
  231|  10.8M|  do {
  232|  10.8M|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  10.8M|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 10.7M, False: 137k]
  ------------------
  234|   137k|}
j12init_lossless_decompressor:
  281|    311|{
  282|    311|  lossless_decomp_ptr losslessd;
  283|       |
  284|       |#if BITS_IN_JSAMPLE == 8
  285|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  286|       |#else
  287|    311|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    622|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (287:7): [True: 0, False: 311]
  ------------------
  288|    311|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    311|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (288:7): [True: 0, False: 311]
  ------------------
  289|      0|#endif
  290|      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)))
  ------------------
  291|       |
  292|       |  /* Create subobject in permanent pool */
  293|    311|  losslessd = (lossless_decomp_ptr)
  294|    311|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    311|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    311|                                sizeof(jpeg_lossless_decompressor));
  296|    311|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    311|  losslessd->pub.start_pass = start_pass_lossless;
  298|    311|}
jdlossls-12.c:start_pass_lossless:
  243|   105k|{
  244|   105k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|   105k|  int ci;
  246|       |
  247|       |  /* Check that the scan parameters Ss, Se, Ah, Al are OK for lossless JPEG.
  248|       |   *
  249|       |   * Ss is the predictor selection value (psv).  Legal values for sequential
  250|       |   * lossless JPEG are: 1 <= psv <= 7.
  251|       |   *
  252|       |   * Se and Ah are not used and should be zero.
  253|       |   *
  254|       |   * Al specifies the point transform (Pt).
  255|       |   * Legal values are: 0 <= Pt <= (data precision - 1).
  256|       |   */
  257|   105k|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 1, False: 105k]
  |  Branch (257:24): [True: 1, False: 105k]
  ------------------
  258|   105k|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 1, False: 105k]
  |  Branch (258:25): [True: 1, False: 105k]
  ------------------
  259|   105k|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 105k]
  |  Branch (259:24): [True: 1, False: 105k]
  ------------------
  260|      5|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      5|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      5|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      5|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|   105k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|   211k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 105k, False: 105k]
  ------------------
  265|   105k|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|   105k|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 67.5k, False: 38.1k]
  ------------------
  269|  67.5k|    losslessd->scaler_scale = simple_upscale;
  270|  38.1k|  else
  271|  38.1k|    losslessd->scaler_scale = noscale;
  272|   105k|}
jdlossls-12.c:jpeg_undifference_first_row:
  177|   104k|{
  178|   104k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|   104k|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|   104k|  int Ra; \
  |  |   60|   104k|  \
  |  |   61|   104k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|   104k|  *undiff_buf++ = Ra; \
  |  |   63|   104k|  \
  |  |   64|  1.39M|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 1.28M, False: 104k]
  |  |  ------------------
  |  |   65|  1.28M|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  1.28M|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  1.28M|    *undiff_buf++ = Ra; \
  |  |   67|  1.28M|  }
  ------------------
  181|       |
  182|       |  /*
  183|       |   * Now that we have undifferenced the first row, we want to use the
  184|       |   * undifferencer that corresponds to the predictor specified in the
  185|       |   * scan header.
  186|       |   */
  187|   104k|  switch (cinfo->Ss) {
  188|  14.8k|  case 1:
  ------------------
  |  Branch (188:3): [True: 14.8k, False: 90.0k]
  ------------------
  189|  14.8k|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|  14.8k|    break;
  191|  3.44k|  case 2:
  ------------------
  |  Branch (191:3): [True: 3.44k, False: 101k]
  ------------------
  192|  3.44k|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|  3.44k|    break;
  194|  4.16k|  case 3:
  ------------------
  |  Branch (194:3): [True: 4.16k, False: 100k]
  ------------------
  195|  4.16k|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|  4.16k|    break;
  197|  7.66k|  case 4:
  ------------------
  |  Branch (197:3): [True: 7.66k, False: 97.2k]
  ------------------
  198|  7.66k|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|  7.66k|    break;
  200|  16.9k|  case 5:
  ------------------
  |  Branch (200:3): [True: 16.9k, False: 87.9k]
  ------------------
  201|  16.9k|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|  16.9k|    break;
  203|  43.0k|  case 6:
  ------------------
  |  Branch (203:3): [True: 43.0k, False: 61.8k]
  ------------------
  204|  43.0k|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|  43.0k|    break;
  206|  14.7k|  case 7:
  ------------------
  |  Branch (206:3): [True: 14.7k, False: 90.1k]
  ------------------
  207|  14.7k|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|  14.7k|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 104k]
  ------------------
  210|      0|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      0|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      0|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  211|   104k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|   104k|  }
  213|   104k|}
jdlossls-12.c:jpeg_undifference1:
  111|  1.37k|{
  112|  1.37k|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|  1.37k|  int Ra; \
  |  |   60|  1.37k|  \
  |  |   61|  1.37k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  1.37k|  *undiff_buf++ = Ra; \
  |  |   63|  1.37k|  \
  |  |   64|  15.8k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 14.4k, False: 1.37k]
  |  |  ------------------
  |  |   65|  14.4k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  14.4k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  14.4k|    *undiff_buf++ = Ra; \
  |  |   67|  14.4k|  }
  ------------------
  113|  1.37k|}
jdlossls-12.c:jpeg_undifference2:
  119|  1.47k|{
  120|  1.47k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  1.47k|  int Ra, Rb, Rc; \
  |  |   87|  1.47k|  \
  |  |   88|  1.47k|  Rb = *prev_row++; \
  |  |   89|  1.47k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.47k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.47k|  *undiff_buf++ = Ra; \
  |  |   91|  1.47k|  \
  |  |   92|  11.1k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 9.64k, False: 1.47k]
  |  |  ------------------
  |  |   93|  9.64k|    Rc = Rb; \
  |  |   94|  9.64k|    Rb = *prev_row++; \
  |  |   95|  9.64k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  9.64k|    *undiff_buf++ = Ra; \
  |  |   97|  9.64k|  }
  ------------------
  121|  1.47k|  (void)(Rc);
  122|  1.47k|}
jdlossls-12.c:jpeg_undifference3:
  128|  1.29k|{
  129|  1.29k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  1.29k|  int Ra, Rb, Rc; \
  |  |   87|  1.29k|  \
  |  |   88|  1.29k|  Rb = *prev_row++; \
  |  |   89|  1.29k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.29k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.29k|  *undiff_buf++ = Ra; \
  |  |   91|  1.29k|  \
  |  |   92|  10.2k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 8.95k, False: 1.29k]
  |  |  ------------------
  |  |   93|  8.95k|    Rc = Rb; \
  |  |   94|  8.95k|    Rb = *prev_row++; \
  |  |   95|  8.95k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  8.95k|    *undiff_buf++ = Ra; \
  |  |   97|  8.95k|  }
  ------------------
  130|  1.29k|}
jdlossls-12.c:jpeg_undifference4:
  136|    888|{
  137|    888|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|    888|  int Ra, Rb, Rc; \
  |  |   87|    888|  \
  |  |   88|    888|  Rb = *prev_row++; \
  |  |   89|    888|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    888|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    888|  *undiff_buf++ = Ra; \
  |  |   91|    888|  \
  |  |   92|  3.81k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.92k, False: 888]
  |  |  ------------------
  |  |   93|  2.92k|    Rc = Rb; \
  |  |   94|  2.92k|    Rb = *prev_row++; \
  |  |   95|  2.92k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.92k|    *undiff_buf++ = Ra; \
  |  |   97|  2.92k|  }
  ------------------
  138|    888|}
jdlossls-12.c:jpeg_undifference5:
  144|  1.26k|{
  145|  1.26k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  1.26k|  int Ra, Rb, Rc; \
  |  |   87|  1.26k|  \
  |  |   88|  1.26k|  Rb = *prev_row++; \
  |  |   89|  1.26k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.26k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.26k|  *undiff_buf++ = Ra; \
  |  |   91|  1.26k|  \
  |  |   92|  6.77k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 5.50k, False: 1.26k]
  |  |  ------------------
  |  |   93|  5.50k|    Rc = Rb; \
  |  |   94|  5.50k|    Rb = *prev_row++; \
  |  |   95|  5.50k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  5.50k|    *undiff_buf++ = Ra; \
  |  |   97|  5.50k|  }
  ------------------
  146|  1.26k|}
jdlossls-12.c:jpeg_undifference6:
  152|    938|{
  153|    938|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|    938|  int Ra, Rb, Rc; \
  |  |   87|    938|  \
  |  |   88|    938|  Rb = *prev_row++; \
  |  |   89|    938|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    938|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    938|  *undiff_buf++ = Ra; \
  |  |   91|    938|  \
  |  |   92|  4.52k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 3.58k, False: 938]
  |  |  ------------------
  |  |   93|  3.58k|    Rc = Rb; \
  |  |   94|  3.58k|    Rb = *prev_row++; \
  |  |   95|  3.58k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  3.58k|    *undiff_buf++ = Ra; \
  |  |   97|  3.58k|  }
  ------------------
  154|    938|}
jdlossls-12.c:jpeg_undifference7:
  160|    817|{
  161|    817|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|    817|  int Ra, Rb, Rc; \
  |  |   87|    817|  \
  |  |   88|    817|  Rb = *prev_row++; \
  |  |   89|    817|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    817|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    817|  *undiff_buf++ = Ra; \
  |  |   91|    817|  \
  |  |   92|  10.3k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 9.53k, False: 817]
  |  |  ------------------
  |  |   93|  9.53k|    Rc = Rb; \
  |  |   94|  9.53k|    Rb = *prev_row++; \
  |  |   95|  9.53k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  9.53k|    *undiff_buf++ = Ra; \
  |  |   97|  9.53k|  }
  ------------------
  162|    817|  (void)(Rc);
  163|    817|}
jdlossls-12.c:simple_upscale:
  221|  71.2k|{
  222|  1.15M|  do {
  223|  1.15M|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|  1.15M|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 1.08M, False: 71.2k]
  ------------------
  225|  71.2k|}
jdlossls-12.c:noscale:
  230|  41.7k|{
  231|   300k|  do {
  232|   300k|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|   300k|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 258k, False: 41.7k]
  ------------------
  234|  41.7k|}

jinit_d_main_controller:
  429|  72.7k|{
  430|  72.7k|  my_main_ptr main_ptr;
  431|  72.7k|  int ci, rgroup, ngroups;
  432|  72.7k|  jpeg_component_info *compptr;
  433|       |
  434|  72.7k|#ifdef D_LOSSLESS_SUPPORTED
  435|  72.7k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 3.15k, False: 69.5k]
  ------------------
  436|  3.15k|#if BITS_IN_JSAMPLE == 8
  437|  3.15k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  6.30k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (437:9): [True: 0, False: 3.15k]
  |  Branch (437:52): [True: 0, False: 3.15k]
  ------------------
  438|       |#else
  439|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  440|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  441|       |#endif
  442|      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)))
  ------------------
  443|  3.15k|  } else
  444|  69.5k|#endif
  445|  69.5k|  {
  446|  69.5k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  69.5k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (446:9): [True: 0, False: 69.5k]
  ------------------
  447|      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)))
  ------------------
  448|  69.5k|  }
  449|       |
  450|  72.7k|  main_ptr = (my_main_ptr)
  451|  72.7k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  72.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|  72.7k|                                sizeof(my_main_controller));
  453|  72.7k|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|  72.7k|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|  72.7k|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|  72.7k|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 72.7k]
  ------------------
  458|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  459|       |
  460|       |  /* Allocate the workspace.
  461|       |   * ngroups is the number of row groups we need.
  462|       |   */
  463|  72.7k|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 5.26k, False: 67.4k]
  ------------------
  464|  5.26k|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|  5.26k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 5.26k]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|  5.26k|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|  5.26k|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|  5.26k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|  67.4k|  } else {
  469|  67.4k|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  67.4k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|  67.4k|  }
  471|       |
  472|   171k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 98.6k, False: 72.7k]
  ------------------
  473|  98.6k|       ci++, compptr++) {
  474|  98.6k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  98.6k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|  98.6k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  98.6k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|  98.6k|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|  98.6k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  98.6k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|  98.6k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|  98.6k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|  98.6k|                         (JDIMENSION)(rgroup * ngroups));
  480|  98.6k|  }
  481|  72.7k|}
jdmainct-8.c:start_pass_main:
  259|  63.5k|{
  260|  63.5k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|  63.5k|  switch (pass_mode) {
  263|  63.5k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 63.5k, False: 0]
  ------------------
  264|  63.5k|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 4.91k, False: 58.6k]
  ------------------
  265|  4.91k|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |  256|  4.91k|#define _process_data  process_data
  ------------------
  266|  4.91k|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  267|  4.91k|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  268|  4.91k|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|  4.91k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  269|  4.91k|      main_ptr->iMCU_row_ctr = 0;
  270|  58.6k|    } else {
  271|       |      /* Simple case with no context needed */
  272|  58.6k|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  256|  58.6k|#define _process_data  process_data
  ------------------
  273|  58.6k|    }
  274|  63.5k|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|  63.5k|#define FALSE   0               /* values of boolean */
  ------------------
  275|  63.5k|    main_ptr->rowgroup_ctr = 0;
  276|  63.5k|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 63.5k]
  ------------------
  279|       |    /* For last pass of 2-pass quantization, just crank the postprocessor */
  280|      0|    main_ptr->pub._process_data = process_data_crank_post;
  ------------------
  |  |  256|      0|#define _process_data  process_data
  ------------------
  281|      0|    break;
  282|      0|#endif
  283|      0|  default:
  ------------------
  |  Branch (283:3): [True: 0, False: 63.5k]
  ------------------
  284|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  285|      0|    break;
  286|  63.5k|  }
  287|  63.5k|}
jdmainct-8.c:process_data_context_main:
  337|   388k|{
  338|   388k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  339|       |
  340|       |  /* Read input data if we haven't filled the main buffer yet */
  341|   388k|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (341:7): [True: 26.6k, False: 361k]
  ------------------
  342|  26.6k|    if (!(*cinfo->coef->_decompress_data) (cinfo,
  ------------------
  |  |  258|  26.6k|#define _decompress_data  decompress_data
  ------------------
  |  Branch (342:9): [True: 0, False: 26.6k]
  ------------------
  343|  26.6k|                                           main_ptr->xbuffer[main_ptr->whichptr]))
  344|      0|      return;                   /* suspension forced, can do nothing more */
  345|  26.6k|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|  26.6k|#define TRUE    1
  ------------------
  346|  26.6k|    main_ptr->iMCU_row_ctr++;   /* count rows received */
  347|  26.6k|  }
  348|       |
  349|       |  /* Postprocessor typically will not swallow all the input data it is handed
  350|       |   * in one call (due to filling the output buffer first).  Must be prepared
  351|       |   * to exit and restart.  This switch lets us keep track of how far we got.
  352|       |   * Note that each case falls through to the next on successful completion.
  353|       |   */
  354|   388k|  switch (main_ptr->context_state) {
  ------------------
  |  Branch (354:11): [True: 388k, False: 0]
  ------------------
  355|  43.4k|  case CTX_POSTPONED_ROW:
  ------------------
  |  |   48|  43.4k|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  |  Branch (355:3): [True: 43.4k, False: 345k]
  ------------------
  356|       |    /* Call postprocessor using previously set pointers for postponed row */
  357|  43.4k|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  260|  43.4k|#define _post_process_data  post_process_data
  ------------------
  358|  43.4k|                                        main_ptr->xbuffer[main_ptr->whichptr],
  359|  43.4k|                                        &main_ptr->rowgroup_ctr,
  360|  43.4k|                                        main_ptr->rowgroups_avail, output_buf,
  361|  43.4k|                                        out_row_ctr, out_rows_avail);
  362|  43.4k|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (362:9): [True: 21.7k, False: 21.7k]
  ------------------
  363|  21.7k|      return;                   /* Need to suspend */
  364|  21.7k|    main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|  21.7k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  365|  21.7k|    if (*out_row_ctr >= out_rows_avail)
  ------------------
  |  Branch (365:9): [True: 21.7k, False: 0]
  ------------------
  366|  21.7k|      return;                   /* Postprocessor exactly filled output buf */
  367|      0|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|      0|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  368|  26.6k|  case CTX_PREPARE_FOR_IMCU:
  ------------------
  |  |   46|  26.6k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  |  Branch (368:3): [True: 26.6k, False: 361k]
  ------------------
  369|       |    /* Prepare to process first M-1 row groups of this iMCU row */
  370|  26.6k|    main_ptr->rowgroup_ctr = 0;
  371|  26.6k|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size - 1);
  ------------------
  |  |   27|  26.6k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  372|       |    /* Check for bottom of image: if so, tweak pointers to "duplicate"
  373|       |     * the last sample row, and adjust rowgroups_avail to ignore padding rows.
  374|       |     */
  375|  26.6k|    if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows)
  ------------------
  |  Branch (375:9): [True: 4.91k, False: 21.7k]
  ------------------
  376|  4.91k|      set_bottom_pointers(cinfo);
  377|  26.6k|    main_ptr->context_state = CTX_PROCESS_IMCU;
  ------------------
  |  |   47|  26.6k|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  378|  26.6k|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|  26.6k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  379|   345k|  case CTX_PROCESS_IMCU:
  ------------------
  |  |   47|   345k|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  |  Branch (379:3): [True: 318k, False: 70.1k]
  ------------------
  380|       |    /* Call postprocessor using previously set pointers */
  381|   345k|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  260|   345k|#define _post_process_data  post_process_data
  ------------------
  382|   345k|                                        main_ptr->xbuffer[main_ptr->whichptr],
  383|   345k|                                        &main_ptr->rowgroup_ctr,
  384|   345k|                                        main_ptr->rowgroups_avail, output_buf,
  385|   345k|                                        out_row_ctr, out_rows_avail);
  386|   345k|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (386:9): [True: 320k, False: 24.2k]
  ------------------
  387|   320k|      return;                   /* Need to suspend */
  388|       |    /* After the first iMCU, change wraparound pointers to normal state */
  389|  24.2k|    if (main_ptr->iMCU_row_ctr == 1)
  ------------------
  |  Branch (389:9): [True: 4.62k, False: 19.6k]
  ------------------
  390|  4.62k|      set_wraparound_pointers(cinfo);
  391|       |    /* Prepare to load new iMCU row using other xbuffer list */
  392|  24.2k|    main_ptr->whichptr ^= 1;    /* 0=>1 or 1=>0 */
  393|  24.2k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  24.2k|#define FALSE   0               /* values of boolean */
  ------------------
  394|       |    /* Still need to process last row group of this iMCU row, */
  395|       |    /* which is saved at index M+1 of the other xbuffer */
  396|  24.2k|    main_ptr->rowgroup_ctr = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 1);
  ------------------
  |  |   27|  24.2k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  397|  24.2k|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 2);
  ------------------
  |  |   27|  24.2k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  398|  24.2k|    main_ptr->context_state = CTX_POSTPONED_ROW;
  ------------------
  |  |   48|  24.2k|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  399|   388k|  }
  400|   388k|}
jdmainct-8.c:set_bottom_pointers:
  222|  4.91k|{
  223|  4.91k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  224|  4.91k|  int ci, i, rgroup, iMCUheight, rows_left;
  225|  4.91k|  jpeg_component_info *compptr;
  226|  4.91k|  _JSAMPARRAY xbuf;
  ------------------
  |  |  230|  4.91k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  227|       |
  228|  19.6k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (228:44): [True: 14.7k, False: 4.91k]
  ------------------
  229|  14.7k|       ci++, compptr++) {
  230|       |    /* Count sample rows in one iMCU row and in one row group */
  231|  14.7k|    iMCUheight = compptr->v_samp_factor * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  14.7k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  232|  14.7k|    rgroup = iMCUheight / cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  14.7k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  233|       |    /* Count nondummy sample rows remaining for this component */
  234|  14.7k|    rows_left = (int)(compptr->downsampled_height % (JDIMENSION)iMCUheight);
  235|  14.7k|    if (rows_left == 0) rows_left = iMCUheight;
  ------------------
  |  Branch (235:9): [True: 4.42k, False: 10.3k]
  ------------------
  236|       |    /* Count nondummy row groups.  Should get same answer for each component,
  237|       |     * so we need only do it once.
  238|       |     */
  239|  14.7k|    if (ci == 0) {
  ------------------
  |  Branch (239:9): [True: 4.91k, False: 9.82k]
  ------------------
  240|  4.91k|      main_ptr->rowgroups_avail = (JDIMENSION)((rows_left - 1) / rgroup + 1);
  241|  4.91k|    }
  242|       |    /* Duplicate the last real sample row rgroup*2 times; this pads out the
  243|       |     * last partial rowgroup and ensures at least one full rowgroup of context.
  244|       |     */
  245|  14.7k|    xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci];
  246|  54.0k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (246:17): [True: 39.3k, False: 14.7k]
  ------------------
  247|  39.3k|      xbuf[rows_left + i] = xbuf[rows_left - 1];
  248|  39.3k|    }
  249|  14.7k|  }
  250|  4.91k|}
jdmainct-8.c:make_funny_pointers:
  181|  4.91k|{
  182|  4.91k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  183|  4.91k|  int ci, i, rgroup;
  184|  4.91k|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  4.91k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  185|  4.91k|  jpeg_component_info *compptr;
  186|  4.91k|  _JSAMPARRAY buf, xbuf0, xbuf1;
  ------------------
  |  |  230|  4.91k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  187|       |
  188|  19.6k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (188:44): [True: 14.7k, False: 4.91k]
  ------------------
  189|  14.7k|       ci++, compptr++) {
  190|  14.7k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  14.7k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  191|  14.7k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  14.7k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  192|  14.7k|    xbuf0 = main_ptr->xbuffer[0][ci];
  193|  14.7k|    xbuf1 = main_ptr->xbuffer[1][ci];
  194|       |    /* First copy the workspace pointers as-is */
  195|  14.7k|    buf = main_ptr->buffer[ci];
  196|   211k|    for (i = 0; i < rgroup * (M + 2); i++) {
  ------------------
  |  Branch (196:17): [True: 196k, False: 14.7k]
  ------------------
  197|   196k|      xbuf0[i] = xbuf1[i] = buf[i];
  198|   196k|    }
  199|       |    /* In the second list, put the last four row groups in swapped order */
  200|  54.0k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (200:17): [True: 39.3k, False: 14.7k]
  ------------------
  201|  39.3k|      xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i];
  202|  39.3k|      xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i];
  203|  39.3k|    }
  204|       |    /* The wraparound pointers at top and bottom will be filled later
  205|       |     * (see set_wraparound_pointers, below).  Initially we want the "above"
  206|       |     * pointers to duplicate the first actual data line.  This only needs
  207|       |     * to happen in xbuffer[0].
  208|       |     */
  209|  34.3k|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (209:17): [True: 19.6k, False: 14.7k]
  ------------------
  210|  19.6k|      xbuf0[i - rgroup] = xbuf0[0];
  211|  19.6k|    }
  212|  14.7k|  }
  213|  4.91k|}
jdmainct-8.c:process_data_simple_main:
  298|  9.88M|{
  299|  9.88M|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  300|  9.88M|  JDIMENSION rowgroups_avail;
  301|       |
  302|       |  /* Read input data if we haven't filled the main buffer yet */
  303|  9.88M|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (303:7): [True: 1.32M, False: 8.56M]
  ------------------
  304|  1.32M|    if (!(*cinfo->coef->_decompress_data) (cinfo, main_ptr->buffer))
  ------------------
  |  |  258|  1.32M|#define _decompress_data  decompress_data
  ------------------
  |  Branch (304:9): [True: 0, False: 1.32M]
  ------------------
  305|      0|      return;                   /* suspension forced, can do nothing more */
  306|  1.32M|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|  1.32M|#define TRUE    1
  ------------------
  307|  1.32M|  }
  308|       |
  309|       |  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
  310|  9.88M|  rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  9.88M|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  311|       |  /* Note: at the bottom of the image, we may pass extra garbage row groups
  312|       |   * to the postprocessor.  The postprocessor has to check for bottom
  313|       |   * of image anyway (at row resolution), so no point in us doing it too.
  314|       |   */
  315|       |
  316|       |  /* Feed the postprocessor */
  317|  9.88M|  (*cinfo->post->_post_process_data) (cinfo, main_ptr->buffer,
  ------------------
  |  |  260|  9.88M|#define _post_process_data  post_process_data
  ------------------
  318|  9.88M|                                      &main_ptr->rowgroup_ctr, rowgroups_avail,
  319|  9.88M|                                      output_buf, out_row_ctr, out_rows_avail);
  320|       |
  321|       |  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
  322|  9.88M|  if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
  ------------------
  |  Branch (322:7): [True: 1.26M, False: 8.61M]
  ------------------
  323|  1.26M|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  1.26M|#define FALSE   0               /* values of boolean */
  ------------------
  324|  1.26M|    main_ptr->rowgroup_ctr = 0;
  325|  1.26M|  }
  326|  9.88M|}
jdmainct-8.c:alloc_funny_pointers:
  139|  5.26k|{
  140|  5.26k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  141|  5.26k|  int ci, rgroup;
  142|  5.26k|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  5.26k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  143|  5.26k|  jpeg_component_info *compptr;
  144|  5.26k|  _JSAMPARRAY xbuf;
  ------------------
  |  |  230|  5.26k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  145|       |
  146|       |  /* Get top-level space for component array pointers.
  147|       |   * We alloc both arrays with one call to save a few cycles.
  148|       |   */
  149|  5.26k|  main_ptr->xbuffer[0] = (_JSAMPIMAGE)
  150|  5.26k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  5.26k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  151|  5.26k|                                cinfo->num_components * 2 *
  152|  5.26k|                                sizeof(_JSAMPARRAY));
  153|  5.26k|  main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
  154|       |
  155|  21.0k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (155:44): [True: 15.7k, False: 5.26k]
  ------------------
  156|  15.7k|       ci++, compptr++) {
  157|  15.7k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  15.7k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  158|  15.7k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  15.7k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  159|       |    /* Get space for pointer lists --- M+4 row groups in each list.
  160|       |     * We alloc both pointer lists with one call to save a few cycles.
  161|       |     */
  162|  15.7k|    xbuf = (_JSAMPARRAY)
  163|  15.7k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  15.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  164|  15.7k|                                  2 * (rgroup * (M + 4)) * sizeof(_JSAMPROW));
  165|  15.7k|    xbuf += rgroup;             /* want one row group at negative offsets */
  166|  15.7k|    main_ptr->xbuffer[0][ci] = xbuf;
  167|  15.7k|    xbuf += rgroup * (M + 4);
  168|  15.7k|    main_ptr->xbuffer[1][ci] = xbuf;
  169|  15.7k|  }
  170|  5.26k|}
j12init_d_main_controller:
  429|    797|{
  430|    797|  my_main_ptr main_ptr;
  431|    797|  int ci, rgroup, ngroups;
  432|    797|  jpeg_component_info *compptr;
  433|       |
  434|    797|#ifdef D_LOSSLESS_SUPPORTED
  435|    797|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 311, False: 486]
  ------------------
  436|       |#if BITS_IN_JSAMPLE == 8
  437|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  438|       |#else
  439|    311|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    622|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (439:9): [True: 0, False: 311]
  ------------------
  440|    311|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    311|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (440:9): [True: 0, False: 311]
  ------------------
  441|      0|#endif
  442|      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)))
  ------------------
  443|    311|  } else
  444|    486|#endif
  445|    486|  {
  446|    486|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    486|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (446:9): [True: 0, False: 486]
  ------------------
  447|      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)))
  ------------------
  448|    486|  }
  449|       |
  450|    797|  main_ptr = (my_main_ptr)
  451|    797|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    797|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|    797|                                sizeof(my_main_controller));
  453|    797|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|    797|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|    797|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|    797|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 797]
  ------------------
  458|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  459|       |
  460|       |  /* Allocate the workspace.
  461|       |   * ngroups is the number of row groups we need.
  462|       |   */
  463|    797|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 0, False: 797]
  ------------------
  464|      0|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 0]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|      0|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|      0|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|    797|  } else {
  469|    797|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    797|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|    797|  }
  471|       |
  472|  1.59k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 797, False: 797]
  ------------------
  473|    797|       ci++, compptr++) {
  474|    797|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    797|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|    797|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|    797|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|    797|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|    797|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    797|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|    797|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|    797|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|    797|                         (JDIMENSION)(rgroup * ngroups));
  480|    797|  }
  481|    797|}
jdmainct-12.c:start_pass_main:
  259|    781|{
  260|    781|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|    781|  switch (pass_mode) {
  263|    781|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 781, False: 0]
  ------------------
  264|    781|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 0, False: 781]
  ------------------
  265|      0|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |  140|      0|#define _process_data  process_data_12
  ------------------
  266|      0|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  267|      0|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  268|      0|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|      0|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  269|      0|      main_ptr->iMCU_row_ctr = 0;
  270|    781|    } else {
  271|       |      /* Simple case with no context needed */
  272|    781|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  140|    781|#define _process_data  process_data_12
  ------------------
  273|    781|    }
  274|    781|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|    781|#define FALSE   0               /* values of boolean */
  ------------------
  275|    781|    main_ptr->rowgroup_ctr = 0;
  276|    781|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 781]
  ------------------
  279|       |    /* For last pass of 2-pass quantization, just crank the postprocessor */
  280|      0|    main_ptr->pub._process_data = process_data_crank_post;
  ------------------
  |  |  140|      0|#define _process_data  process_data_12
  ------------------
  281|      0|    break;
  282|      0|#endif
  283|      0|  default:
  ------------------
  |  Branch (283:3): [True: 0, False: 781]
  ------------------
  284|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  285|      0|    break;
  286|    781|  }
  287|    781|}
jdmainct-12.c:process_data_simple_main:
  298|  1.74M|{
  299|  1.74M|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  300|  1.74M|  JDIMENSION rowgroups_avail;
  301|       |
  302|       |  /* Read input data if we haven't filled the main buffer yet */
  303|  1.74M|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (303:7): [True: 317k, False: 1.43M]
  ------------------
  304|   317k|    if (!(*cinfo->coef->_decompress_data) (cinfo, main_ptr->buffer))
  ------------------
  |  |  142|   317k|#define _decompress_data  decompress_data_12
  ------------------
  |  Branch (304:9): [True: 0, False: 317k]
  ------------------
  305|      0|      return;                   /* suspension forced, can do nothing more */
  306|   317k|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|   317k|#define TRUE    1
  ------------------
  307|   317k|  }
  308|       |
  309|       |  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
  310|  1.74M|  rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.74M|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  311|       |  /* Note: at the bottom of the image, we may pass extra garbage row groups
  312|       |   * to the postprocessor.  The postprocessor has to check for bottom
  313|       |   * of image anyway (at row resolution), so no point in us doing it too.
  314|       |   */
  315|       |
  316|       |  /* Feed the postprocessor */
  317|  1.74M|  (*cinfo->post->_post_process_data) (cinfo, main_ptr->buffer,
  ------------------
  |  |  144|  1.74M|#define _post_process_data  post_process_data_12
  ------------------
  318|  1.74M|                                      &main_ptr->rowgroup_ctr, rowgroups_avail,
  319|  1.74M|                                      output_buf, out_row_ctr, out_rows_avail);
  320|       |
  321|       |  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
  322|  1.74M|  if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
  ------------------
  |  Branch (322:7): [True: 317k, False: 1.43M]
  ------------------
  323|   317k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|   317k|#define FALSE   0               /* values of boolean */
  ------------------
  324|   317k|    main_ptr->rowgroup_ctr = 0;
  325|   317k|  }
  326|  1.74M|}

jdmainct-8.c:set_wraparound_pointers:
   56|  4.62k|{
   57|  4.62k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
   58|  4.62k|  int ci, i, rgroup;
   59|  4.62k|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  4.62k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
   60|  4.62k|  jpeg_component_info *compptr;
   61|  4.62k|  _JSAMPARRAY xbuf0, xbuf1;
  ------------------
  |  |  230|  4.62k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
   62|       |
   63|  18.5k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (63:44): [True: 13.8k, False: 4.62k]
  ------------------
   64|  13.8k|       ci++, compptr++) {
   65|  13.8k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  13.8k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
   66|  13.8k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  13.8k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
   67|  13.8k|    xbuf0 = main_ptr->xbuffer[0][ci];
   68|  13.8k|    xbuf1 = main_ptr->xbuffer[1][ci];
   69|  32.3k|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (69:17): [True: 18.5k, False: 13.8k]
  ------------------
   70|  18.5k|      xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i];
   71|  18.5k|      xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i];
   72|  18.5k|      xbuf0[rgroup * (M + 2) + i] = xbuf0[i];
   73|  18.5k|      xbuf1[rgroup * (M + 2) + i] = xbuf1[i];
   74|  18.5k|    }
   75|  13.8k|  }
   76|  4.62k|}

jpeg_resync_to_restart:
 1218|   115k|{
 1219|   115k|  int marker = cinfo->unread_marker;
 1220|   115k|  int action = 1;
 1221|       |
 1222|       |  /* Always put up a warning. */
 1223|   115k|  WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
  ------------------
  |  |  290|   115k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|   115k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|   115k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|   115k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
 1224|       |
 1225|       |  /* Outer loop handles repeated decision after scanning forward. */
 1226|   118k|  for (;;) {
 1227|   118k|    if (marker < (int)M_SOF0)
  ------------------
  |  Branch (1227:9): [True: 2.57k, False: 115k]
  ------------------
 1228|  2.57k|      action = 2;               /* invalid marker */
 1229|   115k|    else if (marker < (int)M_RST0 || marker > (int)M_RST7)
  ------------------
  |  Branch (1229:14): [True: 522, False: 115k]
  |  Branch (1229:38): [True: 113k, False: 1.98k]
  ------------------
 1230|   113k|      action = 3;               /* valid non-restart marker */
 1231|  1.98k|    else {
 1232|  1.98k|      if (marker == ((int)M_RST0 + ((desired + 1) & 7)) ||
  ------------------
  |  Branch (1232:11): [True: 486, False: 1.49k]
  ------------------
 1233|  1.49k|          marker == ((int)M_RST0 + ((desired + 2) & 7)))
  ------------------
  |  Branch (1233:11): [True: 458, False: 1.04k]
  ------------------
 1234|    944|        action = 3;             /* one of the next two expected restarts */
 1235|  1.04k|      else if (marker == ((int)M_RST0 + ((desired - 1) & 7)) ||
  ------------------
  |  Branch (1235:16): [True: 382, False: 658]
  ------------------
 1236|    658|               marker == ((int)M_RST0 + ((desired - 2) & 7)))
  ------------------
  |  Branch (1236:16): [True: 222, False: 436]
  ------------------
 1237|    604|        action = 2;             /* a prior restart, so advance */
 1238|    436|      else
 1239|    436|        action = 1;             /* desired restart or too far away */
 1240|  1.98k|    }
 1241|   118k|    TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
  ------------------
  |  |  304|   118k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|   118k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|   118k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|   118k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1242|   118k|    switch (action) {
  ------------------
  |  Branch (1242:13): [True: 118k, False: 0]
  ------------------
 1243|    436|    case 1:
  ------------------
  |  Branch (1243:5): [True: 436, False: 117k]
  ------------------
 1244|       |      /* Discard marker and let entropy decoder resume processing. */
 1245|    436|      cinfo->unread_marker = 0;
 1246|    436|      return TRUE;
  ------------------
  |  |  210|    436|#define TRUE    1
  ------------------
 1247|  3.17k|    case 2:
  ------------------
  |  Branch (1247:5): [True: 3.17k, False: 115k]
  ------------------
 1248|       |      /* Scan to the next marker, and repeat the decision loop. */
 1249|  3.17k|      if (!next_marker(cinfo))
  ------------------
  |  Branch (1249:11): [True: 0, False: 3.17k]
  ------------------
 1250|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1251|  3.17k|      marker = cinfo->unread_marker;
 1252|  3.17k|      break;
 1253|   114k|    case 3:
  ------------------
  |  Branch (1253:5): [True: 114k, False: 3.61k]
  ------------------
 1254|       |      /* Return without advancing past this marker. */
 1255|       |      /* Entropy decoder will be forced to process an empty segment. */
 1256|   114k|      return TRUE;
  ------------------
  |  |  210|   114k|#define TRUE    1
  ------------------
 1257|   118k|    }
 1258|   118k|  } /* end loop */
 1259|   115k|}
jinit_marker_reader:
 1288|  37.3k|{
 1289|  37.3k|  my_marker_ptr marker;
 1290|  37.3k|  int i;
 1291|       |
 1292|       |  /* Create subobject in permanent pool */
 1293|  37.3k|  marker = (my_marker_ptr)
 1294|  37.3k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  37.3k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
 1295|  37.3k|                                sizeof(my_marker_reader));
 1296|  37.3k|  cinfo->marker = (struct jpeg_marker_reader *)marker;
 1297|       |  /* Initialize public method pointers */
 1298|  37.3k|  marker->pub.reset_marker_reader = reset_marker_reader;
 1299|  37.3k|  marker->pub.read_markers = read_markers;
 1300|  37.3k|  marker->pub.read_restart_marker = read_restart_marker;
 1301|       |  /* Initialize COM/APPn processing.
 1302|       |   * By default, we examine and then discard APP0 and APP14,
 1303|       |   * but simply discard COM and all other APPn.
 1304|       |   */
 1305|  37.3k|  marker->process_COM = skip_variable;
 1306|  37.3k|  marker->length_limit_COM = 0;
 1307|   634k|  for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (1307:15): [True: 597k, False: 37.3k]
  ------------------
 1308|   597k|    marker->process_APPn[i] = skip_variable;
 1309|   597k|    marker->length_limit_APPn[i] = 0;
 1310|   597k|  }
 1311|  37.3k|  marker->process_APPn[0] = get_interesting_appn;
 1312|  37.3k|  marker->process_APPn[14] = get_interesting_appn;
 1313|       |  /* Reset marker processing state */
 1314|  37.3k|  reset_marker_reader(cinfo);
 1315|  37.3k|}
jdmarker.c:next_marker:
  892|   459k|{
  893|   459k|  int c;
  894|   459k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   459k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   459k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   459k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  895|       |
  896|   481k|  for (;;) {
  897|   481k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   481k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.23M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 252k]
  |  |  |  |  |  Branch (279:38): [True: 252k, False: 229k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 481k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   481k|            bytes_in_buffer--; \
  |  |  156|   481k|            V = *next_input_byte++; )
  ------------------
  898|       |    /* Skip any non-FF bytes.
  899|       |     * This may look a bit inefficient, but it will not occur in a valid file.
  900|       |     * We sync after each discarded byte so that a suspending data source
  901|       |     * can discard the byte from its buffer.
  902|       |     */
  903|  4.86M|    while (c != 0xFF) {
  ------------------
  |  Branch (903:12): [True: 4.38M, False: 481k]
  ------------------
  904|  4.38M|      cinfo->marker->discarded_bytes++;
  905|  4.38M|      INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  4.38M|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  4.38M|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  906|  4.38M|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  4.38M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.41M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 11.1k]
  |  |  |  |  |  Branch (279:38): [True: 11.1k, False: 4.37M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 4.38M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  4.38M|            bytes_in_buffer--; \
  |  |  156|  4.38M|            V = *next_input_byte++; )
  ------------------
  907|  4.38M|    }
  908|       |    /* This loop swallows any duplicate FF bytes.  Extra FFs are legal as
  909|       |     * pad bytes, so don't count them in discarded_bytes.  We assume there
  910|       |     * will not be so many consecutive FF bytes as to overflow a suspending
  911|       |     * data source's input buffer.
  912|       |     */
  913|   821k|    do {
  914|   821k|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   821k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   828k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.29k]
  |  |  |  |  |  Branch (279:38): [True: 2.29k, False: 819k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 821k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   821k|            bytes_in_buffer--; \
  |  |  156|   821k|            V = *next_input_byte++; )
  ------------------
  915|   821k|    } while (c == 0xFF);
  ------------------
  |  Branch (915:14): [True: 339k, False: 481k]
  ------------------
  916|   481k|    if (c != 0)
  ------------------
  |  Branch (916:9): [True: 459k, False: 21.9k]
  ------------------
  917|   459k|      break;                    /* found a valid marker, exit loop */
  918|       |    /* Reach here if we found a stuffed-zero data sequence (FF/00).
  919|       |     * Discard it and loop back to try again.
  920|       |     */
  921|  21.9k|    cinfo->marker->discarded_bytes += 2;
  922|  21.9k|    INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  21.9k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  21.9k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  923|  21.9k|  }
  924|       |
  925|   459k|  if (cinfo->marker->discarded_bytes != 0) {
  ------------------
  |  Branch (925:7): [True: 143k, False: 316k]
  ------------------
  926|   143k|    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
  ------------------
  |  |  290|   143k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|   143k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|   143k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|   143k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  927|   143k|    cinfo->marker->discarded_bytes = 0;
  928|   143k|  }
  929|       |
  930|   459k|  cinfo->unread_marker = c;
  931|       |
  932|   459k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   459k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   459k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  933|   459k|  return TRUE;
  ------------------
  |  |  210|   459k|#define TRUE    1
  ------------------
  934|   459k|}
jdmarker.c:reset_marker_reader:
 1268|   213k|{
 1269|   213k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1270|       |
 1271|   213k|  cinfo->comp_info = NULL;              /* until allocated by get_sof */
 1272|   213k|  cinfo->input_scan_number = 0;         /* no SOS seen yet */
 1273|   213k|  cinfo->unread_marker = 0;             /* no pending marker */
 1274|   213k|  marker->pub.saw_SOI = FALSE;          /* set internal state too */
  ------------------
  |  |  207|   213k|#define FALSE   0               /* values of boolean */
  ------------------
 1275|   213k|  marker->pub.saw_SOF = FALSE;
  ------------------
  |  |  207|   213k|#define FALSE   0               /* values of boolean */
  ------------------
 1276|   213k|  marker->pub.discarded_bytes = 0;
 1277|       |  marker->cur_marker = NULL;
 1278|   213k|}
jdmarker.c:read_markers:
  970|   219k|{
  971|       |  /* Outer loop repeats once for each marker. */
  972|   659k|  for (;;) {
  973|       |    /* Collect the marker proper, unless we already did. */
  974|       |    /* NB: first_marker() enforces the requirement that SOI appear first. */
  975|   659k|    if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (975:9): [True: 630k, False: 29.1k]
  ------------------
  976|   630k|      if (!cinfo->marker->saw_SOI) {
  ------------------
  |  Branch (976:11): [True: 176k, False: 454k]
  ------------------
  977|   176k|        if (!first_marker(cinfo))
  ------------------
  |  Branch (977:13): [True: 0, False: 176k]
  ------------------
  978|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  979|   454k|      } else {
  980|   454k|        if (!next_marker(cinfo))
  ------------------
  |  Branch (980:13): [True: 0, False: 454k]
  ------------------
  981|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  982|   454k|      }
  983|   630k|    }
  984|       |    /* At this point cinfo->unread_marker contains the marker code and the
  985|       |     * input point is just past the marker proper, but before any parameters.
  986|       |     * A suspension will cause us to return with this state still true.
  987|       |     */
  988|   659k|    switch (cinfo->unread_marker) {
  989|  92.1k|    case M_SOI:
  ------------------
  |  Branch (989:5): [True: 92.1k, False: 567k]
  ------------------
  990|  92.1k|      if (!get_soi(cinfo))
  ------------------
  |  Branch (990:11): [True: 0, False: 92.1k]
  ------------------
  991|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  992|  92.1k|      break;
  993|       |
  994|  92.1k|    case M_SOF0:                /* Baseline */
  ------------------
  |  Branch (994:5): [True: 45.5k, False: 614k]
  ------------------
  995|  47.3k|    case M_SOF1:                /* Extended sequential, Huffman */
  ------------------
  |  Branch (995:5): [True: 1.82k, False: 658k]
  ------------------
  996|  47.3k|      if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  47.3k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  47.3k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  47.3k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (996:11): [True: 0, False: 47.3k]
  ------------------
  997|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  998|  47.3k|      break;
  999|       |
 1000|  47.3k|    case M_SOF2:                /* Progressive, Huffman */
  ------------------
  |  Branch (1000:5): [True: 9.70k, False: 650k]
  ------------------
 1001|  9.70k|      if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  210|  9.70k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|  9.70k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|  9.70k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1001:11): [True: 0, False: 9.70k]
  ------------------
 1002|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1003|  9.70k|      break;
 1004|       |
 1005|  9.70k|    case M_SOF3:                /* Lossless, Huffman */
  ------------------
  |  Branch (1005:5): [True: 7.13k, False: 652k]
  ------------------
 1006|  7.13k|      if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|  7.13k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  210|  7.13k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|  7.13k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1006:11): [True: 0, False: 7.13k]
  ------------------
 1007|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1008|  7.13k|      break;
 1009|       |
 1010|  7.99k|    case M_SOF9:                /* Extended sequential, arithmetic */
  ------------------
  |  Branch (1010:5): [True: 7.99k, False: 651k]
  ------------------
 1011|  7.99k|      if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|  7.99k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|  7.99k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  210|  7.99k|#define TRUE    1
  ------------------
  |  Branch (1011:11): [True: 0, False: 7.99k]
  ------------------
 1012|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1013|  7.99k|      break;
 1014|       |
 1015|  12.6k|    case M_SOF10:               /* Progressive, arithmetic */
  ------------------
  |  Branch (1015:5): [True: 12.6k, False: 647k]
  ------------------
 1016|  12.6k|      if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|  12.6k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  207|  12.6k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|  12.6k|#define TRUE    1
  ------------------
  |  Branch (1016:11): [True: 0, False: 12.6k]
  ------------------
 1017|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1018|  12.6k|      break;
 1019|       |
 1020|  12.6k|    case M_SOF11:               /* Lossless, arithmetic */
  ------------------
  |  Branch (1020:5): [True: 1.18k, False: 658k]
  ------------------
 1021|  1.18k|      if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  207|  1.18k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|  1.18k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|  1.18k|#define TRUE    1
  ------------------
  |  Branch (1021:11): [True: 0, False: 1.18k]
  ------------------
 1022|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1023|  1.18k|      break;
 1024|       |
 1025|       |    /* Currently unsupported SOFn types */
 1026|  1.18k|    case M_SOF5:                /* Differential sequential, Huffman */
  ------------------
  |  Branch (1026:5): [True: 142, False: 659k]
  ------------------
 1027|    283|    case M_SOF6:                /* Differential progressive, Huffman */
  ------------------
  |  Branch (1027:5): [True: 141, False: 659k]
  ------------------
 1028|    535|    case M_SOF7:                /* Differential lossless, Huffman */
  ------------------
  |  Branch (1028:5): [True: 252, False: 659k]
  ------------------
 1029|    831|    case M_JPG:                 /* Reserved for JPEG extensions */
  ------------------
  |  Branch (1029:5): [True: 296, False: 659k]
  ------------------
 1030|    959|    case M_SOF13:               /* Differential sequential, arithmetic */
  ------------------
  |  Branch (1030:5): [True: 128, False: 659k]
  ------------------
 1031|  1.17k|    case M_SOF14:               /* Differential progressive, arithmetic */
  ------------------
  |  Branch (1031:5): [True: 220, False: 659k]
  ------------------
 1032|  1.31k|    case M_SOF15:               /* Differential lossless, arithmetic */
  ------------------
  |  Branch (1032:5): [True: 136, False: 659k]
  ------------------
 1033|  1.31k|      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
  ------------------
  |  |  243|  1.31k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  1.31k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  1.31k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1034|  1.31k|      break;
 1035|       |
 1036|  93.5k|    case M_SOS:
  ------------------
  |  Branch (1036:5): [True: 93.5k, False: 566k]
  ------------------
 1037|  93.5k|      if (!get_sos(cinfo))
  ------------------
  |  Branch (1037:11): [True: 0, False: 93.5k]
  ------------------
 1038|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1039|  93.5k|      cinfo->unread_marker = 0; /* processed the marker */
 1040|  93.5k|      return JPEG_REACHED_SOS;
  ------------------
  |  | 1111|  93.5k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
 1041|       |
 1042|  30.4k|    case M_EOI:
  ------------------
  |  Branch (1042:5): [True: 30.4k, False: 629k]
  ------------------
 1043|  30.4k|      TRACEMS(cinfo, 1, JTRC_EOI);
  ------------------
  |  |  297|  30.4k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  30.4k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1044|  30.4k|      cinfo->unread_marker = 0; /* processed the marker */
 1045|  30.4k|      return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|  30.4k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
 1046|       |
 1047|    946|    case M_DAC:
  ------------------
  |  Branch (1047:5): [True: 946, False: 658k]
  ------------------
 1048|    946|      if (!get_dac(cinfo))
  ------------------
  |  Branch (1048:11): [True: 0, False: 946]
  ------------------
 1049|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1050|    946|      break;
 1051|       |
 1052|   153k|    case M_DHT:
  ------------------
  |  Branch (1052:5): [True: 153k, False: 506k]
  ------------------
 1053|   153k|      if (!get_dht(cinfo))
  ------------------
  |  Branch (1053:11): [True: 0, False: 153k]
  ------------------
 1054|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1055|   153k|      break;
 1056|       |
 1057|   153k|    case M_DQT:
  ------------------
  |  Branch (1057:5): [True: 82.8k, False: 576k]
  ------------------
 1058|  82.8k|      if (!get_dqt(cinfo))
  ------------------
  |  Branch (1058:11): [True: 0, False: 82.8k]
  ------------------
 1059|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1060|  82.8k|      break;
 1061|       |
 1062|  82.8k|    case M_DRI:
  ------------------
  |  Branch (1062:5): [True: 5.65k, False: 654k]
  ------------------
 1063|  5.65k|      if (!get_dri(cinfo))
  ------------------
  |  Branch (1063:11): [True: 0, False: 5.65k]
  ------------------
 1064|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1065|  5.65k|      break;
 1066|       |
 1067|  5.65k|    case M_APP0:
  ------------------
  |  Branch (1067:5): [True: 4.17k, False: 655k]
  ------------------
 1068|  5.11k|    case M_APP1:
  ------------------
  |  Branch (1068:5): [True: 942, False: 658k]
  ------------------
 1069|  5.30k|    case M_APP2:
  ------------------
  |  Branch (1069:5): [True: 186, False: 659k]
  ------------------
 1070|  5.59k|    case M_APP3:
  ------------------
  |  Branch (1070:5): [True: 292, False: 659k]
  ------------------
 1071|  6.10k|    case M_APP4:
  ------------------
  |  Branch (1071:5): [True: 509, False: 659k]
  ------------------
 1072|  6.36k|    case M_APP5:
  ------------------
  |  Branch (1072:5): [True: 264, False: 659k]
  ------------------
 1073|  7.11k|    case M_APP6:
  ------------------
  |  Branch (1073:5): [True: 746, False: 659k]
  ------------------
 1074|  7.38k|    case M_APP7:
  ------------------
  |  Branch (1074:5): [True: 272, False: 659k]
  ------------------
 1075|  7.61k|    case M_APP8:
  ------------------
  |  Branch (1075:5): [True: 232, False: 659k]
  ------------------
 1076|  8.04k|    case M_APP9:
  ------------------
  |  Branch (1076:5): [True: 427, False: 659k]
  ------------------
 1077|  8.21k|    case M_APP10:
  ------------------
  |  Branch (1077:5): [True: 166, False: 659k]
  ------------------
 1078|  8.54k|    case M_APP11:
  ------------------
  |  Branch (1078:5): [True: 328, False: 659k]
  ------------------
 1079|  8.70k|    case M_APP12:
  ------------------
  |  Branch (1079:5): [True: 167, False: 659k]
  ------------------
 1080|  9.06k|    case M_APP13:
  ------------------
  |  Branch (1080:5): [True: 358, False: 659k]
  ------------------
 1081|  12.6k|    case M_APP14:
  ------------------
  |  Branch (1081:5): [True: 3.60k, False: 656k]
  ------------------
 1082|  13.2k|    case M_APP15:
  ------------------
  |  Branch (1082:5): [True: 632, False: 659k]
  ------------------
 1083|  13.2k|      if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
  ------------------
  |  Branch (1083:11): [True: 0, False: 13.2k]
  ------------------
 1084|  13.2k|               cinfo->unread_marker - (int)M_APP0]) (cinfo))
 1085|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1086|  13.2k|      break;
 1087|       |
 1088|  13.2k|    case M_COM:
  ------------------
  |  Branch (1088:5): [True: 2.01k, False: 657k]
  ------------------
 1089|  2.01k|      if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
  ------------------
  |  Branch (1089:11): [True: 0, False: 2.01k]
  ------------------
 1090|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1091|  2.01k|      break;
 1092|       |
 1093|  2.01k|    case M_RST0:                /* these are all parameterless */
  ------------------
  |  Branch (1093:5): [True: 269, False: 659k]
  ------------------
 1094|    618|    case M_RST1:
  ------------------
  |  Branch (1094:5): [True: 349, False: 659k]
  ------------------
 1095|  1.71k|    case M_RST2:
  ------------------
  |  Branch (1095:5): [True: 1.09k, False: 658k]
  ------------------
 1096|  2.25k|    case M_RST3:
  ------------------
  |  Branch (1096:5): [True: 536, False: 659k]
  ------------------
 1097|  2.72k|    case M_RST4:
  ------------------
  |  Branch (1097:5): [True: 470, False: 659k]
  ------------------
 1098|  4.06k|    case M_RST5:
  ------------------
  |  Branch (1098:5): [True: 1.34k, False: 658k]
  ------------------
 1099|  5.10k|    case M_RST6:
  ------------------
  |  Branch (1099:5): [True: 1.03k, False: 658k]
  ------------------
 1100|  6.85k|    case M_RST7:
  ------------------
  |  Branch (1100:5): [True: 1.75k, False: 658k]
  ------------------
 1101|  11.2k|    case M_TEM:
  ------------------
  |  Branch (1101:5): [True: 4.35k, False: 655k]
  ------------------
 1102|  11.2k|      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
  ------------------
  |  |  300|  11.2k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  11.2k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  11.2k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1103|  11.2k|      break;
 1104|       |
 1105|    879|    case M_DNL:                 /* Ignore DNL ... perhaps the wrong thing */
  ------------------
  |  Branch (1105:5): [True: 879, False: 659k]
  ------------------
 1106|    879|      if (!skip_variable(cinfo))
  ------------------
  |  Branch (1106:11): [True: 0, False: 879]
  ------------------
 1107|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1108|    879|      break;
 1109|       |
 1110|  1.78k|    default:                    /* must be DHP, EXP, JPGn, or RESn */
  ------------------
  |  Branch (1110:5): [True: 1.78k, False: 658k]
  ------------------
 1111|       |      /* For now, we treat the reserved markers as fatal errors since they are
 1112|       |       * likely to be used to signal incompatible JPEG Part 3 extensions.
 1113|       |       * Once the JPEG 3 version-number marker is well defined, this code
 1114|       |       * ought to change!
 1115|       |       */
 1116|  1.78k|      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|  1.78k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  1.78k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  1.78k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1117|  1.78k|      break;
 1118|   659k|    }
 1119|       |    /* Successfully processed marker, so reset state variable */
 1120|   440k|    cinfo->unread_marker = 0;
 1121|   440k|  } /* end loop */
 1122|   219k|}
jdmarker.c:first_marker:
  945|   176k|{
  946|   176k|  int c, c2;
  947|   176k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   176k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   176k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   176k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  948|       |
  949|   176k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   176k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   282k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 35.4k]
  |  |  |  |  |  Branch (279:38): [True: 35.4k, False: 140k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 176k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   176k|            bytes_in_buffer--; \
  |  |  156|   176k|            V = *next_input_byte++; )
  ------------------
  950|   176k|  INPUT_BYTE(cinfo, c2, return FALSE);
  ------------------
  |  |  154|   176k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   211k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 11.9k]
  |  |  |  |  |  Branch (279:38): [True: 11.9k, False: 164k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 176k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   176k|            bytes_in_buffer--; \
  |  |  156|   176k|            V = *next_input_byte++; )
  ------------------
  951|   176k|  if (c != 0xFF || c2 != (int)M_SOI)
  ------------------
  |  Branch (951:7): [True: 79.5k, False: 96.5k]
  |  Branch (951:20): [True: 4.65k, False: 91.9k]
  ------------------
  952|  84.2k|    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
  ------------------
  |  |  247|  84.2k|  ((cinfo)->err->msg_code = (code), \
  |  |  248|  84.2k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|  84.2k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|  84.2k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  953|       |
  954|   176k|  cinfo->unread_marker = c2;
  955|       |
  956|   176k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   176k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   176k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  957|   176k|  return TRUE;
  ------------------
  |  |  210|   176k|#define TRUE    1
  ------------------
  958|   176k|}
jdmarker.c:get_soi:
  204|  92.1k|{
  205|  92.1k|  int i;
  206|       |
  207|  92.1k|  TRACEMS(cinfo, 1, JTRC_SOI);
  ------------------
  |  |  297|  92.1k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  92.1k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  208|       |
  209|  92.1k|  if (cinfo->marker->saw_SOI)
  ------------------
  |  Branch (209:7): [True: 171, False: 91.9k]
  ------------------
  210|    171|    ERREXIT(cinfo, JERR_SOI_DUPLICATE);
  ------------------
  |  |  240|    171|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    171|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  211|       |
  212|       |  /* Reset all parameters that are defined to be reset by SOI */
  213|       |
  214|  1.56M|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|  1.56M|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (214:15): [True: 1.47M, False: 92.1k]
  ------------------
  215|  1.47M|    cinfo->arith_dc_L[i] = 0;
  216|  1.47M|    cinfo->arith_dc_U[i] = 1;
  217|  1.47M|    cinfo->arith_ac_K[i] = 5;
  218|  1.47M|  }
  219|  92.1k|  cinfo->restart_interval = 0;
  220|       |
  221|       |  /* Set initial assumptions for colorspace etc */
  222|       |
  223|  92.1k|  cinfo->jpeg_color_space = JCS_UNKNOWN;
  224|  92.1k|  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
  ------------------
  |  |  207|  92.1k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|  92.1k|  cinfo->saw_JFIF_marker = FALSE;
  ------------------
  |  |  207|  92.1k|#define FALSE   0               /* values of boolean */
  ------------------
  227|  92.1k|  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
  228|  92.1k|  cinfo->JFIF_minor_version = 1;
  229|  92.1k|  cinfo->density_unit = 0;
  230|  92.1k|  cinfo->X_density = 1;
  231|  92.1k|  cinfo->Y_density = 1;
  232|  92.1k|  cinfo->saw_Adobe_marker = FALSE;
  ------------------
  |  |  207|  92.1k|#define FALSE   0               /* values of boolean */
  ------------------
  233|  92.1k|  cinfo->Adobe_transform = 0;
  234|       |
  235|  92.1k|  cinfo->marker->saw_SOI = TRUE;
  ------------------
  |  |  210|  92.1k|#define TRUE    1
  ------------------
  236|       |
  237|  92.1k|  return TRUE;
  ------------------
  |  |  210|  92.1k|#define TRUE    1
  ------------------
  238|  92.1k|}
jdmarker.c:get_sof:
  245|  86.0k|{
  246|  86.0k|  JLONG length;
  247|  86.0k|  int c, ci;
  248|  86.0k|  jpeg_component_info *compptr;
  249|  86.0k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  86.0k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  86.0k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  86.0k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  250|       |
  251|  86.0k|  if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (251:7): [True: 386, False: 85.6k]
  ------------------
  252|    386|    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
  ------------------
  |  |  240|    386|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    386|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  253|       |
  254|  86.0k|  cinfo->progressive_mode = is_prog;
  255|  86.0k|  cinfo->master->lossless = is_lossless;
  256|  86.0k|  cinfo->arith_code = is_arith;
  257|       |
  258|  86.0k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  86.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   173k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 173]
  |  |  |  |  |  Branch (279:38): [True: 173, False: 85.8k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 170]
  |  |  |  |  |  Branch (279:38): [True: 170, False: 85.8k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 86.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  86.0k|            bytes_in_buffer--; \
  |  |  164|  86.0k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  86.0k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  86.0k|            bytes_in_buffer--; \
  |  |  167|  86.0k|            V += *next_input_byte++; )
  ------------------
  259|       |
  260|  86.0k|  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  ------------------
  |  |  154|  86.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  87.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 321]
  |  |  |  |  |  Branch (279:38): [True: 321, False: 85.7k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 86.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  86.0k|            bytes_in_buffer--; \
  |  |  156|  86.0k|            V = *next_input_byte++; )
  ------------------
  261|  86.0k|  cinfo->master->jpeg_data_precision = cinfo->data_precision;
  262|  86.0k|  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  ------------------
  |  |  162|  86.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   174k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 189]
  |  |  |  |  |  Branch (279:38): [True: 189, False: 85.8k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 490]
  |  |  |  |  |  Branch (279:38): [True: 490, False: 85.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 86.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  86.0k|            bytes_in_buffer--; \
  |  |  164|  86.0k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  86.0k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  86.0k|            bytes_in_buffer--; \
  |  |  167|  86.0k|            V += *next_input_byte++; )
  ------------------
  263|  86.0k|  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  ------------------
  |  |  162|  86.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   175k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 392]
  |  |  |  |  |  Branch (279:38): [True: 392, False: 85.6k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 652]
  |  |  |  |  |  Branch (279:38): [True: 652, False: 85.3k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 86.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  86.0k|            bytes_in_buffer--; \
  |  |  164|  86.0k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  86.0k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  86.0k|            bytes_in_buffer--; \
  |  |  167|  86.0k|            V += *next_input_byte++; )
  ------------------
  264|  86.0k|  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
  ------------------
  |  |  154|  86.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  88.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 716]
  |  |  |  |  |  Branch (279:38): [True: 716, False: 85.3k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 86.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  86.0k|            bytes_in_buffer--; \
  |  |  156|  86.0k|            V = *next_input_byte++; )
  ------------------
  265|       |
  266|  86.0k|  length -= 8;
  267|       |
  268|  86.0k|  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
  ------------------
  |  |  314|  86.0k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  86.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 86.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  86.0k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  86.0k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  86.0k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  269|  86.0k|           (int)cinfo->image_width, (int)cinfo->image_height,
  270|  86.0k|           cinfo->num_components);
  271|       |
  272|       |  /* We don't support files in which the image height is initially specified */
  273|       |  /* as 0 and is later redefined by DNL.  As long as we have to check that,  */
  274|       |  /* might as well have a general sanity check. */
  275|  86.0k|  if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
  ------------------
  |  Branch (275:7): [True: 585, False: 85.4k]
  |  Branch (275:35): [True: 195, False: 85.2k]
  ------------------
  276|  85.2k|      cinfo->num_components <= 0)
  ------------------
  |  Branch (276:7): [True: 199, False: 85.0k]
  ------------------
  277|    593|    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
  ------------------
  |  |  240|    593|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    593|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |
  279|  86.0k|  if (length != (cinfo->num_components * 3))
  ------------------
  |  Branch (279:7): [True: 1.37k, False: 84.6k]
  ------------------
  280|  1.37k|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|  1.37k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.37k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  281|       |
  282|  86.0k|  if (cinfo->comp_info == NULL) /* do only once, even if suspend */
  ------------------
  |  Branch (282:7): [True: 83.6k, False: 2.34k]
  ------------------
  283|  83.6k|    cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
  284|  83.6k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  83.6k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  285|  83.6k|                         cinfo->num_components * sizeof(jpeg_component_info));
  286|       |
  287|   215k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (287:44): [True: 128k, False: 86.0k]
  ------------------
  288|   128k|       ci++, compptr++) {
  289|   128k|    compptr->component_index = ci;
  290|   128k|    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
  ------------------
  |  |  154|   128k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   130k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 403]
  |  |  |  |  |  Branch (279:38): [True: 403, False: 128k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 128k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   128k|            bytes_in_buffer--; \
  |  |  156|   128k|            V = *next_input_byte++; )
  ------------------
  291|   128k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   128k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   130k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 440]
  |  |  |  |  |  Branch (279:38): [True: 440, False: 128k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 128k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   128k|            bytes_in_buffer--; \
  |  |  156|   128k|            V = *next_input_byte++; )
  ------------------
  292|   128k|    compptr->h_samp_factor = (c >> 4) & 15;
  293|   128k|    compptr->v_samp_factor = (c     ) & 15;
  294|   128k|    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
  ------------------
  |  |  154|   128k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   130k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 649]
  |  |  |  |  |  Branch (279:38): [True: 649, False: 128k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 128k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   128k|            bytes_in_buffer--; \
  |  |  156|   128k|            V = *next_input_byte++; )
  ------------------
  295|       |
  296|   128k|    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
  ------------------
  |  |  314|   128k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   128k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 128k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|   128k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|   128k|           (cinfo)->err->msg_code = (code); \
  |  |  317|   128k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  297|   128k|             compptr->component_id, compptr->h_samp_factor,
  298|   128k|             compptr->v_samp_factor, compptr->quant_tbl_no);
  299|   128k|  }
  300|       |
  301|  86.0k|  cinfo->marker->saw_SOF = TRUE;
  ------------------
  |  |  210|  86.0k|#define TRUE    1
  ------------------
  302|       |
  303|  86.0k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  86.0k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  86.0k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  304|  86.0k|  return TRUE;
  ------------------
  |  |  210|  86.0k|#define TRUE    1
  ------------------
  305|  86.0k|}
jdmarker.c:get_sos:
  311|  93.5k|{
  312|  93.5k|  JLONG length;
  313|  93.5k|  int i, ci, n, c, cc, pi;
  314|  93.5k|  jpeg_component_info *compptr;
  315|  93.5k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  93.5k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  93.5k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  93.5k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  316|       |
  317|  93.5k|  if (!cinfo->marker->saw_SOF)
  ------------------
  |  Branch (317:7): [True: 197, False: 93.3k]
  ------------------
  318|    197|    ERREXIT(cinfo, JERR_SOS_NO_SOF);
  ------------------
  |  |  240|    197|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    197|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  319|       |
  320|  93.5k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  93.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   188k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 231]
  |  |  |  |  |  Branch (279:38): [True: 231, False: 93.2k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 309]
  |  |  |  |  |  Branch (279:38): [True: 309, False: 93.2k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 93.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  93.5k|            bytes_in_buffer--; \
  |  |  164|  93.5k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  93.5k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  93.5k|            bytes_in_buffer--; \
  |  |  167|  93.5k|            V += *next_input_byte++; )
  ------------------
  321|       |
  322|  93.5k|  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
  ------------------
  |  |  154|  93.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  94.7k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 391]
  |  |  |  |  |  Branch (279:38): [True: 391, False: 93.1k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 93.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  93.5k|            bytes_in_buffer--; \
  |  |  156|  93.5k|            V = *next_input_byte++; )
  ------------------
  323|       |
  324|  93.5k|  TRACEMS1(cinfo, 1, JTRC_SOS, n);
  ------------------
  |  |  300|  93.5k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  93.5k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  93.5k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  325|       |
  326|  93.5k|  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  92.3k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (326:7): [True: 922, False: 92.6k]
  |  Branch (326:32): [True: 215, False: 92.3k]
  |  Branch (326:41): [True: 107, False: 92.2k]
  ------------------
  327|  1.04k|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|  1.04k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.04k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  328|       |
  329|  93.5k|  cinfo->comps_in_scan = n;
  330|       |
  331|       |  /* Collect the component-spec parameters */
  332|       |
  333|   462k|  for (i = 0; i < MAX_COMPS_IN_SCAN; i++)
  ------------------
  |  |   71|   462k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (333:15): [True: 369k, False: 93.5k]
  ------------------
  334|   369k|    cinfo->cur_comp_info[i] = NULL;
  335|       |
  336|   201k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (336:15): [True: 109k, False: 92.4k]
  ------------------
  337|   109k|    INPUT_BYTE(cinfo, cc, return FALSE);
  ------------------
  |  |  154|   109k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   111k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 593]
  |  |  |  |  |  Branch (279:38): [True: 593, False: 108k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 109k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   109k|            bytes_in_buffer--; \
  |  |  156|   109k|            V = *next_input_byte++; )
  ------------------
  338|   109k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   109k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   112k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.08k]
  |  |  |  |  |  Branch (279:38): [True: 1.08k, False: 108k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 109k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   109k|            bytes_in_buffer--; \
  |  |  156|   109k|            V = *next_input_byte++; )
  ------------------
  339|       |
  340|   109k|    for (ci = 0, compptr = cinfo->comp_info;
  341|   144k|         ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN;
  ------------------
  |  |   71|   143k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (341:10): [True: 143k, False: 862]
  |  Branch (341:40): [True: 143k, False: 208]
  ------------------
  342|   143k|         ci++, compptr++) {
  343|   143k|      if (cc == compptr->component_id && !cinfo->cur_comp_info[ci])
  ------------------
  |  Branch (343:11): [True: 108k, False: 35.1k]
  |  Branch (343:42): [True: 108k, False: 300]
  ------------------
  344|   108k|        goto id_found;
  345|   143k|    }
  346|       |
  347|  1.07k|    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|  1.07k|  ((cinfo)->err->msg_code = (code), \
  |  |  244|  1.07k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|  1.07k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  348|       |
  349|   108k|id_found:
  350|       |
  351|   108k|    cinfo->cur_comp_info[i] = compptr;
  352|   108k|    compptr->dc_tbl_no = (c >> 4) & 15;
  353|   108k|    compptr->ac_tbl_no = (c     ) & 15;
  354|       |
  355|   108k|    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
  ------------------
  |  |  309|   108k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   108k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 108k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|   108k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|   108k|           (cinfo)->err->msg_code = (code); \
  |  |  312|   108k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  356|   108k|             compptr->dc_tbl_no, compptr->ac_tbl_no);
  357|       |
  358|       |    /* This CSi (cc) should differ from the previous CSi */
  359|   133k|    for (pi = 0; pi < i; pi++) {
  ------------------
  |  Branch (359:18): [True: 24.8k, False: 108k]
  ------------------
  360|  24.8k|      if (cinfo->cur_comp_info[pi] == compptr) {
  ------------------
  |  Branch (360:11): [True: 207, False: 24.6k]
  ------------------
  361|    207|        ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|    207|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    207|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    207|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  362|    207|      }
  363|  24.8k|    }
  364|   108k|  }
  365|       |
  366|       |  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  367|  92.4k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  92.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  95.3k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 948]
  |  |  |  |  |  Branch (279:38): [True: 948, False: 91.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 92.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  92.4k|            bytes_in_buffer--; \
  |  |  156|  92.4k|            V = *next_input_byte++; )
  ------------------
  368|  92.4k|  cinfo->Ss = c;
  369|  92.4k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  92.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  97.3k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.62k]
  |  |  |  |  |  Branch (279:38): [True: 1.62k, False: 90.8k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 92.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  92.4k|            bytes_in_buffer--; \
  |  |  156|  92.4k|            V = *next_input_byte++; )
  ------------------
  370|  92.4k|  cinfo->Se = c;
  371|  92.4k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  92.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  96.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.21k]
  |  |  |  |  |  Branch (279:38): [True: 1.21k, False: 91.2k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 92.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  92.4k|            bytes_in_buffer--; \
  |  |  156|  92.4k|            V = *next_input_byte++; )
  ------------------
  372|  92.4k|  cinfo->Ah = (c >> 4) & 15;
  373|  92.4k|  cinfo->Al = (c     ) & 15;
  374|       |
  375|  92.4k|  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
  ------------------
  |  |  314|  92.4k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  92.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 92.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  92.4k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  92.4k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  92.4k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  376|  92.4k|           cinfo->Ah, cinfo->Al);
  377|       |
  378|       |  /* Prepare to scan data & restart markers */
  379|  92.4k|  cinfo->marker->next_restart_num = 0;
  380|       |
  381|       |  /* Count another SOS marker */
  382|  92.4k|  cinfo->input_scan_number++;
  383|       |
  384|  92.4k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  92.4k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  92.4k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  385|  92.4k|  return TRUE;
  ------------------
  |  |  210|  92.4k|#define TRUE    1
  ------------------
  386|  92.4k|}
jdmarker.c:get_dac:
  394|    946|{
  395|    946|  JLONG length;
  396|    946|  int index, val;
  397|    946|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    946|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    946|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    946|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  398|       |
  399|    946|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    946|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.04k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 251]
  |  |  |  |  |  Branch (279:38): [True: 251, False: 695]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 134]
  |  |  |  |  |  Branch (279:38): [True: 134, False: 812]
  |  |  |  |  |  Branch (279:53): [Folded, False: 946]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    946|            bytes_in_buffer--; \
  |  |  164|    946|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    946|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    946|            bytes_in_buffer--; \
  |  |  167|    946|            V += *next_input_byte++; )
  ------------------
  400|    946|  length -= 2;
  401|       |
  402|  1.88k|  while (length > 0) {
  ------------------
  |  Branch (402:10): [True: 942, False: 946]
  ------------------
  403|    942|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|    942|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.70k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 253]
  |  |  |  |  |  Branch (279:38): [True: 253, False: 689]
  |  |  |  |  |  Branch (279:53): [Folded, False: 942]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    942|            bytes_in_buffer--; \
  |  |  156|    942|            V = *next_input_byte++; )
  ------------------
  404|    942|    INPUT_BYTE(cinfo, val, return FALSE);
  ------------------
  |  |  154|    942|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.73k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 264]
  |  |  |  |  |  Branch (279:38): [True: 264, False: 678]
  |  |  |  |  |  Branch (279:53): [Folded, False: 942]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    942|            bytes_in_buffer--; \
  |  |  156|    942|            V = *next_input_byte++; )
  ------------------
  405|       |
  406|    942|    length -= 2;
  407|       |
  408|    942|    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
  ------------------
  |  |  304|    942|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    942|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    942|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    942|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  409|       |
  410|    942|    if (index < 0 || index >= (2 * NUM_ARITH_TBLS))
  ------------------
  |  |   70|    942|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (410:9): [True: 0, False: 942]
  |  Branch (410:22): [True: 407, False: 535]
  ------------------
  411|    407|      ERREXIT1(cinfo, JERR_DAC_INDEX, index);
  ------------------
  |  |  243|    407|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    407|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    407|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  412|       |
  413|    942|    if (index >= NUM_ARITH_TBLS) { /* define AC table */
  ------------------
  |  |   70|    942|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (413:9): [True: 134, False: 808]
  ------------------
  414|    134|      cinfo->arith_ac_K[index - NUM_ARITH_TBLS] = (UINT8)val;
  ------------------
  |  |   70|    134|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  415|    808|    } else {                    /* define DC table */
  416|    808|      cinfo->arith_dc_L[index] = (UINT8)(val & 0x0F);
  417|    808|      cinfo->arith_dc_U[index] = (UINT8)(val >> 4);
  418|    808|      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
  ------------------
  |  Branch (418:11): [True: 272, False: 536]
  ------------------
  419|    272|        ERREXIT1(cinfo, JERR_DAC_VALUE, val);
  ------------------
  |  |  243|    272|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    272|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    272|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  420|    808|    }
  421|    942|  }
  422|       |
  423|    946|  if (length != 0)
  ------------------
  |  Branch (423:7): [True: 138, False: 808]
  ------------------
  424|    138|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    138|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    138|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  425|       |
  426|    946|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    946|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    946|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  427|    946|  return TRUE;
  ------------------
  |  |  210|    946|#define TRUE    1
  ------------------
  428|    946|}
jdmarker.c:get_dht:
  440|   153k|{
  441|   153k|  JLONG length;
  442|   153k|  UINT8 bits[17];
  443|   153k|  UINT8 huffval[256];
  444|   153k|  int i, index, count;
  445|   153k|  JHUFF_TBL **htblptr;
  446|   153k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|   153k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|   153k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|   153k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  447|       |
  448|   153k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|   153k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   307k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 142]
  |  |  |  |  |  Branch (279:38): [True: 142, False: 153k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 135]
  |  |  |  |  |  Branch (279:38): [True: 135, False: 153k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 153k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   153k|            bytes_in_buffer--; \
  |  |  164|   153k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   153k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   153k|            bytes_in_buffer--; \
  |  |  167|   153k|            V += *next_input_byte++; )
  ------------------
  449|   153k|  length -= 2;
  450|       |
  451|   307k|  while (length > 16) {
  ------------------
  |  Branch (451:10): [True: 153k, False: 153k]
  ------------------
  452|   153k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|   153k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   154k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 171]
  |  |  |  |  |  Branch (279:38): [True: 171, False: 153k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 153k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   153k|            bytes_in_buffer--; \
  |  |  156|   153k|            V = *next_input_byte++; )
  ------------------
  453|       |
  454|   153k|    TRACEMS1(cinfo, 1, JTRC_DHT, index);
  ------------------
  |  |  300|   153k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|   153k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|   153k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  455|       |
  456|   153k|    bits[0] = 0;
  457|   153k|    count = 0;
  458|  2.61M|    for (i = 1; i <= 16; i++) {
  ------------------
  |  Branch (458:17): [True: 2.45M, False: 153k]
  ------------------
  459|  2.45M|      INPUT_BYTE(cinfo, bits[i], return FALSE);
  ------------------
  |  |  154|  2.45M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.47M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 5.11k]
  |  |  |  |  |  Branch (279:38): [True: 5.11k, False: 2.45M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.45M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.45M|            bytes_in_buffer--; \
  |  |  156|  2.45M|            V = *next_input_byte++; )
  ------------------
  460|  2.45M|      count += bits[i];
  461|  2.45M|    }
  462|       |
  463|   153k|    length -= 1 + 16;
  464|       |
  465|   153k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|   153k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   153k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 153k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|   153k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|   153k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|   153k|           (cinfo)->err->msg_code = (code); \
  |  |  329|   153k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  466|   153k|             bits[1], bits[2], bits[3], bits[4],
  467|   153k|             bits[5], bits[6], bits[7], bits[8]);
  468|   153k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|   153k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|   153k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 153k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|   153k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|   153k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|   153k|           (cinfo)->err->msg_code = (code); \
  |  |  329|   153k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  469|   153k|             bits[9], bits[10], bits[11], bits[12],
  470|   153k|             bits[13], bits[14], bits[15], bits[16]);
  471|       |
  472|       |    /* Here we just do minimal validation of the counts to avoid walking
  473|       |     * off the end of our table space.  jdhuff.c will check more carefully.
  474|       |     */
  475|   153k|    if (count > 256 || ((JLONG)count) > length)
  ------------------
  |  Branch (475:9): [True: 1.09k, False: 152k]
  |  Branch (475:24): [True: 163, False: 152k]
  ------------------
  476|  1.25k|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|  1.25k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.25k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  477|       |
  478|  13.6M|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (478:17): [True: 13.5M, False: 153k]
  ------------------
  479|  13.5M|      INPUT_BYTE(cinfo, huffval[i], return FALSE);
  ------------------
  |  |  154|  13.5M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  13.6M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 7.37k]
  |  |  |  |  |  Branch (279:38): [True: 7.37k, False: 13.5M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 13.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   153k|            bytes_in_buffer--; \
  |  |  156|   153k|            V = *next_input_byte++; )
  ------------------
  480|       |
  481|   153k|    memset(&huffval[count], 0, (256 - count) * sizeof(UINT8));
  482|       |
  483|   153k|    length -= count;
  484|       |
  485|   153k|    if (index & 0x10) {         /* AC table definition */
  ------------------
  |  Branch (485:9): [True: 80.4k, False: 73.2k]
  ------------------
  486|  80.4k|      index -= 0x10;
  487|  80.4k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  80.4k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (487:11): [True: 0, False: 80.4k]
  |  Branch (487:24): [True: 215, False: 80.2k]
  ------------------
  488|    215|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|    215|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    215|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    215|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  489|  80.4k|      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
  490|  80.4k|    } else {                    /* DC table definition */
  491|  73.2k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  72.0k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (491:11): [True: 1.25k, False: 72.0k]
  |  Branch (491:24): [True: 184, False: 71.8k]
  ------------------
  492|    184|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|    184|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    184|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    184|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  493|  73.2k|      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
  494|  73.2k|    }
  495|       |
  496|   153k|    if (*htblptr == NULL)
  ------------------
  |  Branch (496:9): [True: 140k, False: 13.3k]
  ------------------
  497|   140k|      *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  498|       |
  499|   153k|    memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
  500|   153k|    memcpy((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
  501|   153k|  }
  502|       |
  503|   153k|  if (length != 0)
  ------------------
  |  Branch (503:7): [True: 149, False: 153k]
  ------------------
  504|    149|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    149|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    149|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  505|       |
  506|   153k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   153k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   153k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  507|   153k|  return TRUE;
  ------------------
  |  |  210|   153k|#define TRUE    1
  ------------------
  508|   153k|}
jdmarker.c:get_dqt:
  514|  82.8k|{
  515|  82.8k|  JLONG length;
  516|  82.8k|  int n, i, prec;
  517|  82.8k|  unsigned int tmp;
  518|  82.8k|  JQUANT_TBL *quant_ptr;
  519|  82.8k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  82.8k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  82.8k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  82.8k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  520|       |
  521|  82.8k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  82.8k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   166k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 204]
  |  |  |  |  |  Branch (279:38): [True: 204, False: 82.6k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 147]
  |  |  |  |  |  Branch (279:38): [True: 147, False: 82.7k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 82.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  82.8k|            bytes_in_buffer--; \
  |  |  164|  82.8k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  82.8k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  82.8k|            bytes_in_buffer--; \
  |  |  167|  82.8k|            V += *next_input_byte++; )
  ------------------
  522|  82.8k|  length -= 2;
  523|       |
  524|   166k|  while (length > 0) {
  ------------------
  |  Branch (524:10): [True: 83.2k, False: 82.8k]
  ------------------
  525|  83.2k|    INPUT_BYTE(cinfo, n, return FALSE);
  ------------------
  |  |  154|  83.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  85.3k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 706]
  |  |  |  |  |  Branch (279:38): [True: 706, False: 82.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 83.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  83.2k|            bytes_in_buffer--; \
  |  |  156|  83.2k|            V = *next_input_byte++; )
  ------------------
  526|  83.2k|    prec = n >> 4;
  527|  83.2k|    n &= 0x0F;
  528|       |
  529|  83.2k|    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
  ------------------
  |  |  304|  83.2k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  83.2k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  83.2k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  83.2k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  530|       |
  531|  83.2k|    if (n >= NUM_QUANT_TBLS)
  ------------------
  |  |   68|  83.2k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (531:9): [True: 973, False: 82.2k]
  ------------------
  532|    973|      ERREXIT1(cinfo, JERR_DQT_INDEX, n);
  ------------------
  |  |  243|    973|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    973|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    973|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  533|       |
  534|  83.2k|    if (cinfo->quant_tbl_ptrs[n] == NULL)
  ------------------
  |  Branch (534:9): [True: 39.5k, False: 43.6k]
  ------------------
  535|  39.5k|      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  536|  83.2k|    quant_ptr = cinfo->quant_tbl_ptrs[n];
  537|       |
  538|  5.34M|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  5.34M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (538:17): [True: 5.26M, False: 83.2k]
  ------------------
  539|  5.26M|      if (prec)
  ------------------
  |  Branch (539:11): [True: 89.7k, False: 5.17M]
  ------------------
  540|  5.26M|        INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  89.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   355k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 41.2k]
  |  |  |  |  |  Branch (279:38): [True: 41.2k, False: 48.4k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 17.5k]
  |  |  |  |  |  Branch (279:38): [True: 17.5k, False: 72.2k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 89.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  5.26M|            bytes_in_buffer--; \
  |  |  164|  5.26M|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  5.26M|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  5.26M|            bytes_in_buffer--; \
  |  |  167|  5.26M|            V += *next_input_byte++; )
  ------------------
  541|  5.17M|      else
  542|  5.26M|        INPUT_BYTE(cinfo, tmp, return FALSE);
  ------------------
  |  |  154|  5.17M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  5.30M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 44.2k]
  |  |  |  |  |  Branch (279:38): [True: 44.2k, False: 5.12M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.17M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  5.26M|            bytes_in_buffer--; \
  |  |  156|  5.26M|            V = *next_input_byte++; )
  ------------------
  543|       |      /* We convert the zigzag-order table to natural array order. */
  544|  5.26M|      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
  545|  5.26M|    }
  546|       |
  547|  83.2k|    if (cinfo->err->trace_level >= 2) {
  ------------------
  |  Branch (547:9): [True: 0, False: 83.2k]
  ------------------
  548|      0|      for (i = 0; i < DCTSIZE2; i += 8) {
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (548:19): [True: 0, False: 0]
  ------------------
  549|      0|        TRACEMS8(cinfo, 2, JTRC_QUANTVALS,
  ------------------
  |  |  325|      0|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|      0|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|      0|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|      0|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|      0|           (cinfo)->err->msg_code = (code); \
  |  |  329|      0|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  550|      0|                 quant_ptr->quantval[i],     quant_ptr->quantval[i + 1],
  551|      0|                 quant_ptr->quantval[i + 2], quant_ptr->quantval[i + 3],
  552|      0|                 quant_ptr->quantval[i + 4], quant_ptr->quantval[i + 5],
  553|      0|                 quant_ptr->quantval[i + 6], quant_ptr->quantval[i + 7]);
  554|      0|      }
  555|      0|    }
  556|       |
  557|  83.2k|    length -= DCTSIZE2 + 1;
  ------------------
  |  |   67|  83.2k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  558|  83.2k|    if (prec) length -= DCTSIZE2;
  ------------------
  |  |   67|  1.40k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (558:9): [True: 1.40k, False: 81.8k]
  ------------------
  559|  83.2k|  }
  560|       |
  561|  82.8k|  if (length != 0)
  ------------------
  |  Branch (561:7): [True: 1.14k, False: 81.7k]
  ------------------
  562|  1.14k|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|  1.14k|  ((cinfo)->err->msg_code = (code), \
  |  |  241|  1.14k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  563|       |
  564|  82.8k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  82.8k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  82.8k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  565|  82.8k|  return TRUE;
  ------------------
  |  |  210|  82.8k|#define TRUE    1
  ------------------
  566|  82.8k|}
jdmarker.c:get_dri:
  572|  5.65k|{
  573|  5.65k|  JLONG length;
  574|  5.65k|  unsigned int tmp;
  575|  5.65k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  5.65k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  5.65k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  5.65k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  576|       |
  577|  5.65k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  5.65k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  12.8k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 369]
  |  |  |  |  |  Branch (279:38): [True: 369, False: 5.28k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 129]
  |  |  |  |  |  Branch (279:38): [True: 129, False: 5.52k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.65k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  5.65k|            bytes_in_buffer--; \
  |  |  164|  5.65k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  5.65k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  5.65k|            bytes_in_buffer--; \
  |  |  167|  5.65k|            V += *next_input_byte++; )
  ------------------
  578|       |
  579|  5.65k|  if (length != 4)
  ------------------
  |  Branch (579:7): [True: 638, False: 5.01k]
  ------------------
  580|    638|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|    638|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    638|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  581|       |
  582|  5.65k|  INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  5.65k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  12.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 195]
  |  |  |  |  |  Branch (279:38): [True: 195, False: 5.45k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 198]
  |  |  |  |  |  Branch (279:38): [True: 198, False: 5.45k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.65k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  5.65k|            bytes_in_buffer--; \
  |  |  164|  5.65k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  5.65k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  5.65k|            bytes_in_buffer--; \
  |  |  167|  5.65k|            V += *next_input_byte++; )
  ------------------
  583|       |
  584|  5.65k|  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
  ------------------
  |  |  300|  5.65k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  5.65k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  5.65k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  585|       |
  586|  5.65k|  cinfo->restart_interval = tmp;
  587|       |
  588|  5.65k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  5.65k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  5.65k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  589|  5.65k|  return TRUE;
  ------------------
  |  |  210|  5.65k|#define TRUE    1
  ------------------
  590|  5.65k|}
jdmarker.c:read_restart_marker:
 1139|   119k|{
 1140|       |  /* Obtain a marker unless we already did. */
 1141|       |  /* Note that next_marker will complain if it skips any data. */
 1142|   119k|  if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (1142:7): [True: 2.00k, False: 117k]
  ------------------
 1143|  2.00k|    if (!next_marker(cinfo))
  ------------------
  |  Branch (1143:9): [True: 0, False: 2.00k]
  ------------------
 1144|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1145|  2.00k|  }
 1146|       |
 1147|   119k|  if (cinfo->unread_marker ==
  ------------------
  |  Branch (1147:7): [True: 2.77k, False: 116k]
  ------------------
 1148|   119k|      ((int)M_RST0 + cinfo->marker->next_restart_num)) {
 1149|       |    /* Normal case --- swallow the marker and let entropy decoder continue */
 1150|  2.77k|    TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
  ------------------
  |  |  300|  2.77k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  2.77k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  2.77k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1151|  2.77k|    cinfo->unread_marker = 0;
 1152|   116k|  } else {
 1153|       |    /* Uh-oh, the restart markers have been messed up. */
 1154|       |    /* Let the data source manager determine how to resync. */
 1155|   116k|    if (!(*cinfo->src->resync_to_restart) (cinfo,
  ------------------
  |  Branch (1155:9): [True: 0, False: 116k]
  ------------------
 1156|   116k|                                           cinfo->marker->next_restart_num))
 1157|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1158|   116k|  }
 1159|       |
 1160|       |  /* Update next-restart state */
 1161|   119k|  cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
 1162|       |
 1163|   119k|  return TRUE;
  ------------------
  |  |  210|   119k|#define TRUE    1
  ------------------
 1164|   119k|}
jdmarker.c:skip_variable:
  864|  8.41k|{
  865|  8.41k|  JLONG length;
  866|  8.41k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  8.41k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  8.41k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  8.41k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  867|       |
  868|  8.41k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  8.41k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  19.3k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 408]
  |  |  |  |  |  Branch (279:38): [True: 408, False: 8.00k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 419]
  |  |  |  |  |  Branch (279:38): [True: 419, False: 7.99k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 8.41k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  8.41k|            bytes_in_buffer--; \
  |  |  164|  8.41k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  8.41k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  8.41k|            bytes_in_buffer--; \
  |  |  167|  8.41k|            V += *next_input_byte++; )
  ------------------
  869|  8.41k|  length -= 2;
  870|       |
  871|  8.41k|  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
  ------------------
  |  |  304|  8.41k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  8.41k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  8.41k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  8.41k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  872|       |
  873|  8.41k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|  8.41k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  8.41k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  874|  8.41k|  if (length > 0)
  ------------------
  |  Branch (874:7): [True: 6.24k, False: 2.16k]
  ------------------
  875|  6.24k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  876|       |
  877|  8.41k|  return TRUE;
  ------------------
  |  |  210|  8.41k|#define TRUE    1
  ------------------
  878|  8.41k|}
jdmarker.c:get_interesting_appn:
  712|  7.77k|{
  713|  7.77k|  JLONG length;
  714|  7.77k|  JOCTET b[APPN_DATA_LEN];
  715|  7.77k|  unsigned int i, numtoread;
  716|  7.77k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  7.77k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  7.77k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  7.77k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  717|       |
  718|  7.77k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  7.77k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  16.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 204]
  |  |  |  |  |  Branch (279:38): [True: 204, False: 7.57k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 153]
  |  |  |  |  |  Branch (279:38): [True: 153, False: 7.62k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 7.77k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  7.77k|            bytes_in_buffer--; \
  |  |  164|  7.77k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  7.77k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  7.77k|            bytes_in_buffer--; \
  |  |  167|  7.77k|            V += *next_input_byte++; )
  ------------------
  719|  7.77k|  length -= 2;
  720|       |
  721|       |  /* get the interesting part of the marker data */
  722|  7.77k|  if (length >= APPN_DATA_LEN)
  ------------------
  |  |  602|  7.77k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  |  Branch (722:7): [True: 6.35k, False: 1.42k]
  ------------------
  723|  6.35k|    numtoread = APPN_DATA_LEN;
  ------------------
  |  |  602|  6.35k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  724|  1.42k|  else if (length > 0)
  ------------------
  |  Branch (724:12): [True: 1.05k, False: 364]
  ------------------
  725|  1.05k|    numtoread = (unsigned int)length;
  726|    364|  else
  727|    364|    numtoread = 0;
  728|   102k|  for (i = 0; i < numtoread; i++)
  ------------------
  |  Branch (728:15): [True: 95.2k, False: 7.77k]
  ------------------
  729|  95.2k|    INPUT_BYTE(cinfo, b[i], return FALSE);
  ------------------
  |  |  154|  95.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   105k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.39k]
  |  |  |  |  |  Branch (279:38): [True: 3.39k, False: 91.8k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 95.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  7.77k|            bytes_in_buffer--; \
  |  |  156|  7.77k|            V = *next_input_byte++; )
  ------------------
  730|  7.77k|  length -= numtoread;
  731|       |
  732|       |  /* process it */
  733|  7.77k|  switch (cinfo->unread_marker) {
  734|  4.17k|  case M_APP0:
  ------------------
  |  Branch (734:3): [True: 4.17k, False: 3.60k]
  ------------------
  735|  4.17k|    examine_app0(cinfo, (JOCTET *)b, numtoread, length);
  736|  4.17k|    break;
  737|  3.60k|  case M_APP14:
  ------------------
  |  Branch (737:3): [True: 3.60k, False: 4.17k]
  ------------------
  738|  3.60k|    examine_app14(cinfo, (JOCTET *)b, numtoread, length);
  739|  3.60k|    break;
  740|      0|  default:
  ------------------
  |  Branch (740:3): [True: 0, False: 7.77k]
  ------------------
  741|       |    /* can't get here unless jpeg_save_markers chooses wrong processor */
  742|      0|    ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  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)))
  ------------------
  743|      0|    break;
  744|  7.77k|  }
  745|       |
  746|       |  /* skip any remaining data -- could be lots */
  747|  7.77k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  7.77k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  7.77k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  748|  7.77k|  if (length > 0)
  ------------------
  |  Branch (748:7): [True: 5.26k, False: 2.50k]
  ------------------
  749|  5.26k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  750|       |
  751|  7.77k|  return TRUE;
  ------------------
  |  |  210|  7.77k|#define TRUE    1
  ------------------
  752|  7.77k|}
jdmarker.c:examine_app0:
  612|  4.17k|{
  613|  4.17k|  JLONG totallen = (JLONG)datalen + remaining;
  614|       |
  615|  4.17k|  if (datalen >= APP0_DATA_LEN &&
  ------------------
  |  |  600|  8.35k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (615:7): [True: 3.00k, False: 1.17k]
  ------------------
  616|  3.00k|      data[0] == 0x4A &&
  ------------------
  |  Branch (616:7): [True: 2.23k, False: 768]
  ------------------
  617|  2.23k|      data[1] == 0x46 &&
  ------------------
  |  Branch (617:7): [True: 1.92k, False: 312]
  ------------------
  618|  1.92k|      data[2] == 0x49 &&
  ------------------
  |  Branch (618:7): [True: 1.09k, False: 830]
  ------------------
  619|  1.09k|      data[3] == 0x46 &&
  ------------------
  |  Branch (619:7): [True: 964, False: 130]
  ------------------
  620|    964|      data[4] == 0) {
  ------------------
  |  Branch (620:7): [True: 662, False: 302]
  ------------------
  621|       |    /* Found JFIF APP0 marker: save info */
  622|    662|    cinfo->saw_JFIF_marker = TRUE;
  ------------------
  |  |  210|    662|#define TRUE    1
  ------------------
  623|    662|    cinfo->JFIF_major_version = data[5];
  624|    662|    cinfo->JFIF_minor_version = data[6];
  625|    662|    cinfo->density_unit = data[7];
  626|    662|    cinfo->X_density = (data[8] << 8) + data[9];
  627|    662|    cinfo->Y_density = (data[10] << 8) + data[11];
  628|       |    /* Check version.
  629|       |     * Major version must be 1, anything else signals an incompatible change.
  630|       |     * (We used to treat this as an error, but now it's a nonfatal warning,
  631|       |     * because some bozo at Hijaak couldn't read the spec.)
  632|       |     * Minor version should be 0..2, but process anyway if newer.
  633|       |     */
  634|    662|    if (cinfo->JFIF_major_version != 1)
  ------------------
  |  Branch (634:9): [True: 534, False: 128]
  ------------------
  635|    534|      WARNMS2(cinfo, JWRN_JFIF_MAJOR,
  ------------------
  |  |  290|    534|  ((cinfo)->err->msg_code = (code), \
  |  |  291|    534|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|    534|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|    534|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  636|    662|              cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
  637|       |    /* Generate trace messages */
  638|    662|    TRACEMS5(cinfo, 1, JTRC_JFIF,
  ------------------
  |  |  319|    662|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    662|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 662]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|    662|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  321|    662|           _mp[4] = (p5); \
  |  |  322|    662|           (cinfo)->err->msg_code = (code); \
  |  |  323|    662|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  639|    662|             cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
  640|    662|             cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
  641|       |    /* Validate thumbnail dimensions and issue appropriate messages */
  642|    662|    if (data[12] | data[13])
  ------------------
  |  Branch (642:9): [True: 485, False: 177]
  ------------------
  643|    485|      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
  ------------------
  |  |  304|    485|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    485|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    485|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    485|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  644|    662|    totallen -= APP0_DATA_LEN;
  ------------------
  |  |  600|    662|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  645|    662|    if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
  ------------------
  |  Branch (645:9): [True: 357, False: 305]
  ------------------
  646|    357|      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
  ------------------
  |  |  300|    357|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    357|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    357|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  647|  3.51k|  } else if (datalen >= 6 &&
  ------------------
  |  Branch (647:14): [True: 3.26k, False: 248]
  ------------------
  648|  3.26k|             data[0] == 0x4A &&
  ------------------
  |  Branch (648:14): [True: 2.22k, False: 1.03k]
  ------------------
  649|  2.22k|             data[1] == 0x46 &&
  ------------------
  |  Branch (649:14): [True: 1.65k, False: 571]
  ------------------
  650|  1.65k|             data[2] == 0x58 &&
  ------------------
  |  Branch (650:14): [True: 1.09k, False: 566]
  ------------------
  651|  1.09k|             data[3] == 0x58 &&
  ------------------
  |  Branch (651:14): [True: 942, False: 149]
  ------------------
  652|    942|             data[4] == 0) {
  ------------------
  |  Branch (652:14): [True: 640, False: 302]
  ------------------
  653|       |    /* Found JFIF "JFXX" extension APP0 marker */
  654|       |    /* The library doesn't actually do anything with these,
  655|       |     * but we try to produce a helpful trace message.
  656|       |     */
  657|    640|    switch (data[5]) {
  658|    186|    case 0x10:
  ------------------
  |  Branch (658:5): [True: 186, False: 454]
  ------------------
  659|    186|      TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int)totallen);
  ------------------
  |  |  300|    186|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    186|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    186|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  660|    186|      break;
  661|    190|    case 0x11:
  ------------------
  |  Branch (661:5): [True: 190, False: 450]
  ------------------
  662|    190|      TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int)totallen);
  ------------------
  |  |  300|    190|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    190|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    190|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  663|    190|      break;
  664|    128|    case 0x13:
  ------------------
  |  Branch (664:5): [True: 128, False: 512]
  ------------------
  665|    128|      TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int)totallen);
  ------------------
  |  |  300|    128|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    128|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    128|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  666|    128|      break;
  667|    136|    default:
  ------------------
  |  Branch (667:5): [True: 136, False: 504]
  ------------------
  668|    136|      TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, data[5], (int)totallen);
  ------------------
  |  |  304|    136|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    136|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    136|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    136|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  669|    136|      break;
  670|    640|    }
  671|  2.87k|  } else {
  672|       |    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
  673|  2.87k|    TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
  ------------------
  |  |  300|  2.87k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  2.87k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  2.87k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  674|  2.87k|  }
  675|  4.17k|}
jdmarker.c:examine_app14:
  685|  3.60k|{
  686|  3.60k|  unsigned int version, flags0, flags1, transform;
  687|       |
  688|  3.60k|  if (datalen >= APP14_DATA_LEN &&
  ------------------
  |  |  601|  7.20k|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (688:7): [True: 3.35k, False: 248]
  ------------------
  689|  3.35k|      data[0] == 0x41 &&
  ------------------
  |  Branch (689:7): [True: 3.11k, False: 239]
  ------------------
  690|  3.11k|      data[1] == 0x64 &&
  ------------------
  |  Branch (690:7): [True: 2.87k, False: 239]
  ------------------
  691|  2.87k|      data[2] == 0x6F &&
  ------------------
  |  Branch (691:7): [True: 2.65k, False: 224]
  ------------------
  692|  2.65k|      data[3] == 0x62 &&
  ------------------
  |  Branch (692:7): [True: 2.19k, False: 461]
  ------------------
  693|  2.19k|      data[4] == 0x65) {
  ------------------
  |  Branch (693:7): [True: 1.99k, False: 197]
  ------------------
  694|       |    /* Found Adobe APP14 marker */
  695|  1.99k|    version = (data[5] << 8) + data[6];
  696|  1.99k|    flags0 = (data[7] << 8) + data[8];
  697|  1.99k|    flags1 = (data[9] << 8) + data[10];
  698|  1.99k|    transform = data[11];
  699|  1.99k|    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
  ------------------
  |  |  314|  1.99k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  1.99k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.99k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  1.99k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  1.99k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  1.99k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  700|  1.99k|    cinfo->saw_Adobe_marker = TRUE;
  ------------------
  |  |  210|  1.99k|#define TRUE    1
  ------------------
  701|  1.99k|    cinfo->Adobe_transform = (UINT8)transform;
  702|  1.99k|  } else {
  703|       |    /* Start of APP14 does not match "Adobe", or too short */
  704|  1.60k|    TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
  ------------------
  |  |  300|  1.60k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  1.60k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  1.60k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  705|  1.60k|  }
  706|  3.60k|}

jpeg_calc_output_dimensions:
  269|  74.7k|{
  270|  74.7k|#ifdef IDCT_SCALING_SUPPORTED
  271|  74.7k|  int ci;
  272|  74.7k|  jpeg_component_info *compptr;
  273|  74.7k|#endif
  274|       |
  275|       |  /* Prevent application from calling me at wrong times */
  276|  74.7k|  if (cinfo->global_state != DSTATE_READY)
  ------------------
  |  |   50|  74.7k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (276:7): [True: 0, False: 74.7k]
  ------------------
  277|      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)))
  ------------------
  278|       |
  279|       |  /* Compute core output image dimensions and DCT scaling choices. */
  280|  74.7k|  jpeg_core_output_dimensions(cinfo);
  281|       |
  282|  74.7k|#ifdef IDCT_SCALING_SUPPORTED
  283|       |
  284|  74.7k|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (284:7): [True: 70.9k, False: 3.75k]
  ------------------
  285|       |    /* In selecting the actual DCT scaling for each component, we try to
  286|       |     * scale up the chroma components via IDCT scaling rather than upsampling.
  287|       |     * This saves time if the upsampler gets to use 1:1 scaling.
  288|       |     * Note this code adapts subsampling ratios which are powers of 2.
  289|       |     */
  290|   169k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (290:46): [True: 98.5k, False: 70.9k]
  ------------------
  291|  98.5k|         ci++, compptr++) {
  292|  98.5k|      int ssize = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  98.5k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  293|  98.5k|      while (ssize < DCTSIZE &&
  ------------------
  |  |   66|   197k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (293:14): [True: 0, False: 98.5k]
  ------------------
  294|      0|             ((cinfo->max_h_samp_factor * cinfo->_min_DCT_scaled_size) %
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (294:14): [True: 0, False: 0]
  ------------------
  295|      0|              (compptr->h_samp_factor * ssize * 2) == 0) &&
  296|      0|             ((cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size) %
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (296:14): [True: 0, False: 0]
  ------------------
  297|      0|              (compptr->v_samp_factor * ssize * 2) == 0)) {
  298|      0|        ssize = ssize * 2;
  299|      0|      }
  300|       |#if JPEG_LIB_VERSION >= 70
  301|       |      compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = ssize;
  302|       |#else
  303|  98.5k|      compptr->DCT_scaled_size = ssize;
  304|  98.5k|#endif
  305|  98.5k|    }
  306|       |
  307|       |    /* Recompute downsampled dimensions of components;
  308|       |     * application needs to know these if using raw downsampled data.
  309|       |     */
  310|   169k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (310:46): [True: 98.5k, False: 70.9k]
  ------------------
  311|  98.5k|         ci++, compptr++) {
  312|       |      /* Size in samples, after IDCT scaling */
  313|  98.5k|      compptr->downsampled_width = (JDIMENSION)
  314|  98.5k|        jdiv_round_up((long)cinfo->image_width *
  315|  98.5k|                      (long)(compptr->h_samp_factor *
  316|  98.5k|                             compptr->_DCT_scaled_size),
  ------------------
  |  |   24|  98.5k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  317|  98.5k|                      (long)(cinfo->max_h_samp_factor * DCTSIZE));
  ------------------
  |  |   66|  98.5k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  318|  98.5k|      compptr->downsampled_height = (JDIMENSION)
  319|  98.5k|        jdiv_round_up((long)cinfo->image_height *
  320|  98.5k|                      (long)(compptr->v_samp_factor *
  321|  98.5k|                             compptr->_DCT_scaled_size),
  ------------------
  |  |   24|  98.5k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  322|  98.5k|                      (long)(cinfo->max_v_samp_factor * DCTSIZE));
  ------------------
  |  |   66|  98.5k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  323|  98.5k|    }
  324|  70.9k|  } else
  325|  3.75k|#endif /* IDCT_SCALING_SUPPORTED */
  326|  3.75k|  {
  327|       |    /* Hardwire it to "no scaling" */
  328|  3.75k|    cinfo->output_width = cinfo->image_width;
  329|  3.75k|    cinfo->output_height = cinfo->image_height;
  330|       |    /* jdinput.c has already initialized DCT_scaled_size to DCTSIZE,
  331|       |     * and has computed unscaled downsampled_width and downsampled_height.
  332|       |     */
  333|  3.75k|  }
  334|       |
  335|       |  /* Report number of components in selected colorspace. */
  336|       |  /* Probably this should be in the color conversion module... */
  337|  74.7k|  switch (cinfo->out_color_space) {
  338|      0|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (338:3): [True: 0, False: 74.7k]
  ------------------
  339|      0|    cinfo->out_color_components = 1;
  340|      0|    break;
  341|  13.6k|  case JCS_RGB:
  ------------------
  |  Branch (341:3): [True: 13.6k, False: 61.0k]
  ------------------
  342|  13.6k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (342:3): [True: 0, False: 74.7k]
  ------------------
  343|  13.6k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (343:3): [True: 0, False: 74.7k]
  ------------------
  344|  13.6k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (344:3): [True: 0, False: 74.7k]
  ------------------
  345|  13.6k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (345:3): [True: 0, False: 74.7k]
  ------------------
  346|  13.6k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (346:3): [True: 0, False: 74.7k]
  ------------------
  347|  13.6k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (347:3): [True: 0, False: 74.7k]
  ------------------
  348|  13.6k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (348:3): [True: 0, False: 74.7k]
  ------------------
  349|  13.6k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (349:3): [True: 0, False: 74.7k]
  ------------------
  350|  13.6k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (350:3): [True: 0, False: 74.7k]
  ------------------
  351|  13.6k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (351:3): [True: 0, False: 74.7k]
  ------------------
  352|  13.6k|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  353|  13.6k|    break;
  354|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (354:3): [True: 0, False: 74.7k]
  ------------------
  355|      0|  case JCS_RGB565:
  ------------------
  |  Branch (355:3): [True: 0, False: 74.7k]
  ------------------
  356|      0|    cinfo->out_color_components = 3;
  357|      0|    break;
  358|      0|  case JCS_CMYK:
  ------------------
  |  Branch (358:3): [True: 0, False: 74.7k]
  ------------------
  359|      0|  case JCS_YCCK:
  ------------------
  |  Branch (359:3): [True: 0, False: 74.7k]
  ------------------
  360|      0|    cinfo->out_color_components = 4;
  361|      0|    break;
  362|  61.0k|  default:                      /* else must be same colorspace as in file */
  ------------------
  |  Branch (362:3): [True: 61.0k, False: 13.6k]
  ------------------
  363|  61.0k|    cinfo->out_color_components = cinfo->num_components;
  364|  61.0k|    break;
  365|  74.7k|  }
  366|  74.7k|  cinfo->output_components = (cinfo->quantize_colors ? 1 :
  ------------------
  |  Branch (366:31): [True: 0, False: 74.7k]
  ------------------
  367|  74.7k|                              cinfo->out_color_components);
  368|       |
  369|       |  /* See if upsampler will want to emit more than one row at a time */
  370|  74.7k|  if (use_merged_upsample(cinfo))
  ------------------
  |  Branch (370:7): [True: 0, False: 74.7k]
  ------------------
  371|      0|    cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
  372|  74.7k|  else
  373|  74.7k|    cinfo->rec_outbuf_height = 1;
  374|  74.7k|}
jinit_master_decompress:
  902|  74.7k|{
  903|  74.7k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  904|       |
  905|       |#ifdef WITH_PROFILE
  906|       |  master->pub.total_start = getTime();
  907|       |#endif
  908|       |
  909|  74.7k|  master->pub.prepare_for_output_pass = prepare_for_output_pass;
  910|  74.7k|  master->pub.finish_output_pass = finish_output_pass;
  911|       |
  912|  74.7k|  master->pub.is_dummy_pass = FALSE;
  ------------------
  |  |  207|  74.7k|#define FALSE   0               /* values of boolean */
  ------------------
  913|  74.7k|  master->pub.jinit_upsampler_no_alloc = FALSE;
  ------------------
  |  |  207|  74.7k|#define FALSE   0               /* values of boolean */
  ------------------
  914|       |
  915|  74.7k|  master_selection(cinfo);
  916|  74.7k|}
jdmaster.c:jpeg_core_output_dimensions:
  103|  74.7k|{
  104|  74.7k|#ifdef IDCT_SCALING_SUPPORTED
  105|  74.7k|  int ci;
  106|  74.7k|  jpeg_component_info *compptr;
  107|       |
  108|  74.7k|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (108:7): [True: 70.9k, False: 3.75k]
  ------------------
  109|       |    /* Compute actual output image dimensions and DCT scaling choices. */
  110|  70.9k|    if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom) {
  ------------------
  |  |   66|  70.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (110:9): [True: 0, False: 70.9k]
  ------------------
  111|       |      /* Provide 1/block_size scaling */
  112|      0|      cinfo->output_width = (JDIMENSION)
  113|      0|        jdiv_round_up((long)cinfo->image_width, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  114|      0|      cinfo->output_height = (JDIMENSION)
  115|      0|        jdiv_round_up((long)cinfo->image_height, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  116|      0|      cinfo->_min_DCT_h_scaled_size = 1;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  117|      0|      cinfo->_min_DCT_v_scaled_size = 1;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  118|  70.9k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 2) {
  ------------------
  |  |   66|  70.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (118:16): [True: 0, False: 70.9k]
  ------------------
  119|       |      /* Provide 2/block_size scaling */
  120|      0|      cinfo->output_width = (JDIMENSION)
  121|      0|        jdiv_round_up((long)cinfo->image_width * 2L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  122|      0|      cinfo->output_height = (JDIMENSION)
  123|      0|        jdiv_round_up((long)cinfo->image_height * 2L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  124|      0|      cinfo->_min_DCT_h_scaled_size = 2;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  125|      0|      cinfo->_min_DCT_v_scaled_size = 2;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  126|  70.9k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 3) {
  ------------------
  |  |   66|  70.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (126:16): [True: 0, False: 70.9k]
  ------------------
  127|       |      /* Provide 3/block_size scaling */
  128|      0|      cinfo->output_width = (JDIMENSION)
  129|      0|        jdiv_round_up((long)cinfo->image_width * 3L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  130|      0|      cinfo->output_height = (JDIMENSION)
  131|      0|        jdiv_round_up((long)cinfo->image_height * 3L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  132|      0|      cinfo->_min_DCT_h_scaled_size = 3;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  133|      0|      cinfo->_min_DCT_v_scaled_size = 3;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  134|  70.9k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 4) {
  ------------------
  |  |   66|  70.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (134:16): [True: 0, False: 70.9k]
  ------------------
  135|       |      /* Provide 4/block_size scaling */
  136|      0|      cinfo->output_width = (JDIMENSION)
  137|      0|        jdiv_round_up((long)cinfo->image_width * 4L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  138|      0|      cinfo->output_height = (JDIMENSION)
  139|      0|        jdiv_round_up((long)cinfo->image_height * 4L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  140|      0|      cinfo->_min_DCT_h_scaled_size = 4;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  141|      0|      cinfo->_min_DCT_v_scaled_size = 4;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  142|  70.9k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 5) {
  ------------------
  |  |   66|  70.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (142:16): [True: 0, False: 70.9k]
  ------------------
  143|       |      /* Provide 5/block_size scaling */
  144|      0|      cinfo->output_width = (JDIMENSION)
  145|      0|        jdiv_round_up((long)cinfo->image_width * 5L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  146|      0|      cinfo->output_height = (JDIMENSION)
  147|      0|        jdiv_round_up((long)cinfo->image_height * 5L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  148|      0|      cinfo->_min_DCT_h_scaled_size = 5;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  149|      0|      cinfo->_min_DCT_v_scaled_size = 5;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  150|  70.9k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 6) {
  ------------------
  |  |   66|  70.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (150:16): [True: 0, False: 70.9k]
  ------------------
  151|       |      /* Provide 6/block_size scaling */
  152|      0|      cinfo->output_width = (JDIMENSION)
  153|      0|        jdiv_round_up((long)cinfo->image_width * 6L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  154|      0|      cinfo->output_height = (JDIMENSION)
  155|      0|        jdiv_round_up((long)cinfo->image_height * 6L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  156|      0|      cinfo->_min_DCT_h_scaled_size = 6;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  157|      0|      cinfo->_min_DCT_v_scaled_size = 6;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  158|  70.9k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 7) {
  ------------------
  |  |   66|  70.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (158:16): [True: 0, False: 70.9k]
  ------------------
  159|       |      /* Provide 7/block_size scaling */
  160|      0|      cinfo->output_width = (JDIMENSION)
  161|      0|        jdiv_round_up((long)cinfo->image_width * 7L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  162|      0|      cinfo->output_height = (JDIMENSION)
  163|      0|        jdiv_round_up((long)cinfo->image_height * 7L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  164|      0|      cinfo->_min_DCT_h_scaled_size = 7;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  165|      0|      cinfo->_min_DCT_v_scaled_size = 7;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  166|  70.9k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 8) {
  ------------------
  |  |   66|  70.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (166:16): [True: 70.9k, False: 0]
  ------------------
  167|       |      /* Provide 8/block_size scaling */
  168|  70.9k|      cinfo->output_width = (JDIMENSION)
  169|  70.9k|        jdiv_round_up((long)cinfo->image_width * 8L, (long)DCTSIZE);
  ------------------
  |  |   66|  70.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  170|  70.9k|      cinfo->output_height = (JDIMENSION)
  171|  70.9k|        jdiv_round_up((long)cinfo->image_height * 8L, (long)DCTSIZE);
  ------------------
  |  |   66|  70.9k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  172|  70.9k|      cinfo->_min_DCT_h_scaled_size = 8;
  ------------------
  |  |   28|  70.9k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  173|  70.9k|      cinfo->_min_DCT_v_scaled_size = 8;
  ------------------
  |  |   29|  70.9k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  174|  70.9k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 9) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (174:16): [True: 0, False: 0]
  ------------------
  175|       |      /* Provide 9/block_size scaling */
  176|      0|      cinfo->output_width = (JDIMENSION)
  177|      0|        jdiv_round_up((long)cinfo->image_width * 9L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  178|      0|      cinfo->output_height = (JDIMENSION)
  179|      0|        jdiv_round_up((long)cinfo->image_height * 9L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  180|      0|      cinfo->_min_DCT_h_scaled_size = 9;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  181|      0|      cinfo->_min_DCT_v_scaled_size = 9;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  182|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 10) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (182:16): [True: 0, False: 0]
  ------------------
  183|       |      /* Provide 10/block_size scaling */
  184|      0|      cinfo->output_width = (JDIMENSION)
  185|      0|        jdiv_round_up((long)cinfo->image_width * 10L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  186|      0|      cinfo->output_height = (JDIMENSION)
  187|      0|        jdiv_round_up((long)cinfo->image_height * 10L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  188|      0|      cinfo->_min_DCT_h_scaled_size = 10;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  189|      0|      cinfo->_min_DCT_v_scaled_size = 10;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  190|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 11) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (190:16): [True: 0, False: 0]
  ------------------
  191|       |      /* Provide 11/block_size scaling */
  192|      0|      cinfo->output_width = (JDIMENSION)
  193|      0|        jdiv_round_up((long)cinfo->image_width * 11L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  194|      0|      cinfo->output_height = (JDIMENSION)
  195|      0|        jdiv_round_up((long)cinfo->image_height * 11L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  196|      0|      cinfo->_min_DCT_h_scaled_size = 11;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  197|      0|      cinfo->_min_DCT_v_scaled_size = 11;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  198|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 12) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (198:16): [True: 0, False: 0]
  ------------------
  199|       |      /* Provide 12/block_size scaling */
  200|      0|      cinfo->output_width = (JDIMENSION)
  201|      0|        jdiv_round_up((long)cinfo->image_width * 12L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  202|      0|      cinfo->output_height = (JDIMENSION)
  203|      0|        jdiv_round_up((long)cinfo->image_height * 12L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  204|      0|      cinfo->_min_DCT_h_scaled_size = 12;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  205|      0|      cinfo->_min_DCT_v_scaled_size = 12;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  206|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 13) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (206:16): [True: 0, False: 0]
  ------------------
  207|       |      /* Provide 13/block_size scaling */
  208|      0|      cinfo->output_width = (JDIMENSION)
  209|      0|        jdiv_round_up((long)cinfo->image_width * 13L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  210|      0|      cinfo->output_height = (JDIMENSION)
  211|      0|        jdiv_round_up((long)cinfo->image_height * 13L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  212|      0|      cinfo->_min_DCT_h_scaled_size = 13;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  213|      0|      cinfo->_min_DCT_v_scaled_size = 13;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  214|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 14) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (214:16): [True: 0, False: 0]
  ------------------
  215|       |      /* Provide 14/block_size scaling */
  216|      0|      cinfo->output_width = (JDIMENSION)
  217|      0|        jdiv_round_up((long)cinfo->image_width * 14L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  218|      0|      cinfo->output_height = (JDIMENSION)
  219|      0|        jdiv_round_up((long)cinfo->image_height * 14L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  220|      0|      cinfo->_min_DCT_h_scaled_size = 14;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  221|      0|      cinfo->_min_DCT_v_scaled_size = 14;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  222|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 15) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (222:16): [True: 0, False: 0]
  ------------------
  223|       |      /* Provide 15/block_size scaling */
  224|      0|      cinfo->output_width = (JDIMENSION)
  225|      0|        jdiv_round_up((long)cinfo->image_width * 15L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  226|      0|      cinfo->output_height = (JDIMENSION)
  227|      0|        jdiv_round_up((long)cinfo->image_height * 15L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  228|      0|      cinfo->_min_DCT_h_scaled_size = 15;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  229|      0|      cinfo->_min_DCT_v_scaled_size = 15;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  230|      0|    } else {
  231|       |      /* Provide 16/block_size scaling */
  232|      0|      cinfo->output_width = (JDIMENSION)
  233|      0|        jdiv_round_up((long)cinfo->image_width * 16L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  234|      0|      cinfo->output_height = (JDIMENSION)
  235|      0|        jdiv_round_up((long)cinfo->image_height * 16L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  236|      0|      cinfo->_min_DCT_h_scaled_size = 16;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  237|      0|      cinfo->_min_DCT_v_scaled_size = 16;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  238|      0|    }
  239|       |
  240|       |    /* Recompute dimensions of components */
  241|   169k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (241:46): [True: 98.5k, False: 70.9k]
  ------------------
  242|  98.5k|         ci++, compptr++) {
  243|  98.5k|      compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   25|  98.5k|#define _DCT_h_scaled_size  DCT_scaled_size
  ------------------
                    compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   28|  98.5k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  244|  98.5k|      compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   26|  98.5k|#define _DCT_v_scaled_size  DCT_scaled_size
  ------------------
                    compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   29|  98.5k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  245|  98.5k|    }
  246|  70.9k|  } else
  247|  3.75k|#endif /* !IDCT_SCALING_SUPPORTED */
  248|  3.75k|  {
  249|       |    /* Hardwire it to "no scaling" */
  250|  3.75k|    cinfo->output_width = cinfo->image_width;
  251|  3.75k|    cinfo->output_height = cinfo->image_height;
  252|       |    /* jdinput.c has already initialized DCT_scaled_size,
  253|       |     * and has computed unscaled downsampled_width and downsampled_height.
  254|       |     */
  255|  3.75k|  }
  256|  74.7k|}
jdmaster.c:use_merged_upsample:
   39|   149k|{
   40|   149k|#ifdef UPSAMPLE_MERGING_SUPPORTED
   41|       |  /* Colorspace conversion is not supported with lossless JPEG images */
   42|   149k|  if (cinfo->master->lossless)
  ------------------
  |  Branch (42:7): [True: 7.50k, False: 141k]
  ------------------
   43|  7.50k|    return FALSE;
  ------------------
  |  |  207|  7.50k|#define FALSE   0               /* values of boolean */
  ------------------
   44|       |  /* Merging is the equivalent of plain box-filter upsampling */
   45|   141k|  if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)
  ------------------
  |  Branch (45:7): [True: 141k, False: 0]
  |  Branch (45:37): [True: 0, False: 0]
  ------------------
   46|   141k|    return FALSE;
  ------------------
  |  |  207|   141k|#define FALSE   0               /* values of boolean */
  ------------------
   47|       |  /* jdmerge.c only supports YCC=>RGB and YCC=>RGB565 color conversion */
   48|      0|  if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 ||
  ------------------
  |  Branch (48:7): [True: 0, False: 0]
  |  Branch (48:47): [True: 0, False: 0]
  ------------------
   49|      0|      (cinfo->out_color_space != JCS_RGB &&
  ------------------
  |  Branch (49:8): [True: 0, False: 0]
  ------------------
   50|      0|       cinfo->out_color_space != JCS_RGB565 &&
  ------------------
  |  Branch (50:8): [True: 0, False: 0]
  ------------------
   51|      0|       cinfo->out_color_space != JCS_EXT_RGB &&
  ------------------
  |  Branch (51:8): [True: 0, False: 0]
  ------------------
   52|      0|       cinfo->out_color_space != JCS_EXT_RGBX &&
  ------------------
  |  Branch (52:8): [True: 0, False: 0]
  ------------------
   53|      0|       cinfo->out_color_space != JCS_EXT_BGR &&
  ------------------
  |  Branch (53:8): [True: 0, False: 0]
  ------------------
   54|      0|       cinfo->out_color_space != JCS_EXT_BGRX &&
  ------------------
  |  Branch (54:8): [True: 0, False: 0]
  ------------------
   55|      0|       cinfo->out_color_space != JCS_EXT_XBGR &&
  ------------------
  |  Branch (55:8): [True: 0, False: 0]
  ------------------
   56|      0|       cinfo->out_color_space != JCS_EXT_XRGB &&
  ------------------
  |  Branch (56:8): [True: 0, False: 0]
  ------------------
   57|      0|       cinfo->out_color_space != JCS_EXT_RGBA &&
  ------------------
  |  Branch (57:8): [True: 0, False: 0]
  ------------------
   58|      0|       cinfo->out_color_space != JCS_EXT_BGRA &&
  ------------------
  |  Branch (58:8): [True: 0, False: 0]
  ------------------
   59|      0|       cinfo->out_color_space != JCS_EXT_ABGR &&
  ------------------
  |  Branch (59:8): [True: 0, False: 0]
  ------------------
   60|      0|       cinfo->out_color_space != JCS_EXT_ARGB))
  ------------------
  |  Branch (60:8): [True: 0, False: 0]
  ------------------
   61|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   62|      0|  if ((cinfo->out_color_space == JCS_RGB565 &&
  ------------------
  |  Branch (62:8): [True: 0, False: 0]
  ------------------
   63|      0|       cinfo->out_color_components != 3) ||
  ------------------
  |  Branch (63:8): [True: 0, False: 0]
  ------------------
   64|      0|      (cinfo->out_color_space != JCS_RGB565 &&
  ------------------
  |  Branch (64:8): [True: 0, False: 0]
  ------------------
   65|      0|       cinfo->out_color_components != rgb_pixelsize[cinfo->out_color_space]))
  ------------------
  |  Branch (65:8): [True: 0, False: 0]
  ------------------
   66|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   67|       |  /* and it only handles 2h1v or 2h2v sampling ratios */
   68|      0|  if (cinfo->comp_info[0].h_samp_factor != 2 ||
  ------------------
  |  Branch (68:7): [True: 0, False: 0]
  ------------------
   69|      0|      cinfo->comp_info[1].h_samp_factor != 1 ||
  ------------------
  |  Branch (69:7): [True: 0, False: 0]
  ------------------
   70|      0|      cinfo->comp_info[2].h_samp_factor != 1 ||
  ------------------
  |  Branch (70:7): [True: 0, False: 0]
  ------------------
   71|      0|      cinfo->comp_info[0].v_samp_factor >  2 ||
  ------------------
  |  Branch (71:7): [True: 0, False: 0]
  ------------------
   72|      0|      cinfo->comp_info[1].v_samp_factor != 1 ||
  ------------------
  |  Branch (72:7): [True: 0, False: 0]
  ------------------
   73|      0|      cinfo->comp_info[2].v_samp_factor != 1)
  ------------------
  |  Branch (73:7): [True: 0, False: 0]
  ------------------
   74|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   75|       |  /* furthermore, it doesn't work if we've scaled the IDCTs differently */
   76|      0|  if (cinfo->comp_info[0]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   24|      0|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
                if (cinfo->comp_info[0]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (76:7): [True: 0, False: 0]
  ------------------
   77|      0|      cinfo->comp_info[1]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   24|      0|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
                    cinfo->comp_info[1]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (77:7): [True: 0, False: 0]
  ------------------
   78|      0|      cinfo->comp_info[2]._DCT_scaled_size != cinfo->_min_DCT_scaled_size)
  ------------------
  |  |   24|      0|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
                    cinfo->comp_info[2]._DCT_scaled_size != cinfo->_min_DCT_scaled_size)
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (78:7): [True: 0, False: 0]
  ------------------
   79|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   80|       |  /* ??? also need to test for upsample-time rescaling, when & if supported */
   81|      0|  return TRUE;                  /* by golly, it'll work... */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
   82|       |#else
   83|       |  return FALSE;
   84|       |#endif
   85|      0|}
jdmaster.c:prepare_for_output_pass:
  797|  65.3k|{
  798|  65.3k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  799|       |
  800|  65.3k|  if (master->pub.is_dummy_pass) {
  ------------------
  |  Branch (800:7): [True: 0, False: 65.3k]
  ------------------
  801|      0|#ifdef QUANT_2PASS_SUPPORTED
  802|       |    /* Final pass of 2-pass quantization */
  803|      0|    master->pub.is_dummy_pass = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  804|      0|    (*cinfo->cquantize->start_pass) (cinfo, FALSE);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  805|      0|    (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST);
  806|      0|    (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST);
  807|       |#else
  808|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  809|       |#endif /* QUANT_2PASS_SUPPORTED */
  810|  65.3k|  } else {
  811|  65.3k|    if (cinfo->quantize_colors && cinfo->colormap == NULL) {
  ------------------
  |  Branch (811:9): [True: 0, False: 65.3k]
  |  Branch (811:35): [True: 0, False: 0]
  ------------------
  812|       |      /* Select new quantization method */
  813|      0|      if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) {
  ------------------
  |  Branch (813:11): [True: 0, False: 0]
  |  Branch (813:39): [True: 0, False: 0]
  ------------------
  814|      0|        cinfo->cquantize = master->quantizer_2pass;
  815|      0|        master->pub.is_dummy_pass = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  816|      0|      } else if (cinfo->enable_1pass_quant) {
  ------------------
  |  Branch (816:18): [True: 0, False: 0]
  ------------------
  817|      0|        cinfo->cquantize = master->quantizer_1pass;
  818|      0|      } else {
  819|      0|        ERREXIT(cinfo, JERR_MODE_CHANGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  820|      0|      }
  821|      0|    }
  822|  65.3k|    (*cinfo->idct->start_pass) (cinfo);
  823|  65.3k|    (*cinfo->coef->start_output_pass) (cinfo);
  824|  65.3k|    if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (824:9): [True: 64.3k, False: 940]
  ------------------
  825|  64.3k|      if (!master->using_merged_upsample)
  ------------------
  |  Branch (825:11): [True: 64.3k, False: 0]
  ------------------
  826|  64.3k|        (*cinfo->cconvert->start_pass) (cinfo);
  827|  64.3k|      (*cinfo->upsample->start_pass) (cinfo);
  828|  64.3k|      if (cinfo->quantize_colors)
  ------------------
  |  Branch (828:11): [True: 0, False: 64.3k]
  ------------------
  829|      0|        (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass);
  830|  64.3k|      (*cinfo->post->start_pass) (cinfo,
  831|  64.3k|            (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
  ------------------
  |  Branch (831:14): [True: 0, False: 64.3k]
  ------------------
  832|  64.3k|      (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
  833|  64.3k|    }
  834|  65.3k|  }
  835|       |
  836|       |  /* Set up progress monitor's pass info if present */
  837|  65.3k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (837:7): [True: 29.9k, False: 35.3k]
  ------------------
  838|  29.9k|    cinfo->progress->completed_passes = master->pass_number;
  839|  29.9k|    cinfo->progress->total_passes = master->pass_number +
  840|  29.9k|                                    (master->pub.is_dummy_pass ? 2 : 1);
  ------------------
  |  Branch (840:38): [True: 0, False: 29.9k]
  ------------------
  841|       |    /* In buffered-image mode, we assume one more output pass if EOI not
  842|       |     * yet reached, but no more passes if EOI has been reached.
  843|       |     */
  844|  29.9k|    if (cinfo->buffered_image && !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (844:9): [True: 0, False: 29.9k]
  |  Branch (844:34): [True: 0, False: 0]
  ------------------
  845|      0|      cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1);
  ------------------
  |  Branch (845:41): [True: 0, False: 0]
  ------------------
  846|      0|    }
  847|  29.9k|  }
  848|  65.3k|}
jdmaster.c:finish_output_pass:
  857|  29.5k|{
  858|  29.5k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  859|       |
  860|  29.5k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (860:7): [True: 0, False: 29.5k]
  ------------------
  861|      0|    (*cinfo->cquantize->finish_pass) (cinfo);
  862|  29.5k|  master->pass_number++;
  863|  29.5k|}
jdmaster.c:master_selection:
  515|  74.7k|{
  516|  74.7k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  517|  74.7k|  boolean use_c_buffer;
  518|  74.7k|  long samplesperrow;
  519|  74.7k|  JDIMENSION jd_samplesperrow;
  520|       |
  521|       |  /* When decompressing an 8-bit-per-sample lossy JPEG image, we allow the
  522|       |   * caller to request 12-bit-per-sample output in order to facilitate shadow
  523|       |   * recovery in underexposed images.  However, in all other cases, setting the
  524|       |   * output data precision to a different value than the JPEG data precision
  525|       |   * will produce unexpected results, such as a bogus output image.
  526|       |   */
  527|  74.7k|  if (cinfo->master->jpeg_data_precision &&
  ------------------
  |  Branch (527:7): [True: 74.7k, False: 0]
  ------------------
  528|  74.7k|      cinfo->data_precision != cinfo->master->jpeg_data_precision &&
  ------------------
  |  Branch (528:7): [True: 0, False: 74.7k]
  ------------------
  529|      0|      (cinfo->master->lossless || cinfo->data_precision != 12))
  ------------------
  |  Branch (529:8): [True: 0, False: 0]
  |  Branch (529:35): [True: 0, False: 0]
  ------------------
  530|      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)))
  ------------------
  531|       |
  532|       |  /* Disable IDCT scaling and raw (downsampled) data output in lossless mode.
  533|       |   * IDCT scaling is not useful in lossless mode, and it must be disabled in
  534|       |   * order to properly calculate the output dimensions.  Raw data output isn't
  535|       |   * particularly useful without subsampling and has not been tested in
  536|       |   * lossless mode.
  537|       |   */
  538|  74.7k|#ifdef D_LOSSLESS_SUPPORTED
  539|  74.7k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (539:7): [True: 3.75k, False: 70.9k]
  ------------------
  540|  3.75k|    cinfo->raw_data_out = FALSE;
  ------------------
  |  |  207|  3.75k|#define FALSE   0               /* values of boolean */
  ------------------
  541|  3.75k|    cinfo->scale_num = cinfo->scale_denom = 1;
  542|  3.75k|  }
  543|  74.7k|#endif
  544|       |
  545|       |  /* Initialize dimensions and other stuff */
  546|  74.7k|  jpeg_calc_output_dimensions(cinfo);
  547|  74.7k|  prepare_range_limit_table(cinfo);
  548|       |
  549|       |  /* Width of an output scanline must be representable as JDIMENSION. */
  550|  74.7k|  samplesperrow = (long)cinfo->output_width *
  551|  74.7k|                  (long)cinfo->out_color_components;
  552|  74.7k|  jd_samplesperrow = (JDIMENSION)samplesperrow;
  553|  74.7k|  if ((long)jd_samplesperrow != samplesperrow)
  ------------------
  |  Branch (553:7): [True: 0, False: 74.7k]
  ------------------
  554|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  555|       |
  556|       |  /* Initialize my private state */
  557|  74.7k|  master->pass_number = 0;
  558|  74.7k|  master->using_merged_upsample = use_merged_upsample(cinfo);
  559|       |
  560|       |  /* Color quantizer selection */
  561|  74.7k|  master->quantizer_1pass = NULL;
  562|  74.7k|  master->quantizer_2pass = NULL;
  563|       |  /* No mode changes if not using buffered-image mode. */
  564|  74.7k|  if (!cinfo->quantize_colors || !cinfo->buffered_image) {
  ------------------
  |  Branch (564:7): [True: 74.7k, False: 0]
  |  Branch (564:34): [True: 0, False: 0]
  ------------------
  565|  74.7k|    cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  207|  74.7k|#define FALSE   0               /* values of boolean */
  ------------------
  566|  74.7k|    cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|  74.7k|#define FALSE   0               /* values of boolean */
  ------------------
  567|  74.7k|    cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|  74.7k|#define FALSE   0               /* values of boolean */
  ------------------
  568|  74.7k|  }
  569|  74.7k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (569:7): [True: 0, False: 74.7k]
  ------------------
  570|      0|    if (cinfo->raw_data_out)
  ------------------
  |  Branch (570:9): [True: 0, False: 0]
  ------------------
  571|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  572|       |    /* 2-pass quantizer only works in 3-component color space. */
  573|      0|    if (cinfo->out_color_components != 3 ||
  ------------------
  |  Branch (573:9): [True: 0, False: 0]
  ------------------
  574|      0|        cinfo->out_color_space == JCS_RGB565) {
  ------------------
  |  Branch (574:9): [True: 0, False: 0]
  ------------------
  575|      0|      cinfo->enable_1pass_quant = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  576|      0|      cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  577|      0|      cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  578|      0|      cinfo->colormap = NULL;
  579|      0|    } else if (cinfo->colormap != NULL) {
  ------------------
  |  Branch (579:16): [True: 0, False: 0]
  ------------------
  580|      0|      cinfo->enable_external_quant = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  581|      0|    } else if (cinfo->two_pass_quantize) {
  ------------------
  |  Branch (581:16): [True: 0, False: 0]
  ------------------
  582|      0|      cinfo->enable_2pass_quant = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  583|      0|    } else {
  584|      0|      cinfo->enable_1pass_quant = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  585|      0|    }
  586|       |
  587|      0|    if (cinfo->enable_1pass_quant) {
  ------------------
  |  Branch (587:9): [True: 0, False: 0]
  ------------------
  588|      0|#ifdef QUANT_1PASS_SUPPORTED
  589|      0|      if (cinfo->data_precision == 8)
  ------------------
  |  Branch (589:11): [True: 0, False: 0]
  ------------------
  590|      0|        jinit_1pass_quantizer(cinfo);
  591|      0|      else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (591:16): [True: 0, False: 0]
  ------------------
  592|      0|        j12init_1pass_quantizer(cinfo);
  593|      0|      else
  594|      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)))
  ------------------
  595|      0|      master->quantizer_1pass = cinfo->cquantize;
  596|       |#else
  597|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  598|       |#endif
  599|      0|    }
  600|       |
  601|       |    /* We use the 2-pass code to map to external colormaps. */
  602|      0|    if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) {
  ------------------
  |  Branch (602:9): [True: 0, False: 0]
  |  Branch (602:38): [True: 0, False: 0]
  ------------------
  603|      0|#ifdef QUANT_2PASS_SUPPORTED
  604|      0|      if (cinfo->data_precision == 8)
  ------------------
  |  Branch (604:11): [True: 0, False: 0]
  ------------------
  605|      0|        jinit_2pass_quantizer(cinfo);
  606|      0|      else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (606:16): [True: 0, False: 0]
  ------------------
  607|      0|        j12init_2pass_quantizer(cinfo);
  608|      0|      else
  609|      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)))
  ------------------
  610|      0|      master->quantizer_2pass = cinfo->cquantize;
  611|       |#else
  612|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  613|       |#endif
  614|      0|    }
  615|       |    /* If both quantizers are initialized, the 2-pass one is left active;
  616|       |     * this is necessary for starting with quantization to an external map.
  617|       |     */
  618|      0|  }
  619|       |
  620|       |  /* Post-processing: in particular, color conversion first */
  621|  74.7k|  if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (621:7): [True: 73.7k, False: 953]
  ------------------
  622|  73.7k|    if (master->using_merged_upsample) {
  ------------------
  |  Branch (622:9): [True: 0, False: 73.7k]
  ------------------
  623|      0|#ifdef UPSAMPLE_MERGING_SUPPORTED
  624|      0|      if (cinfo->data_precision == 8)
  ------------------
  |  Branch (624:11): [True: 0, False: 0]
  ------------------
  625|      0|        jinit_merged_upsampler(cinfo); /* does color conversion too */
  626|      0|      else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (626:16): [True: 0, False: 0]
  ------------------
  627|      0|        j12init_merged_upsampler(cinfo); /* does color conversion too */
  628|      0|      else
  629|      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)))
  ------------------
  630|       |#else
  631|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  632|       |#endif
  633|  73.7k|    } else {
  634|  73.7k|      if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (634:11): [True: 72.9k, False: 797]
  ------------------
  635|  72.9k|        jinit_color_deconverter(cinfo);
  636|  72.9k|        jinit_upsampler(cinfo);
  637|  72.9k|      } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (637:18): [True: 797, False: 0]
  ------------------
  638|    797|        j12init_color_deconverter(cinfo);
  639|    797|        j12init_upsampler(cinfo);
  640|    797|      } else {
  641|      0|#ifdef D_LOSSLESS_SUPPORTED
  642|      0|        j16init_color_deconverter(cinfo);
  643|      0|        j16init_upsampler(cinfo);
  644|       |#else
  645|       |        ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  646|       |#endif
  647|      0|      }
  648|  73.7k|    }
  649|  73.7k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (649:9): [True: 72.9k, False: 811]
  ------------------
  650|  72.9k|      jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  651|    811|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (651:14): [True: 797, False: 14]
  ------------------
  652|    797|      j12init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  653|     14|    else
  654|     14|#ifdef D_LOSSLESS_SUPPORTED
  655|     14|      j16init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  656|       |#else
  657|       |      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  658|       |#endif
  659|  73.7k|  }
  660|       |
  661|  74.7k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (661:7): [True: 3.73k, False: 71.0k]
  ------------------
  662|  3.73k|#ifdef D_LOSSLESS_SUPPORTED
  663|       |    /* Prediction, sample undifferencing, point transform, and sample size
  664|       |     * scaling
  665|       |     */
  666|  3.73k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (666:9): [True: 3.42k, False: 311]
  ------------------
  667|  3.42k|      jinit_lossless_decompressor(cinfo);
  668|    311|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (668:14): [True: 311, False: 0]
  ------------------
  669|    311|      j12init_lossless_decompressor(cinfo);
  670|      0|    else
  671|      0|      j16init_lossless_decompressor(cinfo);
  672|       |    /* Entropy decoding: either Huffman or arithmetic coding. */
  673|  3.73k|    if (cinfo->arith_code) {
  ------------------
  |  Branch (673:9): [True: 277, False: 3.46k]
  ------------------
  674|    277|      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  ------------------
  |  |  240|    277|  ((cinfo)->err->msg_code = (code), \
  |  |  241|    277|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  675|  3.46k|    } else {
  676|  3.46k|      jinit_lhuff_decoder(cinfo);
  677|  3.46k|    }
  678|       |
  679|       |    /* Initialize principal buffer controllers. */
  680|  3.73k|    use_c_buffer = cinfo->inputctl->has_multiple_scans ||
  ------------------
  |  Branch (680:20): [True: 367, False: 3.37k]
  ------------------
  681|  3.37k|                   cinfo->buffered_image;
  ------------------
  |  Branch (681:20): [True: 0, False: 3.37k]
  ------------------
  682|  3.73k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (682:9): [True: 3.15k, False: 588]
  ------------------
  683|  3.15k|      jinit_d_diff_controller(cinfo, use_c_buffer);
  684|    588|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (684:14): [True: 311, False: 277]
  ------------------
  685|    311|      j12init_d_diff_controller(cinfo, use_c_buffer);
  686|    277|    else
  687|    277|      j16init_d_diff_controller(cinfo, use_c_buffer);
  688|       |#else
  689|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  690|       |#endif
  691|  71.0k|  } else {
  692|  71.0k|#if defined(DCT_ISLOW_SUPPORTED) || defined(DCT_IFAST_SUPPORTED) || \
  693|  71.0k|    defined(DCT_FLOAT_SUPPORTED)
  694|       |    /* Inverse DCT */
  695|  71.0k|    if (cinfo->data_precision == 8)
  ------------------
  |  Branch (695:9): [True: 70.5k, False: 500]
  ------------------
  696|  70.5k|      jinit_inverse_dct(cinfo);
  697|    500|    else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (697:14): [True: 486, False: 14]
  ------------------
  698|    486|      j12init_inverse_dct(cinfo);
  699|     14|    else
  700|     14|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  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)))
  ------------------
  701|       |    /* Entropy decoding: either Huffman or arithmetic coding. */
  702|  71.0k|    if (cinfo->arith_code) {
  ------------------
  |  Branch (702:9): [True: 18.0k, False: 52.9k]
  ------------------
  703|  18.0k|#ifdef D_ARITH_CODING_SUPPORTED
  704|  18.0k|      jinit_arith_decoder(cinfo);
  705|       |#else
  706|       |      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  707|       |#endif
  708|  52.9k|    } else {
  709|  52.9k|      if (cinfo->progressive_mode) {
  ------------------
  |  Branch (709:11): [True: 8.41k, False: 44.5k]
  ------------------
  710|  8.41k|#ifdef D_PROGRESSIVE_SUPPORTED
  711|  8.41k|        jinit_phuff_decoder(cinfo);
  712|       |#else
  713|       |        ERREXIT(cinfo, JERR_NOT_COMPILED);
  714|       |#endif
  715|  8.41k|      } else
  716|  44.5k|        jinit_huff_decoder(cinfo);
  717|  52.9k|    }
  718|       |
  719|       |    /* Initialize principal buffer controllers. */
  720|  71.0k|    use_c_buffer = cinfo->inputctl->has_multiple_scans ||
  ------------------
  |  Branch (720:20): [True: 22.5k, False: 48.4k]
  ------------------
  721|  48.4k|                   cinfo->buffered_image;
  ------------------
  |  Branch (721:20): [True: 0, False: 48.4k]
  ------------------
  722|  71.0k|    if (cinfo->data_precision == 12)
  ------------------
  |  Branch (722:9): [True: 486, False: 70.5k]
  ------------------
  723|    486|      j12init_d_coef_controller(cinfo, use_c_buffer);
  724|  70.5k|    else
  725|  70.5k|      jinit_d_coef_controller(cinfo, use_c_buffer);
  726|       |#else
  727|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  728|       |#endif
  729|  71.0k|  }
  730|       |
  731|  74.7k|  if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (731:7): [True: 73.5k, False: 1.24k]
  ------------------
  732|  73.5k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (732:9): [True: 72.7k, False: 797]
  ------------------
  733|  72.7k|      jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  207|  72.7k|#define FALSE   0               /* values of boolean */
  ------------------
  734|    797|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (734:14): [True: 797, False: 0]
  ------------------
  735|    797|      j12init_d_main_controller(cinfo,
  736|    797|                                FALSE /* never need full buffer here */);
  ------------------
  |  |  207|    797|#define FALSE   0               /* values of boolean */
  ------------------
  737|      0|    else
  738|      0|#ifdef D_LOSSLESS_SUPPORTED
  739|      0|      j16init_d_main_controller(cinfo,
  740|      0|                                FALSE /* never need full buffer here */);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  741|       |#else
  742|       |      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  743|       |#endif
  744|  73.5k|  }
  745|       |
  746|       |  /* We can now tell the memory manager to allocate virtual arrays. */
  747|  74.7k|  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
  748|       |
  749|       |  /* Initialize input side of decompressor to consume first scan. */
  750|  74.7k|  (*cinfo->inputctl->start_input_pass) (cinfo);
  751|       |
  752|       |  /* Set the first and last iMCU columns to decompress from single-scan images.
  753|       |   * By default, decompress all of the iMCU columns.
  754|       |   */
  755|  74.7k|  cinfo->master->first_iMCU_col = 0;
  756|  74.7k|  cinfo->master->last_iMCU_col = cinfo->MCUs_per_row - 1;
  757|  74.7k|  cinfo->master->last_good_iMCU_row = 0;
  758|       |
  759|  74.7k|#ifdef D_MULTISCAN_FILES_SUPPORTED
  760|       |  /* If jpeg_start_decompress will read the whole file, initialize
  761|       |   * progress monitoring appropriately.  The input step is counted
  762|       |   * as one pass.
  763|       |   */
  764|  74.7k|  if (cinfo->progress != NULL && !cinfo->buffered_image &&
  ------------------
  |  Branch (764:7): [True: 35.8k, False: 38.9k]
  |  Branch (764:34): [True: 35.8k, False: 0]
  ------------------
  765|  35.8k|      cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (765:7): [True: 21.5k, False: 14.2k]
  ------------------
  766|  21.5k|    int nscans;
  767|       |    /* Estimate number of scans to set pass_limit. */
  768|  21.5k|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (768:9): [True: 19.4k, False: 2.07k]
  ------------------
  769|       |      /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
  770|  19.4k|      nscans = 2 + 3 * cinfo->num_components;
  771|  19.4k|    } else {
  772|       |      /* For a nonprogressive multiscan file, estimate 1 scan per component. */
  773|  2.07k|      nscans = cinfo->num_components;
  774|  2.07k|    }
  775|  21.5k|    cinfo->progress->pass_counter = 0L;
  776|  21.5k|    cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows * nscans;
  777|  21.5k|    cinfo->progress->completed_passes = 0;
  778|  21.5k|    cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);
  ------------------
  |  Branch (778:38): [True: 0, False: 21.5k]
  ------------------
  779|       |    /* Count the input pass as done */
  780|  21.5k|    master->pass_number++;
  781|  21.5k|  }
  782|  74.7k|#endif /* D_MULTISCAN_FILES_SUPPORTED */
  783|  74.7k|}
jdmaster.c:prepare_range_limit_table:
  420|  74.7k|{
  421|  74.7k|  JSAMPLE *table;
  422|  74.7k|  J12SAMPLE *table12;
  423|  74.7k|#ifdef D_LOSSLESS_SUPPORTED
  424|  74.7k|  J16SAMPLE *table16;
  425|  74.7k|#endif
  426|  74.7k|  int i;
  427|       |
  428|  74.7k|  if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (428:7): [True: 73.9k, False: 797]
  ------------------
  429|  73.9k|    table = (JSAMPLE *)
  430|  73.9k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  73.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  431|  73.9k|                  (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  73.9k|#define MAXJSAMPLE       255
  ------------------
                                (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   53|  73.9k|#define CENTERJSAMPLE    128
  ------------------
  432|  73.9k|    table += (MAXJSAMPLE + 1);  /* allow negative subscripts of simple table */
  ------------------
  |  |   52|  73.9k|#define MAXJSAMPLE       255
  ------------------
  433|  73.9k|    cinfo->sample_range_limit = table;
  434|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  435|  73.9k|    memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  73.9k|#define MAXJSAMPLE       255
  ------------------
                  memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  73.9k|#define MAXJSAMPLE       255
  ------------------
  436|       |    /* Main part of "simple" table: limit[x] = x */
  437|  19.0M|    for (i = 0; i <= MAXJSAMPLE; i++)
  ------------------
  |  |   52|  19.0M|#define MAXJSAMPLE       255
  ------------------
  |  Branch (437:17): [True: 18.9M, False: 73.9k]
  ------------------
  438|  18.9M|      table[i] = (JSAMPLE)i;
  439|  73.9k|    table += CENTERJSAMPLE;     /* Point to where post-IDCT table starts */
  ------------------
  |  |   53|  73.9k|#define CENTERJSAMPLE    128
  ------------------
  440|       |    /* End of simple table, rest of first half of post-IDCT table */
  441|  28.4M|    for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   53|  73.9k|#define CENTERJSAMPLE    128
  ------------------
                  for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   52|  28.4M|#define MAXJSAMPLE       255
  ------------------
  |  Branch (441:29): [True: 28.3M, False: 73.9k]
  ------------------
  442|  28.3M|      table[i] = MAXJSAMPLE;
  ------------------
  |  |   52|  28.3M|#define MAXJSAMPLE       255
  ------------------
  443|       |    /* Second half of post-IDCT table */
  444|  73.9k|    memset(table + (2 * (MAXJSAMPLE + 1)), 0,
  ------------------
  |  |   52|  73.9k|#define MAXJSAMPLE       255
  ------------------
  445|  73.9k|           (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  73.9k|#define MAXJSAMPLE       255
  ------------------
                         (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   53|  73.9k|#define CENTERJSAMPLE    128
  ------------------
  446|  73.9k|    memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   52|  73.9k|#define MAXJSAMPLE       255
  ------------------
                  memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   53|  73.9k|#define CENTERJSAMPLE    128
  ------------------
  447|  73.9k|           cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE));
  ------------------
  |  |   53|  73.9k|#define CENTERJSAMPLE    128
  ------------------
  448|  73.9k|  } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (448:14): [True: 797, False: 0]
  ------------------
  449|    797|    table12 = (J12SAMPLE *)
  450|    797|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    797|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  451|    797|                  (5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
  ------------------
  |  |   60|    797|#define MAXJ12SAMPLE     4095
  ------------------
                                (5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
  ------------------
  |  |   61|    797|#define CENTERJ12SAMPLE  2048
  ------------------
  452|    797|                  sizeof(J12SAMPLE));
  453|    797|    table12 += (MAXJ12SAMPLE + 1);  /* allow negative subscripts of simple
  ------------------
  |  |   60|    797|#define MAXJ12SAMPLE     4095
  ------------------
  454|       |                                       table */
  455|    797|    cinfo->sample_range_limit = (JSAMPLE *)table12;
  456|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  457|    797|    memset(table12 - (MAXJ12SAMPLE + 1), 0,
  ------------------
  |  |   60|    797|#define MAXJ12SAMPLE     4095
  ------------------
  458|    797|           (MAXJ12SAMPLE + 1) * sizeof(J12SAMPLE));
  ------------------
  |  |   60|    797|#define MAXJ12SAMPLE     4095
  ------------------
  459|       |    /* Main part of "simple" table: limit[x] = x */
  460|  3.26M|    for (i = 0; i <= MAXJ12SAMPLE; i++)
  ------------------
  |  |   60|  3.26M|#define MAXJ12SAMPLE     4095
  ------------------
  |  Branch (460:17): [True: 3.26M, False: 797]
  ------------------
  461|  3.26M|      table12[i] = (J12SAMPLE)i;
  462|    797|    table12 += CENTERJ12SAMPLE; /* Point to where post-IDCT table starts */
  ------------------
  |  |   61|    797|#define CENTERJ12SAMPLE  2048
  ------------------
  463|       |    /* End of simple table, rest of first half of post-IDCT table */
  464|  4.89M|    for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
  ------------------
  |  |   61|    797|#define CENTERJ12SAMPLE  2048
  ------------------
                  for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
  ------------------
  |  |   60|  4.89M|#define MAXJ12SAMPLE     4095
  ------------------
  |  Branch (464:31): [True: 4.89M, False: 797]
  ------------------
  465|  4.89M|      table12[i] = MAXJ12SAMPLE;
  ------------------
  |  |   60|  4.89M|#define MAXJ12SAMPLE     4095
  ------------------
  466|       |    /* Second half of post-IDCT table */
  467|    797|    memset(table12 + (2 * (MAXJ12SAMPLE + 1)), 0,
  ------------------
  |  |   60|    797|#define MAXJ12SAMPLE     4095
  ------------------
  468|    797|           (2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
  ------------------
  |  |   60|    797|#define MAXJ12SAMPLE     4095
  ------------------
                         (2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
  ------------------
  |  |   61|    797|#define CENTERJ12SAMPLE  2048
  ------------------
  469|    797|    memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
  ------------------
  |  |   60|    797|#define MAXJ12SAMPLE     4095
  ------------------
                  memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
  ------------------
  |  |   61|    797|#define CENTERJ12SAMPLE  2048
  ------------------
  470|    797|           cinfo->sample_range_limit, CENTERJ12SAMPLE * sizeof(J12SAMPLE));
  ------------------
  |  |   61|    797|#define CENTERJ12SAMPLE  2048
  ------------------
  471|    797|  } else {
  472|      0|#ifdef D_LOSSLESS_SUPPORTED
  473|      0|    table16 = (J16SAMPLE *)
  474|      0|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  475|      0|                  (5 * (MAXJ16SAMPLE + 1) + CENTERJ16SAMPLE) *
  ------------------
  |  |   68|      0|#define MAXJ16SAMPLE     65535
  ------------------
                                (5 * (MAXJ16SAMPLE + 1) + CENTERJ16SAMPLE) *
  ------------------
  |  |   69|      0|#define CENTERJ16SAMPLE  32768
  ------------------
  476|      0|                  sizeof(J16SAMPLE));
  477|      0|    table16 += (MAXJ16SAMPLE + 1);  /* allow negative subscripts of simple
  ------------------
  |  |   68|      0|#define MAXJ16SAMPLE     65535
  ------------------
  478|       |                                       table */
  479|      0|    cinfo->sample_range_limit = (JSAMPLE *)table16;
  480|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  481|      0|    memset(table16 - (MAXJ16SAMPLE + 1), 0,
  ------------------
  |  |   68|      0|#define MAXJ16SAMPLE     65535
  ------------------
  482|      0|           (MAXJ16SAMPLE + 1) * sizeof(J16SAMPLE));
  ------------------
  |  |   68|      0|#define MAXJ16SAMPLE     65535
  ------------------
  483|       |    /* Main part of "simple" table: limit[x] = x */
  484|      0|    for (i = 0; i <= MAXJ16SAMPLE; i++)
  ------------------
  |  |   68|      0|#define MAXJ16SAMPLE     65535
  ------------------
  |  Branch (484:17): [True: 0, False: 0]
  ------------------
  485|      0|      table16[i] = (J16SAMPLE)i;
  486|      0|    table16 += CENTERJ16SAMPLE; /* Point to where post-IDCT table starts */
  ------------------
  |  |   69|      0|#define CENTERJ16SAMPLE  32768
  ------------------
  487|       |    /* End of simple table, rest of first half of post-IDCT table */
  488|      0|    for (i = CENTERJ16SAMPLE; i < 2 * (MAXJ16SAMPLE + 1); i++)
  ------------------
  |  |   69|      0|#define CENTERJ16SAMPLE  32768
  ------------------
                  for (i = CENTERJ16SAMPLE; i < 2 * (MAXJ16SAMPLE + 1); i++)
  ------------------
  |  |   68|      0|#define MAXJ16SAMPLE     65535
  ------------------
  |  Branch (488:31): [True: 0, False: 0]
  ------------------
  489|      0|      table16[i] = MAXJ16SAMPLE;
  ------------------
  |  |   68|      0|#define MAXJ16SAMPLE     65535
  ------------------
  490|       |    /* Second half of post-IDCT table */
  491|      0|    memset(table16 + (2 * (MAXJ16SAMPLE + 1)), 0,
  ------------------
  |  |   68|      0|#define MAXJ16SAMPLE     65535
  ------------------
  492|      0|           (2 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE) * sizeof(J16SAMPLE));
  ------------------
  |  |   68|      0|#define MAXJ16SAMPLE     65535
  ------------------
                         (2 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE) * sizeof(J16SAMPLE));
  ------------------
  |  |   69|      0|#define CENTERJ16SAMPLE  32768
  ------------------
  493|      0|    memcpy(table16 + (4 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE),
  ------------------
  |  |   68|      0|#define MAXJ16SAMPLE     65535
  ------------------
                  memcpy(table16 + (4 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE),
  ------------------
  |  |   69|      0|#define CENTERJ16SAMPLE  32768
  ------------------
  494|      0|           cinfo->sample_range_limit, CENTERJ16SAMPLE * sizeof(J16SAMPLE));
  ------------------
  |  |   69|      0|#define CENTERJ16SAMPLE  32768
  ------------------
  495|       |#else
  496|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  497|       |#endif
  498|      0|  }
  499|  74.7k|}

jinit_phuff_decoder:
  654|  8.41k|{
  655|  8.41k|  phuff_entropy_ptr entropy;
  656|  8.41k|  int *coef_bit_ptr;
  657|  8.41k|  int ci, i;
  658|       |
  659|  8.41k|  entropy = (phuff_entropy_ptr)
  660|  8.41k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  8.41k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  661|  8.41k|                                sizeof(phuff_entropy_decoder));
  662|  8.41k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  663|  8.41k|  entropy->pub.start_pass = start_pass_phuff_decoder;
  664|       |
  665|       |  /* Mark derived tables unallocated */
  666|  42.0k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  42.0k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (666:15): [True: 33.6k, False: 8.41k]
  ------------------
  667|  33.6k|    entropy->derived_tbls[i] = NULL;
  668|  33.6k|  }
  669|       |
  670|       |  /* Create progression status table */
  671|  8.41k|  cinfo->coef_bits = (int (*)[DCTSIZE2])
  672|  8.41k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  8.41k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  673|  8.41k|                                cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|  8.41k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  674|  8.41k|                                sizeof(int));
  675|  8.41k|  coef_bit_ptr = &cinfo->coef_bits[0][0];
  676|  24.4k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (676:16): [True: 16.0k, False: 8.41k]
  ------------------
  677|  1.04M|    for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  1.04M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (677:17): [True: 1.02M, False: 16.0k]
  ------------------
  678|  1.02M|      *coef_bit_ptr++ = -1;
  679|  8.41k|}
jdphuff.c:start_pass_phuff_decoder:
   83|  11.5k|{
   84|  11.5k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
   85|  11.5k|  boolean is_DC_band, bad;
   86|  11.5k|  int ci, coefi, tbl;
   87|  11.5k|  d_derived_tbl **pdtbl;
   88|  11.5k|  int *coef_bit_ptr, *prev_coef_bit_ptr;
   89|  11.5k|  jpeg_component_info *compptr;
   90|       |
   91|  11.5k|  is_DC_band = (cinfo->Ss == 0);
   92|       |
   93|       |  /* Validate scan parameters */
   94|  11.5k|  bad = FALSE;
  ------------------
  |  |  207|  11.5k|#define FALSE   0               /* values of boolean */
  ------------------
   95|  11.5k|  if (is_DC_band) {
  ------------------
  |  Branch (95:7): [True: 6.10k, False: 5.42k]
  ------------------
   96|  6.10k|    if (cinfo->Se != 0)
  ------------------
  |  Branch (96:9): [True: 426, False: 5.68k]
  ------------------
   97|    426|      bad = TRUE;
  ------------------
  |  |  210|    426|#define TRUE    1
  ------------------
   98|  6.10k|  } else {
   99|       |    /* need not check Ss/Se < 0 since they came from unsigned bytes */
  100|  5.42k|    if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
  ------------------
  |  |   67|  5.00k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (100:9): [True: 416, False: 5.00k]
  |  Branch (100:34): [True: 225, False: 4.77k]
  ------------------
  101|    641|      bad = TRUE;
  ------------------
  |  |  210|    641|#define TRUE    1
  ------------------
  102|       |    /* AC scans may have only one component */
  103|  5.42k|    if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (103:9): [True: 80, False: 5.34k]
  ------------------
  104|     80|      bad = TRUE;
  ------------------
  |  |  210|     80|#define TRUE    1
  ------------------
  105|  5.42k|  }
  106|  11.5k|  if (cinfo->Ah != 0) {
  ------------------
  |  Branch (106:7): [True: 6.27k, False: 5.25k]
  ------------------
  107|       |    /* Successive approximation refinement scan: must have Al = Ah-1. */
  108|  6.27k|    if (cinfo->Al != cinfo->Ah - 1)
  ------------------
  |  Branch (108:9): [True: 405, False: 5.87k]
  ------------------
  109|    405|      bad = TRUE;
  ------------------
  |  |  210|    405|#define TRUE    1
  ------------------
  110|  6.27k|  }
  111|  11.5k|  if (cinfo->Al > 13)           /* need not check for < 0 */
  ------------------
  |  Branch (111:7): [True: 375, False: 11.1k]
  ------------------
  112|    375|    bad = TRUE;
  ------------------
  |  |  210|    375|#define TRUE    1
  ------------------
  113|       |  /* Arguably the maximum Al value should be less than 13 for 8-bit precision,
  114|       |   * but the spec doesn't say so, and we try to be liberal about what we
  115|       |   * accept.  Note: large Al values could result in out-of-range DC
  116|       |   * coefficients during early scans, leading to bizarre displays due to
  117|       |   * overflows in the IDCT math.  But we won't crash.
  118|       |   */
  119|  11.5k|  if (bad)
  ------------------
  |  Branch (119:7): [True: 1.20k, False: 10.3k]
  ------------------
  120|  1.20k|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|  1.20k|  ((cinfo)->err->msg_code = (code), \
  |  |  259|  1.20k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|  1.20k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|  1.20k|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|  1.20k|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|  1.20k|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  121|  11.5k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  122|       |  /* Update progression status, and verify that scan order is legal.
  123|       |   * Note that inter-scan inconsistencies are treated as warnings
  124|       |   * not fatal errors ... not clear if this is right way to behave.
  125|       |   */
  126|  25.8k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:16): [True: 14.3k, False: 11.5k]
  ------------------
  127|  14.3k|    int cindex = cinfo->cur_comp_info[ci]->component_index;
  128|  14.3k|    coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  129|  14.3k|    prev_coef_bit_ptr = &cinfo->coef_bits[cindex + cinfo->num_components][0];
  130|  14.3k|    if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (130:9): [True: 4.64k, False: 9.68k]
  |  Branch (130:24): [True: 3.78k, False: 860]
  ------------------
  131|  3.78k|      WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|  3.78k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  3.78k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  3.78k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  3.78k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  132|   316k|    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|  14.3k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 9.68k, False: 4.64k]
  |  |  ------------------
  ------------------
                  for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|   316k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 208k, False: 108k]
  |  |  ------------------
  ------------------
  |  Branch (132:37): [True: 302k, False: 14.3k]
  ------------------
  133|   302k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (133:11): [True: 83.7k, False: 218k]
  ------------------
  134|  83.7k|        prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  135|   218k|      else
  136|   218k|        prev_coef_bit_ptr[coefi] = 0;
  137|   302k|    }
  138|   156k|    for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (138:29): [True: 141k, False: 14.3k]
  ------------------
  139|   141k|      int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (139:22): [True: 112k, False: 29.3k]
  ------------------
  140|   141k|      if (cinfo->Ah != expected)
  ------------------
  |  Branch (140:11): [True: 54.3k, False: 87.4k]
  ------------------
  141|  54.3k|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|  54.3k|  ((cinfo)->err->msg_code = (code), \
  |  |  291|  54.3k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|  54.3k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|  54.3k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  142|   141k|      coef_bit_ptr[coefi] = cinfo->Al;
  143|   141k|    }
  144|  14.3k|  }
  145|       |
  146|       |  /* Select MCU decoding routine */
  147|  11.5k|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (147:7): [True: 4.61k, False: 6.91k]
  ------------------
  148|  4.61k|    if (is_DC_band)
  ------------------
  |  Branch (148:9): [True: 2.00k, False: 2.61k]
  ------------------
  149|  2.00k|      entropy->pub.decode_mcu = decode_mcu_DC_first;
  150|  2.61k|    else
  151|  2.61k|      entropy->pub.decode_mcu = decode_mcu_AC_first;
  152|  6.91k|  } else {
  153|  6.91k|    if (is_DC_band)
  ------------------
  |  Branch (153:9): [True: 3.67k, False: 3.23k]
  ------------------
  154|  3.67k|      entropy->pub.decode_mcu = decode_mcu_DC_refine;
  155|  3.23k|    else
  156|  3.23k|      entropy->pub.decode_mcu = decode_mcu_AC_refine;
  157|  6.91k|  }
  158|       |
  159|  25.8k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (159:16): [True: 14.3k, False: 11.5k]
  ------------------
  160|  14.3k|    compptr = cinfo->cur_comp_info[ci];
  161|       |    /* Make sure requested tables are present, and compute derived tables.
  162|       |     * We may build same derived table more than once, but it's not expensive.
  163|       |     */
  164|  14.3k|    if (is_DC_band) {
  ------------------
  |  Branch (164:9): [True: 9.68k, False: 4.64k]
  ------------------
  165|  9.68k|      if (cinfo->Ah == 0) {     /* DC refinement needs no table */
  ------------------
  |  Branch (165:11): [True: 5.46k, False: 4.21k]
  ------------------
  166|  5.46k|        tbl = compptr->dc_tbl_no;
  167|  5.46k|        pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  168|  5.46k|        jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, pdtbl);
  ------------------
  |  |  210|  5.46k|#define TRUE    1
  ------------------
  169|  5.46k|      }
  170|  9.68k|    } else {
  171|  4.64k|      tbl = compptr->ac_tbl_no;
  172|  4.64k|      pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  173|  4.64k|      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, pdtbl);
  ------------------
  |  |  207|  4.64k|#define FALSE   0               /* values of boolean */
  ------------------
  174|       |      /* remember the single active table */
  175|  4.64k|      entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
  176|  4.64k|    }
  177|       |    /* Initialize DC predictions to 0 */
  178|  14.3k|    entropy->saved.last_dc_val[ci] = 0;
  179|  14.3k|  }
  180|       |
  181|       |  /* Initialize bitread state variables */
  182|  11.5k|  entropy->bitstate.bits_left = 0;
  183|  11.5k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  184|  11.5k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  11.5k|#define FALSE   0               /* values of boolean */
  ------------------
  185|       |
  186|       |  /* Initialize private state variables */
  187|  11.5k|  entropy->saved.EOBRUN = 0;
  188|       |
  189|       |  /* Initialize restart counter */
  190|  11.5k|  entropy->restarts_to_go = cinfo->restart_interval;
  191|  11.5k|}
jdphuff.c:decode_mcu_DC_first:
  291|  2.33M|{
  292|  2.33M|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  293|  2.33M|  int Al = cinfo->Al;
  294|  2.33M|  register int s, r;
  295|  2.33M|  int blkn, ci;
  296|  2.33M|  JBLOCKROW block;
  297|  2.33M|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  2.33M|  register bit_buf_type get_buffer; \
  |  |  126|  2.33M|  register int bits_left; \
  |  |  127|  2.33M|  bitread_working_state br_state
  ------------------
  298|  2.33M|  savable_state state;
  299|  2.33M|  d_derived_tbl *tbl;
  300|  2.33M|  jpeg_component_info *compptr;
  301|       |
  302|       |  /* Process restart marker if needed; may have to suspend */
  303|  2.33M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (303:7): [True: 8.95k, False: 2.32M]
  ------------------
  304|  8.95k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (304:9): [True: 5.64k, False: 3.31k]
  ------------------
  305|  5.64k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (305:11): [True: 0, False: 5.64k]
  ------------------
  306|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  307|  8.95k|  }
  308|       |
  309|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  310|       |   * This way, we return uniform gray for the remainder of the segment.
  311|       |   */
  312|  2.33M|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (312:7): [True: 11.3k, False: 2.31M]
  ------------------
  313|       |
  314|       |    /* Load up working state */
  315|  11.3k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  11.3k|  br_state.cinfo = cinfop; \
  |  |  131|  11.3k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  11.3k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  11.3k|  get_buffer = permstate.get_buffer; \
  |  |  134|  11.3k|  bits_left = permstate.bits_left;
  ------------------
  316|  11.3k|    state = entropy->saved;
  317|       |
  318|       |    /* Outer loop handles each block in the MCU */
  319|       |
  320|  48.0k|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (320:20): [True: 36.6k, False: 11.3k]
  ------------------
  321|  36.6k|      block = MCU_data[blkn];
  322|  36.6k|      ci = cinfo->MCU_membership[blkn];
  323|  36.6k|      compptr = cinfo->cur_comp_info[ci];
  324|  36.6k|      tbl = entropy->derived_tbls[compptr->dc_tbl_no];
  325|       |
  326|       |      /* Decode a single block's worth of coefficients */
  327|       |
  328|       |      /* Section F.2.2.1: decode the DC coefficient difference */
  329|  36.6k|      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
  ------------------
  |  |  200|  36.6k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  36.6k|  register int nb, look; \
  |  |  202|  36.6k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  36.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 4.17k, False: 32.5k]
  |  |  ------------------
  |  |  203|  4.17k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 4.17k]
  |  |  ------------------
  |  |  204|  4.17k|      { failaction; } \
  |  |  205|  4.17k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  4.17k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  4.17k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 493, False: 3.68k]
  |  |  ------------------
  |  |  207|    493|      nb = 1;  goto slowlabel; \
  |  |  208|    493|    } \
  |  |  209|  4.17k|  } \
  |  |  210|  36.6k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  36.1k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  36.1k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  36.1k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  36.1k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 31.7k, False: 4.46k]
  |  |  ------------------
  |  |  212|  31.7k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  31.7k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  31.7k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  31.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  31.7k|  } else { \
  |  |  215|  4.95k|slowlabel: \
  |  |  216|  4.95k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 4.95k]
  |  |  ------------------
  |  |  217|  4.95k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  4.95k|      { failaction; } \
  |  |  219|  4.95k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  4.95k|  } \
  |  |  221|  36.1k|}
  ------------------
  330|  36.6k|      if (s) {
  ------------------
  |  Branch (330:11): [True: 7.11k, False: 29.5k]
  ------------------
  331|  7.11k|        CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  7.11k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  7.11k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 352, False: 6.76k]
  |  |  ------------------
  |  |  162|    352|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 352]
  |  |  ------------------
  |  |  163|    352|      { action; } \
  |  |  164|    352|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    352|  } \
  |  |  166|  7.11k|}
  ------------------
  332|  7.11k|        r = GET_BITS(s);
  ------------------
  |  |  169|  7.11k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  333|  7.11k|        s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|  7.11k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|  4.29k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 4.29k, False: 2.82k]
  |  |  ------------------
  ------------------
  334|  7.11k|      }
  335|       |
  336|       |      /* Convert DC difference to actual value, update last_dc_val */
  337|  36.6k|      if ((state.last_dc_val[ci] >= 0 &&
  ------------------
  |  Branch (337:12): [True: 27.2k, False: 9.45k]
  ------------------
  338|  27.2k|           s > INT_MAX - state.last_dc_val[ci]) ||
  ------------------
  |  Branch (338:12): [True: 0, False: 27.2k]
  ------------------
  339|  36.6k|          (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
  ------------------
  |  Branch (339:12): [True: 9.45k, False: 27.2k]
  |  Branch (339:41): [True: 0, False: 9.45k]
  ------------------
  340|      0|        ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  341|  36.6k|      s += state.last_dc_val[ci];
  342|  36.6k|      state.last_dc_val[ci] = s;
  343|       |      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
  344|  36.6k|      (*block)[0] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|  36.6k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  345|  36.6k|    }
  346|       |
  347|       |    /* Completed MCU, so update state */
  348|  11.3k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  11.3k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  11.3k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  11.3k|  permstate.get_buffer = get_buffer; \
  |  |  140|  11.3k|  permstate.bits_left = bits_left
  ------------------
  349|  11.3k|    entropy->saved = state;
  350|  11.3k|  }
  351|       |
  352|       |  /* Account for restart interval (no-op if not using restarts) */
  353|  2.33M|  if (cinfo->restart_interval)
  ------------------
  |  Branch (353:7): [True: 8.95k, False: 2.32M]
  ------------------
  354|  8.95k|    entropy->restarts_to_go--;
  355|       |
  356|  2.33M|  return TRUE;
  ------------------
  |  |  210|  2.33M|#define TRUE    1
  ------------------
  357|  2.33M|}
jdphuff.c:process_restart:
  233|  14.5k|{
  234|  14.5k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  235|  14.5k|  int ci;
  236|       |
  237|       |  /* Throw away any unused bits remaining in bit buffer; */
  238|       |  /* include any full bytes in next_marker's count of discarded bytes */
  239|  14.5k|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  240|  14.5k|  entropy->bitstate.bits_left = 0;
  241|       |
  242|       |  /* Advance past the RSTn marker */
  243|  14.5k|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (243:7): [True: 0, False: 14.5k]
  ------------------
  244|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  245|       |
  246|       |  /* Re-initialize DC predictions to 0 */
  247|  38.1k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (247:16): [True: 23.5k, False: 14.5k]
  ------------------
  248|  23.5k|    entropy->saved.last_dc_val[ci] = 0;
  249|       |  /* Re-init EOB run count, too */
  250|  14.5k|  entropy->saved.EOBRUN = 0;
  251|       |
  252|       |  /* Reset restart counter */
  253|  14.5k|  entropy->restarts_to_go = cinfo->restart_interval;
  254|       |
  255|       |  /* Reset out-of-data flag, unless read_restart_marker left us smack up
  256|       |   * against a marker.  In that case we will end up treating the next data
  257|       |   * segment as empty, and we can avoid producing bogus output pixels by
  258|       |   * leaving the flag set.
  259|       |   */
  260|  14.5k|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (260:7): [True: 687, False: 13.8k]
  ------------------
  261|    687|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|    687|#define FALSE   0               /* values of boolean */
  ------------------
  262|       |
  263|  14.5k|  return TRUE;
  ------------------
  |  |  210|  14.5k|#define TRUE    1
  ------------------
  264|  14.5k|}
jdphuff.c:decode_mcu_AC_first:
  367|   851k|{
  368|   851k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  369|   851k|  int Se = cinfo->Se;
  370|   851k|  int Al = cinfo->Al;
  371|   851k|  register int s, k, r;
  372|   851k|  unsigned int EOBRUN;
  373|   851k|  JBLOCKROW block;
  374|   851k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   851k|  register bit_buf_type get_buffer; \
  |  |  126|   851k|  register int bits_left; \
  |  |  127|   851k|  bitread_working_state br_state
  ------------------
  375|   851k|  d_derived_tbl *tbl;
  376|       |
  377|       |  /* Process restart marker if needed; may have to suspend */
  378|   851k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (378:7): [True: 90.0k, False: 761k]
  ------------------
  379|  90.0k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (379:9): [True: 2.99k, False: 87.1k]
  ------------------
  380|  2.99k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (380:11): [True: 0, False: 2.99k]
  ------------------
  381|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  382|  90.0k|  }
  383|       |
  384|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  385|       |   * This way, we return uniform gray for the remainder of the segment.
  386|       |   */
  387|   851k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (387:7): [True: 27.9k, False: 823k]
  ------------------
  388|       |
  389|       |    /* Load up working state.
  390|       |     * We can avoid loading/saving bitread state if in an EOB run.
  391|       |     */
  392|  27.9k|    EOBRUN = entropy->saved.EOBRUN;     /* only part of saved state we need */
  393|       |
  394|       |    /* There is always only one block per MCU */
  395|       |
  396|  27.9k|    if (EOBRUN > 0)             /* if it's a band of zeroes... */
  ------------------
  |  Branch (396:9): [True: 19.2k, False: 8.65k]
  ------------------
  397|  19.2k|      EOBRUN--;                 /* ...process it now (we do nothing) */
  398|  8.65k|    else {
  399|  8.65k|      BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  8.65k|  br_state.cinfo = cinfop; \
  |  |  131|  8.65k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  8.65k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  8.65k|  get_buffer = permstate.get_buffer; \
  |  |  134|  8.65k|  bits_left = permstate.bits_left;
  ------------------
  400|  8.65k|      block = MCU_data[0];
  401|  8.65k|      tbl = entropy->ac_derived_tbl;
  402|       |
  403|  68.0k|      for (k = cinfo->Ss; k <= Se; k++) {
  ------------------
  |  Branch (403:27): [True: 64.4k, False: 3.53k]
  ------------------
  404|  64.4k|        HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
  ------------------
  |  |  200|  64.4k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  64.4k|  register int nb, look; \
  |  |  202|  64.4k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  64.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 8.55k, False: 55.9k]
  |  |  ------------------
  |  |  203|  8.55k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 8.55k]
  |  |  ------------------
  |  |  204|  8.55k|      { failaction; } \
  |  |  205|  8.55k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  8.55k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  8.55k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 3.53k, False: 5.02k]
  |  |  ------------------
  |  |  207|  3.53k|      nb = 1;  goto slowlabel; \
  |  |  208|  3.53k|    } \
  |  |  209|  8.55k|  } \
  |  |  210|  64.4k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  60.9k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  60.9k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  60.9k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  60.9k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 57.7k, False: 3.17k]
  |  |  ------------------
  |  |  212|  57.7k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  57.7k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  57.7k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  57.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  57.7k|  } else { \
  |  |  215|  6.70k|slowlabel: \
  |  |  216|  6.70k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 6.70k]
  |  |  ------------------
  |  |  217|  6.70k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  6.70k|      { failaction; } \
  |  |  219|  6.70k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  6.70k|  } \
  |  |  221|  60.9k|}
  ------------------
  405|  64.4k|        r = s >> 4;
  406|  64.4k|        s &= 15;
  407|  64.4k|        if (s) {
  ------------------
  |  Branch (407:13): [True: 59.0k, False: 5.40k]
  ------------------
  408|  59.0k|          k += r;
  409|  59.0k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  59.0k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  59.0k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 8.78k, False: 50.3k]
  |  |  ------------------
  |  |  162|  8.78k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 8.78k]
  |  |  ------------------
  |  |  163|  8.78k|      { action; } \
  |  |  164|  8.78k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  8.78k|  } \
  |  |  166|  59.0k|}
  ------------------
  410|  59.0k|          r = GET_BITS(s);
  ------------------
  |  |  169|  59.0k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  411|  59.0k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|  59.0k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|  54.1k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 54.1k, False: 4.98k]
  |  |  ------------------
  ------------------
  412|       |          /* Scale and output coefficient in natural (dezigzagged) order */
  413|  59.0k|          (*block)[jpeg_natural_order[k]] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|  59.0k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  414|  59.0k|        } else {
  415|  5.40k|          if (r == 15) {        /* ZRL */
  ------------------
  |  Branch (415:15): [True: 285, False: 5.11k]
  ------------------
  416|    285|            k += 15;            /* skip 15 zeroes in band */
  417|  5.11k|          } else {              /* EOBr, run length is 2^r + appended bits */
  418|  5.11k|            EOBRUN = 1 << r;
  419|  5.11k|            if (r) {            /* EOBr, r > 0 */
  ------------------
  |  Branch (419:17): [True: 987, False: 4.12k]
  ------------------
  420|    987|              CHECK_BIT_BUFFER(br_state, r, return FALSE);
  ------------------
  |  |  160|    987|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|    987|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 226, False: 761]
  |  |  ------------------
  |  |  162|    226|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 226]
  |  |  ------------------
  |  |  163|    226|      { action; } \
  |  |  164|    226|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    226|  } \
  |  |  166|    987|}
  ------------------
  421|    987|              r = GET_BITS(r);
  ------------------
  |  |  169|    987|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  422|    987|              EOBRUN += r;
  423|    987|            }
  424|  5.11k|            EOBRUN--;           /* this band is processed at this moment */
  425|  5.11k|            break;              /* force end-of-band */
  426|  5.11k|          }
  427|  5.40k|        }
  428|  64.4k|      }
  429|       |
  430|  8.65k|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  8.65k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  8.65k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  8.65k|  permstate.get_buffer = get_buffer; \
  |  |  140|  8.65k|  permstate.bits_left = bits_left
  ------------------
  431|  8.65k|    }
  432|       |
  433|       |    /* Completed MCU, so update state */
  434|  27.9k|    entropy->saved.EOBRUN = EOBRUN;     /* only part of saved state we need */
  435|  27.9k|  }
  436|       |
  437|       |  /* Account for restart interval (no-op if not using restarts) */
  438|   851k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (438:7): [True: 90.0k, False: 761k]
  ------------------
  439|  90.0k|    entropy->restarts_to_go--;
  440|       |
  441|   851k|  return TRUE;
  ------------------
  |  |  210|   851k|#define TRUE    1
  ------------------
  442|   851k|}
jdphuff.c:decode_mcu_DC_refine:
  453|  83.6k|{
  454|  83.6k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  455|  83.6k|  int p1 = 1 << cinfo->Al;      /* 1 in the bit position being coded */
  456|  83.6k|  int blkn;
  457|  83.6k|  JBLOCKROW block;
  458|  83.6k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  83.6k|  register bit_buf_type get_buffer; \
  |  |  126|  83.6k|  register int bits_left; \
  |  |  127|  83.6k|  bitread_working_state br_state
  ------------------
  459|       |
  460|       |  /* Process restart marker if needed; may have to suspend */
  461|  83.6k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (461:7): [True: 5.87k, False: 77.7k]
  ------------------
  462|  5.87k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (462:9): [True: 2.60k, False: 3.27k]
  ------------------
  463|  2.60k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (463:11): [True: 0, False: 2.60k]
  ------------------
  464|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  465|  5.87k|  }
  466|       |
  467|       |  /* Not worth the cycles to check insufficient_data here,
  468|       |   * since we will not change the data anyway if we read zeroes.
  469|       |   */
  470|       |
  471|       |  /* Load up working state */
  472|  83.6k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  83.6k|  br_state.cinfo = cinfop; \
  |  |  131|  83.6k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  83.6k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  83.6k|  get_buffer = permstate.get_buffer; \
  |  |  134|  83.6k|  bits_left = permstate.bits_left;
  ------------------
  473|       |
  474|       |  /* Outer loop handles each block in the MCU */
  475|       |
  476|   172k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (476:18): [True: 89.0k, False: 83.6k]
  ------------------
  477|  89.0k|    block = MCU_data[blkn];
  478|       |
  479|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  480|  89.0k|    CHECK_BIT_BUFFER(br_state, 1, return FALSE);
  ------------------
  |  |  160|  89.0k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  89.0k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 6.35k, False: 82.6k]
  |  |  ------------------
  |  |  162|  6.35k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 6.35k]
  |  |  ------------------
  |  |  163|  6.35k|      { action; } \
  |  |  164|  6.35k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  6.35k|  } \
  |  |  166|  89.0k|}
  ------------------
  481|  89.0k|    if (GET_BITS(1))
  ------------------
  |  |  169|  89.0k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 42.1k, False: 46.8k]
  |  |  ------------------
  ------------------
  482|  42.1k|      (*block)[0] |= p1;
  483|       |    /* Note: since we use |=, repeating the assignment later is safe */
  484|  89.0k|  }
  485|       |
  486|       |  /* Completed MCU, so update state */
  487|  83.6k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  83.6k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  83.6k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  83.6k|  permstate.get_buffer = get_buffer; \
  |  |  140|  83.6k|  permstate.bits_left = bits_left
  ------------------
  488|       |
  489|       |  /* Account for restart interval (no-op if not using restarts) */
  490|  83.6k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (490:7): [True: 5.87k, False: 77.7k]
  ------------------
  491|  5.87k|    entropy->restarts_to_go--;
  492|       |
  493|  83.6k|  return TRUE;
  ------------------
  |  |  210|  83.6k|#define TRUE    1
  ------------------
  494|  83.6k|}
jdphuff.c:decode_mcu_AC_refine:
  503|   521k|{
  504|   521k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  505|   521k|  int Se = cinfo->Se;
  506|   521k|  int p1 = 1 << cinfo->Al;        /* 1 in the bit position being coded */
  507|   521k|  int m1 = (NEG_1) << cinfo->Al;  /* -1 in the bit position being coded */
  ------------------
  |  |  202|   521k|#define NEG_1  ((unsigned)-1)
  ------------------
  508|   521k|  register int s, k, r;
  509|   521k|  unsigned int EOBRUN;
  510|   521k|  JBLOCKROW block;
  511|   521k|  JCOEFPTR thiscoef;
  512|   521k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   521k|  register bit_buf_type get_buffer; \
  |  |  126|   521k|  register int bits_left; \
  |  |  127|   521k|  bitread_working_state br_state
  ------------------
  513|   521k|  d_derived_tbl *tbl;
  514|   521k|  int num_newnz;
  515|   521k|  int newnz_pos[DCTSIZE2];
  516|       |
  517|       |  /* Process restart marker if needed; may have to suspend */
  518|   521k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (518:7): [True: 242k, False: 279k]
  ------------------
  519|   242k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (519:9): [True: 3.35k, False: 239k]
  ------------------
  520|  3.35k|      if (!process_restart(cinfo))
  ------------------
  |  Branch (520:11): [True: 0, False: 3.35k]
  ------------------
  521|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  522|   242k|  }
  523|       |
  524|       |  /* If we've run out of data, don't modify the MCU.
  525|       |   */
  526|   521k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (526:7): [True: 56.7k, False: 464k]
  ------------------
  527|       |
  528|       |    /* Load up working state */
  529|  56.7k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  56.7k|  br_state.cinfo = cinfop; \
  |  |  131|  56.7k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  56.7k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  56.7k|  get_buffer = permstate.get_buffer; \
  |  |  134|  56.7k|  bits_left = permstate.bits_left;
  ------------------
  530|  56.7k|    EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
  531|       |
  532|       |    /* There is always only one block per MCU */
  533|  56.7k|    block = MCU_data[0];
  534|  56.7k|    tbl = entropy->ac_derived_tbl;
  535|       |
  536|       |    /* If we are forced to suspend, we must undo the assignments to any newly
  537|       |     * nonzero coefficients in the block, because otherwise we'd get confused
  538|       |     * next time about which coefficients were already nonzero.
  539|       |     * But we need not undo addition of bits to already-nonzero coefficients;
  540|       |     * instead, we can test the current bit to see if we already did it.
  541|       |     */
  542|  56.7k|    num_newnz = 0;
  543|       |
  544|       |    /* initialize coefficient loop counter to start of band */
  545|  56.7k|    k = cinfo->Ss;
  546|       |
  547|  56.7k|    if (EOBRUN == 0) {
  ------------------
  |  Branch (547:9): [True: 12.0k, False: 44.7k]
  ------------------
  548|  70.4k|      for (; k <= Se; k++) {
  ------------------
  |  Branch (548:14): [True: 67.1k, False: 3.33k]
  ------------------
  549|  67.1k|        HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
  ------------------
  |  |  200|  67.1k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  67.1k|  register int nb, look; \
  |  |  202|  67.1k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  67.1k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 9.32k, False: 57.8k]
  |  |  ------------------
  |  |  203|  9.32k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 9.32k]
  |  |  ------------------
  |  |  204|  9.32k|      { failaction; } \
  |  |  205|  9.32k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  9.32k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  9.32k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 4.81k, False: 4.51k]
  |  |  ------------------
  |  |  207|  4.81k|      nb = 1;  goto slowlabel; \
  |  |  208|  4.81k|    } \
  |  |  209|  9.32k|  } \
  |  |  210|  67.1k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  62.3k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  62.3k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  62.3k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  62.3k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 59.1k, False: 3.16k]
  |  |  ------------------
  |  |  212|  59.1k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  59.1k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  59.1k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  59.1k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  59.1k|  } else { \
  |  |  215|  7.97k|slowlabel: \
  |  |  216|  7.97k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 7.97k]
  |  |  ------------------
  |  |  217|  7.97k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  7.97k|      { failaction; } \
  |  |  219|  7.97k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  7.97k|  } \
  |  |  221|  62.3k|}
  ------------------
  550|  67.1k|        r = s >> 4;
  551|  67.1k|        s &= 15;
  552|  67.1k|        if (s) {
  ------------------
  |  Branch (552:13): [True: 58.3k, False: 8.82k]
  ------------------
  553|  58.3k|          if (s != 1)           /* size of new coef should always be 1 */
  ------------------
  |  Branch (553:15): [True: 51.1k, False: 7.15k]
  ------------------
  554|  51.1k|            WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|  51.1k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  51.1k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  555|  58.3k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|  58.3k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  58.3k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 576, False: 57.7k]
  |  |  ------------------
  |  |  162|    576|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 576]
  |  |  ------------------
  |  |  163|    576|      { action; } \
  |  |  164|    576|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    576|  } \
  |  |  166|  58.3k|}
  ------------------
  556|  58.3k|          if (GET_BITS(1))
  ------------------
  |  |  169|  58.3k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 8.48k, False: 49.8k]
  |  |  ------------------
  ------------------
  557|  8.48k|            s = p1;             /* newly nonzero coef is positive */
  558|  49.8k|          else
  559|  49.8k|            s = m1;             /* newly nonzero coef is negative */
  560|  58.3k|        } else {
  561|  8.82k|          if (r != 15) {
  ------------------
  |  Branch (561:15): [True: 8.69k, False: 129]
  ------------------
  562|  8.69k|            EOBRUN = 1 << r;    /* EOBr, run length is 2^r + appended bits */
  563|  8.69k|            if (r) {
  ------------------
  |  Branch (563:17): [True: 2.90k, False: 5.79k]
  ------------------
  564|  2.90k|              CHECK_BIT_BUFFER(br_state, r, goto undoit);
  ------------------
  |  |  160|  2.90k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  2.90k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 375, False: 2.52k]
  |  |  ------------------
  |  |  162|    375|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 375]
  |  |  ------------------
  |  |  163|    375|      { action; } \
  |  |  164|    375|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    375|  } \
  |  |  166|  2.90k|}
  ------------------
  565|  2.90k|              r = GET_BITS(r);
  ------------------
  |  |  169|  2.90k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  566|  2.90k|              EOBRUN += r;
  567|  2.90k|            }
  568|  8.69k|            break;              /* rest of block is handled by EOB logic */
  569|  8.69k|          }
  570|       |          /* note s = 0 for processing ZRL */
  571|  8.82k|        }
  572|       |        /* Advance over already-nonzero coefs and r still-zero coefs,
  573|       |         * appending correction bits to the nonzeroes.  A correction bit is 1
  574|       |         * if the absolute value of the coefficient must be increased.
  575|       |         */
  576|   124k|        do {
  577|   124k|          thiscoef = *block + jpeg_natural_order[k];
  578|   124k|          if (*thiscoef != 0) {
  ------------------
  |  Branch (578:15): [True: 9.26k, False: 115k]
  ------------------
  579|  9.26k|            CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|  9.26k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  9.26k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 298, False: 8.96k]
  |  |  ------------------
  |  |  162|    298|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 298]
  |  |  ------------------
  |  |  163|    298|      { action; } \
  |  |  164|    298|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    298|  } \
  |  |  166|  9.26k|}
  ------------------
  580|  9.26k|            if (GET_BITS(1)) {
  ------------------
  |  |  169|  9.26k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 2.19k, False: 7.06k]
  |  |  ------------------
  ------------------
  581|  2.19k|              if ((*thiscoef & p1) == 0) { /* do nothing if already set it */
  ------------------
  |  Branch (581:19): [True: 1.09k, False: 1.10k]
  ------------------
  582|  1.09k|                if (*thiscoef >= 0)
  ------------------
  |  Branch (582:21): [True: 362, False: 730]
  ------------------
  583|    362|                  *thiscoef += (JCOEF)p1;
  584|    730|                else
  585|    730|                  *thiscoef += (JCOEF)m1;
  586|  1.09k|              }
  587|  2.19k|            }
  588|   115k|          } else {
  589|   115k|            if (--r < 0)
  ------------------
  |  Branch (589:17): [True: 56.8k, False: 58.3k]
  ------------------
  590|  56.8k|              break;            /* reached target zero coefficient */
  591|   115k|          }
  592|  67.5k|          k++;
  593|  67.5k|        } while (k <= Se);
  ------------------
  |  Branch (593:18): [True: 66.0k, False: 1.56k]
  ------------------
  594|  58.4k|        if (s) {
  ------------------
  |  Branch (594:13): [True: 58.3k, False: 129]
  ------------------
  595|  58.3k|          int pos = jpeg_natural_order[k];
  596|       |          /* Output newly nonzero coefficient */
  597|  58.3k|          (*block)[pos] = (JCOEF)s;
  598|       |          /* Remember its position in case we have to suspend */
  599|  58.3k|          newnz_pos[num_newnz++] = pos;
  600|  58.3k|        }
  601|  58.4k|      }
  602|  12.0k|    }
  603|       |
  604|  56.7k|    if (EOBRUN > 0) {
  ------------------
  |  Branch (604:9): [True: 53.4k, False: 3.33k]
  ------------------
  605|       |      /* Scan any remaining coefficient positions after the end-of-band
  606|       |       * (the last newly nonzero coefficient, if any).  Append a correction
  607|       |       * bit to each already-nonzero coefficient.  A correction bit is 1
  608|       |       * if the absolute value of the coefficient must be increased.
  609|       |       */
  610|  1.47M|      for (; k <= Se; k++) {
  ------------------
  |  Branch (610:14): [True: 1.41M, False: 53.4k]
  ------------------
  611|  1.41M|        thiscoef = *block + jpeg_natural_order[k];
  612|  1.41M|        if (*thiscoef != 0) {
  ------------------
  |  Branch (612:13): [True: 13.4k, False: 1.40M]
  ------------------
  613|  13.4k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|  13.4k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  13.4k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 241, False: 13.2k]
  |  |  ------------------
  |  |  162|    241|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 241]
  |  |  ------------------
  |  |  163|    241|      { action; } \
  |  |  164|    241|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    241|  } \
  |  |  166|  13.4k|}
  ------------------
  614|  13.4k|          if (GET_BITS(1)) {
  ------------------
  |  |  169|  13.4k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 3.27k, False: 10.1k]
  |  |  ------------------
  ------------------
  615|  3.27k|            if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */
  ------------------
  |  Branch (615:17): [True: 2.94k, False: 334]
  ------------------
  616|  2.94k|              if (*thiscoef >= 0)
  ------------------
  |  Branch (616:19): [True: 1.91k, False: 1.02k]
  ------------------
  617|  1.91k|                *thiscoef += (JCOEF)p1;
  618|  1.02k|              else
  619|  1.02k|                *thiscoef += (JCOEF)m1;
  620|  2.94k|            }
  621|  3.27k|          }
  622|  13.4k|        }
  623|  1.41M|      }
  624|       |      /* Count one block completed in EOB run */
  625|  53.4k|      EOBRUN--;
  626|  53.4k|    }
  627|       |
  628|       |    /* Completed MCU, so update state */
  629|  56.7k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  56.7k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  56.7k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  56.7k|  permstate.get_buffer = get_buffer; \
  |  |  140|  56.7k|  permstate.bits_left = bits_left
  ------------------
  630|  56.7k|    entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
  631|  56.7k|  }
  632|       |
  633|       |  /* Account for restart interval (no-op if not using restarts) */
  634|   521k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (634:7): [True: 242k, False: 279k]
  ------------------
  635|   242k|    entropy->restarts_to_go--;
  636|       |
  637|   521k|  return TRUE;
  ------------------
  |  |  210|   521k|#define TRUE    1
  ------------------
  638|       |
  639|      0|undoit:
  640|       |  /* Re-zero any output coefficients that we made newly nonzero */
  641|      0|  while (num_newnz > 0)
  ------------------
  |  Branch (641:10): [True: 0, False: 0]
  ------------------
  642|      0|    (*block)[newnz_pos[--num_newnz]] = 0;
  643|       |
  644|      0|  return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  645|   521k|}

jinit_d_post_controller:
  267|  72.9k|{
  268|  72.9k|  my_post_ptr post;
  269|       |
  270|  72.9k|#ifdef D_LOSSLESS_SUPPORTED
  271|  72.9k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 3.42k, False: 69.5k]
  ------------------
  272|  3.42k|#if BITS_IN_JSAMPLE == 8
  273|  3.42k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  6.85k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (273:9): [True: 0, False: 3.42k]
  |  Branch (273:52): [True: 0, False: 3.42k]
  ------------------
  274|       |#else
  275|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  276|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  277|       |#endif
  278|      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)))
  ------------------
  279|  3.42k|  } else
  280|  69.5k|#endif
  281|  69.5k|  {
  282|  69.5k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  69.5k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (282:9): [True: 0, False: 69.5k]
  ------------------
  283|      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)))
  ------------------
  284|  69.5k|  }
  285|       |
  286|  72.9k|  post = (my_post_ptr)
  287|  72.9k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  72.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|  72.9k|                                sizeof(my_post_controller));
  289|  72.9k|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|  72.9k|  post->pub.start_pass = start_pass_dpost;
  291|  72.9k|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|  72.9k|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|  72.9k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 72.9k]
  ------------------
  296|      0|#if BITS_IN_JSAMPLE != 16
  297|       |    /* The buffer strip height is max_v_samp_factor, which is typically
  298|       |     * an efficient number of rows for upsampling to return.
  299|       |     * (In the presence of output rescaling, we might want to be smarter?)
  300|       |     */
  301|      0|    post->strip_height = (JDIMENSION)cinfo->max_v_samp_factor;
  302|      0|    if (need_full_buffer) {
  ------------------
  |  Branch (302:9): [True: 0, False: 0]
  ------------------
  303|       |      /* Two-pass color quantization: need full-image storage. */
  304|       |      /* We round up the number of rows to a multiple of the strip height. */
  305|      0|#ifdef QUANT_2PASS_SUPPORTED
  306|      0|      post->whole_image = (*cinfo->mem->request_virt_sarray)
  307|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  308|      0|         cinfo->output_width * cinfo->out_color_components,
  309|      0|         (JDIMENSION)jround_up((long)cinfo->output_height,
  310|      0|                               (long)post->strip_height),
  311|      0|         post->strip_height);
  312|       |#else
  313|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  314|       |#endif /* QUANT_2PASS_SUPPORTED */
  315|      0|    } else {
  316|       |      /* One-pass color quantization: just make a strip buffer. */
  317|      0|      post->buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  318|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  319|      0|         cinfo->output_width * cinfo->out_color_components,
  320|      0|         post->strip_height);
  321|      0|    }
  322|       |#else
  323|       |    ERREXIT(cinfo, JERR_NOTIMPL);
  324|       |#endif
  325|      0|  }
  326|  72.9k|}
jdpostct-8.c:start_pass_dpost:
   85|  63.5k|{
   86|  63.5k|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|  63.5k|  switch (pass_mode) {
   89|  63.5k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 63.5k, False: 0]
  ------------------
   90|  63.5k|#if BITS_IN_JSAMPLE != 16
   91|  63.5k|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 63.5k]
  ------------------
   92|       |      /* Single-pass processing with color quantization. */
   93|      0|      post->pub._post_process_data = post_process_1pass;
  ------------------
  |  |  260|      0|#define _post_process_data  post_process_data
  ------------------
   94|       |      /* We could be doing buffered-image output before starting a 2-pass
   95|       |       * color quantization; in that case, jinit_d_post_controller did not
   96|       |       * allocate a strip buffer.  Use the virtual-array buffer as workspace.
   97|       |       */
   98|      0|      if (post->buffer == NULL) {
  ------------------
  |  Branch (98:11): [True: 0, False: 0]
  ------------------
   99|      0|        post->buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  100|      0|          ((j_common_ptr)cinfo, post->whole_image,
  101|      0|           (JDIMENSION)0, post->strip_height, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  102|      0|      }
  103|      0|    } else
  104|  63.5k|#endif
  105|  63.5k|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|  63.5k|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  260|  63.5k|#define _post_process_data  post_process_data
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  265|  63.5k|#define _upsample  upsample
  ------------------
  110|  63.5k|    }
  111|  63.5k|    break;
  112|      0|#if defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16
  113|      0|  case JBUF_SAVE_AND_PASS:
  ------------------
  |  Branch (113:3): [True: 0, False: 63.5k]
  ------------------
  114|       |    /* First pass of 2-pass quantization */
  115|      0|    if (post->whole_image == NULL)
  ------------------
  |  Branch (115:9): [True: 0, False: 0]
  ------------------
  116|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  117|      0|    post->pub._post_process_data = post_process_prepass;
  ------------------
  |  |  260|      0|#define _post_process_data  post_process_data
  ------------------
  118|      0|    break;
  119|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (119:3): [True: 0, False: 63.5k]
  ------------------
  120|       |    /* Second pass of 2-pass quantization */
  121|      0|    if (post->whole_image == NULL)
  ------------------
  |  Branch (121:9): [True: 0, False: 0]
  ------------------
  122|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  123|      0|    post->pub._post_process_data = post_process_2pass;
  ------------------
  |  |  260|      0|#define _post_process_data  post_process_data
  ------------------
  124|      0|    break;
  125|      0|#endif /* defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16 */
  126|      0|  default:
  ------------------
  |  Branch (126:3): [True: 0, False: 63.5k]
  ------------------
  127|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  128|      0|    break;
  129|  63.5k|  }
  130|  63.5k|  post->starting_row = post->next_row = 0;
  131|  63.5k|}
j12init_d_post_controller:
  267|    797|{
  268|    797|  my_post_ptr post;
  269|       |
  270|    797|#ifdef D_LOSSLESS_SUPPORTED
  271|    797|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 311, False: 486]
  ------------------
  272|       |#if BITS_IN_JSAMPLE == 8
  273|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  274|       |#else
  275|    311|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    622|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (275:9): [True: 0, False: 311]
  ------------------
  276|    311|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    311|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (276:9): [True: 0, False: 311]
  ------------------
  277|      0|#endif
  278|      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)))
  ------------------
  279|    311|  } else
  280|    486|#endif
  281|    486|  {
  282|    486|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    486|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (282:9): [True: 0, False: 486]
  ------------------
  283|      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)))
  ------------------
  284|    486|  }
  285|       |
  286|    797|  post = (my_post_ptr)
  287|    797|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    797|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|    797|                                sizeof(my_post_controller));
  289|    797|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|    797|  post->pub.start_pass = start_pass_dpost;
  291|    797|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|    797|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|    797|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 797]
  ------------------
  296|      0|#if BITS_IN_JSAMPLE != 16
  297|       |    /* The buffer strip height is max_v_samp_factor, which is typically
  298|       |     * an efficient number of rows for upsampling to return.
  299|       |     * (In the presence of output rescaling, we might want to be smarter?)
  300|       |     */
  301|      0|    post->strip_height = (JDIMENSION)cinfo->max_v_samp_factor;
  302|      0|    if (need_full_buffer) {
  ------------------
  |  Branch (302:9): [True: 0, False: 0]
  ------------------
  303|       |      /* Two-pass color quantization: need full-image storage. */
  304|       |      /* We round up the number of rows to a multiple of the strip height. */
  305|      0|#ifdef QUANT_2PASS_SUPPORTED
  306|      0|      post->whole_image = (*cinfo->mem->request_virt_sarray)
  307|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  308|      0|         cinfo->output_width * cinfo->out_color_components,
  309|      0|         (JDIMENSION)jround_up((long)cinfo->output_height,
  310|      0|                               (long)post->strip_height),
  311|      0|         post->strip_height);
  312|       |#else
  313|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  314|       |#endif /* QUANT_2PASS_SUPPORTED */
  315|      0|    } else {
  316|       |      /* One-pass color quantization: just make a strip buffer. */
  317|      0|      post->buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  318|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  319|      0|         cinfo->output_width * cinfo->out_color_components,
  320|      0|         post->strip_height);
  321|      0|    }
  322|       |#else
  323|       |    ERREXIT(cinfo, JERR_NOTIMPL);
  324|       |#endif
  325|      0|  }
  326|    797|}
jdpostct-12.c:start_pass_dpost:
   85|    781|{
   86|    781|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|    781|  switch (pass_mode) {
   89|    781|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 781, False: 0]
  ------------------
   90|    781|#if BITS_IN_JSAMPLE != 16
   91|    781|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 781]
  ------------------
   92|       |      /* Single-pass processing with color quantization. */
   93|      0|      post->pub._post_process_data = post_process_1pass;
  ------------------
  |  |  144|      0|#define _post_process_data  post_process_data_12
  ------------------
   94|       |      /* We could be doing buffered-image output before starting a 2-pass
   95|       |       * color quantization; in that case, jinit_d_post_controller did not
   96|       |       * allocate a strip buffer.  Use the virtual-array buffer as workspace.
   97|       |       */
   98|      0|      if (post->buffer == NULL) {
  ------------------
  |  Branch (98:11): [True: 0, False: 0]
  ------------------
   99|      0|        post->buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  100|      0|          ((j_common_ptr)cinfo, post->whole_image,
  101|      0|           (JDIMENSION)0, post->strip_height, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  102|      0|      }
  103|      0|    } else
  104|    781|#endif
  105|    781|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|    781|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  144|    781|#define _post_process_data  post_process_data_12
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  149|    781|#define _upsample  upsample_12
  ------------------
  110|    781|    }
  111|    781|    break;
  112|      0|#if defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16
  113|      0|  case JBUF_SAVE_AND_PASS:
  ------------------
  |  Branch (113:3): [True: 0, False: 781]
  ------------------
  114|       |    /* First pass of 2-pass quantization */
  115|      0|    if (post->whole_image == NULL)
  ------------------
  |  Branch (115:9): [True: 0, False: 0]
  ------------------
  116|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  117|      0|    post->pub._post_process_data = post_process_prepass;
  ------------------
  |  |  144|      0|#define _post_process_data  post_process_data_12
  ------------------
  118|      0|    break;
  119|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (119:3): [True: 0, False: 781]
  ------------------
  120|       |    /* Second pass of 2-pass quantization */
  121|      0|    if (post->whole_image == NULL)
  ------------------
  |  Branch (121:9): [True: 0, False: 0]
  ------------------
  122|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  123|      0|    post->pub._post_process_data = post_process_2pass;
  ------------------
  |  |  144|      0|#define _post_process_data  post_process_data_12
  ------------------
  124|      0|    break;
  125|      0|#endif /* defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16 */
  126|      0|  default:
  ------------------
  |  Branch (126:3): [True: 0, False: 781]
  ------------------
  127|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  128|      0|    break;
  129|    781|  }
  130|    781|  post->starting_row = post->next_row = 0;
  131|    781|}

jinit_upsampler:
  438|  72.9k|{
  439|  72.9k|  my_upsample_ptr upsample;
  440|  72.9k|  int ci;
  441|  72.9k|  jpeg_component_info *compptr;
  442|  72.9k|  boolean need_buffer, do_fancy;
  443|  72.9k|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|  72.9k|#ifdef D_LOSSLESS_SUPPORTED
  446|  72.9k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 3.43k, False: 69.5k]
  ------------------
  447|  3.43k|#if BITS_IN_JSAMPLE == 8
  448|  3.43k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  6.86k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (448:9): [True: 0, False: 3.43k]
  |  Branch (448:52): [True: 0, False: 3.43k]
  ------------------
  449|       |#else
  450|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  451|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  452|       |#endif
  453|      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)))
  ------------------
  454|  3.43k|  } else
  455|  69.5k|#endif
  456|  69.5k|  {
  457|  69.5k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  69.5k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (457:9): [True: 0, False: 69.5k]
  ------------------
  458|      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)))
  ------------------
  459|  69.5k|  }
  460|       |
  461|  72.9k|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 72.9k, False: 0]
  ------------------
  462|  72.9k|    upsample = (my_upsample_ptr)
  463|  72.9k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  72.9k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|  72.9k|                                  sizeof(my_upsampler));
  465|  72.9k|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|  72.9k|    upsample->pub.start_pass = start_pass_upsample;
  467|  72.9k|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  265|  72.9k|#define _upsample  upsample
  ------------------
  468|  72.9k|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|  72.9k|#define FALSE   0               /* values of boolean */
  ------------------
  469|  72.9k|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|  72.9k|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 72.9k]
  ------------------
  473|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  474|       |
  475|       |  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
  476|       |   * so don't ask for it.
  477|       |   */
  478|  72.9k|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|  72.9k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 72.9k, False: 0]
  |  Branch (478:44): [True: 69.5k, False: 3.43k]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|   171k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 98.9k, False: 72.9k]
  ------------------
  484|  98.9k|       ci++, compptr++) {
  485|       |    /* Compute size of an "input group" after IDCT scaling.  This many samples
  486|       |     * are to be converted to max_h_samp_factor * max_v_samp_factor components.
  487|       |     */
  488|  98.9k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  98.9k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|  98.9k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  98.9k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|  98.9k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  98.9k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|  98.9k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  98.9k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|  98.9k|    h_out_group = cinfo->max_h_samp_factor;
  493|  98.9k|    v_out_group = cinfo->max_v_samp_factor;
  494|  98.9k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|  98.9k|    need_buffer = TRUE;
  ------------------
  |  |  210|  98.9k|#define TRUE    1
  ------------------
  496|  98.9k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 98.9k]
  ------------------
  497|       |      /* Don't bother to upsample an uninteresting component. */
  498|      0|      upsample->methods[ci] = noop_upsample;
  499|      0|      need_buffer = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  500|  98.9k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 76.8k, False: 22.0k]
  |  Branch (500:45): [True: 73.4k, False: 3.38k]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|  73.4k|      upsample->methods[ci] = fullsize_upsample;
  503|  73.4k|      need_buffer = FALSE;
  ------------------
  |  |  207|  73.4k|#define FALSE   0               /* values of boolean */
  ------------------
  504|  73.4k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 18.9k, False: 6.47k]
  |  Branch (504:49): [True: 7.86k, False: 11.0k]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|  7.86k|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 7.86k, False: 7]
  |  Branch (506:23): [True: 6.83k, False: 1.02k]
  ------------------
  507|  6.83k|#ifdef WITH_SIMD
  508|  6.83k|        if (jsimd_set_h2v1_fancy_upsample(cinfo))
  ------------------
  |  Branch (508:13): [True: 6.83k, False: 0]
  ------------------
  509|  6.83k|          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  510|      0|        else
  511|      0|#endif
  512|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|  6.83k|      } else {
  514|  1.02k|#ifdef WITH_SIMD
  515|  1.02k|        if (jsimd_set_h2v1_upsample(cinfo))
  ------------------
  |  Branch (515:13): [True: 1.02k, False: 0]
  ------------------
  516|  1.02k|          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|      0|        else
  518|      0|#endif
  519|      0|          upsample->methods[ci] = h2v1_upsample;
  520|  1.02k|      }
  521|  17.5k|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 3.38k, False: 14.1k]
  ------------------
  522|  3.38k|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 1.87k, False: 1.50k]
  |  Branch (522:49): [True: 1.87k, False: 7]
  ------------------
  523|       |      /* Non-fancy upsampling is handled by the generic method */
  524|       |#if defined(WITH_SIMD) && (SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM)
  525|       |      if (jsimd_set_h1v2_fancy_upsample(cinfo))
  526|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  527|       |      else
  528|       |#endif
  529|  1.87k|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|  1.87k|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|  1.87k|#define TRUE    1
  ------------------
  531|  15.6k|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 11.0k, False: 4.60k]
  ------------------
  532|  11.0k|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 10.2k, False: 872]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|  10.2k|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 10.2k, False: 4]
  |  Branch (534:23): [True: 8.64k, False: 1.55k]
  ------------------
  535|  8.64k|#ifdef WITH_SIMD
  536|  8.64k|        if (jsimd_set_h2v2_fancy_upsample(cinfo))
  ------------------
  |  Branch (536:13): [True: 8.64k, False: 0]
  ------------------
  537|  8.64k|          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  538|      0|        else
  539|      0|#endif
  540|      0|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|  8.64k|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|  8.64k|#define TRUE    1
  ------------------
  542|  8.64k|      } else {
  543|  1.56k|#ifdef WITH_SIMD
  544|  1.56k|        if (jsimd_set_h2v2_upsample(cinfo))
  ------------------
  |  Branch (544:13): [True: 1.56k, False: 0]
  ------------------
  545|  1.56k|          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|      0|        else
  547|      0|#endif
  548|      0|          upsample->methods[ci] = h2v2_upsample;
  549|  1.56k|      }
  550|  10.2k|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 5.47k, False: 3]
  ------------------
  551|  5.47k|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 5.47k, False: 1]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|  5.47k|      upsample->methods[ci] = int_upsample;
  554|  5.47k|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|  5.47k|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|  5.47k|    } else
  557|      4|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      4|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|  98.9k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 25.4k, False: 73.4k]
  |  Branch (558:24): [True: 25.4k, False: 0]
  ------------------
  559|  25.4k|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|  25.4k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  25.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|  25.4k|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|  25.4k|                               (long)cinfo->max_h_samp_factor),
  563|  25.4k|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|  25.4k|    }
  565|  98.9k|  }
  566|  72.9k|}
jdsample-8.c:start_pass_upsample:
   47|  63.5k|{
   48|  63.5k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|  63.5k|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|  63.5k|  upsample->rows_to_go = cinfo->output_height;
   54|  63.5k|}
jdsample-8.c:sep_upsample:
   70|  10.2M|{
   71|  10.2M|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   72|  10.2M|  int ci;
   73|  10.2M|  jpeg_component_info *compptr;
   74|  10.2M|  JDIMENSION num_rows;
   75|       |
   76|       |  /* Fill the conversion buffer, if it's empty */
   77|  10.2M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (77:7): [True: 10.0M, False: 255k]
  ------------------
   78|  20.7M|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (78:46): [True: 10.7M, False: 10.0M]
  ------------------
   79|  10.7M|         ci++, compptr++) {
   80|       |      /* Invoke per-component upsample method.  Notice we pass a POINTER
   81|       |       * to color_buf[ci], so that fullsize_upsample can change it.
   82|       |       */
   83|       |#ifdef WITH_PROFILE
   84|       |      cinfo->master->start = getTime();
   85|       |#endif
   86|  10.7M|      (*upsample->methods[ci]) (cinfo, compptr,
   87|  10.7M|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   88|  10.7M|        upsample->color_buf + ci);
   89|       |#ifdef WITH_PROFILE
   90|       |      cinfo->master->upsample_elapsed += getTime() - cinfo->master->start;
   91|       |      cinfo->master->upsample_msamples +=
   92|       |        (double)cinfo->output_width * cinfo->max_v_samp_factor / 1000000.;
   93|       |#endif
   94|  10.7M|    }
   95|  10.0M|    upsample->next_row_out = 0;
   96|  10.0M|  }
   97|       |
   98|       |  /* Color-convert and emit rows */
   99|       |
  100|       |  /* How many we have in the buffer: */
  101|  10.2M|  num_rows = (JDIMENSION)(cinfo->max_v_samp_factor - upsample->next_row_out);
  102|       |  /* Not more than the distance to the end of the image.  Need this test
  103|       |   * in case the image height is not a multiple of max_v_samp_factor:
  104|       |   */
  105|  10.2M|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (105:7): [True: 3.43k, False: 10.2M]
  ------------------
  106|  3.43k|    num_rows = upsample->rows_to_go;
  107|       |  /* And not more than what the client can accept: */
  108|  10.2M|  out_rows_avail -= *out_row_ctr;
  109|  10.2M|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (109:7): [True: 255k, False: 10.0M]
  ------------------
  110|   255k|    num_rows = out_rows_avail;
  111|       |
  112|       |#ifdef WITH_PROFILE
  113|       |  cinfo->master->start = getTime();
  114|       |#endif
  115|  10.2M|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  267|  10.2M|#define _color_convert  color_convert
  ------------------
  116|  10.2M|                                      (JDIMENSION)upsample->next_row_out,
  117|  10.2M|                                      output_buf + *out_row_ctr,
  118|  10.2M|                                      (int)num_rows);
  119|       |#ifdef WITH_PROFILE
  120|       |  cinfo->master->cconvert_elapsed += getTime() - cinfo->master->start;
  121|       |  cinfo->master->cconvert_mpixels +=
  122|       |    (double)cinfo->output_width * num_rows / 1000000.;
  123|       |#endif
  124|       |
  125|       |  /* Adjust counts */
  126|  10.2M|  *out_row_ctr += num_rows;
  127|  10.2M|  upsample->rows_to_go -= num_rows;
  128|  10.2M|  upsample->next_row_out += num_rows;
  129|       |  /* When the buffer is emptied, declare this input row group consumed */
  130|  10.2M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (130:7): [True: 10.0M, False: 258k]
  ------------------
  131|  10.0M|    (*in_row_group_ctr)++;
  132|  10.2M|}
jdsample-8.c:fullsize_upsample:
  151|  10.1M|{
  152|  10.1M|  *output_data_ptr = input_data;
  153|  10.1M|}
jdsample-8.c:h1v2_fancy_upsample:
  338|  71.2k|{
  339|  71.2k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  71.2k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  340|  71.2k|  _JSAMPROW inptr0, inptr1, outptr;
  ------------------
  |  |  229|  71.2k|#define _JSAMPROW  JSAMPROW
  ------------------
  341|  71.2k|#if BITS_IN_JSAMPLE == 8
  342|  71.2k|  int thiscolsum, bias;
  343|       |#else
  344|       |  JLONG thiscolsum, bias;
  345|       |#endif
  346|  71.2k|  JDIMENSION colctr;
  347|  71.2k|  int inrow, outrow, v;
  348|       |
  349|  71.2k|  inrow = outrow = 0;
  350|   142k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (350:10): [True: 71.2k, False: 71.2k]
  ------------------
  351|   213k|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (351:17): [True: 142k, False: 71.2k]
  ------------------
  352|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  353|   142k|      inptr0 = input_data[inrow];
  354|   142k|      if (v == 0) {             /* next nearest is row above */
  ------------------
  |  Branch (354:11): [True: 71.2k, False: 71.2k]
  ------------------
  355|  71.2k|        inptr1 = input_data[inrow - 1];
  356|  71.2k|        bias = 1;
  357|  71.2k|      } else {                  /* next nearest is row below */
  358|  71.2k|        inptr1 = input_data[inrow + 1];
  359|  71.2k|        bias = 2;
  360|  71.2k|      }
  361|   142k|      outptr = output_data[outrow++];
  362|       |
  363|  1.19M|      for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
  ------------------
  |  Branch (363:24): [True: 1.04M, False: 142k]
  ------------------
  364|  1.04M|        thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  365|  1.04M|        *outptr++ = (_JSAMPLE)((thiscolsum + bias) >> 2);
  366|  1.04M|      }
  367|   142k|    }
  368|  71.2k|    inrow++;
  369|  71.2k|  }
  370|  71.2k|}
jdsample-8.c:int_upsample:
  183|  43.8k|{
  184|  43.8k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
  185|  43.8k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  43.8k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  186|  43.8k|  register _JSAMPROW inptr, outptr;
  187|  43.8k|  register _JSAMPLE invalue;
  188|  43.8k|  register int h;
  189|  43.8k|  _JSAMPROW outend;
  ------------------
  |  |  229|  43.8k|#define _JSAMPROW  JSAMPROW
  ------------------
  190|  43.8k|  int h_expand, v_expand;
  191|  43.8k|  int inrow, outrow;
  192|       |
  193|  43.8k|  h_expand = upsample->h_expand[compptr->component_index];
  194|  43.8k|  v_expand = upsample->v_expand[compptr->component_index];
  195|       |
  196|  43.8k|  inrow = outrow = 0;
  197|  87.6k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (197:10): [True: 43.8k, False: 43.8k]
  ------------------
  198|       |    /* Generate one output row with proper horizontal expansion */
  199|  43.8k|    inptr = input_data[inrow];
  200|  43.8k|    outptr = output_data[outrow];
  201|  43.8k|    outend = outptr + cinfo->output_width;
  202|   536k|    while (outptr < outend) {
  ------------------
  |  Branch (202:12): [True: 492k, False: 43.8k]
  ------------------
  203|   492k|      invalue = *inptr++;
  204|  1.25M|      for (h = h_expand; h > 0; h--) {
  ------------------
  |  Branch (204:26): [True: 760k, False: 492k]
  ------------------
  205|   760k|        *outptr++ = invalue;
  206|   760k|      }
  207|   492k|    }
  208|       |    /* Generate any additional output rows by duplicating the first one */
  209|  43.8k|    if (v_expand > 1) {
  ------------------
  |  Branch (209:9): [True: 40.7k, False: 3.03k]
  ------------------
  210|  40.7k|      _jcopy_sample_rows(output_data, outrow, output_data, outrow + 1,
  ------------------
  |  |  297|  40.7k|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  211|  40.7k|                         v_expand - 1, cinfo->output_width);
  212|  40.7k|    }
  213|  43.8k|    inrow++;
  214|  43.8k|    outrow += v_expand;
  215|  43.8k|  }
  216|  43.8k|}
j12init_upsampler:
  438|    797|{
  439|    797|  my_upsample_ptr upsample;
  440|    797|  int ci;
  441|    797|  jpeg_component_info *compptr;
  442|    797|  boolean need_buffer, do_fancy;
  443|    797|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|    797|#ifdef D_LOSSLESS_SUPPORTED
  446|    797|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 311, False: 486]
  ------------------
  447|       |#if BITS_IN_JSAMPLE == 8
  448|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  449|       |#else
  450|    311|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    622|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (450:9): [True: 0, False: 311]
  ------------------
  451|    311|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    311|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (451:9): [True: 0, False: 311]
  ------------------
  452|      0|#endif
  453|      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)))
  ------------------
  454|    311|  } else
  455|    486|#endif
  456|    486|  {
  457|    486|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    486|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (457:9): [True: 0, False: 486]
  ------------------
  458|      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)))
  ------------------
  459|    486|  }
  460|       |
  461|    797|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 797, False: 0]
  ------------------
  462|    797|    upsample = (my_upsample_ptr)
  463|    797|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    797|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|    797|                                  sizeof(my_upsampler));
  465|    797|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|    797|    upsample->pub.start_pass = start_pass_upsample;
  467|    797|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  149|    797|#define _upsample  upsample_12
  ------------------
  468|    797|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|    797|#define FALSE   0               /* values of boolean */
  ------------------
  469|    797|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|    797|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 797]
  ------------------
  473|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  474|       |
  475|       |  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
  476|       |   * so don't ask for it.
  477|       |   */
  478|    797|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|    797|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 797, False: 0]
  |  Branch (478:44): [True: 486, False: 311]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|  1.59k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 797, False: 797]
  ------------------
  484|    797|       ci++, compptr++) {
  485|       |    /* Compute size of an "input group" after IDCT scaling.  This many samples
  486|       |     * are to be converted to max_h_samp_factor * max_v_samp_factor components.
  487|       |     */
  488|    797|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    797|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|    797|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    797|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|    797|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    797|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|    797|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    797|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|    797|    h_out_group = cinfo->max_h_samp_factor;
  493|    797|    v_out_group = cinfo->max_v_samp_factor;
  494|    797|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|    797|    need_buffer = TRUE;
  ------------------
  |  |  210|    797|#define TRUE    1
  ------------------
  496|    797|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 797]
  ------------------
  497|       |      /* Don't bother to upsample an uninteresting component. */
  498|      0|      upsample->methods[ci] = noop_upsample;
  499|      0|      need_buffer = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  500|    797|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 797, False: 0]
  |  Branch (500:45): [True: 797, False: 0]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|    797|      upsample->methods[ci] = fullsize_upsample;
  503|    797|      need_buffer = FALSE;
  ------------------
  |  |  207|    797|#define FALSE   0               /* values of boolean */
  ------------------
  504|    797|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 0, False: 0]
  |  Branch (504:49): [True: 0, False: 0]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|      0|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 0, False: 0]
  |  Branch (506:23): [True: 0, False: 0]
  ------------------
  507|       |#ifdef WITH_SIMD
  508|       |        if (jsimd_set_h2v1_fancy_upsample(cinfo))
  509|       |          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  510|       |        else
  511|       |#endif
  512|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|      0|      } else {
  514|       |#ifdef WITH_SIMD
  515|       |        if (jsimd_set_h2v1_upsample(cinfo))
  516|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|       |        else
  518|       |#endif
  519|      0|          upsample->methods[ci] = h2v1_upsample;
  520|      0|      }
  521|      0|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 0, False: 0]
  ------------------
  522|      0|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 0, False: 0]
  |  Branch (522:49): [True: 0, False: 0]
  ------------------
  523|       |      /* Non-fancy upsampling is handled by the generic method */
  524|       |#if defined(WITH_SIMD) && (SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM)
  525|       |      if (jsimd_set_h1v2_fancy_upsample(cinfo))
  526|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  527|       |      else
  528|       |#endif
  529|      0|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|      0|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  531|      0|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 0, False: 0]
  ------------------
  532|      0|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 0, False: 0]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|      0|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 0, False: 0]
  |  Branch (534:23): [True: 0, False: 0]
  ------------------
  535|       |#ifdef WITH_SIMD
  536|       |        if (jsimd_set_h2v2_fancy_upsample(cinfo))
  537|       |          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  538|       |        else
  539|       |#endif
  540|      0|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|      0|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  542|      0|      } else {
  543|       |#ifdef WITH_SIMD
  544|       |        if (jsimd_set_h2v2_upsample(cinfo))
  545|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|       |        else
  547|       |#endif
  548|      0|          upsample->methods[ci] = h2v2_upsample;
  549|      0|      }
  550|      0|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 0, False: 0]
  ------------------
  551|      0|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 0, False: 0]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|      0|      upsample->methods[ci] = int_upsample;
  554|      0|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|      0|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|      0|    } else
  557|      0|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|    797|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 0, False: 797]
  |  Branch (558:24): [True: 0, False: 0]
  ------------------
  559|      0|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|      0|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|      0|                               (long)cinfo->max_h_samp_factor),
  563|      0|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|      0|    }
  565|    797|  }
  566|    797|}
jdsample-12.c:start_pass_upsample:
   47|    781|{
   48|    781|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|    781|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|    781|  upsample->rows_to_go = cinfo->output_height;
   54|    781|}
jdsample-12.c:sep_upsample:
   70|  1.74M|{
   71|  1.74M|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   72|  1.74M|  int ci;
   73|  1.74M|  jpeg_component_info *compptr;
   74|  1.74M|  JDIMENSION num_rows;
   75|       |
   76|       |  /* Fill the conversion buffer, if it's empty */
   77|  1.74M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (77:7): [True: 1.74M, False: 0]
  ------------------
   78|  3.49M|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (78:46): [True: 1.74M, False: 1.74M]
  ------------------
   79|  1.74M|         ci++, compptr++) {
   80|       |      /* Invoke per-component upsample method.  Notice we pass a POINTER
   81|       |       * to color_buf[ci], so that fullsize_upsample can change it.
   82|       |       */
   83|       |#ifdef WITH_PROFILE
   84|       |      cinfo->master->start = getTime();
   85|       |#endif
   86|  1.74M|      (*upsample->methods[ci]) (cinfo, compptr,
   87|  1.74M|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   88|  1.74M|        upsample->color_buf + ci);
   89|       |#ifdef WITH_PROFILE
   90|       |      cinfo->master->upsample_elapsed += getTime() - cinfo->master->start;
   91|       |      cinfo->master->upsample_msamples +=
   92|       |        (double)cinfo->output_width * cinfo->max_v_samp_factor / 1000000.;
   93|       |#endif
   94|  1.74M|    }
   95|  1.74M|    upsample->next_row_out = 0;
   96|  1.74M|  }
   97|       |
   98|       |  /* Color-convert and emit rows */
   99|       |
  100|       |  /* How many we have in the buffer: */
  101|  1.74M|  num_rows = (JDIMENSION)(cinfo->max_v_samp_factor - upsample->next_row_out);
  102|       |  /* Not more than the distance to the end of the image.  Need this test
  103|       |   * in case the image height is not a multiple of max_v_samp_factor:
  104|       |   */
  105|  1.74M|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (105:7): [True: 0, False: 1.74M]
  ------------------
  106|      0|    num_rows = upsample->rows_to_go;
  107|       |  /* And not more than what the client can accept: */
  108|  1.74M|  out_rows_avail -= *out_row_ctr;
  109|  1.74M|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (109:7): [True: 0, False: 1.74M]
  ------------------
  110|      0|    num_rows = out_rows_avail;
  111|       |
  112|       |#ifdef WITH_PROFILE
  113|       |  cinfo->master->start = getTime();
  114|       |#endif
  115|  1.74M|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  151|  1.74M|#define _color_convert  color_convert_12
  ------------------
  116|  1.74M|                                      (JDIMENSION)upsample->next_row_out,
  117|  1.74M|                                      output_buf + *out_row_ctr,
  118|  1.74M|                                      (int)num_rows);
  119|       |#ifdef WITH_PROFILE
  120|       |  cinfo->master->cconvert_elapsed += getTime() - cinfo->master->start;
  121|       |  cinfo->master->cconvert_mpixels +=
  122|       |    (double)cinfo->output_width * num_rows / 1000000.;
  123|       |#endif
  124|       |
  125|       |  /* Adjust counts */
  126|  1.74M|  *out_row_ctr += num_rows;
  127|  1.74M|  upsample->rows_to_go -= num_rows;
  128|  1.74M|  upsample->next_row_out += num_rows;
  129|       |  /* When the buffer is emptied, declare this input row group consumed */
  130|  1.74M|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (130:7): [True: 1.74M, False: 0]
  ------------------
  131|  1.74M|    (*in_row_group_ctr)++;
  132|  1.74M|}
jdsample-12.c:fullsize_upsample:
  151|  1.74M|{
  152|  1.74M|  *output_data_ptr = input_data;
  153|  1.74M|}

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

jpeg12_idct_islow:
  198|  3.53M|{
  199|  3.53M|  JLONG tmp0, tmp1, tmp2, tmp3;
  200|  3.53M|  JLONG tmp10, tmp11, tmp12, tmp13;
  201|  3.53M|  JLONG z1, z2, z3, z4, z5;
  202|  3.53M|  JCOEFPTR inptr;
  203|  3.53M|  ISLOW_MULT_TYPE *quantptr;
  204|  3.53M|  int *wsptr;
  205|  3.53M|  _JSAMPROW outptr;
  ------------------
  |  |  113|  3.53M|#define _JSAMPROW  J12SAMPROW
  ------------------
  206|  3.53M|  _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |  108|  3.53M|#define _JSAMPLE  J12SAMPLE
  ------------------
                _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |   95|  3.53M|  ((_JSAMPLE *)((cinfo)->sample_range_limit) + _CENTERJSAMPLE)
  |  |  ------------------
  |  |  |  |  111|  3.53M|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   61|  3.53M|#define CENTERJ12SAMPLE  2048
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  207|  3.53M|  int ctr;
  208|  3.53M|  int workspace[DCTSIZE2];      /* buffers data between passes */
  209|  3.53M|  SHIFT_TEMPS
  210|  3.53M|  SCALING_FACTOR
  ------------------
  |  |  170|  3.53M|  JLONG scaling_factor = (cinfo->master->jpeg_data_precision == 8 && \
  |  |  ------------------
  |  |  |  Branch (170:27): [True: 0, False: 3.53M]
  |  |  ------------------
  |  |  171|  3.53M|                          cinfo->data_precision == 12 ? 16 : 1);
  |  |  ------------------
  |  |  |  Branch (171:27): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  211|       |
  212|       |  /* Pass 1: process columns from input, store into work array. */
  213|       |  /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
  214|       |  /* furthermore, we scale the results by 2**PASS1_BITS. */
  215|       |
  216|  3.53M|  inptr = coef_block;
  217|  3.53M|  quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
  218|  3.53M|  wsptr = workspace;
  219|  31.7M|  for (ctr = DCTSIZE; ctr > 0; ctr--) {
  ------------------
  |  |   66|  3.53M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (219:23): [True: 28.2M, False: 3.53M]
  ------------------
  220|       |    /* Due to quantization, we will usually find that many of the input
  221|       |     * coefficients are zero, especially the AC terms.  We can exploit this
  222|       |     * by short-circuiting the IDCT calculation for any column in which all
  223|       |     * the AC terms are zero.  In that case each output is equal to the
  224|       |     * DC coefficient (with scale factor as needed).
  225|       |     * With typical images and quantization tables, half or more of the
  226|       |     * column DCT calculations can be simplified this way.
  227|       |     */
  228|       |
  229|  28.2M|    if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  28.2M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  26.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (229:9): [True: 26.7M, False: 1.54M]
  |  Branch (229:36): [True: 26.5M, False: 134k]
  ------------------
  230|  26.5M|        inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  26.5M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (230:9): [True: 26.4M, False: 86.9k]
  |  Branch (230:36): [True: 26.4M, False: 13.4k]
  ------------------
  231|  26.4M|        inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (231:9): [True: 26.4M, False: 42.7k]
  |  Branch (231:36): [True: 26.4M, False: 17.4k]
  ------------------
  232|  26.4M|        inptr[DCTSIZE * 7] == 0) {
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (232:9): [True: 26.4M, False: 1.10k]
  ------------------
  233|       |      /* AC terms all zero */
  234|  26.4M|      int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
  ------------------
  |  |   85|  26.4M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  235|  26.4M|                             quantptr[DCTSIZE * 0]), PASS1_BITS);
  236|       |
  237|  26.4M|      wsptr[DCTSIZE * 0] = dcval;
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  238|  26.4M|      wsptr[DCTSIZE * 1] = dcval;
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  239|  26.4M|      wsptr[DCTSIZE * 2] = dcval;
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  240|  26.4M|      wsptr[DCTSIZE * 3] = dcval;
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  241|  26.4M|      wsptr[DCTSIZE * 4] = dcval;
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  242|  26.4M|      wsptr[DCTSIZE * 5] = dcval;
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  243|  26.4M|      wsptr[DCTSIZE * 6] = dcval;
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  244|  26.4M|      wsptr[DCTSIZE * 7] = dcval;
  ------------------
  |  |   66|  26.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  245|       |
  246|  26.4M|      inptr++;                  /* advance pointers to next column */
  247|  26.4M|      quantptr++;
  248|  26.4M|      wsptr++;
  249|  26.4M|      continue;
  250|  26.4M|    }
  251|       |
  252|       |    /* Even part: reverse the even part of the forward DCT. */
  253|       |    /* The rotator is sqrt(2)*c(-6). */
  254|       |
  255|  1.84M|    z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
  ------------------
  |  |  186|  1.84M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  256|  1.84M|    z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
  ------------------
  |  |  186|  1.84M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  257|       |
  258|  1.84M|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  259|  1.84M|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  260|  1.84M|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  261|       |
  262|  1.84M|    z2 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
  ------------------
  |  |  186|  1.84M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  263|  1.84M|    z3 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
  ------------------
  |  |  186|  1.84M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  264|       |
  265|  1.84M|    tmp0 = LEFT_SHIFT(z2 + z3, CONST_BITS);
  ------------------
  |  |   85|  1.84M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  266|  1.84M|    tmp1 = LEFT_SHIFT(z2 - z3, CONST_BITS);
  ------------------
  |  |   85|  1.84M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  267|       |
  268|  1.84M|    tmp10 = tmp0 + tmp3;
  269|  1.84M|    tmp13 = tmp0 - tmp3;
  270|  1.84M|    tmp11 = tmp1 + tmp2;
  271|  1.84M|    tmp12 = tmp1 - tmp2;
  272|       |
  273|       |    /* Odd part per figure 8; the matrix is unitary and hence its
  274|       |     * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
  275|       |     */
  276|       |
  277|  1.84M|    tmp0 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
  ------------------
  |  |  186|  1.84M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  278|  1.84M|    tmp1 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
  ------------------
  |  |  186|  1.84M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  279|  1.84M|    tmp2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
  ------------------
  |  |  186|  1.84M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  280|  1.84M|    tmp3 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
  ------------------
  |  |  186|  1.84M|  (((ISLOW_MULT_TYPE)(coef)) * (quantval) * scaling_factor)
  ------------------
  281|       |
  282|  1.84M|    z1 = tmp0 + tmp3;
  283|  1.84M|    z2 = tmp1 + tmp2;
  284|  1.84M|    z3 = tmp0 + tmp2;
  285|  1.84M|    z4 = tmp1 + tmp3;
  286|  1.84M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  287|       |
  288|  1.84M|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  289|  1.84M|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  290|  1.84M|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  291|  1.84M|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  292|  1.84M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  293|  1.84M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  294|  1.84M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  295|  1.84M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  156|  1.84M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  296|       |
  297|  1.84M|    z3 += z5;
  298|  1.84M|    z4 += z5;
  299|       |
  300|  1.84M|    tmp0 += z1 + z3;
  301|  1.84M|    tmp1 += z2 + z4;
  302|  1.84M|    tmp2 += z2 + z3;
  303|  1.84M|    tmp3 += z1 + z4;
  304|       |
  305|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  306|       |
  307|  1.84M|    wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.84M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  308|  1.84M|    wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.84M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  309|  1.84M|    wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.84M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  310|  1.84M|    wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.84M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  311|  1.84M|    wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.84M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  312|  1.84M|    wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.84M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  313|  1.84M|    wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.84M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  314|  1.84M|    wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  1.84M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  1.84M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  1.84M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  315|       |
  316|  1.84M|    inptr++;                    /* advance pointers to next column */
  317|  1.84M|    quantptr++;
  318|  1.84M|    wsptr++;
  319|  1.84M|  }
  320|       |
  321|       |  /* Pass 2: process rows from work array, store into output array. */
  322|       |  /* Note that we must descale the results by a factor of 8 == 2**3, */
  323|       |  /* and also undo the PASS1_BITS scaling. */
  324|       |
  325|  3.53M|  wsptr = workspace;
  326|  31.7M|  for (ctr = 0; ctr < DCTSIZE; ctr++) {
  ------------------
  |  |   66|  31.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (326:17): [True: 28.2M, False: 3.53M]
  ------------------
  327|  28.2M|    outptr = output_buf[ctr] + output_col;
  328|       |    /* Rows of zeroes can be exploited in the same way as we did with columns.
  329|       |     * However, the column calculation has created many nonzero AC terms, so
  330|       |     * the simplification applies less often (typically 5% to 10% of the time).
  331|       |     * On machines with very fast multiplication, it's possible that the
  332|       |     * test takes more time than it's worth.  In that case this section
  333|       |     * may be commented out.
  334|       |     */
  335|       |
  336|  28.2M|#ifndef NO_ZERO_ROW_TEST
  337|  28.2M|    if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
  ------------------
  |  Branch (337:9): [True: 20.9M, False: 7.32M]
  |  Branch (337:26): [True: 20.7M, False: 196k]
  |  Branch (337:43): [True: 20.6M, False: 96.3k]
  |  Branch (337:60): [True: 20.5M, False: 88.4k]
  ------------------
  338|  20.5M|        wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
  ------------------
  |  Branch (338:9): [True: 20.3M, False: 172k]
  |  Branch (338:26): [True: 20.1M, False: 208k]
  |  Branch (338:43): [True: 20.1M, False: 31.5k]
  ------------------
  339|       |      /* AC terms all zero */
  340|  20.1M|      _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  108|  20.1M|#define _JSAMPLE  J12SAMPLE
  ------------------
                    _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  216|  20.1M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  20.1M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  341|  20.1M|                                                PASS1_BITS + 3) & RANGE_MASK];
  ------------------
  |  |   97|  20.1M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  20.1M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  20.1M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  342|       |
  343|  20.1M|      outptr[0] = dcval;
  344|  20.1M|      outptr[1] = dcval;
  345|  20.1M|      outptr[2] = dcval;
  346|  20.1M|      outptr[3] = dcval;
  347|  20.1M|      outptr[4] = dcval;
  348|  20.1M|      outptr[5] = dcval;
  349|  20.1M|      outptr[6] = dcval;
  350|  20.1M|      outptr[7] = dcval;
  351|       |
  352|  20.1M|      wsptr += DCTSIZE;         /* advance pointer to next row */
  ------------------
  |  |   66|  20.1M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  353|  20.1M|      continue;
  354|  20.1M|    }
  355|  8.11M|#endif
  356|       |
  357|       |    /* Even part: reverse the even part of the forward DCT. */
  358|       |    /* The rotator is sqrt(2)*c(-6). */
  359|       |
  360|  8.11M|    z2 = (JLONG)wsptr[2];
  361|  8.11M|    z3 = (JLONG)wsptr[6];
  362|       |
  363|  8.11M|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  364|  8.11M|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  365|  8.11M|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  366|       |
  367|  8.11M|    tmp0 = LEFT_SHIFT((JLONG)wsptr[0] + (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  8.11M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  368|  8.11M|    tmp1 = LEFT_SHIFT((JLONG)wsptr[0] - (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  8.11M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  369|       |
  370|  8.11M|    tmp10 = tmp0 + tmp3;
  371|  8.11M|    tmp13 = tmp0 - tmp3;
  372|  8.11M|    tmp11 = tmp1 + tmp2;
  373|  8.11M|    tmp12 = tmp1 - tmp2;
  374|       |
  375|       |    /* Odd part per figure 8; the matrix is unitary and hence its
  376|       |     * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
  377|       |     */
  378|       |
  379|  8.11M|    tmp0 = (JLONG)wsptr[7];
  380|  8.11M|    tmp1 = (JLONG)wsptr[5];
  381|  8.11M|    tmp2 = (JLONG)wsptr[3];
  382|  8.11M|    tmp3 = (JLONG)wsptr[1];
  383|       |
  384|  8.11M|    z1 = tmp0 + tmp3;
  385|  8.11M|    z2 = tmp1 + tmp2;
  386|  8.11M|    z3 = tmp0 + tmp2;
  387|  8.11M|    z4 = tmp1 + tmp3;
  388|  8.11M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  389|       |
  390|  8.11M|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  391|  8.11M|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  392|  8.11M|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  393|  8.11M|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  394|  8.11M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  395|  8.11M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  396|  8.11M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  397|  8.11M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  156|  8.11M|#define MULTIPLY(var, const)  ((var) * (const))
  ------------------
  398|       |
  399|  8.11M|    z3 += z5;
  400|  8.11M|    z4 += z5;
  401|       |
  402|  8.11M|    tmp0 += z1 + z3;
  403|  8.11M|    tmp1 += z2 + z4;
  404|  8.11M|    tmp2 += z2 + z3;
  405|  8.11M|    tmp3 += z1 + z4;
  406|       |
  407|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  408|       |
  409|  8.11M|    outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3,
  ------------------
  |  |  216|  8.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  8.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  410|  8.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  411|  8.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  8.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  8.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  8.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  412|  8.11M|    outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3,
  ------------------
  |  |  216|  8.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  8.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  413|  8.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  414|  8.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  8.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  8.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  8.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  415|  8.11M|    outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2,
  ------------------
  |  |  216|  8.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  8.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  416|  8.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  417|  8.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  8.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  8.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  8.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  418|  8.11M|    outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2,
  ------------------
  |  |  216|  8.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  8.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  419|  8.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  420|  8.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  8.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  8.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  8.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  421|  8.11M|    outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1,
  ------------------
  |  |  216|  8.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  8.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  422|  8.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  423|  8.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  8.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  8.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  8.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  424|  8.11M|    outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1,
  ------------------
  |  |  216|  8.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  8.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  425|  8.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  426|  8.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  8.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  8.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  8.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  427|  8.11M|    outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0,
  ------------------
  |  |  216|  8.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  8.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  428|  8.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  429|  8.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  8.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  8.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  8.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  430|  8.11M|    outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0,
  ------------------
  |  |  216|  8.11M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  8.11M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  431|  8.11M|                                         CONST_BITS + PASS1_BITS + 3) &
  432|  8.11M|                            RANGE_MASK];
  ------------------
  |  |   97|  8.11M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  110|  8.11M|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   60|  8.11M|#define MAXJ12SAMPLE     4095
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  433|       |
  434|  8.11M|    wsptr += DCTSIZE;           /* advance pointer to next row */
  ------------------
  |  |   66|  8.11M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  435|  8.11M|  }
  436|  3.53M|}

jmemmgr.c:GETENV_S:
   80|  37.3k|{
   81|  37.3k|  char *env;
   82|       |
   83|  37.3k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 37.3k]
  ------------------
   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|  37.3k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 37.3k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|  37.3k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 37.3k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|  37.3k|  env = getenv(name);
   97|  37.3k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 37.3k, False: 0]
  ------------------
   98|  37.3k|  {
   99|  37.3k|    *buffer = 0;
  100|  37.3k|    return 0;
  101|  37.3k|  }
  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|   108k|{
   81|   108k|  char *env;
   82|       |
   83|   108k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 108k]
  ------------------
   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|   108k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 108k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|   108k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 108k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|   108k|  env = getenv(name);
   97|   108k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 108k, False: 0]
  ------------------
   98|   108k|  {
   99|   108k|    *buffer = 0;
  100|   108k|    return 0;
  101|   108k|  }
  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|  37.3k|{
 1197|  37.3k|  my_mem_ptr mem;
 1198|  37.3k|  long max_to_use;
 1199|  37.3k|  int pool;
 1200|  37.3k|  size_t test_mac;
 1201|       |
 1202|  37.3k|  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|  37.3k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  37.3k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  37.3k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1211:7): [Folded, False: 37.3k]
  ------------------
 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|  37.3k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  37.3k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1219|  37.3k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|  74.6k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1219:7): [True: 0, False: 37.3k]
  ------------------
 1220|  37.3k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  37.3k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  37.3k|#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|  37.3k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1224|       |
 1225|       |  /* Attempt to allocate memory manager's control block */
 1226|  37.3k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1227|       |
 1228|  37.3k|  if (mem == NULL) {
  ------------------
  |  Branch (1228:7): [True: 0, False: 37.3k]
  ------------------
 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|  37.3k|  mem->pub.alloc_small = alloc_small;
 1235|  37.3k|  mem->pub.alloc_large = alloc_large;
 1236|  37.3k|  mem->pub.alloc_sarray = alloc_sarray;
 1237|  37.3k|  mem->pub.alloc_barray = alloc_barray;
 1238|  37.3k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1239|  37.3k|  mem->pub.request_virt_barray = request_virt_barray;
 1240|  37.3k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1241|  37.3k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1242|  37.3k|  mem->pub.access_virt_barray = access_virt_barray;
 1243|  37.3k|  mem->pub.free_pool = free_pool;
 1244|  37.3k|  mem->pub.self_destruct = self_destruct;
 1245|       |
 1246|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1247|  37.3k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  37.3k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1248|       |
 1249|       |  /* Initialize working state */
 1250|  37.3k|  mem->pub.max_memory_to_use = max_to_use;
 1251|       |
 1252|   111k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  37.3k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|   111k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1252:35): [True: 74.6k, False: 37.3k]
  ------------------
 1253|  74.6k|    mem->small_list[pool] = NULL;
 1254|  74.6k|    mem->large_list[pool] = NULL;
 1255|  74.6k|  }
 1256|  37.3k|  mem->virt_sarray_list = NULL;
 1257|  37.3k|  mem->virt_barray_list = NULL;
 1258|       |
 1259|  37.3k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1260|       |
 1261|       |  /* Declare ourselves open for business */
 1262|  37.3k|  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|  37.3k|#ifndef NO_GETENV
 1271|  37.3k|  {
 1272|  37.3k|    char memenv[30] = { 0 };
 1273|       |
 1274|  37.3k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1274:9): [True: 37.3k, False: 0]
  |  Branch (1274:45): [True: 0, False: 37.3k]
  ------------------
 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|  37.3k|  }
 1288|  37.3k|#endif
 1289|       |
 1290|  37.3k|}
jmemmgr.c:alloc_small:
  269|  1.65M|{
  270|  1.65M|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  271|  1.65M|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  272|  1.65M|  char *data_ptr;
  273|  1.65M|  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|  1.65M|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  1.65M|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (281:7): [True: 0, False: 1.65M]
  ------------------
  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|  1.65M|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  1.65M|#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|  1.65M|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  1.65M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (289:7): [True: 0, False: 1.65M]
  ------------------
  290|  1.65M|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  1.65M|#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|  1.65M|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  1.65M|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (294:7): [True: 0, False: 1.65M]
  |  Branch (294:22): [True: 0, False: 1.65M]
  ------------------
  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|  1.65M|  prev_hdr_ptr = NULL;
  297|  1.65M|  hdr_ptr = mem->small_list[pool_id];
  298|  1.85M|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (298:10): [True: 1.70M, False: 155k]
  ------------------
  299|  1.70M|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (299:9): [True: 1.50M, False: 202k]
  ------------------
  300|  1.50M|      break;                    /* found pool with enough space */
  301|   202k|    prev_hdr_ptr = hdr_ptr;
  302|   202k|    hdr_ptr = hdr_ptr->next;
  303|   202k|  }
  304|       |
  305|       |  /* Time to make a new pool? */
  306|  1.65M|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (306:7): [True: 155k, False: 1.50M]
  ------------------
  307|       |    /* min_request is what we need now, slop is what will be leftover */
  308|   155k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   155k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  309|   155k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (309:9): [True: 121k, False: 34.2k]
  ------------------
  310|   121k|      slop = first_pool_slop[pool_id];
  311|  34.2k|    else
  312|  34.2k|      slop = extra_pool_slop[pool_id];
  313|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  314|   155k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|   155k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (314:9): [True: 0, False: 155k]
  ------------------
  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|   155k|    for (;;) {
  318|   155k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  319|   155k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (319:11): [True: 155k, False: 0]
  ------------------
  320|   155k|        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|   155k|    mem->total_space_allocated += min_request + slop;
  326|       |    /* Success, initialize the new pool header and add to end of list */
  327|   155k|    hdr_ptr->next = NULL;
  328|   155k|    hdr_ptr->bytes_used = 0;
  329|   155k|    hdr_ptr->bytes_left = sizeofobject + slop;
  330|   155k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (330:9): [True: 121k, False: 34.2k]
  ------------------
  331|   121k|      mem->small_list[pool_id] = hdr_ptr;
  332|  34.2k|    else
  333|  34.2k|      prev_hdr_ptr->next = hdr_ptr;
  334|   155k|  }
  335|       |
  336|       |  /* OK, allocate the object from the current pool */
  337|  1.65M|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  338|  1.65M|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  339|  1.65M|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  1.65M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (339:7): [True: 1.65M, False: 0]
  ------------------
  340|  1.65M|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  1.65M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  1.65M|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  341|  1.65M|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  342|  1.65M|  hdr_ptr->bytes_used += sizeofobject;
  343|  1.65M|  hdr_ptr->bytes_left -= sizeofobject;
  344|       |
  345|  1.65M|  return (void *)data_ptr;
  346|  1.65M|}
jmemmgr.c:round_up_pow2:
   45|  2.01M|{
   46|  2.01M|  return ((a + b - 1) & (~(b - 1)));
   47|  2.01M|}
jmemmgr.c:alloc_large:
  366|   228k|{
  367|   228k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  368|   228k|  large_pool_ptr hdr_ptr;
  369|   228k|  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|   228k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   228k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (376:7): [True: 0, False: 228k]
  ------------------
  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|   228k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|   228k|#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|   228k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|   228k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (384:7): [True: 0, False: 228k]
  ------------------
  385|   228k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|   228k|#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|   228k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|   228k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (389:7): [True: 0, False: 228k]
  |  Branch (389:22): [True: 0, False: 228k]
  ------------------
  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|   228k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  393|   228k|                                           sizeof(large_pool_hdr) +
  394|   228k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|   228k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  395|   228k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (395:7): [True: 0, False: 228k]
  ------------------
  396|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  397|   228k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  398|   228k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|   228k|#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|   228k|  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|   228k|  hdr_ptr->bytes_used = sizeofobject;
  406|   228k|  hdr_ptr->bytes_left = 0;
  407|   228k|  mem->large_list[pool_id] = hdr_ptr;
  408|       |
  409|   228k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  410|   228k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  411|   228k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|   228k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (411:7): [True: 228k, False: 0]
  ------------------
  412|   228k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   228k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   228k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  413|       |
  414|   228k|  return (void *)data_ptr;
  415|   228k|}
jmemmgr.c:alloc_sarray:
  438|   132k|{
  439|   132k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  440|   132k|  JSAMPARRAY result;
  441|   132k|  JSAMPROW workspace;
  442|   132k|  JDIMENSION rowsperchunk, currow, i;
  443|   132k|  long ltemp;
  444|   132k|  J12SAMPARRAY result12;
  445|   132k|  J12SAMPROW workspace12;
  446|   132k|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  447|   132k|  J16SAMPARRAY result16;
  448|   132k|  J16SAMPROW workspace16;
  449|   132k|#endif
  450|   132k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (450:24): [True: 132k, False: 0]
  ------------------
  451|   132k|                        ((j_decompress_ptr)cinfo)->data_precision :
  452|   132k|                        ((j_compress_ptr)cinfo)->data_precision;
  453|   132k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (453:24): [True: 0, False: 132k]
  ------------------
  454|   132k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (454:45): [True: 1.41k, False: 131k]
  ------------------
  455|  1.41k|                                            sizeof(J12SAMPLE) :
  456|   132k|                                            sizeof(JSAMPLE));
  457|       |
  458|       |  /* Make sure each row is properly aligned */
  459|   132k|  if ((ALIGN_SIZE % sample_size) != 0)
  ------------------
  |  |   89|   132k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (459:7): [True: 0, False: 132k]
  ------------------
  460|      0|    out_of_memory(cinfo, 5);    /* safety check */
  461|       |
  462|   132k|  if (samplesperrow == 0 || samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   132k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (462:7): [True: 0, False: 132k]
  |  Branch (462:29): [True: 0, False: 132k]
  ------------------
  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|   132k|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|   132k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  468|   132k|                                                           sample_size);
  469|       |
  470|       |  /* Calculate max # of rows allowed in one allocation chunk */
  471|   132k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|   132k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  472|   132k|          ((long)samplesperrow * (long)sample_size);
  473|   132k|  if (ltemp <= 0)
  ------------------
  |  Branch (473:7): [True: 0, False: 132k]
  ------------------
  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|   132k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (475:7): [True: 0, False: 132k]
  ------------------
  476|      0|    rowsperchunk = (JDIMENSION)ltemp;
  477|   132k|  else
  478|   132k|    rowsperchunk = numrows;
  479|   132k|  mem->last_rowsperchunk = rowsperchunk;
  480|       |
  481|   132k|  if (data_precision <= 8) {
  ------------------
  |  Branch (481:7): [True: 131k, False: 1.41k]
  ------------------
  482|       |    /* Get space for row pointers (small object) */
  483|   131k|    result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  484|   131k|                                     (size_t)(numrows * sizeof(JSAMPROW)));
  485|       |
  486|       |    /* Get the rows themselves (large objects) */
  487|   131k|    currow = 0;
  488|   262k|    while (currow < numrows) {
  ------------------
  |  Branch (488:12): [True: 131k, False: 131k]
  ------------------
  489|   131k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|   131k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 131k]
  |  |  ------------------
  ------------------
  490|   131k|      workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  491|   131k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  492|  1.28M|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (492:30): [True: 1.15M, False: 131k]
  ------------------
  493|  1.15M|        result[currow++] = workspace;
  494|  1.15M|        workspace += samplesperrow;
  495|  1.15M|      }
  496|   131k|    }
  497|       |
  498|   131k|    return result;
  499|   131k|  } else if (data_precision <= 12) {
  ------------------
  |  Branch (499:14): [True: 1.41k, False: 0]
  ------------------
  500|       |    /* Get space for row pointers (small object) */
  501|  1.41k|    result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
  502|  1.41k|                                         (size_t)(numrows *
  503|  1.41k|                                                  sizeof(J12SAMPROW)));
  504|       |
  505|       |    /* Get the rows themselves (large objects) */
  506|  1.41k|    currow = 0;
  507|  2.83k|    while (currow < numrows) {
  ------------------
  |  Branch (507:12): [True: 1.41k, False: 1.41k]
  ------------------
  508|  1.41k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  1.41k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 1.41k]
  |  |  ------------------
  ------------------
  509|  1.41k|      workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
  510|  1.41k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  511|  6.24k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (511:30): [True: 4.82k, False: 1.41k]
  ------------------
  512|  4.82k|        result12[currow++] = workspace12;
  513|  4.82k|        workspace12 += samplesperrow;
  514|  4.82k|      }
  515|  1.41k|    }
  516|       |
  517|  1.41k|    return (JSAMPARRAY)result12;
  518|  1.41k|  } 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|   132k|}
jmemmgr.c:alloc_barray:
  555|  47.7k|{
  556|  47.7k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  557|  47.7k|  JBLOCKARRAY result;
  558|  47.7k|  JBLOCKROW workspace;
  559|  47.7k|  JDIMENSION rowsperchunk, currow, i;
  560|  47.7k|  long ltemp;
  561|       |
  562|       |  /* Make sure each row is properly aligned */
  563|  47.7k|  if (blocksperrow == 0 || (sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  47.7k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (563:7): [True: 0, False: 47.7k]
  |  Branch (563:28): [Folded, False: 0]
  ------------------
  564|      0|    out_of_memory(cinfo, 6);    /* safety check */
  565|       |
  566|       |  /* Calculate max # of rows allowed in one allocation chunk */
  567|  47.7k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  47.7k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  568|  47.7k|          ((long)blocksperrow * sizeof(JBLOCK));
  569|  47.7k|  if (ltemp <= 0)
  ------------------
  |  Branch (569:7): [True: 0, False: 47.7k]
  ------------------
  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.7k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (571:7): [True: 11, False: 47.7k]
  ------------------
  572|     11|    rowsperchunk = (JDIMENSION)ltemp;
  573|  47.7k|  else
  574|  47.7k|    rowsperchunk = numrows;
  575|  47.7k|  mem->last_rowsperchunk = rowsperchunk;
  576|       |
  577|       |  /* Get space for row pointers (small object) */
  578|  47.7k|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  579|  47.7k|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  580|       |
  581|       |  /* Get the rows themselves (large objects) */
  582|  47.7k|  currow = 0;
  583|  95.5k|  while (currow < numrows) {
  ------------------
  |  Branch (583:10): [True: 47.7k, False: 47.7k]
  ------------------
  584|  47.7k|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  47.7k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 35, False: 47.7k]
  |  |  ------------------
  ------------------
  585|  47.7k|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  586|  47.7k|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  587|  47.7k|                  sizeof(JBLOCK)));
  588|  1.02M|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (588:28): [True: 976k, False: 47.7k]
  ------------------
  589|   976k|      result[currow++] = workspace;
  590|   976k|      workspace += blocksperrow;
  591|   976k|    }
  592|  47.7k|  }
  593|       |
  594|  47.7k|  return result;
  595|  47.7k|}
jmemmgr.c:request_virt_sarray:
  640|    270|{
  641|    270|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  642|    270|  jvirt_sarray_ptr result;
  643|       |
  644|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  645|    270|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|    270|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (645:7): [True: 0, False: 270]
  ------------------
  646|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  647|       |
  648|       |  /* get control block */
  649|    270|  result = (jvirt_sarray_ptr)alloc_small(cinfo, pool_id,
  650|    270|                                         sizeof(struct jvirt_sarray_control));
  651|       |
  652|    270|  result->mem_buffer = NULL;    /* marks array not yet realized */
  653|    270|  result->rows_in_array = numrows;
  654|    270|  result->samplesperrow = samplesperrow;
  655|    270|  result->maxaccess = maxaccess;
  656|    270|  result->pre_zero = pre_zero;
  657|    270|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|    270|#define FALSE   0               /* values of boolean */
  ------------------
  658|    270|  result->next = mem->virt_sarray_list; /* add to list of virtual arrays */
  659|    270|  mem->virt_sarray_list = result;
  660|       |
  661|    270|  return result;
  662|    270|}
jmemmgr.c:request_virt_barray:
  670|  47.7k|{
  671|  47.7k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  672|  47.7k|  jvirt_barray_ptr result;
  673|       |
  674|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  675|  47.7k|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|  47.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (675:7): [True: 0, False: 47.7k]
  ------------------
  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.7k|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  680|  47.7k|                                         sizeof(struct jvirt_barray_control));
  681|       |
  682|  47.7k|  result->mem_buffer = NULL;    /* marks array not yet realized */
  683|  47.7k|  result->rows_in_array = numrows;
  684|  47.7k|  result->blocksperrow = blocksperrow;
  685|  47.7k|  result->maxaccess = maxaccess;
  686|  47.7k|  result->pre_zero = pre_zero;
  687|  47.7k|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|  47.7k|#define FALSE   0               /* values of boolean */
  ------------------
  688|  47.7k|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  689|  47.7k|  mem->virt_barray_list = result;
  690|       |
  691|  47.7k|  return result;
  692|  47.7k|}
jmemmgr.c:realize_virt_arrays:
  698|  74.4k|{
  699|  74.4k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  700|  74.4k|  size_t space_per_minheight, maximum_space, avail_mem;
  701|  74.4k|  size_t minheights, max_minheights;
  702|  74.4k|  jvirt_sarray_ptr sptr;
  703|  74.4k|  jvirt_barray_ptr bptr;
  704|  74.4k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (704:24): [True: 74.4k, False: 0]
  ------------------
  705|  74.4k|                        ((j_decompress_ptr)cinfo)->data_precision :
  706|  74.4k|                        ((j_compress_ptr)cinfo)->data_precision;
  707|  74.4k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (707:24): [True: 0, False: 74.4k]
  ------------------
  708|  74.4k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (708:45): [True: 797, False: 73.6k]
  ------------------
  709|    797|                                            sizeof(J12SAMPLE) :
  710|  74.4k|                                            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|  74.4k|  space_per_minheight = 0;
  717|  74.4k|  maximum_space = 0;
  718|  74.7k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (718:38): [True: 270, False: 74.4k]
  ------------------
  719|    270|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (719:9): [True: 270, False: 0]
  ------------------
  720|    270|      size_t new_space = (size_t)sptr->rows_in_array *
  721|    270|                         (size_t)sptr->samplesperrow * sample_size;
  722|       |
  723|    270|      space_per_minheight += (size_t)sptr->maxaccess *
  724|    270|                             (size_t)sptr->samplesperrow * sample_size;
  725|    270|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (725:11): [True: 0, False: 270]
  ------------------
  726|      0|        out_of_memory(cinfo, 10);
  727|    270|      maximum_space += new_space;
  728|    270|    }
  729|    270|  }
  730|   122k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (730:38): [True: 47.7k, False: 74.4k]
  ------------------
  731|  47.7k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (731:9): [True: 47.7k, False: 0]
  ------------------
  732|  47.7k|      size_t new_space = (size_t)bptr->rows_in_array *
  733|  47.7k|                         (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  734|       |
  735|  47.7k|      space_per_minheight += (size_t)bptr->maxaccess *
  736|  47.7k|                             (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  737|  47.7k|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (737:11): [True: 0, False: 47.7k]
  ------------------
  738|      0|        out_of_memory(cinfo, 11);
  739|  47.7k|      maximum_space += new_space;
  740|  47.7k|    }
  741|  47.7k|  }
  742|       |
  743|  74.4k|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (743:7): [True: 51.8k, False: 22.6k]
  ------------------
  744|  51.8k|    return;                     /* no unrealized arrays, no work */
  745|       |
  746|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  747|  22.6k|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  748|  22.6k|                                 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|  22.6k|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (754:7): [True: 22.6k, False: 0]
  ------------------
  755|  22.6k|    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|  22.9k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (767:38): [True: 270, False: 22.6k]
  ------------------
  768|    270|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (768:9): [True: 270, False: 0]
  ------------------
  769|    270|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  770|    270|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (770:11): [True: 270, False: 0]
  ------------------
  771|       |        /* This buffer fits in memory */
  772|    270|        sptr->rows_in_mem = sptr->rows_in_array;
  773|    270|      } 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|    270|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    270|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  783|    270|                                      sptr->samplesperrow, sptr->rows_in_mem);
  784|    270|      sptr->rowsperchunk = mem->last_rowsperchunk;
  785|    270|      sptr->cur_start_row = 0;
  786|    270|      sptr->first_undef_row = 0;
  787|    270|      sptr->dirty = FALSE;
  ------------------
  |  |  207|    270|#define FALSE   0               /* values of boolean */
  ------------------
  788|    270|    }
  789|    270|  }
  790|       |
  791|  70.3k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (791:38): [True: 47.7k, False: 22.6k]
  ------------------
  792|  47.7k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (792:9): [True: 47.7k, False: 0]
  ------------------
  793|  47.7k|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  794|  47.7k|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (794:11): [True: 47.7k, False: 0]
  ------------------
  795|       |        /* This buffer fits in memory */
  796|  47.7k|        bptr->rows_in_mem = bptr->rows_in_array;
  797|  47.7k|      } 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.7k|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  47.7k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  807|  47.7k|                                      bptr->blocksperrow, bptr->rows_in_mem);
  808|  47.7k|      bptr->rowsperchunk = mem->last_rowsperchunk;
  809|  47.7k|      bptr->cur_start_row = 0;
  810|  47.7k|      bptr->first_undef_row = 0;
  811|  47.7k|      bptr->dirty = FALSE;
  ------------------
  |  |  207|  47.7k|#define FALSE   0               /* values of boolean */
  ------------------
  812|  47.7k|    }
  813|  47.7k|  }
  814|  22.6k|}
jmemmgr.c:access_virt_sarray:
  924|   140k|{
  925|   140k|  JDIMENSION end_row = start_row + num_rows;
  926|   140k|  JDIMENSION undef_row;
  927|   140k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (927:24): [True: 140k, False: 0]
  ------------------
  928|   140k|                        ((j_decompress_ptr)cinfo)->data_precision :
  929|   140k|                        ((j_compress_ptr)cinfo)->data_precision;
  930|   140k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (930:24): [True: 0, False: 140k]
  ------------------
  931|   140k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (931:45): [True: 0, False: 140k]
  ------------------
  932|      0|                                            sizeof(J12SAMPLE) :
  933|   140k|                                            sizeof(JSAMPLE));
  934|       |
  935|       |  /* debugging check */
  936|   140k|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (936:7): [True: 0, False: 140k]
  |  Branch (936:39): [True: 0, False: 140k]
  ------------------
  937|   140k|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (937:7): [True: 0, False: 140k]
  ------------------
  938|      0|    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  939|       |
  940|       |  /* Make the desired part of the virtual array accessible */
  941|   140k|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (941:7): [True: 0, False: 140k]
  ------------------
  942|   140k|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (942:7): [True: 0, False: 140k]
  ------------------
  943|      0|    if (!ptr->b_s_open)
  ------------------
  |  Branch (943:9): [True: 0, False: 0]
  ------------------
  944|      0|      ERREXIT(cinfo, JERR_VIRTUAL_BUG);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  945|       |    /* Flush old buffer contents if necessary */
  946|      0|    if (ptr->dirty) {
  ------------------
  |  Branch (946:9): [True: 0, False: 0]
  ------------------
  947|      0|      do_sarray_io(cinfo, ptr, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  948|      0|      ptr->dirty = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  949|      0|    }
  950|       |    /* Decide what part of virtual array to access.
  951|       |     * Algorithm: if target address > current window, assume forward scan,
  952|       |     * load starting at target address.  If target address < current window,
  953|       |     * assume backward scan, load so that target area is top of window.
  954|       |     * Note that when switching from forward write to forward read, will have
  955|       |     * start_row = 0, so the limiting case applies and we load from 0 anyway.
  956|       |     */
  957|      0|    if (start_row > ptr->cur_start_row) {
  ------------------
  |  Branch (957:9): [True: 0, False: 0]
  ------------------
  958|      0|      ptr->cur_start_row = start_row;
  959|      0|    } else {
  960|       |      /* use long arithmetic here to avoid overflow & unsigned problems */
  961|      0|      long ltemp;
  962|       |
  963|      0|      ltemp = (long)end_row - (long)ptr->rows_in_mem;
  964|      0|      if (ltemp < 0)
  ------------------
  |  Branch (964:11): [True: 0, False: 0]
  ------------------
  965|      0|        ltemp = 0;              /* don't fall off front end of file */
  966|      0|      ptr->cur_start_row = (JDIMENSION)ltemp;
  967|      0|    }
  968|       |    /* Read in the selected part of the array.
  969|       |     * During the initial write pass, we will do no actual read
  970|       |     * because the selected part is all undefined.
  971|       |     */
  972|      0|    do_sarray_io(cinfo, ptr, FALSE);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  973|      0|  }
  974|       |  /* Ensure the accessed part of the array is defined; prezero if needed.
  975|       |   * To improve locality of access, we only prezero the part of the array
  976|       |   * that the caller is about to access, not the entire in-memory array.
  977|       |   */
  978|   140k|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (978:7): [True: 73.6k, False: 66.7k]
  ------------------
  979|  73.6k|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (979:9): [True: 0, False: 73.6k]
  ------------------
  980|      0|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (980:11): [True: 0, False: 0]
  ------------------
  981|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  982|      0|      undef_row = start_row;    /* but reader is allowed to read ahead */
  983|  73.6k|    } else {
  984|  73.6k|      undef_row = ptr->first_undef_row;
  985|  73.6k|    }
  986|  73.6k|    if (writable)
  ------------------
  |  Branch (986:9): [True: 73.6k, False: 23]
  ------------------
  987|  73.6k|      ptr->first_undef_row = end_row;
  988|  73.6k|    if (ptr->pre_zero) {
  ------------------
  |  Branch (988:9): [True: 0, False: 73.6k]
  ------------------
  989|      0|      size_t bytesperrow = (size_t)ptr->samplesperrow * sample_size;
  990|      0|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
  991|      0|      end_row -= ptr->cur_start_row;
  992|      0|      while (undef_row < end_row) {
  ------------------
  |  Branch (992:14): [True: 0, False: 0]
  ------------------
  993|      0|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
  994|      0|        undef_row++;
  995|      0|      }
  996|  73.6k|    } else {
  997|  73.6k|      if (!writable)            /* reader looking at undefined data */
  ------------------
  |  Branch (997:11): [True: 23, False: 73.6k]
  ------------------
  998|     23|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|     23|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     23|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  999|  73.6k|    }
 1000|  73.6k|  }
 1001|       |  /* Flag the buffer dirty if caller will write in it */
 1002|   140k|  if (writable)
  ------------------
  |  Branch (1002:7): [True: 134k, False: 6.23k]
  ------------------
 1003|   134k|    ptr->dirty = TRUE;
  ------------------
  |  |  210|   134k|#define TRUE    1
  ------------------
 1004|       |  /* Return address of proper part of the buffer */
 1005|   140k|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1006|   140k|}
jmemmgr.c:access_virt_barray:
 1015|  1.64M|{
 1016|  1.64M|  JDIMENSION end_row = start_row + num_rows;
 1017|  1.64M|  JDIMENSION undef_row;
 1018|       |
 1019|       |  /* debugging check */
 1020|  1.64M|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (1020:7): [True: 0, False: 1.64M]
  |  Branch (1020:39): [True: 0, False: 1.64M]
  ------------------
 1021|  1.64M|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (1021:7): [True: 0, False: 1.64M]
  ------------------
 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|  1.64M|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (1025:7): [True: 0, False: 1.64M]
  ------------------
 1026|  1.64M|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (1026:7): [True: 0, False: 1.64M]
  ------------------
 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|  1.64M|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (1062:7): [True: 873k, False: 772k]
  ------------------
 1063|   873k|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (1063:9): [True: 58.8k, False: 814k]
  ------------------
 1064|  58.8k|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (1064:11): [True: 0, False: 58.8k]
  ------------------
 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|  58.8k|      undef_row = start_row;    /* but reader is allowed to read ahead */
 1067|   814k|    } else {
 1068|   814k|      undef_row = ptr->first_undef_row;
 1069|   814k|    }
 1070|   873k|    if (writable)
  ------------------
  |  Branch (1070:9): [True: 800k, False: 73.5k]
  ------------------
 1071|   800k|      ptr->first_undef_row = end_row;
 1072|   873k|    if (ptr->pre_zero) {
  ------------------
  |  Branch (1072:9): [True: 873k, False: 0]
  ------------------
 1073|   873k|      size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
 1074|   873k|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
 1075|   873k|      end_row -= ptr->cur_start_row;
 1076|  1.78M|      while (undef_row < end_row) {
  ------------------
  |  Branch (1076:14): [True: 913k, False: 873k]
  ------------------
 1077|   913k|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
 1078|   913k|        undef_row++;
 1079|   913k|      }
 1080|   873k|    } else {
 1081|      0|      if (!writable)            /* reader looking at undefined data */
  ------------------
  |  Branch (1081:11): [True: 0, False: 0]
  ------------------
 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|      0|    }
 1084|   873k|  }
 1085|       |  /* Flag the buffer dirty if caller will write in it */
 1086|  1.64M|  if (writable)
  ------------------
  |  Branch (1086:7): [True: 1.22M, False: 425k]
  ------------------
 1087|  1.22M|    ptr->dirty = TRUE;
  ------------------
  |  |  210|  1.22M|#define TRUE    1
  ------------------
 1088|       |  /* Return address of proper part of the buffer */
 1089|  1.64M|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1090|  1.64M|}
jmemmgr.c:free_pool:
 1099|   351k|{
 1100|   351k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1101|   351k|  small_pool_ptr shdr_ptr;
 1102|   351k|  large_pool_ptr lhdr_ptr;
 1103|   351k|  size_t space_freed;
 1104|       |
 1105|   351k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|   351k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1105:7): [True: 0, False: 351k]
  |  Branch (1105:22): [True: 0, False: 351k]
  ------------------
 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|   351k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  889|   351k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1114:7): [True: 314k, False: 37.3k]
  ------------------
 1115|   314k|    jvirt_sarray_ptr sptr;
 1116|   314k|    jvirt_barray_ptr bptr;
 1117|       |
 1118|   314k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1118:40): [True: 270, False: 314k]
  ------------------
 1119|    270|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1119:11): [True: 0, False: 270]
  ------------------
 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|    270|    }
 1124|   314k|    mem->virt_sarray_list = NULL;
 1125|   361k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1125:40): [True: 47.7k, False: 314k]
  ------------------
 1126|  47.7k|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1126:11): [True: 0, False: 47.7k]
  ------------------
 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.7k|    }
 1131|   314k|    mem->virt_barray_list = NULL;
 1132|   314k|  }
 1133|       |
 1134|       |  /* Release large objects */
 1135|   351k|  lhdr_ptr = mem->large_list[pool_id];
 1136|   351k|  mem->large_list[pool_id] = NULL;
 1137|       |
 1138|   580k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1138:10): [True: 228k, False: 351k]
  ------------------
 1139|   228k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1140|   228k|    space_freed = lhdr_ptr->bytes_used +
 1141|   228k|                  lhdr_ptr->bytes_left +
 1142|   228k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   228k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1143|   228k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1144|   228k|    mem->total_space_allocated -= space_freed;
 1145|   228k|    lhdr_ptr = next_lhdr_ptr;
 1146|   228k|  }
 1147|       |
 1148|       |  /* Release small objects */
 1149|   351k|  shdr_ptr = mem->small_list[pool_id];
 1150|   351k|  mem->small_list[pool_id] = NULL;
 1151|       |
 1152|   506k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1152:10): [True: 155k, False: 351k]
  ------------------
 1153|   155k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1154|   155k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1155|   155k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|   155k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1156|   155k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1157|   155k|    mem->total_space_allocated -= space_freed;
 1158|   155k|    shdr_ptr = next_shdr_ptr;
 1159|   155k|  }
 1160|   351k|}
jmemmgr.c:self_destruct:
 1170|  37.3k|{
 1171|  37.3k|  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|   111k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  37.3k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|   111k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1177:35): [True: 74.6k, False: 37.3k]
  ------------------
 1178|  74.6k|    free_pool(cinfo, pool);
 1179|  74.6k|  }
 1180|       |
 1181|       |  /* Release the memory manager control block too. */
 1182|  37.3k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1183|  37.3k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1184|       |
 1185|  37.3k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1186|  37.3k|}

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

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

jdiv_round_up:
   81|   883k|{
   82|   883k|  return (a + b - 1L) / b;
   83|   883k|}
jround_up:
   90|   128k|{
   91|   128k|  a += b - 1L;
   92|   128k|  return a - (a % b);
   93|   128k|}
jcopy_sample_rows:
  110|  40.7k|{
  111|  40.7k|  register _JSAMPROW inptr, outptr;
  112|  40.7k|  register size_t count = (size_t)(num_cols * sizeof(_JSAMPLE));
  113|  40.7k|  register int row;
  114|       |
  115|  40.7k|  input_array += source_row;
  116|  40.7k|  output_array += dest_row;
  117|       |
  118|   121k|  for (row = num_rows; row > 0; row--) {
  ------------------
  |  Branch (118:24): [True: 80.4k, False: 40.7k]
  ------------------
  119|  80.4k|    inptr = *input_array++;
  120|  80.4k|    outptr = *output_array++;
  121|  80.4k|    memcpy(outptr, inptr, count);
  122|  80.4k|  }
  123|  40.7k|}
jcopy_block_row:
  135|  8.49M|{
  136|  8.49M|  memcpy(output_row, input_row, num_blocks * (DCTSIZE2 * sizeof(JCOEF)));
  ------------------
  |  |   67|  8.49M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  137|  8.49M|}
jzero_far:
  144|   113M|{
  145|   113M|  memset(target, 0, bytestozero);
  146|   113M|}

handle_error:
   43|  3.37M|{
   44|  3.37M|    return;
   45|  3.37M|}
LLVMFuzzerTestOneInput:
   48|  5.98k|{
   49|  5.98k|#ifndef STANDALONE
   50|  5.98k|    TIFFSetErrorHandler(handle_error);
   51|  5.98k|    TIFFSetWarningHandler(handle_error);
   52|  5.98k|#endif
   53|  5.98k|#if defined(__has_feature)
   54|       |#if __has_feature(memory_sanitizer)
   55|       |    // libjpeg-turbo has issues with MSAN and SIMD code
   56|       |    // See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7547
   57|       |    // and https://github.com/libjpeg-turbo/libjpeg-turbo/pull/365
   58|       |    setenv("JSIMD_FORCENONE", "1", 1);
   59|       |#endif
   60|  5.98k|#endif
   61|  5.98k|    std::istringstream s(std::string(Data, Data + Size));
   62|  5.98k|    TIFF *tif = TIFFStreamOpen("MemTIFF", &s);
   63|  5.98k|    if (!tif)
  ------------------
  |  Branch (63:9): [True: 1.59k, False: 4.38k]
  ------------------
   64|  1.59k|    {
   65|  1.59k|        return 0;
   66|  1.59k|    }
   67|  4.38k|    uint32_t w, h;
   68|  4.38k|    uint32_t *raster;
   69|       |
   70|  4.38k|    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
  ------------------
  |  |  178|  4.38k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
   71|  4.38k|    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
  ------------------
  |  |  179|  4.38k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
   72|       |    /* don't continue if file size is ludicrous */
   73|  4.38k|    if (TIFFTileSize64(tif) > MAX_SIZE)
  ------------------
  |  Branch (73:9): [True: 25, False: 4.36k]
  ------------------
   74|     25|    {
   75|     25|        TIFFClose(tif);
   76|     25|        return 0;
   77|     25|    }
   78|  4.36k|    uint64_t bufsize = TIFFTileSize64(tif);
   79|       |    /* don't continue if the buffer size greater than the max allowed by the
   80|       |     * fuzzer */
   81|  4.36k|    if (bufsize > MAX_SIZE || bufsize == 0)
  ------------------
  |  Branch (81:9): [True: 0, False: 4.36k]
  |  Branch (81:31): [True: 23, False: 4.33k]
  ------------------
   82|     23|    {
   83|     23|        TIFFClose(tif);
   84|     23|        return 0;
   85|     23|    }
   86|       |
   87|  4.33k|    if (TIFFIsTiled(tif))
  ------------------
  |  Branch (87:9): [True: 2.47k, False: 1.86k]
  ------------------
   88|  2.47k|    {
   89|       |        /* another hack to work around an OOM in tif_fax3.c */
   90|  2.47k|        uint32_t tilewidth = 0;
   91|  2.47k|        uint32_t imagewidth = 0;
   92|  2.47k|        TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tilewidth);
  ------------------
  |  |  311|  2.47k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
   93|  2.47k|        TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &imagewidth);
  ------------------
  |  |  178|  2.47k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
   94|  2.47k|        tilewidth = __TIFFSafeMultiply(uint32_t, tilewidth, 2);
  ------------------
  |  |   35|  2.47k|    ((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v)))                \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 2.47k, Folded]
  |  |  |  Branch (35:27): [True: 2.47k, False: 0]
  |  |  ------------------
  |  |   36|  2.47k|         ? (t)((v) * (m))                                                      \
  |  |   37|  2.47k|         : (t)0)
  ------------------
   95|  2.47k|        imagewidth = __TIFFSafeMultiply(uint32_t, imagewidth, 2);
  ------------------
  |  |   35|  2.47k|    ((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v)))                \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 2.47k, Folded]
  |  |  |  Branch (35:27): [True: 2.47k, False: 2]
  |  |  ------------------
  |  |   36|  2.47k|         ? (t)((v) * (m))                                                      \
  |  |   37|  2.47k|         : (t)0)
  ------------------
   96|  2.47k|        if (tilewidth * 2 > MAX_SIZE || imagewidth * 2 > MAX_SIZE ||
  ------------------
  |  Branch (96:13): [True: 0, False: 2.47k]
  |  Branch (96:41): [True: 2, False: 2.47k]
  ------------------
   97|  2.47k|            tilewidth == 0 || imagewidth == 0)
  ------------------
  |  Branch (97:13): [True: 0, False: 2.47k]
  |  Branch (97:31): [True: 2, False: 2.47k]
  ------------------
   98|      4|        {
   99|      4|            TIFFClose(tif);
  100|      4|            return 0;
  101|      4|        }
  102|  2.47k|    }
  103|  1.86k|    else
  104|  1.86k|    {
  105|       |        // check the size of the non-tiled image
  106|  1.86k|        uint32_t rowsize = 0;
  107|  1.86k|        TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsize);
  ------------------
  |  |  258|  1.86k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  108|  1.86k|        uint32_t stripsize = TIFFStripSize(tif);
  109|  1.86k|        rowsize = __TIFFSafeMultiply(uint32_t, rowsize, 2);
  ------------------
  |  |   35|  1.86k|    ((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v)))                \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 1.86k, Folded]
  |  |  |  Branch (35:27): [True: 1.86k, False: 0]
  |  |  ------------------
  |  |   36|  1.86k|         ? (t)((v) * (m))                                                      \
  |  |   37|  1.86k|         : (t)0)
  ------------------
  110|  1.86k|        stripsize = __TIFFSafeMultiply(uint32_t, stripsize, 2);
  ------------------
  |  |   35|  1.86k|    ((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v)))                \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 1.86k, Folded]
  |  |  |  Branch (35:27): [True: 1.86k, False: 0]
  |  |  ------------------
  |  |   36|  1.86k|         ? (t)((v) * (m))                                                      \
  |  |   37|  1.86k|         : (t)0)
  ------------------
  111|  1.86k|        if (rowsize * 2 > MAX_SIZE || stripsize * 2 > MAX_SIZE ||
  ------------------
  |  Branch (111:13): [True: 0, False: 1.86k]
  |  Branch (111:39): [True: 1, False: 1.86k]
  ------------------
  112|  1.86k|            rowsize == 0 || stripsize == 0)
  ------------------
  |  Branch (112:13): [True: 0, False: 1.86k]
  |  Branch (112:29): [True: 0, False: 1.86k]
  ------------------
  113|      1|        {
  114|      1|            TIFFClose(tif);
  115|      1|            return 0;
  116|      1|        }
  117|  1.86k|    }
  118|       |
  119|  4.33k|    uint32_t size = __TIFFSafeMultiply(uint32_t, w, h);
  ------------------
  |  |   35|  4.33k|    ((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v)))                \
  |  |  ------------------
  |  |  |  Branch (35:7): [True: 4.33k, False: 0]
  |  |  |  Branch (35:27): [True: 4.33k, False: 1]
  |  |  ------------------
  |  |   36|  4.33k|         ? (t)((v) * (m))                                                      \
  |  |   37|  4.33k|         : (t)0)
  ------------------
  120|       |
  121|  4.33k|    if (size > MAX_SIZE || size == 0)
  ------------------
  |  Branch (121:9): [True: 2, False: 4.33k]
  |  Branch (121:28): [True: 1, False: 4.33k]
  ------------------
  122|      3|    {
  123|      3|        TIFFClose(tif);
  124|      3|        return 0;
  125|      3|    }
  126|       |
  127|  4.33k|    raster = (uint32_t *)_TIFFmalloc(size * sizeof(uint32_t));
  128|  4.33k|    int ret = 0;
  129|  4.33k|    if (raster != NULL)
  ------------------
  |  Branch (129:9): [True: 4.33k, False: 0]
  ------------------
  130|  4.33k|    {
  131|  4.33k|        TIFFReadRGBAImage(tif, w, h, raster, 0);
  132|       |
  133|  4.33k|        if (!TIFFIsTiled(tif))
  ------------------
  |  Branch (133:13): [True: 1.86k, False: 2.47k]
  ------------------
  134|  1.86k|        {
  135|       |            // Allocate a buffer to hold one scanline
  136|  1.86k|            tsize_t scanlineSize = TIFFScanlineSize(tif);
  137|  1.86k|            void *buffer = _TIFFmalloc(scanlineSize);
  138|  1.86k|            if (!buffer)
  ------------------
  |  Branch (138:17): [True: 0, False: 1.86k]
  ------------------
  139|      0|            {
  140|      0|                fprintf(stderr, "Memory allocation failed\n");
  141|      0|                ret = 1;
  142|      0|                goto cleanup;
  143|      0|            }
  144|       |
  145|       |            // Read each scanline
  146|  1.92M|            for (uint32_t row = 0; row < h; row++)
  ------------------
  |  Branch (146:36): [True: 1.92M, False: 665]
  ------------------
  147|  1.92M|            {
  148|  1.92M|                if (TIFFReadScanline(tif, buffer, row, 0) < 0)
  ------------------
  |  Branch (148:21): [True: 1.19k, False: 1.92M]
  ------------------
  149|  1.19k|                {
  150|  1.19k|                    _TIFFfree(buffer);
  151|  1.19k|                    ret = 1;
  152|  1.19k|                    goto cleanup;
  153|  1.19k|                }
  154|  1.92M|            }
  155|    665|            _TIFFfree(buffer);
  156|    665|        }
  157|  4.33k|    cleanup:
  158|  4.33k|        _TIFFfree(raster);
  159|  4.33k|    }
  160|  4.33k|    TIFFClose(tif);
  161|       |
  162|  4.33k|    return ret;
  163|  4.33k|}

_TIFFMultiply32:
   37|  3.95M|{
   38|  3.95M|    if (second && first > UINT32_MAX / second)
  ------------------
  |  Branch (38:9): [True: 3.95M, False: 2]
  |  Branch (38:19): [True: 608, False: 3.95M]
  ------------------
   39|    608|    {
   40|    608|        TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
   41|    608|        return 0;
   42|    608|    }
   43|       |
   44|  3.95M|    return first * second;
   45|  3.95M|}
_TIFFMultiply64:
   49|  8.47M|{
   50|  8.47M|    if (second && first > UINT64_MAX / second)
  ------------------
  |  Branch (50:9): [True: 5.89M, False: 2.58M]
  |  Branch (50:19): [True: 0, False: 5.89M]
  ------------------
   51|      0|    {
   52|      0|        TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
   53|      0|        return 0;
   54|      0|    }
   55|       |
   56|  8.47M|    return first * second;
   57|  8.47M|}
_TIFFAdd64:
   61|  4.24M|{
   62|  4.24M|    if (first > UINT64_MAX - second)
  ------------------
  |  Branch (62:9): [True: 0, False: 4.24M]
  ------------------
   63|      0|    {
   64|      0|        if (tif != NULL && where != NULL)
  ------------------
  |  Branch (64:13): [True: 0, False: 0]
  |  Branch (64:28): [True: 0, False: 0]
  ------------------
   65|      0|        {
   66|      0|            TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
   67|      0|        }
   68|      0|        return 0;
   69|      0|    }
   70|       |
   71|  4.24M|    return first + second;
   72|  4.24M|}
_TIFFMultiplySSize:
   76|   178k|{
   77|   178k|    if (first <= 0 || second <= 0)
  ------------------
  |  Branch (77:9): [True: 0, False: 178k]
  |  Branch (77:23): [True: 0, False: 178k]
  ------------------
   78|      0|    {
   79|      0|        if (tif != NULL && where != NULL)
  ------------------
  |  Branch (79:13): [True: 0, False: 0]
  |  Branch (79:28): [True: 0, False: 0]
  ------------------
   80|      0|        {
   81|      0|            TIFFErrorExtR(tif, where,
   82|      0|                          "Invalid argument to _TIFFMultiplySSize() in %s",
   83|      0|                          where);
   84|      0|        }
   85|      0|        return 0;
   86|      0|    }
   87|       |
   88|   178k|    if (first > TIFF_TMSIZE_T_MAX / second)
  ------------------
  |  |   68|   178k|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (88:9): [True: 0, False: 178k]
  ------------------
   89|      0|    {
   90|      0|        if (tif != NULL && where != NULL)
  ------------------
  |  Branch (90:13): [True: 0, False: 0]
  |  Branch (90:28): [True: 0, False: 0]
  ------------------
   91|      0|        {
   92|      0|            TIFFErrorExtR(tif, where, "Integer overflow in %s", where);
   93|      0|        }
   94|      0|        return 0;
   95|      0|    }
   96|   178k|    return first * second;
   97|   178k|}
_TIFFCastUInt64ToSSize:
  124|  1.79M|{
  125|  1.79M|    if (val > (uint64_t)TIFF_TMSIZE_T_MAX)
  ------------------
  |  |   68|  1.79M|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (125:9): [True: 5, False: 1.79M]
  ------------------
  126|      5|    {
  127|      5|        if (tif != NULL && module != NULL)
  ------------------
  |  Branch (127:13): [True: 5, False: 0]
  |  Branch (127:28): [True: 5, False: 0]
  ------------------
  128|      5|        {
  129|      5|            TIFFErrorExtR(tif, module, "Integer overflow");
  130|      5|        }
  131|      5|        return 0;
  132|      5|    }
  133|  1.79M|    return (tmsize_t)val;
  134|  1.79M|}
_TIFFCastUInt64ToUInt32:
  137|  1.84M|{
  138|  1.84M|    if (val > UINT32_MAX)
  ------------------
  |  Branch (138:9): [True: 0, False: 1.84M]
  ------------------
  139|      0|    {
  140|      0|        if (tif != NULL && module != NULL)
  ------------------
  |  Branch (140:13): [True: 0, False: 0]
  |  Branch (140:28): [True: 0, False: 0]
  ------------------
  141|      0|        {
  142|      0|            TIFFErrorExtR(tif, module, "Integer overflow");
  143|      0|        }
  144|      0|        return 0;
  145|      0|    }
  146|  1.84M|    return (uint32_t)val;
  147|  1.84M|}
_TIFFCheckRealloc:
  187|   171k|{
  188|   171k|    void *cp = NULL;
  189|   171k|    tmsize_t count = _TIFFMultiplySSize(tif, nmemb, elem_size, NULL);
  190|       |    /*
  191|       |     * Check for integer overflow.
  192|       |     */
  193|   171k|    if (count != 0)
  ------------------
  |  Branch (193:9): [True: 171k, False: 0]
  ------------------
  194|   171k|    {
  195|   171k|        cp = _TIFFreallocExt(tif, buffer, count);
  196|   171k|    }
  197|       |
  198|   171k|    if (cp == NULL)
  ------------------
  |  Branch (198:9): [True: 0, False: 171k]
  ------------------
  199|      0|    {
  200|      0|        TIFFErrorExtR(tif, tif->tif_name,
  201|      0|                      "Failed to allocate memory for %s "
  202|      0|                      "(%" TIFF_SSIZE_FORMAT " elements of %" TIFF_SSIZE_FORMAT
  203|      0|                      " bytes each)",
  204|      0|                      what, nmemb, elem_size);
  205|      0|    }
  206|       |
  207|   171k|    return cp;
  208|   171k|}
_TIFFCheckMalloc:
  212|  48.4k|{
  213|       |    return _TIFFCheckRealloc(tif, NULL, nmemb, elem_size, what);
  214|  48.4k|}
TIFFVGetFieldDefaulted:
  309|   333k|{
  310|   333k|    TIFFDirectory *td = &tif->tif_dir;
  311|       |
  312|   333k|    if (TIFFVGetField(tif, tag, ap))
  ------------------
  |  Branch (312:9): [True: 312k, False: 20.7k]
  ------------------
  313|   312k|        return (1);
  314|  20.7k|    switch (tag)
  315|  20.7k|    {
  316|      0|        case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  170|      0|#define TIFFTAG_SUBFILETYPE 254       /* subfile data descriptor */
  ------------------
  |  Branch (316:9): [True: 0, False: 20.7k]
  ------------------
  317|      0|            *va_arg(ap, uint32_t *) = td->td_subfiletype;
  318|      0|            return (1);
  319|    507|        case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|    507|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (319:9): [True: 507, False: 20.2k]
  ------------------
  320|    507|            *va_arg(ap, uint16_t *) = td->td_bitspersample;
  321|    507|            return (1);
  322|      0|        case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  234|      0|#define TIFFTAG_THRESHHOLDING 263          /* +thresholding used on data */
  ------------------
  |  Branch (322:9): [True: 0, False: 20.7k]
  ------------------
  323|      0|            *va_arg(ap, uint16_t *) = td->td_threshholding;
  324|      0|            return (1);
  325|      0|        case TIFFTAG_FILLORDER:
  ------------------
  |  |  240|      0|#define TIFFTAG_FILLORDER 266              /* data order within a byte */
  ------------------
  |  Branch (325:9): [True: 0, False: 20.7k]
  ------------------
  326|      0|            *va_arg(ap, uint16_t *) = td->td_fillorder;
  327|      0|            return (1);
  328|  2.92k|        case TIFFTAG_ORIENTATION:
  ------------------
  |  |  248|  2.92k|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  |  Branch (328:9): [True: 2.92k, False: 17.8k]
  ------------------
  329|  2.92k|            *va_arg(ap, uint16_t *) = td->td_orientation;
  330|  2.92k|            return (1);
  331|  1.35k|        case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  257|  1.35k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (331:9): [True: 1.35k, False: 19.3k]
  ------------------
  332|  1.35k|            *va_arg(ap, uint16_t *) = td->td_samplesperpixel;
  333|  1.35k|            return (1);
  334|      0|        case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|      0|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (334:9): [True: 0, False: 20.7k]
  ------------------
  335|      0|            *va_arg(ap, uint32_t *) = td->td_rowsperstrip;
  336|      0|            return (1);
  337|      0|        case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  260|      0|#define TIFFTAG_MINSAMPLEVALUE 280         /* +minimum sample value */
  ------------------
  |  Branch (337:9): [True: 0, False: 20.7k]
  ------------------
  338|      0|            *va_arg(ap, uint16_t *) = td->td_minsamplevalue;
  339|      0|            return (1);
  340|      0|        case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  261|      0|#define TIFFTAG_MAXSAMPLEVALUE 281         /* +maximum sample value */
  ------------------
  |  Branch (340:9): [True: 0, False: 20.7k]
  ------------------
  341|      0|        {
  342|      0|            uint16_t maxsamplevalue;
  343|       |            /* td_bitspersample=1 is always set in TIFFDefaultDirectory().
  344|       |             * Therefore, td_maxsamplevalue has to be re-calculated in
  345|       |             * TIFFGetFieldDefaulted(). */
  346|      0|            if (td->td_bitspersample > 0)
  ------------------
  |  Branch (346:17): [True: 0, False: 0]
  ------------------
  347|      0|            {
  348|       |                /* This shift operation into a uint16_t limits the value to
  349|       |                 * 65535 even if td_bitspersamle is > 16 */
  350|      0|                if (td->td_bitspersample <= 16)
  ------------------
  |  Branch (350:21): [True: 0, False: 0]
  ------------------
  351|      0|                {
  352|      0|                    maxsamplevalue = (uint16_t)((1U << td->td_bitspersample) -
  353|      0|                                                1); /* 2**(BitsPerSample) - 1 */
  354|      0|                }
  355|      0|                else
  356|      0|                {
  357|      0|                    maxsamplevalue = 65535;
  358|      0|                }
  359|      0|            }
  360|      0|            else
  361|      0|            {
  362|      0|                maxsamplevalue = 0;
  363|      0|            }
  364|      0|            *va_arg(ap, uint16_t *) = maxsamplevalue;
  365|      0|            return (1);
  366|      0|        }
  367|      0|        case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  264|      0|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  |  Branch (367:9): [True: 0, False: 20.7k]
  ------------------
  368|      0|            *va_arg(ap, uint16_t *) = td->td_planarconfig;
  369|      0|            return (1);
  370|      0|        case TIFFTAG_RESOLUTIONUNIT:
  ------------------
  |  |  287|      0|#define TIFFTAG_RESOLUTIONUNIT 296         /* units of resolutions */
  ------------------
  |  Branch (370:9): [True: 0, False: 20.7k]
  ------------------
  371|      0|            *va_arg(ap, uint16_t *) = td->td_resolutionunit;
  372|      0|            return (1);
  373|      0|        case TIFFTAG_PREDICTOR:
  ------------------
  |  |  303|      0|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (373:9): [True: 0, False: 20.7k]
  ------------------
  374|      0|        {
  375|      0|            TIFFPredictorState *sp = (TIFFPredictorState *)tif->tif_data;
  376|      0|            if (sp == NULL)
  ------------------
  |  Branch (376:17): [True: 0, False: 0]
  ------------------
  377|      0|            {
  378|      0|                TIFFErrorExtR(
  379|      0|                    tif, tif->tif_name,
  380|      0|                    "Cannot get \"Predictor\" tag as plugin is not configured");
  381|      0|                *va_arg(ap, uint16_t *) = 0;
  382|      0|                return 0;
  383|      0|            }
  384|      0|            *va_arg(ap, uint16_t *) = (uint16_t)sp->predictor;
  385|      0|            return 1;
  386|      0|        }
  387|      0|        case TIFFTAG_DOTRANGE:
  ------------------
  |  |  327|      0|#define TIFFTAG_DOTRANGE 336               /* !0% and 100% dot codes */
  ------------------
  |  Branch (387:9): [True: 0, False: 20.7k]
  ------------------
  388|      0|            *va_arg(ap, uint16_t *) = 0;
  389|      0|            if (td->td_bitspersample <= 16)
  ------------------
  |  Branch (389:17): [True: 0, False: 0]
  ------------------
  390|      0|                *va_arg(ap, uint16_t *) =
  391|      0|                    (uint16_t)((1U << td->td_bitspersample) - 1);
  392|      0|            else
  393|      0|                *va_arg(ap, uint16_t *) = 65535;
  394|      0|            return (1);
  395|    101|        case TIFFTAG_INKSET:
  ------------------
  |  |  322|    101|#define TIFFTAG_INKSET 332                 /* !inks in separated image */
  ------------------
  |  Branch (395:9): [True: 101, False: 20.6k]
  ------------------
  396|    101|            *va_arg(ap, uint16_t *) = INKSET_CMYK;
  ------------------
  |  |  323|    101|#define INKSET_CMYK 1                      /* !cyan-magenta-yellow-black color */
  ------------------
  397|    101|            return 1;
  398|      0|        case TIFFTAG_NUMBEROFINKS:
  ------------------
  |  |  326|      0|#define TIFFTAG_NUMBEROFINKS 334           /* !number of inks */
  ------------------
  |  Branch (398:9): [True: 0, False: 20.7k]
  ------------------
  399|      0|            *va_arg(ap, uint16_t *) = 4;
  400|      0|            return (1);
  401|  3.03k|        case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|  3.03k|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (401:9): [True: 3.03k, False: 17.7k]
  ------------------
  402|  3.03k|            *va_arg(ap, uint16_t *) = td->td_extrasamples;
  403|  3.03k|            *va_arg(ap, const uint16_t **) = td->td_sampleinfo;
  404|  3.03k|            return (1);
  405|      0|        case TIFFTAG_MATTEING:
  ------------------
  |  |  405|      0|#define TIFFTAG_MATTEING 32995   /* $use ExtraSamples */
  ------------------
  |  Branch (405:9): [True: 0, False: 20.7k]
  ------------------
  406|      0|            *va_arg(ap, uint16_t *) =
  407|      0|                (td->td_extrasamples == 1 && td->td_sampleinfo &&
  ------------------
  |  Branch (407:18): [True: 0, False: 0]
  |  Branch (407:46): [True: 0, False: 0]
  ------------------
  408|      0|                 td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
  ------------------
  |  |  331|      0|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (408:18): [True: 0, False: 0]
  ------------------
  409|      0|            return (1);
  410|      0|        case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  408|      0|#define TIFFTAG_TILEDEPTH 32998  /* z depth/data tile */
  ------------------
  |  Branch (410:9): [True: 0, False: 20.7k]
  ------------------
  411|      0|            *va_arg(ap, uint32_t *) = td->td_tiledepth;
  412|      0|            return (1);
  413|      0|        case TIFFTAG_DATATYPE:
  ------------------
  |  |  406|      0|#define TIFFTAG_DATATYPE 32996   /* $use SampleFormat */
  ------------------
  |  Branch (413:9): [True: 0, False: 20.7k]
  ------------------
  414|      0|            *va_arg(ap, uint16_t *) = (uint16_t)(td->td_sampleformat - 1);
  415|      0|            return (1);
  416|      0|        case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  333|      0|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
  |  Branch (416:9): [True: 0, False: 20.7k]
  ------------------
  417|      0|            *va_arg(ap, uint16_t *) = td->td_sampleformat;
  418|      0|            return (1);
  419|      0|        case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  407|      0|#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
  ------------------
  |  Branch (419:9): [True: 0, False: 20.7k]
  ------------------
  420|      0|            *va_arg(ap, uint32_t *) = td->td_imagedepth;
  421|      0|            return (1);
  422|  1.01k|        case TIFFTAG_YCBCRCOEFFICIENTS:
  ------------------
  |  |  387|  1.01k|#define TIFFTAG_YCBCRCOEFFICIENTS 529      /* !RGB -> YCbCr transform */
  ------------------
  |  Branch (422:9): [True: 1.01k, False: 19.7k]
  ------------------
  423|  1.01k|        {
  424|       |            /* defaults are from CCIR Recommendation 601-1 */
  425|  1.01k|            static const float ycbcrcoeffs[] = {0.299f, 0.587f, 0.114f};
  426|  1.01k|            *va_arg(ap, const float **) = ycbcrcoeffs;
  427|  1.01k|            return 1;
  428|      0|        }
  429|  10.7k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|  10.7k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (429:9): [True: 10.7k, False: 9.96k]
  ------------------
  430|  10.7k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[0];
  431|  10.7k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[1];
  432|  10.7k|            return (1);
  433|      0|        case TIFFTAG_YCBCRPOSITIONING:
  ------------------
  |  |  389|      0|#define TIFFTAG_YCBCRPOSITIONING 531       /* !subsample positioning */
  ------------------
  |  Branch (433:9): [True: 0, False: 20.7k]
  ------------------
  434|      0|            *va_arg(ap, uint16_t *) = td->td_ycbcrpositioning;
  435|      0|            return (1);
  436|      7|        case TIFFTAG_WHITEPOINT:
  ------------------
  |  |  307|      7|#define TIFFTAG_WHITEPOINT 318             /* image white point */
  ------------------
  |  Branch (436:9): [True: 7, False: 20.7k]
  ------------------
  437|      7|        {
  438|       |            /* TIFF 6.0 specification tells that it is no default
  439|       |               value for the WhitePoint, but AdobePhotoshop TIFF
  440|       |               Technical Note tells that it should be CIE D50. */
  441|      7|            static const float whitepoint[] = {
  442|      7|                D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  132|      7|#define D50_X0 (96.4250f)
  ------------------
                              D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  132|      7|#define D50_X0 (96.4250f)
  ------------------
                              D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  133|      7|#define D50_Y0 (100.0f)
  ------------------
                              D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
  ------------------
  |  |  134|      7|#define D50_Z0 (82.4680f)
  ------------------
  443|      7|                D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  133|      7|#define D50_Y0 (100.0f)
  ------------------
                              D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  132|      7|#define D50_X0 (96.4250f)
  ------------------
                              D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  133|      7|#define D50_Y0 (100.0f)
  ------------------
                              D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)};
  ------------------
  |  |  134|      7|#define D50_Z0 (82.4680f)
  ------------------
  444|      7|            *va_arg(ap, const float **) = whitepoint;
  445|      7|            return 1;
  446|      0|        }
  447|      0|        case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|      0|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (447:9): [True: 0, False: 20.7k]
  ------------------
  448|      0|            if (!td->td_transferfunction[0] &&
  ------------------
  |  Branch (448:17): [True: 0, False: 0]
  ------------------
  449|      0|                !TIFFDefaultTransferFunction(tif, td))
  ------------------
  |  Branch (449:17): [True: 0, False: 0]
  ------------------
  450|      0|            {
  451|      0|                TIFFErrorExtR(tif, tif->tif_name,
  452|      0|                              "No space for \"TransferFunction\" tag");
  453|      0|                return (0);
  454|      0|            }
  455|      0|            *va_arg(ap, const uint16_t **) = td->td_transferfunction[0];
  456|      0|            if (td->td_samplesperpixel - td->td_extrasamples > 1)
  ------------------
  |  Branch (456:17): [True: 0, False: 0]
  ------------------
  457|      0|            {
  458|      0|                *va_arg(ap, const uint16_t **) = td->td_transferfunction[1];
  459|      0|                *va_arg(ap, const uint16_t **) = td->td_transferfunction[2];
  460|      0|            }
  461|      0|            return (1);
  462|  1.01k|        case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  392|  1.01k|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
  |  Branch (462:9): [True: 1.01k, False: 19.7k]
  ------------------
  463|  1.01k|            if (!td->td_refblackwhite && !TIFFDefaultRefBlackWhite(tif, td))
  ------------------
  |  Branch (463:17): [True: 1.01k, False: 0]
  |  Branch (463:42): [True: 0, False: 1.01k]
  ------------------
  464|      0|                return (0);
  465|  1.01k|            *va_arg(ap, const float **) = td->td_refblackwhite;
  466|  1.01k|            return (1);
  467|      0|        default:
  ------------------
  |  Branch (467:9): [True: 0, False: 20.7k]
  ------------------
  468|      0|            break;
  469|  20.7k|    }
  470|      0|    return 0;
  471|  20.7k|}
TIFFGetFieldDefaulted:
  478|   333k|{
  479|   333k|    int ok;
  480|   333k|    va_list ap;
  481|       |
  482|   333k|    va_start(ap, tag);
  483|   333k|    ok = TIFFVGetFieldDefaulted(tif, tag, ap);
  484|       |    va_end(ap);
  485|   333k|    return (ok);
  486|   333k|}
_TIFFClampDoubleToFloat:
  489|    822|{
  490|    822|    if (val > (double)FLT_MAX)
  ------------------
  |  Branch (490:9): [True: 0, False: 822]
  ------------------
  491|      0|        return FLT_MAX;
  492|    822|    if (val < -(double)FLT_MAX)
  ------------------
  |  Branch (492:9): [True: 0, False: 822]
  ------------------
  493|      0|        return -FLT_MAX;
  494|    822|    return (float)val;
  495|    822|}
_TIFFSeekOK:
  507|   531k|{
  508|       |    /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */
  509|       |    /* See http://bugzilla.maptools.org/show_bug.cgi?id=2726 */
  510|   531k|    return off <= (~(uint64_t)0) / 2 && TIFFSeekFile(tif, off, SEEK_SET) == off;
  ------------------
  |  |  287|   531k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
  |  Branch (510:12): [True: 531k, False: 220]
  |  Branch (510:41): [True: 347k, False: 184k]
  ------------------
  511|   531k|}
tif_aux.c:TIFFDefaultRefBlackWhite:
  265|  1.01k|{
  266|  1.01k|    int i;
  267|       |
  268|  1.01k|    td->td_refblackwhite = (float *)_TIFFmallocExt(tif, 6 * sizeof(float));
  269|  1.01k|    if (td->td_refblackwhite == NULL)
  ------------------
  |  Branch (269:9): [True: 0, False: 1.01k]
  ------------------
  270|      0|        return 0;
  271|  1.01k|    if (td->td_photometric == PHOTOMETRIC_YCBCR)
  ------------------
  |  |  227|  1.01k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (271:9): [True: 1.01k, False: 0]
  ------------------
  272|  1.01k|    {
  273|       |        /*
  274|       |         * YCbCr (Class Y) images must have the ReferenceBlackWhite
  275|       |         * tag set. Fix the broken images, which lacks that tag.
  276|       |         */
  277|  1.01k|        td->td_refblackwhite[0] = 0.0f;
  278|  1.01k|        td->td_refblackwhite[1] = td->td_refblackwhite[3] =
  279|  1.01k|            td->td_refblackwhite[5] = 255.0f;
  280|  1.01k|        td->td_refblackwhite[2] = td->td_refblackwhite[4] = 128.0f;
  281|  1.01k|    }
  282|      0|    else
  283|      0|    {
  284|       |        /*
  285|       |         * Assume RGB (Class R)
  286|       |         */
  287|      0|        for (i = 0; i < 3; i++)
  ------------------
  |  Branch (287:21): [True: 0, False: 0]
  ------------------
  288|      0|        {
  289|      0|            td->td_refblackwhite[2 * i + 0] = 0;
  290|      0|            if (td->td_bitspersample < 64)
  ------------------
  |  Branch (290:17): [True: 0, False: 0]
  ------------------
  291|      0|                td->td_refblackwhite[2 * i + 1] =
  292|      0|                    (float)((1ULL << td->td_bitspersample) - 1ULL);
  293|      0|            else
  294|      0|                td->td_refblackwhite[2 * i + 1] = (float)UINT64_MAX;
  295|      0|        }
  296|      0|    }
  297|  1.01k|    return 1;
  298|  1.01k|}

TIFFCleanup:
   45|  5.98k|{
   46|       |    /*
   47|       |     * Flush buffered data and directory (if dirty).
   48|       |     */
   49|  5.98k|    if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (49:9): [True: 0, False: 5.98k]
  ------------------
   50|      0|        TIFFFlush(tif);
   51|  5.98k|    TIFFFreeDirectory(tif);
   52|       |
   53|  5.98k|    _TIFFCleanupIFDOffsetAndNumberMaps(tif);
   54|       |
   55|       |    /*
   56|       |     * Clean up client info links.
   57|       |     */
   58|  5.98k|    while (tif->tif_clientinfo)
  ------------------
  |  Branch (58:12): [True: 0, False: 5.98k]
  ------------------
   59|      0|    {
   60|      0|        TIFFClientInfoLink *psLink = tif->tif_clientinfo;
   61|       |
   62|      0|        tif->tif_clientinfo = psLink->next;
   63|      0|        _TIFFfreeExt(tif, psLink->name);
   64|      0|        _TIFFfreeExt(tif, psLink);
   65|      0|    }
   66|       |
   67|  5.98k|    if (tif->tif_rawdata && (tif->tif_flags & TIFF_MYBUFFER))
  ------------------
  |  |  128|  3.33k|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (67:9): [True: 3.33k, False: 2.65k]
  |  Branch (67:29): [True: 3.33k, False: 0]
  ------------------
   68|  3.33k|        _TIFFfreeExt(tif, tif->tif_rawdata);
   69|  5.98k|    if (isMapped(tif))
  ------------------
  |  |  279|  5.98k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  5.98k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 5.98k]
  |  |  ------------------
  ------------------
   70|      0|        TIFFUnmapFileContents(tif, tif->tif_base, (toff_t)tif->tif_size);
  ------------------
  |  |  293|      0|    ((*(tif)->tif_unmapproc)((tif)->tif_clientdata, (addr), (size)))
  ------------------
   71|       |
   72|       |    /*
   73|       |     * Clean up custom fields.
   74|       |     */
   75|  5.98k|    if (tif->tif_fields && tif->tif_nfields > 0)
  ------------------
  |  Branch (75:9): [True: 5.98k, False: 3]
  |  Branch (75:28): [True: 5.98k, False: 0]
  ------------------
   76|  5.98k|    {
   77|  5.98k|        uint32_t i;
   78|       |
   79|  1.06M|        for (i = 0; i < tif->tif_nfields; i++)
  ------------------
  |  Branch (79:21): [True: 1.05M, False: 5.98k]
  ------------------
   80|  1.05M|        {
   81|  1.05M|            TIFFField *fld = tif->tif_fields[i];
   82|  1.05M|            if (fld->field_name != NULL)
  ------------------
  |  Branch (82:17): [True: 1.05M, False: 0]
  ------------------
   83|  1.05M|            {
   84|  1.05M|                if (fld->field_bit == FIELD_CUSTOM &&
  ------------------
  |  |  346|  2.11M|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (84:21): [True: 733k, False: 321k]
  ------------------
   85|       |                    /* caution: tif_fields[i] must not be the beginning of a
   86|       |                     * fields-array. Otherwise the following tags are also freed
   87|       |                     * with the first free().
   88|       |                     */
   89|   733k|                    TIFFFieldIsAnonymous(fld))
  ------------------
  |  Branch (89:21): [True: 117k, False: 616k]
  ------------------
   90|   117k|                {
   91|   117k|                    _TIFFfreeExt(tif, (void *)fld->field_name);
   92|   117k|                    _TIFFfreeExt(tif, fld);
   93|   117k|                }
   94|  1.05M|            }
   95|  1.05M|        }
   96|       |
   97|  5.98k|        _TIFFfreeExt(tif, tif->tif_fields);
   98|  5.98k|    }
   99|       |
  100|  5.98k|    if (tif->tif_nfieldscompat > 0)
  ------------------
  |  Branch (100:9): [True: 0, False: 5.98k]
  ------------------
  101|      0|    {
  102|      0|        uint32_t i;
  103|       |
  104|      0|        for (i = 0; i < tif->tif_nfieldscompat; i++)
  ------------------
  |  Branch (104:21): [True: 0, False: 0]
  ------------------
  105|      0|        {
  106|      0|            if (tif->tif_fieldscompat[i].allocated_size)
  ------------------
  |  Branch (106:17): [True: 0, False: 0]
  ------------------
  107|      0|                _TIFFfreeExt(tif, tif->tif_fieldscompat[i].fields);
  108|      0|        }
  109|      0|        _TIFFfreeExt(tif, tif->tif_fieldscompat);
  110|      0|    }
  111|       |
  112|  5.98k|    if (tif->tif_cur_cumulated_mem_alloc != 0)
  ------------------
  |  Branch (112:9): [True: 0, False: 5.98k]
  ------------------
  113|      0|    {
  114|      0|        TIFFErrorExtR(tif, "TIFFCleanup",
  115|      0|                      "tif_cur_cumulated_mem_alloc = %" PRIu64 " whereas it "
  116|      0|                      "should be 0",
  117|      0|                      (uint64_t)tif->tif_cur_cumulated_mem_alloc);
  118|      0|    }
  119|       |
  120|       |    _TIFFfreeExt(NULL, tif);
  121|  5.98k|}
_TIFFCleanupIFDOffsetAndNumberMaps:
  128|  5.98k|{
  129|  5.98k|    if (tif->tif_map_dir_offset_to_number)
  ------------------
  |  Branch (129:9): [True: 5.98k, False: 2]
  ------------------
  130|  5.98k|    {
  131|  5.98k|        TIFFHashSetDestroy(tif->tif_map_dir_offset_to_number);
  132|  5.98k|        tif->tif_map_dir_offset_to_number = NULL;
  133|  5.98k|    }
  134|  5.98k|    if (tif->tif_map_dir_number_to_offset)
  ------------------
  |  Branch (134:9): [True: 5.98k, False: 2]
  ------------------
  135|  5.98k|    {
  136|  5.98k|        TIFFHashSetDestroy(tif->tif_map_dir_number_to_offset);
  137|       |        tif->tif_map_dir_number_to_offset = NULL;
  138|  5.98k|    }
  139|  5.98k|}
TIFFClose:
  156|  4.38k|{
  157|  4.38k|    if (tif != NULL)
  ------------------
  |  Branch (157:9): [True: 4.38k, False: 0]
  ------------------
  158|  4.38k|    {
  159|  4.38k|        TIFFCloseProc closeproc = tif->tif_closeproc;
  160|  4.38k|        thandle_t fd = tif->tif_clientdata;
  161|       |
  162|  4.38k|        TIFFCleanup(tif);
  163|  4.38k|        (void)(*closeproc)(fd);
  164|  4.38k|    }
  165|  4.38k|}

TIFFIsCODECConfigured:
  147|  7.10k|{
  148|  7.10k|    const TIFFCodec *codec = TIFFFindCODEC(scheme);
  149|       |
  150|  7.10k|    if (codec == NULL)
  ------------------
  |  Branch (150:9): [True: 78, False: 7.02k]
  ------------------
  151|     78|    {
  152|     78|        return 0;
  153|     78|    }
  154|  7.02k|    if (codec->init == NULL)
  ------------------
  |  Branch (154:9): [True: 0, False: 7.02k]
  ------------------
  155|      0|    {
  156|      0|        return 0;
  157|      0|    }
  158|  7.02k|    if (codec->init != NotConfigured)
  ------------------
  |  Branch (158:9): [True: 7.02k, False: 1]
  ------------------
  159|  7.02k|    {
  160|  7.02k|        return 1;
  161|  7.02k|    }
  162|      1|    return 0;
  163|  7.02k|}
tif_codec.c:NotConfigured:
  124|      1|{
  125|      1|    (void)scheme;
  126|       |
  127|      1|    tif->tif_fixuptags = _notConfigured;
  128|      1|    tif->tif_decodestatus = FALSE;
  ------------------
  |  |   72|      1|#define FALSE 0
  ------------------
  129|      1|    tif->tif_setupdecode = _notConfigured;
  130|      1|    tif->tif_encodestatus = FALSE;
  ------------------
  |  |   72|      1|#define FALSE 0
  ------------------
  131|      1|    tif->tif_setupencode = _notConfigured;
  132|      1|    return (1);
  133|      1|}
tif_codec.c:_notConfigured:
  111|      2|{
  112|      2|    const TIFFCodec *c = TIFFFindCODEC(tif->tif_dir.td_compression);
  113|      2|    char compression_code[20];
  114|       |
  115|      2|    snprintf(compression_code, sizeof(compression_code), "%" PRIu16,
  116|      2|             tif->tif_dir.td_compression);
  117|      2|    TIFFErrorExtR(tif, tif->tif_name,
  118|      2|                  "%s compression support is not configured",
  119|      2|                  c ? c->name : compression_code);
  ------------------
  |  Branch (119:19): [True: 2, False: 0]
  ------------------
  120|      2|    return (0);
  121|      2|}

TIFFCIELabToXYZ:
   46|   467M|{
   47|       |    /*
   48|       |     * Keep the historical signed a * 256 and b * 256 scaling. Out-of-range
   49|       |     * callers may trigger UBSan signed-overflow reports here, but this
   50|       |     * per-pixel path intentionally does not add extra handling; see !926 for
   51|       |     * details.
   52|       |     */
   53|   467M|    TIFFCIELab16ToXYZ(cielab, l * 257U, a * 256, b * 256, X, Y, Z);
   54|   467M|}
TIFFCIELab16ToXYZ:
   64|   467M|{
   65|   467M|    float L = (float)l * 100.0f / 65535.0f;
   66|   467M|    float cby, tmp;
   67|       |
   68|   467M|    if (L < 8.856f)
  ------------------
  |  Branch (68:9): [True: 467M, False: 38.9k]
  ------------------
   69|   467M|    {
   70|   467M|        *Y = (L * cielab->Y0) / 903.292f;
   71|   467M|        cby = 7.787f * (*Y / cielab->Y0) + 16.0f / 116.0f;
   72|   467M|    }
   73|  38.9k|    else
   74|  38.9k|    {
   75|  38.9k|        cby = (L + 16.0f) / 116.0f;
   76|  38.9k|        *Y = cielab->Y0 * cby * cby * cby;
   77|  38.9k|    }
   78|       |
   79|   467M|    tmp = (float)a / 256.0f / 500.0f + cby;
   80|   467M|    if (tmp < 0.2069f)
  ------------------
  |  Branch (80:9): [True: 467M, False: 42.4k]
  ------------------
   81|   467M|        *X = cielab->X0 * (tmp - 0.13793f) / 7.787f;
   82|  42.4k|    else
   83|  42.4k|        *X = cielab->X0 * tmp * tmp * tmp;
   84|       |
   85|   467M|    tmp = cby - (float)b / 256.0f / 200.0f;
   86|   467M|    if (tmp < 0.2069f)
  ------------------
  |  Branch (86:9): [True: 467M, False: 30.2k]
  ------------------
   87|   467M|        *Z = cielab->Z0 * (tmp - 0.13793f) / 7.787f;
   88|  30.2k|    else
   89|  30.2k|        *Z = cielab->Z0 * tmp * tmp * tmp;
   90|   467M|}
TIFFXYZToRGB:
   98|   467M|{
   99|   467M|    size_t i;
  100|   467M|    float Yr, Yg, Yb;
  101|   467M|    float *matrix = &cielab->display.d_mat[0][0];
  102|       |
  103|       |    /* Multiply through the matrix to get luminosity values. */
  104|   467M|    Yr = matrix[0] * X + matrix[1] * Y + matrix[2] * Z;
  105|   467M|    Yg = matrix[3] * X + matrix[4] * Y + matrix[5] * Z;
  106|   467M|    Yb = matrix[6] * X + matrix[7] * Y + matrix[8] * Z;
  107|       |
  108|       |    /* Clip input */
  109|   467M|    Yr = TIFFmax(Yr, cielab->display.d_Y0R);
  ------------------
  |  |  336|   467M|#define TIFFmax(A, B) ((A) > (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (336:24): [True: 34.6k, False: 467M]
  |  |  ------------------
  ------------------
  110|   467M|    Yg = TIFFmax(Yg, cielab->display.d_Y0G);
  ------------------
  |  |  336|   467M|#define TIFFmax(A, B) ((A) > (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (336:24): [True: 28.3k, False: 467M]
  |  |  ------------------
  ------------------
  111|   467M|    Yb = TIFFmax(Yb, cielab->display.d_Y0B);
  ------------------
  |  |  336|   467M|#define TIFFmax(A, B) ((A) > (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (336:24): [True: 28.5k, False: 467M]
  |  |  ------------------
  ------------------
  112|       |
  113|       |    /* Avoid overflow in case of wrong input values */
  114|   467M|    Yr = TIFFmin(Yr, cielab->display.d_YCR);
  ------------------
  |  |  337|   467M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 467M, False: 4.36k]
  |  |  ------------------
  ------------------
  115|   467M|    Yg = TIFFmin(Yg, cielab->display.d_YCG);
  ------------------
  |  |  337|   467M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 467M, False: 720]
  |  |  ------------------
  ------------------
  116|   467M|    Yb = TIFFmin(Yb, cielab->display.d_YCB);
  ------------------
  |  |  337|   467M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 467M, False: 14.4k]
  |  |  ------------------
  ------------------
  117|       |
  118|       |    /* Turn luminosity to colour value. */
  119|   467M|    i = (size_t)((Yr - cielab->display.d_Y0R) / cielab->rstep);
  120|   467M|    i = TIFFmin((size_t)cielab->range, i);
  ------------------
  |  |  337|   467M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 0, False: 467M]
  |  |  ------------------
  ------------------
  121|   467M|    *r = RINT(cielab->Yr2r[i]);
  ------------------
  |  |   92|   467M|#define RINT(R) ((uint32_t)((R) > 0 ? ((R) + 0.5f) : ((R) - 0.5f)))
  |  |  ------------------
  |  |  |  Branch (92:29): [True: 34.0k, False: 467M]
  |  |  ------------------
  ------------------
  122|       |
  123|   467M|    i = (size_t)((Yg - cielab->display.d_Y0G) / cielab->gstep);
  124|   467M|    i = TIFFmin((size_t)cielab->range, i);
  ------------------
  |  |  337|   467M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 0, False: 467M]
  |  |  ------------------
  ------------------
  125|   467M|    *g = RINT(cielab->Yg2g[i]);
  ------------------
  |  |   92|   467M|#define RINT(R) ((uint32_t)((R) > 0 ? ((R) + 0.5f) : ((R) - 0.5f)))
  |  |  ------------------
  |  |  |  Branch (92:29): [True: 28.3k, False: 467M]
  |  |  ------------------
  ------------------
  126|       |
  127|   467M|    i = (size_t)((Yb - cielab->display.d_Y0B) / cielab->bstep);
  128|   467M|    i = TIFFmin((size_t)cielab->range, i);
  ------------------
  |  |  337|   467M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 0, False: 467M]
  |  |  ------------------
  ------------------
  129|   467M|    *b = RINT(cielab->Yb2b[i]);
  ------------------
  |  |   92|   467M|#define RINT(R) ((uint32_t)((R) > 0 ? ((R) + 0.5f) : ((R) - 0.5f)))
  |  |  ------------------
  |  |  |  Branch (92:29): [True: 28.3k, False: 467M]
  |  |  ------------------
  ------------------
  130|       |
  131|       |    /* Clip output. */
  132|   467M|    *r = TIFFmin(*r, cielab->display.d_Vrwr);
  ------------------
  |  |  337|   467M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 467M, False: 4.47k]
  |  |  ------------------
  ------------------
  133|   467M|    *g = TIFFmin(*g, cielab->display.d_Vrwg);
  ------------------
  |  |  337|   467M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 467M, False: 721]
  |  |  ------------------
  ------------------
  134|   467M|    *b = TIFFmin(*b, cielab->display.d_Vrwb);
  ------------------
  |  |  337|   467M|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 467M, False: 14.4k]
  |  |  ------------------
  ------------------
  135|   467M|}
TIFFCIELabToRGBInit:
  144|      8|{
  145|      8|    size_t i;
  146|      8|    double dfGamma;
  147|       |
  148|      8|    cielab->range = CIELABTORGB_TABLE_RANGE;
  ------------------
  |  |  182|      8|#define CIELABTORGB_TABLE_RANGE 1500
  ------------------
  149|       |
  150|      8|    _TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay));
  151|       |
  152|       |    /* Red */
  153|      8|    dfGamma = 1.0 / (double)cielab->display.d_gammaR;
  154|      8|    cielab->rstep =
  155|      8|        (cielab->display.d_YCR - cielab->display.d_Y0R) / (float)cielab->range;
  156|  12.0k|    for (i = 0; i <= (size_t)cielab->range; i++)
  ------------------
  |  Branch (156:17): [True: 12.0k, False: 8]
  ------------------
  157|  12.0k|    {
  158|  12.0k|        cielab->Yr2r[i] = (float)cielab->display.d_Vrwr *
  159|  12.0k|                          ((float)pow((double)i / cielab->range, dfGamma));
  160|  12.0k|    }
  161|       |
  162|       |    /* Green */
  163|      8|    dfGamma = 1.0 / (double)cielab->display.d_gammaG;
  164|      8|    cielab->gstep =
  165|      8|        (cielab->display.d_YCR - cielab->display.d_Y0R) / (float)cielab->range;
  166|  12.0k|    for (i = 0; i <= (size_t)cielab->range; i++)
  ------------------
  |  Branch (166:17): [True: 12.0k, False: 8]
  ------------------
  167|  12.0k|    {
  168|  12.0k|        cielab->Yg2g[i] = (float)cielab->display.d_Vrwg *
  169|  12.0k|                          ((float)pow((double)i / cielab->range, dfGamma));
  170|  12.0k|    }
  171|       |
  172|       |    /* Blue */
  173|      8|    dfGamma = 1.0 / (double)cielab->display.d_gammaB;
  174|      8|    cielab->bstep =
  175|      8|        (cielab->display.d_YCR - cielab->display.d_Y0R) / (float)cielab->range;
  176|  12.0k|    for (i = 0; i <= (size_t)cielab->range; i++)
  ------------------
  |  Branch (176:17): [True: 12.0k, False: 8]
  ------------------
  177|  12.0k|    {
  178|  12.0k|        cielab->Yb2b[i] = (float)cielab->display.d_Vrwb *
  179|  12.0k|                          ((float)pow((double)i / cielab->range, dfGamma));
  180|  12.0k|    }
  181|       |
  182|       |    /* Init reference white point */
  183|      8|    cielab->X0 = refWhite[0];
  184|      8|    cielab->Y0 = refWhite[1];
  185|      8|    cielab->Z0 = refWhite[2];
  186|       |
  187|      8|    return 0;
  188|      8|}
TIFFYCbCrtoRGB:
  208|   270M|{
  209|   270M|    int32_t i;
  210|       |
  211|       |    /* XXX: Only 8-bit YCbCr input supported for now */
  212|   270M|    Y = HICLAMP(Y, 255);
  ------------------
  |  |  204|   270M|#define HICLAMP(f, max) ((f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (204:26): [True: 0, False: 270M]
  |  |  ------------------
  ------------------
  213|   270M|    Cb = CLAMP(Cb, 0, 255);
  ------------------
  |  |  203|   270M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 0, False: 270M]
  |  |  |  Branch (203:34): [True: 0, False: 270M]
  |  |  ------------------
  ------------------
  214|   270M|    Cr = CLAMP(Cr, 0, 255);
  ------------------
  |  |  203|   270M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 0, False: 270M]
  |  |  |  Branch (203:34): [True: 0, False: 270M]
  |  |  ------------------
  ------------------
  215|       |
  216|   270M|    i = ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr];
  217|   270M|    *r = (uint32_t)CLAMP(i, 0, 255);
  ------------------
  |  |  203|   270M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 263M, False: 6.39M]
  |  |  |  Branch (203:34): [True: 593k, False: 5.79M]
  |  |  ------------------
  ------------------
  218|   270M|    i = ycbcr->Y_tab[Y] +
  219|   270M|        ((ycbcr->Cb_g_tab[Cb] + ycbcr->Cr_g_tab[Cr]) >> SHIFT);
  ------------------
  |  |  195|   270M|#define SHIFT 16
  ------------------
  220|   270M|    *g = (uint32_t)CLAMP(i, 0, 255);
  ------------------
  |  |  203|   270M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 411k, False: 269M]
  |  |  |  Branch (203:34): [True: 71.1M, False: 198M]
  |  |  ------------------
  ------------------
  221|   270M|    i = ycbcr->Y_tab[Y] + ycbcr->Cb_b_tab[Cb];
  222|   270M|    *b = (uint32_t)CLAMP(i, 0, 255);
  ------------------
  |  |  203|   270M|    ((!((f) >= (min))) ? (min) : (f) > (max) ? (max) : (f))
  |  |  ------------------
  |  |  |  Branch (203:6): [True: 254M, False: 15.9M]
  |  |  |  Branch (203:34): [True: 861k, False: 15.0M]
  |  |  ------------------
  ------------------
  223|   270M|}
TIFFYCbCrToRGBInit:
  259|  1.02k|{
  260|  1.02k|    TIFFRGBValue *clamptab;
  261|  1.02k|    int i;
  262|       |
  263|  1.02k|#define LumaRed luma[0]
  264|  1.02k|#define LumaGreen luma[1]
  265|  1.02k|#define LumaBlue luma[2]
  266|       |
  267|  1.02k|    clamptab =
  268|  1.02k|        (uint8_t *)ycbcr + TIFFroundup_32(sizeof(TIFFYCbCrToRGB), sizeof(long));
  ------------------
  |  |  322|  1.02k|#define TIFFroundup_32(x, y) ((uint32_t)(TIFFhowmany_32(x, y) * (uint32_t)(y)))
  |  |  ------------------
  |  |  |  |  312|  1.02k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (312:6): [True: 1.02k, Folded]
  |  |  |  |  ------------------
  |  |  |  |  313|  1.02k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  |  |  314|  1.02k|         : 0U)
  |  |  ------------------
  ------------------
  269|  1.02k|    _TIFFmemset(clamptab, 0, 256); /* v < 0 => 0 */
  270|  1.02k|    ycbcr->clamptab = (clamptab += 256);
  271|   262k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (271:17): [True: 261k, False: 1.02k]
  ------------------
  272|   261k|        clamptab[i] = (TIFFRGBValue)i;
  273|  1.02k|    _TIFFmemset(clamptab + 256, 255, 2 * 256); /* v > 255 => 255 */
  274|  1.02k|    ycbcr->Cr_r_tab = (int *)(clamptab + 3 * 256);
  275|  1.02k|    ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;
  276|  1.02k|    ycbcr->Cr_g_tab = (int32_t *)(ycbcr->Cb_b_tab + 256);
  277|  1.02k|    ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;
  278|  1.02k|    ycbcr->Y_tab = ycbcr->Cb_g_tab + 256;
  279|       |
  280|  1.02k|    {
  281|  1.02k|        float f1 = 2 - 2 * LumaRed;
  ------------------
  |  |  263|  1.02k|#define LumaRed luma[0]
  ------------------
  282|  1.02k|        int32_t D1 = FIX(CLAMP(f1, 0.0f, 2.0f));
  ------------------
  |  |  196|  4.08k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  1.02k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 0, False: 1.02k]
  |  |  |  Branch (196:36): [True: 1, False: 1.02k]
  |  |  ------------------
  ------------------
  283|  1.02k|        float f2 = LumaRed * f1 / LumaGreen;
  ------------------
  |  |  263|  1.02k|#define LumaRed luma[0]
  ------------------
                      float f2 = LumaRed * f1 / LumaGreen;
  ------------------
  |  |  264|  1.02k|#define LumaGreen luma[1]
  ------------------
  284|  1.02k|        int32_t D2 = -FIX(CLAMP(f2, 0.0f, 2.0f));
  ------------------
  |  |  196|  4.08k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  1.02k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 0, False: 1.02k]
  |  |  |  Branch (196:36): [True: 1, False: 1.02k]
  |  |  ------------------
  ------------------
  285|  1.02k|        float f3 = 2 - 2 * LumaBlue;
  ------------------
  |  |  265|  1.02k|#define LumaBlue luma[2]
  ------------------
  286|  1.02k|        int32_t D3 = FIX(CLAMP(f3, 0.0f, 2.0f));
  ------------------
  |  |  196|  4.08k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  1.02k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 0, False: 1.02k]
  |  |  |  Branch (196:36): [True: 0, False: 1.02k]
  |  |  ------------------
  ------------------
  287|  1.02k|        float f4 = LumaBlue * f3 / LumaGreen;
  ------------------
  |  |  265|  1.02k|#define LumaBlue luma[2]
  ------------------
                      float f4 = LumaBlue * f3 / LumaGreen;
  ------------------
  |  |  264|  1.02k|#define LumaGreen luma[1]
  ------------------
  288|  1.02k|        int32_t D4 = -FIX(CLAMP(f4, 0.0f, 2.0f));
  ------------------
  |  |  196|  4.08k|#define FIX(x) ((int32_t)((double)(x) * (1L << SHIFT) + 0.5))
  |  |  ------------------
  |  |  |  |  195|  1.02k|#define SHIFT 16
  |  |  ------------------
  |  |  |  Branch (196:36): [True: 0, False: 1.02k]
  |  |  |  Branch (196:36): [True: 0, False: 1.02k]
  |  |  ------------------
  ------------------
  289|  1.02k|        int x;
  290|       |
  291|  1.02k|#undef LumaBlue
  292|  1.02k|#undef LumaGreen
  293|  1.02k|#undef LumaRed
  294|       |
  295|       |        /*
  296|       |         * i is the actual input pixel value in the range 0..255
  297|       |         * Cb and Cr values are in the range -128..127 (actually
  298|       |         * they are in a range defined by the ReferenceBlackWhite
  299|       |         * tag) so there is some range shifting to do here when
  300|       |         * constructing tables indexed by the raw pixel data.
  301|       |         */
  302|   262k|        for (i = 0, x = -128; i < 256; i++, x++)
  ------------------
  |  Branch (302:31): [True: 261k, False: 1.02k]
  ------------------
  303|   261k|        {
  304|   261k|            int32_t Cr = (int32_t)CLAMPw(Code2V(x, refBlackWhite[4] - 128.0f,
  ------------------
  |  |  199|   261k|    (((float)((c) - (int32_t)(RB)) * (float)(CR)) /                            \
  |  |  200|   261k|     ((!TIFF_FLOAT_EQ((RW), (RB))) ? ((RW) - (RB)) : 1.0f))
  |  |  ------------------
  |  |  |  |  342|   261k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (200:7): [True: 261k, False: 0]
  |  |  ------------------
  ------------------
  305|   261k|                                                refBlackWhite[5] - 128.0f, 127),
  306|   261k|                                         -128.0f * 32, 128.0f * 32);
  307|   261k|            int32_t Cb = (int32_t)CLAMPw(Code2V(x, refBlackWhite[2] - 128.0f,
  ------------------
  |  |  199|   261k|    (((float)((c) - (int32_t)(RB)) * (float)(CR)) /                            \
  |  |  200|   261k|     ((!TIFF_FLOAT_EQ((RW), (RB))) ? ((RW) - (RB)) : 1.0f))
  |  |  ------------------
  |  |  |  |  342|   261k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (200:7): [True: 261k, False: 0]
  |  |  ------------------
  ------------------
  308|   261k|                                                refBlackWhite[3] - 128.0f, 127),
  309|   261k|                                         -128.0f * 32, 128.0f * 32);
  310|       |
  311|   261k|            ycbcr->Cr_r_tab[i] = (int32_t)((D1 * Cr + ONE_HALF) >> SHIFT);
  ------------------
  |  |  197|   261k|#define ONE_HALF ((int32_t)(1 << (SHIFT - 1)))
  |  |  ------------------
  |  |  |  |  195|   261k|#define SHIFT 16
  |  |  ------------------
  ------------------
                          ycbcr->Cr_r_tab[i] = (int32_t)((D1 * Cr + ONE_HALF) >> SHIFT);
  ------------------
  |  |  195|   261k|#define SHIFT 16
  ------------------
  312|   261k|            ycbcr->Cb_b_tab[i] = (int32_t)((D3 * Cb + ONE_HALF) >> SHIFT);
  ------------------
  |  |  197|   261k|#define ONE_HALF ((int32_t)(1 << (SHIFT - 1)))
  |  |  ------------------
  |  |  |  |  195|   261k|#define SHIFT 16
  |  |  ------------------
  ------------------
                          ycbcr->Cb_b_tab[i] = (int32_t)((D3 * Cb + ONE_HALF) >> SHIFT);
  ------------------
  |  |  195|   261k|#define SHIFT 16
  ------------------
  313|   261k|            ycbcr->Cr_g_tab[i] = D2 * Cr;
  314|   261k|            ycbcr->Cb_g_tab[i] = D4 * Cb + ONE_HALF;
  ------------------
  |  |  197|   261k|#define ONE_HALF ((int32_t)(1 << (SHIFT - 1)))
  |  |  ------------------
  |  |  |  |  195|   261k|#define SHIFT 16
  |  |  ------------------
  ------------------
  315|   261k|            ycbcr->Y_tab[i] = (int32_t)CLAMPw(
  316|   261k|                Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255),
  ------------------
  |  |  199|   261k|    (((float)((c) - (int32_t)(RB)) * (float)(CR)) /                            \
  |  |  200|   261k|     ((!TIFF_FLOAT_EQ((RW), (RB))) ? ((RW) - (RB)) : 1.0f))
  |  |  ------------------
  |  |  |  |  342|   261k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (200:7): [True: 261k, False: 0]
  |  |  ------------------
  ------------------
  317|   261k|                -128.0f * 32, 128.0f * 32);
  318|   261k|        }
  319|  1.02k|    }
  320|       |
  321|  1.02k|    return 0;
  322|  1.02k|}
tif_color.c:CLAMPw:
  228|   784k|{
  229|   784k|    if (v < vmin)
  ------------------
  |  Branch (229:9): [True: 1.40k, False: 783k]
  ------------------
  230|  1.40k|    {
  231|       |        /* printf("%f clamped to %f\n", v, vmin); */
  232|  1.40k|        return vmin;
  233|  1.40k|    }
  234|   783k|    if (v > vmax)
  ------------------
  |  Branch (234:9): [True: 1.30k, False: 782k]
  ------------------
  235|  1.30k|    {
  236|       |        /* printf("%f clamped to %f\n", v, vmax); */
  237|  1.30k|        return vmax;
  238|  1.30k|    }
  239|   782k|    return v;
  240|   783k|}

_TIFFNoRowDecode:
   97|      3|{
   98|      3|    (void)pp;
   99|      3|    (void)cc;
  100|      3|    (void)s;
  101|      3|    return (TIFFNoDecode(tif, "scanline"));
  102|      3|}
_TIFFNoStripDecode:
  105|     51|{
  106|     51|    (void)pp;
  107|     51|    (void)cc;
  108|     51|    (void)s;
  109|     51|    return (TIFFNoDecode(tif, "strip"));
  110|     51|}
_TIFFNoTileDecode:
  113|    434|{
  114|    434|    (void)pp;
  115|    434|    (void)cc;
  116|    434|    (void)s;
  117|    434|    return (TIFFNoDecode(tif, "tile"));
  118|    434|}
_TIFFNoPreCode:
  129|  1.65k|{
  130|  1.65k|    (void)tif;
  131|  1.65k|    (void)s;
  132|  1.65k|    return (1);
  133|  1.65k|}
_TIFFSetDefaultCompressionState:
  155|  22.6k|{
  156|  22.6k|    tif->tif_fixuptags = _TIFFNoFixupTags;
  157|  22.6k|    tif->tif_decodestatus = TRUE;
  ------------------
  |  |   71|  22.6k|#define TRUE 1
  ------------------
  158|  22.6k|    tif->tif_setupdecode = _TIFFtrue;
  159|  22.6k|    tif->tif_predecode = _TIFFNoPreCode;
  160|  22.6k|    tif->tif_decoderow = _TIFFNoRowDecode;
  161|  22.6k|    tif->tif_decodestrip = _TIFFNoStripDecode;
  162|  22.6k|    tif->tif_decodetile = _TIFFNoTileDecode;
  163|  22.6k|    tif->tif_encodestatus = TRUE;
  ------------------
  |  |   71|  22.6k|#define TRUE 1
  ------------------
  164|  22.6k|    tif->tif_setupencode = _TIFFtrue;
  165|  22.6k|    tif->tif_preencode = _TIFFNoPreCode;
  166|  22.6k|    tif->tif_postencode = _TIFFtrue;
  167|  22.6k|    tif->tif_encoderow = _TIFFNoRowEncode;
  168|  22.6k|    tif->tif_encodestrip = _TIFFNoStripEncode;
  169|  22.6k|    tif->tif_encodetile = _TIFFNoTileEncode;
  170|  22.6k|    tif->tif_close = _TIFFvoid;
  171|  22.6k|    tif->tif_seek = _TIFFNoSeek;
  172|  22.6k|    tif->tif_cleanup = _TIFFvoid;
  173|  22.6k|    tif->tif_defstripsize = _TIFFDefaultStripSize;
  174|  22.6k|    tif->tif_deftilesize = _TIFFDefaultTileSize;
  175|  22.6k|    tif->tif_getmaxcompressionratio = _TIFFDefaultGetMaxCompressionRatio;
  176|  22.6k|    tif->tif_flags &= ~(TIFF_NOBITREV | TIFF_NOREADRAW);
  ------------------
  |  |  127|  22.6k|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
                  tif->tif_flags &= ~(TIFF_NOBITREV | TIFF_NOREADRAW);
  ------------------
  |  |  138|  22.6k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  177|  22.6k|}
TIFFSetCompressionScheme:
  180|  11.4k|{
  181|  11.4k|    const TIFFCodec *c = TIFFFindCODEC((uint16_t)scheme);
  182|       |
  183|  11.4k|    _TIFFSetDefaultCompressionState(tif);
  184|  11.4k|    if (scheme == COMPRESSION_NONE)
  ------------------
  |  |  182|  11.4k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (184:9): [True: 5.98k, False: 5.44k]
  ------------------
  185|  5.98k|        tif->tif_getmaxcompressionratio = _TIFFGetMaxCompressionRatioOne;
  186|       |    /*
  187|       |     * Don't treat an unknown compression scheme as an error.
  188|       |     * This permits applications to open files with data that
  189|       |     * the library does not have builtin support for, but which
  190|       |     * may still be meaningful.
  191|       |     */
  192|  11.4k|    return (c ? (*c->init)(tif, scheme) : 1);
  ------------------
  |  Branch (192:13): [True: 11.3k, False: 102]
  ------------------
  193|  11.4k|}
TIFFGetMaxCompressionRatio:
  196|    446|{
  197|    446|    if (tif->tif_getmaxcompressionratio)
  ------------------
  |  Branch (197:9): [True: 446, False: 0]
  ------------------
  198|    446|        return tif->tif_getmaxcompressionratio(tif);
  199|      0|    return 0;
  200|    446|}
TIFFFindCODEC:
  215|  19.0k|{
  216|  19.0k|    const TIFFCodec *c;
  217|  19.0k|    codec_t *cd;
  218|       |
  219|  19.0k|    for (cd = registeredCODECS; cd; cd = cd->next)
  ------------------
  |  Branch (219:33): [True: 0, False: 19.0k]
  ------------------
  220|      0|        if (cd->info->scheme == scheme)
  ------------------
  |  Branch (220:13): [True: 0, False: 0]
  ------------------
  221|      0|            return ((const TIFFCodec *)cd->info);
  222|   101k|    for (c = _TIFFBuiltinCODECS; c->name; c++)
  ------------------
  |  Branch (222:34): [True: 101k, False: 339]
  ------------------
  223|   101k|        if (c->scheme == scheme)
  ------------------
  |  Branch (223:13): [True: 18.6k, False: 82.7k]
  ------------------
  224|  18.6k|            return (c);
  225|    339|    return NULL;
  226|  19.0k|}
tif_compress.c:TIFFNoDecode:
   76|    488|{
   77|    488|    const TIFFCodec *c = TIFFFindCODEC(tif->tif_dir.td_compression);
   78|       |
   79|    488|    if (c)
  ------------------
  |  Branch (79:9): [True: 329, False: 159]
  ------------------
   80|    329|        TIFFErrorExtR(tif, tif->tif_name, "%s %s decoding is not implemented",
   81|    329|                      c->name, method);
   82|    159|    else
   83|    159|        TIFFErrorExtR(tif, tif->tif_name,
   84|    159|                      "Compression scheme %" PRIu16
   85|    159|                      " %s decoding is not implemented",
   86|    159|                      tif->tif_dir.td_compression, method);
   87|    488|    return (0);
   88|    488|}
tif_compress.c:_TIFFNoFixupTags:
   91|    126|{
   92|    126|    (void)tif;
   93|    126|    return (1);
   94|    126|}
tif_compress.c:_TIFFtrue:
  136|    313|{
  137|    313|    (void)tif;
  138|    313|    return (1);
  139|    313|}
tif_compress.c:_TIFFvoid:
  140|  12.1k|static void _TIFFvoid(TIFF *tif) { (void)tif; }
tif_compress.c:_TIFFDefaultGetMaxCompressionRatio:
  143|    175|{
  144|    175|    (void)tif;
  145|    175|    return 0; /* unknown */
  146|    175|}
tif_compress.c:_TIFFGetMaxCompressionRatioOne:
  149|      9|{
  150|      9|    (void)tif;
  151|      9|    return 1; /* no compression */
  152|      9|}

_TIFFsetByteArrayExt:
   67|    748|{
   68|    748|    setByteArray(tif, vpp, vp, n, 1);
   69|    748|}
_TIFFsetShortArrayExt:
   82|    866|{
   83|    866|    setByteArray(tif, (void **)wpp, wp, n, sizeof(uint16_t));
   84|    866|}
_TIFFsetFloatArrayExt:
  107|      7|{
  108|      7|    setByteArray(tif, (void **)fpp, fp, n, sizeof(float));
  109|      7|}
_TIFFsetDoubleArrayExt:
  117|    208|{
  118|    208|    setByteArray(tif, (void **)dpp, dp, n, sizeof(double));
  119|    208|}
TIFFSetField:
 1168|  69.9k|{
 1169|  69.9k|    va_list ap;
 1170|  69.9k|    int status;
 1171|       |
 1172|  69.9k|    va_start(ap, tag);
 1173|  69.9k|    status = TIFFVSetField(tif, tag, ap);
 1174|       |    va_end(ap);
 1175|  69.9k|    return (status);
 1176|  69.9k|}
TIFFVSetField:
 1227|  69.9k|{
 1228|  69.9k|    return OkToChangeTag(tif, tag)
  ------------------
  |  Branch (1228:12): [True: 69.9k, False: 0]
  ------------------
 1229|  69.9k|               ? (*tif->tif_tagmethods.vsetfield)(tif, tag, ap)
 1230|  69.9k|               : 0;
 1231|  69.9k|}
TIFFGetField:
 1608|  38.2k|{
 1609|  38.2k|    int status;
 1610|  38.2k|    va_list ap;
 1611|       |
 1612|  38.2k|    va_start(ap, tag);
 1613|  38.2k|    status = TIFFVGetField(tif, tag, ap);
 1614|       |    va_end(ap);
 1615|  38.2k|    return (status);
 1616|  38.2k|}
TIFFVGetField:
 1625|   371k|{
 1626|   371k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  341|   371k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
 1627|   371k|    return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit))
  ------------------
  |  |  276|   743k|#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (276:24): [True: 0, False: 371k]
  |  |  ------------------
  ------------------
                  return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit))
  ------------------
  |  |  248|   371k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|   371k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|   371k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 346k, False: 25.2k]
  |  |  ------------------
  ------------------
  |  Branch (1627:13): [True: 371k, False: 0]
  ------------------
 1628|   371k|                ? (*tif->tif_tagmethods.vgetfield)(tif, tag, ap)
 1629|   371k|                : 0);
 1630|   371k|}
_TIFFResetTifDirAndInitStrileCounters:
 1646|  11.9k|{
 1647|  11.9k|    _TIFFmemset(td, 0, sizeof(*td));
 1648|  11.9k|    td->td_curstrip = NOSTRIP;      /* invalid strip = NOSTRIP */
  ------------------
  |  |  111|  11.9k|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
 1649|  11.9k|    td->td_row = (uint32_t)-1;      /* read/write pre-increment */
 1650|  11.9k|    td->td_col = (uint32_t)-1;      /* read/write pre-increment */
 1651|  11.9k|    td->td_scanlinesize = 0;        /* initialize to zero */
 1652|  11.9k|    td->td_curtile = NOTILE;        /* invalid tile = NOTILE */
  ------------------
  |  |  116|  11.9k|#define NOTILE ((uint32_t)(-1)) /* undefined state */
  ------------------
 1653|  11.9k|    td->td_tilesize = (tmsize_t)-1; /* invalidate tilezize */
 1654|  11.9k|}
TIFFFreeDirectory:
 1660|  11.9k|{
 1661|  11.9k|    TIFFDirectory *td = &tif->tif_dir;
 1662|  11.9k|    int i;
 1663|       |
 1664|  11.9k|    (*tif->tif_cleanup)(tif);
 1665|  11.9k|    _TIFFmemset(td->td_fieldsset, 0, sizeof(td->td_fieldsset));
 1666|  11.9k|    CleanupField(td_sminsamplevalue);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 194, False: 11.7k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|    194|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|    194|            td->member = 0;                                                    \
  |  | 1638|    194|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1667|  11.9k|    CleanupField(td_smaxsamplevalue);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 11, False: 11.9k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|     11|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|     11|            td->member = 0;                                                    \
  |  | 1638|     11|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1668|  11.9k|    CleanupField(td_colormap[0]);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 40, False: 11.9k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|     40|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|     40|            td->member = 0;                                                    \
  |  | 1638|     40|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1669|  11.9k|    CleanupField(td_colormap[1]);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 40, False: 11.9k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|     40|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|     40|            td->member = 0;                                                    \
  |  | 1638|     40|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1670|  11.9k|    CleanupField(td_colormap[2]);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 40, False: 11.9k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|     40|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|     40|            td->member = 0;                                                    \
  |  | 1638|     40|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1671|  11.9k|    CleanupField(td_sampleinfo);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 681, False: 11.2k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|    681|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|    681|            td->member = 0;                                                    \
  |  | 1638|    681|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1672|  11.9k|    CleanupField(td_subifd);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 2, False: 11.9k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|      2|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|      2|            td->member = 0;                                                    \
  |  | 1638|      2|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1673|  11.9k|    CleanupField(td_inknames);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 11, False: 11.9k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|     11|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|     11|            td->member = 0;                                                    \
  |  | 1638|     11|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1674|  11.9k|    CleanupField(td_refblackwhite);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 1.02k, False: 10.9k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|  1.02k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|  1.02k|            td->member = 0;                                                    \
  |  | 1638|  1.02k|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1675|  11.9k|    CleanupField(td_transferfunction[0]);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 3, False: 11.9k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|      3|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|      3|            td->member = 0;                                                    \
  |  | 1638|      3|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1676|  11.9k|    CleanupField(td_transferfunction[1]);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 0, False: 11.9k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|      0|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|      0|            td->member = 0;                                                    \
  |  | 1638|      0|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1677|  11.9k|    CleanupField(td_transferfunction[2]);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 0, False: 11.9k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|      0|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|      0|            td->member = 0;                                                    \
  |  | 1638|      0|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1678|  11.9k|    CleanupField(td_stripoffset_p);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 5.50k, False: 6.46k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|  5.50k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|  5.50k|            td->member = 0;                                                    \
  |  | 1638|  5.50k|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1679|  11.9k|    CleanupField(td_stripbytecount_p);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 5.21k, False: 6.75k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|  5.21k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|  5.21k|            td->member = 0;                                                    \
  |  | 1638|  5.21k|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1680|  11.9k|    td->td_stripoffsetbyteallocsize = 0;
 1681|  11.9k|    TIFFClrFieldBit(tif, FIELD_YCBCRSUBSAMPLING);
  ------------------
  |  |  250|  11.9k|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  247|  11.9k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  246|  11.9k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1682|  11.9k|    TIFFClrFieldBit(tif, FIELD_YCBCRPOSITIONING);
  ------------------
  |  |  250|  11.9k|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  247|  11.9k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  246|  11.9k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1683|       |
 1684|       |    /* Cleanup custom tag values */
 1685|  23.9k|    for (i = 0; i < td->td_customValueCount; i++)
  ------------------
  |  Branch (1685:17): [True: 11.9k, False: 11.9k]
  ------------------
 1686|  11.9k|    {
 1687|  11.9k|        if (td->td_customValues[i].value)
  ------------------
  |  Branch (1687:13): [True: 10.0k, False: 1.85k]
  ------------------
 1688|  10.0k|            _TIFFfreeExt(tif, td->td_customValues[i].value);
 1689|  11.9k|    }
 1690|       |
 1691|  11.9k|    td->td_customValueCount = 0;
 1692|  11.9k|    CleanupField(td_customValues);
  ------------------
  |  | 1633|  11.9k|    {                                                                          \
  |  | 1634|  11.9k|        if (td->member)                                                        \
  |  |  ------------------
  |  |  |  Branch (1634:13): [True: 3.50k, False: 8.46k]
  |  |  ------------------
  |  | 1635|  11.9k|        {                                                                      \
  |  | 1636|  3.50k|            _TIFFfreeExt(tif, td->member);                                     \
  |  | 1637|  3.50k|            td->member = 0;                                                    \
  |  | 1638|  3.50k|        }                                                                      \
  |  | 1639|  11.9k|    }
  ------------------
 1693|       |
 1694|  11.9k|    _TIFFmemset(&(td->td_stripoffset_entry), 0, sizeof(TIFFDirEntry));
 1695|  11.9k|    _TIFFmemset(&(td->td_stripbytecount_entry), 0, sizeof(TIFFDirEntry));
 1696|       |
 1697|       |    /* Reset some internal parameters for IFD data size checking. */
 1698|  11.9k|    tif->tif_dir.td_dirdatasize_read = 0;
 1699|  11.9k|    tif->tif_dir.td_dirdatasize_write = 0;
 1700|  11.9k|    if (tif->tif_dir.td_dirdatasize_offsets != NULL)
  ------------------
  |  Branch (1700:9): [True: 5.98k, False: 5.98k]
  ------------------
 1701|  5.98k|    {
 1702|  5.98k|        _TIFFfreeExt(tif, tif->tif_dir.td_dirdatasize_offsets);
 1703|  5.98k|        tif->tif_dir.td_dirdatasize_offsets = NULL;
 1704|  5.98k|        tif->tif_dir.td_dirdatasize_Noffsets = 0;
 1705|  5.98k|    }
 1706|  11.9k|    tif->tif_dir.td_iswrittentofile = FALSE;
  ------------------
  |  |   72|  11.9k|#define FALSE 0
  ------------------
 1707|       |    /* Note: tif->tif_dir structure is set to zero in TIFFDefaultDirectory() */
 1708|  11.9k|}
TIFFDefaultDirectory:
 1788|  5.98k|{
 1789|  5.98k|    TIFFDirectory *td = &tif->tif_dir;
 1790|  5.98k|    const TIFFFieldArray *tiffFieldArray;
 1791|       |
 1792|  5.98k|    tiffFieldArray = _TIFFGetFields();
 1793|  5.98k|    _TIFFSetupFields(tif, tiffFieldArray);
 1794|       |    /* Reset tif->tif_dir structure to zero and
 1795|       |     * initialize some IFD strile counter and index parameters. */
 1796|  5.98k|    _TIFFResetTifDirAndInitStrileCounters(td);
 1797|  5.98k|    td->td_fillorder = FILLORDER_MSB2LSB;
  ------------------
  |  |  241|  5.98k|#define FILLORDER_MSB2LSB 1                /* most significant -> least */
  ------------------
 1798|  5.98k|    td->td_bitspersample = 1;
 1799|  5.98k|    td->td_threshholding = THRESHHOLD_BILEVEL;
  ------------------
  |  |  235|  5.98k|#define THRESHHOLD_BILEVEL 1               /* b&w art scan */
  ------------------
 1800|  5.98k|    td->td_orientation = ORIENTATION_TOPLEFT;
  ------------------
  |  |  249|  5.98k|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
 1801|  5.98k|    td->td_samplesperpixel = 1;
 1802|  5.98k|    td->td_rowsperstrip = (uint32_t)-1;
 1803|  5.98k|    td->td_tilewidth = 0;
 1804|  5.98k|    td->td_tilelength = 0;
 1805|  5.98k|    td->td_tiledepth = 1;
 1806|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 1807|       |    td->td_stripbytecountsorted = 1; /* Our own arrays always sorted. */
 1808|       |#endif
 1809|  5.98k|    td->td_resolutionunit = RESUNIT_INCH;
  ------------------
  |  |  289|  5.98k|#define RESUNIT_INCH 2                     /* english */
  ------------------
 1810|  5.98k|    td->td_sampleformat = SAMPLEFORMAT_UINT;
  ------------------
  |  |  334|  5.98k|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
 1811|  5.98k|    td->td_imagedepth = 1;
 1812|  5.98k|    td->td_ycbcrsubsampling[0] = 2;
 1813|  5.98k|    td->td_ycbcrsubsampling[1] = 2;
 1814|  5.98k|    td->td_ycbcrpositioning = YCBCRPOSITION_CENTERED;
  ------------------
  |  |  390|  5.98k|#define YCBCRPOSITION_CENTERED 1           /* !as in PostScript Level 2 */
  ------------------
 1815|  5.98k|    tif->tif_postdecode = _TIFFNoPostDecode;
 1816|  5.98k|    tif->tif_foundfield = NULL;
 1817|  5.98k|    tif->tif_tagmethods.vsetfield = _TIFFVSetField;
 1818|  5.98k|    tif->tif_tagmethods.vgetfield = _TIFFVGetField;
 1819|  5.98k|    tif->tif_tagmethods.printdir = NULL;
 1820|       |    /* additional default values */
 1821|  5.98k|    td->td_planarconfig = PLANARCONFIG_CONTIG;
  ------------------
  |  |  265|  5.98k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
 1822|  5.98k|    td->td_compression = COMPRESSION_NONE;
  ------------------
  |  |  182|  5.98k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
 1823|  5.98k|    td->td_subfiletype = 0;
 1824|  5.98k|    td->td_minsamplevalue = 0;
 1825|       |    /* td_bitspersample=1 is always set in TIFFDefaultDirectory().
 1826|       |     * Therefore, td_maxsamplevalue has to be re-calculated in
 1827|       |     * TIFFGetFieldDefaulted(). */
 1828|  5.98k|    td->td_maxsamplevalue = 1; /* Default for td_bitspersample=1 */
 1829|  5.98k|    td->td_extrasamples = 0;
 1830|  5.98k|    td->td_sampleinfo = NULL;
 1831|       |
 1832|       |    /*
 1833|       |     *  Give client code a chance to install their own
 1834|       |     *  tag extensions & methods, prior to compression overloads,
 1835|       |     *  but do some prior cleanup first.
 1836|       |     * (http://trac.osgeo.org/gdal/ticket/5054)
 1837|       |     */
 1838|  5.98k|    if (tif->tif_nfieldscompat > 0)
  ------------------
  |  Branch (1838:9): [True: 0, False: 5.98k]
  ------------------
 1839|      0|    {
 1840|      0|        uint32_t i;
 1841|       |
 1842|      0|        for (i = 0; i < tif->tif_nfieldscompat; i++)
  ------------------
  |  Branch (1842:21): [True: 0, False: 0]
  ------------------
 1843|      0|        {
 1844|      0|            if (tif->tif_fieldscompat[i].allocated_size)
  ------------------
  |  Branch (1844:17): [True: 0, False: 0]
  ------------------
 1845|      0|                _TIFFfreeExt(tif, tif->tif_fieldscompat[i].fields);
 1846|      0|        }
 1847|      0|        _TIFFfreeExt(tif, tif->tif_fieldscompat);
 1848|      0|        tif->tif_nfieldscompat = 0;
 1849|      0|        tif->tif_fieldscompat = NULL;
 1850|      0|    }
 1851|  5.98k|    if (_TIFFextender)
  ------------------
  |  Branch (1851:9): [True: 0, False: 5.98k]
  ------------------
 1852|      0|        (*_TIFFextender)(tif);
 1853|  5.98k|    (void)TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
  ------------------
  |  |  181|  5.98k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
                  (void)TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
  ------------------
  |  |  182|  5.98k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
 1854|       |    /*
 1855|       |     * NB: The directory is marked dirty as a result of setting
 1856|       |     * up the default compression scheme.  However, this really
 1857|       |     * isn't correct -- we want TIFF_DIRTYDIRECT to be set only
 1858|       |     * if the user does something.  We could just do the setup
 1859|       |     * by hand, but it seems better to use the normal mechanism
 1860|       |     * (i.e. TIFFSetField).
 1861|       |     */
 1862|  5.98k|    tif->tif_flags &= ~TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|  5.98k|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1863|       |
 1864|       |    /*
 1865|       |     * As per http://bugzilla.remotesensing.org/show_bug.cgi?id=19
 1866|       |     * we clear the ISTILED flag when setting up a new directory.
 1867|       |     * Should we also be clearing stuff like INSUBIFD?
 1868|       |     */
 1869|  5.98k|    tif->tif_flags &= ~TIFF_ISTILED;
  ------------------
  |  |  129|  5.98k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
 1870|       |
 1871|  5.98k|    return (1);
 1872|  5.98k|}
tif_dir.c:setByteArray:
   46|  5.88k|{
   47|  5.88k|    if (*vpp)
  ------------------
  |  Branch (47:9): [True: 62, False: 5.82k]
  ------------------
   48|     62|    {
   49|     62|        _TIFFfreeExt(tif, *vpp);
   50|     62|        *vpp = 0;
   51|     62|    }
   52|  5.88k|    if (vp)
  ------------------
  |  Branch (52:9): [True: 5.84k, False: 43]
  ------------------
   53|  5.84k|    {
   54|  5.84k|        tmsize_t bytes = _TIFFMultiplySSize(NULL, (tmsize_t)nmemb,
   55|  5.84k|                                            (tmsize_t)elem_size, NULL);
   56|  5.84k|        if (bytes)
  ------------------
  |  Branch (56:13): [True: 5.84k, False: 0]
  ------------------
   57|  5.84k|            *vpp = (void *)_TIFFmallocExt(tif, bytes);
   58|  5.84k|        if (*vpp)
  ------------------
  |  Branch (58:13): [True: 5.84k, False: 0]
  ------------------
   59|  5.84k|            _TIFFmemcpy(*vpp, vp, bytes);
   60|  5.84k|    }
   61|  5.88k|}
tif_dir.c:OkToChangeTag:
 1135|  69.9k|{
 1136|  69.9k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  341|  69.9k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
 1137|  69.9k|    if (!fip)
  ------------------
  |  Branch (1137:9): [True: 0, False: 69.9k]
  ------------------
 1138|      0|    { /* unknown tag */
 1139|      0|        TIFFErrorExtR(tif, "TIFFSetField", "%s: Unknown %stag %" PRIu32,
 1140|      0|                      tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "", tag);
  ------------------
  |  |  276|      0|#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (276:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1141|      0|        return (0);
 1142|      0|    }
 1143|  69.9k|    if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) &&
  ------------------
  |  |  179|   139k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
                  if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) &&
  ------------------
  |  |  125|  65.2k|#define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
  ------------------
  |  Branch (1143:9): [True: 65.2k, False: 4.70k]
  |  Branch (1143:39): [True: 0, False: 65.2k]
  ------------------
 1144|      0|        !fip->field_oktochange)
  ------------------
  |  Branch (1144:9): [True: 0, False: 0]
  ------------------
 1145|      0|    {
 1146|       |        /*
 1147|       |         * Consult info table to see if tag can be changed
 1148|       |         * after we've started writing.  We only allow changes
 1149|       |         * to those tags that don't/shouldn't affect the
 1150|       |         * compression and/or format of the data.
 1151|       |         */
 1152|      0|        TIFFErrorExtR(tif, "TIFFSetField",
 1153|      0|                      "%s: Cannot modify tag \"%s\" while writing",
 1154|      0|                      tif->tif_name, fip->field_name);
 1155|      0|        return (0);
 1156|      0|    }
 1157|  69.9k|    return (1);
 1158|  69.9k|}
tif_dir.c:_TIFFVSetField:
  224|  64.3k|{
  225|  64.3k|    static const char module[] = "_TIFFVSetField";
  226|       |
  227|  64.3k|    TIFFDirectory *td = &tif->tif_dir;
  228|  64.3k|    int status = 1;
  229|  64.3k|    uint32_t v32, v;
  230|  64.3k|    double dblval;
  231|  64.3k|    char *s;
  232|  64.3k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  341|  64.3k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  233|  64.3k|    uint32_t standard_tag = tag;
  234|  64.3k|    if (fip == NULL) /* cannot happen since OkToChangeTag() already checks it */
  ------------------
  |  Branch (234:9): [True: 0, False: 64.3k]
  ------------------
  235|      0|        return 0;
  236|       |    /*
  237|       |     * We want to force the custom code to be used for custom
  238|       |     * fields even if the tag happens to match a well known
  239|       |     * one - important for reinterpreted handling of standard
  240|       |     * tag values in custom directories (i.e. EXIF)
  241|       |     */
  242|  64.3k|    if (fip->field_bit == FIELD_CUSTOM)
  ------------------
  |  |  346|  64.3k|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (242:9): [True: 12.0k, False: 52.2k]
  ------------------
  243|  12.0k|    {
  244|  12.0k|        standard_tag = 0;
  245|  12.0k|    }
  246|       |
  247|  64.3k|    switch (standard_tag)
  248|  64.3k|    {
  249|     44|        case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  170|     44|#define TIFFTAG_SUBFILETYPE 254       /* subfile data descriptor */
  ------------------
  |  Branch (249:9): [True: 44, False: 64.2k]
  ------------------
  250|     44|            td->td_subfiletype = (uint32_t)va_arg(ap, uint32_t);
  251|     44|            break;
  252|  5.86k|        case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  178|  5.86k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  |  Branch (252:9): [True: 5.86k, False: 58.4k]
  ------------------
  253|  5.86k|            td->td_imagewidth = (uint32_t)va_arg(ap, uint32_t);
  254|  5.86k|            break;
  255|  4.70k|        case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  179|  4.70k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  |  Branch (255:9): [True: 4.70k, False: 59.6k]
  ------------------
  256|  4.70k|            td->td_imagelength = (uint32_t)va_arg(ap, uint32_t);
  257|  4.70k|            break;
  258|  4.07k|        case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|  4.07k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (258:9): [True: 4.07k, False: 60.2k]
  ------------------
  259|  4.07k|            td->td_bitspersample = (uint16_t)va_arg(ap, uint16_vap);
  260|       |            /*
  261|       |             * If the data require post-decoding processing to byte-swap
  262|       |             * samples, set it up here.  Note that since tags are required
  263|       |             * to be ordered, compression code can override this behavior
  264|       |             * in the setup method if it wants to roll the post decoding
  265|       |             * work in with its normal work.
  266|       |             */
  267|  4.07k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  4.07k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (267:17): [True: 184, False: 3.89k]
  ------------------
  268|    184|            {
  269|    184|                if (td->td_bitspersample == 8)
  ------------------
  |  Branch (269:21): [True: 10, False: 174]
  ------------------
  270|     10|                    tif->tif_postdecode = _TIFFNoPostDecode;
  271|    174|                else if (td->td_bitspersample == 16)
  ------------------
  |  Branch (271:26): [True: 39, False: 135]
  ------------------
  272|     39|                    tif->tif_postdecode = _TIFFSwab16BitData;
  273|    135|                else if (td->td_bitspersample == 24)
  ------------------
  |  Branch (273:26): [True: 13, False: 122]
  ------------------
  274|     13|                    tif->tif_postdecode = _TIFFSwab24BitData;
  275|    122|                else if (td->td_bitspersample == 32)
  ------------------
  |  Branch (275:26): [True: 51, False: 71]
  ------------------
  276|     51|                    tif->tif_postdecode = _TIFFSwab32BitData;
  277|     71|                else if (td->td_bitspersample == 64)
  ------------------
  |  Branch (277:26): [True: 57, False: 14]
  ------------------
  278|     57|                    tif->tif_postdecode = _TIFFSwab64BitData;
  279|     14|                else if (td->td_bitspersample == 128) /* two 64's */
  ------------------
  |  Branch (279:26): [True: 4, False: 10]
  ------------------
  280|      4|                    tif->tif_postdecode = _TIFFSwab64BitData;
  281|    184|            }
  282|  4.07k|            break;
  283|  11.9k|        case TIFFTAG_COMPRESSION:
  ------------------
  |  |  181|  11.9k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  |  Branch (283:9): [True: 11.9k, False: 52.3k]
  ------------------
  284|  11.9k|            v = (uint16_t)va_arg(ap, uint16_vap);
  285|       |            /*
  286|       |             * If we're changing the compression scheme, notify the
  287|       |             * previous module so that it can cleanup any state it's
  288|       |             * setup.
  289|       |             */
  290|  11.9k|            if (TIFFFieldSet(tif, FIELD_COMPRESSION))
  ------------------
  |  |  248|  11.9k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  11.9k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  11.9k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 5.97k, False: 5.98k]
  |  |  ------------------
  ------------------
  291|  5.97k|            {
  292|  5.97k|                if ((uint32_t)td->td_compression == v)
  ------------------
  |  Branch (292:21): [True: 530, False: 5.44k]
  ------------------
  293|    530|                    break;
  294|  5.44k|                (*tif->tif_cleanup)(tif);
  295|  5.44k|                tif->tif_flags &= ~TIFF_CODERSETUP;
  ------------------
  |  |  124|  5.44k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
  296|  5.44k|            }
  297|       |            /*
  298|       |             * Setup new compression routine state.
  299|       |             */
  300|  11.4k|            if ((status = TIFFSetCompressionScheme(tif, (int)v)) != 0)
  ------------------
  |  Branch (300:17): [True: 11.4k, False: 0]
  ------------------
  301|  11.4k|                td->td_compression = (uint16_t)v;
  302|      0|            else
  303|      0|                status = 0;
  304|  11.4k|            break;
  305|  3.04k|        case TIFFTAG_PHOTOMETRIC:
  ------------------
  |  |  220|  3.04k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (305:9): [True: 3.04k, False: 61.2k]
  ------------------
  306|  3.04k|            td->td_photometric = (uint16_t)va_arg(ap, uint16_vap);
  307|  3.04k|            break;
  308|      2|        case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  234|      2|#define TIFFTAG_THRESHHOLDING 263          /* +thresholding used on data */
  ------------------
  |  Branch (308:9): [True: 2, False: 64.3k]
  ------------------
  309|      2|            td->td_threshholding = (uint16_t)va_arg(ap, uint16_vap);
  310|      2|            break;
  311|    305|        case TIFFTAG_FILLORDER:
  ------------------
  |  |  240|    305|#define TIFFTAG_FILLORDER 266              /* data order within a byte */
  ------------------
  |  Branch (311:9): [True: 305, False: 64.0k]
  ------------------
  312|    305|            v = (uint16_t)va_arg(ap, uint16_vap);
  313|    305|            if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)
  ------------------
  |  |  242|    610|#define FILLORDER_LSB2MSB 2                /* least significant -> most */
  ------------------
                          if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)
  ------------------
  |  |  241|    296|#define FILLORDER_MSB2LSB 1                /* most significant -> least */
  ------------------
  |  Branch (313:17): [True: 296, False: 9]
  |  Branch (313:43): [True: 43, False: 253]
  ------------------
  314|     43|                goto badvalue;
  315|    262|            td->td_fillorder = (uint16_t)v;
  316|    262|            break;
  317|    498|        case TIFFTAG_ORIENTATION:
  ------------------
  |  |  248|    498|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  |  Branch (317:9): [True: 498, False: 63.8k]
  ------------------
  318|    498|            v = (uint16_t)va_arg(ap, uint16_vap);
  319|    498|            if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v)
  ------------------
  |  |  249|    996|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
                          if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v)
  ------------------
  |  |  256|    498|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (319:17): [True: 0, False: 498]
  |  Branch (319:44): [True: 25, False: 473]
  ------------------
  320|     25|                goto badvalue;
  321|    473|            else
  322|    473|                td->td_orientation = (uint16_t)v;
  323|    473|            break;
  324|  3.32k|        case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  257|  3.32k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (324:9): [True: 3.32k, False: 60.9k]
  ------------------
  325|  3.32k|            v = (uint16_t)va_arg(ap, uint16_vap);
  326|  3.32k|            if (v == 0)
  ------------------
  |  Branch (326:17): [True: 0, False: 3.32k]
  ------------------
  327|      0|                goto badvalue;
  328|  3.32k|            if (v != td->td_samplesperpixel)
  ------------------
  |  Branch (328:17): [True: 3.19k, False: 129]
  ------------------
  329|  3.19k|            {
  330|       |                /* See http://bugzilla.maptools.org/show_bug.cgi?id=2500 */
  331|  3.19k|                if (td->td_sminsamplevalue != NULL)
  ------------------
  |  Branch (331:21): [True: 3, False: 3.19k]
  ------------------
  332|      3|                {
  333|      3|                    TIFFWarningExtR(tif, module,
  334|      3|                                    "SamplesPerPixel tag value is changing, "
  335|      3|                                    "but SMinSampleValue tag was read with a "
  336|      3|                                    "different value. Canceling it");
  337|      3|                    TIFFClrFieldBit(tif, FIELD_SMINSAMPLEVALUE);
  ------------------
  |  |  250|      3|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  247|      3|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  246|      3|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  338|      3|                    _TIFFfreeExt(tif, td->td_sminsamplevalue);
  339|      3|                    td->td_sminsamplevalue = NULL;
  340|      3|                }
  341|  3.19k|                if (td->td_smaxsamplevalue != NULL)
  ------------------
  |  Branch (341:21): [True: 0, False: 3.19k]
  ------------------
  342|      0|                {
  343|      0|                    TIFFWarningExtR(tif, module,
  344|      0|                                    "SamplesPerPixel tag value is changing, "
  345|      0|                                    "but SMaxSampleValue tag was read with a "
  346|      0|                                    "different value. Canceling it");
  347|      0|                    TIFFClrFieldBit(tif, FIELD_SMAXSAMPLEVALUE);
  ------------------
  |  |  250|      0|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  247|      0|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  246|      0|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  348|      0|                    _TIFFfreeExt(tif, td->td_smaxsamplevalue);
  349|      0|                    td->td_smaxsamplevalue = NULL;
  350|      0|                }
  351|       |                /* Test if 3 transfer functions instead of just one are now
  352|       |                   needed See http://bugzilla.maptools.org/show_bug.cgi?id=2820
  353|       |                 */
  354|  3.19k|                if (td->td_transferfunction[0] != NULL &&
  ------------------
  |  Branch (354:21): [True: 0, False: 3.19k]
  ------------------
  355|      0|                    (v - td->td_extrasamples > 1) &&
  ------------------
  |  Branch (355:21): [True: 0, False: 0]
  ------------------
  356|      0|                    !(td->td_samplesperpixel - td->td_extrasamples > 1))
  ------------------
  |  Branch (356:21): [True: 0, False: 0]
  ------------------
  357|      0|                {
  358|      0|                    TIFFWarningExtR(tif, module,
  359|      0|                                    "SamplesPerPixel tag value is changing, "
  360|      0|                                    "but TransferFunction was read with a "
  361|      0|                                    "different value. Canceling it");
  362|      0|                    TIFFClrFieldBit(tif, FIELD_TRANSFERFUNCTION);
  ------------------
  |  |  250|      0|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  247|      0|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  246|      0|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  363|      0|                    _TIFFfreeExt(tif, td->td_transferfunction[0]);
  364|      0|                    td->td_transferfunction[0] = NULL;
  365|      0|                }
  366|  3.19k|            }
  367|  3.32k|            td->td_samplesperpixel = (uint16_t)v;
  368|  3.32k|            break;
  369|  3.26k|        case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|  3.26k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (369:9): [True: 3.26k, False: 61.0k]
  ------------------
  370|  3.26k|            v32 = (uint32_t)va_arg(ap, uint32_t);
  371|  3.26k|            if (v32 == 0)
  ------------------
  |  Branch (371:17): [True: 0, False: 3.26k]
  ------------------
  372|      0|                goto badvalue32;
  373|  3.26k|            td->td_rowsperstrip = v32;
  374|  3.26k|            if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS))
  ------------------
  |  |  248|  3.26k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  3.26k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  3.26k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (374:17): [True: 3.20k, False: 63]
  ------------------
  375|  3.20k|            {
  376|  3.20k|                td->td_tilelength = v32;
  377|  3.20k|                td->td_tilewidth = td->td_imagewidth;
  378|  3.20k|            }
  379|  3.26k|            break;
  380|      8|        case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  260|      8|#define TIFFTAG_MINSAMPLEVALUE 280         /* +minimum sample value */
  ------------------
  |  Branch (380:9): [True: 8, False: 64.3k]
  ------------------
  381|      8|            td->td_minsamplevalue = (uint16_t)va_arg(ap, uint16_vap);
  382|      8|            break;
  383|      7|        case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  261|      7|#define TIFFTAG_MAXSAMPLEVALUE 281         /* +maximum sample value */
  ------------------
  |  Branch (383:9): [True: 7, False: 64.3k]
  ------------------
  384|      7|            td->td_maxsamplevalue = (uint16_t)va_arg(ap, uint16_vap);
  385|      7|            break;
  386|    197|        case TIFFTAG_SMINSAMPLEVALUE:
  ------------------
  |  |  340|    197|#define TIFFTAG_SMINSAMPLEVALUE 340        /* !variable MinSampleValue */
  ------------------
  |  Branch (386:9): [True: 197, False: 64.1k]
  ------------------
  387|    197|            if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  143|    197|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  |  Branch (387:17): [True: 197, False: 0]
  ------------------
  388|    197|                _TIFFsetDoubleArrayExt(tif, &td->td_sminsamplevalue,
  389|    197|                                       va_arg(ap, double *),
  390|    197|                                       td->td_samplesperpixel);
  391|      0|            else
  392|      0|                setDoubleArrayOneValue(tif, &td->td_sminsamplevalue,
  393|      0|                                       va_arg(ap, double),
  394|      0|                                       td->td_samplesperpixel);
  395|    197|            break;
  396|     11|        case TIFFTAG_SMAXSAMPLEVALUE:
  ------------------
  |  |  341|     11|#define TIFFTAG_SMAXSAMPLEVALUE 341        /* !variable MaxSampleValue */
  ------------------
  |  Branch (396:9): [True: 11, False: 64.3k]
  ------------------
  397|     11|            if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  143|     11|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  |  Branch (397:17): [True: 11, False: 0]
  ------------------
  398|     11|                _TIFFsetDoubleArrayExt(tif, &td->td_smaxsamplevalue,
  399|     11|                                       va_arg(ap, double *),
  400|     11|                                       td->td_samplesperpixel);
  401|      0|            else
  402|      0|                setDoubleArrayOneValue(tif, &td->td_smaxsamplevalue,
  403|      0|                                       va_arg(ap, double),
  404|      0|                                       td->td_samplesperpixel);
  405|     11|            break;
  406|    440|        case TIFFTAG_XRESOLUTION:
  ------------------
  |  |  262|    440|#define TIFFTAG_XRESOLUTION 282            /* pixels/resolution in x */
  ------------------
  |  Branch (406:9): [True: 440, False: 63.8k]
  ------------------
  407|    440|            dblval = va_arg(ap, double);
  408|    440|            if (isnan(dblval) || dblval < 0)
  ------------------
  |  Branch (408:17): [True: 0, False: 440]
  |  Branch (408:34): [True: 5, False: 435]
  ------------------
  409|      5|                goto badvaluedouble;
  410|    435|            td->td_xresolution = _TIFFClampDoubleToFloat(dblval);
  411|    435|            break;
  412|    294|        case TIFFTAG_YRESOLUTION:
  ------------------
  |  |  263|    294|#define TIFFTAG_YRESOLUTION 283            /* pixels/resolution in y */
  ------------------
  |  Branch (412:9): [True: 294, False: 64.0k]
  ------------------
  413|    294|            dblval = va_arg(ap, double);
  414|    294|            if (isnan(dblval) || dblval < 0)
  ------------------
  |  Branch (414:17): [True: 0, False: 294]
  |  Branch (414:34): [True: 2, False: 292]
  ------------------
  415|      2|                goto badvaluedouble;
  416|    292|            td->td_yresolution = _TIFFClampDoubleToFloat(dblval);
  417|    292|            break;
  418|  7.60k|        case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  264|  7.60k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  |  Branch (418:9): [True: 7.60k, False: 56.7k]
  ------------------
  419|  7.60k|            v = (uint16_t)va_arg(ap, uint16_vap);
  420|  7.60k|            if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  265|  15.2k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
                          if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  1.12k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (420:17): [True: 1.12k, False: 6.48k]
  |  Branch (420:45): [True: 0, False: 1.12k]
  ------------------
  421|      0|                goto badvalue;
  422|  7.60k|            td->td_planarconfig = (uint16_t)v;
  423|  7.60k|            break;
  424|      5|        case TIFFTAG_XPOSITION:
  ------------------
  |  |  268|      5|#define TIFFTAG_XPOSITION 286              /* x page offset of image lhs */
  ------------------
  |  Branch (424:9): [True: 5, False: 64.3k]
  ------------------
  425|      5|            td->td_xposition = _TIFFClampDoubleToFloat(va_arg(ap, double));
  426|      5|            break;
  427|     90|        case TIFFTAG_YPOSITION:
  ------------------
  |  |  269|     90|#define TIFFTAG_YPOSITION 287              /* y page offset of image lhs */
  ------------------
  |  Branch (427:9): [True: 90, False: 64.2k]
  ------------------
  428|     90|            td->td_yposition = _TIFFClampDoubleToFloat(va_arg(ap, double));
  429|     90|            break;
  430|    218|        case TIFFTAG_RESOLUTIONUNIT:
  ------------------
  |  |  287|    218|#define TIFFTAG_RESOLUTIONUNIT 296         /* units of resolutions */
  ------------------
  |  Branch (430:9): [True: 218, False: 64.0k]
  ------------------
  431|    218|            v = (uint16_t)va_arg(ap, uint16_vap);
  432|    218|            if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)
  ------------------
  |  |  288|    436|#define RESUNIT_NONE 1                     /* no meaningful units */
  ------------------
                          if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)
  ------------------
  |  |  290|    215|#define RESUNIT_CENTIMETER 3               /* metric */
  ------------------
  |  Branch (432:17): [True: 3, False: 215]
  |  Branch (432:37): [True: 21, False: 194]
  ------------------
  433|     24|                goto badvalue;
  434|    194|            td->td_resolutionunit = (uint16_t)v;
  435|    194|            break;
  436|    218|        case TIFFTAG_PAGENUMBER:
  ------------------
  |  |  291|    218|#define TIFFTAG_PAGENUMBER 297             /* page numbers of multi-page */
  ------------------
  |  Branch (436:9): [True: 218, False: 64.0k]
  ------------------
  437|    218|            td->td_pagenumber[0] = (uint16_t)va_arg(ap, uint16_vap);
  438|    218|            td->td_pagenumber[1] = (uint16_t)va_arg(ap, uint16_vap);
  439|    218|            break;
  440|      0|        case TIFFTAG_HALFTONEHINTS:
  ------------------
  |  |  310|      0|#define TIFFTAG_HALFTONEHINTS 321          /* !highlight+shadow info */
  ------------------
  |  Branch (440:9): [True: 0, False: 64.3k]
  ------------------
  441|      0|            td->td_halftonehints[0] = (uint16_t)va_arg(ap, uint16_vap);
  442|      0|            td->td_halftonehints[1] = (uint16_t)va_arg(ap, uint16_vap);
  443|      0|            break;
  444|     40|        case TIFFTAG_COLORMAP:
  ------------------
  |  |  309|     40|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (444:9): [True: 40, False: 64.2k]
  ------------------
  445|     40|            if (td->td_bitspersample >= 32)
  ------------------
  |  Branch (445:17): [True: 0, False: 40]
  ------------------
  446|      0|            {
  447|      0|                v = td->td_bitspersample;
  448|      0|                goto badvalue;
  449|      0|            }
  450|     40|            v32 = 1U << td->td_bitspersample;
  451|     40|            _TIFFsetShortArrayExt(tif, &td->td_colormap[0],
  452|     40|                                  va_arg(ap, uint16_t *), v32);
  453|     40|            _TIFFsetShortArrayExt(tif, &td->td_colormap[1],
  454|     40|                                  va_arg(ap, uint16_t *), v32);
  455|     40|            _TIFFsetShortArrayExt(tif, &td->td_colormap[2],
  456|     40|                                  va_arg(ap, uint16_t *), v32);
  457|     40|            break;
  458|    186|        case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|    186|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (458:9): [True: 186, False: 64.1k]
  ------------------
  459|    186|            if (!setExtraSamples(tif, ap, &v))
  ------------------
  |  Branch (459:17): [True: 0, False: 186]
  ------------------
  460|      0|                goto badvalue;
  461|    186|            break;
  462|    186|        case TIFFTAG_MATTEING:
  ------------------
  |  |  405|     12|#define TIFFTAG_MATTEING 32995   /* $use ExtraSamples */
  ------------------
  |  Branch (462:9): [True: 12, False: 64.3k]
  ------------------
  463|     12|            td->td_extrasamples = (((uint16_t)va_arg(ap, uint16_vap)) != 0);
  464|     12|            if (td->td_extrasamples)
  ------------------
  |  Branch (464:17): [True: 12, False: 0]
  ------------------
  465|     12|            {
  466|     12|                uint16_t sv = EXTRASAMPLE_ASSOCALPHA;
  ------------------
  |  |  331|     12|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  467|     12|                _TIFFsetShortArrayExt(tif, &td->td_sampleinfo, &sv, 1);
  468|     12|            }
  469|     12|            break;
  470|  2.49k|        case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  311|  2.49k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  |  Branch (470:9): [True: 2.49k, False: 61.8k]
  ------------------
  471|  2.49k|            v32 = (uint32_t)va_arg(ap, uint32_t);
  472|  2.49k|            if (v32 % 16)
  ------------------
  |  Branch (472:17): [True: 1.98k, False: 507]
  ------------------
  473|  1.98k|            {
  474|  1.98k|                if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (474:21): [True: 0, False: 1.98k]
  ------------------
  475|      0|                    goto badvalue32;
  476|  1.98k|                TIFFWarningExtR(
  477|  1.98k|                    tif, tif->tif_name,
  478|  1.98k|                    "Nonstandard tile width %" PRIu32 ", convert file", v32);
  479|  1.98k|            }
  480|  2.49k|            td->td_tilewidth = v32;
  481|  2.49k|            tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  129|  2.49k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
  482|  2.49k|            break;
  483|  1.52k|        case TIFFTAG_TILELENGTH:
  ------------------
  |  |  312|  1.52k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  |  Branch (483:9): [True: 1.52k, False: 62.7k]
  ------------------
  484|  1.52k|            v32 = (uint32_t)va_arg(ap, uint32_t);
  485|  1.52k|            if (v32 % 16)
  ------------------
  |  Branch (485:17): [True: 1.17k, False: 352]
  ------------------
  486|  1.17k|            {
  487|  1.17k|                if (tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (487:21): [True: 0, False: 1.17k]
  ------------------
  488|      0|                    goto badvalue32;
  489|  1.17k|                TIFFWarningExtR(
  490|  1.17k|                    tif, tif->tif_name,
  491|  1.17k|                    "Nonstandard tile length %" PRIu32 ", convert file", v32);
  492|  1.17k|            }
  493|  1.52k|            td->td_tilelength = v32;
  494|  1.52k|            tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  129|  1.52k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
  495|  1.52k|            break;
  496|      5|        case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  408|      5|#define TIFFTAG_TILEDEPTH 32998  /* z depth/data tile */
  ------------------
  |  Branch (496:9): [True: 5, False: 64.3k]
  ------------------
  497|      5|            v32 = (uint32_t)va_arg(ap, uint32_t);
  498|      5|            if (v32 == 0)
  ------------------
  |  Branch (498:17): [True: 0, False: 5]
  ------------------
  499|      0|                goto badvalue32;
  500|      5|            td->td_tiledepth = v32;
  501|      5|            break;
  502|     13|        case TIFFTAG_DATATYPE:
  ------------------
  |  |  406|     13|#define TIFFTAG_DATATYPE 32996   /* $use SampleFormat */
  ------------------
  |  Branch (502:9): [True: 13, False: 64.3k]
  ------------------
  503|     13|            v = (uint16_t)va_arg(ap, uint16_vap);
  504|     13|            switch (v)
  505|     13|            {
  506|      3|                case DATATYPE_VOID:
  ------------------
  |  |   39|      3|#define DATATYPE_VOID 0   /* !untyped data */
  ------------------
  |  Branch (506:17): [True: 3, False: 10]
  ------------------
  507|      3|                    v = SAMPLEFORMAT_VOID;
  ------------------
  |  |  337|      3|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
  508|      3|                    break;
  509|      0|                case DATATYPE_INT:
  ------------------
  |  |   40|      0|#define DATATYPE_INT 1    /* !signed integer data */
  ------------------
  |  Branch (509:17): [True: 0, False: 13]
  ------------------
  510|      0|                    v = SAMPLEFORMAT_INT;
  ------------------
  |  |  335|      0|#define SAMPLEFORMAT_INT 2                 /* !signed integer data */
  ------------------
  511|      0|                    break;
  512|      0|                case DATATYPE_UINT:
  ------------------
  |  |   41|      0|#define DATATYPE_UINT 2   /* !unsigned integer data */
  ------------------
  |  Branch (512:17): [True: 0, False: 13]
  ------------------
  513|      0|                    v = SAMPLEFORMAT_UINT;
  ------------------
  |  |  334|      0|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  514|      0|                    break;
  515|     10|                case DATATYPE_IEEEFP:
  ------------------
  |  |   42|     10|#define DATATYPE_IEEEFP 3 /* !IEEE floating point data */
  ------------------
  |  Branch (515:17): [True: 10, False: 3]
  ------------------
  516|     10|                    v = SAMPLEFORMAT_IEEEFP;
  ------------------
  |  |  336|     10|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  517|     10|                    break;
  518|      0|                default:
  ------------------
  |  Branch (518:17): [True: 0, False: 13]
  ------------------
  519|      0|                    goto badvalue;
  520|     13|            }
  521|     13|            td->td_sampleformat = (uint16_t)v;
  522|     13|            break;
  523|    577|        case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  333|    577|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
  |  Branch (523:9): [True: 577, False: 63.7k]
  ------------------
  524|    577|            v = (uint16_t)va_arg(ap, uint16_vap);
  525|    577|            if (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v)
  ------------------
  |  |  334|  1.15k|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
                          if (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v)
  ------------------
  |  |  339|    577|#define SAMPLEFORMAT_COMPLEXIEEEFP 6       /* !complex ieee floating */
  ------------------
  |  Branch (525:17): [True: 0, False: 577]
  |  Branch (525:42): [True: 0, False: 577]
  ------------------
  526|      0|                goto badvalue;
  527|    577|            td->td_sampleformat = (uint16_t)v;
  528|       |
  529|       |            /*  Try to fix up the SWAB function for complex data. */
  530|    577|            if (td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT &&
  ------------------
  |  |  338|  1.15k|#define SAMPLEFORMAT_COMPLEXINT 5          /* !complex signed int */
  ------------------
  |  Branch (530:17): [True: 4, False: 573]
  ------------------
  531|      4|                td->td_bitspersample == 32 &&
  ------------------
  |  Branch (531:17): [True: 0, False: 4]
  ------------------
  532|      0|                tif->tif_postdecode == _TIFFSwab32BitData)
  ------------------
  |  Branch (532:17): [True: 0, False: 0]
  ------------------
  533|      0|                tif->tif_postdecode = _TIFFSwab16BitData;
  534|    577|            else if ((td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT ||
  ------------------
  |  |  338|  1.15k|#define SAMPLEFORMAT_COMPLEXINT 5          /* !complex signed int */
  ------------------
  |  Branch (534:23): [True: 4, False: 573]
  ------------------
  535|    573|                      td->td_sampleformat == SAMPLEFORMAT_COMPLEXIEEEFP) &&
  ------------------
  |  |  339|    573|#define SAMPLEFORMAT_COMPLEXIEEEFP 6       /* !complex ieee floating */
  ------------------
  |  Branch (535:23): [True: 0, False: 573]
  ------------------
  536|      4|                     td->td_bitspersample == 64 &&
  ------------------
  |  Branch (536:22): [True: 3, False: 1]
  ------------------
  537|      3|                     tif->tif_postdecode == _TIFFSwab64BitData)
  ------------------
  |  Branch (537:22): [True: 3, False: 0]
  ------------------
  538|      3|                tif->tif_postdecode = _TIFFSwab32BitData;
  539|    577|            break;
  540|      6|        case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  407|      6|#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
  ------------------
  |  Branch (540:9): [True: 6, False: 64.3k]
  ------------------
  541|      6|            td->td_imagedepth = (uint32_t)va_arg(ap, uint32_t);
  542|      6|            break;
  543|      3|        case TIFFTAG_SUBIFD:
  ------------------
  |  |  321|      3|#define TIFFTAG_SUBIFD 330                 /* subimage descriptors */
  ------------------
  |  Branch (543:9): [True: 3, False: 64.3k]
  ------------------
  544|      3|            if ((tif->tif_flags & TIFF_INSUBIFD) == 0)
  ------------------
  |  |  132|      3|#define TIFF_INSUBIFD 0x02000U    /* currently writing a subifd */
  ------------------
  |  Branch (544:17): [True: 3, False: 0]
  ------------------
  545|      3|            {
  546|      3|                td->td_nsubifd = (uint16_t)va_arg(ap, uint16_vap);
  547|      3|                _TIFFsetLong8Array(tif, &td->td_subifd,
  548|      3|                                   (uint64_t *)va_arg(ap, uint64_t *),
  549|      3|                                   (uint32_t)td->td_nsubifd);
  550|      3|            }
  551|      0|            else
  552|      0|            {
  553|      0|                TIFFErrorExtR(tif, module, "%s: Sorry, cannot nest SubIFDs",
  554|      0|                              tif->tif_name);
  555|      0|                status = 0;
  556|      0|            }
  557|      3|            break;
  558|      5|        case TIFFTAG_YCBCRPOSITIONING:
  ------------------
  |  |  389|      5|#define TIFFTAG_YCBCRPOSITIONING 531       /* !subsample positioning */
  ------------------
  |  Branch (558:9): [True: 5, False: 64.3k]
  ------------------
  559|      5|            td->td_ycbcrpositioning = (uint16_t)va_arg(ap, uint16_vap);
  560|      5|            break;
  561|  1.19k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|  1.19k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (561:9): [True: 1.19k, False: 63.1k]
  ------------------
  562|  1.19k|            td->td_ycbcrsubsampling[0] = (uint16_t)va_arg(ap, uint16_vap);
  563|  1.19k|            td->td_ycbcrsubsampling[1] = (uint16_t)va_arg(ap, uint16_vap);
  564|  1.19k|            break;
  565|      3|        case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|      3|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (565:9): [True: 3, False: 64.3k]
  ------------------
  566|      3|        {
  567|      3|            uint32_t i;
  568|      3|            uint32_t count;
  569|      3|            if (td->td_bitspersample >= 32)
  ------------------
  |  Branch (569:17): [True: 0, False: 3]
  ------------------
  570|      0|            {
  571|      0|                v = td->td_bitspersample;
  572|      0|                goto badvalue;
  573|      0|            }
  574|      3|            count = 1U << td->td_bitspersample;
  575|      3|            v = (td->td_samplesperpixel - td->td_extrasamples) > 1 ? 3 : 1;
  ------------------
  |  Branch (575:17): [True: 0, False: 3]
  ------------------
  576|      6|            for (i = 0; i < v; i++)
  ------------------
  |  Branch (576:25): [True: 3, False: 3]
  ------------------
  577|      3|                _TIFFsetShortArrayExt(tif, &td->td_transferfunction[i],
  578|      3|                                      va_arg(ap, uint16_t *), count);
  579|      3|            break;
  580|      3|        }
  581|      7|        case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  392|      7|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
  |  Branch (581:9): [True: 7, False: 64.3k]
  ------------------
  582|       |            /* XXX should check for null range */
  583|      7|            _TIFFsetFloatArrayExt(tif, &td->td_refblackwhite,
  584|      7|                                  va_arg(ap, float *), 6);
  585|      7|            break;
  586|     11|        case TIFFTAG_INKNAMES:
  ------------------
  |  |  325|     11|#define TIFFTAG_INKNAMES 333               /* !ascii names of inks */
  ------------------
  |  Branch (586:9): [True: 11, False: 64.3k]
  ------------------
  587|     11|        {
  588|     11|            v = (uint16_t)va_arg(ap, uint16_vap);
  589|     11|            s = va_arg(ap, char *);
  590|     11|            uint16_t ninksinstring;
  591|     11|            ninksinstring = countInkNamesString(tif, v, s);
  592|     11|            status = ninksinstring > 0;
  593|     11|            if (ninksinstring > 0)
  ------------------
  |  Branch (593:17): [True: 11, False: 0]
  ------------------
  594|     11|            {
  595|     11|                _TIFFsetNString(tif, &td->td_inknames, s, v);
  596|     11|                td->td_inknameslen = (int)v;
  597|       |                /* Set NumberOfInks to the value ninksinstring */
  598|     11|                if (TIFFFieldSet(tif, FIELD_NUMBEROFINKS))
  ------------------
  |  |  248|     11|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|     11|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|     11|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 6, False: 5]
  |  |  ------------------
  ------------------
  599|      6|                {
  600|      6|                    if (td->td_numberofinks != ninksinstring)
  ------------------
  |  Branch (600:25): [True: 6, False: 0]
  ------------------
  601|      6|                    {
  602|      6|                        TIFFErrorExtR(
  603|      6|                            tif, module,
  604|      6|                            "Warning %s; Tag %s:\n  Value %" PRIu16
  605|      6|                            " of NumberOfInks is different from the number of "
  606|      6|                            "inks %" PRIu16
  607|      6|                            ".\n  -> NumberOfInks value adapted to %" PRIu16 "",
  608|      6|                            tif->tif_name, fip->field_name, td->td_numberofinks,
  609|      6|                            ninksinstring, ninksinstring);
  610|      6|                        td->td_numberofinks = ninksinstring;
  611|      6|                    }
  612|      6|                }
  613|      5|                else
  614|      5|                {
  615|      5|                    td->td_numberofinks = ninksinstring;
  616|      5|                    TIFFSetFieldBit(tif, FIELD_NUMBEROFINKS);
  ------------------
  |  |  249|      5|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|      5|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|      5|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  617|      5|                }
  618|     11|                if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  248|     11|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|     11|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|     11|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 7, False: 4]
  |  |  ------------------
  ------------------
  619|      7|                {
  620|      7|                    if (td->td_numberofinks != td->td_samplesperpixel)
  ------------------
  |  Branch (620:25): [True: 7, False: 0]
  ------------------
  621|      7|                    {
  622|      7|                        TIFFErrorExtR(tif, module,
  623|      7|                                      "Warning %s; Tag %s:\n  Value %" PRIu16
  624|      7|                                      " of NumberOfInks is different from the "
  625|      7|                                      "SamplesPerPixel value %" PRIu16 "",
  626|      7|                                      tif->tif_name, fip->field_name,
  627|      7|                                      td->td_numberofinks,
  628|      7|                                      td->td_samplesperpixel);
  629|      7|                    }
  630|      7|                }
  631|     11|            }
  632|     11|        }
  633|     11|        break;
  634|      9|        case TIFFTAG_NUMBEROFINKS:
  ------------------
  |  |  326|      9|#define TIFFTAG_NUMBEROFINKS 334           /* !number of inks */
  ------------------
  |  Branch (634:9): [True: 9, False: 64.3k]
  ------------------
  635|      9|            v = (uint16_t)va_arg(ap, uint16_vap);
  636|       |            /* If InkNames already set also NumberOfInks is set accordingly and
  637|       |             * should be equal */
  638|      9|            if (TIFFFieldSet(tif, FIELD_INKNAMES))
  ------------------
  |  |  248|      9|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|      9|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|      9|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  639|      0|            {
  640|      0|                if (v != td->td_numberofinks)
  ------------------
  |  Branch (640:21): [True: 0, False: 0]
  ------------------
  641|      0|                {
  642|      0|                    TIFFErrorExtR(
  643|      0|                        tif, module,
  644|      0|                        "Error %s; Tag %s:\n  It is not possible to set the "
  645|      0|                        "value %" PRIu32
  646|      0|                        " for NumberOfInks\n  which is different from the "
  647|      0|                        "number of inks in the InkNames tag (%" PRIu16 ")",
  648|      0|                        tif->tif_name, fip->field_name, v, td->td_numberofinks);
  649|       |                    /* Do not set / overwrite number of inks already set by
  650|       |                     * InkNames case accordingly. */
  651|      0|                    status = 0;
  652|      0|                }
  653|      0|            }
  654|      9|            else
  655|      9|            {
  656|      9|                td->td_numberofinks = (uint16_t)v;
  657|      9|                if (TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  248|      9|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|      9|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|      9|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 2, False: 7]
  |  |  ------------------
  ------------------
  658|      2|                {
  659|      2|                    if (td->td_numberofinks != td->td_samplesperpixel)
  ------------------
  |  Branch (659:25): [True: 2, False: 0]
  ------------------
  660|      2|                    {
  661|      2|                        TIFFErrorExtR(tif, module,
  662|      2|                                      "Warning %s; Tag %s:\n  Value %" PRIu32
  663|      2|                                      " of NumberOfInks is different from the "
  664|      2|                                      "SamplesPerPixel value %" PRIu16 "",
  665|      2|                                      tif->tif_name, fip->field_name, v,
  666|      2|                                      td->td_samplesperpixel);
  667|      2|                    }
  668|      2|                }
  669|      9|            }
  670|      9|            break;
  671|      0|        case TIFFTAG_PERSAMPLE:
  ------------------
  |  |  752|      0|#define TIFFTAG_PERSAMPLE 65563        /* interface for per sample tags */
  ------------------
  |  Branch (671:9): [True: 0, False: 64.3k]
  ------------------
  672|      0|            v = (uint16_t)va_arg(ap, uint16_vap);
  673|      0|            if (v == PERSAMPLE_MULTI)
  ------------------
  |  |  754|      0|#define PERSAMPLE_MULTI 1              /* present as multiple values */
  ------------------
  |  Branch (673:17): [True: 0, False: 0]
  ------------------
  674|      0|                tif->tif_flags |= TIFF_PERSAMPLE;
  ------------------
  |  |  143|      0|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  675|      0|            else
  676|      0|                tif->tif_flags &= ~TIFF_PERSAMPLE;
  ------------------
  |  |  143|      0|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  677|      0|            break;
  678|  12.0k|        default:
  ------------------
  |  Branch (678:9): [True: 12.0k, False: 52.2k]
  ------------------
  679|  12.0k|        {
  680|  12.0k|            TIFFTagValue *tv;
  681|  12.0k|            int tv_size, iCustom;
  682|       |
  683|       |            /*
  684|       |             * This can happen if multiple images are open with different
  685|       |             * codecs which have private tags.  The global tag information
  686|       |             * table may then have tags that are valid for one file but not
  687|       |             * the other. If the client tries to set a tag that is not valid
  688|       |             * for the image's codec then we'll arrive here.  This
  689|       |             * happens, for example, when tiffcp is used to convert between
  690|       |             * compression schemes and codec-specific tags are blindly copied.
  691|       |             *
  692|       |             * This also happens when a FIELD_IGNORE tag is written.
  693|       |             */
  694|  12.0k|            if (fip->field_bit == FIELD_IGNORE)
  ------------------
  |  |  190|  12.0k|#define FIELD_IGNORE 0
  ------------------
  |  Branch (694:17): [True: 0, False: 12.0k]
  ------------------
  695|      0|            {
  696|      0|                TIFFErrorExtR(
  697|      0|                    tif, module,
  698|      0|                    "%s: Ignored %stag \"%s\" (not supported by libtiff)",
  699|      0|                    tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
  ------------------
  |  |  276|      0|#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (276:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  700|      0|                    fip->field_name);
  701|      0|                status = 0;
  702|      0|                break;
  703|      0|            }
  704|  12.0k|            if (fip->field_bit != FIELD_CUSTOM)
  ------------------
  |  |  346|  12.0k|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (704:17): [True: 0, False: 12.0k]
  ------------------
  705|      0|            {
  706|      0|                TIFFErrorExtR(
  707|      0|                    tif, module,
  708|      0|                    "%s: Invalid %stag \"%s\" (not supported by codec)",
  709|      0|                    tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
  ------------------
  |  |  276|      0|#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (276:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  710|      0|                    fip->field_name);
  711|      0|                status = 0;
  712|      0|                break;
  713|      0|            }
  714|       |
  715|       |            /*
  716|       |             * Find the existing entry for this custom value.
  717|       |             */
  718|  12.0k|            tv = NULL;
  719|   302k|            for (iCustom = 0; iCustom < td->td_customValueCount; iCustom++)
  ------------------
  |  Branch (719:31): [True: 290k, False: 12.0k]
  ------------------
  720|   290k|            {
  721|   290k|                if (td->td_customValues[iCustom].info->field_tag == tag)
  ------------------
  |  Branch (721:21): [True: 0, False: 290k]
  ------------------
  722|      0|                {
  723|      0|                    tv = td->td_customValues + iCustom;
  724|      0|                    if (tv->value != NULL)
  ------------------
  |  Branch (724:25): [True: 0, False: 0]
  ------------------
  725|      0|                    {
  726|      0|                        _TIFFfreeExt(tif, tv->value);
  727|      0|                        tv->value = NULL;
  728|      0|                    }
  729|      0|                    break;
  730|      0|                }
  731|   290k|            }
  732|       |
  733|       |            /*
  734|       |             * Grow the custom list if the entry was not found.
  735|       |             */
  736|  12.0k|            if (tv == NULL)
  ------------------
  |  Branch (736:17): [True: 12.0k, False: 0]
  ------------------
  737|  12.0k|            {
  738|  12.0k|                TIFFTagValue *new_customValues;
  739|       |
  740|  12.0k|                new_customValues = (TIFFTagValue *)_TIFFreallocExt(
  741|  12.0k|                    tif, td->td_customValues,
  742|  12.0k|                    (tmsize_t)(sizeof(TIFFTagValue) *
  743|  12.0k|                               (size_t)(td->td_customValueCount + 1)));
  744|  12.0k|                if (!new_customValues)
  ------------------
  |  Branch (744:21): [True: 0, False: 12.0k]
  ------------------
  745|      0|                {
  746|      0|                    TIFFErrorExtR(tif, module,
  747|      0|                                  "%s: Failed to allocate space for list of "
  748|      0|                                  "custom values",
  749|      0|                                  tif->tif_name);
  750|      0|                    status = 0;
  751|      0|                    goto end;
  752|      0|                }
  753|       |
  754|  12.0k|                td->td_customValueCount++;
  755|  12.0k|                td->td_customValues = new_customValues;
  756|       |
  757|  12.0k|                tv = td->td_customValues + (td->td_customValueCount - 1);
  758|  12.0k|                tv->info = fip;
  759|  12.0k|                tv->value = NULL;
  760|  12.0k|                tv->count = 0;
  761|  12.0k|            }
  762|       |
  763|       |            /*
  764|       |             * Set custom value ... save a copy of the custom tag value.
  765|       |             */
  766|       |            /*--: Rational2Double: For Rationals evaluate "set_get_field_type"
  767|       |             * to determine internal storage size. */
  768|  12.0k|            tv_size = TIFFFieldSetGetSize(fip);
  769|  12.0k|            if (tv_size == 0)
  ------------------
  |  Branch (769:17): [True: 0, False: 12.0k]
  ------------------
  770|      0|            {
  771|      0|                status = 0;
  772|      0|                TIFFErrorExtR(tif, module, "%s: Bad field type %u for \"%s\"",
  773|      0|                              tif->tif_name, fip->field_type, fip->field_name);
  774|      0|                goto end;
  775|      0|            }
  776|       |
  777|  12.0k|            if (fip->field_type == TIFF_ASCII)
  ------------------
  |  Branch (777:17): [True: 4.04k, False: 8.01k]
  ------------------
  778|  4.04k|            {
  779|  4.04k|                uint32_t ma;
  780|  4.04k|                const char *mb;
  781|  4.04k|                if (fip->field_passcount)
  ------------------
  |  Branch (781:21): [True: 3.04k, False: 991]
  ------------------
  782|  3.04k|                {
  783|  3.04k|                    assert(fip->field_writecount == TIFF_VARIABLE2);
  ------------------
  |  Branch (783:21): [True: 0, False: 3.04k]
  |  Branch (783:21): [True: 3.04k, False: 0]
  ------------------
  784|  3.04k|                    ma = (uint32_t)va_arg(ap, uint32_t);
  785|  3.04k|                    mb = (const char *)va_arg(ap, const char *);
  786|  3.04k|                }
  787|    991|                else
  788|    991|                {
  789|    991|                    mb = (const char *)va_arg(ap, const char *);
  790|    991|                    size_t len = strlen(mb) + 1;
  791|    991|                    if (len >= 0x80000000U)
  ------------------
  |  Branch (791:25): [True: 0, False: 991]
  ------------------
  792|      0|                    {
  793|      0|                        status = 0;
  794|      0|                        TIFFErrorExtR(tif, module,
  795|      0|                                      "%s: Too long string value for \"%s\". "
  796|      0|                                      "Maximum supported is 2147483647 bytes",
  797|      0|                                      tif->tif_name, fip->field_name);
  798|      0|                        goto end;
  799|      0|                    }
  800|    991|                    ma = (uint32_t)len;
  801|    991|                }
  802|  4.04k|                tv->count = (int)ma;
  803|  4.04k|                setByteArray(tif, &tv->value, mb, ma, 1);
  804|  4.04k|            }
  805|  8.01k|            else
  806|  8.01k|            {
  807|  8.01k|                if (fip->field_passcount)
  ------------------
  |  Branch (807:21): [True: 7.72k, False: 291]
  ------------------
  808|  7.72k|                {
  809|  7.72k|                    if (fip->field_writecount == TIFF_VARIABLE2)
  ------------------
  |  |  344|  7.72k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (809:25): [True: 7.56k, False: 160]
  ------------------
  810|  7.56k|                        tv->count = (int)va_arg(ap, uint32_t);
  811|    160|                    else
  812|    160|                        tv->count = va_arg(ap, int);
  813|  7.72k|                }
  814|    291|                else if (fip->field_writecount == TIFF_VARIABLE ||
  ------------------
  |  |  342|    582|#define TIFF_VARIABLE -1     /* marker for variable length tags */
  ------------------
  |  Branch (814:26): [True: 0, False: 291]
  ------------------
  815|    291|                         fip->field_writecount == TIFF_VARIABLE2)
  ------------------
  |  |  344|    291|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (815:26): [True: 0, False: 291]
  ------------------
  816|      0|                    tv->count = 1;
  817|    291|                else if (fip->field_writecount == TIFF_SPP)
  ------------------
  |  |  343|    291|#define TIFF_SPP -2          /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (817:26): [True: 0, False: 291]
  ------------------
  818|      0|                    tv->count = td->td_samplesperpixel;
  819|    291|                else
  820|    291|                    tv->count = fip->field_writecount;
  821|       |
  822|  8.01k|                if (tv->count == 0)
  ------------------
  |  Branch (822:21): [True: 1.81k, False: 6.20k]
  ------------------
  823|  1.81k|                {
  824|  1.81k|                    TIFFWarningExtR(tif, module,
  825|  1.81k|                                    "%s: Null count for \"%s\" (type "
  826|  1.81k|                                    "%u, writecount %d, passcount %d)",
  827|  1.81k|                                    tif->tif_name, fip->field_name,
  828|  1.81k|                                    fip->field_type, fip->field_writecount,
  829|  1.81k|                                    fip->field_passcount);
  830|  1.81k|                    break;
  831|  1.81k|                }
  832|       |
  833|  6.20k|                tv->value = _TIFFCheckMalloc(tif, tv->count, tv_size,
  834|  6.20k|                                             "custom tag binary object");
  835|  6.20k|                if (!tv->value)
  ------------------
  |  Branch (835:21): [True: 0, False: 6.20k]
  ------------------
  836|      0|                {
  837|      0|                    status = 0;
  838|      0|                    goto end;
  839|      0|                }
  840|       |
  841|  6.20k|                if (fip->field_tag == TIFFTAG_DOTRANGE &&
  ------------------
  |  |  327|  12.4k|#define TIFFTAG_DOTRANGE 336               /* !0% and 100% dot codes */
  ------------------
  |  Branch (841:21): [True: 0, False: 6.20k]
  ------------------
  842|      0|                    strcmp(fip->field_name, "DotRange") == 0)
  ------------------
  |  Branch (842:21): [True: 0, False: 0]
  ------------------
  843|      0|                {
  844|       |                    /* TODO: This is an evil exception and should not have been
  845|       |                       handled this way ... likely best if we move it into
  846|       |                       the directory structure with an explicit field in
  847|       |                       libtiff 4.1 and assign it a FIELD_ value */
  848|      0|                    uint16_t v2[2];
  849|      0|                    v2[0] = (uint16_t)va_arg(ap, int);
  850|      0|                    v2[1] = (uint16_t)va_arg(ap, int);
  851|      0|                    _TIFFmemcpy(tv->value, &v2, 4);
  852|      0|                }
  853|       |
  854|  6.20k|                else if (fip->field_passcount ||
  ------------------
  |  Branch (854:26): [True: 5.91k, False: 291]
  ------------------
  855|    291|                         fip->field_writecount == TIFF_VARIABLE ||
  ------------------
  |  |  342|  6.49k|#define TIFF_VARIABLE -1     /* marker for variable length tags */
  ------------------
  |  Branch (855:26): [True: 0, False: 291]
  ------------------
  856|    291|                         fip->field_writecount == TIFF_VARIABLE2 ||
  ------------------
  |  |  344|  6.49k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (856:26): [True: 0, False: 291]
  ------------------
  857|    291|                         fip->field_writecount == TIFF_SPP || tv->count > 1)
  ------------------
  |  |  343|  6.49k|#define TIFF_SPP -2          /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (857:26): [True: 0, False: 291]
  |  Branch (857:63): [True: 63, False: 228]
  ------------------
  858|  5.97k|                {
  859|       |                    /*--: Rational2Double: For Rationals tv_size is set above to
  860|       |                     * 4 or 8 according to fip->set_get_field_type! */
  861|  5.97k|                    _TIFFmemcpy(tv->value, va_arg(ap, void *),
  862|  5.97k|                                tv->count * tv_size);
  863|       |                    /* Test here for too big values for LONG8, IFD8, SLONG8 in
  864|       |                     * ClassicTIFF and delete custom field from custom list */
  865|  5.97k|                    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  5.97k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (865:25): [True: 5.95k, False: 16]
  ------------------
  866|  5.95k|                    {
  867|  5.95k|                        if (tv->info->field_type == TIFF_LONG8 ||
  ------------------
  |  Branch (867:29): [True: 15, False: 5.94k]
  ------------------
  868|  5.94k|                            tv->info->field_type == TIFF_IFD8)
  ------------------
  |  Branch (868:29): [True: 12, False: 5.93k]
  ------------------
  869|     27|                        {
  870|     27|                            uint64_t *pui64 = (uint64_t *)tv->value;
  871|    174|                            for (int i = 0; i < tv->count; i++)
  ------------------
  |  Branch (871:45): [True: 173, False: 1]
  ------------------
  872|    173|                            {
  873|    173|                                if (pui64[i] > 0xffffffffu)
  ------------------
  |  Branch (873:37): [True: 26, False: 147]
  ------------------
  874|     26|                                {
  875|     26|                                    TIFFErrorExtR(
  876|     26|                                        tif, module,
  877|     26|                                        "%s: Bad %s value %" PRIu64
  878|     26|                                        " at %d. array position for \"%s\" tag "
  879|     26|                                        "%u in ClassicTIFF. Tag won't be "
  880|     26|                                        "written to file",
  881|     26|                                        tif->tif_name,
  882|     26|                                        (tv->info->field_type == TIFF_LONG8
  ------------------
  |  Branch (882:42): [True: 14, False: 12]
  ------------------
  883|     26|                                             ? "LONG8"
  884|     26|                                             : "IFD8"),
  885|     26|                                        pui64[i], i, fip->field_name, tag);
  886|     26|                                    goto badvalueifd8long8;
  887|     26|                                }
  888|    173|                            }
  889|     27|                        }
  890|  5.93k|                        else if (tv->info->field_type == TIFF_SLONG8)
  ------------------
  |  Branch (890:34): [True: 101, False: 5.83k]
  ------------------
  891|    101|                        {
  892|    101|                            int64_t *pi64 = (int64_t *)tv->value;
  893|    338|                            for (int i = 0; i < tv->count; i++)
  ------------------
  |  Branch (893:45): [True: 319, False: 19]
  ------------------
  894|    319|                            {
  895|    319|                                if (pi64[i] > 2147483647 ||
  ------------------
  |  Branch (895:37): [True: 39, False: 280]
  ------------------
  896|    280|                                    pi64[i] < (-2147483647 - 1))
  ------------------
  |  Branch (896:37): [True: 43, False: 237]
  ------------------
  897|     82|                                {
  898|     82|                                    TIFFErrorExtR(
  899|     82|                                        tif, module,
  900|     82|                                        "%s: Bad SLONG8 value %" PRIi64
  901|     82|                                        " at %d. array position for \"%s\" tag "
  902|     82|                                        "%u in ClassicTIFF. Tag won't be "
  903|     82|                                        "written to file",
  904|     82|                                        tif->tif_name, pi64[i], i,
  905|     82|                                        fip->field_name, tag);
  906|     82|                                    goto badvalueifd8long8;
  907|     82|                                }
  908|    319|                            }
  909|    101|                        }
  910|  5.95k|                    }
  911|  5.97k|                }
  912|    228|                else
  913|    228|                {
  914|    228|                    char *val = (char *)tv->value;
  915|    228|                    assert(tv->count == 1);
  ------------------
  |  Branch (915:21): [True: 0, False: 228]
  |  Branch (915:21): [True: 228, False: 0]
  ------------------
  916|       |
  917|    228|                    switch (fip->field_type)
  918|    228|                    {
  919|      6|                        case TIFF_BYTE:
  ------------------
  |  Branch (919:25): [True: 6, False: 222]
  ------------------
  920|      6|                        case TIFF_UNDEFINED:
  ------------------
  |  Branch (920:25): [True: 0, False: 228]
  ------------------
  921|      6|                        {
  922|      6|                            uint8_t v2 = (uint8_t)va_arg(ap, int);
  923|      6|                            _TIFFmemcpy(val, &v2, tv_size);
  924|      6|                        }
  925|      6|                        break;
  926|      0|                        case TIFF_SBYTE:
  ------------------
  |  Branch (926:25): [True: 0, False: 228]
  ------------------
  927|      0|                        {
  928|      0|                            int8_t v2 = (int8_t)va_arg(ap, int);
  929|      0|                            _TIFFmemcpy(val, &v2, tv_size);
  930|      0|                        }
  931|      0|                        break;
  932|    122|                        case TIFF_SHORT:
  ------------------
  |  Branch (932:25): [True: 122, False: 106]
  ------------------
  933|    122|                        {
  934|    122|                            uint16_t v2 = (uint16_t)va_arg(ap, int);
  935|    122|                            _TIFFmemcpy(val, &v2, tv_size);
  936|    122|                        }
  937|    122|                        break;
  938|      0|                        case TIFF_SSHORT:
  ------------------
  |  Branch (938:25): [True: 0, False: 228]
  ------------------
  939|      0|                        {
  940|      0|                            int16_t v2 = (int16_t)va_arg(ap, int);
  941|      0|                            _TIFFmemcpy(val, &v2, tv_size);
  942|      0|                        }
  943|      0|                        break;
  944|      6|                        case TIFF_LONG:
  ------------------
  |  Branch (944:25): [True: 6, False: 222]
  ------------------
  945|      6|                        case TIFF_IFD:
  ------------------
  |  Branch (945:25): [True: 0, False: 228]
  ------------------
  946|      6|                        {
  947|      6|                            uint32_t v2 = va_arg(ap, uint32_t);
  948|      6|                            _TIFFmemcpy(val, &v2, tv_size);
  949|      6|                        }
  950|      6|                        break;
  951|      0|                        case TIFF_SLONG:
  ------------------
  |  Branch (951:25): [True: 0, False: 228]
  ------------------
  952|      0|                        {
  953|      0|                            int32_t v2 = va_arg(ap, int32_t);
  954|      0|                            _TIFFmemcpy(val, &v2, tv_size);
  955|      0|                        }
  956|      0|                        break;
  957|     47|                        case TIFF_LONG8:
  ------------------
  |  Branch (957:25): [True: 47, False: 181]
  ------------------
  958|     61|                        case TIFF_IFD8:
  ------------------
  |  Branch (958:25): [True: 14, False: 214]
  ------------------
  959|     61|                        {
  960|     61|                            uint64_t v2 = va_arg(ap, uint64_t);
  961|     61|                            _TIFFmemcpy(val, &v2, tv_size);
  962|       |                            /* Test here for too big values for ClassicTIFF and
  963|       |                             * delete custom field from custom list */
  964|     61|                            if (!(tif->tif_flags & TIFF_BIGTIFF) &&
  ------------------
  |  |  140|     61|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (964:33): [True: 61, False: 0]
  ------------------
  965|     61|                                (v2 > 0xffffffffu))
  ------------------
  |  Branch (965:33): [True: 3, False: 58]
  ------------------
  966|      3|                            {
  967|      3|                                TIFFErrorExtR(
  968|      3|                                    tif, module,
  969|      3|                                    "%s: Bad LONG8 or IFD8 value %" PRIu64
  970|      3|                                    " for \"%s\" tag %u in ClassicTIFF. Tag "
  971|      3|                                    "won't be written to file",
  972|      3|                                    tif->tif_name, v2, fip->field_name, tag);
  973|      3|                                goto badvalueifd8long8;
  974|      3|                            }
  975|     61|                        }
  976|     58|                        break;
  977|     58|                        case TIFF_SLONG8:
  ------------------
  |  Branch (977:25): [True: 0, False: 228]
  ------------------
  978|      0|                        {
  979|      0|                            int64_t v2 = va_arg(ap, int64_t);
  980|      0|                            _TIFFmemcpy(val, &v2, tv_size);
  981|       |                            /* Test here for too big values for ClassicTIFF and
  982|       |                             * delete custom field from custom list */
  983|      0|                            if (!(tif->tif_flags & TIFF_BIGTIFF) &&
  ------------------
  |  |  140|      0|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (983:33): [True: 0, False: 0]
  ------------------
  984|      0|                                ((v2 > 2147483647) || (v2 < (-2147483647 - 1))))
  ------------------
  |  Branch (984:34): [True: 0, False: 0]
  |  Branch (984:55): [True: 0, False: 0]
  ------------------
  985|      0|                            {
  986|      0|                                TIFFErrorExtR(
  987|      0|                                    tif, module,
  988|      0|                                    "%s: Bad SLONG8 value %" PRIi64
  989|      0|                                    " for \"%s\" tag %u in ClassicTIFF. Tag "
  990|      0|                                    "won't be written to file",
  991|      0|                                    tif->tif_name, v2, fip->field_name, tag);
  992|      0|                                goto badvalueifd8long8;
  993|      0|                            }
  994|      0|                        }
  995|      0|                        break;
  996|     23|                        case TIFF_RATIONAL:
  ------------------
  |  Branch (996:25): [True: 23, False: 205]
  ------------------
  997|     33|                        case TIFF_SRATIONAL:
  ------------------
  |  Branch (997:25): [True: 10, False: 218]
  ------------------
  998|       |                            /*-- Rational2Double: For Rationals tv_size is set
  999|       |                             * above to 4 or 8 according to
 1000|       |                             * fip->set_get_field_type!
 1001|       |                             */
 1002|     33|                            {
 1003|     33|                                if (tv_size == 8)
  ------------------
  |  Branch (1003:37): [True: 0, False: 33]
  ------------------
 1004|      0|                                {
 1005|      0|                                    double v2 = va_arg(ap, double);
 1006|      0|                                    _TIFFmemcpy(val, &v2, tv_size);
 1007|      0|                                }
 1008|     33|                                else
 1009|     33|                                {
 1010|       |                                    /*-- default should be tv_size == 4 */
 1011|     33|                                    float v3 = (float)va_arg(ap, double);
 1012|     33|                                    _TIFFmemcpy(val, &v3, tv_size);
 1013|       |                                    /*-- ToDo: After Testing, this should be
 1014|       |                                     * removed and tv_size==4 should be set as
 1015|       |                                     * default. */
 1016|     33|                                    if (tv_size != 4)
  ------------------
  |  Branch (1016:41): [True: 0, False: 33]
  ------------------
 1017|      0|                                    {
 1018|      0|                                        TIFFErrorExtR(tif, module,
 1019|      0|                                                      "Rational2Double: "
 1020|      0|                                                      ".set_get_field_type "
 1021|      0|                                                      "in not 4 but %d",
 1022|      0|                                                      tv_size);
 1023|      0|                                    }
 1024|     33|                                }
 1025|     33|                            }
 1026|     33|                            break;
 1027|      0|                        case TIFF_FLOAT:
  ------------------
  |  Branch (1027:25): [True: 0, False: 228]
  ------------------
 1028|      0|                        {
 1029|      0|                            float v2 =
 1030|      0|                                _TIFFClampDoubleToFloat(va_arg(ap, double));
 1031|      0|                            _TIFFmemcpy(val, &v2, tv_size);
 1032|      0|                        }
 1033|      0|                        break;
 1034|      0|                        case TIFF_DOUBLE:
  ------------------
  |  Branch (1034:25): [True: 0, False: 228]
  ------------------
 1035|      0|                        {
 1036|      0|                            double v2 = va_arg(ap, double);
 1037|      0|                            _TIFFmemcpy(val, &v2, tv_size);
 1038|      0|                        }
 1039|      0|                        break;
 1040|      0|                        case TIFF_NOTYPE:
  ------------------
  |  Branch (1040:25): [True: 0, False: 228]
  ------------------
 1041|      0|                        case TIFF_ASCII:
  ------------------
  |  Branch (1041:25): [True: 0, False: 228]
  ------------------
 1042|      0|                        default:
  ------------------
  |  Branch (1042:25): [True: 0, False: 228]
  ------------------
 1043|      0|                            _TIFFmemset(val, 0, tv_size);
 1044|      0|                            status = 0;
 1045|      0|                            break;
 1046|    228|                    }
 1047|    228|                }
 1048|  6.20k|            }
 1049|  12.0k|        }
 1050|  64.3k|    }
 1051|  64.1k|    if (status)
  ------------------
  |  Branch (1051:9): [True: 64.1k, False: 0]
  ------------------
 1052|  64.1k|    {
 1053|  64.1k|        const TIFFField *fip2 = TIFFFieldWithTag(tif, tag);
 1054|  64.1k|        if (fip2)
  ------------------
  |  Branch (1054:13): [True: 64.1k, False: 0]
  ------------------
 1055|  64.1k|            TIFFSetFieldBit(tif, fip2->field_bit);
  ------------------
  |  |  249|  64.1k|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|  64.1k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|  64.1k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1056|  64.1k|        tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|  64.1k|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1057|  64.1k|    }
 1058|       |
 1059|  64.1k|end:
 1060|  64.1k|    va_end(ap);
 1061|  64.1k|    return (status);
 1062|     92|badvalue:
 1063|     92|{
 1064|     92|    const TIFFField *fip2 = TIFFFieldWithTag(tif, tag);
 1065|     92|    TIFFErrorExtR(tif, module, "%s: Bad value %" PRIu32 " for \"%s\" tag",
 1066|     92|                  tif->tif_name, v, fip2 ? fip2->field_name : "Unknown");
  ------------------
  |  Branch (1066:37): [True: 92, False: 0]
  ------------------
 1067|     92|    va_end(ap);
 1068|     92|}
 1069|     92|    return (0);
 1070|      0|badvalue32:
 1071|      0|{
 1072|      0|    const TIFFField *fip2 = TIFFFieldWithTag(tif, tag);
 1073|      0|    TIFFErrorExtR(tif, module, "%s: Bad value %" PRIu32 " for \"%s\" tag",
 1074|      0|                  tif->tif_name, v32, fip2 ? fip2->field_name : "Unknown");
  ------------------
  |  Branch (1074:39): [True: 0, False: 0]
  ------------------
 1075|      0|    va_end(ap);
 1076|      0|}
 1077|      0|    return (0);
 1078|      7|badvaluedouble:
 1079|      7|{
 1080|      7|    const TIFFField *fip2 = TIFFFieldWithTag(tif, tag);
 1081|      7|    TIFFErrorExtR(tif, module, "%s: Bad value %f for \"%s\" tag", tif->tif_name,
 1082|      7|                  dblval, fip2 ? fip2->field_name : "Unknown");
  ------------------
  |  Branch (1082:27): [True: 7, False: 0]
  ------------------
 1083|      7|    va_end(ap);
 1084|      7|}
 1085|      7|    return (0);
 1086|    111|badvalueifd8long8:
 1087|    111|{
 1088|       |    /* Error message issued already above. */
 1089|    111|    TIFFTagValue *tv2 = NULL;
 1090|    111|    int iCustom2, iC2;
 1091|       |    /* Find the existing entry for this custom value. */
 1092|    655|    for (iCustom2 = 0; iCustom2 < td->td_customValueCount; iCustom2++)
  ------------------
  |  Branch (1092:24): [True: 655, False: 0]
  ------------------
 1093|    655|    {
 1094|    655|        if (td->td_customValues[iCustom2].info->field_tag == tag)
  ------------------
  |  Branch (1094:13): [True: 111, False: 544]
  ------------------
 1095|    111|        {
 1096|    111|            tv2 = td->td_customValues + (iCustom2);
 1097|    111|            break;
 1098|    111|        }
 1099|    655|    }
 1100|    111|    if (tv2 != NULL)
  ------------------
  |  Branch (1100:9): [True: 111, False: 0]
  ------------------
 1101|    111|    {
 1102|       |        /* Remove custom field from custom list */
 1103|    111|        if (tv2->value != NULL)
  ------------------
  |  Branch (1103:13): [True: 111, False: 0]
  ------------------
 1104|    111|        {
 1105|    111|            _TIFFfreeExt(tif, tv2->value);
 1106|    111|            tv2->value = NULL;
 1107|    111|        }
 1108|       |        /* Shorten list and close gap in customValues list.
 1109|       |         * Re-allocation of td_customValues not necessary here. */
 1110|    111|        td->td_customValueCount--;
 1111|    111|        for (iC2 = iCustom2; iC2 < td->td_customValueCount; iC2++)
  ------------------
  |  Branch (1111:30): [True: 0, False: 111]
  ------------------
 1112|      0|        {
 1113|      0|            td->td_customValues[iC2] = td->td_customValues[iC2 + 1];
 1114|      0|        }
 1115|    111|    }
 1116|      0|    else
 1117|      0|    {
 1118|      0|        assert(0);
  ------------------
  |  Branch (1118:9): [Folded, False: 0]
  |  Branch (1118:9): [Folded, False: 0]
  ------------------
 1119|      0|    }
 1120|    111|    va_end(ap);
 1121|    111|}
 1122|    111|    return (0);
 1123|    111|} /*-- _TIFFVSetField() --*/
tif_dir.c:setExtraSamples:
  139|    186|{
  140|       |/* XXX: Unassociated alpha data == 999 is a known Corel Draw bug, see below */
  141|    186|#define EXTRASAMPLE_COREL_UNASSALPHA 999
  142|       |
  143|    186|    uint16_t *va;
  144|    186|    uint32_t i;
  145|    186|    TIFFDirectory *td = &tif->tif_dir;
  146|    186|    static const char module[] = "setExtraSamples";
  147|       |
  148|    186|    *v = (uint16_t)va_arg(ap, uint16_vap);
  149|    186|    if ((uint16_t)*v > td->td_samplesperpixel)
  ------------------
  |  Branch (149:9): [True: 0, False: 186]
  ------------------
  150|      0|        return 0;
  151|    186|    va = va_arg(ap, uint16_t *);
  152|    186|    if (*v > 0 && va == NULL) /* typically missing param */
  ------------------
  |  Branch (152:9): [True: 186, False: 0]
  |  Branch (152:19): [True: 0, False: 186]
  ------------------
  153|      0|        return 0;
  154|    373|    for (i = 0; i < *v; i++)
  ------------------
  |  Branch (154:17): [True: 187, False: 186]
  ------------------
  155|    187|    {
  156|    187|        if (va[i] > EXTRASAMPLE_UNASSALPHA)
  ------------------
  |  |  332|    187|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (156:13): [True: 0, False: 187]
  ------------------
  157|      0|        {
  158|       |            /*
  159|       |             * XXX: Corel Draw is known to produce incorrect
  160|       |             * ExtraSamples tags which must be patched here if we
  161|       |             * want to be able to open some of the damaged TIFF
  162|       |             * files:
  163|       |             */
  164|      0|            if (va[i] == EXTRASAMPLE_COREL_UNASSALPHA)
  ------------------
  |  |  141|      0|#define EXTRASAMPLE_COREL_UNASSALPHA 999
  ------------------
  |  Branch (164:17): [True: 0, False: 0]
  ------------------
  165|      0|                va[i] = EXTRASAMPLE_UNASSALPHA;
  ------------------
  |  |  332|      0|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  166|      0|            else
  167|      0|                return 0;
  168|      0|        }
  169|    187|    }
  170|       |
  171|    186|    if (td->td_transferfunction[0] != NULL &&
  ------------------
  |  Branch (171:9): [True: 0, False: 186]
  ------------------
  172|      0|        (td->td_samplesperpixel - *v > 1) &&
  ------------------
  |  Branch (172:9): [True: 0, False: 0]
  ------------------
  173|      0|        !(td->td_samplesperpixel - td->td_extrasamples > 1))
  ------------------
  |  Branch (173:9): [True: 0, False: 0]
  ------------------
  174|      0|    {
  175|      0|        TIFFWarningExtR(tif, module,
  176|      0|                        "ExtraSamples tag value is changing, "
  177|      0|                        "but TransferFunction was read with a different value. "
  178|      0|                        "Canceling it");
  179|      0|        TIFFClrFieldBit(tif, FIELD_TRANSFERFUNCTION);
  ------------------
  |  |  250|      0|#define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  247|      0|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFClrFieldBit(tif, field) (BITFIELDn(tif, field) &= ~BITn(field))
  |  |  ------------------
  |  |  |  |  246|      0|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  180|      0|        _TIFFfreeExt(tif, td->td_transferfunction[0]);
  181|      0|        td->td_transferfunction[0] = NULL;
  182|      0|    }
  183|       |
  184|    186|    td->td_extrasamples = (uint16_t)*v;
  185|    186|    _TIFFsetShortArrayExt(tif, &td->td_sampleinfo, va, td->td_extrasamples);
  186|    186|    return 1;
  187|       |
  188|    186|#undef EXTRASAMPLE_COREL_UNASSALPHA
  189|    186|}
tif_dir.c:_TIFFsetLong8Array:
   98|      3|{
   99|      3|    setByteArray(tif, (void **)lpp, lp, n, sizeof(uint64_t));
  100|      3|}
tif_dir.c:countInkNamesString:
  196|     11|{
  197|     11|    uint16_t i = 0;
  198|       |
  199|     11|    if (slen > 0)
  ------------------
  |  Branch (199:9): [True: 11, False: 0]
  ------------------
  200|     11|    {
  201|     11|        const char *ep = s + slen;
  202|     11|        const char *cp = s;
  203|     11|        do
  204|  7.15k|        {
  205|  17.7k|            for (; cp < ep && *cp != '\0'; cp++)
  ------------------
  |  Branch (205:20): [True: 17.7k, False: 0]
  |  Branch (205:31): [True: 10.6k, False: 7.15k]
  ------------------
  206|  10.6k|            {
  207|  10.6k|            }
  208|  7.15k|            if (cp >= ep)
  ------------------
  |  Branch (208:17): [True: 0, False: 7.15k]
  ------------------
  209|      0|                goto bad;
  210|  7.15k|            cp++; /* skip \0 */
  211|  7.15k|            i++;
  212|  7.15k|        } while (cp < ep);
  ------------------
  |  Branch (212:18): [True: 7.14k, False: 11]
  ------------------
  213|     11|        return (i);
  214|     11|    }
  215|      0|bad:
  216|      0|    TIFFErrorExtR(tif, "TIFFSetField",
  217|      0|                  "%s: Invalid InkNames value; no null at given buffer end "
  218|      0|                  "location %" PRIu32 ", after %" PRIu16 " ink",
  219|      0|                  tif->tif_name, slen, i);
  220|      0|    return (0);
  221|     11|}
tif_dir.c:_TIFFsetNString:
   72|     11|{
   73|     11|    setByteArray(tif, (void **)cpp, cp, n, 1);
   74|     11|}
tif_dir.c:_TIFFVGetField:
 1234|   343k|{
 1235|   343k|    TIFFDirectory *td = &tif->tif_dir;
 1236|   343k|    int ret_val = 1;
 1237|   343k|    uint32_t standard_tag = tag;
 1238|   343k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  341|   343k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
 1239|   343k|    if (fip == NULL) /* cannot happen since TIFFGetField() already checks it */
  ------------------
  |  Branch (1239:9): [True: 0, False: 343k]
  ------------------
 1240|      0|        return 0;
 1241|       |
 1242|       |    /*
 1243|       |     * We want to force the custom code to be used for custom
 1244|       |     * fields even if the tag happens to match a well known
 1245|       |     * one - important for reinterpreted handling of standard
 1246|       |     * tag values in custom directories (i.e. EXIF)
 1247|       |     */
 1248|   343k|    if (fip->field_bit == FIELD_CUSTOM)
  ------------------
  |  |  346|   343k|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (1248:9): [True: 503, False: 343k]
  ------------------
 1249|    503|    {
 1250|    503|        standard_tag = 0;
 1251|    503|    }
 1252|       |
 1253|   343k|    switch (standard_tag)
 1254|   343k|    {
 1255|      0|        case TIFFTAG_SUBFILETYPE:
  ------------------
  |  |  170|      0|#define TIFFTAG_SUBFILETYPE 254       /* subfile data descriptor */
  ------------------
  |  Branch (1255:9): [True: 0, False: 343k]
  ------------------
 1256|      0|            *va_arg(ap, uint32_t *) = td->td_subfiletype;
 1257|      0|            break;
 1258|  10.0k|        case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  178|  10.0k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  |  Branch (1258:9): [True: 10.0k, False: 333k]
  ------------------
 1259|  10.0k|            *va_arg(ap, uint32_t *) = td->td_imagewidth;
 1260|  10.0k|            break;
 1261|  7.59k|        case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  179|  7.59k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  |  Branch (1261:9): [True: 7.59k, False: 336k]
  ------------------
 1262|  7.59k|            *va_arg(ap, uint32_t *) = td->td_imagelength;
 1263|  7.59k|            break;
 1264|  2.70k|        case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|  2.70k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (1264:9): [True: 2.70k, False: 341k]
  ------------------
 1265|  2.70k|            *va_arg(ap, uint16_t *) = td->td_bitspersample;
 1266|  2.70k|            break;
 1267|  4.86k|        case TIFFTAG_COMPRESSION:
  ------------------
  |  |  181|  4.86k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  |  Branch (1267:9): [True: 4.86k, False: 338k]
  ------------------
 1268|  4.86k|            *va_arg(ap, uint16_t *) = td->td_compression;
 1269|  4.86k|            break;
 1270|  4.71k|        case TIFFTAG_PHOTOMETRIC:
  ------------------
  |  |  220|  4.71k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (1270:9): [True: 4.71k, False: 339k]
  ------------------
 1271|  4.71k|            *va_arg(ap, uint16_t *) = td->td_photometric;
 1272|  4.71k|            break;
 1273|      0|        case TIFFTAG_THRESHHOLDING:
  ------------------
  |  |  234|      0|#define TIFFTAG_THRESHHOLDING 263          /* +thresholding used on data */
  ------------------
  |  Branch (1273:9): [True: 0, False: 343k]
  ------------------
 1274|      0|            *va_arg(ap, uint16_t *) = td->td_threshholding;
 1275|      0|            break;
 1276|      0|        case TIFFTAG_FILLORDER:
  ------------------
  |  |  240|      0|#define TIFFTAG_FILLORDER 266              /* data order within a byte */
  ------------------
  |  Branch (1276:9): [True: 0, False: 343k]
  ------------------
 1277|      0|            *va_arg(ap, uint16_t *) = td->td_fillorder;
 1278|      0|            break;
 1279|    282|        case TIFFTAG_ORIENTATION:
  ------------------
  |  |  248|    282|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  |  Branch (1279:9): [True: 282, False: 343k]
  ------------------
 1280|    282|            *va_arg(ap, uint16_t *) = td->td_orientation;
 1281|    282|            break;
 1282|  1.85k|        case TIFFTAG_SAMPLESPERPIXEL:
  ------------------
  |  |  257|  1.85k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (1282:9): [True: 1.85k, False: 342k]
  ------------------
 1283|  1.85k|            *va_arg(ap, uint16_t *) = td->td_samplesperpixel;
 1284|  1.85k|            break;
 1285|  2.56k|        case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|  2.56k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (1285:9): [True: 2.56k, False: 341k]
  ------------------
 1286|  2.56k|            *va_arg(ap, uint32_t *) = td->td_rowsperstrip;
 1287|  2.56k|            break;
 1288|      0|        case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  260|      0|#define TIFFTAG_MINSAMPLEVALUE 280         /* +minimum sample value */
  ------------------
  |  Branch (1288:9): [True: 0, False: 343k]
  ------------------
 1289|      0|            *va_arg(ap, uint16_t *) = td->td_minsamplevalue;
 1290|      0|            break;
 1291|      0|        case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  261|      0|#define TIFFTAG_MAXSAMPLEVALUE 281         /* +maximum sample value */
  ------------------
  |  Branch (1291:9): [True: 0, False: 343k]
  ------------------
 1292|      0|            *va_arg(ap, uint16_t *) = td->td_maxsamplevalue;
 1293|      0|            break;
 1294|      0|        case TIFFTAG_SMINSAMPLEVALUE:
  ------------------
  |  |  340|      0|#define TIFFTAG_SMINSAMPLEVALUE 340        /* !variable MinSampleValue */
  ------------------
  |  Branch (1294:9): [True: 0, False: 343k]
  ------------------
 1295|      0|            if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  143|      0|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  |  Branch (1295:17): [True: 0, False: 0]
  ------------------
 1296|      0|                *va_arg(ap, double **) = td->td_sminsamplevalue;
 1297|      0|            else
 1298|      0|            {
 1299|       |                /* libtiff historically treats this as a single value. */
 1300|      0|                uint16_t i;
 1301|      0|                double v = td->td_sminsamplevalue[0];
 1302|      0|                for (i = 1; i < td->td_samplesperpixel; ++i)
  ------------------
  |  Branch (1302:29): [True: 0, False: 0]
  ------------------
 1303|      0|                    if (td->td_sminsamplevalue[i] < v)
  ------------------
  |  Branch (1303:25): [True: 0, False: 0]
  ------------------
 1304|      0|                        v = td->td_sminsamplevalue[i];
 1305|      0|                *va_arg(ap, double *) = v;
 1306|      0|            }
 1307|      0|            break;
 1308|      0|        case TIFFTAG_SMAXSAMPLEVALUE:
  ------------------
  |  |  341|      0|#define TIFFTAG_SMAXSAMPLEVALUE 341        /* !variable MaxSampleValue */
  ------------------
  |  Branch (1308:9): [True: 0, False: 343k]
  ------------------
 1309|      0|            if (tif->tif_flags & TIFF_PERSAMPLE)
  ------------------
  |  |  143|      0|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
  |  Branch (1309:17): [True: 0, False: 0]
  ------------------
 1310|      0|                *va_arg(ap, double **) = td->td_smaxsamplevalue;
 1311|      0|            else
 1312|      0|            {
 1313|       |                /* libtiff historically treats this as a single value. */
 1314|      0|                uint16_t i;
 1315|      0|                double v = td->td_smaxsamplevalue[0];
 1316|      0|                for (i = 1; i < td->td_samplesperpixel; ++i)
  ------------------
  |  Branch (1316:29): [True: 0, False: 0]
  ------------------
 1317|      0|                    if (td->td_smaxsamplevalue[i] > v)
  ------------------
  |  Branch (1317:25): [True: 0, False: 0]
  ------------------
 1318|      0|                        v = td->td_smaxsamplevalue[i];
 1319|      0|                *va_arg(ap, double *) = v;
 1320|      0|            }
 1321|      0|            break;
 1322|      0|        case TIFFTAG_XRESOLUTION:
  ------------------
  |  |  262|      0|#define TIFFTAG_XRESOLUTION 282            /* pixels/resolution in x */
  ------------------
  |  Branch (1322:9): [True: 0, False: 343k]
  ------------------
 1323|      0|            *va_arg(ap, float *) = td->td_xresolution;
 1324|      0|            break;
 1325|      0|        case TIFFTAG_YRESOLUTION:
  ------------------
  |  |  263|      0|#define TIFFTAG_YRESOLUTION 283            /* pixels/resolution in y */
  ------------------
  |  Branch (1325:9): [True: 0, False: 343k]
  ------------------
 1326|      0|            *va_arg(ap, float *) = td->td_yresolution;
 1327|      0|            break;
 1328|  3.20k|        case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  264|  3.20k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  |  Branch (1328:9): [True: 3.20k, False: 340k]
  ------------------
 1329|  3.20k|            *va_arg(ap, uint16_t *) = td->td_planarconfig;
 1330|  3.20k|            break;
 1331|      0|        case TIFFTAG_XPOSITION:
  ------------------
  |  |  268|      0|#define TIFFTAG_XPOSITION 286              /* x page offset of image lhs */
  ------------------
  |  Branch (1331:9): [True: 0, False: 343k]
  ------------------
 1332|      0|            *va_arg(ap, float *) = td->td_xposition;
 1333|      0|            break;
 1334|      0|        case TIFFTAG_YPOSITION:
  ------------------
  |  |  269|      0|#define TIFFTAG_YPOSITION 287              /* y page offset of image lhs */
  ------------------
  |  Branch (1334:9): [True: 0, False: 343k]
  ------------------
 1335|      0|            *va_arg(ap, float *) = td->td_yposition;
 1336|      0|            break;
 1337|      0|        case TIFFTAG_RESOLUTIONUNIT:
  ------------------
  |  |  287|      0|#define TIFFTAG_RESOLUTIONUNIT 296         /* units of resolutions */
  ------------------
  |  Branch (1337:9): [True: 0, False: 343k]
  ------------------
 1338|      0|            *va_arg(ap, uint16_t *) = td->td_resolutionunit;
 1339|      0|            break;
 1340|      0|        case TIFFTAG_PAGENUMBER:
  ------------------
  |  |  291|      0|#define TIFFTAG_PAGENUMBER 297             /* page numbers of multi-page */
  ------------------
  |  Branch (1340:9): [True: 0, False: 343k]
  ------------------
 1341|      0|            *va_arg(ap, uint16_t *) = td->td_pagenumber[0];
 1342|      0|            *va_arg(ap, uint16_t *) = td->td_pagenumber[1];
 1343|      0|            break;
 1344|      0|        case TIFFTAG_HALFTONEHINTS:
  ------------------
  |  |  310|      0|#define TIFFTAG_HALFTONEHINTS 321          /* !highlight+shadow info */
  ------------------
  |  Branch (1344:9): [True: 0, False: 343k]
  ------------------
 1345|      0|            *va_arg(ap, uint16_t *) = td->td_halftonehints[0];
 1346|      0|            *va_arg(ap, uint16_t *) = td->td_halftonehints[1];
 1347|      0|            break;
 1348|     33|        case TIFFTAG_COLORMAP:
  ------------------
  |  |  309|     33|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (1348:9): [True: 33, False: 343k]
  ------------------
 1349|     33|            *va_arg(ap, const uint16_t **) = td->td_colormap[0];
 1350|     33|            *va_arg(ap, const uint16_t **) = td->td_colormap[1];
 1351|     33|            *va_arg(ap, const uint16_t **) = td->td_colormap[2];
 1352|     33|            break;
 1353|      0|        case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  247|      0|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
  |  Branch (1353:9): [True: 0, False: 343k]
  ------------------
 1354|      0|        case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  313|      0|#define TIFFTAG_TILEOFFSETS 324            /* !offsets to data tiles */
  ------------------
  |  Branch (1354:9): [True: 0, False: 343k]
  ------------------
 1355|      0|            _TIFFFillStriles(tif);
 1356|      0|            *va_arg(ap, const uint64_t **) = td->td_stripoffset_p;
 1357|      0|            if (td->td_stripoffset_p == NULL)
  ------------------
  |  Branch (1357:17): [True: 0, False: 0]
  ------------------
 1358|      0|                ret_val = 0;
 1359|      0|            break;
 1360|      0|        case TIFFTAG_STRIPBYTECOUNTS:
  ------------------
  |  |  259|      0|#define TIFFTAG_STRIPBYTECOUNTS 279        /* bytes counts for strips */
  ------------------
  |  Branch (1360:9): [True: 0, False: 343k]
  ------------------
 1361|      0|        case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  314|      0|#define TIFFTAG_TILEBYTECOUNTS 325         /* !byte counts for tiles */
  ------------------
  |  Branch (1361:9): [True: 0, False: 343k]
  ------------------
 1362|      0|            _TIFFFillStriles(tif);
 1363|      0|            *va_arg(ap, const uint64_t **) = td->td_stripbytecount_p;
 1364|      0|            if (td->td_stripbytecount_p == NULL)
  ------------------
  |  Branch (1364:17): [True: 0, False: 0]
  ------------------
 1365|      0|                ret_val = 0;
 1366|      0|            break;
 1367|      0|        case TIFFTAG_MATTEING:
  ------------------
  |  |  405|      0|#define TIFFTAG_MATTEING 32995   /* $use ExtraSamples */
  ------------------
  |  Branch (1367:9): [True: 0, False: 343k]
  ------------------
 1368|      0|            *va_arg(ap, uint16_t *) =
 1369|      0|                (td->td_extrasamples == 1 && td->td_sampleinfo &&
  ------------------
  |  Branch (1369:18): [True: 0, False: 0]
  |  Branch (1369:46): [True: 0, False: 0]
  ------------------
 1370|      0|                 td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
  ------------------
  |  |  331|      0|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (1370:18): [True: 0, False: 0]
  ------------------
 1371|      0|            break;
 1372|    171|        case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|    171|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (1372:9): [True: 171, False: 343k]
  ------------------
 1373|    171|            *va_arg(ap, uint16_t *) = td->td_extrasamples;
 1374|    171|            *va_arg(ap, const uint16_t **) = td->td_sampleinfo;
 1375|    171|            break;
 1376|  4.91k|        case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  311|  4.91k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  |  Branch (1376:9): [True: 4.91k, False: 338k]
  ------------------
 1377|  4.91k|            *va_arg(ap, uint32_t *) = td->td_tilewidth;
 1378|  4.91k|            break;
 1379|  2.43k|        case TIFFTAG_TILELENGTH:
  ------------------
  |  |  312|  2.43k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  |  Branch (1379:9): [True: 2.43k, False: 341k]
  ------------------
 1380|  2.43k|            *va_arg(ap, uint32_t *) = td->td_tilelength;
 1381|  2.43k|            break;
 1382|      0|        case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  408|      0|#define TIFFTAG_TILEDEPTH 32998  /* z depth/data tile */
  ------------------
  |  Branch (1382:9): [True: 0, False: 343k]
  ------------------
 1383|      0|            *va_arg(ap, uint32_t *) = td->td_tiledepth;
 1384|      0|            break;
 1385|      0|        case TIFFTAG_DATATYPE:
  ------------------
  |  |  406|      0|#define TIFFTAG_DATATYPE 32996   /* $use SampleFormat */
  ------------------
  |  Branch (1385:9): [True: 0, False: 343k]
  ------------------
 1386|      0|            switch (td->td_sampleformat)
 1387|      0|            {
 1388|      0|                case SAMPLEFORMAT_UINT:
  ------------------
  |  |  334|      0|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  |  Branch (1388:17): [True: 0, False: 0]
  ------------------
 1389|      0|                    *va_arg(ap, uint16_t *) = DATATYPE_UINT;
  ------------------
  |  |   41|      0|#define DATATYPE_UINT 2   /* !unsigned integer data */
  ------------------
 1390|      0|                    break;
 1391|      0|                case SAMPLEFORMAT_INT:
  ------------------
  |  |  335|      0|#define SAMPLEFORMAT_INT 2                 /* !signed integer data */
  ------------------
  |  Branch (1391:17): [True: 0, False: 0]
  ------------------
 1392|      0|                    *va_arg(ap, uint16_t *) = DATATYPE_INT;
  ------------------
  |  |   40|      0|#define DATATYPE_INT 1    /* !signed integer data */
  ------------------
 1393|      0|                    break;
 1394|      0|                case SAMPLEFORMAT_IEEEFP:
  ------------------
  |  |  336|      0|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  |  Branch (1394:17): [True: 0, False: 0]
  ------------------
 1395|      0|                    *va_arg(ap, uint16_t *) = DATATYPE_IEEEFP;
  ------------------
  |  |   42|      0|#define DATATYPE_IEEEFP 3 /* !IEEE floating point data */
  ------------------
 1396|      0|                    break;
 1397|      0|                case SAMPLEFORMAT_VOID:
  ------------------
  |  |  337|      0|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
  |  Branch (1397:17): [True: 0, False: 0]
  ------------------
 1398|      0|                    *va_arg(ap, uint16_t *) = DATATYPE_VOID;
  ------------------
  |  |   39|      0|#define DATATYPE_VOID 0   /* !untyped data */
  ------------------
 1399|      0|                    break;
 1400|      0|                default:
  ------------------
  |  Branch (1400:17): [True: 0, False: 0]
  ------------------
 1401|      0|                    break;
 1402|      0|            }
 1403|      0|            break;
 1404|      0|        case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  333|      0|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
  |  Branch (1404:9): [True: 0, False: 343k]
  ------------------
 1405|      0|            *va_arg(ap, uint16_t *) = td->td_sampleformat;
 1406|      0|            break;
 1407|      0|        case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  407|      0|#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
  ------------------
  |  Branch (1407:9): [True: 0, False: 343k]
  ------------------
 1408|      0|            *va_arg(ap, uint32_t *) = td->td_imagedepth;
 1409|      0|            break;
 1410|      0|        case TIFFTAG_SUBIFD:
  ------------------
  |  |  321|      0|#define TIFFTAG_SUBIFD 330                 /* subimage descriptors */
  ------------------
  |  Branch (1410:9): [True: 0, False: 343k]
  ------------------
 1411|      0|            *va_arg(ap, uint16_t *) = td->td_nsubifd;
 1412|      0|            *va_arg(ap, const uint64_t **) = td->td_subifd;
 1413|      0|            break;
 1414|      0|        case TIFFTAG_YCBCRPOSITIONING:
  ------------------
  |  |  389|      0|#define TIFFTAG_YCBCRPOSITIONING 531       /* !subsample positioning */
  ------------------
  |  Branch (1414:9): [True: 0, False: 343k]
  ------------------
 1415|      0|            *va_arg(ap, uint16_t *) = td->td_ycbcrpositioning;
 1416|      0|            break;
 1417|   297k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|   297k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (1417:9): [True: 297k, False: 45.9k]
  ------------------
 1418|   297k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[0];
 1419|   297k|            *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[1];
 1420|   297k|            break;
 1421|      0|        case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|      0|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (1421:9): [True: 0, False: 343k]
  ------------------
 1422|      0|            *va_arg(ap, const uint16_t **) = td->td_transferfunction[0];
 1423|      0|            if (td->td_samplesperpixel - td->td_extrasamples > 1)
  ------------------
  |  Branch (1423:17): [True: 0, False: 0]
  ------------------
 1424|      0|            {
 1425|      0|                *va_arg(ap, const uint16_t **) = td->td_transferfunction[1];
 1426|      0|                *va_arg(ap, const uint16_t **) = td->td_transferfunction[2];
 1427|      0|            }
 1428|      0|            else
 1429|      0|            {
 1430|      0|                *va_arg(ap, const uint16_t **) = NULL;
 1431|      0|                *va_arg(ap, const uint16_t **) = NULL;
 1432|      0|            }
 1433|      0|            break;
 1434|      6|        case TIFFTAG_REFERENCEBLACKWHITE:
  ------------------
  |  |  392|      6|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
  |  Branch (1434:9): [True: 6, False: 343k]
  ------------------
 1435|      6|            *va_arg(ap, const float **) = td->td_refblackwhite;
 1436|      6|            break;
 1437|      0|        case TIFFTAG_INKNAMES:
  ------------------
  |  |  325|      0|#define TIFFTAG_INKNAMES 333               /* !ascii names of inks */
  ------------------
  |  Branch (1437:9): [True: 0, False: 343k]
  ------------------
 1438|      0|            *va_arg(ap, const char **) = td->td_inknames;
 1439|      0|            break;
 1440|      0|        case TIFFTAG_NUMBEROFINKS:
  ------------------
  |  |  326|      0|#define TIFFTAG_NUMBEROFINKS 334           /* !number of inks */
  ------------------
  |  Branch (1440:9): [True: 0, False: 343k]
  ------------------
 1441|      0|            *va_arg(ap, uint16_t *) = td->td_numberofinks;
 1442|      0|            break;
 1443|    503|        default:
  ------------------
  |  Branch (1443:9): [True: 503, False: 343k]
  ------------------
 1444|    503|        {
 1445|    503|            int i;
 1446|       |
 1447|       |            /*
 1448|       |             * This can happen if multiple images are open
 1449|       |             * with different codecs which have private
 1450|       |             * tags.  The global tag information table may
 1451|       |             * then have tags that are valid for one file
 1452|       |             * but not the other. If the client tries to
 1453|       |             * get a tag that is not valid for the image's
 1454|       |             * codec then we'll arrive here.
 1455|       |             */
 1456|    503|            if (fip->field_bit != FIELD_CUSTOM)
  ------------------
  |  |  346|    503|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (1456:17): [True: 0, False: 503]
  ------------------
 1457|      0|            {
 1458|      0|                TIFFErrorExtR(tif, "_TIFFVGetField",
 1459|      0|                              "%s: Invalid %stag \"%s\" "
 1460|      0|                              "(not supported by codec)",
 1461|      0|                              tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
  ------------------
  |  |  276|      0|#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
  |  |  ------------------
  |  |  |  Branch (276:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1462|      0|                              fip->field_name);
 1463|      0|                ret_val = 0;
 1464|      0|                break;
 1465|      0|            }
 1466|       |
 1467|       |            /*
 1468|       |             * Do we have a custom value?
 1469|       |             */
 1470|    503|            ret_val = 0;
 1471|  1.27k|            for (i = 0; i < td->td_customValueCount; i++)
  ------------------
  |  Branch (1471:25): [True: 785, False: 494]
  ------------------
 1472|    785|            {
 1473|    785|                TIFFTagValue *tv = td->td_customValues + i;
 1474|       |
 1475|    785|                if (tv->info->field_tag != tag)
  ------------------
  |  Branch (1475:21): [True: 776, False: 9]
  ------------------
 1476|    776|                    continue;
 1477|       |
 1478|      9|                if (fip->field_passcount)
  ------------------
  |  Branch (1478:21): [True: 0, False: 9]
  ------------------
 1479|      0|                {
 1480|      0|                    if (fip->field_readcount == TIFF_VARIABLE2)
  ------------------
  |  |  344|      0|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (1480:25): [True: 0, False: 0]
  ------------------
 1481|      0|                        *va_arg(ap, uint32_t *) = (uint32_t)tv->count;
 1482|      0|                    else /* Assume TIFF_VARIABLE */
 1483|      0|                        *va_arg(ap, uint16_t *) = (uint16_t)tv->count;
 1484|      0|                    *va_arg(ap, const void **) = tv->value;
 1485|      0|                    ret_val = 1;
 1486|      0|                }
 1487|      9|                else if (fip->field_tag == TIFFTAG_DOTRANGE &&
  ------------------
  |  |  327|     18|#define TIFFTAG_DOTRANGE 336               /* !0% and 100% dot codes */
  ------------------
  |  Branch (1487:26): [True: 0, False: 9]
  ------------------
 1488|      0|                         strcmp(fip->field_name, "DotRange") == 0)
  ------------------
  |  Branch (1488:26): [True: 0, False: 0]
  ------------------
 1489|      0|                {
 1490|       |                    /* TODO: This is an evil exception and should not have been
 1491|       |                       handled this way ... likely best if we move it into
 1492|       |                       the directory structure with an explicit field in
 1493|       |                       libtiff 4.1 and assign it a FIELD_ value */
 1494|      0|                    *va_arg(ap, uint16_t *) = ((uint16_t *)tv->value)[0];
 1495|      0|                    *va_arg(ap, uint16_t *) = ((uint16_t *)tv->value)[1];
 1496|      0|                    ret_val = 1;
 1497|      0|                }
 1498|      9|                else
 1499|      9|                {
 1500|      9|                    if (fip->field_type == TIFF_ASCII ||
  ------------------
  |  Branch (1500:25): [True: 0, False: 9]
  ------------------
 1501|      9|                        fip->field_readcount == TIFF_VARIABLE ||
  ------------------
  |  |  342|     18|#define TIFF_VARIABLE -1     /* marker for variable length tags */
  ------------------
  |  Branch (1501:25): [True: 0, False: 9]
  ------------------
 1502|      9|                        fip->field_readcount == TIFF_VARIABLE2 ||
  ------------------
  |  |  344|     18|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
  |  Branch (1502:25): [True: 0, False: 9]
  ------------------
 1503|      9|                        fip->field_readcount == TIFF_SPP || tv->count > 1)
  ------------------
  |  |  343|     18|#define TIFF_SPP -2          /* marker for SamplesPerPixel tags */
  ------------------
  |  Branch (1503:25): [True: 0, False: 9]
  |  Branch (1503:61): [True: 8, False: 1]
  ------------------
 1504|      8|                    {
 1505|      8|                        *va_arg(ap, void **) = tv->value;
 1506|      8|                        ret_val = 1;
 1507|      8|                    }
 1508|      1|                    else
 1509|      1|                    {
 1510|      1|                        char *val = (char *)tv->value;
 1511|      1|                        assert(tv->count == 1);
  ------------------
  |  Branch (1511:25): [True: 0, False: 1]
  |  Branch (1511:25): [True: 1, False: 0]
  ------------------
 1512|      1|                        switch (fip->field_type)
 1513|      1|                        {
 1514|      0|                            case TIFF_BYTE:
  ------------------
  |  Branch (1514:29): [True: 0, False: 1]
  ------------------
 1515|      0|                            case TIFF_UNDEFINED:
  ------------------
  |  Branch (1515:29): [True: 0, False: 1]
  ------------------
 1516|      0|                                *va_arg(ap, uint8_t *) = *(uint8_t *)val;
 1517|      0|                                ret_val = 1;
 1518|      0|                                break;
 1519|      0|                            case TIFF_SBYTE:
  ------------------
  |  Branch (1519:29): [True: 0, False: 1]
  ------------------
 1520|      0|                                *va_arg(ap, int8_t *) = *(int8_t *)val;
 1521|      0|                                ret_val = 1;
 1522|      0|                                break;
 1523|      1|                            case TIFF_SHORT:
  ------------------
  |  Branch (1523:29): [True: 1, False: 0]
  ------------------
 1524|      1|                                *va_arg(ap, uint16_t *) = *(uint16_t *)val;
 1525|      1|                                ret_val = 1;
 1526|      1|                                break;
 1527|      0|                            case TIFF_SSHORT:
  ------------------
  |  Branch (1527:29): [True: 0, False: 1]
  ------------------
 1528|      0|                                *va_arg(ap, int16_t *) = *(int16_t *)val;
 1529|      0|                                ret_val = 1;
 1530|      0|                                break;
 1531|      0|                            case TIFF_LONG:
  ------------------
  |  Branch (1531:29): [True: 0, False: 1]
  ------------------
 1532|      0|                            case TIFF_IFD:
  ------------------
  |  Branch (1532:29): [True: 0, False: 1]
  ------------------
 1533|      0|                                *va_arg(ap, uint32_t *) = *(uint32_t *)val;
 1534|      0|                                ret_val = 1;
 1535|      0|                                break;
 1536|      0|                            case TIFF_SLONG:
  ------------------
  |  Branch (1536:29): [True: 0, False: 1]
  ------------------
 1537|      0|                                *va_arg(ap, int32_t *) = *(int32_t *)val;
 1538|      0|                                ret_val = 1;
 1539|      0|                                break;
 1540|      0|                            case TIFF_LONG8:
  ------------------
  |  Branch (1540:29): [True: 0, False: 1]
  ------------------
 1541|      0|                            case TIFF_IFD8:
  ------------------
  |  Branch (1541:29): [True: 0, False: 1]
  ------------------
 1542|      0|                                *va_arg(ap, uint64_t *) = *(uint64_t *)val;
 1543|      0|                                ret_val = 1;
 1544|      0|                                break;
 1545|      0|                            case TIFF_SLONG8:
  ------------------
  |  Branch (1545:29): [True: 0, False: 1]
  ------------------
 1546|      0|                                *va_arg(ap, int64_t *) = *(int64_t *)val;
 1547|      0|                                ret_val = 1;
 1548|      0|                                break;
 1549|      0|                            case TIFF_RATIONAL:
  ------------------
  |  Branch (1549:29): [True: 0, False: 1]
  ------------------
 1550|      0|                            case TIFF_SRATIONAL:
  ------------------
  |  Branch (1550:29): [True: 0, False: 1]
  ------------------
 1551|      0|                            {
 1552|       |                                /*-- Rational2Double: For Rationals evaluate
 1553|       |                                 * "set_get_field_type" to determine internal
 1554|       |                                 * storage size and return value size. */
 1555|      0|                                int tv_size = TIFFFieldSetGetSize(fip);
 1556|      0|                                if (tv_size == 8)
  ------------------
  |  Branch (1556:37): [True: 0, False: 0]
  ------------------
 1557|      0|                                {
 1558|      0|                                    *va_arg(ap, double *) = *(double *)val;
 1559|      0|                                    ret_val = 1;
 1560|      0|                                }
 1561|      0|                                else
 1562|      0|                                {
 1563|       |                                    /*-- default should be tv_size == 4  */
 1564|      0|                                    *va_arg(ap, float *) = *(float *)val;
 1565|      0|                                    ret_val = 1;
 1566|       |                                    /*-- ToDo: After Testing, this should be
 1567|       |                                     * removed and tv_size==4 should be set as
 1568|       |                                     * default. */
 1569|      0|                                    if (tv_size != 4)
  ------------------
  |  Branch (1569:41): [True: 0, False: 0]
  ------------------
 1570|      0|                                    {
 1571|      0|                                        TIFFErrorExtR(tif, "_TIFFVGetField",
 1572|      0|                                                      "Rational2Double: "
 1573|      0|                                                      ".set_get_field_type "
 1574|      0|                                                      "in not 4 but %d",
 1575|      0|                                                      tv_size);
 1576|      0|                                    }
 1577|      0|                                }
 1578|      0|                            }
 1579|      0|                            break;
 1580|      0|                            case TIFF_FLOAT:
  ------------------
  |  Branch (1580:29): [True: 0, False: 1]
  ------------------
 1581|      0|                                *va_arg(ap, float *) = *(float *)val;
 1582|      0|                                ret_val = 1;
 1583|      0|                                break;
 1584|      0|                            case TIFF_DOUBLE:
  ------------------
  |  Branch (1584:29): [True: 0, False: 1]
  ------------------
 1585|      0|                                *va_arg(ap, double *) = *(double *)val;
 1586|      0|                                ret_val = 1;
 1587|      0|                                break;
 1588|      0|                            case TIFF_NOTYPE:
  ------------------
  |  Branch (1588:29): [True: 0, False: 1]
  ------------------
 1589|      0|                            case TIFF_ASCII:
  ------------------
  |  Branch (1589:29): [True: 0, False: 1]
  ------------------
 1590|      0|                            default:
  ------------------
  |  Branch (1590:29): [True: 0, False: 1]
  ------------------
 1591|      0|                                ret_val = 0;
 1592|      0|                                break;
 1593|      1|                        }
 1594|      1|                    }
 1595|      9|                }
 1596|      9|                break;
 1597|      9|            }
 1598|    503|        }
 1599|   343k|    }
 1600|   343k|    return (ret_val);
 1601|   343k|}

_TIFFGetFields:
  561|  5.98k|const TIFFFieldArray *_TIFFGetFields(void) { return (&tiffFieldArray); }
_TIFFSetupFields:
  568|  5.98k|{
  569|  5.98k|    if (tif->tif_fields && tif->tif_nfields > 0)
  ------------------
  |  Branch (569:9): [True: 0, False: 5.98k]
  |  Branch (569:28): [True: 0, False: 0]
  ------------------
  570|      0|    {
  571|      0|        uint32_t i;
  572|       |
  573|      0|        for (i = 0; i < tif->tif_nfields; i++)
  ------------------
  |  Branch (573:21): [True: 0, False: 0]
  ------------------
  574|      0|        {
  575|      0|            TIFFField *fld = tif->tif_fields[i];
  576|      0|            if (fld->field_name != NULL)
  ------------------
  |  Branch (576:17): [True: 0, False: 0]
  ------------------
  577|      0|            {
  578|      0|                if (fld->field_bit == FIELD_CUSTOM && TIFFFieldIsAnonymous(fld))
  ------------------
  |  |  346|      0|#define FIELD_CUSTOM 65
  ------------------
  |  Branch (578:21): [True: 0, False: 0]
  |  Branch (578:55): [True: 0, False: 0]
  ------------------
  579|      0|                {
  580|      0|                    _TIFFfreeExt(tif, (void *)fld->field_name);
  581|       |                    /* caution: tif_fields[i] must not be the beginning of a
  582|       |                     * fields-array. Otherwise the following tags are also freed
  583|       |                     * with the first free().
  584|       |                     */
  585|      0|                    _TIFFfreeExt(tif, fld);
  586|      0|                }
  587|      0|            }
  588|      0|        }
  589|       |
  590|      0|        _TIFFfreeExt(tif, tif->tif_fields);
  591|      0|        tif->tif_fields = NULL;
  592|      0|        tif->tif_nfields = 0;
  593|      0|    }
  594|  5.98k|    if (!_TIFFMergeFields(tif, fieldarray->fields, fieldarray->count))
  ------------------
  |  Branch (594:9): [True: 0, False: 5.98k]
  ------------------
  595|      0|    {
  596|      0|        TIFFErrorExtR(tif, "_TIFFSetupFields", "Setting up field info failed");
  597|      0|    }
  598|  5.98k|}
_TIFFMergeFields:
  628|   129k|{
  629|   129k|    static const char module[] = "_TIFFMergeFields";
  630|   129k|    static const char reason[] = "for fields array";
  631|       |    /* TIFFField** tp; */
  632|   129k|    uint32_t i;
  633|       |
  634|   129k|    tif->tif_foundfield = NULL;
  635|       |
  636|   129k|    TIFFField **tif_newfields = NULL;
  637|       |
  638|   129k|    if (tif->tif_fields && tif->tif_nfields > 0)
  ------------------
  |  Branch (638:9): [True: 123k, False: 5.98k]
  |  Branch (638:28): [True: 123k, False: 0]
  ------------------
  639|   123k|    {
  640|   123k|        tif_newfields = (TIFFField **)_TIFFCheckRealloc(
  641|   123k|            tif, tif->tif_fields, (tmsize_t)tif->tif_nfields + n,
  642|   123k|            (tmsize_t)sizeof(TIFFField *), reason);
  643|   123k|    }
  644|  5.98k|    else
  645|  5.98k|    {
  646|  5.98k|        tif_newfields =
  647|  5.98k|            (TIFFField **)_TIFFCheckMalloc(tif, n, sizeof(TIFFField *), reason);
  648|  5.98k|    }
  649|   129k|    if (!tif_newfields)
  ------------------
  |  Branch (649:9): [True: 0, False: 129k]
  ------------------
  650|      0|    {
  651|      0|        tif->tif_nfields = 0;
  652|      0|        TIFFErrorExtR(tif, module, "Failed to allocate fields array");
  653|      0|        return 0;
  654|      0|    }
  655|   129k|    tif->tif_fields = tif_newfields;
  656|       |
  657|       |    /* tp = tif->tif_fields + tif->tif_nfields; */
  658|  1.18M|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (658:17): [True: 1.05M, False: 129k]
  ------------------
  659|  1.05M|    {
  660|  1.05M|        const TIFFField *fip = TIFFFindField(tif, info[i].field_tag, TIFF_ANY);
  ------------------
  |  |  341|  1.05M|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  661|       |
  662|       |        /* only add definitions that aren't already present */
  663|  1.05M|        if (!fip)
  ------------------
  |  Branch (663:13): [True: 1.05M, False: 0]
  ------------------
  664|  1.05M|        {
  665|  1.05M|            tif->tif_fields[tif->tif_nfields] = (TIFFField *)(info + i);
  666|  1.05M|            tif->tif_nfields++;
  667|  1.05M|        }
  668|  1.05M|    }
  669|       |
  670|       |    /* Sort the field info by tag number */
  671|   129k|    qsort(tif->tif_fields, tif->tif_nfields, sizeof(TIFFField *), tagCompare);
  672|       |
  673|   129k|    return (int)n;
  674|   129k|}
TIFFDataWidth:
  696|  77.6k|{
  697|  77.6k|    switch (type)
  698|  77.6k|    {
  699|    997|        case 0: /* nothing */
  ------------------
  |  Branch (699:9): [True: 997, False: 76.6k]
  ------------------
  700|  15.9k|        case TIFF_BYTE:
  ------------------
  |  Branch (700:9): [True: 14.9k, False: 62.6k]
  ------------------
  701|  27.4k|        case TIFF_ASCII:
  ------------------
  |  Branch (701:9): [True: 11.4k, False: 66.1k]
  ------------------
  702|  28.5k|        case TIFF_SBYTE:
  ------------------
  |  Branch (702:9): [True: 1.15k, False: 76.4k]
  ------------------
  703|  30.7k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (703:9): [True: 2.19k, False: 75.4k]
  ------------------
  704|  30.7k|            return 1;
  705|  21.3k|        case TIFF_SHORT:
  ------------------
  |  Branch (705:9): [True: 21.3k, False: 56.2k]
  ------------------
  706|  22.9k|        case TIFF_SSHORT:
  ------------------
  |  Branch (706:9): [True: 1.58k, False: 76.0k]
  ------------------
  707|  22.9k|            return 2;
  708|  11.7k|        case TIFF_LONG:
  ------------------
  |  Branch (708:9): [True: 11.7k, False: 65.8k]
  ------------------
  709|  12.1k|        case TIFF_SLONG:
  ------------------
  |  Branch (709:9): [True: 442, False: 77.1k]
  ------------------
  710|  12.2k|        case TIFF_FLOAT:
  ------------------
  |  Branch (710:9): [True: 112, False: 77.5k]
  ------------------
  711|  12.4k|        case TIFF_IFD:
  ------------------
  |  Branch (711:9): [True: 195, False: 77.4k]
  ------------------
  712|  12.4k|            return 4;
  713|  2.12k|        case TIFF_RATIONAL:
  ------------------
  |  Branch (713:9): [True: 2.12k, False: 75.4k]
  ------------------
  714|  2.49k|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (714:9): [True: 370, False: 77.2k]
  ------------------
  715|  7.76k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (715:9): [True: 5.27k, False: 72.3k]
  ------------------
  716|  10.4k|        case TIFF_LONG8:
  ------------------
  |  Branch (716:9): [True: 2.71k, False: 74.9k]
  ------------------
  717|  11.0k|        case TIFF_SLONG8:
  ------------------
  |  Branch (717:9): [True: 575, False: 77.0k]
  ------------------
  718|  11.2k|        case TIFF_IFD8:
  ------------------
  |  Branch (718:9): [True: 164, False: 77.4k]
  ------------------
  719|  11.2k|            return 8;
  720|    165|        default:
  ------------------
  |  Branch (720:9): [True: 165, False: 77.4k]
  ------------------
  721|    165|            return 0; /* will return 0 for unknown types */
  722|  77.6k|    }
  723|  77.6k|}
TIFFFieldSetGetSize:
  732|  12.0k|{
  733|       |    /*
  734|       |     * TIFFSetField() and TIFFGetField() must provide the parameter accordingly
  735|       |     * to the definition of "set_get_field_type" of the tag definition in
  736|       |     * dir_info.c. This function returns the data size for that purpose.
  737|       |     *
  738|       |     * Furthermore, this data size is also used for the internal storage,
  739|       |     * even for TIFF_RATIONAL values for FIELD_CUSTOM, which are stored
  740|       |     * internally as 4-byte float, but some of them should be stored internally
  741|       |     * as 8-byte double, depending on the "set_get_field_type" _FLOAT_ or
  742|       |     * _DOUBLE_.
  743|       |     */
  744|  12.0k|    if (fip == NULL)
  ------------------
  |  Branch (744:9): [True: 0, False: 12.0k]
  ------------------
  745|      0|        return 0;
  746|       |
  747|  12.0k|    switch (fip->set_get_field_type)
  748|  12.0k|    {
  749|      0|        case TIFF_SETGET_UNDEFINED:
  ------------------
  |  Branch (749:9): [True: 0, False: 12.0k]
  ------------------
  750|    991|        case TIFF_SETGET_ASCII:
  ------------------
  |  Branch (750:9): [True: 991, False: 11.0k]
  ------------------
  751|    991|        case TIFF_SETGET_C0_ASCII:
  ------------------
  |  Branch (751:9): [True: 0, False: 12.0k]
  ------------------
  752|    991|        case TIFF_SETGET_C16_ASCII:
  ------------------
  |  Branch (752:9): [True: 0, False: 12.0k]
  ------------------
  753|  4.04k|        case TIFF_SETGET_C32_ASCII:
  ------------------
  |  Branch (753:9): [True: 3.04k, False: 9.01k]
  ------------------
  754|  4.04k|        case TIFF_SETGET_OTHER:
  ------------------
  |  Branch (754:9): [True: 0, False: 12.0k]
  ------------------
  755|  4.04k|            return 1;
  756|      6|        case TIFF_SETGET_UINT8:
  ------------------
  |  Branch (756:9): [True: 6, False: 12.0k]
  ------------------
  757|      6|        case TIFF_SETGET_SINT8:
  ------------------
  |  Branch (757:9): [True: 0, False: 12.0k]
  ------------------
  758|     32|        case TIFF_SETGET_C0_UINT8:
  ------------------
  |  Branch (758:9): [True: 26, False: 12.0k]
  ------------------
  759|     32|        case TIFF_SETGET_C0_SINT8:
  ------------------
  |  Branch (759:9): [True: 0, False: 12.0k]
  ------------------
  760|     39|        case TIFF_SETGET_C16_UINT8:
  ------------------
  |  Branch (760:9): [True: 7, False: 12.0k]
  ------------------
  761|     39|        case TIFF_SETGET_C16_SINT8:
  ------------------
  |  Branch (761:9): [True: 0, False: 12.0k]
  ------------------
  762|  2.00k|        case TIFF_SETGET_C32_UINT8:
  ------------------
  |  Branch (762:9): [True: 1.96k, False: 10.0k]
  ------------------
  763|  2.05k|        case TIFF_SETGET_C32_SINT8:
  ------------------
  |  Branch (763:9): [True: 49, False: 12.0k]
  ------------------
  764|  2.05k|            return 1;
  765|    122|        case TIFF_SETGET_UINT16:
  ------------------
  |  Branch (765:9): [True: 122, False: 11.9k]
  ------------------
  766|    122|        case TIFF_SETGET_SINT16:
  ------------------
  |  Branch (766:9): [True: 0, False: 12.0k]
  ------------------
  767|    122|        case TIFF_SETGET_C0_UINT16:
  ------------------
  |  Branch (767:9): [True: 0, False: 12.0k]
  ------------------
  768|    122|        case TIFF_SETGET_C0_SINT16:
  ------------------
  |  Branch (768:9): [True: 0, False: 12.0k]
  ------------------
  769|    123|        case TIFF_SETGET_C16_UINT16:
  ------------------
  |  Branch (769:9): [True: 1, False: 12.0k]
  ------------------
  770|    123|        case TIFF_SETGET_C16_SINT16:
  ------------------
  |  Branch (770:9): [True: 0, False: 12.0k]
  ------------------
  771|  2.48k|        case TIFF_SETGET_C32_UINT16:
  ------------------
  |  Branch (771:9): [True: 2.35k, False: 9.70k]
  ------------------
  772|  2.59k|        case TIFF_SETGET_C32_SINT16:
  ------------------
  |  Branch (772:9): [True: 112, False: 11.9k]
  ------------------
  773|  2.59k|            return 2;
  774|      0|        case TIFF_SETGET_INT:
  ------------------
  |  Branch (774:9): [True: 0, False: 12.0k]
  ------------------
  775|      6|        case TIFF_SETGET_UINT32:
  ------------------
  |  Branch (775:9): [True: 6, False: 12.0k]
  ------------------
  776|      6|        case TIFF_SETGET_SINT32:
  ------------------
  |  Branch (776:9): [True: 0, False: 12.0k]
  ------------------
  777|     39|        case TIFF_SETGET_FLOAT:
  ------------------
  |  Branch (777:9): [True: 33, False: 12.0k]
  ------------------
  778|     39|        case TIFF_SETGET_UINT16_PAIR:
  ------------------
  |  Branch (778:9): [True: 0, False: 12.0k]
  ------------------
  779|     54|        case TIFF_SETGET_C0_UINT32:
  ------------------
  |  Branch (779:9): [True: 15, False: 12.0k]
  ------------------
  780|     54|        case TIFF_SETGET_C0_SINT32:
  ------------------
  |  Branch (780:9): [True: 0, False: 12.0k]
  ------------------
  781|     76|        case TIFF_SETGET_C0_FLOAT:
  ------------------
  |  Branch (781:9): [True: 22, False: 12.0k]
  ------------------
  782|    112|        case TIFF_SETGET_C16_UINT32:
  ------------------
  |  Branch (782:9): [True: 36, False: 12.0k]
  ------------------
  783|    112|        case TIFF_SETGET_C16_SINT32:
  ------------------
  |  Branch (783:9): [True: 0, False: 12.0k]
  ------------------
  784|    228|        case TIFF_SETGET_C16_FLOAT:
  ------------------
  |  Branch (784:9): [True: 116, False: 11.9k]
  ------------------
  785|    500|        case TIFF_SETGET_C32_UINT32:
  ------------------
  |  Branch (785:9): [True: 272, False: 11.7k]
  ------------------
  786|    550|        case TIFF_SETGET_C32_SINT32:
  ------------------
  |  Branch (786:9): [True: 50, False: 12.0k]
  ------------------
  787|    768|        case TIFF_SETGET_C32_FLOAT:
  ------------------
  |  Branch (787:9): [True: 218, False: 11.8k]
  ------------------
  788|    768|            return 4;
  789|     47|        case TIFF_SETGET_UINT64:
  ------------------
  |  Branch (789:9): [True: 47, False: 12.0k]
  ------------------
  790|     47|        case TIFF_SETGET_SINT64:
  ------------------
  |  Branch (790:9): [True: 0, False: 12.0k]
  ------------------
  791|     47|        case TIFF_SETGET_DOUBLE:
  ------------------
  |  Branch (791:9): [True: 0, False: 12.0k]
  ------------------
  792|     61|        case TIFF_SETGET_IFD8:
  ------------------
  |  Branch (792:9): [True: 14, False: 12.0k]
  ------------------
  793|     61|        case TIFF_SETGET_C0_UINT64:
  ------------------
  |  Branch (793:9): [True: 0, False: 12.0k]
  ------------------
  794|     61|        case TIFF_SETGET_C0_SINT64:
  ------------------
  |  Branch (794:9): [True: 0, False: 12.0k]
  ------------------
  795|     61|        case TIFF_SETGET_C0_DOUBLE:
  ------------------
  |  Branch (795:9): [True: 0, False: 12.0k]
  ------------------
  796|     61|        case TIFF_SETGET_C0_IFD8:
  ------------------
  |  Branch (796:9): [True: 0, False: 12.0k]
  ------------------
  797|     61|        case TIFF_SETGET_C16_UINT64:
  ------------------
  |  Branch (797:9): [True: 0, False: 12.0k]
  ------------------
  798|     61|        case TIFF_SETGET_C16_SINT64:
  ------------------
  |  Branch (798:9): [True: 0, False: 12.0k]
  ------------------
  799|     61|        case TIFF_SETGET_C16_DOUBLE:
  ------------------
  |  Branch (799:9): [True: 0, False: 12.0k]
  ------------------
  800|     61|        case TIFF_SETGET_C16_IFD8:
  ------------------
  |  Branch (800:9): [True: 0, False: 12.0k]
  ------------------
  801|     86|        case TIFF_SETGET_C32_UINT64:
  ------------------
  |  Branch (801:9): [True: 25, False: 12.0k]
  ------------------
  802|    223|        case TIFF_SETGET_C32_SINT64:
  ------------------
  |  Branch (802:9): [True: 137, False: 11.9k]
  ------------------
  803|  2.55k|        case TIFF_SETGET_C32_DOUBLE:
  ------------------
  |  Branch (803:9): [True: 2.33k, False: 9.72k]
  ------------------
  804|  2.60k|        case TIFF_SETGET_C32_IFD8:
  ------------------
  |  Branch (804:9): [True: 47, False: 12.0k]
  ------------------
  805|  2.60k|            return 8;
  806|      0|        default:
  ------------------
  |  Branch (806:9): [True: 0, False: 12.0k]
  ------------------
  807|      0|            return 0;
  808|  12.0k|    }
  809|  12.0k|} /*-- TIFFFieldSetGetSize() --- */
TIFFFindField:
  882|  1.98M|{
  883|  1.98M|    TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0,   TIFF_SETGET_UNDEFINED,
  884|  1.98M|                     0, 0, 0, NULL,        NULL};
  885|  1.98M|    TIFFField *pkey = &key;
  886|  1.98M|    const TIFFField **ret;
  887|  1.98M|    if (tif->tif_foundfield && tif->tif_foundfield->field_tag == tag &&
  ------------------
  |  Branch (887:9): [True: 902k, False: 1.07M]
  |  Branch (887:32): [True: 780k, False: 121k]
  ------------------
  888|   780k|        (dt == TIFF_ANY || dt == tif->tif_foundfield->field_type))
  ------------------
  |  |  341|  1.56M|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  |  Branch (888:10): [True: 780k, False: 0]
  |  Branch (888:28): [True: 0, False: 0]
  ------------------
  889|   780k|        return tif->tif_foundfield;
  890|       |
  891|       |    /* If we are invoked with no field information, then just return. */
  892|  1.20M|    if (!tif->tif_fields)
  ------------------
  |  Branch (892:9): [True: 0, False: 1.20M]
  ------------------
  893|      0|        return NULL;
  894|       |
  895|       |    /* NB: use sorted search (e.g. binary search) */
  896|       |
  897|  1.20M|    key.field_tag = tag;
  898|  1.20M|    key.field_type = dt;
  899|       |
  900|  1.20M|    ret = (const TIFFField **)bsearch(&pkey, tif->tif_fields, tif->tif_nfields,
  901|  1.20M|                                      sizeof(TIFFField *), tagCompare);
  902|  1.20M|    return tif->tif_foundfield = (ret ? *ret : NULL);
  ------------------
  |  Branch (902:35): [True: 145k, False: 1.05M]
  ------------------
  903|  1.20M|}
TIFFFieldWithTag:
  934|  76.0k|{
  935|  76.0k|    const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
  ------------------
  |  |  341|  76.0k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  936|  76.0k|    if (!fip)
  ------------------
  |  Branch (936:9): [True: 0, False: 76.0k]
  ------------------
  937|      0|    {
  938|      0|        if (tif->tif_warn_about_unknown_tags)
  ------------------
  |  Branch (938:13): [True: 0, False: 0]
  ------------------
  939|      0|        {
  940|      0|            TIFFWarningExtR(tif, "TIFFFieldWithTag",
  941|      0|                            "Warning, unknown tag 0x%x", (unsigned int)tag);
  942|      0|        }
  943|      0|    }
  944|  76.0k|    return (fip);
  945|  76.0k|}
TIFFFieldIsAnonymous:
  974|   733k|{
  975|   733k|    return (int)fip->field_anonymous;
  976|   733k|}
_TIFFCreateAnonField:
  997|   117k|{
  998|   117k|    TIFFField *fld;
  999|   117k|    (void)tif;
 1000|       |
 1001|   117k|    fld = (TIFFField *)_TIFFmallocExt(tif, sizeof(TIFFField));
 1002|   117k|    if (fld == NULL)
  ------------------
  |  Branch (1002:9): [True: 0, False: 117k]
  ------------------
 1003|      0|        return NULL;
 1004|   117k|    _TIFFmemset(fld, 0, sizeof(TIFFField));
 1005|       |
 1006|   117k|    fld->field_tag = tag;
 1007|   117k|    fld->field_readcount = TIFF_VARIABLE2;
  ------------------
  |  |  344|   117k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
 1008|   117k|    fld->field_writecount = TIFF_VARIABLE2;
  ------------------
  |  |  344|   117k|#define TIFF_VARIABLE2 -3    /* marker for uint32_t var-length tags */
  ------------------
 1009|   117k|    fld->field_type = field_type;
 1010|   117k|    fld->field_anonymous =
 1011|   117k|        1; /* indicate that this is an anonymous / unknown tag */
 1012|   117k|    switch (field_type)
 1013|   117k|    {
 1014|  3.33k|        case TIFF_BYTE:
  ------------------
  |  Branch (1014:9): [True: 3.33k, False: 114k]
  ------------------
 1015|  3.90k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1015:9): [True: 572, False: 116k]
  ------------------
 1016|  3.90k|            fld->set_get_field_type = TIFF_SETGET_C32_UINT8;
 1017|  3.90k|            break;
 1018|  6.25k|        case TIFF_ASCII:
  ------------------
  |  Branch (1018:9): [True: 6.25k, False: 111k]
  ------------------
 1019|  6.25k|            fld->set_get_field_type = TIFF_SETGET_C32_ASCII;
 1020|  6.25k|            break;
 1021|  4.24k|        case TIFF_SHORT:
  ------------------
  |  Branch (1021:9): [True: 4.24k, False: 113k]
  ------------------
 1022|  4.24k|            fld->set_get_field_type = TIFF_SETGET_C32_UINT16;
 1023|  4.24k|            break;
 1024|  1.34k|        case TIFF_LONG:
  ------------------
  |  Branch (1024:9): [True: 1.34k, False: 116k]
  ------------------
 1025|  1.34k|            fld->set_get_field_type = TIFF_SETGET_C32_UINT32;
 1026|  1.34k|            break;
 1027|    963|        case TIFF_RATIONAL:
  ------------------
  |  Branch (1027:9): [True: 963, False: 116k]
  ------------------
 1028|  1.16k|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (1028:9): [True: 201, False: 117k]
  ------------------
 1029|  1.25k|        case TIFF_FLOAT:
  ------------------
  |  Branch (1029:9): [True: 88, False: 117k]
  ------------------
 1030|  1.25k|            fld->set_get_field_type = TIFF_SETGET_C32_FLOAT;
 1031|  1.25k|            break;
 1032|    537|        case TIFF_SBYTE:
  ------------------
  |  Branch (1032:9): [True: 537, False: 116k]
  ------------------
 1033|    537|            fld->set_get_field_type = TIFF_SETGET_C32_SINT8;
 1034|    537|            break;
 1035|    535|        case TIFF_SSHORT:
  ------------------
  |  Branch (1035:9): [True: 535, False: 116k]
  ------------------
 1036|    535|            fld->set_get_field_type = TIFF_SETGET_C32_SINT16;
 1037|    535|            break;
 1038|    323|        case TIFF_SLONG:
  ------------------
  |  Branch (1038:9): [True: 323, False: 117k]
  ------------------
 1039|    323|            fld->set_get_field_type = TIFF_SETGET_C32_SINT32;
 1040|    323|            break;
 1041|  2.74k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (1041:9): [True: 2.74k, False: 114k]
  ------------------
 1042|  2.74k|            fld->set_get_field_type = TIFF_SETGET_C32_DOUBLE;
 1043|  2.74k|            break;
 1044|    140|        case TIFF_IFD:
  ------------------
  |  Branch (1044:9): [True: 140, False: 117k]
  ------------------
 1045|    197|        case TIFF_IFD8:
  ------------------
  |  Branch (1045:9): [True: 57, False: 117k]
  ------------------
 1046|    197|            fld->set_get_field_type = TIFF_SETGET_C32_IFD8;
 1047|    197|            break;
 1048|    154|        case TIFF_LONG8:
  ------------------
  |  Branch (1048:9): [True: 154, False: 117k]
  ------------------
 1049|    154|            fld->set_get_field_type = TIFF_SETGET_C32_UINT64;
 1050|    154|            break;
 1051|    271|        case TIFF_SLONG8:
  ------------------
  |  Branch (1051:9): [True: 271, False: 117k]
  ------------------
 1052|    271|            fld->set_get_field_type = TIFF_SETGET_C32_SINT64;
 1053|    271|            break;
 1054|  9.72k|        case TIFF_NOTYPE:
  ------------------
  |  Branch (1054:9): [True: 9.72k, False: 107k]
  ------------------
 1055|  95.7k|        default:
  ------------------
  |  Branch (1055:9): [True: 85.9k, False: 31.4k]
  ------------------
 1056|  95.7k|            fld->set_get_field_type = TIFF_SETGET_UNDEFINED;
 1057|  95.7k|            break;
 1058|   117k|    }
 1059|   117k|    fld->field_bit = FIELD_CUSTOM;
  ------------------
  |  |  346|   117k|#define FIELD_CUSTOM 65
  ------------------
 1060|   117k|    fld->field_oktochange = TRUE;
  ------------------
  |  |   71|   117k|#define TRUE 1
  ------------------
 1061|   117k|    fld->field_passcount = TRUE;
  ------------------
  |  |   71|   117k|#define TRUE 1
  ------------------
 1062|   117k|    char *field_name_buf = (char *)_TIFFmallocExt(tif, 32);
 1063|   117k|    if (field_name_buf == NULL)
  ------------------
  |  Branch (1063:9): [True: 0, False: 117k]
  ------------------
 1064|      0|    {
 1065|      0|        _TIFFfreeExt(tif, fld);
 1066|      0|        return NULL;
 1067|      0|    }
 1068|   117k|    fld->field_subfields = NULL;
 1069|       |
 1070|       |    /*
 1071|       |     * note that this name is a special sign to TIFFClose() and
 1072|       |     * _TIFFSetupFields() to free the field
 1073|       |     * Update:
 1074|       |     *   This special sign is replaced by fld->field_anonymous  flag.
 1075|       |     */
 1076|   117k|    (void)snprintf(field_name_buf, 32, "Tag %d", (int)tag);
 1077|   117k|    fld->field_name = field_name_buf;
 1078|       |
 1079|   117k|    return fld;
 1080|   117k|}
_TIFFCheckFieldIsValidForCodec:
 1354|   138k|{
 1355|       |    /* Filter out non-codec specific tags */
 1356|   138k|    switch (tag)
 1357|   138k|    {
 1358|       |        /* Shared tags */
 1359|    637|        case TIFFTAG_PREDICTOR:
  ------------------
  |  |  303|    637|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1359:9): [True: 637, False: 137k]
  ------------------
 1360|       |        /* JPEG tags */
 1361|  1.61k|        case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  346|  1.61k|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (1361:9): [True: 979, False: 137k]
  ------------------
 1362|       |        /* OJPEG tags */
 1363|  2.32k|        case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|  2.32k|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (1363:9): [True: 704, False: 137k]
  ------------------
 1364|  2.48k|        case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  380|  2.48k|#define TIFFTAG_JPEGIFBYTECOUNT 514        /* !JFIF stream length */
  ------------------
  |  Branch (1364:9): [True: 168, False: 138k]
  ------------------
 1365|  3.39k|        case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|  3.39k|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (1365:9): [True: 910, False: 137k]
  ------------------
 1366|  4.26k|        case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  385|  4.26k|#define TIFFTAG_JPEGDCTABLES 520           /* !DCT table offsets */
  ------------------
  |  Branch (1366:9): [True: 866, False: 137k]
  ------------------
 1367|  5.11k|        case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  386|  5.11k|#define TIFFTAG_JPEGACTABLES 521           /* !AC coefficient offsets */
  ------------------
  |  Branch (1367:9): [True: 850, False: 137k]
  ------------------
 1368|  6.26k|        case TIFFTAG_JPEGPROC:
  ------------------
  |  |  376|  6.26k|#define TIFFTAG_JPEGPROC 512               /* !JPEG processing algorithm */
  ------------------
  |  Branch (1368:9): [True: 1.14k, False: 137k]
  ------------------
 1369|  6.30k|        case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  381|  6.30k|#define TIFFTAG_JPEGRESTARTINTERVAL 515    /* !restart interval length */
  ------------------
  |  Branch (1369:9): [True: 49, False: 138k]
  ------------------
 1370|       |        /* CCITT* */
 1371|  6.31k|        case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  315|  6.31k|#define TIFFTAG_BADFAXLINES 326            /* lines w/ wrong pixel count */
  ------------------
  |  Branch (1371:9): [True: 10, False: 138k]
  ------------------
 1372|  6.35k|        case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  316|  6.35k|#define TIFFTAG_CLEANFAXDATA 327           /* regenerated line info */
  ------------------
  |  Branch (1372:9): [True: 37, False: 138k]
  ------------------
 1373|  6.72k|        case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  320|  6.72k|#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
  ------------------
  |  Branch (1373:9): [True: 365, False: 138k]
  ------------------
 1374|  6.98k|        case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  279|  6.98k|#define TIFFTAG_GROUP3OPTIONS 292          /* 32 flag bits */
  ------------------
  |  Branch (1374:9): [True: 259, False: 138k]
  ------------------
 1375|  7.09k|        case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|  7.09k|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1375:9): [True: 119, False: 138k]
  ------------------
 1376|       |        /* LERC */
 1377|  7.10k|        case TIFFTAG_LERC_PARAMETERS:
  ------------------
  |  |  502|  7.10k|#define TIFFTAG_LERC_PARAMETERS 50674 /* Stores LERC version and additional compression method */
  ------------------
  |  Branch (1377:9): [True: 1, False: 138k]
  ------------------
 1378|  7.10k|            break;
 1379|   131k|        default:
  ------------------
  |  Branch (1379:9): [True: 131k, False: 7.10k]
  ------------------
 1380|   131k|            return 1;
 1381|   138k|    }
 1382|  7.10k|    if (!TIFFIsCODECConfigured(tif->tif_dir.td_compression))
  ------------------
  |  Branch (1382:9): [True: 79, False: 7.02k]
  ------------------
 1383|     79|    {
 1384|     79|        return 0;
 1385|     79|    }
 1386|       |    /* Check if codec specific tags are allowed for the current
 1387|       |     * compression scheme (codec) */
 1388|  7.02k|    switch (tif->tif_dir.td_compression)
 1389|  7.02k|    {
 1390|    324|        case COMPRESSION_LZW:
  ------------------
  |  |  188|    324|#define COMPRESSION_LZW 5             /* Lempel-Ziv  & Welch */
  ------------------
  |  Branch (1390:9): [True: 324, False: 6.69k]
  ------------------
 1391|    324|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|    324|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1391:17): [True: 290, False: 34]
  ------------------
 1392|    290|                return 1;
 1393|     34|            break;
 1394|     34|        case COMPRESSION_PACKBITS:
  ------------------
  |  |  195|     15|#define COMPRESSION_PACKBITS 32773    /* Macintosh RLE */
  ------------------
  |  Branch (1394:9): [True: 15, False: 7.00k]
  ------------------
 1395|       |            /* No codec-specific tags */
 1396|     15|            break;
 1397|      0|        case COMPRESSION_THUNDERSCAN:
  ------------------
  |  |  196|      0|#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */
  ------------------
  |  Branch (1397:9): [True: 0, False: 7.02k]
  ------------------
 1398|       |            /* No codec-specific tags */
 1399|      0|            break;
 1400|      9|        case COMPRESSION_NEXT:
  ------------------
  |  |  193|      9|#define COMPRESSION_NEXT 32766        /* NeXT 2-bit RLE */
  ------------------
  |  Branch (1400:9): [True: 9, False: 7.01k]
  ------------------
 1401|       |            /* No codec-specific tags */
 1402|      9|            break;
 1403|  2.37k|        case COMPRESSION_JPEG:
  ------------------
  |  |  190|  2.37k|#define COMPRESSION_JPEG 7            /* %JPEG DCT compression */
  ------------------
  |  Branch (1403:9): [True: 2.37k, False: 4.64k]
  ------------------
 1404|  2.37k|            if (tag == TIFFTAG_JPEGTABLES)
  ------------------
  |  |  346|  2.37k|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (1404:17): [True: 889, False: 1.48k]
  ------------------
 1405|    889|                return 1;
 1406|  1.48k|            break;
 1407|  3.42k|        case COMPRESSION_OJPEG:
  ------------------
  |  |  189|  3.42k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (1407:9): [True: 3.42k, False: 3.59k]
  ------------------
 1408|  3.42k|            switch (tag)
 1409|  3.42k|            {
 1410|    598|                case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|    598|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (1410:17): [True: 598, False: 2.83k]
  ------------------
 1411|    720|                case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  380|    720|#define TIFFTAG_JPEGIFBYTECOUNT 514        /* !JFIF stream length */
  ------------------
  |  Branch (1411:17): [True: 122, False: 3.30k]
  ------------------
 1412|  1.58k|                case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|  1.58k|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (1412:17): [True: 860, False: 2.56k]
  ------------------
 1413|  2.39k|                case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  385|  2.39k|#define TIFFTAG_JPEGDCTABLES 520           /* !DCT table offsets */
  ------------------
  |  Branch (1413:17): [True: 817, False: 2.61k]
  ------------------
 1414|  3.20k|                case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  386|  3.20k|#define TIFFTAG_JPEGACTABLES 521           /* !AC coefficient offsets */
  ------------------
  |  Branch (1414:17): [True: 803, False: 2.62k]
  ------------------
 1415|  3.26k|                case TIFFTAG_JPEGPROC:
  ------------------
  |  |  376|  3.26k|#define TIFFTAG_JPEGPROC 512               /* !JPEG processing algorithm */
  ------------------
  |  Branch (1415:17): [True: 66, False: 3.36k]
  ------------------
 1416|  3.29k|                case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  381|  3.29k|#define TIFFTAG_JPEGRESTARTINTERVAL 515    /* !restart interval length */
  ------------------
  |  Branch (1416:17): [True: 33, False: 3.39k]
  ------------------
 1417|  3.29k|                    return 1;
 1418|    130|                default:
  ------------------
  |  Branch (1418:17): [True: 130, False: 3.29k]
  ------------------
 1419|    130|                    break;
 1420|  3.42k|            }
 1421|    130|            break;
 1422|    130|        case COMPRESSION_CCITTRLE:
  ------------------
  |  |  183|     38|#define COMPRESSION_CCITTRLE 2        /* CCITT modified Huffman RLE */
  ------------------
  |  Branch (1422:9): [True: 38, False: 6.98k]
  ------------------
 1423|     55|        case COMPRESSION_CCITTRLEW:
  ------------------
  |  |  194|     55|#define COMPRESSION_CCITTRLEW 32771   /* #1 w/ word alignment */
  ------------------
  |  Branch (1423:9): [True: 17, False: 7.00k]
  ------------------
 1424|    268|        case COMPRESSION_CCITTFAX3:
  ------------------
  |  |  184|    268|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1424:9): [True: 213, False: 6.80k]
  ------------------
 1425|    319|        case COMPRESSION_CCITTFAX4:
  ------------------
  |  |  186|    319|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (1425:9): [True: 51, False: 6.97k]
  ------------------
 1426|    319|            switch (tag)
 1427|    319|            {
 1428|      4|                case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  315|      4|#define TIFFTAG_BADFAXLINES 326            /* lines w/ wrong pixel count */
  ------------------
  |  Branch (1428:17): [True: 4, False: 315]
  ------------------
 1429|     14|                case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  316|     14|#define TIFFTAG_CLEANFAXDATA 327           /* regenerated line info */
  ------------------
  |  Branch (1429:17): [True: 10, False: 309]
  ------------------
 1430|     19|                case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  320|     19|#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
  ------------------
  |  Branch (1430:17): [True: 5, False: 314]
  ------------------
 1431|     19|                    return 1;
 1432|    156|                case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  279|    156|#define TIFFTAG_GROUP3OPTIONS 292          /* 32 flag bits */
  ------------------
  |  Branch (1432:17): [True: 156, False: 163]
  ------------------
 1433|    156|                    if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
  ------------------
  |  |  184|    156|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1433:25): [True: 143, False: 13]
  ------------------
 1434|    143|                        return 1;
 1435|     13|                    break;
 1436|     26|                case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|     26|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1436:17): [True: 26, False: 293]
  ------------------
 1437|     26|                    if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)
  ------------------
  |  |  186|     26|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (1437:25): [True: 16, False: 10]
  ------------------
 1438|     16|                        return 1;
 1439|     10|                    break;
 1440|    118|                default:
  ------------------
  |  Branch (1440:17): [True: 118, False: 201]
  ------------------
 1441|    118|                    break;
 1442|    319|            }
 1443|    141|            break;
 1444|    141|        case COMPRESSION_JBIG:
  ------------------
  |  |  209|      1|#define COMPRESSION_JBIG 34661     /* ISO JBIG */
  ------------------
  |  Branch (1444:9): [True: 1, False: 7.02k]
  ------------------
 1445|       |            /* No codec-specific tags */
 1446|      1|            break;
 1447|     16|        case COMPRESSION_DEFLATE:
  ------------------
  |  |  205|     16|#define COMPRESSION_DEFLATE 32946   /* Deflate compression, legacy tag */
  ------------------
  |  Branch (1447:9): [True: 16, False: 7.00k]
  ------------------
 1448|    167|        case COMPRESSION_ADOBE_DEFLATE:
  ------------------
  |  |  206|    167|#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression, as recognized by Adobe */
  ------------------
  |  Branch (1448:9): [True: 151, False: 6.87k]
  ------------------
 1449|    167|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|    167|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1449:17): [True: 118, False: 49]
  ------------------
 1450|    118|                return 1;
 1451|     49|            break;
 1452|    153|        case COMPRESSION_PIXARLOG:
  ------------------
  |  |  204|    153|#define COMPRESSION_PIXARLOG 32909  /* Pixar companded 11bit ZIP */
  ------------------
  |  Branch (1452:9): [True: 153, False: 6.86k]
  ------------------
 1453|    153|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|    153|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1453:17): [True: 97, False: 56]
  ------------------
 1454|     97|                return 1;
 1455|     56|            break;
 1456|     56|        case COMPRESSION_SGILOG:
  ------------------
  |  |  210|      6|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (1456:9): [True: 6, False: 7.01k]
  ------------------
 1457|     20|        case COMPRESSION_SGILOG24:
  ------------------
  |  |  211|     20|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  |  Branch (1457:9): [True: 14, False: 7.00k]
  ------------------
 1458|       |            /* No codec-specific tags */
 1459|     20|            break;
 1460|     33|        case COMPRESSION_LZMA:
  ------------------
  |  |  215|     33|#define COMPRESSION_LZMA 34925             /* LZMA2 */
  ------------------
  |  Branch (1460:9): [True: 33, False: 6.98k]
  ------------------
 1461|     33|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|     33|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1461:17): [True: 8, False: 25]
  ------------------
 1462|      8|                return 1;
 1463|     25|            break;
 1464|     25|        case COMPRESSION_ZSTD:
  ------------------
  |  |  216|      0|#define COMPRESSION_ZSTD 50000             /* ZSTD: WARNING not registered in Adobe-maintained registry */
  ------------------
  |  Branch (1464:9): [True: 0, False: 7.02k]
  ------------------
 1465|      0|            if (tag == TIFFTAG_PREDICTOR)
  ------------------
  |  |  303|      0|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1465:17): [True: 0, False: 0]
  ------------------
 1466|      0|                return 1;
 1467|      0|            break;
 1468|      0|        case COMPRESSION_LERC:
  ------------------
  |  |  213|      0|#define COMPRESSION_LERC 34887     /* ESRI Lerc codec: https://github.com/Esri/lerc */
  ------------------
  |  Branch (1468:9): [True: 0, False: 7.02k]
  ------------------
 1469|      0|            if (tag == TIFFTAG_LERC_PARAMETERS)
  ------------------
  |  |  502|      0|#define TIFFTAG_LERC_PARAMETERS 50674 /* Stores LERC version and additional compression method */
  ------------------
  |  Branch (1469:17): [True: 0, False: 0]
  ------------------
 1470|      0|                return 1;
 1471|      0|            break;
 1472|    178|        default:
  ------------------
  |  Branch (1472:9): [True: 178, False: 6.84k]
  ------------------
 1473|    178|            break;
 1474|  7.02k|    }
 1475|  2.14k|    return 0;
 1476|  7.02k|}
tif_dirinfo.c:tagCompare:
  601|   270M|{
  602|   270M|    const TIFFField *ta = *(const TIFFField **)a;
  603|   270M|    const TIFFField *tb = *(const TIFFField **)b;
  604|       |    /* NB: be careful of return values for 16-bit platforms */
  605|   270M|    if (ta->field_tag != tb->field_tag)
  ------------------
  |  Branch (605:9): [True: 270M, False: 145k]
  ------------------
  606|   270M|        return (int)ta->field_tag - (int)tb->field_tag;
  607|   145k|    else
  608|   145k|        return (ta->field_type == TIFF_ANY)
  ------------------
  |  |  341|   145k|#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
  ------------------
  |  Branch (608:16): [True: 145k, False: 0]
  ------------------
  609|   145k|                   ? 0
  610|   145k|                   : ((int)tb->field_type - (int)ta->field_type);
  611|   270M|}

TIFFReadDirectory:
 4336|  5.98k|{
 4337|  5.98k|    static const char module[] = "TIFFReadDirectory";
 4338|  5.98k|    TIFFDirEntry *dir;
 4339|  5.98k|    uint16_t dircount;
 4340|  5.98k|    TIFFDirEntry *dp;
 4341|  5.98k|    uint16_t di;
 4342|  5.98k|    const TIFFField *fip;
 4343|  5.98k|    uint32_t fii = FAILED_FII;
  ------------------
  |  |   44|  5.98k|#define FAILED_FII ((uint32_t)-1)
  ------------------
 4344|  5.98k|    toff_t nextdiroff;
 4345|  5.98k|    int bitspersample_read = FALSE;
  ------------------
  |  |   72|  5.98k|#define FALSE 0
  ------------------
 4346|  5.98k|    int color_channels;
 4347|       |
 4348|  5.98k|    if (tif->tif_nextdiroff == 0)
  ------------------
  |  Branch (4348:9): [True: 0, False: 5.98k]
  ------------------
 4349|      0|    {
 4350|       |        /* In this special case, tif_diroff needs also to be set to 0.
 4351|       |         * This is behind the last IFD, thus no checking or reading necessary.
 4352|       |         */
 4353|      0|        tif->tif_diroff = tif->tif_nextdiroff;
 4354|      0|        return 0;
 4355|      0|    }
 4356|       |
 4357|  5.98k|    nextdiroff = tif->tif_nextdiroff;
 4358|       |    /* tif_curdir++ and tif_nextdiroff should only be updated after SUCCESSFUL
 4359|       |     * reading of the directory. Otherwise, invalid IFD offsets could corrupt
 4360|       |     * the IFD list. */
 4361|  5.98k|    if (!_TIFFCheckDirNumberAndOffset(tif,
  ------------------
  |  Branch (4361:9): [True: 0, False: 5.98k]
  ------------------
 4362|  5.98k|                                      tif->tif_curdir ==
  ------------------
  |  Branch (4362:39): [True: 5.98k, False: 0]
  ------------------
 4363|  5.98k|                                              TIFF_NON_EXISTENT_DIR_NUMBER
  ------------------
  |  |   65|  5.98k|#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
  ------------------
 4364|  5.98k|                                          ? 0
 4365|  5.98k|                                          : tif->tif_curdir + 1,
 4366|  5.98k|                                      nextdiroff))
 4367|      0|    {
 4368|      0|        return 0; /* bad offset (IFD looping or more than TIFF_MAX_DIR_COUNT
 4369|       |                     IFDs) */
 4370|      0|    }
 4371|  5.98k|    dircount = TIFFFetchDirectory(tif, nextdiroff, &dir, &tif->tif_nextdiroff);
 4372|  5.98k|    if (!dircount)
  ------------------
  |  Branch (4372:9): [True: 1, False: 5.98k]
  ------------------
 4373|      1|    {
 4374|      1|        TIFFErrorExtR(tif, module,
 4375|      1|                      "Failed to read directory at offset %" PRIu64,
 4376|      1|                      nextdiroff);
 4377|      1|        return 0;
 4378|      1|    }
 4379|       |    /* Set global values after a valid directory has been fetched.
 4380|       |     * tif_diroff is already set to nextdiroff in TIFFFetchDirectory() in the
 4381|       |     * beginning. */
 4382|  5.98k|    if (tif->tif_curdir == TIFF_NON_EXISTENT_DIR_NUMBER)
  ------------------
  |  |   65|  5.98k|#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
  ------------------
  |  Branch (4382:9): [True: 5.98k, False: 0]
  ------------------
 4383|  5.98k|        tif->tif_curdir = 0;
 4384|      0|    else
 4385|      0|        tif->tif_curdir++;
 4386|       |
 4387|  5.98k|    TIFFReadDirectoryCheckOrder(tif, dir, dircount);
 4388|       |
 4389|       |    /*
 4390|       |     * Mark duplicates of any tag to be ignored (bugzilla 1994)
 4391|       |     * to avoid certain pathological problems.
 4392|       |     */
 4393|  5.98k|    {
 4394|  5.98k|        TIFFDirEntry *ma;
 4395|  5.98k|        uint16_t mb;
 4396|   353k|        for (ma = dir, mb = 0; mb < dircount; ma++, mb++)
  ------------------
  |  Branch (4396:32): [True: 347k, False: 5.98k]
  ------------------
 4397|   347k|        {
 4398|   347k|            TIFFDirEntry *na;
 4399|   347k|            uint16_t nb;
 4400|   343M|            for (na = ma + 1, nb = (uint16_t)(mb + 1); nb < dircount;
  ------------------
  |  Branch (4400:56): [True: 343M, False: 347k]
  ------------------
 4401|   343M|                 na++, nb++)
 4402|   343M|            {
 4403|   343M|                if (ma->tdir_tag == na->tdir_tag)
  ------------------
  |  Branch (4403:21): [True: 30.1M, False: 312M]
  ------------------
 4404|  30.1M|                {
 4405|  30.1M|                    na->tdir_ignore = TRUE;
  ------------------
  |  |   71|  30.1M|#define TRUE 1
  ------------------
 4406|  30.1M|                }
 4407|   343M|            }
 4408|   347k|        }
 4409|  5.98k|    }
 4410|       |
 4411|  5.98k|    tif->tif_flags &= ~TIFF_BEENWRITING; /* reset before new dir */
  ------------------
  |  |  125|  5.98k|#define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
  ------------------
 4412|  5.98k|    tif->tif_flags &= ~TIFF_BUF4WRITE;   /* reset before new dir */
  ------------------
  |  |  141|  5.98k|#define TIFF_BUF4WRITE 0x100000U  /* rawcc bytes are for writing */
  ------------------
 4413|  5.98k|    tif->tif_flags &= ~TIFF_CHOPPEDUPARRAYS;
  ------------------
  |  |  153|  5.98k|    0x4000000U /* set when allocChoppedUpStripArrays() has modified strip      \
  ------------------
 4414|       |
 4415|       |    /* When changing directory, in deferred strile loading mode, we must also
 4416|       |     * unset the TIFF_LAZYSTRILELOAD_DONE bit if it was initially set,
 4417|       |     * to make sure the strile offset/bytecount are read again (when they fit
 4418|       |     * in the tag data area).
 4419|       |     */
 4420|  5.98k|    tif->tif_flags &= ~TIFF_LAZYSTRILELOAD_DONE;
  ------------------
  |  |  149|  5.98k|    0x2000000U /* set when lazy/ondemand loading of strip/tile                 \
  ------------------
 4421|       |
 4422|       |    /* Free any old stuff and reinit i/o and other parameters within
 4423|       |     * TIFFDefaultDirectory() since we are starting on a new directory. */
 4424|  5.98k|    TIFFFreeDirectory(tif);
 4425|  5.98k|    TIFFDefaultDirectory(tif);
 4426|       |
 4427|       |    /* After setup a fresh directory indicate that now active IFD is also
 4428|       |     * present on file, even if its entries could not be read successfully
 4429|       |     * below.  */
 4430|  5.98k|    tif->tif_dir.td_iswrittentofile = TRUE;
  ------------------
  |  |   71|  5.98k|#define TRUE 1
  ------------------
 4431|       |
 4432|       |    /* Allocate arrays for offset values outside IFD entry for IFD data size
 4433|       |     * checking. Note: Counter are reset within TIFFFreeDirectory(). */
 4434|  5.98k|    tif->tif_dir.td_dirdatasize_offsets =
 4435|  5.98k|        (TIFFEntryOffsetAndLength *)_TIFFmallocExt(
 4436|  5.98k|            tif,
 4437|  5.98k|            (tmsize_t)((size_t)dircount * sizeof(TIFFEntryOffsetAndLength)));
 4438|  5.98k|    if (tif->tif_dir.td_dirdatasize_offsets == NULL)
  ------------------
  |  Branch (4438:9): [True: 0, False: 5.98k]
  ------------------
 4439|      0|    {
 4440|      0|        TIFFErrorExtR(
 4441|      0|            tif, module,
 4442|      0|            "Failed to allocate memory for counting IFD data size at reading");
 4443|      0|        goto bad;
 4444|      0|    }
 4445|       |    /*
 4446|       |     * Electronic Arts writes gray-scale TIFF files
 4447|       |     * without a PlanarConfiguration directory entry.
 4448|       |     * Thus we setup a default value here, even though
 4449|       |     * the TIFF spec says there is no default value.
 4450|       |     * After PlanarConfiguration is preset in TIFFDefaultDirectory()
 4451|       |     * the following setting is not needed, but does not harm either.
 4452|       |     */
 4453|  5.98k|    TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
  ------------------
  |  |  264|  5.98k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
                  TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
  ------------------
  |  |  265|  5.98k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
 4454|       |    /*
 4455|       |     * Setup default value and then make a pass over
 4456|       |     * the fields to check type and tag information,
 4457|       |     * and to extract info required to size data
 4458|       |     * structures.  A second pass is made afterwards
 4459|       |     * to read in everything not taken in the first pass.
 4460|       |     * But we must process the Compression tag first
 4461|       |     * in order to merge in codec-private tag definitions (otherwise
 4462|       |     * we may get complaints about unknown tags).  However, the
 4463|       |     * Compression tag may be dependent on the SamplesPerPixel
 4464|       |     * tag value because older TIFF specs permitted Compression
 4465|       |     * to be written as a SamplesPerPixel-count tag entry.
 4466|       |     * Thus if we don't first figure out the correct SamplesPerPixel
 4467|       |     * tag value then we may end up ignoring the Compression tag
 4468|       |     * value because it has an incorrect count value (if the
 4469|       |     * true value of SamplesPerPixel is not 1).
 4470|       |     */
 4471|  5.98k|    dp =
 4472|  5.98k|        TIFFReadDirectoryFindEntry(tif, dir, dircount, TIFFTAG_SAMPLESPERPIXEL);
  ------------------
  |  |  257|  5.98k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
 4473|  5.98k|    if (dp)
  ------------------
  |  Branch (4473:9): [True: 2.41k, False: 3.56k]
  ------------------
 4474|  2.41k|    {
 4475|  2.41k|        if (!TIFFFetchNormalTag(tif, dp, 0))
  ------------------
  |  Branch (4475:13): [True: 1, False: 2.41k]
  ------------------
 4476|      1|            goto bad;
 4477|  2.41k|        dp->tdir_ignore = TRUE;
  ------------------
  |  |   71|  2.41k|#define TRUE 1
  ------------------
 4478|  2.41k|    }
 4479|  5.98k|    dp = TIFFReadDirectoryFindEntry(tif, dir, dircount, TIFFTAG_COMPRESSION);
  ------------------
  |  |  181|  5.98k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
 4480|  5.98k|    if (dp)
  ------------------
  |  Branch (4480:9): [True: 5.45k, False: 526]
  ------------------
 4481|  5.45k|    {
 4482|       |        /*
 4483|       |         * The 5.0 spec says the Compression tag has one value, while
 4484|       |         * earlier specs say it has one value per sample.  Because of
 4485|       |         * this, we accept the tag if one value is supplied with either
 4486|       |         * count.
 4487|       |         */
 4488|  5.45k|        uint16_t value;
 4489|  5.45k|        enum TIFFReadDirEntryErr err;
 4490|  5.45k|        err = TIFFReadDirEntryShort(tif, dp, &value);
 4491|  5.45k|        if (err == TIFFReadDirEntryErrCount)
  ------------------
  |  Branch (4491:13): [True: 366, False: 5.08k]
  ------------------
 4492|    366|            err = TIFFReadDirEntryPersampleShort(tif, dp, &value);
 4493|  5.45k|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4493:13): [True: 7, False: 5.44k]
  ------------------
 4494|      7|        {
 4495|      7|            TIFFReadDirEntryOutputErr(tif, err, module, "Compression", 0);
 4496|      7|            goto bad;
 4497|      7|        }
 4498|  5.44k|        if (!TIFFSetField(tif, TIFFTAG_COMPRESSION, value))
  ------------------
  |  |  181|  5.44k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  |  Branch (4498:13): [True: 0, False: 5.44k]
  ------------------
 4499|      0|            goto bad;
 4500|  5.44k|        dp->tdir_ignore = TRUE;
  ------------------
  |  |   71|  5.44k|#define TRUE 1
  ------------------
 4501|  5.44k|    }
 4502|    526|    else
 4503|    526|    {
 4504|    526|        if (!TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE))
  ------------------
  |  |  181|    526|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
                      if (!TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE))
  ------------------
  |  |  182|    526|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (4504:13): [True: 0, False: 526]
  ------------------
 4505|      0|            goto bad;
 4506|    526|    }
 4507|       |    /*
 4508|       |     * First real pass over the directory.
 4509|       |     */
 4510|   352k|    for (di = 0, dp = dir; di < dircount; di++, dp++)
  ------------------
  |  Branch (4510:28): [True: 346k, False: 5.96k]
  ------------------
 4511|   346k|    {
 4512|   346k|        if (!dp->tdir_ignore)
  ------------------
  |  Branch (4512:13): [True: 169k, False: 177k]
  ------------------
 4513|   169k|        {
 4514|   169k|            TIFFReadDirectoryFindFieldInfo(tif, dp->tdir_tag, &fii);
 4515|   169k|            if (fii == FAILED_FII)
  ------------------
  |  |   44|   169k|#define FAILED_FII ((uint32_t)-1)
  ------------------
  |  Branch (4515:17): [True: 117k, False: 51.9k]
  ------------------
 4516|   117k|            {
 4517|   117k|                if (tif->tif_warn_about_unknown_tags)
  ------------------
  |  Branch (4517:21): [True: 0, False: 117k]
  ------------------
 4518|      0|                {
 4519|      0|                    TIFFWarningExtR(tif, module,
 4520|      0|                                    "Unknown field with tag %" PRIu16
 4521|      0|                                    " (0x%" PRIx16 ") encountered",
 4522|      0|                                    dp->tdir_tag, dp->tdir_tag);
 4523|      0|                }
 4524|       |                /* the following knowingly leaks the
 4525|       |                   anonymous field structure */
 4526|   117k|                const TIFFField *fld = _TIFFCreateAnonField(
 4527|   117k|                    tif, dp->tdir_tag, (TIFFDataType)dp->tdir_type);
 4528|   117k|                if (fld == NULL || !_TIFFMergeFields(tif, fld, 1))
  ------------------
  |  Branch (4528:21): [True: 0, False: 117k]
  |  Branch (4528:36): [True: 0, False: 117k]
  ------------------
 4529|      0|                {
 4530|      0|                    TIFFWarningExtR(
 4531|      0|                        tif, module,
 4532|      0|                        "Registering anonymous field with tag %" PRIu16
 4533|      0|                        " (0x%" PRIx16 ") failed",
 4534|      0|                        dp->tdir_tag, dp->tdir_tag);
 4535|      0|                    dp->tdir_ignore = TRUE;
  ------------------
  |  |   71|      0|#define TRUE 1
  ------------------
 4536|      0|                }
 4537|   117k|                else
 4538|   117k|                {
 4539|   117k|                    TIFFReadDirectoryFindFieldInfo(tif, dp->tdir_tag, &fii);
 4540|   117k|                    assert(fii != FAILED_FII);
  ------------------
  |  Branch (4540:21): [True: 0, False: 117k]
  |  Branch (4540:21): [True: 117k, False: 0]
  ------------------
 4541|   117k|                }
 4542|   117k|            }
 4543|   169k|        }
 4544|   346k|        if (!dp->tdir_ignore)
  ------------------
  |  Branch (4544:13): [True: 169k, False: 177k]
  ------------------
 4545|   169k|        {
 4546|   169k|            fip = tif->tif_fields[fii];
 4547|   169k|            if (fip->field_bit == FIELD_IGNORE)
  ------------------
  |  |  190|   169k|#define FIELD_IGNORE 0
  ------------------
  |  Branch (4547:17): [True: 472, False: 168k]
  ------------------
 4548|    472|                dp->tdir_ignore = TRUE;
  ------------------
  |  |   71|    472|#define TRUE 1
  ------------------
 4549|   168k|            else
 4550|   168k|            {
 4551|   168k|                switch (dp->tdir_tag)
 4552|   168k|                {
 4553|  3.30k|                    case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  247|  3.30k|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
  |  Branch (4553:21): [True: 3.30k, False: 165k]
  ------------------
 4554|  6.93k|                    case TIFFTAG_STRIPBYTECOUNTS:
  ------------------
  |  |  259|  6.93k|#define TIFFTAG_STRIPBYTECOUNTS 279        /* bytes counts for strips */
  ------------------
  |  Branch (4554:21): [True: 3.62k, False: 165k]
  ------------------
 4555|  9.43k|                    case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  313|  9.43k|#define TIFFTAG_TILEOFFSETS 324            /* !offsets to data tiles */
  ------------------
  |  Branch (4555:21): [True: 2.50k, False: 166k]
  ------------------
 4556|  10.8k|                    case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  314|  10.8k|#define TIFFTAG_TILEBYTECOUNTS 325         /* !byte counts for tiles */
  ------------------
  |  Branch (4556:21): [True: 1.43k, False: 167k]
  ------------------
 4557|  10.8k|                        TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  249|  10.8k|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|  10.8k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|  10.8k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 4558|  10.8k|                        break;
 4559|  5.86k|                    case TIFFTAG_IMAGEWIDTH:
  ------------------
  |  |  178|  5.86k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  |  Branch (4559:21): [True: 5.86k, False: 163k]
  ------------------
 4560|  10.5k|                    case TIFFTAG_IMAGELENGTH:
  ------------------
  |  |  179|  10.5k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  |  Branch (4560:21): [True: 4.70k, False: 164k]
  ------------------
 4561|  10.5k|                    case TIFFTAG_IMAGEDEPTH:
  ------------------
  |  |  407|  10.5k|#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
  ------------------
  |  Branch (4561:21): [True: 6, False: 168k]
  ------------------
 4562|  12.1k|                    case TIFFTAG_TILELENGTH:
  ------------------
  |  |  312|  12.1k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  |  Branch (4562:21): [True: 1.52k, False: 167k]
  ------------------
 4563|  14.5k|                    case TIFFTAG_TILEWIDTH:
  ------------------
  |  |  311|  14.5k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  |  Branch (4563:21): [True: 2.49k, False: 166k]
  ------------------
 4564|  14.6k|                    case TIFFTAG_TILEDEPTH:
  ------------------
  |  |  408|  14.6k|#define TIFFTAG_TILEDEPTH 32998  /* z depth/data tile */
  ------------------
  |  Branch (4564:21): [True: 5, False: 168k]
  ------------------
 4565|  16.2k|                    case TIFFTAG_PLANARCONFIG:
  ------------------
  |  |  264|  16.2k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  |  Branch (4565:21): [True: 1.62k, False: 167k]
  ------------------
 4566|  19.4k|                    case TIFFTAG_ROWSPERSTRIP:
  ------------------
  |  |  258|  19.4k|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
  |  Branch (4566:21): [True: 3.24k, False: 165k]
  ------------------
 4567|  19.6k|                    case TIFFTAG_EXTRASAMPLES:
  ------------------
  |  |  329|  19.6k|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  |  Branch (4567:21): [True: 187, False: 168k]
  ------------------
 4568|  19.6k|                        if (!TIFFFetchNormalTag(tif, dp, 0))
  ------------------
  |  Branch (4568:29): [True: 10, False: 19.6k]
  ------------------
 4569|     10|                            goto bad;
 4570|  19.6k|                        dp->tdir_ignore = TRUE;
  ------------------
  |  |   71|  19.6k|#define TRUE 1
  ------------------
 4571|  19.6k|                        break;
 4572|   138k|                    default:
  ------------------
  |  Branch (4572:21): [True: 138k, False: 30.5k]
  ------------------
 4573|   138k|                        if (!_TIFFCheckFieldIsValidForCodec(tif, dp->tdir_tag))
  ------------------
  |  Branch (4573:29): [True: 2.22k, False: 136k]
  ------------------
 4574|  2.22k|                            dp->tdir_ignore = TRUE;
  ------------------
  |  |   71|  2.22k|#define TRUE 1
  ------------------
 4575|   138k|                        break;
 4576|   168k|                }
 4577|   168k|            }
 4578|   169k|        }
 4579|   346k|    }
 4580|       |    /*
 4581|       |     * XXX: OJPEG hack.
 4582|       |     * If a) compression is OJPEG, b) planarconfig tag says it's separate,
 4583|       |     * c) strip offsets/bytecounts tag are both present and
 4584|       |     * d) both contain exactly one value, then we consistently find
 4585|       |     * that the buggy implementation of the buggy compression scheme
 4586|       |     * matches contig planarconfig best. So we 'fix-up' the tag here
 4587|       |     */
 4588|  5.96k|    if ((tif->tif_dir.td_compression == COMPRESSION_OJPEG) &&
  ------------------
  |  |  189|  5.96k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (4588:9): [True: 1.03k, False: 4.93k]
  ------------------
 4589|  1.03k|        (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE))
  ------------------
  |  |  266|  1.03k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (4589:9): [True: 663, False: 369]
  ------------------
 4590|    663|    {
 4591|    663|        if (!_TIFFFillStriles(tif))
  ------------------
  |  Branch (4591:13): [True: 0, False: 663]
  ------------------
 4592|      0|            goto bad;
 4593|    663|        dp = TIFFReadDirectoryFindEntry(tif, dir, dircount,
 4594|    663|                                        TIFFTAG_STRIPOFFSETS);
  ------------------
  |  |  247|    663|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
 4595|    663|        if ((dp != 0) && (dp->tdir_count == 1))
  ------------------
  |  Branch (4595:13): [True: 660, False: 3]
  |  Branch (4595:26): [True: 31, False: 629]
  ------------------
 4596|     31|        {
 4597|     31|            dp = TIFFReadDirectoryFindEntry(tif, dir, dircount,
 4598|     31|                                            TIFFTAG_STRIPBYTECOUNTS);
  ------------------
  |  |  259|     31|#define TIFFTAG_STRIPBYTECOUNTS 279        /* bytes counts for strips */
  ------------------
 4599|     31|            if ((dp != 0) && (dp->tdir_count == 1))
  ------------------
  |  Branch (4599:17): [True: 13, False: 18]
  |  Branch (4599:30): [True: 1, False: 12]
  ------------------
 4600|      1|            {
 4601|      1|                tif->tif_dir.td_planarconfig = PLANARCONFIG_CONTIG;
  ------------------
  |  |  265|      1|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
 4602|      1|                TIFFWarningExtR(tif, module,
 4603|      1|                                "Planarconfig tag value assumed incorrect, "
 4604|      1|                                "assuming data is contig instead of chunky");
 4605|      1|            }
 4606|     31|        }
 4607|    663|    }
 4608|       |    /*
 4609|       |     * Allocate directory structure and setup defaults.
 4610|       |     */
 4611|  5.96k|    if (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS))
  ------------------
  |  |  248|  5.96k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  5.96k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  5.96k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4611:9): [True: 9, False: 5.95k]
  ------------------
 4612|      9|    {
 4613|      9|        MissingRequired(tif, "ImageLength");
 4614|      9|        goto bad;
 4615|      9|    }
 4616|       |
 4617|       |    /*
 4618|       |     * Second pass: extract other information.
 4619|       |     */
 4620|   333k|    for (di = 0, dp = dir; di < dircount; di++, dp++)
  ------------------
  |  Branch (4620:28): [True: 327k, False: 5.92k]
  ------------------
 4621|   327k|    {
 4622|   327k|        if (!dp->tdir_ignore)
  ------------------
  |  Branch (4622:13): [True: 138k, False: 188k]
  ------------------
 4623|   138k|        {
 4624|   138k|            switch (dp->tdir_tag)
 4625|   138k|            {
 4626|     16|                case TIFFTAG_MINSAMPLEVALUE:
  ------------------
  |  |  260|     16|#define TIFFTAG_MINSAMPLEVALUE 280         /* +minimum sample value */
  ------------------
  |  Branch (4626:17): [True: 16, False: 138k]
  ------------------
 4627|     29|                case TIFFTAG_MAXSAMPLEVALUE:
  ------------------
  |  |  261|     29|#define TIFFTAG_MAXSAMPLEVALUE 281         /* +maximum sample value */
  ------------------
  |  Branch (4627:17): [True: 13, False: 138k]
  ------------------
 4628|  3.14k|                case TIFFTAG_BITSPERSAMPLE:
  ------------------
  |  |  180|  3.14k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (4628:17): [True: 3.11k, False: 135k]
  ------------------
 4629|  3.16k|                case TIFFTAG_DATATYPE:
  ------------------
  |  |  406|  3.16k|#define TIFFTAG_DATATYPE 32996   /* $use SampleFormat */
  ------------------
  |  Branch (4629:17): [True: 17, False: 138k]
  ------------------
 4630|  3.73k|                case TIFFTAG_SAMPLEFORMAT:
  ------------------
  |  |  333|  3.73k|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
  |  Branch (4630:17): [True: 566, False: 138k]
  ------------------
 4631|       |                    /*
 4632|       |                     * The MinSampleValue, MaxSampleValue, BitsPerSample
 4633|       |                     * DataType and SampleFormat tags are supposed to be
 4634|       |                     * written as one value/sample, but some vendors
 4635|       |                     * incorrectly write one value only -- so we accept
 4636|       |                     * that as well (yuck). Other vendors write correct
 4637|       |                     * value for NumberOfSamples, but incorrect one for
 4638|       |                     * BitsPerSample and friends, and we will read this
 4639|       |                     * too.
 4640|       |                     */
 4641|  3.73k|                    {
 4642|  3.73k|                        uint16_t value;
 4643|  3.73k|                        enum TIFFReadDirEntryErr err;
 4644|  3.73k|                        err = TIFFReadDirEntryShort(tif, dp, &value);
 4645|  3.73k|                        if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4645:29): [True: 0, False: 3.73k]
  ------------------
 4646|      0|                            goto bad;
 4647|  3.73k|                        if (err == TIFFReadDirEntryErrCount)
  ------------------
  |  Branch (4647:29): [True: 1.68k, False: 2.04k]
  ------------------
 4648|  1.68k|                            err =
 4649|  1.68k|                                TIFFReadDirEntryPersampleShort(tif, dp, &value);
 4650|  3.73k|                        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4650:29): [True: 31, False: 3.69k]
  ------------------
 4651|     31|                        {
 4652|     31|                            fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4653|     31|                            TIFFReadDirEntryOutputErr(
 4654|     31|                                tif, err, module,
 4655|     31|                                fip ? fip->field_name : "unknown tagname", 0);
  ------------------
  |  Branch (4655:33): [True: 31, False: 0]
  ------------------
 4656|     31|                            goto bad;
 4657|     31|                        }
 4658|  3.69k|                        if (!TIFFSetField(tif, dp->tdir_tag, value))
  ------------------
  |  Branch (4658:29): [True: 0, False: 3.69k]
  ------------------
 4659|      0|                            goto bad;
 4660|  3.69k|                        if (dp->tdir_tag == TIFFTAG_BITSPERSAMPLE)
  ------------------
  |  |  180|  3.69k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (4660:29): [True: 3.10k, False: 593]
  ------------------
 4661|  3.10k|                            bitspersample_read = TRUE;
  ------------------
  |  |   71|  3.10k|#define TRUE 1
  ------------------
 4662|  3.69k|                    }
 4663|      0|                    break;
 4664|    199|                case TIFFTAG_SMINSAMPLEVALUE:
  ------------------
  |  |  340|    199|#define TIFFTAG_SMINSAMPLEVALUE 340        /* !variable MinSampleValue */
  ------------------
  |  Branch (4664:17): [True: 199, False: 138k]
  ------------------
 4665|    211|                case TIFFTAG_SMAXSAMPLEVALUE:
  ------------------
  |  |  341|    211|#define TIFFTAG_SMAXSAMPLEVALUE 341        /* !variable MaxSampleValue */
  ------------------
  |  Branch (4665:17): [True: 12, False: 138k]
  ------------------
 4666|    211|                {
 4667|       |
 4668|    211|                    double *data = NULL;
 4669|    211|                    enum TIFFReadDirEntryErr err;
 4670|    211|                    uint32_t saved_flags;
 4671|    211|                    int m;
 4672|    211|                    if (dp->tdir_count !=
  ------------------
  |  Branch (4672:25): [True: 2, False: 209]
  ------------------
 4673|    211|                        (uint64_t)tif->tif_dir.td_samplesperpixel)
 4674|      2|                        err = TIFFReadDirEntryErrCount;
 4675|    209|                    else
 4676|    209|                        err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
 4677|    211|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4677:25): [True: 0, False: 211]
  ------------------
 4678|      0|                        goto bad;
 4679|    211|                    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4679:25): [True: 3, False: 208]
  ------------------
 4680|      3|                    {
 4681|      3|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4682|      3|                        TIFFReadDirEntryOutputErr(
 4683|      3|                            tif, err, module,
 4684|      3|                            fip ? fip->field_name : "unknown tagname", 0);
  ------------------
  |  Branch (4684:29): [True: 3, False: 0]
  ------------------
 4685|      3|                        goto bad;
 4686|      3|                    }
 4687|    208|                    saved_flags = tif->tif_flags;
 4688|    208|                    tif->tif_flags |= TIFF_PERSAMPLE;
  ------------------
  |  |  143|    208|#define TIFF_PERSAMPLE 0x400000U  /* get/set per sample tags as arrays */
  ------------------
 4689|    208|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 4690|    208|                    tif->tif_flags = saved_flags;
 4691|    208|                    _TIFFfreeExt(tif, data);
 4692|    208|                    if (!m)
  ------------------
  |  Branch (4692:25): [True: 0, False: 208]
  ------------------
 4693|      0|                        goto bad;
 4694|    208|                }
 4695|    208|                break;
 4696|  3.30k|                case TIFFTAG_STRIPOFFSETS:
  ------------------
  |  |  247|  3.30k|#define TIFFTAG_STRIPOFFSETS 273           /* offsets to data strips */
  ------------------
  |  Branch (4696:17): [True: 3.30k, False: 135k]
  ------------------
 4697|  5.80k|                case TIFFTAG_TILEOFFSETS:
  ------------------
  |  |  313|  5.80k|#define TIFFTAG_TILEOFFSETS 324            /* !offsets to data tiles */
  ------------------
  |  Branch (4697:17): [True: 2.50k, False: 136k]
  ------------------
 4698|  5.80k|                {
 4699|  5.80k|                    switch (dp->tdir_type)
 4700|  5.80k|                    {
 4701|     23|                        case TIFF_SHORT:
  ------------------
  |  Branch (4701:25): [True: 23, False: 5.78k]
  ------------------
 4702|  3.75k|                        case TIFF_LONG:
  ------------------
  |  Branch (4702:25): [True: 3.72k, False: 2.07k]
  ------------------
 4703|  3.88k|                        case TIFF_LONG8:
  ------------------
  |  Branch (4703:25): [True: 137, False: 5.66k]
  ------------------
 4704|  3.88k|                            break;
 4705|  1.91k|                        default:
  ------------------
  |  Branch (4705:25): [True: 1.91k, False: 3.88k]
  ------------------
 4706|       |                            /* Warn except if directory typically created with
 4707|       |                             * TIFFDeferStrileArrayWriting() */
 4708|  1.91k|                            if (!(tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (4708:35): [True: 0, False: 1.91k]
  ------------------
 4709|      0|                                  dp->tdir_count == 0 && dp->tdir_type == 0 &&
  ------------------
  |  Branch (4709:35): [True: 0, False: 0]
  |  Branch (4709:58): [True: 0, False: 0]
  ------------------
 4710|      0|                                  dp->tdir_offset.toff_long8 == 0))
  ------------------
  |  Branch (4710:35): [True: 0, False: 0]
  ------------------
 4711|  1.91k|                            {
 4712|  1.91k|                                fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4713|  1.91k|                                TIFFWarningExtR(
 4714|  1.91k|                                    tif, module, "Invalid data type for tag %s",
 4715|  1.91k|                                    fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4715:37): [True: 1.91k, False: 0]
  ------------------
 4716|  1.91k|                            }
 4717|  1.91k|                            break;
 4718|  5.80k|                    }
 4719|  5.80k|                    _TIFFmemcpy(&(tif->tif_dir.td_stripoffset_entry), dp,
 4720|  5.80k|                                sizeof(TIFFDirEntry));
 4721|  5.80k|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4721:25): [True: 0, False: 5.80k]
  ------------------
 4722|      0|                        goto bad;
 4723|  5.80k|                }
 4724|  5.80k|                break;
 4725|  5.80k|                case TIFFTAG_STRIPBYTECOUNTS:
  ------------------
  |  |  259|  3.61k|#define TIFFTAG_STRIPBYTECOUNTS 279        /* bytes counts for strips */
  ------------------
  |  Branch (4725:17): [True: 3.61k, False: 135k]
  ------------------
 4726|  5.05k|                case TIFFTAG_TILEBYTECOUNTS:
  ------------------
  |  |  314|  5.05k|#define TIFFTAG_TILEBYTECOUNTS 325         /* !byte counts for tiles */
  ------------------
  |  Branch (4726:17): [True: 1.43k, False: 137k]
  ------------------
 4727|  5.05k|                {
 4728|  5.05k|                    switch (dp->tdir_type)
 4729|  5.05k|                    {
 4730|  1.25k|                        case TIFF_SHORT:
  ------------------
  |  Branch (4730:25): [True: 1.25k, False: 3.79k]
  ------------------
 4731|  2.28k|                        case TIFF_LONG:
  ------------------
  |  Branch (4731:25): [True: 1.03k, False: 4.02k]
  ------------------
 4732|  3.36k|                        case TIFF_LONG8:
  ------------------
  |  Branch (4732:25): [True: 1.07k, False: 3.97k]
  ------------------
 4733|  3.36k|                            break;
 4734|  1.69k|                        default:
  ------------------
  |  Branch (4734:25): [True: 1.69k, False: 3.36k]
  ------------------
 4735|       |                            /* Warn except if directory typically created with
 4736|       |                             * TIFFDeferStrileArrayWriting() */
 4737|  1.69k|                            if (!(tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (4737:35): [True: 0, False: 1.69k]
  ------------------
 4738|      0|                                  dp->tdir_count == 0 && dp->tdir_type == 0 &&
  ------------------
  |  Branch (4738:35): [True: 0, False: 0]
  |  Branch (4738:58): [True: 0, False: 0]
  ------------------
 4739|      0|                                  dp->tdir_offset.toff_long8 == 0))
  ------------------
  |  Branch (4739:35): [True: 0, False: 0]
  ------------------
 4740|  1.69k|                            {
 4741|  1.69k|                                fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4742|  1.69k|                                TIFFWarningExtR(
 4743|  1.69k|                                    tif, module, "Invalid data type for tag %s",
 4744|  1.69k|                                    fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4744:37): [True: 1.69k, False: 0]
  ------------------
 4745|  1.69k|                            }
 4746|  1.69k|                            break;
 4747|  5.05k|                    }
 4748|  5.05k|                    _TIFFmemcpy(&(tif->tif_dir.td_stripbytecount_entry), dp,
 4749|  5.05k|                                sizeof(TIFFDirEntry));
 4750|  5.05k|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4750:25): [True: 0, False: 5.05k]
  ------------------
 4751|      0|                        goto bad;
 4752|  5.05k|                }
 4753|  5.05k|                break;
 4754|  5.05k|                case TIFFTAG_COLORMAP:
  ------------------
  |  |  309|    332|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (4754:17): [True: 332, False: 138k]
  ------------------
 4755|    437|                case TIFFTAG_TRANSFERFUNCTION:
  ------------------
  |  |  298|    437|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (4755:17): [True: 105, False: 138k]
  ------------------
 4756|    437|                {
 4757|    437|                    enum TIFFReadDirEntryErr err;
 4758|    437|                    uint32_t countpersample;
 4759|    437|                    uint32_t countrequired;
 4760|    437|                    uint32_t incrementpersample;
 4761|    437|                    uint16_t *value = NULL;
 4762|       |                    /* It would be dangerous to instantiate those tag values */
 4763|       |                    /* since if td_bitspersample has not yet been read (due to
 4764|       |                     */
 4765|       |                    /* unordered tags), it could be read afterwards with a */
 4766|       |                    /* values greater than the default one (1), which may cause
 4767|       |                     */
 4768|       |                    /* crashes in user code */
 4769|    437|                    if (!bitspersample_read)
  ------------------
  |  Branch (4769:25): [True: 101, False: 336]
  ------------------
 4770|    101|                    {
 4771|    101|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4772|    101|                        TIFFWarningExtR(
 4773|    101|                            tif, module,
 4774|    101|                            "Ignoring %s since BitsPerSample tag not found",
 4775|    101|                            fip ? fip->field_name : "unknown tagname");
  ------------------
  |  Branch (4775:29): [True: 101, False: 0]
  ------------------
 4776|    101|                        continue;
 4777|    101|                    }
 4778|       |                    /* ColorMap or TransferFunction for high bit */
 4779|       |                    /* depths do not make much sense and could be */
 4780|       |                    /* used as a denial of service vector */
 4781|    336|                    if (tif->tif_dir.td_bitspersample > 24)
  ------------------
  |  Branch (4781:25): [True: 27, False: 309]
  ------------------
 4782|     27|                    {
 4783|     27|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4784|     27|                        TIFFWarningExtR(
 4785|     27|                            tif, module,
 4786|     27|                            "Ignoring %s because BitsPerSample=%" PRIu16 ">24",
 4787|     27|                            fip ? fip->field_name : "unknown tagname",
  ------------------
  |  Branch (4787:29): [True: 27, False: 0]
  ------------------
 4788|     27|                            tif->tif_dir.td_bitspersample);
 4789|     27|                        continue;
 4790|     27|                    }
 4791|    309|                    countpersample = (1U << tif->tif_dir.td_bitspersample);
 4792|    309|                    if ((dp->tdir_tag == TIFFTAG_TRANSFERFUNCTION) &&
  ------------------
  |  |  298|    309|#define TIFFTAG_TRANSFERFUNCTION 301       /* !colorimetry info */
  ------------------
  |  Branch (4792:25): [True: 44, False: 265]
  ------------------
 4793|     44|                        (dp->tdir_count == (uint64_t)countpersample))
  ------------------
  |  Branch (4793:25): [True: 1, False: 43]
  ------------------
 4794|      1|                    {
 4795|      1|                        countrequired = countpersample;
 4796|      1|                        incrementpersample = 0;
 4797|      1|                    }
 4798|    308|                    else
 4799|    308|                    {
 4800|    308|                        countrequired = 3 * countpersample;
 4801|    308|                        incrementpersample = countpersample;
 4802|    308|                    }
 4803|    309|                    if (dp->tdir_count != (uint64_t)countrequired)
  ------------------
  |  Branch (4803:25): [True: 261, False: 48]
  ------------------
 4804|    261|                        err = TIFFReadDirEntryErrCount;
 4805|     48|                    else
 4806|     48|                        err = TIFFReadDirEntryShortArray(tif, dp, &value);
 4807|    309|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (4807:25): [True: 0, False: 309]
  ------------------
 4808|      0|                        goto bad;
 4809|    309|                    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (4809:25): [True: 266, False: 43]
  ------------------
 4810|    266|                    {
 4811|    266|                        fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4812|    266|                        TIFFReadDirEntryOutputErr(
 4813|    266|                            tif, err, module,
 4814|    266|                            fip ? fip->field_name : "unknown tagname", 1);
  ------------------
  |  Branch (4814:29): [True: 266, False: 0]
  ------------------
 4815|    266|                    }
 4816|     43|                    else
 4817|     43|                    {
 4818|     43|                        TIFFSetField(tif, dp->tdir_tag, value,
 4819|     43|                                     value + incrementpersample,
 4820|     43|                                     value + 2 * incrementpersample);
 4821|     43|                        _TIFFfreeExt(tif, value);
 4822|     43|                    }
 4823|    309|                }
 4824|      0|                break;
 4825|       |                    /* BEGIN REV 4.0 COMPATIBILITY */
 4826|      0|                case TIFFTAG_OSUBFILETYPE:
  ------------------
  |  |  174|      0|#define TIFFTAG_OSUBFILETYPE 255      /* +kind of data in subfile */
  ------------------
  |  Branch (4826:17): [True: 0, False: 138k]
  ------------------
 4827|      0|                {
 4828|      0|                    uint16_t valueo;
 4829|      0|                    uint32_t value;
 4830|      0|                    if (TIFFReadDirEntryShort(tif, dp, &valueo) ==
  ------------------
  |  Branch (4830:25): [True: 0, False: 0]
  ------------------
 4831|      0|                        TIFFReadDirEntryErrOk)
 4832|      0|                    {
 4833|      0|                        switch (valueo)
 4834|      0|                        {
 4835|      0|                            case OFILETYPE_REDUCEDIMAGE:
  ------------------
  |  |  176|      0|#define OFILETYPE_REDUCEDIMAGE 2      /* reduced size image data */
  ------------------
  |  Branch (4835:29): [True: 0, False: 0]
  ------------------
 4836|      0|                                value = FILETYPE_REDUCEDIMAGE;
  ------------------
  |  |  171|      0|#define FILETYPE_REDUCEDIMAGE 0x1     /* reduced resolution version */
  ------------------
 4837|      0|                                break;
 4838|      0|                            case OFILETYPE_PAGE:
  ------------------
  |  |  177|      0|#define OFILETYPE_PAGE 3              /* one page of many */
  ------------------
  |  Branch (4838:29): [True: 0, False: 0]
  ------------------
 4839|      0|                                value = FILETYPE_PAGE;
  ------------------
  |  |  172|      0|#define FILETYPE_PAGE 0x2             /* one page of many */
  ------------------
 4840|      0|                                break;
 4841|      0|                            default:
  ------------------
  |  Branch (4841:29): [True: 0, False: 0]
  ------------------
 4842|      0|                                value = 0;
 4843|      0|                                break;
 4844|      0|                        }
 4845|      0|                        if (value != 0)
  ------------------
  |  Branch (4845:29): [True: 0, False: 0]
  ------------------
 4846|      0|                            TIFFSetField(tif, TIFFTAG_SUBFILETYPE, value);
  ------------------
  |  |  170|      0|#define TIFFTAG_SUBFILETYPE 254       /* subfile data descriptor */
  ------------------
 4847|      0|                    }
 4848|      0|                }
 4849|      0|                break;
 4850|       |                /* END REV 4.0 COMPATIBILITY */
 4851|       |#if 0
 4852|       |                case TIFFTAG_EP_BATTERYLEVEL:
 4853|       |                    /* TIFFTAG_EP_BATTERYLEVEL can be RATIONAL or ASCII.
 4854|       |                     * LibTiff defines it as ASCII and converts RATIONAL to an
 4855|       |                     * ASCII string. */
 4856|       |                    switch (dp->tdir_type)
 4857|       |                    {
 4858|       |                        case TIFF_RATIONAL:
 4859|       |                        {
 4860|       |                            /* Read rational and convert to ASCII*/
 4861|       |                            enum TIFFReadDirEntryErr err;
 4862|       |                            TIFFRational_t rValue;
 4863|       |                            err = TIFFReadDirEntryCheckedRationalDirect(
 4864|       |                                tif, dp, &rValue);
 4865|       |                            if (err != TIFFReadDirEntryErrOk)
 4866|       |                            {
 4867|       |                                fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4868|       |                                TIFFReadDirEntryOutputErr(
 4869|       |                                    tif, err, module,
 4870|       |                                    fip ? fip->field_name : "unknown tagname",
 4871|       |                                    1);
 4872|       |                            }
 4873|       |                            else
 4874|       |                            {
 4875|       |                                char szAux[32];
 4876|       |                                snprintf(szAux, sizeof(szAux) - 1, "%d/%d",
 4877|       |                                         rValue.uNum, rValue.uDenom);
 4878|       |                                TIFFSetField(tif, dp->tdir_tag, szAux);
 4879|       |                            }
 4880|       |                        }
 4881|       |                        break;
 4882|       |                        case TIFF_ASCII:
 4883|       |                            (void)TIFFFetchNormalTag(tif, dp, TRUE);
 4884|       |                            break;
 4885|       |                        default:
 4886|       |                            fip = TIFFFieldWithTag(tif, dp->tdir_tag);
 4887|       |                            TIFFWarningExtR(tif, module,
 4888|       |                                            "Invalid data type for tag %s. "
 4889|       |                                            "ASCII or RATIONAL expected",
 4890|       |                                            fip ? fip->field_name
 4891|       |                                                : "unknown tagname");
 4892|       |                            break;
 4893|       |                    }
 4894|       |                    break;
 4895|       |#endif
 4896|   123k|                default:
  ------------------
  |  Branch (4896:17): [True: 123k, False: 15.2k]
  ------------------
 4897|   123k|                    (void)TIFFFetchNormalTag(tif, dp, TRUE);
  ------------------
  |  |   71|   123k|#define TRUE 1
  ------------------
 4898|   123k|                    break;
 4899|   138k|            } /* -- switch (dp->tdir_tag) -- */
 4900|   138k|        } /* -- if (!dp->tdir_ignore) */
 4901|   327k|    } /* -- for-loop -- */
 4902|       |
 4903|       |    /* Evaluate final IFD data size. */
 4904|  5.92k|    CalcFinalIFDdatasizeReading(tif, dircount);
 4905|       |
 4906|       |    /*
 4907|       |     * OJPEG hack:
 4908|       |     * - If a) compression is OJPEG, and b) photometric tag is missing,
 4909|       |     * then we consistently find that photometric should be YCbCr
 4910|       |     * - If a) compression is OJPEG, and b) photometric tag says it's RGB,
 4911|       |     * then we consistently find that the buggy implementation of the
 4912|       |     * buggy compression scheme matches photometric YCbCr instead.
 4913|       |     * - If a) compression is OJPEG, and b) bitspersample tag is missing,
 4914|       |     * then we consistently find bitspersample should be 8.
 4915|       |     * - If a) compression is OJPEG, b) samplesperpixel tag is missing,
 4916|       |     * and c) photometric is RGB or YCbCr, then we consistently find
 4917|       |     * samplesperpixel should be 3
 4918|       |     * - If a) compression is OJPEG, b) samplesperpixel tag is missing,
 4919|       |     * and c) photometric is MINISWHITE or MINISBLACK, then we consistently
 4920|       |     * find samplesperpixel should be 3
 4921|       |     */
 4922|  5.92k|    if (tif->tif_dir.td_compression == COMPRESSION_OJPEG)
  ------------------
  |  |  189|  5.92k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (4922:9): [True: 1.02k, False: 4.89k]
  ------------------
 4923|  1.02k|    {
 4924|  1.02k|        if (!TIFFFieldSet(tif, FIELD_PHOTOMETRIC))
  ------------------
  |  |  248|  1.02k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  1.02k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  1.02k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4924:13): [True: 957, False: 69]
  ------------------
 4925|    957|        {
 4926|    957|            TIFFWarningExtR(
 4927|    957|                tif, module,
 4928|    957|                "Photometric tag is missing, assuming data is YCbCr");
 4929|    957|            if (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR))
  ------------------
  |  |  220|    957|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
                          if (!TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR))
  ------------------
  |  |  227|    957|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (4929:17): [True: 0, False: 957]
  ------------------
 4930|      0|                goto bad;
 4931|    957|        }
 4932|     69|        else if (tif->tif_dir.td_photometric == PHOTOMETRIC_RGB)
  ------------------
  |  |  223|     69|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (4932:18): [True: 13, False: 56]
  ------------------
 4933|     13|        {
 4934|     13|            tif->tif_dir.td_photometric = PHOTOMETRIC_YCBCR;
  ------------------
  |  |  227|     13|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
 4935|     13|            TIFFWarningExtR(tif, module,
 4936|     13|                            "Photometric tag value assumed incorrect, "
 4937|     13|                            "assuming data is YCbCr instead of RGB");
 4938|     13|        }
 4939|  1.02k|        if (!TIFFFieldSet(tif, FIELD_BITSPERSAMPLE))
  ------------------
  |  |  248|  1.02k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  1.02k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  1.02k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4939:13): [True: 961, False: 65]
  ------------------
 4940|    961|        {
 4941|    961|            TIFFWarningExtR(
 4942|    961|                tif, module,
 4943|    961|                "BitsPerSample tag is missing, assuming 8 bits per sample");
 4944|    961|            if (!TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8))
  ------------------
  |  |  180|    961|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  |  Branch (4944:17): [True: 0, False: 961]
  ------------------
 4945|      0|                goto bad;
 4946|    961|        }
 4947|  1.02k|        if (!TIFFFieldSet(tif, FIELD_SAMPLESPERPIXEL))
  ------------------
  |  |  248|  1.02k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  1.02k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  1.02k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4947:13): [True: 927, False: 99]
  ------------------
 4948|    927|        {
 4949|    927|            if (tif->tif_dir.td_photometric == PHOTOMETRIC_RGB)
  ------------------
  |  |  223|    927|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (4949:17): [True: 0, False: 927]
  ------------------
 4950|      0|            {
 4951|      0|                TIFFWarningExtR(tif, module,
 4952|      0|                                "SamplesPerPixel tag is missing, "
 4953|      0|                                "assuming correct SamplesPerPixel value is 3");
 4954|      0|                if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3))
  ------------------
  |  |  257|      0|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (4954:21): [True: 0, False: 0]
  ------------------
 4955|      0|                    goto bad;
 4956|      0|            }
 4957|    927|            if (tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR)
  ------------------
  |  |  227|    927|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (4957:17): [True: 912, False: 15]
  ------------------
 4958|    912|            {
 4959|    912|                TIFFWarningExtR(tif, module,
 4960|    912|                                "SamplesPerPixel tag is missing, "
 4961|    912|                                "applying correct SamplesPerPixel value of 3");
 4962|    912|                if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3))
  ------------------
  |  |  257|    912|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (4962:21): [True: 0, False: 912]
  ------------------
 4963|      0|                    goto bad;
 4964|    912|            }
 4965|     15|            else if ((tif->tif_dir.td_photometric == PHOTOMETRIC_MINISWHITE) ||
  ------------------
  |  |  221|     15|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (4965:22): [True: 1, False: 14]
  ------------------
 4966|     14|                     (tif->tif_dir.td_photometric == PHOTOMETRIC_MINISBLACK))
  ------------------
  |  |  222|     14|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (4966:22): [True: 0, False: 14]
  ------------------
 4967|      1|            {
 4968|       |                /*
 4969|       |                 * SamplesPerPixel tag is missing, but is not required
 4970|       |                 * by spec.  Assume correct SamplesPerPixel value of 1.
 4971|       |                 */
 4972|      1|                if (!TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1))
  ------------------
  |  |  257|      1|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  |  Branch (4972:21): [True: 0, False: 1]
  ------------------
 4973|      0|                    goto bad;
 4974|      1|            }
 4975|    927|        }
 4976|  1.02k|    }
 4977|       |
 4978|       |    /*
 4979|       |     * Setup appropriate structures (by strip or by tile)
 4980|       |     * We do that only after the above OJPEG hack which alters SamplesPerPixel
 4981|       |     * and thus influences the number of strips in the separate planarconfig.
 4982|       |     */
 4983|  5.92k|    if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS))
  ------------------
  |  |  248|  5.92k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  5.92k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  5.92k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (4983:9): [True: 3.33k, False: 2.59k]
  ------------------
 4984|  3.33k|    {
 4985|  3.33k|        tif->tif_dir.td_nstrips = TIFFNumberOfStrips(tif);
 4986|  3.33k|        tif->tif_dir.td_tilewidth = tif->tif_dir.td_imagewidth;
 4987|  3.33k|        tif->tif_dir.td_tilelength = tif->tif_dir.td_rowsperstrip;
 4988|  3.33k|        tif->tif_dir.td_tiledepth = tif->tif_dir.td_imagedepth;
 4989|  3.33k|        tif->tif_flags &= ~TIFF_ISTILED;
  ------------------
  |  |  129|  3.33k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
 4990|  3.33k|    }
 4991|  2.59k|    else
 4992|  2.59k|    {
 4993|  2.59k|        tif->tif_dir.td_nstrips = TIFFNumberOfTiles(tif);
 4994|  2.59k|        tif->tif_flags |= TIFF_ISTILED;
  ------------------
  |  |  129|  2.59k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
 4995|  2.59k|    }
 4996|  5.92k|    if (!tif->tif_dir.td_nstrips)
  ------------------
  |  Branch (4996:9): [True: 48, False: 5.87k]
  ------------------
 4997|     48|    {
 4998|     48|        TIFFErrorExtR(tif, module, "Cannot handle zero number of %s",
 4999|     48|                      isTiled(tif) ? "tiles" : "strips");
  ------------------
  |  |  278|     48|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     48|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 33, False: 15]
  |  |  ------------------
  ------------------
 5000|     48|        goto bad;
 5001|     48|    }
 5002|  5.87k|    tif->tif_dir.td_stripsperimage = tif->tif_dir.td_nstrips;
 5003|  5.87k|    if (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  5.87k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (5003:9): [True: 1.11k, False: 4.75k]
  ------------------
 5004|  1.11k|        tif->tif_dir.td_stripsperimage /= tif->tif_dir.td_samplesperpixel;
 5005|  5.87k|    if (!TIFFFieldSet(tif, FIELD_STRIPOFFSETS))
  ------------------
  |  |  248|  5.87k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  5.87k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  5.87k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5005:9): [True: 233, False: 5.63k]
  ------------------
 5006|    233|    {
 5007|    233|#ifdef OJPEG_SUPPORT
 5008|    233|        if ((tif->tif_dir.td_compression == COMPRESSION_OJPEG) &&
  ------------------
  |  |  189|    233|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (5008:13): [True: 39, False: 194]
  ------------------
 5009|     39|            (isTiled(tif) == 0) && (tif->tif_dir.td_nstrips == 1))
  ------------------
  |  |  278|     39|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     39|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (5009:13): [True: 39, False: 0]
  |  Branch (5009:36): [True: 35, False: 4]
  ------------------
 5010|     35|        {
 5011|       |            /*
 5012|       |             * XXX: OJPEG hack.
 5013|       |             * If a) compression is OJPEG, b) it's not a tiled TIFF,
 5014|       |             * and c) the number of strips is 1,
 5015|       |             * then we tolerate the absence of stripoffsets tag,
 5016|       |             * because, presumably, all required data is in the
 5017|       |             * JpegInterchangeFormat stream.
 5018|       |             */
 5019|     35|            TIFFSetFieldBit(tif, FIELD_STRIPOFFSETS);
  ------------------
  |  |  249|     35|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|     35|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|     35|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 5020|     35|        }
 5021|    198|        else
 5022|    198|#endif
 5023|    198|        {
 5024|    198|            MissingRequired(tif, isTiled(tif) ? "TileOffsets" : "StripOffsets");
  ------------------
  |  |  278|    198|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    198|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 1, False: 197]
  |  |  ------------------
  ------------------
 5025|    198|            goto bad;
 5026|    198|        }
 5027|    233|    }
 5028|       |
 5029|  5.67k|    if (tif->tif_mode == O_RDWR &&
  ------------------
  |  Branch (5029:9): [True: 0, False: 5.67k]
  ------------------
 5030|      0|        tif->tif_dir.td_stripoffset_entry.tdir_tag != 0 &&
  ------------------
  |  Branch (5030:9): [True: 0, False: 0]
  ------------------
 5031|      0|        tif->tif_dir.td_stripoffset_entry.tdir_count == 0 &&
  ------------------
  |  Branch (5031:9): [True: 0, False: 0]
  ------------------
 5032|      0|        tif->tif_dir.td_stripoffset_entry.tdir_type == 0 &&
  ------------------
  |  Branch (5032:9): [True: 0, False: 0]
  ------------------
 5033|      0|        tif->tif_dir.td_stripoffset_entry.tdir_offset.toff_long8 == 0 &&
  ------------------
  |  Branch (5033:9): [True: 0, False: 0]
  ------------------
 5034|      0|        tif->tif_dir.td_stripbytecount_entry.tdir_tag != 0 &&
  ------------------
  |  Branch (5034:9): [True: 0, False: 0]
  ------------------
 5035|      0|        tif->tif_dir.td_stripbytecount_entry.tdir_count == 0 &&
  ------------------
  |  Branch (5035:9): [True: 0, False: 0]
  ------------------
 5036|      0|        tif->tif_dir.td_stripbytecount_entry.tdir_type == 0 &&
  ------------------
  |  Branch (5036:9): [True: 0, False: 0]
  ------------------
 5037|      0|        tif->tif_dir.td_stripbytecount_entry.tdir_offset.toff_long8 == 0)
  ------------------
  |  Branch (5037:9): [True: 0, False: 0]
  ------------------
 5038|      0|    {
 5039|       |        /* Directory typically created with TIFFDeferStrileArrayWriting() */
 5040|      0|        TIFFSetupStrips(tif);
 5041|      0|    }
 5042|  5.67k|    else if (!(tif->tif_flags & TIFF_DEFERSTRILELOAD))
  ------------------
  |  |  147|  5.67k|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (5042:14): [True: 5.67k, False: 0]
  ------------------
 5043|  5.67k|    {
 5044|  5.67k|        if (tif->tif_dir.td_stripoffset_entry.tdir_tag != 0)
  ------------------
  |  Branch (5044:13): [True: 5.63k, False: 35]
  ------------------
 5045|  5.63k|        {
 5046|  5.63k|            if (!TIFFFetchStripThing(tif, &(tif->tif_dir.td_stripoffset_entry),
  ------------------
  |  Branch (5046:17): [True: 137, False: 5.50k]
  ------------------
 5047|  5.63k|                                     tif->tif_dir.td_nstrips,
 5048|  5.63k|                                     &tif->tif_dir.td_stripoffset_p))
 5049|    137|            {
 5050|    137|                goto bad;
 5051|    137|            }
 5052|  5.63k|        }
 5053|  5.53k|        if (tif->tif_dir.td_stripbytecount_entry.tdir_tag != 0)
  ------------------
  |  Branch (5053:13): [True: 4.83k, False: 703]
  ------------------
 5054|  4.83k|        {
 5055|  4.83k|            if (!TIFFFetchStripThing(
  ------------------
  |  Branch (5055:17): [True: 21, False: 4.81k]
  ------------------
 5056|  4.83k|                    tif, &(tif->tif_dir.td_stripbytecount_entry),
 5057|  4.83k|                    tif->tif_dir.td_nstrips, &tif->tif_dir.td_stripbytecount_p))
 5058|     21|            {
 5059|     21|                goto bad;
 5060|     21|            }
 5061|  4.83k|        }
 5062|  5.53k|    }
 5063|       |
 5064|       |    /*
 5065|       |     * Make sure all non-color channels are extrasamples.
 5066|       |     * If it's not the case, define them as such.
 5067|       |     */
 5068|  5.51k|    color_channels = _TIFFGetMaxColorChannels(tif->tif_dir.td_photometric);
 5069|  5.51k|    if (color_channels &&
  ------------------
  |  Branch (5069:9): [True: 5.44k, False: 71]
  ------------------
 5070|  5.44k|        tif->tif_dir.td_samplesperpixel - tif->tif_dir.td_extrasamples >
  ------------------
  |  Branch (5070:9): [True: 545, False: 4.90k]
  ------------------
 5071|  5.44k|            color_channels)
 5072|    545|    {
 5073|    545|        uint16_t old_extrasamples;
 5074|    545|        uint16_t *new_sampleinfo;
 5075|       |
 5076|    545|        TIFFWarningExtR(
 5077|    545|            tif, module,
 5078|    545|            "Sum of Photometric type-related "
 5079|    545|            "color channels and ExtraSamples doesn't match SamplesPerPixel. "
 5080|    545|            "Defining non-color channels as ExtraSamples.");
 5081|       |
 5082|    545|        old_extrasamples = tif->tif_dir.td_extrasamples;
 5083|    545|        tif->tif_dir.td_extrasamples =
 5084|    545|            (uint16_t)(tif->tif_dir.td_samplesperpixel - color_channels);
 5085|       |
 5086|       |        // sampleinfo should contain information relative to these new extra
 5087|       |        // samples
 5088|    545|        new_sampleinfo = (uint16_t *)_TIFFcallocExt(
 5089|    545|            tif, tif->tif_dir.td_extrasamples, sizeof(uint16_t));
 5090|    545|        if (!new_sampleinfo)
  ------------------
  |  Branch (5090:13): [True: 0, False: 545]
  ------------------
 5091|      0|        {
 5092|      0|            TIFFErrorExtR(tif, module,
 5093|      0|                          "Failed to allocate memory for "
 5094|      0|                          "temporary new sampleinfo array "
 5095|      0|                          "(%" PRIu16 " 16 bit elements)",
 5096|      0|                          tif->tif_dir.td_extrasamples);
 5097|      0|            goto bad;
 5098|      0|        }
 5099|       |
 5100|    545|        if (old_extrasamples > 0)
  ------------------
  |  Branch (5100:13): [True: 61, False: 484]
  ------------------
 5101|     61|            memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo,
 5102|     61|                   old_extrasamples * sizeof(uint16_t));
 5103|    545|        _TIFFsetShortArrayExt(tif, &tif->tif_dir.td_sampleinfo, new_sampleinfo,
 5104|    545|                              tif->tif_dir.td_extrasamples);
 5105|    545|        _TIFFfreeExt(tif, new_sampleinfo);
 5106|    545|    }
 5107|       |
 5108|       |    /*
 5109|       |     * Verify Palette image has a Colormap.
 5110|       |     */
 5111|  5.51k|    if (tif->tif_dir.td_photometric == PHOTOMETRIC_PALETTE &&
  ------------------
  |  |  224|  11.0k|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (5111:9): [True: 179, False: 5.33k]
  ------------------
 5112|    179|        !TIFFFieldSet(tif, FIELD_COLORMAP))
  ------------------
  |  |  248|    179|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|    179|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|    179|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5112:9): [True: 146, False: 33]
  ------------------
 5113|    146|    {
 5114|    146|        if (tif->tif_dir.td_bitspersample >= 8 &&
  ------------------
  |  Branch (5114:13): [True: 133, False: 13]
  ------------------
 5115|    133|            tif->tif_dir.td_samplesperpixel == 3)
  ------------------
  |  Branch (5115:13): [True: 26, False: 107]
  ------------------
 5116|     26|            tif->tif_dir.td_photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  223|     26|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
 5117|    120|        else if (tif->tif_dir.td_bitspersample >= 8)
  ------------------
  |  Branch (5117:18): [True: 107, False: 13]
  ------------------
 5118|    107|            tif->tif_dir.td_photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  222|    107|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
 5119|     13|        else
 5120|     13|        {
 5121|     13|            MissingRequired(tif, "Colormap");
 5122|     13|            goto bad;
 5123|     13|        }
 5124|    146|    }
 5125|       |    /*
 5126|       |     * OJPEG hack:
 5127|       |     * We do no further messing with strip/tile offsets/bytecounts in OJPEG
 5128|       |     * TIFFs
 5129|       |     */
 5130|  5.50k|    if (tif->tif_dir.td_compression != COMPRESSION_OJPEG)
  ------------------
  |  |  189|  5.50k|#define COMPRESSION_OJPEG 6           /* !6.0 JPEG */
  ------------------
  |  Branch (5130:9): [True: 4.52k, False: 980]
  ------------------
 5131|  4.52k|    {
 5132|       |        /*
 5133|       |         * Attempt to deal with a missing StripByteCounts tag.
 5134|       |         */
 5135|  4.52k|        if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS))
  ------------------
  |  |  248|  4.52k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  4.52k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  4.52k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5135:13): [True: 400, False: 4.12k]
  ------------------
 5136|    400|        {
 5137|       |            /*
 5138|       |             * Some manufacturers violate the spec by not giving
 5139|       |             * the size of the strips.  In this case, assume there
 5140|       |             * is one uncompressed strip of data.
 5141|       |             */
 5142|    400|            if ((tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|    800|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5142:18): [True: 395, False: 5]
  ------------------
 5143|    395|                 tif->tif_dir.td_nstrips > 1) ||
  ------------------
  |  Branch (5143:18): [True: 2, False: 393]
  ------------------
 5144|    398|                (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE &&
  ------------------
  |  |  266|    796|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (5144:18): [True: 5, False: 393]
  ------------------
 5145|      5|                 tif->tif_dir.td_nstrips !=
  ------------------
  |  Branch (5145:18): [True: 1, False: 4]
  ------------------
 5146|      5|                     (uint32_t)tif->tif_dir.td_samplesperpixel))
 5147|      3|            {
 5148|      3|                MissingRequired(tif, "StripByteCounts");
 5149|      3|                goto bad;
 5150|      3|            }
 5151|    397|            TIFFWarningExtR(
 5152|    397|                tif, module,
 5153|    397|                "TIFF directory is missing required "
 5154|    397|                "\"StripByteCounts\" field, calculating from imagelength");
 5155|    397|            if (EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (5155:17): [True: 19, False: 378]
  ------------------
 5156|     19|                goto bad;
 5157|    397|        }
 5158|  4.12k|        else if (tif->tif_dir.td_nstrips == 1 &&
  ------------------
  |  Branch (5158:18): [True: 2.06k, False: 2.05k]
  ------------------
 5159|  2.06k|                 !(tif->tif_flags & TIFF_ISTILED) && ByteCountLooksBad(tif))
  ------------------
  |  |  129|  2.06k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
  |  Branch (5159:18): [True: 2.05k, False: 15]
  |  Branch (5159:54): [True: 107, False: 1.94k]
  ------------------
 5160|    107|        {
 5161|       |            /*
 5162|       |             * XXX: Plexus (and others) sometimes give a value of
 5163|       |             * zero for a tag when they don't know what the
 5164|       |             * correct value is!  Try and handle the simple case
 5165|       |             * of estimating the size of a one strip image.
 5166|       |             */
 5167|    107|            TIFFWarningExtR(tif, module,
 5168|    107|                            "Bogus \"StripByteCounts\" field, ignoring and "
 5169|    107|                            "calculating from imagelength");
 5170|    107|            if (EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (5170:17): [True: 0, False: 107]
  ------------------
 5171|      0|                goto bad;
 5172|    107|        }
 5173|  4.01k|        else if (!(tif->tif_flags & TIFF_DEFERSTRILELOAD) &&
  ------------------
  |  |  147|  4.01k|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (5173:18): [True: 4.01k, False: 0]
  ------------------
 5174|  4.01k|                 tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  8.03k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5174:18): [True: 3.56k, False: 451]
  ------------------
 5175|  3.56k|                 tif->tif_dir.td_nstrips > 2 &&
  ------------------
  |  Branch (5175:18): [True: 1.70k, False: 1.86k]
  ------------------
 5176|  1.70k|                 tif->tif_dir.td_compression == COMPRESSION_NONE &&
  ------------------
  |  |  182|  5.71k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5176:18): [True: 108, False: 1.59k]
  ------------------
 5177|    108|                 TIFFGetStrileByteCount(tif, 0) !=
  ------------------
  |  Branch (5177:18): [True: 105, False: 3]
  ------------------
 5178|    108|                     TIFFGetStrileByteCount(tif, 1) &&
 5179|    105|                 TIFFGetStrileByteCount(tif, 0) != 0 &&
  ------------------
  |  Branch (5179:18): [True: 104, False: 1]
  ------------------
 5180|    104|                 TIFFGetStrileByteCount(tif, 1) != 0)
  ------------------
  |  Branch (5180:18): [True: 12, False: 92]
  ------------------
 5181|     12|        {
 5182|       |            /*
 5183|       |             * XXX: Some vendors fill StripByteCount array with
 5184|       |             * absolutely wrong values (it can be equal to
 5185|       |             * StripOffset array, for example). Catch this case
 5186|       |             * here.
 5187|       |             *
 5188|       |             * We avoid this check if deferring strile loading
 5189|       |             * as it would always force us to load the strip/tile
 5190|       |             * information.
 5191|       |             */
 5192|     12|            TIFFWarningExtR(tif, module,
 5193|     12|                            "Wrong \"StripByteCounts\" field, ignoring and "
 5194|     12|                            "calculating from imagelength");
 5195|     12|            if (EstimateStripByteCounts(tif, dir, dircount) < 0)
  ------------------
  |  Branch (5195:17): [True: 0, False: 12]
  ------------------
 5196|      0|                goto bad;
 5197|     12|        }
 5198|  4.52k|    }
 5199|  5.48k|    if (dir)
  ------------------
  |  Branch (5199:9): [True: 5.48k, False: 0]
  ------------------
 5200|  5.48k|    {
 5201|  5.48k|        _TIFFfreeExt(tif, dir);
 5202|  5.48k|        dir = NULL;
 5203|  5.48k|    }
 5204|  5.48k|    if (!TIFFFieldSet(tif, FIELD_MAXSAMPLEVALUE))
  ------------------
  |  |  248|  5.48k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  5.48k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  5.48k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5204:9): [True: 5.47k, False: 3]
  ------------------
 5205|  5.47k|    {
 5206|  5.47k|        if (tif->tif_dir.td_bitspersample >= 16)
  ------------------
  |  Branch (5206:13): [True: 501, False: 4.97k]
  ------------------
 5207|    501|            tif->tif_dir.td_maxsamplevalue = 0xFFFF;
 5208|  4.97k|        else
 5209|  4.97k|            tif->tif_dir.td_maxsamplevalue =
 5210|  4.97k|                (uint16_t)((1 << tif->tif_dir.td_bitspersample) - 1);
 5211|  5.47k|    }
 5212|       |
 5213|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 5214|       |    /*
 5215|       |     * XXX: We can optimize checking for the strip bounds using the sorted
 5216|       |     * bytecounts array. See also comments for TIFFAppendToStrip()
 5217|       |     * function in tif_write.c.
 5218|       |     */
 5219|       |    if (!(tif->tif_flags & TIFF_DEFERSTRILELOAD) && tif->tif_dir.td_nstrips > 1)
 5220|       |    {
 5221|       |        uint32_t strip;
 5222|       |
 5223|       |        tif->tif_dir.td_stripbytecountsorted = 1;
 5224|       |        for (strip = 1; strip < tif->tif_dir.td_nstrips; strip++)
 5225|       |        {
 5226|       |            if (TIFFGetStrileOffset(tif, strip - 1) >
 5227|       |                TIFFGetStrileOffset(tif, strip))
 5228|       |            {
 5229|       |                tif->tif_dir.td_stripbytecountsorted = 0;
 5230|       |                break;
 5231|       |            }
 5232|       |        }
 5233|       |    }
 5234|       |#endif
 5235|       |
 5236|       |    /*
 5237|       |     * An opportunity for compression mode dependent tag fixup
 5238|       |     */
 5239|  5.48k|    (*tif->tif_fixuptags)(tif);
 5240|       |
 5241|       |    /*
 5242|       |     * Some manufacturers make life difficult by writing
 5243|       |     * large amounts of uncompressed data as a single strip.
 5244|       |     * This is contrary to the recommendations of the spec.
 5245|       |     * The following makes an attempt at breaking such images
 5246|       |     * into strips closer to the recommended 8k bytes.  A
 5247|       |     * side effect, however, is that the RowsPerStrip tag
 5248|       |     * value may be changed.
 5249|       |     */
 5250|  5.48k|    if ((tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|  5.48k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5250:9): [True: 4.38k, False: 1.10k]
  ------------------
 5251|  4.38k|        (tif->tif_dir.td_nstrips == 1) &&
  ------------------
  |  Branch (5251:9): [True: 2.38k, False: 1.99k]
  ------------------
 5252|  2.38k|        (tif->tif_dir.td_compression == COMPRESSION_NONE) &&
  ------------------
  |  |  182|  2.38k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5252:9): [True: 81, False: 2.30k]
  ------------------
 5253|     81|        ((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP))
  ------------------
  |  |  134|     81|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
                      ((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP))
  ------------------
  |  |  129|     81|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
                      ((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP))
  ------------------
  |  |  134|     81|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
  |  Branch (5253:9): [True: 77, False: 4]
  ------------------
 5254|     77|    {
 5255|     77|        ChopUpSingleUncompressedStrip(tif);
 5256|     77|    }
 5257|       |
 5258|       |    /* There are also uncompressed striped files with strips larger than */
 5259|       |    /* 2 GB, which make them unfriendly with a lot of code. If possible, */
 5260|       |    /* try to expose smaller "virtual" strips. */
 5261|  5.48k|    if (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  10.9k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (5261:9): [True: 4.38k, False: 1.10k]
  ------------------
 5262|  4.38k|        tif->tif_dir.td_compression == COMPRESSION_NONE &&
  ------------------
  |  |  182|  9.86k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5262:9): [True: 208, False: 4.17k]
  ------------------
 5263|    208|        (tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  134|    208|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
                      (tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  129|    208|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  ------------------
                      (tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) == TIFF_STRIPCHOP &&
  ------------------
  |  |  134|  5.68k|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
  |  Branch (5263:9): [True: 184, False: 24]
  ------------------
 5264|    184|        TIFFStripSize64(tif) > 0x7FFFFFFFUL)
  ------------------
  |  Branch (5264:9): [True: 15, False: 169]
  ------------------
 5265|     15|    {
 5266|     15|        TryChopUpUncompressedBigTiff(tif);
 5267|     15|    }
 5268|       |
 5269|       |    /*
 5270|       |     * Clear the dirty directory flag.
 5271|       |     */
 5272|  5.48k|    tif->tif_flags &= ~TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|  5.48k|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 5273|  5.48k|    tif->tif_flags &= ~TIFF_DIRTYSTRIP;
  ------------------
  |  |  142|  5.48k|#define TIFF_DIRTYSTRIP 0x200000U /* stripoffsets/stripbytecount dirty*/
  ------------------
 5274|       |
 5275|       |    /*
 5276|       |     * Reinitialize some further i/o since we are starting on a new directory.
 5277|       |     */
 5278|  5.48k|    tif->tif_dir.td_scanlinesize = TIFFScanlineSize(tif);
 5279|  5.48k|    if (!tif->tif_dir.td_scanlinesize)
  ------------------
  |  Branch (5279:9): [True: 39, False: 5.44k]
  ------------------
 5280|     39|    {
 5281|     39|        TIFFErrorExtR(tif, module, "Cannot handle zero scanline size");
 5282|     39|        return (0);
 5283|     39|    }
 5284|       |
 5285|  5.44k|    if (isTiled(tif))
  ------------------
  |  |  278|  5.44k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  5.44k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 2.48k, False: 2.96k]
  |  |  ------------------
  ------------------
 5286|  2.48k|    {
 5287|  2.48k|        tif->tif_dir.td_tilesize = TIFFTileSize(tif);
 5288|  2.48k|        if (!tif->tif_dir.td_tilesize)
  ------------------
  |  Branch (5288:13): [True: 0, False: 2.48k]
  ------------------
 5289|      0|        {
 5290|      0|            TIFFErrorExtR(tif, module, "Cannot handle zero tile size");
 5291|      0|            return (0);
 5292|      0|        }
 5293|  2.48k|    }
 5294|  2.96k|    else
 5295|  2.96k|    {
 5296|  2.96k|        if (!TIFFStripSize(tif))
  ------------------
  |  Branch (5296:13): [True: 1.05k, False: 1.90k]
  ------------------
 5297|  1.05k|        {
 5298|  1.05k|            TIFFErrorExtR(tif, module, "Cannot handle zero strip size");
 5299|  1.05k|            return (0);
 5300|  1.05k|        }
 5301|  2.96k|    }
 5302|  4.38k|    return (1);
 5303|    500|bad:
 5304|    500|    if (dir)
  ------------------
  |  Branch (5304:9): [True: 500, False: 0]
  ------------------
 5305|    500|        _TIFFfreeExt(tif, dir);
 5306|    500|    return (0);
 5307|  5.44k|} /*-- TIFFReadDirectory() --*/
_TIFFCheckDirNumberAndOffset:
 5773|  5.98k|{
 5774|  5.98k|    if (diroff == 0) /* no more directories */
  ------------------
  |  Branch (5774:9): [True: 0, False: 5.98k]
  ------------------
 5775|      0|        return 0;
 5776|       |
 5777|  5.98k|    if (tif->tif_map_dir_offset_to_number == NULL)
  ------------------
  |  Branch (5777:9): [True: 5.98k, False: 0]
  ------------------
 5778|  5.98k|    {
 5779|  5.98k|        tif->tif_map_dir_offset_to_number = TIFFHashSetNew(
 5780|  5.98k|            hashFuncOffsetToNumber, equalFuncOffsetToNumber, free);
 5781|  5.98k|        if (tif->tif_map_dir_offset_to_number == NULL)
  ------------------
  |  Branch (5781:13): [True: 0, False: 5.98k]
  ------------------
 5782|      0|        {
 5783|      0|            TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5784|      0|                          "Not enough memory");
 5785|      0|            return 1;
 5786|      0|        }
 5787|  5.98k|    }
 5788|       |
 5789|  5.98k|    if (tif->tif_map_dir_number_to_offset == NULL)
  ------------------
  |  Branch (5789:9): [True: 5.98k, False: 0]
  ------------------
 5790|  5.98k|    {
 5791|       |        /* No free callback for this map, as it shares the same items as
 5792|       |         * tif->tif_map_dir_offset_to_number. */
 5793|  5.98k|        tif->tif_map_dir_number_to_offset = TIFFHashSetNew(
 5794|  5.98k|            hashFuncNumberToOffset, equalFuncNumberToOffset, NULL);
 5795|  5.98k|        if (tif->tif_map_dir_number_to_offset == NULL)
  ------------------
  |  Branch (5795:13): [True: 0, False: 5.98k]
  ------------------
 5796|      0|        {
 5797|      0|            TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5798|      0|                          "Not enough memory");
 5799|      0|            return 1;
 5800|      0|        }
 5801|  5.98k|    }
 5802|       |
 5803|       |    /* Check if offset is already in the list:
 5804|       |     * - yes: check, if offset is at the same IFD number - if not, it is an IFD
 5805|       |     * loop
 5806|       |     * -  no: add to list or update offset at that IFD number
 5807|       |     */
 5808|  5.98k|    TIFFOffsetAndDirNumber entry;
 5809|  5.98k|    entry.offset = diroff;
 5810|  5.98k|    entry.dirNumber = dirn;
 5811|       |
 5812|  5.98k|    TIFFOffsetAndDirNumber *foundEntry =
 5813|  5.98k|        (TIFFOffsetAndDirNumber *)TIFFHashSetLookup(
 5814|  5.98k|            tif->tif_map_dir_offset_to_number, &entry);
 5815|  5.98k|    if (foundEntry)
  ------------------
  |  Branch (5815:9): [True: 0, False: 5.98k]
  ------------------
 5816|      0|    {
 5817|      0|        if (foundEntry->dirNumber == dirn)
  ------------------
  |  Branch (5817:13): [True: 0, False: 0]
  ------------------
 5818|      0|        {
 5819|      0|            return 1;
 5820|      0|        }
 5821|      0|        else
 5822|      0|        {
 5823|      0|            TIFFWarningExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5824|      0|                            "TIFF directory %d has IFD looping to directory %u "
 5825|      0|                            "at offset 0x%" PRIx64 " (%" PRIu64 ")",
 5826|      0|                            (int)dirn - 1, foundEntry->dirNumber, diroff,
 5827|      0|                            diroff);
 5828|      0|            return 0;
 5829|      0|        }
 5830|      0|    }
 5831|       |
 5832|       |    /* Check if offset of an IFD has been changed and update offset of that IFD
 5833|       |     * number. */
 5834|  5.98k|    foundEntry = (TIFFOffsetAndDirNumber *)TIFFHashSetLookup(
 5835|  5.98k|        tif->tif_map_dir_number_to_offset, &entry);
 5836|  5.98k|    if (foundEntry)
  ------------------
  |  Branch (5836:9): [True: 0, False: 5.98k]
  ------------------
 5837|      0|    {
 5838|      0|        if (foundEntry->offset != diroff)
  ------------------
  |  Branch (5838:13): [True: 0, False: 0]
  ------------------
 5839|      0|        {
 5840|      0|            TIFFOffsetAndDirNumber entryOld;
 5841|      0|            entryOld.offset = foundEntry->offset;
 5842|      0|            entryOld.dirNumber = dirn;
 5843|       |            /* We must remove first from tif_map_dir_number_to_offset as the */
 5844|       |            /* entry is owned (and thus freed) by */
 5845|       |            /* tif_map_dir_offset_to_number */
 5846|      0|            TIFFOffsetAndDirNumber *foundEntryOld =
 5847|      0|                (TIFFOffsetAndDirNumber *)TIFFHashSetLookup(
 5848|      0|                    tif->tif_map_dir_number_to_offset, &entryOld);
 5849|      0|            if (foundEntryOld)
  ------------------
  |  Branch (5849:17): [True: 0, False: 0]
  ------------------
 5850|      0|            {
 5851|      0|                TIFFHashSetRemove(tif->tif_map_dir_number_to_offset,
 5852|      0|                                  foundEntryOld);
 5853|      0|            }
 5854|      0|            foundEntryOld = (TIFFOffsetAndDirNumber *)TIFFHashSetLookup(
 5855|      0|                tif->tif_map_dir_offset_to_number, &entryOld);
 5856|      0|            if (foundEntryOld)
  ------------------
  |  Branch (5856:17): [True: 0, False: 0]
  ------------------
 5857|      0|            {
 5858|      0|                TIFFHashSetRemove(tif->tif_map_dir_offset_to_number,
 5859|      0|                                  foundEntryOld);
 5860|      0|            }
 5861|       |
 5862|      0|            TIFFOffsetAndDirNumber *entryPtr = (TIFFOffsetAndDirNumber *)malloc(
 5863|      0|                sizeof(TIFFOffsetAndDirNumber));
 5864|      0|            if (entryPtr == NULL)
  ------------------
  |  Branch (5864:17): [True: 0, False: 0]
  ------------------
 5865|      0|            {
 5866|      0|                return 0;
 5867|      0|            }
 5868|       |
 5869|       |            /* Add IFD offset and dirn to IFD directory list */
 5870|      0|            *entryPtr = entry;
 5871|       |
 5872|      0|            if (!TIFFHashSetInsert(tif->tif_map_dir_offset_to_number, entryPtr))
  ------------------
  |  Branch (5872:17): [True: 0, False: 0]
  ------------------
 5873|      0|            {
 5874|      0|                TIFFErrorExtR(
 5875|      0|                    tif, "_TIFFCheckDirNumberAndOffset",
 5876|      0|                    "Insertion in tif_map_dir_offset_to_number failed");
 5877|      0|                return 0;
 5878|      0|            }
 5879|      0|            if (!TIFFHashSetInsert(tif->tif_map_dir_number_to_offset, entryPtr))
  ------------------
  |  Branch (5879:17): [True: 0, False: 0]
  ------------------
 5880|      0|            {
 5881|      0|                TIFFErrorExtR(
 5882|      0|                    tif, "_TIFFCheckDirNumberAndOffset",
 5883|      0|                    "Insertion in tif_map_dir_number_to_offset failed");
 5884|      0|                return 0;
 5885|      0|            }
 5886|      0|        }
 5887|      0|        return 1;
 5888|      0|    }
 5889|       |
 5890|       |    /* Arbitrary (hopefully big enough) limit */
 5891|  5.98k|    if (TIFFHashSetSize(tif->tif_map_dir_offset_to_number) >=
  ------------------
  |  Branch (5891:9): [True: 0, False: 5.98k]
  ------------------
 5892|  5.98k|        TIFF_MAX_DIR_COUNT)
  ------------------
  |  |  122|  5.98k|#define TIFF_MAX_DIR_COUNT 1048576
  ------------------
 5893|      0|    {
 5894|      0|        TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5895|      0|                      "Cannot handle more than %u TIFF directories",
 5896|      0|                      (unsigned)TIFF_MAX_DIR_COUNT);
  ------------------
  |  |  122|      0|#define TIFF_MAX_DIR_COUNT 1048576
  ------------------
 5897|      0|        return 0;
 5898|      0|    }
 5899|       |
 5900|  5.98k|    TIFFOffsetAndDirNumber *entryPtr =
 5901|  5.98k|        (TIFFOffsetAndDirNumber *)malloc(sizeof(TIFFOffsetAndDirNumber));
 5902|  5.98k|    if (entryPtr == NULL)
  ------------------
  |  Branch (5902:9): [True: 0, False: 5.98k]
  ------------------
 5903|      0|    {
 5904|      0|        TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5905|      0|                      "malloc(sizeof(TIFFOffsetAndDirNumber)) failed");
 5906|      0|        return 0;
 5907|      0|    }
 5908|       |
 5909|       |    /* Add IFD offset and dirn to IFD directory list */
 5910|  5.98k|    *entryPtr = entry;
 5911|       |
 5912|  5.98k|    if (!TIFFHashSetInsert(tif->tif_map_dir_offset_to_number, entryPtr))
  ------------------
  |  Branch (5912:9): [True: 0, False: 5.98k]
  ------------------
 5913|      0|    {
 5914|      0|        TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5915|      0|                      "Insertion in tif_map_dir_offset_to_number failed");
 5916|      0|        return 0;
 5917|      0|    }
 5918|  5.98k|    if (!TIFFHashSetInsert(tif->tif_map_dir_number_to_offset, entryPtr))
  ------------------
  |  Branch (5918:9): [True: 0, False: 5.98k]
  ------------------
 5919|      0|    {
 5920|      0|        TIFFErrorExtR(tif, "_TIFFCheckDirNumberAndOffset",
 5921|      0|                      "Insertion in tif_map_dir_number_to_offset failed");
 5922|      0|        return 0;
 5923|      0|    }
 5924|       |
 5925|  5.98k|    return 1;
 5926|  5.98k|} /* --- _TIFFCheckDirNumberAndOffset() ---*/
TIFFGetStrileOffset:
 8522|   502k|{
 8523|       |    return TIFFGetStrileOffsetWithErr(tif, strile, NULL);
 8524|   502k|}
TIFFGetStrileOffsetWithErr:
 8529|  9.87M|{
 8530|  9.87M|    TIFFDirectory *td = &tif->tif_dir;
 8531|  9.87M|    return _TIFFGetStrileOffsetOrByteCountValue(tif, strile,
 8532|  9.87M|                                                &(td->td_stripoffset_entry),
 8533|  9.87M|                                                &(td->td_stripoffset_p), pbErr);
 8534|  9.87M|}
TIFFGetStrileByteCount:
 8539|  1.22M|{
 8540|       |    return TIFFGetStrileByteCountWithErr(tif, strile, NULL);
 8541|  1.22M|}
TIFFGetStrileByteCountWithErr:
 8546|  1.60M|{
 8547|  1.60M|    TIFFDirectory *td = &tif->tif_dir;
 8548|  1.60M|    return _TIFFGetStrileOffsetOrByteCountValue(
 8549|  1.60M|        tif, strile, &(td->td_stripbytecount_entry), &(td->td_stripbytecount_p),
 8550|  1.60M|        pbErr);
 8551|  1.60M|}
_TIFFFillStriles:
 8553|    663|int _TIFFFillStriles(TIFF *tif) { return _TIFFFillStrilesInternal(tif, 1); }
tif_dirread.c:TIFFReadDirEntryShort:
  486|  19.1k|{
  487|  19.1k|    enum TIFFReadDirEntryErr err;
  488|  19.1k|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (488:9): [True: 4.06k, False: 15.1k]
  ------------------
  489|  4.06k|        return (TIFFReadDirEntryErrCount);
  490|  15.1k|    switch (direntry->tdir_type)
  491|  15.1k|    {
  492|    774|        case TIFF_BYTE:
  ------------------
  |  Branch (492:9): [True: 774, False: 14.3k]
  ------------------
  493|    774|        {
  494|    774|            uint8_t m;
  495|    774|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
  496|    774|            *value = (uint16_t)m;
  497|    774|            return (TIFFReadDirEntryErrOk);
  498|      0|        }
  499|    497|        case TIFF_SBYTE:
  ------------------
  |  Branch (499:9): [True: 497, False: 14.6k]
  ------------------
  500|    497|        {
  501|    497|            int8_t m;
  502|    497|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  503|    497|            err = TIFFReadDirEntryCheckRangeShortSbyte(m);
  504|    497|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (504:17): [True: 19, False: 478]
  ------------------
  505|     19|                return (err);
  506|    478|            *value = (uint16_t)m;
  507|    478|            return (TIFFReadDirEntryErrOk);
  508|    497|        }
  509|  13.4k|        case TIFF_SHORT:
  ------------------
  |  Branch (509:9): [True: 13.4k, False: 1.63k]
  ------------------
  510|  13.4k|            TIFFReadDirEntryCheckedShort(tif, direntry, value);
  511|  13.4k|            return (TIFFReadDirEntryErrOk);
  512|     54|        case TIFF_SSHORT:
  ------------------
  |  Branch (512:9): [True: 54, False: 15.0k]
  ------------------
  513|     54|        {
  514|     54|            int16_t m;
  515|     54|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
  516|     54|            err = TIFFReadDirEntryCheckRangeShortSshort(m);
  517|     54|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (517:17): [True: 0, False: 54]
  ------------------
  518|      0|                return (err);
  519|     54|            *value = (uint16_t)m;
  520|     54|            return (TIFFReadDirEntryErrOk);
  521|     54|        }
  522|     78|        case TIFF_LONG:
  ------------------
  |  Branch (522:9): [True: 78, False: 15.0k]
  ------------------
  523|     78|        {
  524|     78|            uint32_t m;
  525|     78|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
  526|     78|            err = TIFFReadDirEntryCheckRangeShortLong(m);
  527|     78|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (527:17): [True: 2, False: 76]
  ------------------
  528|      2|                return (err);
  529|     76|            *value = (uint16_t)m;
  530|     76|            return (TIFFReadDirEntryErrOk);
  531|     78|        }
  532|      7|        case TIFF_SLONG:
  ------------------
  |  Branch (532:9): [True: 7, False: 15.1k]
  ------------------
  533|      7|        {
  534|      7|            int32_t m;
  535|      7|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
  536|      7|            err = TIFFReadDirEntryCheckRangeShortSlong(m);
  537|      7|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (537:17): [True: 0, False: 7]
  ------------------
  538|      0|                return (err);
  539|      7|            *value = (uint16_t)m;
  540|      7|            return (TIFFReadDirEntryErrOk);
  541|      7|        }
  542|     18|        case TIFF_LONG8:
  ------------------
  |  Branch (542:9): [True: 18, False: 15.0k]
  ------------------
  543|     18|        {
  544|     18|            uint64_t m;
  545|     18|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
  546|     18|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (546:17): [True: 5, False: 13]
  ------------------
  547|      5|                return (err);
  548|     13|            err = TIFFReadDirEntryCheckRangeShortLong8(m);
  549|     13|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (549:17): [True: 8, False: 5]
  ------------------
  550|      8|                return (err);
  551|      5|            *value = (uint16_t)m;
  552|      5|            return (TIFFReadDirEntryErrOk);
  553|     13|        }
  554|      1|        case TIFF_SLONG8:
  ------------------
  |  Branch (554:9): [True: 1, False: 15.1k]
  ------------------
  555|      1|        {
  556|      1|            int64_t m;
  557|      1|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  558|      1|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (558:17): [True: 1, False: 0]
  ------------------
  559|      1|                return (err);
  560|      0|            err = TIFFReadDirEntryCheckRangeShortSlong8(m);
  561|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (561:17): [True: 0, False: 0]
  ------------------
  562|      0|                return (err);
  563|      0|            *value = (uint16_t)m;
  564|      0|            return (TIFFReadDirEntryErrOk);
  565|      0|        }
  566|    203|        default:
  ------------------
  |  Branch (566:9): [True: 203, False: 14.9k]
  ------------------
  567|    203|            return (TIFFReadDirEntryErrType);
  568|  15.1k|    }
  569|  15.1k|} /*-- TIFFReadDirEntryShort() --*/
tif_dirread.c:TIFFReadDirEntryCheckedByte:
 3406|  3.89k|{
 3407|  3.89k|    (void)tif;
 3408|  3.89k|    *value = *(uint8_t *)(&direntry->tdir_offset);
 3409|  3.89k|}
tif_dirread.c:TIFFReadDirEntryCheckedSbyte:
 3413|    946|{
 3414|    946|    (void)tif;
 3415|    946|    *value = *(int8_t *)(&direntry->tdir_offset);
 3416|    946|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSbyte:
 3772|    938|{
 3773|    938|    if (value < 0)
  ------------------
  |  Branch (3773:9): [True: 20, False: 918]
  ------------------
 3774|     20|        return (TIFFReadDirEntryErrRange);
 3775|    918|    else
 3776|    918|        return (TIFFReadDirEntryErrOk);
 3777|    938|}
tif_dirread.c:TIFFReadDirEntryCheckedShort:
 3420|  27.4k|{
 3421|  27.4k|    *value = direntry->tdir_offset.toff_short;
 3422|       |    /* *value=*(uint16_t*)(&direntry->tdir_offset); */
 3423|  27.4k|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  27.4k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3423:9): [True: 1.30k, False: 26.1k]
  ------------------
 3424|  1.30k|        TIFFSwabShort(value);
 3425|  27.4k|}
tif_dirread.c:TIFFReadDirEntryCheckedSshort:
 3429|    287|{
 3430|    287|    *value = *(int16_t *)(&direntry->tdir_offset);
 3431|    287|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    287|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3431:9): [True: 11, False: 276]
  ------------------
 3432|     11|        TIFFSwabShort((uint16_t *)value);
 3433|    287|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSshort:
 3781|  1.85k|{
 3782|  1.85k|    if (value < 0)
  ------------------
  |  Branch (3782:9): [True: 9, False: 1.85k]
  ------------------
 3783|      9|        return (TIFFReadDirEntryErrRange);
 3784|  1.85k|    else
 3785|  1.85k|        return (TIFFReadDirEntryErrOk);
 3786|  1.85k|}
tif_dirread.c:TIFFReadDirEntryCheckedLong:
 3437|    713|{
 3438|    713|    *value = *(uint32_t *)(&direntry->tdir_offset);
 3439|    713|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    713|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3439:9): [True: 43, False: 670]
  ------------------
 3440|     43|        TIFFSwabLong(value);
 3441|    713|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortLong:
 3790|    486|{
 3791|    486|    if (value > 0xFFFF)
  ------------------
  |  Branch (3791:9): [True: 4, False: 482]
  ------------------
 3792|      4|        return (TIFFReadDirEntryErrRange);
 3793|    482|    else
 3794|    482|        return (TIFFReadDirEntryErrOk);
 3795|    486|}
tif_dirread.c:TIFFReadDirEntryCheckedSlong:
 3445|    148|{
 3446|    148|    *value = *(int32_t *)(&direntry->tdir_offset);
 3447|    148|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    148|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3447:9): [True: 17, False: 131]
  ------------------
 3448|     17|        TIFFSwabLong((uint32_t *)value);
 3449|    148|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSlong:
 3799|    304|{
 3800|    304|    if ((value < 0) || (value > 0xFFFF))
  ------------------
  |  Branch (3800:9): [True: 1, False: 303]
  |  Branch (3800:24): [True: 2, False: 301]
  ------------------
 3801|      3|        return (TIFFReadDirEntryErrRange);
 3802|    301|    else
 3803|    301|        return (TIFFReadDirEntryErrOk);
 3804|    304|}
tif_dirread.c:TIFFReadDirEntryCheckedLong8:
 3453|     34|{
 3454|     34|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|     34|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3454:9): [True: 27, False: 7]
  ------------------
 3455|     27|    {
 3456|     27|        enum TIFFReadDirEntryErr err;
 3457|     27|        uint32_t offset = direntry->tdir_offset.toff_long;
 3458|     27|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     27|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3458:13): [True: 3, False: 24]
  ------------------
 3459|      3|            TIFFSwabLong(&offset);
 3460|     27|        err = TIFFReadDirEntryData(tif, offset, 8, value);
 3461|     27|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3461:13): [True: 6, False: 21]
  ------------------
 3462|      6|            return (err);
 3463|     27|    }
 3464|      7|    else
 3465|      7|        *value = direntry->tdir_offset.toff_long8;
 3466|     28|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     28|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3466:9): [True: 3, False: 25]
  ------------------
 3467|      3|        TIFFSwabLong8(value);
 3468|     28|    return (TIFFReadDirEntryErrOk);
 3469|     34|}
tif_dirread.c:TIFFReadDirEntryData:
 3990|    835|{
 3991|    835|    assert(size > 0);
  ------------------
  |  Branch (3991:5): [True: 0, False: 835]
  |  Branch (3991:5): [True: 835, False: 0]
  ------------------
 3992|    835|    if (!isMapped(tif))
  ------------------
  |  |  279|    835|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|    835|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (3992:9): [True: 835, False: 0]
  ------------------
 3993|    835|    {
 3994|    835|        if (!SeekOK(tif, offset))
  ------------------
  |  |  303|    835|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (3994:13): [True: 100, False: 735]
  ------------------
 3995|    100|            return (TIFFReadDirEntryErrIo);
 3996|    735|        if (!ReadOK(tif, dest, size))
  ------------------
  |  |  300|    735|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|    735|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (3996:13): [True: 10, False: 725]
  ------------------
 3997|     10|            return (TIFFReadDirEntryErrIo);
 3998|    735|    }
 3999|      0|    else
 4000|      0|    {
 4001|      0|        size_t ma, mb;
 4002|      0|        ma = (size_t)offset;
 4003|      0|        if ((uint64_t)ma != offset || ma > (~(size_t)0) - (size_t)size)
  ------------------
  |  Branch (4003:13): [True: 0, False: 0]
  |  Branch (4003:39): [True: 0, False: 0]
  ------------------
 4004|      0|        {
 4005|      0|            return TIFFReadDirEntryErrIo;
 4006|      0|        }
 4007|      0|        mb = (uint64_t)ma + (uint64_t)size;
 4008|      0|        if (mb > (uint64_t)tif->tif_size)
  ------------------
  |  Branch (4008:13): [True: 0, False: 0]
  ------------------
 4009|      0|            return (TIFFReadDirEntryErrIo);
 4010|      0|        _TIFFmemcpy(dest, tif->tif_base + ma, size);
 4011|      0|    }
 4012|    725|    return (TIFFReadDirEntryErrOk);
 4013|    835|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortLong8:
 3808|    462|{
 3809|    462|    if (value > 0xFFFF)
  ------------------
  |  Branch (3809:9): [True: 12, False: 450]
  ------------------
 3810|     12|        return (TIFFReadDirEntryErrRange);
 3811|    450|    else
 3812|    450|        return (TIFFReadDirEntryErrOk);
 3813|    462|}
tif_dirread.c:TIFFReadDirEntryCheckedSlong8:
 3473|      7|{
 3474|      7|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|      7|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3474:9): [True: 7, False: 0]
  ------------------
 3475|      7|    {
 3476|      7|        enum TIFFReadDirEntryErr err;
 3477|      7|        uint32_t offset = direntry->tdir_offset.toff_long;
 3478|      7|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      7|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3478:13): [True: 0, False: 7]
  ------------------
 3479|      0|            TIFFSwabLong(&offset);
 3480|      7|        err = TIFFReadDirEntryData(tif, offset, 8, value);
 3481|      7|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3481:13): [True: 1, False: 6]
  ------------------
 3482|      1|            return (err);
 3483|      7|    }
 3484|      0|    else
 3485|      0|        *value = *(int64_t *)(&direntry->tdir_offset);
 3486|      6|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      6|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3486:9): [True: 0, False: 6]
  ------------------
 3487|      0|        TIFFSwabLong8((uint64_t *)value);
 3488|      6|    return (TIFFReadDirEntryErrOk);
 3489|      7|}
tif_dirread.c:TIFFReadDirEntryCheckRangeShortSlong8:
 3817|    320|{
 3818|    320|    if ((value < 0) || (value > 0xFFFF))
  ------------------
  |  Branch (3818:9): [True: 2, False: 318]
  |  Branch (3818:24): [True: 3, False: 315]
  ------------------
 3819|      5|        return (TIFFReadDirEntryErrRange);
 3820|    315|    else
 3821|    315|        return (TIFFReadDirEntryErrOk);
 3822|    320|}
tif_dirread.c:TIFFReadDirEntryPersampleShort:
 3348|  2.05k|{
 3349|  2.05k|    enum TIFFReadDirEntryErr err;
 3350|  2.05k|    uint16_t *m;
 3351|  2.05k|    uint16_t *na;
 3352|  2.05k|    uint16_t nb;
 3353|  2.05k|    if (direntry->tdir_count != (uint64_t)tif->tif_dir.td_samplesperpixel)
  ------------------
  |  Branch (3353:9): [True: 1.83k, False: 225]
  ------------------
 3354|  1.83k|    {
 3355|  1.83k|        const TIFFField *fip = TIFFFieldWithTag(tif, direntry->tdir_tag);
 3356|  1.83k|        if (direntry->tdir_count == 0)
  ------------------
  |  Branch (3356:13): [True: 0, False: 1.83k]
  ------------------
 3357|      0|        {
 3358|      0|            return TIFFReadDirEntryErrCount;
 3359|      0|        }
 3360|  1.83k|        else if (direntry->tdir_count <
  ------------------
  |  Branch (3360:18): [True: 2, False: 1.82k]
  ------------------
 3361|  1.83k|                 (uint64_t)tif->tif_dir.td_samplesperpixel)
 3362|      2|        {
 3363|      2|            TIFFWarningExtR(
 3364|      2|                tif, "TIFFReadDirEntryPersampleShort",
 3365|      2|                "Tag %s entry count is %" PRIu64
 3366|      2|                " , whereas it should be SamplesPerPixel=%d. Assuming that "
 3367|      2|                "missing entries are all at the value of the first one",
 3368|      2|                fip ? fip->field_name : "unknown tagname", direntry->tdir_count,
  ------------------
  |  Branch (3368:17): [True: 2, False: 0]
  ------------------
 3369|      2|                tif->tif_dir.td_samplesperpixel);
 3370|      2|        }
 3371|  1.82k|        else
 3372|  1.82k|        {
 3373|  1.82k|            TIFFWarningExtR(tif, "TIFFReadDirEntryPersampleShort",
 3374|  1.82k|                            "Tag %s entry count is %" PRIu64
 3375|  1.82k|                            " , whereas it should be SamplesPerPixel=%d. "
 3376|  1.82k|                            "Ignoring extra entries",
 3377|  1.82k|                            fip ? fip->field_name : "unknown tagname",
  ------------------
  |  Branch (3377:29): [True: 1.82k, False: 0]
  ------------------
 3378|  1.82k|                            direntry->tdir_count,
 3379|  1.82k|                            tif->tif_dir.td_samplesperpixel);
 3380|  1.82k|        }
 3381|  1.83k|    }
 3382|  2.05k|    err = TIFFReadDirEntryShortArray(tif, direntry, &m);
 3383|  2.05k|    if (err != TIFFReadDirEntryErrOk || m == NULL)
  ------------------
  |  Branch (3383:9): [True: 38, False: 2.01k]
  |  Branch (3383:41): [True: 0, False: 2.01k]
  ------------------
 3384|     38|        return (err);
 3385|  2.01k|    na = m;
 3386|  2.01k|    nb = tif->tif_dir.td_samplesperpixel;
 3387|  2.01k|    if (direntry->tdir_count < nb)
  ------------------
  |  Branch (3387:9): [True: 2, False: 2.01k]
  ------------------
 3388|      2|        nb = (uint16_t)direntry->tdir_count;
 3389|  2.01k|    *value = *na++;
 3390|  2.01k|    nb--;
 3391|  2.65k|    while (nb > 0)
  ------------------
  |  Branch (3391:12): [True: 638, False: 2.01k]
  ------------------
 3392|    638|    {
 3393|    638|        if (*na++ != *value)
  ------------------
  |  Branch (3393:13): [True: 0, False: 638]
  ------------------
 3394|      0|        {
 3395|      0|            err = TIFFReadDirEntryErrPsdif;
 3396|      0|            break;
 3397|      0|        }
 3398|    638|        nb--;
 3399|    638|    }
 3400|  2.01k|    _TIFFfreeExt(tif, m);
 3401|  2.01k|    return (err);
 3402|  2.05k|}
tif_dirread.c:TIFFReadDirEntryOutputErr:
 4018|  17.6k|{
 4019|  17.6k|    if (!recover)
  ------------------
  |  Branch (4019:9): [True: 210, False: 17.4k]
  ------------------
 4020|    210|    {
 4021|    210|        switch (err)
 4022|    210|        {
 4023|     12|            case TIFFReadDirEntryErrCount:
  ------------------
  |  Branch (4023:13): [True: 12, False: 198]
  ------------------
 4024|     12|                TIFFErrorExtR(tif, module, "Incorrect count for \"%s\"",
 4025|     12|                              tagname);
 4026|     12|                break;
 4027|     49|            case TIFFReadDirEntryErrType:
  ------------------
  |  Branch (4027:13): [True: 49, False: 161]
  ------------------
 4028|     49|                TIFFErrorExtR(tif, module, "Incompatible type for \"%s\"",
 4029|     49|                              tagname);
 4030|     49|                break;
 4031|    126|            case TIFFReadDirEntryErrIo:
  ------------------
  |  Branch (4031:13): [True: 126, False: 84]
  ------------------
 4032|    126|                TIFFErrorExtR(tif, module, "IO error during reading of \"%s\"",
 4033|    126|                              tagname);
 4034|    126|                break;
 4035|     23|            case TIFFReadDirEntryErrRange:
  ------------------
  |  Branch (4035:13): [True: 23, False: 187]
  ------------------
 4036|     23|                TIFFErrorExtR(tif, module, "Incorrect value for \"%s\"",
 4037|     23|                              tagname);
 4038|     23|                break;
 4039|      0|            case TIFFReadDirEntryErrPsdif:
  ------------------
  |  Branch (4039:13): [True: 0, False: 210]
  ------------------
 4040|      0|                TIFFErrorExtR(
 4041|      0|                    tif, module,
 4042|      0|                    "Cannot handle different values per sample for \"%s\"",
 4043|      0|                    tagname);
 4044|      0|                break;
 4045|      0|            case TIFFReadDirEntryErrSizesan:
  ------------------
  |  Branch (4045:13): [True: 0, False: 210]
  ------------------
 4046|      0|                TIFFErrorExtR(tif, module,
 4047|      0|                              "Sanity check on size of \"%s\" value failed",
 4048|      0|                              tagname);
 4049|      0|                break;
 4050|      0|            case TIFFReadDirEntryErrAlloc:
  ------------------
  |  Branch (4050:13): [True: 0, False: 210]
  ------------------
 4051|      0|                TIFFErrorExtR(tif, module, "Out of memory reading of \"%s\"",
 4052|      0|                              tagname);
 4053|      0|                break;
 4054|      0|            case TIFFReadDirEntryErrOk:
  ------------------
  |  Branch (4054:13): [True: 0, False: 210]
  ------------------
 4055|      0|            default:
  ------------------
  |  Branch (4055:13): [True: 0, False: 210]
  ------------------
 4056|      0|                assert(0); /* we should never get here */
  ------------------
  |  Branch (4056:17): [Folded, False: 0]
  |  Branch (4056:17): [Folded, False: 0]
  ------------------
 4057|      0|                break;
 4058|    210|        }
 4059|    210|    }
 4060|  17.4k|    else
 4061|  17.4k|    {
 4062|  17.4k|        switch (err)
 4063|  17.4k|        {
 4064|  5.60k|            case TIFFReadDirEntryErrCount:
  ------------------
  |  Branch (4064:13): [True: 5.60k, False: 11.8k]
  ------------------
 4065|  5.60k|                TIFFWarningExtR(tif, module,
 4066|  5.60k|                                "Incorrect count for \"%s\"; tag ignored",
 4067|  5.60k|                                tagname);
 4068|  5.60k|                break;
 4069|    927|            case TIFFReadDirEntryErrType:
  ------------------
  |  Branch (4069:13): [True: 927, False: 16.5k]
  ------------------
 4070|    927|                TIFFWarningExtR(tif, module,
 4071|    927|                                "Incompatible type for \"%s\"; tag ignored",
 4072|    927|                                tagname);
 4073|    927|                break;
 4074|  6.33k|            case TIFFReadDirEntryErrIo:
  ------------------
  |  Branch (4074:13): [True: 6.33k, False: 11.1k]
  ------------------
 4075|  6.33k|                TIFFWarningExtR(
 4076|  6.33k|                    tif, module,
 4077|  6.33k|                    "IO error during reading of \"%s\"; tag ignored", tagname);
 4078|  6.33k|                break;
 4079|    203|            case TIFFReadDirEntryErrRange:
  ------------------
  |  Branch (4079:13): [True: 203, False: 17.2k]
  ------------------
 4080|    203|                TIFFWarningExtR(tif, module,
 4081|    203|                                "Incorrect value for \"%s\"; tag ignored",
 4082|    203|                                tagname);
 4083|    203|                break;
 4084|      0|            case TIFFReadDirEntryErrPsdif:
  ------------------
  |  Branch (4084:13): [True: 0, False: 17.4k]
  ------------------
 4085|      0|                TIFFWarningExtR(tif, module,
 4086|      0|                                "Cannot handle different values per sample for "
 4087|      0|                                "\"%s\"; tag ignored",
 4088|      0|                                tagname);
 4089|      0|                break;
 4090|  3.01k|            case TIFFReadDirEntryErrSizesan:
  ------------------
  |  Branch (4090:13): [True: 3.01k, False: 14.4k]
  ------------------
 4091|  3.01k|                TIFFWarningExtR(
 4092|  3.01k|                    tif, module,
 4093|  3.01k|                    "Sanity check on size of \"%s\" value failed; tag ignored",
 4094|  3.01k|                    tagname);
 4095|  3.01k|                break;
 4096|  1.39k|            case TIFFReadDirEntryErrAlloc:
  ------------------
  |  Branch (4096:13): [True: 1.39k, False: 16.0k]
  ------------------
 4097|  1.39k|                TIFFWarningExtR(tif, module,
 4098|  1.39k|                                "Out of memory reading of \"%s\"; tag ignored",
 4099|  1.39k|                                tagname);
 4100|  1.39k|                break;
 4101|      0|            case TIFFReadDirEntryErrOk:
  ------------------
  |  Branch (4101:13): [True: 0, False: 17.4k]
  ------------------
 4102|      0|            default:
  ------------------
  |  Branch (4102:13): [True: 0, False: 17.4k]
  ------------------
 4103|      0|                assert(0); /* we should never get here */
  ------------------
  |  Branch (4103:17): [Folded, False: 0]
  |  Branch (4103:17): [Folded, False: 0]
  ------------------
 4104|      0|                break;
 4105|  17.4k|        }
 4106|  17.4k|    }
 4107|  17.6k|}
tif_dirread.c:EvaluateIFDdatasizeReading:
 4186|  31.6k|{
 4187|  31.6k|    const uint64_t data_width =
 4188|  31.6k|        (uint64_t)TIFFDataWidth((TIFFDataType)dp->tdir_type);
 4189|  31.6k|    if (data_width != 0 && dp->tdir_count > UINT64_MAX / data_width)
  ------------------
  |  Branch (4189:9): [True: 31.4k, False: 147]
  |  Branch (4189:28): [True: 0, False: 31.4k]
  ------------------
 4190|      0|    {
 4191|      0|        TIFFErrorExtR(tif, "EvaluateIFDdatasizeReading",
 4192|      0|                      "Too large IFD data size");
 4193|      0|        return false;
 4194|      0|    }
 4195|  31.6k|    const uint64_t datalength = dp->tdir_count * data_width;
 4196|  31.6k|    if (datalength > ((tif->tif_flags & TIFF_BIGTIFF) ? 0x8U : 0x4U))
  ------------------
  |  |  140|  31.6k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (4196:9): [True: 21.1k, False: 10.4k]
  |  Branch (4196:23): [True: 144, False: 31.4k]
  ------------------
 4197|  21.1k|    {
 4198|  21.1k|        if (tif->tif_dir.td_dirdatasize_read > UINT64_MAX - datalength)
  ------------------
  |  Branch (4198:13): [True: 69, False: 21.0k]
  ------------------
 4199|     69|        {
 4200|     69|            TIFFErrorExtR(tif, "EvaluateIFDdatasizeReading",
 4201|     69|                          "Too large IFD data size");
 4202|     69|            return false;
 4203|     69|        }
 4204|  21.0k|        tif->tif_dir.td_dirdatasize_read += datalength;
 4205|  21.0k|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  21.0k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (4205:13): [True: 21.0k, False: 49]
  ------------------
 4206|  21.0k|        {
 4207|       |            /* The offset of TIFFDirEntry are not swapped when read in. That has
 4208|       |             * to be done when used. */
 4209|  21.0k|            uint32_t offset = dp->tdir_offset.toff_long;
 4210|  21.0k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  21.0k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (4210:17): [True: 488, False: 20.5k]
  ------------------
 4211|    488|                TIFFSwabLong(&offset);
 4212|  21.0k|            tif->tif_dir
 4213|  21.0k|                .td_dirdatasize_offsets[tif->tif_dir.td_dirdatasize_Noffsets]
 4214|  21.0k|                .offset = (uint64_t)offset;
 4215|  21.0k|        }
 4216|     49|        else
 4217|     49|        {
 4218|     49|            tif->tif_dir
 4219|     49|                .td_dirdatasize_offsets[tif->tif_dir.td_dirdatasize_Noffsets]
 4220|     49|                .offset = dp->tdir_offset.toff_long8;
 4221|     49|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     49|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (4221:17): [True: 1, False: 48]
  ------------------
 4222|      1|                TIFFSwabLong8(
 4223|      1|                    &tif->tif_dir
 4224|      1|                         .td_dirdatasize_offsets[tif->tif_dir
 4225|      1|                                                     .td_dirdatasize_Noffsets]
 4226|      1|                         .offset);
 4227|     49|        }
 4228|  21.0k|        tif->tif_dir
 4229|  21.0k|            .td_dirdatasize_offsets[tif->tif_dir.td_dirdatasize_Noffsets]
 4230|  21.0k|            .length = datalength;
 4231|  21.0k|        tif->tif_dir.td_dirdatasize_Noffsets++;
 4232|  21.0k|    }
 4233|  31.5k|    return true;
 4234|  31.6k|}
tif_dirread.c:TIFFReadDirEntryDoubleArray:
 3046|  2.94k|{
 3047|  2.94k|    enum TIFFReadDirEntryErr err;
 3048|  2.94k|    uint32_t count;
 3049|  2.94k|    void *origdata;
 3050|  2.94k|    double *data;
 3051|  2.94k|    switch (direntry->tdir_type)
 3052|  2.94k|    {
 3053|      4|        case TIFF_BYTE:
  ------------------
  |  Branch (3053:9): [True: 4, False: 2.94k]
  ------------------
 3054|      5|        case TIFF_SBYTE:
  ------------------
  |  Branch (3054:9): [True: 1, False: 2.94k]
  ------------------
 3055|    147|        case TIFF_SHORT:
  ------------------
  |  Branch (3055:9): [True: 142, False: 2.80k]
  ------------------
 3056|    150|        case TIFF_SSHORT:
  ------------------
  |  Branch (3056:9): [True: 3, False: 2.94k]
  ------------------
 3057|    154|        case TIFF_LONG:
  ------------------
  |  Branch (3057:9): [True: 4, False: 2.94k]
  ------------------
 3058|    157|        case TIFF_SLONG:
  ------------------
  |  Branch (3058:9): [True: 3, False: 2.94k]
  ------------------
 3059|    161|        case TIFF_LONG8:
  ------------------
  |  Branch (3059:9): [True: 4, False: 2.94k]
  ------------------
 3060|    165|        case TIFF_SLONG8:
  ------------------
  |  Branch (3060:9): [True: 4, False: 2.94k]
  ------------------
 3061|    176|        case TIFF_RATIONAL:
  ------------------
  |  Branch (3061:9): [True: 11, False: 2.93k]
  ------------------
 3062|    206|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (3062:9): [True: 30, False: 2.91k]
  ------------------
 3063|    209|        case TIFF_FLOAT:
  ------------------
  |  Branch (3063:9): [True: 3, False: 2.94k]
  ------------------
 3064|  2.94k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (3064:9): [True: 2.73k, False: 209]
  ------------------
 3065|  2.94k|            break;
 3066|      0|        default:
  ------------------
  |  Branch (3066:9): [True: 0, False: 2.94k]
  ------------------
 3067|      0|            return (TIFFReadDirEntryErrType);
 3068|  2.94k|    }
 3069|  2.94k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 8, &origdata);
 3070|  2.94k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (3070:9): [True: 405, False: 2.54k]
  |  Branch (3070:43): [True: 133, False: 2.41k]
  ------------------
 3071|    538|    {
 3072|    538|        *value = 0;
 3073|    538|        return (err);
 3074|    538|    }
 3075|  2.41k|    switch (direntry->tdir_type)
 3076|  2.41k|    {
 3077|  2.20k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (3077:9): [True: 2.20k, False: 208]
  ------------------
 3078|  2.20k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  2.20k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3078:17): [True: 206, False: 1.99k]
  ------------------
 3079|    206|                TIFFSwabArrayOfLong8((uint64_t *)origdata, count);
 3080|  2.20k|            TIFFCvtIEEEDoubleToNative(tif, count, (double *)origdata);
 3081|  2.20k|            *value = (double *)origdata;
 3082|  2.20k|            return (TIFFReadDirEntryErrOk);
 3083|    208|        default:
  ------------------
  |  Branch (3083:9): [True: 208, False: 2.20k]
  ------------------
 3084|    208|            break;
 3085|  2.41k|    }
 3086|    208|    data = (double *)_TIFFmallocExt(tif,
 3087|    208|                                    (tmsize_t)((size_t)count * sizeof(double)));
 3088|    208|    if (data == 0)
  ------------------
  |  Branch (3088:9): [True: 0, False: 208]
  ------------------
 3089|      0|    {
 3090|      0|        _TIFFfreeExt(tif, origdata);
 3091|      0|        return (TIFFReadDirEntryErrAlloc);
 3092|      0|    }
 3093|    208|    switch (direntry->tdir_type)
 3094|    208|    {
 3095|      4|        case TIFF_BYTE:
  ------------------
  |  Branch (3095:9): [True: 4, False: 204]
  ------------------
 3096|      4|        {
 3097|      4|            uint8_t *ma;
 3098|      4|            double *mb;
 3099|      4|            uint32_t n;
 3100|      4|            ma = (uint8_t *)origdata;
 3101|      4|            mb = data;
 3102|     19|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3102:25): [True: 15, False: 4]
  ------------------
 3103|     15|                *mb++ = (double)(*ma++);
 3104|      4|        }
 3105|      4|        break;
 3106|      1|        case TIFF_SBYTE:
  ------------------
  |  Branch (3106:9): [True: 1, False: 207]
  ------------------
 3107|      1|        {
 3108|      1|            int8_t *ma;
 3109|      1|            double *mb;
 3110|      1|            uint32_t n;
 3111|      1|            ma = (int8_t *)origdata;
 3112|      1|            mb = data;
 3113|     13|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3113:25): [True: 12, False: 1]
  ------------------
 3114|     12|                *mb++ = (double)(*ma++);
 3115|      1|        }
 3116|      1|        break;
 3117|    142|        case TIFF_SHORT:
  ------------------
  |  Branch (3117:9): [True: 142, False: 66]
  ------------------
 3118|    142|        {
 3119|    142|            uint16_t *ma;
 3120|    142|            double *mb;
 3121|    142|            uint32_t n;
 3122|    142|            ma = (uint16_t *)origdata;
 3123|    142|            mb = data;
 3124|  1.11k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3124:25): [True: 971, False: 142]
  ------------------
 3125|    971|            {
 3126|    971|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    971|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3126:21): [True: 224, False: 747]
  ------------------
 3127|    224|                    TIFFSwabShort(ma);
 3128|    971|                *mb++ = (double)(*ma++);
 3129|    971|            }
 3130|    142|        }
 3131|    142|        break;
 3132|      3|        case TIFF_SSHORT:
  ------------------
  |  Branch (3132:9): [True: 3, False: 205]
  ------------------
 3133|      3|        {
 3134|      3|            int16_t *ma;
 3135|      3|            double *mb;
 3136|      3|            uint32_t n;
 3137|      3|            ma = (int16_t *)origdata;
 3138|      3|            mb = data;
 3139|    491|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3139:25): [True: 488, False: 3]
  ------------------
 3140|    488|            {
 3141|    488|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    488|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3141:21): [True: 224, False: 264]
  ------------------
 3142|    224|                    TIFFSwabShort((uint16_t *)ma);
 3143|    488|                *mb++ = (double)(*ma++);
 3144|    488|            }
 3145|      3|        }
 3146|      3|        break;
 3147|      4|        case TIFF_LONG:
  ------------------
  |  Branch (3147:9): [True: 4, False: 204]
  ------------------
 3148|      4|        {
 3149|      4|            uint32_t *ma;
 3150|      4|            double *mb;
 3151|      4|            uint32_t n;
 3152|      4|            ma = (uint32_t *)origdata;
 3153|      4|            mb = data;
 3154|    556|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3154:25): [True: 552, False: 4]
  ------------------
 3155|    552|            {
 3156|    552|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    552|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3156:21): [True: 224, False: 328]
  ------------------
 3157|    224|                    TIFFSwabLong(ma);
 3158|    552|                *mb++ = (double)(*ma++);
 3159|    552|            }
 3160|      4|        }
 3161|      4|        break;
 3162|      3|        case TIFF_SLONG:
  ------------------
  |  Branch (3162:9): [True: 3, False: 205]
  ------------------
 3163|      3|        {
 3164|      3|            int32_t *ma;
 3165|      3|            double *mb;
 3166|      3|            uint32_t n;
 3167|      3|            ma = (int32_t *)origdata;
 3168|      3|            mb = data;
 3169|    491|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3169:25): [True: 488, False: 3]
  ------------------
 3170|    488|            {
 3171|    488|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    488|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3171:21): [True: 224, False: 264]
  ------------------
 3172|    224|                    TIFFSwabLong((uint32_t *)ma);
 3173|    488|                *mb++ = (double)(*ma++);
 3174|    488|            }
 3175|      3|        }
 3176|      3|        break;
 3177|      4|        case TIFF_LONG8:
  ------------------
  |  Branch (3177:9): [True: 4, False: 204]
  ------------------
 3178|      4|        {
 3179|      4|            uint64_t *ma;
 3180|      4|            double *mb;
 3181|      4|            uint32_t n;
 3182|      4|            ma = (uint64_t *)origdata;
 3183|      4|            mb = data;
 3184|    556|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3184:25): [True: 552, False: 4]
  ------------------
 3185|    552|            {
 3186|    552|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    552|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3186:21): [True: 224, False: 328]
  ------------------
 3187|    224|                    TIFFSwabLong8(ma);
 3188|    552|                *mb++ = (double)(*ma++);
 3189|    552|            }
 3190|      4|        }
 3191|      4|        break;
 3192|      4|        case TIFF_SLONG8:
  ------------------
  |  Branch (3192:9): [True: 4, False: 204]
  ------------------
 3193|      4|        {
 3194|      4|            int64_t *ma;
 3195|      4|            double *mb;
 3196|      4|            uint32_t n;
 3197|      4|            ma = (int64_t *)origdata;
 3198|      4|            mb = data;
 3199|    556|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3199:25): [True: 552, False: 4]
  ------------------
 3200|    552|            {
 3201|    552|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    552|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3201:21): [True: 224, False: 328]
  ------------------
 3202|    224|                    TIFFSwabLong8((uint64_t *)ma);
 3203|    552|                *mb++ = (double)(*ma++);
 3204|    552|            }
 3205|      4|        }
 3206|      4|        break;
 3207|     10|        case TIFF_RATIONAL:
  ------------------
  |  Branch (3207:9): [True: 10, False: 198]
  ------------------
 3208|     10|        {
 3209|     10|            uint32_t *ma;
 3210|     10|            uint32_t maa;
 3211|     10|            uint32_t mab;
 3212|     10|            double *mb;
 3213|     10|            uint32_t n;
 3214|     10|            ma = (uint32_t *)origdata;
 3215|     10|            mb = data;
 3216|    917|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3216:25): [True: 907, False: 10]
  ------------------
 3217|    907|            {
 3218|    907|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    907|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3218:21): [True: 448, False: 459]
  ------------------
 3219|    448|                    TIFFSwabLong(ma);
 3220|    907|                maa = *ma++;
 3221|    907|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    907|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3221:21): [True: 448, False: 459]
  ------------------
 3222|    448|                    TIFFSwabLong(ma);
 3223|    907|                mab = *ma++;
 3224|    907|                if (mab == 0)
  ------------------
  |  Branch (3224:21): [True: 252, False: 655]
  ------------------
 3225|    252|                    *mb++ = 0.0;
 3226|    655|                else
 3227|    655|                    *mb++ = (double)maa / (double)mab;
 3228|    907|            }
 3229|     10|        }
 3230|     10|        break;
 3231|     30|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (3231:9): [True: 30, False: 178]
  ------------------
 3232|     30|        {
 3233|     30|            uint32_t *ma;
 3234|     30|            int32_t maa;
 3235|     30|            uint32_t mab;
 3236|     30|            double *mb;
 3237|     30|            uint32_t n;
 3238|     30|            ma = (uint32_t *)origdata;
 3239|     30|            mb = data;
 3240|    938|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3240:25): [True: 908, False: 30]
  ------------------
 3241|    908|            {
 3242|    908|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    908|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3242:21): [True: 448, False: 460]
  ------------------
 3243|    448|                    TIFFSwabLong(ma);
 3244|    908|                maa = *(int32_t *)ma;
 3245|    908|                ma++;
 3246|    908|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    908|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3246:21): [True: 448, False: 460]
  ------------------
 3247|    448|                    TIFFSwabLong(ma);
 3248|    908|                mab = *ma++;
 3249|    908|                if (mab == 0)
  ------------------
  |  Branch (3249:21): [True: 433, False: 475]
  ------------------
 3250|    433|                    *mb++ = 0.0;
 3251|    475|                else
 3252|    475|                    *mb++ = (double)maa / (double)mab;
 3253|    908|            }
 3254|     30|        }
 3255|     30|        break;
 3256|      3|        case TIFF_FLOAT:
  ------------------
  |  Branch (3256:9): [True: 3, False: 205]
  ------------------
 3257|      3|        {
 3258|      3|            float *ma;
 3259|      3|            double *mb;
 3260|      3|            uint32_t n;
 3261|      3|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      3|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3261:17): [True: 0, False: 3]
  ------------------
 3262|      0|                TIFFSwabArrayOfLong((uint32_t *)origdata, count);
 3263|      3|            TIFFCvtIEEEFloatToNative(tif, count, (float *)origdata);
 3264|      3|            ma = (float *)origdata;
 3265|      3|            mb = data;
 3266|    331|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3266:25): [True: 328, False: 3]
  ------------------
 3267|    328|                *mb++ = (double)(*ma++);
 3268|      3|        }
 3269|      3|        break;
 3270|      0|        default:
  ------------------
  |  Branch (3270:9): [True: 0, False: 208]
  ------------------
 3271|      0|            break;
 3272|    208|    }
 3273|    208|    _TIFFfreeExt(tif, origdata);
 3274|    208|    *value = data;
 3275|    208|    return (TIFFReadDirEntryErrOk);
 3276|    208|}
tif_dirread.c:TIFFReadDirEntryArray:
 1390|  26.8k|{
 1391|  26.8k|    return TIFFReadDirEntryArrayWithLimit(tif, direntry, count, desttypesize,
 1392|  26.8k|                                          value, ~((uint64_t)0));
 1393|  26.8k|}
tif_dirread.c:TIFFReadDirEntryArrayWithLimit:
 1263|  39.8k|{
 1264|  39.8k|    int typesize;
 1265|  39.8k|    uint32_t datasize;
 1266|  39.8k|    void *data;
 1267|  39.8k|    uint64_t target_count64;
 1268|  39.8k|    int original_datasize_clamped;
 1269|  39.8k|    typesize = TIFFDataWidth((TIFFDataType)direntry->tdir_type);
 1270|       |
 1271|  39.8k|    target_count64 =
 1272|  39.8k|        (direntry->tdir_count > maxcount) ? maxcount : direntry->tdir_count;
  ------------------
  |  Branch (1272:9): [True: 7.71k, False: 32.1k]
  ------------------
 1273|       |
 1274|  39.8k|    if ((target_count64 == 0) || (typesize == 0))
  ------------------
  |  Branch (1274:9): [True: 2.08k, False: 37.8k]
  |  Branch (1274:34): [True: 0, False: 37.8k]
  ------------------
 1275|  2.08k|    {
 1276|  2.08k|        *value = 0;
 1277|  2.08k|        return (TIFFReadDirEntryErrOk);
 1278|  2.08k|    }
 1279|  37.8k|    (void)desttypesize;
 1280|       |
 1281|       |    /* We just want to know if the original tag size is more than 4 bytes
 1282|       |     * (classic TIFF) or 8 bytes (BigTIFF)
 1283|       |     */
 1284|  37.8k|    original_datasize_clamped =
 1285|  37.8k|        ((direntry->tdir_count > 10) ? 10 : (int)direntry->tdir_count) *
  ------------------
  |  Branch (1285:10): [True: 22.2k, False: 15.5k]
  ------------------
 1286|  37.8k|        typesize;
 1287|       |
 1288|       |    /*
 1289|       |     * As a sanity check, make sure we have no more than a 2GB tag array
 1290|       |     * in either the current data type or the dest data type.  This also
 1291|       |     * avoids problems with overflow of tmsize_t on 32bit systems.
 1292|       |     */
 1293|  37.8k|    if ((uint64_t)(MAX_SIZE_TAG_DATA / (unsigned int)typesize) < target_count64)
  ------------------
  |  | 1257|  37.8k|#define MAX_SIZE_TAG_DATA 2147483647U
  ------------------
  |  Branch (1293:9): [True: 2.98k, False: 34.8k]
  ------------------
 1294|  2.98k|        return (TIFFReadDirEntryErrSizesan);
 1295|  34.8k|    if ((uint64_t)(MAX_SIZE_TAG_DATA / desttypesize) < target_count64)
  ------------------
  |  | 1257|  34.8k|#define MAX_SIZE_TAG_DATA 2147483647U
  ------------------
  |  Branch (1295:9): [True: 26, False: 34.8k]
  ------------------
 1296|     26|        return (TIFFReadDirEntryErrSizesan);
 1297|       |
 1298|  34.8k|    *count = (uint32_t)target_count64;
 1299|  34.8k|    datasize = (uint32_t)(*count) * (unsigned int)typesize;
 1300|  34.8k|    assert((tmsize_t)datasize > 0);
  ------------------
  |  Branch (1300:5): [True: 0, False: 34.8k]
  |  Branch (1300:5): [True: 34.8k, False: 0]
  ------------------
 1301|       |
 1302|  34.8k|    if (datasize > 100 * 1024 * 1024)
  ------------------
  |  Branch (1302:9): [True: 1.39k, False: 33.4k]
  ------------------
 1303|  1.39k|    {
 1304|       |        /* Before allocating a huge amount of memory for corrupted files, check
 1305|       |         * if size of requested memory is not greater than file size.
 1306|       |         */
 1307|  1.39k|        const uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|  1.39k|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 1308|  1.39k|        if (datasize > filesize)
  ------------------
  |  Branch (1308:13): [True: 1.39k, False: 0]
  ------------------
 1309|  1.39k|        {
 1310|  1.39k|            TIFFWarningExtR(tif, "ReadDirEntryArray",
 1311|  1.39k|                            "Requested memory size for tag %d (0x%x) %" PRIu32
 1312|  1.39k|                            " is greater than filesize %" PRIu64
 1313|  1.39k|                            ". Memory not allocated, tag not read",
 1314|  1.39k|                            direntry->tdir_tag, direntry->tdir_tag, datasize,
 1315|  1.39k|                            filesize);
 1316|  1.39k|            return (TIFFReadDirEntryErrAlloc);
 1317|  1.39k|        }
 1318|  1.39k|    }
 1319|       |
 1320|  33.4k|    if (isMapped(tif) && datasize > (uint64_t)tif->tif_size)
  ------------------
  |  |  279|  66.8k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  33.4k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 33.4k]
  |  |  ------------------
  ------------------
  |  Branch (1320:26): [True: 0, False: 0]
  ------------------
 1321|      0|        return TIFFReadDirEntryErrIo;
 1322|       |
 1323|  33.4k|    if (!isMapped(tif) && (((tif->tif_flags & TIFF_BIGTIFF) && datasize > 8) ||
  ------------------
  |  |  279|  66.8k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  33.4k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
                  if (!isMapped(tif) && (((tif->tif_flags & TIFF_BIGTIFF) && datasize > 8) ||
  ------------------
  |  |  140|  33.4k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1323:9): [True: 33.4k, False: 0]
  |  Branch (1323:29): [True: 165, False: 33.2k]
  |  Branch (1323:64): [True: 92, False: 73]
  ------------------
 1324|  33.3k|                           (!(tif->tif_flags & TIFF_BIGTIFF) && datasize > 4)))
  ------------------
  |  |  140|  33.3k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1324:29): [True: 33.2k, False: 73]
  |  Branch (1324:65): [True: 23.6k, False: 9.55k]
  ------------------
 1325|  23.7k|    {
 1326|  23.7k|        data = NULL;
 1327|  23.7k|    }
 1328|  9.62k|    else
 1329|  9.62k|    {
 1330|  9.62k|        data = _TIFFCheckMalloc(tif, *count, typesize, "ReadDirEntryArray");
 1331|  9.62k|        if (data == 0)
  ------------------
  |  Branch (1331:13): [True: 0, False: 9.62k]
  ------------------
 1332|      0|            return (TIFFReadDirEntryErrAlloc);
 1333|  9.62k|    }
 1334|  33.4k|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  33.4k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (1334:9): [True: 33.2k, False: 165]
  ------------------
 1335|  33.2k|    {
 1336|       |        /* Only the condition on original_datasize_clamped. The second
 1337|       |         * one is implied, but Coverity Scan cannot see it. */
 1338|  33.2k|        if (original_datasize_clamped <= 4 && datasize <= 4)
  ------------------
  |  Branch (1338:13): [True: 7.00k, False: 26.2k]
  |  Branch (1338:47): [True: 7.00k, False: 0]
  ------------------
 1339|  7.00k|            _TIFFmemcpy(data, &direntry->tdir_offset, datasize);
 1340|  26.2k|        else
 1341|  26.2k|        {
 1342|  26.2k|            enum TIFFReadDirEntryErr err;
 1343|  26.2k|            uint32_t offset = direntry->tdir_offset.toff_long;
 1344|  26.2k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  26.2k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1344:17): [True: 591, False: 25.6k]
  ------------------
 1345|    591|                TIFFSwabLong(&offset);
 1346|  26.2k|            if (isMapped(tif))
  ------------------
  |  |  279|  26.2k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  26.2k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 26.2k]
  |  |  ------------------
  ------------------
 1347|      0|                err = TIFFReadDirEntryData(tif, (uint64_t)offset,
 1348|      0|                                           (tmsize_t)datasize, data);
 1349|  26.2k|            else
 1350|  26.2k|                err = TIFFReadDirEntryDataAndRealloc(tif, (uint64_t)offset,
 1351|  26.2k|                                                     (tmsize_t)datasize, &data);
 1352|  26.2k|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1352:17): [True: 6.31k, False: 19.9k]
  ------------------
 1353|  6.31k|            {
 1354|  6.31k|                _TIFFfreeExt(tif, data);
 1355|  6.31k|                return (err);
 1356|  6.31k|            }
 1357|  26.2k|        }
 1358|  33.2k|    }
 1359|    165|    else
 1360|    165|    {
 1361|       |        /* See above comment for the Classic TIFF case */
 1362|    165|        if (original_datasize_clamped <= 8 && datasize <= 8)
  ------------------
  |  Branch (1362:13): [True: 30, False: 135]
  |  Branch (1362:47): [True: 30, False: 0]
  ------------------
 1363|     30|            _TIFFmemcpy(data, &direntry->tdir_offset, datasize);
 1364|    135|        else
 1365|    135|        {
 1366|    135|            enum TIFFReadDirEntryErr err;
 1367|    135|            uint64_t offset = direntry->tdir_offset.toff_long8;
 1368|    135|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    135|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1368:17): [True: 2, False: 133]
  ------------------
 1369|      2|                TIFFSwabLong8(&offset);
 1370|    135|            if (isMapped(tif))
  ------------------
  |  |  279|    135|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|    135|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 135]
  |  |  ------------------
  ------------------
 1371|      0|                err = TIFFReadDirEntryData(tif, (uint64_t)offset,
 1372|      0|                                           (tmsize_t)datasize, data);
 1373|    135|            else
 1374|    135|                err = TIFFReadDirEntryDataAndRealloc(tif, (uint64_t)offset,
 1375|    135|                                                     (tmsize_t)datasize, &data);
 1376|    135|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1376:17): [True: 44, False: 91]
  ------------------
 1377|     44|            {
 1378|     44|                _TIFFfreeExt(tif, data);
 1379|     44|                return (err);
 1380|     44|            }
 1381|    135|        }
 1382|    165|    }
 1383|  27.0k|    *value = data;
 1384|  27.0k|    return (TIFFReadDirEntryErrOk);
 1385|  33.4k|}
tif_dirread.c:TIFFReadDirEntryDataAndRealloc:
 1199|  26.3k|{
 1200|  26.3k|#if SIZEOF_SIZE_T == 8
 1201|  26.3k|    tmsize_t threshold = INITIAL_THRESHOLD;
  ------------------
  |  | 1189|  26.3k|#define INITIAL_THRESHOLD (1024 * 1024)
  ------------------
 1202|  26.3k|#endif
 1203|  26.3k|    tmsize_t already_read = 0;
 1204|       |
 1205|  26.3k|    assert(!isMapped(tif));
  ------------------
  |  Branch (1205:5): [True: 0, False: 26.3k]
  |  Branch (1205:5): [True: 26.3k, False: 0]
  ------------------
 1206|       |
 1207|  26.3k|    if (!SeekOK(tif, offset))
  ------------------
  |  |  303|  26.3k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (1207:9): [True: 6.27k, False: 20.1k]
  ------------------
 1208|  6.27k|        return (TIFFReadDirEntryErrIo);
 1209|       |
 1210|       |    /* On 64 bit processes, read first a maximum of 1 MB, then 10 MB, etc */
 1211|       |    /* so as to avoid allocating too much memory in case the file is too */
 1212|       |    /* short. We could ask for the file size, but this might be */
 1213|       |    /* expensive with some I/O layers (think of reading a gzipped file) */
 1214|       |    /* Restrict to 64 bit processes, so as to avoid reallocs() */
 1215|       |    /* on 32 bit processes where virtual memory is scarce.  */
 1216|  40.1k|    while (already_read < size)
  ------------------
  |  Branch (1216:12): [True: 20.1k, False: 20.0k]
  ------------------
 1217|  20.1k|    {
 1218|  20.1k|        void *new_dest;
 1219|  20.1k|        tmsize_t bytes_read;
 1220|  20.1k|        tmsize_t to_read = size - already_read;
 1221|  20.1k|#if SIZEOF_SIZE_T == 8
 1222|  20.1k|        if (to_read >= threshold && threshold < MAX_THRESHOLD)
  ------------------
  |  | 1192|     22|    (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  | 1190|     22|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  | 1190|     22|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  | 1190|     22|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  | 1193|     22|     INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  | 1189|     22|#define INITIAL_THRESHOLD (1024 * 1024)
  |  |  ------------------
  ------------------
  |  Branch (1222:13): [True: 22, False: 20.0k]
  |  Branch (1222:37): [True: 22, False: 0]
  ------------------
 1223|     22|        {
 1224|     22|            to_read = threshold;
 1225|     22|            threshold *= THRESHOLD_MULTIPLIER;
  ------------------
  |  | 1190|     22|#define THRESHOLD_MULTIPLIER 10
  ------------------
 1226|     22|        }
 1227|  20.1k|#endif
 1228|       |
 1229|  20.1k|        new_dest =
 1230|  20.1k|            (uint8_t *)_TIFFreallocExt(tif, *pdest, already_read + to_read);
 1231|  20.1k|        if (new_dest == NULL)
  ------------------
  |  Branch (1231:13): [True: 0, False: 20.1k]
  ------------------
 1232|      0|        {
 1233|      0|            TIFFErrorExtR(tif, tif->tif_name,
 1234|      0|                          "Failed to allocate memory for %s "
 1235|      0|                          "(%" TIFF_SSIZE_FORMAT
 1236|      0|                          " elements of %" TIFF_SSIZE_FORMAT " bytes each)",
 1237|      0|                          "TIFFReadDirEntryArray", (tmsize_t)1,
 1238|      0|                          already_read + to_read);
 1239|      0|            return TIFFReadDirEntryErrAlloc;
 1240|      0|        }
 1241|  20.1k|        *pdest = new_dest;
 1242|       |
 1243|  20.1k|        bytes_read = TIFFReadFile(tif, (char *)*pdest + already_read, to_read);
  ------------------
  |  |  283|  20.1k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 1244|  20.1k|        if (bytes_read < 0)
  ------------------
  |  Branch (1244:13): [True: 0, False: 20.1k]
  ------------------
 1245|      0|            return TIFFReadDirEntryErrIo;
 1246|  20.1k|        already_read += bytes_read;
 1247|  20.1k|        if (bytes_read != to_read)
  ------------------
  |  Branch (1247:13): [True: 77, False: 20.0k]
  ------------------
 1248|     77|        {
 1249|     77|            return TIFFReadDirEntryErrIo;
 1250|     77|        }
 1251|  20.1k|    }
 1252|  20.0k|    return TIFFReadDirEntryErrOk;
 1253|  20.1k|}
tif_dirread.c:TIFFReadDirEntryShortArray:
 1767|  7.47k|{
 1768|  7.47k|    enum TIFFReadDirEntryErr err;
 1769|  7.47k|    uint32_t count;
 1770|  7.47k|    void *origdata;
 1771|  7.47k|    uint16_t *data;
 1772|  7.47k|    switch (direntry->tdir_type)
 1773|  7.47k|    {
 1774|    400|        case TIFF_BYTE:
  ------------------
  |  Branch (1774:9): [True: 400, False: 7.07k]
  ------------------
 1775|    432|        case TIFF_SBYTE:
  ------------------
  |  Branch (1775:9): [True: 32, False: 7.44k]
  ------------------
 1776|  6.65k|        case TIFF_SHORT:
  ------------------
  |  Branch (1776:9): [True: 6.22k, False: 1.24k]
  ------------------
 1777|  7.38k|        case TIFF_SSHORT:
  ------------------
  |  Branch (1777:9): [True: 726, False: 6.75k]
  ------------------
 1778|  7.39k|        case TIFF_LONG:
  ------------------
  |  Branch (1778:9): [True: 12, False: 7.46k]
  ------------------
 1779|  7.40k|        case TIFF_SLONG:
  ------------------
  |  Branch (1779:9): [True: 4, False: 7.47k]
  ------------------
 1780|  7.40k|        case TIFF_LONG8:
  ------------------
  |  Branch (1780:9): [True: 4, False: 7.47k]
  ------------------
 1781|  7.41k|        case TIFF_SLONG8:
  ------------------
  |  Branch (1781:9): [True: 6, False: 7.47k]
  ------------------
 1782|  7.41k|            break;
 1783|     65|        default:
  ------------------
  |  Branch (1783:9): [True: 65, False: 7.41k]
  ------------------
 1784|     65|            return (TIFFReadDirEntryErrType);
 1785|  7.47k|    }
 1786|  7.41k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 2, &origdata);
 1787|  7.41k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1787:9): [True: 1.70k, False: 5.70k]
  |  Branch (1787:43): [True: 68, False: 5.64k]
  ------------------
 1788|  1.77k|    {
 1789|  1.77k|        *value = 0;
 1790|  1.77k|        return (err);
 1791|  1.77k|    }
 1792|  5.64k|    switch (direntry->tdir_type)
 1793|  5.64k|    {
 1794|  4.45k|        case TIFF_SHORT:
  ------------------
  |  Branch (1794:9): [True: 4.45k, False: 1.18k]
  ------------------
 1795|  4.45k|            *value = (uint16_t *)origdata;
 1796|  4.45k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  4.45k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1796:17): [True: 324, False: 4.13k]
  ------------------
 1797|    324|                TIFFSwabArrayOfShort(*value, count);
 1798|  4.45k|            return (TIFFReadDirEntryErrOk);
 1799|    725|        case TIFF_SSHORT:
  ------------------
  |  Branch (1799:9): [True: 725, False: 4.91k]
  ------------------
 1800|    725|        {
 1801|    725|            int16_t *m;
 1802|    725|            uint32_t n;
 1803|    725|            m = (int16_t *)origdata;
 1804|  2.52k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1804:25): [True: 1.80k, False: 716]
  ------------------
 1805|  1.80k|            {
 1806|  1.80k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  1.80k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1806:21): [True: 344, False: 1.46k]
  ------------------
 1807|    344|                    TIFFSwabShort((uint16_t *)m);
 1808|  1.80k|                err = TIFFReadDirEntryCheckRangeShortSshort(*m);
 1809|  1.80k|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1809:21): [True: 9, False: 1.79k]
  ------------------
 1810|      9|                {
 1811|      9|                    _TIFFfreeExt(tif, origdata);
 1812|      9|                    return (err);
 1813|      9|                }
 1814|  1.79k|                m++;
 1815|  1.79k|            }
 1816|    716|            *value = (uint16_t *)origdata;
 1817|    716|            return (TIFFReadDirEntryErrOk);
 1818|    725|        }
 1819|    456|        default:
  ------------------
  |  Branch (1819:9): [True: 456, False: 5.18k]
  ------------------
 1820|    456|            break;
 1821|  5.64k|    }
 1822|    456|    data = (uint16_t *)_TIFFCheckMalloc(tif, count, sizeof(uint16_t),
 1823|    456|                                        "TIFFReadDirEntryShortArray");
 1824|    456|    if (data == 0)
  ------------------
  |  Branch (1824:9): [True: 0, False: 456]
  ------------------
 1825|      0|    {
 1826|      0|        _TIFFfreeExt(tif, origdata);
 1827|      0|        return (TIFFReadDirEntryErrAlloc);
 1828|      0|    }
 1829|    456|    switch (direntry->tdir_type)
 1830|    456|    {
 1831|    399|        case TIFF_BYTE:
  ------------------
  |  Branch (1831:9): [True: 399, False: 57]
  ------------------
 1832|    399|        {
 1833|    399|            uint8_t *ma;
 1834|    399|            uint16_t *mb;
 1835|    399|            uint32_t n;
 1836|    399|            ma = (uint8_t *)origdata;
 1837|    399|            mb = data;
 1838|  12.9k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1838:25): [True: 12.5k, False: 399]
  ------------------
 1839|  12.5k|                *mb++ = (uint16_t)(*ma++);
 1840|    399|        }
 1841|    399|        break;
 1842|     31|        case TIFF_SBYTE:
  ------------------
  |  Branch (1842:9): [True: 31, False: 425]
  ------------------
 1843|     31|        {
 1844|     31|            int8_t *ma;
 1845|     31|            uint16_t *mb;
 1846|     31|            uint32_t n;
 1847|     31|            ma = (int8_t *)origdata;
 1848|     31|            mb = data;
 1849|    471|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1849:25): [True: 441, False: 30]
  ------------------
 1850|    441|            {
 1851|    441|                err = TIFFReadDirEntryCheckRangeShortSbyte(*ma);
 1852|    441|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1852:21): [True: 1, False: 440]
  ------------------
 1853|      1|                    break;
 1854|    440|                *mb++ = (uint16_t)(*ma++);
 1855|    440|            }
 1856|     31|        }
 1857|     31|        break;
 1858|     12|        case TIFF_LONG:
  ------------------
  |  Branch (1858:9): [True: 12, False: 444]
  ------------------
 1859|     12|        {
 1860|     12|            uint32_t *ma;
 1861|     12|            uint16_t *mb;
 1862|     12|            uint32_t n;
 1863|     12|            ma = (uint32_t *)origdata;
 1864|     12|            mb = data;
 1865|    418|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1865:25): [True: 408, False: 10]
  ------------------
 1866|    408|            {
 1867|    408|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    408|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1867:21): [True: 139, False: 269]
  ------------------
 1868|    139|                    TIFFSwabLong(ma);
 1869|    408|                err = TIFFReadDirEntryCheckRangeShortLong(*ma);
 1870|    408|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1870:21): [True: 2, False: 406]
  ------------------
 1871|      2|                    break;
 1872|    406|                *mb++ = (uint16_t)(*ma++);
 1873|    406|            }
 1874|     12|        }
 1875|     12|        break;
 1876|      4|        case TIFF_SLONG:
  ------------------
  |  Branch (1876:9): [True: 4, False: 452]
  ------------------
 1877|      4|        {
 1878|      4|            int32_t *ma;
 1879|      4|            uint16_t *mb;
 1880|      4|            uint32_t n;
 1881|      4|            ma = (int32_t *)origdata;
 1882|      4|            mb = data;
 1883|    298|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1883:25): [True: 297, False: 1]
  ------------------
 1884|    297|            {
 1885|    297|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    297|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1885:21): [True: 153, False: 144]
  ------------------
 1886|    153|                    TIFFSwabLong((uint32_t *)ma);
 1887|    297|                err = TIFFReadDirEntryCheckRangeShortSlong(*ma);
 1888|    297|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1888:21): [True: 3, False: 294]
  ------------------
 1889|      3|                    break;
 1890|    294|                *mb++ = (uint16_t)(*ma++);
 1891|    294|            }
 1892|      4|        }
 1893|      4|        break;
 1894|      4|        case TIFF_LONG8:
  ------------------
  |  Branch (1894:9): [True: 4, False: 452]
  ------------------
 1895|      4|        {
 1896|      4|            uint64_t *ma;
 1897|      4|            uint16_t *mb;
 1898|      4|            uint32_t n;
 1899|      4|            ma = (uint64_t *)origdata;
 1900|      4|            mb = data;
 1901|    449|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1901:25): [True: 449, False: 0]
  ------------------
 1902|    449|            {
 1903|    449|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    449|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1903:21): [True: 227, False: 222]
  ------------------
 1904|    227|                    TIFFSwabLong8(ma);
 1905|    449|                err = TIFFReadDirEntryCheckRangeShortLong8(*ma);
 1906|    449|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1906:21): [True: 4, False: 445]
  ------------------
 1907|      4|                    break;
 1908|    445|                *mb++ = (uint16_t)(*ma++);
 1909|    445|            }
 1910|      4|        }
 1911|      4|        break;
 1912|      6|        case TIFF_SLONG8:
  ------------------
  |  Branch (1912:9): [True: 6, False: 450]
  ------------------
 1913|      6|        {
 1914|      6|            int64_t *ma;
 1915|      6|            uint16_t *mb;
 1916|      6|            uint32_t n;
 1917|      6|            ma = (int64_t *)origdata;
 1918|      6|            mb = data;
 1919|    321|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1919:25): [True: 320, False: 1]
  ------------------
 1920|    320|            {
 1921|    320|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    320|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1921:21): [True: 286, False: 34]
  ------------------
 1922|    286|                    TIFFSwabLong8((uint64_t *)ma);
 1923|    320|                err = TIFFReadDirEntryCheckRangeShortSlong8(*ma);
 1924|    320|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1924:21): [True: 5, False: 315]
  ------------------
 1925|      5|                    break;
 1926|    315|                *mb++ = (uint16_t)(*ma++);
 1927|    315|            }
 1928|      6|        }
 1929|      6|        break;
 1930|      0|        default:
  ------------------
  |  Branch (1930:9): [True: 0, False: 456]
  ------------------
 1931|      0|            break;
 1932|    456|    }
 1933|    456|    _TIFFfreeExt(tif, origdata);
 1934|    456|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1934:9): [True: 15, False: 441]
  ------------------
 1935|     15|    {
 1936|     15|        _TIFFfreeExt(tif, data);
 1937|     15|        return (err);
 1938|     15|    }
 1939|    441|    *value = data;
 1940|    441|    return (TIFFReadDirEntryErrOk);
 1941|    456|}
tif_dirread.c:CalcFinalIFDdatasizeReading:
 4260|  5.92k|{
 4261|       |    /* IFD data size is only needed if file-writing is enabled.
 4262|       |     * This also avoids the seek() to EOF to determine the file size, which
 4263|       |     * causes the stdin-streaming-friendly mode of libtiff for GDAL to fail. */
 4264|  5.92k|    if (tif->tif_mode == O_RDONLY)
  ------------------
  |  Branch (4264:9): [True: 5.92k, False: 0]
  ------------------
 4265|  5.92k|        return;
 4266|       |
 4267|       |    /* Sort TIFFEntryOffsetAndLength array in ascending order. */
 4268|      0|    qsort(tif->tif_dir.td_dirdatasize_offsets,
 4269|      0|          tif->tif_dir.td_dirdatasize_Noffsets,
 4270|      0|          sizeof(TIFFEntryOffsetAndLength), cmpTIFFEntryOffsetAndLength);
 4271|       |
 4272|       |    /* Get offset of end of IFD entry space. */
 4273|      0|    uint64_t IFDendoffset;
 4274|      0|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|      0|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (4274:9): [True: 0, False: 0]
  ------------------
 4275|      0|        IFDendoffset = tif->tif_diroff + 2 + (uint64_t)dircount * 12 + 4;
 4276|      0|    else
 4277|      0|        IFDendoffset = tif->tif_diroff + 8 + (uint64_t)dircount * 20 + 8;
 4278|       |
 4279|       |    /* Check which offsets are right behind IFD entries. However, LibTIFF
 4280|       |     * increments the writing address for every external data to an even offset.
 4281|       |     * Thus gaps of 1 byte can occur. */
 4282|      0|    uint64_t size = 0;
 4283|      0|    uint64_t offset;
 4284|      0|    uint32_t i;
 4285|      0|    for (i = 0; i < tif->tif_dir.td_dirdatasize_Noffsets; i++)
  ------------------
  |  Branch (4285:17): [True: 0, False: 0]
  ------------------
 4286|      0|    {
 4287|      0|        offset = tif->tif_dir.td_dirdatasize_offsets[i].offset;
 4288|      0|        if (offset == IFDendoffset)
  ------------------
  |  Branch (4288:13): [True: 0, False: 0]
  ------------------
 4289|      0|        {
 4290|      0|            size += tif->tif_dir.td_dirdatasize_offsets[i].length;
 4291|      0|            IFDendoffset += tif->tif_dir.td_dirdatasize_offsets[i].length;
 4292|      0|        }
 4293|      0|        else if (offset == IFDendoffset + 1)
  ------------------
  |  Branch (4293:18): [True: 0, False: 0]
  ------------------
 4294|      0|        {
 4295|       |            /* Add gap byte after previous IFD data set. */
 4296|      0|            size += tif->tif_dir.td_dirdatasize_offsets[i].length + 1;
 4297|      0|            IFDendoffset += tif->tif_dir.td_dirdatasize_offsets[i].length;
 4298|      0|        }
 4299|      0|        else
 4300|      0|        {
 4301|       |            /* Further data is no more continuously after IFD */
 4302|      0|            break;
 4303|      0|        }
 4304|      0|    }
 4305|       |    /* Check for gap byte of some easy cases. This should cover 90% of cases.
 4306|       |     * Otherwise, IFD will be re-written even it might be safely overwritten. */
 4307|      0|    if (tif->tif_nextdiroff != 0)
  ------------------
  |  Branch (4307:9): [True: 0, False: 0]
  ------------------
 4308|      0|    {
 4309|      0|        if (tif->tif_nextdiroff == IFDendoffset + 1)
  ------------------
  |  Branch (4309:13): [True: 0, False: 0]
  ------------------
 4310|      0|            size++;
 4311|      0|    }
 4312|      0|    else
 4313|      0|    {
 4314|       |        /* Check for IFD data ends at EOF. Then IFD can always be safely
 4315|       |         * overwritten. */
 4316|      0|        offset = TIFFSeekFile(tif, 0, SEEK_END);
  ------------------
  |  |  287|      0|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 4317|      0|        if (offset == IFDendoffset)
  ------------------
  |  Branch (4317:13): [True: 0, False: 0]
  ------------------
 4318|      0|        {
 4319|      0|            tif->tif_dir.td_dirdatasize_read = UINT64_MAX;
 4320|      0|            return;
 4321|      0|        }
 4322|      0|    }
 4323|       |
 4324|       |    /* Finally, add the size of the IFD tag entries themselves. */
 4325|      0|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|      0|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (4325:9): [True: 0, False: 0]
  ------------------
 4326|      0|        tif->tif_dir.td_dirdatasize_read = 2U + dircount * 12U + 4U + size;
 4327|      0|    else
 4328|      0|        tif->tif_dir.td_dirdatasize_read = 8U + dircount * 20U + 8U + size;
 4329|      0|} /*-- CalcFinalIFDdatasizeReading() --*/
tif_dirread.c:_TIFFGetMaxColorChannels:
 4115|  5.51k|{
 4116|  5.51k|    switch (photometric)
 4117|  5.51k|    {
 4118|    179|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|    179|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (4118:9): [True: 179, False: 5.33k]
  ------------------
 4119|  2.75k|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|  2.75k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (4119:9): [True: 2.57k, False: 2.94k]
  ------------------
 4120|  2.81k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  2.81k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (4120:9): [True: 64, False: 5.45k]
  ------------------
 4121|  2.81k|            return 1;
 4122|  2.38k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|  2.38k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (4122:9): [True: 2.38k, False: 3.13k]
  ------------------
 4123|  2.54k|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|  2.54k|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (4123:9): [True: 163, False: 5.35k]
  ------------------
 4124|  2.55k|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|  2.55k|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (4124:9): [True: 11, False: 5.50k]
  ------------------
 4125|  2.57k|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|  2.57k|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (4125:9): [True: 24, False: 5.49k]
  ------------------
 4126|  2.57k|        case PHOTOMETRIC_ITULAB:
  ------------------
  |  |  230|  2.57k|#define PHOTOMETRIC_ITULAB 10              /* ITU L*a*b* */
  ------------------
  |  Branch (4126:9): [True: 1, False: 5.51k]
  ------------------
 4127|  2.57k|        case PHOTOMETRIC_ICCLAB:
  ------------------
  |  |  229|  2.57k|#define PHOTOMETRIC_ICCLAB 9               /* ICC L*a*b* [Adobe TIFF Technote 4] */
  ------------------
  |  Branch (4127:9): [True: 0, False: 5.51k]
  ------------------
 4128|  2.57k|            return 3;
 4129|     52|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     52|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (4129:9): [True: 52, False: 5.46k]
  ------------------
 4130|     52|        case PHOTOMETRIC_MASK:
  ------------------
  |  |  225|     52|#define PHOTOMETRIC_MASK 4                 /* $holdout mask */
  ------------------
  |  Branch (4130:9): [True: 0, False: 5.51k]
  ------------------
 4131|     52|            return 4;
 4132|     16|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|     16|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (4132:9): [True: 16, False: 5.50k]
  ------------------
 4133|     16|        case PHOTOMETRIC_CFA:
  ------------------
  |  |  231|     16|#define PHOTOMETRIC_CFA 32803              /* color filter array */
  ------------------
  |  Branch (4133:9): [True: 0, False: 5.51k]
  ------------------
 4134|     71|        default:
  ------------------
  |  Branch (4134:9): [True: 55, False: 5.46k]
  ------------------
 4135|     71|            return 0;
 4136|  5.51k|    }
 4137|  5.51k|}
tif_dirread.c:ByteCountLooksBad:
 4140|  2.05k|{
 4141|       |    /*
 4142|       |     * Assume we have wrong StripByteCount value (in case
 4143|       |     * of single strip) in following cases:
 4144|       |     *   - it is equal to zero along with StripOffset;
 4145|       |     *   - it is larger than file itself (in case of uncompressed
 4146|       |     *     image);
 4147|       |     *   - it is smaller than the size of the bytes per row
 4148|       |     *     multiplied on the number of rows.  The last case should
 4149|       |     *     not be checked in the case of writing new image,
 4150|       |     *     because we may do not know the exact strip size
 4151|       |     *     until the whole image will be written and directory
 4152|       |     *     dumped out.
 4153|       |     */
 4154|  2.05k|    uint64_t bytecount = TIFFGetStrileByteCount(tif, 0);
 4155|  2.05k|    uint64_t offset = TIFFGetStrileOffset(tif, 0);
 4156|  2.05k|    uint64_t filesize;
 4157|       |
 4158|  2.05k|    if (offset == 0)
  ------------------
  |  Branch (4158:9): [True: 8, False: 2.04k]
  ------------------
 4159|      8|        return 0;
 4160|  2.04k|    if (bytecount == 0)
  ------------------
  |  Branch (4160:9): [True: 80, False: 1.96k]
  ------------------
 4161|     80|        return 1;
 4162|  1.96k|    if (tif->tif_dir.td_compression != COMPRESSION_NONE)
  ------------------
  |  |  182|  1.96k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (4162:9): [True: 1.92k, False: 43]
  ------------------
 4163|  1.92k|        return 0;
 4164|     43|    filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|     43|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 4165|     43|    if (offset <= filesize && bytecount > filesize - offset)
  ------------------
  |  Branch (4165:9): [True: 28, False: 15]
  |  Branch (4165:31): [True: 13, False: 15]
  ------------------
 4166|     13|        return 1;
 4167|     30|    if (tif->tif_mode == O_RDONLY)
  ------------------
  |  Branch (4167:9): [True: 30, False: 0]
  ------------------
 4168|     30|    {
 4169|     30|        uint64_t scanlinesize = TIFFScanlineSize64(tif);
 4170|     30|        if (tif->tif_dir.td_imagelength > 0 &&
  ------------------
  |  Branch (4170:13): [True: 27, False: 3]
  ------------------
 4171|     27|            scanlinesize > UINT64_MAX / tif->tif_dir.td_imagelength)
  ------------------
  |  Branch (4171:13): [True: 0, False: 27]
  ------------------
 4172|      0|        {
 4173|      0|            return 1;
 4174|      0|        }
 4175|     30|        if (bytecount < scanlinesize * tif->tif_dir.td_imagelength)
  ------------------
  |  Branch (4175:13): [True: 14, False: 16]
  ------------------
 4176|     14|            return 1;
 4177|     30|    }
 4178|     16|    return 0;
 4179|     30|}
tif_dirread.c:TIFFReadDirectoryCheckOrder:
 5311|  5.98k|{
 5312|  5.98k|    static const char module[] = "TIFFReadDirectoryCheckOrder";
 5313|  5.98k|    uint32_t m;
 5314|  5.98k|    uint16_t n;
 5315|  5.98k|    TIFFDirEntry *o;
 5316|  5.98k|    m = 0;
 5317|  30.5k|    for (n = 0, o = dir; n < dircount; n++, o++)
  ------------------
  |  Branch (5317:26): [True: 30.4k, False: 53]
  ------------------
 5318|  30.4k|    {
 5319|  30.4k|        if (o->tdir_tag < m)
  ------------------
  |  Branch (5319:13): [True: 5.92k, False: 24.5k]
  ------------------
 5320|  5.92k|        {
 5321|  5.92k|            TIFFWarningExtR(tif, module,
 5322|  5.92k|                            "Invalid TIFF directory; tags are not sorted in "
 5323|  5.92k|                            "ascending order");
 5324|  5.92k|            break;
 5325|  5.92k|        }
 5326|  24.5k|        m = o->tdir_tag + 1U;
 5327|  24.5k|    }
 5328|  5.98k|}
tif_dirread.c:TIFFReadDirectoryFindEntry:
 5333|  12.6k|{
 5334|  12.6k|    TIFFDirEntry *m;
 5335|  12.6k|    uint16_t n;
 5336|  12.6k|    (void)tif;
 5337|   316k|    for (m = dir, n = 0; n < dircount; m++, n++)
  ------------------
  |  Branch (5337:26): [True: 312k, False: 4.11k]
  ------------------
 5338|   312k|    {
 5339|   312k|        if (m->tdir_tag == tagid)
  ------------------
  |  Branch (5339:13): [True: 8.53k, False: 303k]
  ------------------
 5340|  8.53k|            return (m);
 5341|   312k|    }
 5342|  4.11k|    return (0);
 5343|  12.6k|}
tif_dirread.c:TIFFReadDirectoryFindFieldInfo:
 5347|   432k|{
 5348|   432k|    int32_t ma, mb, mc;
 5349|   432k|    ma = -1;
 5350|   432k|    mc = (int32_t)tif->tif_nfields;
 5351|  3.43M|    while (1)
  ------------------
  |  Branch (5351:12): [True: 3.43M, Folded]
  ------------------
 5352|  3.43M|    {
 5353|  3.43M|        if (ma + 1 == mc)
  ------------------
  |  Branch (5353:13): [True: 117k, False: 3.31M]
  ------------------
 5354|   117k|        {
 5355|   117k|            *fii = FAILED_FII;
  ------------------
  |  |   44|   117k|#define FAILED_FII ((uint32_t)-1)
  ------------------
 5356|   117k|            return;
 5357|   117k|        }
 5358|  3.31M|        mb = (ma + mc) / 2;
 5359|  3.31M|        if (tif->tif_fields[mb]->field_tag == (uint32_t)tagid)
  ------------------
  |  Branch (5359:13): [True: 315k, False: 3.00M]
  ------------------
 5360|   315k|            break;
 5361|  3.00M|        if (tif->tif_fields[mb]->field_tag < (uint32_t)tagid)
  ------------------
  |  Branch (5361:13): [True: 1.48M, False: 1.51M]
  ------------------
 5362|  1.48M|            ma = mb;
 5363|  1.51M|        else
 5364|  1.51M|            mc = mb;
 5365|  3.00M|    }
 5366|   315k|    while (1)
  ------------------
  |  Branch (5366:12): [True: 315k, Folded]
  ------------------
 5367|   315k|    {
 5368|   315k|        if (mb == 0)
  ------------------
  |  Branch (5368:13): [True: 9.05k, False: 306k]
  ------------------
 5369|  9.05k|            break;
 5370|   306k|        if (tif->tif_fields[mb - 1]->field_tag != (uint32_t)tagid)
  ------------------
  |  Branch (5370:13): [True: 306k, False: 0]
  ------------------
 5371|   306k|            break;
 5372|      0|        mb--;
 5373|      0|    }
 5374|   315k|    *fii = (uint32_t)mb;
 5375|   315k|}
tif_dirread.c:EstimateStripByteCounts:
 5582|    516|{
 5583|    516|    static const char module[] = "EstimateStripByteCounts";
 5584|       |
 5585|    516|    TIFFDirEntry *dp;
 5586|    516|    TIFFDirectory *td = &tif->tif_dir;
 5587|    516|    uint32_t strip;
 5588|       |
 5589|       |    /* Do not try to load stripbytecount as we will compute it */
 5590|    516|    if (!_TIFFFillStrilesInternal(tif, 0))
  ------------------
  |  Branch (5590:9): [True: 0, False: 516]
  ------------------
 5591|      0|        return -1;
 5592|       |
 5593|    516|    const uint64_t allocsize = (uint64_t)td->td_nstrips * sizeof(uint64_t);
 5594|    516|    uint64_t filesize = 0;
 5595|    516|    if (allocsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (5595:9): [True: 0, False: 516]
  ------------------
 5596|      0|    {
 5597|       |        /* Before allocating a huge amount of memory for corrupted files, check
 5598|       |         * if size of requested memory is not greater than file size. */
 5599|      0|        filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|      0|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 5600|      0|        if (allocsize > filesize)
  ------------------
  |  Branch (5600:13): [True: 0, False: 0]
  ------------------
 5601|      0|        {
 5602|      0|            TIFFWarningExtR(
 5603|      0|                tif, module,
 5604|      0|                "Requested memory size for StripByteCounts of %" PRIu64
 5605|      0|                " is greater than filesize %" PRIu64 ". Memory not allocated",
 5606|      0|                allocsize, filesize);
 5607|      0|            return -1;
 5608|      0|        }
 5609|      0|    }
 5610|       |
 5611|    516|    if (td->td_stripbytecount_p)
  ------------------
  |  Branch (5611:9): [True: 119, False: 397]
  ------------------
 5612|    119|        _TIFFfreeExt(tif, td->td_stripbytecount_p);
 5613|    516|    td->td_stripbytecount_p = (uint64_t *)_TIFFCheckMalloc(
 5614|    516|        tif, td->td_nstrips, sizeof(uint64_t), "for \"StripByteCounts\" array");
 5615|    516|    if (td->td_stripbytecount_p == NULL)
  ------------------
  |  Branch (5615:9): [True: 0, False: 516]
  ------------------
 5616|      0|        return -1;
 5617|       |
 5618|    516|    if (td->td_compression != COMPRESSION_NONE)
  ------------------
  |  |  182|    516|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (5618:9): [True: 445, False: 71]
  ------------------
 5619|    445|    {
 5620|    445|        uint64_t space;
 5621|    445|        uint16_t n;
 5622|    445|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|    445|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (5622:13): [True: 438, False: 7]
  ------------------
 5623|    438|            space = sizeof(TIFFHeaderClassic) + 2 +
 5624|    438|                    (unsigned long)dircount * 12 + 4;
 5625|      7|        else
 5626|      7|            space =
 5627|      7|                sizeof(TIFFHeaderBig) + 8 + (unsigned long)dircount * 20 + 8;
 5628|       |        /* calculate amount of space used by indirect values */
 5629|  6.53k|        for (dp = dir, n = dircount; n > 0; n--, dp++)
  ------------------
  |  Branch (5629:38): [True: 6.10k, False: 426]
  ------------------
 5630|  6.10k|        {
 5631|  6.10k|            uint32_t typewidth;
 5632|  6.10k|            uint64_t datasize;
 5633|  6.10k|            typewidth = (uint32_t)TIFFDataWidth((TIFFDataType)dp->tdir_type);
 5634|  6.10k|            if (typewidth == 0)
  ------------------
  |  Branch (5634:17): [True: 18, False: 6.09k]
  ------------------
 5635|     18|            {
 5636|     18|                TIFFErrorExtR(
 5637|     18|                    tif, module,
 5638|     18|                    "Cannot determine size of unknown tag type %" PRIu16,
 5639|     18|                    dp->tdir_type);
 5640|     18|                return -1;
 5641|     18|            }
 5642|  6.09k|            if (dp->tdir_count > UINT64_MAX / typewidth)
  ------------------
  |  Branch (5642:17): [True: 0, False: 6.09k]
  ------------------
 5643|      0|                return -1;
 5644|  6.09k|            datasize = (uint64_t)typewidth * dp->tdir_count;
 5645|  6.09k|            if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  6.09k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (5645:17): [True: 5.99k, False: 94]
  ------------------
 5646|  5.99k|            {
 5647|  5.99k|                if (datasize <= 4)
  ------------------
  |  Branch (5647:21): [True: 4.08k, False: 1.91k]
  ------------------
 5648|  4.08k|                    datasize = 0;
 5649|  5.99k|            }
 5650|     94|            else
 5651|     94|            {
 5652|     94|                if (datasize <= 8)
  ------------------
  |  Branch (5652:21): [True: 71, False: 23]
  ------------------
 5653|     71|                    datasize = 0;
 5654|     94|            }
 5655|  6.09k|            if (space > UINT64_MAX - datasize)
  ------------------
  |  Branch (5655:17): [True: 1, False: 6.08k]
  ------------------
 5656|      1|                return -1;
 5657|  6.08k|            space += datasize;
 5658|  6.08k|        }
 5659|    426|        if (filesize == 0)
  ------------------
  |  Branch (5659:13): [True: 426, False: 0]
  ------------------
 5660|    426|            filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|    426|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 5661|    426|        if (filesize < space)
  ------------------
  |  Branch (5661:13): [True: 357, False: 69]
  ------------------
 5662|       |            /* we should perhaps return in error ? */
 5663|    357|            space = filesize;
 5664|     69|        else
 5665|     69|            space = filesize - space;
 5666|    426|        if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|    426|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (5666:13): [True: 2, False: 424]
  ------------------
 5667|      2|            space /= td->td_samplesperpixel;
 5668|    854|        for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (5668:25): [True: 428, False: 426]
  ------------------
 5669|    428|            td->td_stripbytecount_p[strip] = space;
 5670|       |        /*
 5671|       |         * This gross hack handles the case were the offset to
 5672|       |         * the last strip is past the place where we think the strip
 5673|       |         * should begin.  Since a strip of data must be contiguous,
 5674|       |         * it's safe to assume that we've overestimated the amount
 5675|       |         * of data in the strip and trim this number back accordingly.
 5676|       |         */
 5677|    426|        strip--;
 5678|    426|        if (td->td_stripoffset_p[strip] >
  ------------------
  |  Branch (5678:13): [True: 0, False: 426]
  ------------------
 5679|    426|            UINT64_MAX - td->td_stripbytecount_p[strip])
 5680|      0|            return -1;
 5681|    426|        if (td->td_stripoffset_p[strip] + td->td_stripbytecount_p[strip] >
  ------------------
  |  Branch (5681:13): [True: 252, False: 174]
  ------------------
 5682|    426|            filesize)
 5683|    252|        {
 5684|    252|            if (td->td_stripoffset_p[strip] >= filesize)
  ------------------
  |  Branch (5684:17): [True: 6, False: 246]
  ------------------
 5685|      6|            {
 5686|       |                /* Not sure what we should in that case... */
 5687|      6|                td->td_stripbytecount_p[strip] = 0;
 5688|      6|            }
 5689|    246|            else
 5690|    246|            {
 5691|    246|                td->td_stripbytecount_p[strip] =
 5692|    246|                    filesize - td->td_stripoffset_p[strip];
 5693|    246|            }
 5694|    252|        }
 5695|    426|    }
 5696|     71|    else if (isTiled(tif))
  ------------------
  |  |  278|     71|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     71|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 8, False: 63]
  |  |  ------------------
  ------------------
 5697|      8|    {
 5698|      8|        uint64_t bytespertile = TIFFTileSize64(tif);
 5699|       |
 5700|  30.4k|        for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (5700:25): [True: 30.4k, False: 8]
  ------------------
 5701|  30.4k|            td->td_stripbytecount_p[strip] = bytespertile;
 5702|      8|    }
 5703|     63|    else
 5704|     63|    {
 5705|     63|        uint64_t rowbytes = TIFFScanlineSize64(tif);
 5706|     63|        uint32_t rowsperstrip = td->td_imagelength / td->td_stripsperimage;
 5707|    286|        for (strip = 0; strip < td->td_nstrips; strip++)
  ------------------
  |  Branch (5707:25): [True: 223, False: 63]
  ------------------
 5708|    223|        {
 5709|    223|            if (rowbytes > 0 && rowsperstrip > UINT64_MAX / rowbytes)
  ------------------
  |  Branch (5709:17): [True: 221, False: 2]
  |  Branch (5709:33): [True: 0, False: 221]
  ------------------
 5710|      0|                return -1;
 5711|    223|            td->td_stripbytecount_p[strip] = rowbytes * rowsperstrip;
 5712|    223|        }
 5713|     63|    }
 5714|    497|    TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
  ------------------
  |  |  249|    497|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|    497|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|    497|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 5715|    497|    if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))
  ------------------
  |  |  248|    497|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|    497|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|    497|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  |  Branch (5715:9): [True: 222, False: 275]
  ------------------
 5716|    222|        td->td_rowsperstrip = td->td_imagelength;
 5717|    497|    return 1;
 5718|    516|}
tif_dirread.c:MissingRequired:
 5721|    223|{
 5722|    223|    static const char module[] = "MissingRequired";
 5723|       |
 5724|    223|    TIFFErrorExtR(tif, module,
 5725|    223|                  "TIFF directory is missing required \"%s\" field", tagname);
 5726|    223|}
tif_dirread.c:hashFuncOffsetToNumber:
 5729|  17.9k|{
 5730|  17.9k|    const TIFFOffsetAndDirNumber *offsetAndDirNumber =
 5731|  17.9k|        (const TIFFOffsetAndDirNumber *)elt;
 5732|  17.9k|    const uint32_t hash = (uint32_t)(offsetAndDirNumber->offset >> 32) ^
 5733|  17.9k|                          ((uint32_t)offsetAndDirNumber->offset & 0xFFFFFFFFU);
 5734|  17.9k|    return hash;
 5735|  17.9k|}
tif_dirread.c:hashFuncNumberToOffset:
 5747|  17.9k|{
 5748|  17.9k|    const TIFFOffsetAndDirNumber *offsetAndDirNumber =
 5749|  17.9k|        (const TIFFOffsetAndDirNumber *)elt;
 5750|  17.9k|    return offsetAndDirNumber->dirNumber;
 5751|  17.9k|}
tif_dirread.c:TIFFFetchDirectory:
 6087|  5.98k|{
 6088|  5.98k|    static const char module[] = "TIFFFetchDirectory";
 6089|       |
 6090|  5.98k|    void *origdir;
 6091|  5.98k|    uint16_t dircount16;
 6092|  5.98k|    uint32_t dirsize;
 6093|  5.98k|    TIFFDirEntry *dir;
 6094|  5.98k|    uint8_t *ma;
 6095|  5.98k|    TIFFDirEntry *mb;
 6096|  5.98k|    uint16_t n;
 6097|       |
 6098|  5.98k|    assert(pdir);
  ------------------
  |  Branch (6098:5): [True: 0, False: 5.98k]
  |  Branch (6098:5): [True: 5.98k, False: 0]
  ------------------
 6099|       |
 6100|  5.98k|    tif->tif_diroff = diroff;
 6101|  5.98k|    if (nextdiroff)
  ------------------
  |  Branch (6101:9): [True: 5.98k, False: 0]
  ------------------
 6102|  5.98k|        *nextdiroff = 0;
 6103|  5.98k|    if (!isMapped(tif))
  ------------------
  |  |  279|  5.98k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  5.98k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (6103:9): [True: 5.98k, False: 0]
  ------------------
 6104|  5.98k|    {
 6105|  5.98k|        if (!SeekOK(tif, tif->tif_diroff))
  ------------------
  |  |  303|  5.98k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (6105:13): [True: 0, False: 5.98k]
  ------------------
 6106|      0|        {
 6107|      0|            TIFFErrorExtR(tif, module,
 6108|      0|                          "%s: Seek error accessing TIFF directory",
 6109|      0|                          tif->tif_name);
 6110|      0|            return 0;
 6111|      0|        }
 6112|  5.98k|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  5.98k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6112:13): [True: 5.92k, False: 55]
  ------------------
 6113|  5.92k|        {
 6114|  5.92k|            if (!ReadOK(tif, &dircount16, sizeof(uint16_t)))
  ------------------
  |  |  300|  5.92k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|  5.92k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6114:17): [True: 0, False: 5.92k]
  ------------------
 6115|      0|            {
 6116|      0|                TIFFErrorExtR(tif, module,
 6117|      0|                              "%s: Can not read TIFF directory count",
 6118|      0|                              tif->tif_name);
 6119|      0|                return 0;
 6120|      0|            }
 6121|  5.92k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  5.92k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6121:17): [True: 258, False: 5.66k]
  ------------------
 6122|    258|                TIFFSwabShort(&dircount16);
 6123|  5.92k|            if (dircount16 > 4096)
  ------------------
  |  Branch (6123:17): [True: 0, False: 5.92k]
  ------------------
 6124|      0|            {
 6125|      0|                TIFFErrorExtR(tif, module,
 6126|      0|                              "Sanity check on directory count failed, this is "
 6127|      0|                              "probably not a valid IFD offset");
 6128|      0|                return 0;
 6129|      0|            }
 6130|  5.92k|            dirsize = 12;
 6131|  5.92k|        }
 6132|     55|        else
 6133|     55|        {
 6134|     55|            uint64_t dircount64;
 6135|     55|            if (!ReadOK(tif, &dircount64, sizeof(uint64_t)))
  ------------------
  |  |  300|     55|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|     55|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6135:17): [True: 0, False: 55]
  ------------------
 6136|      0|            {
 6137|      0|                TIFFErrorExtR(tif, module,
 6138|      0|                              "%s: Can not read TIFF directory count",
 6139|      0|                              tif->tif_name);
 6140|      0|                return 0;
 6141|      0|            }
 6142|     55|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     55|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6142:17): [True: 4, False: 51]
  ------------------
 6143|      4|                TIFFSwabLong8(&dircount64);
 6144|     55|            if (dircount64 > 4096)
  ------------------
  |  Branch (6144:17): [True: 0, False: 55]
  ------------------
 6145|      0|            {
 6146|      0|                TIFFErrorExtR(tif, module,
 6147|      0|                              "Sanity check on directory count failed, this is "
 6148|      0|                              "probably not a valid IFD offset");
 6149|      0|                return 0;
 6150|      0|            }
 6151|     55|            dircount16 = (uint16_t)dircount64;
 6152|     55|            dirsize = 20;
 6153|     55|        }
 6154|  5.98k|        origdir = _TIFFCheckMalloc(tif, dircount16, dirsize,
 6155|  5.98k|                                   "to read TIFF directory");
 6156|  5.98k|        if (origdir == NULL)
  ------------------
  |  Branch (6156:13): [True: 0, False: 5.98k]
  ------------------
 6157|      0|            return 0;
 6158|  5.98k|        if (!ReadOK(tif, origdir, (tmsize_t)dircount16 * dirsize))
  ------------------
  |  |  300|  5.98k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|  5.98k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6158:13): [True: 1, False: 5.98k]
  ------------------
 6159|      1|        {
 6160|      1|            TIFFErrorExtR(tif, module, "%.100s: Can not read TIFF directory",
 6161|      1|                          tif->tif_name);
 6162|      1|            _TIFFfreeExt(tif, origdir);
 6163|      1|            return 0;
 6164|      1|        }
 6165|       |        /*
 6166|       |         * Read offset to next directory for sequential scans if
 6167|       |         * needed.
 6168|       |         */
 6169|  5.98k|        if (nextdiroff)
  ------------------
  |  Branch (6169:13): [True: 5.98k, False: 0]
  ------------------
 6170|  5.98k|        {
 6171|  5.98k|            if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  5.98k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6171:17): [True: 5.92k, False: 55]
  ------------------
 6172|  5.92k|            {
 6173|  5.92k|                uint32_t nextdiroff32;
 6174|  5.92k|                if (!ReadOK(tif, &nextdiroff32, sizeof(uint32_t)))
  ------------------
  |  |  300|  5.92k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|  5.92k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6174:21): [True: 62, False: 5.86k]
  ------------------
 6175|     62|                    nextdiroff32 = 0;
 6176|  5.92k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  5.92k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6176:21): [True: 258, False: 5.66k]
  ------------------
 6177|    258|                    TIFFSwabLong(&nextdiroff32);
 6178|  5.92k|                *nextdiroff = nextdiroff32;
 6179|  5.92k|            }
 6180|     55|            else
 6181|     55|            {
 6182|     55|                if (!ReadOK(tif, nextdiroff, sizeof(uint64_t)))
  ------------------
  |  |  300|     55|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|     55|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (6182:21): [True: 7, False: 48]
  ------------------
 6183|      7|                    *nextdiroff = 0;
 6184|     55|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     55|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6184:21): [True: 4, False: 51]
  ------------------
 6185|      4|                    TIFFSwabLong8(nextdiroff);
 6186|     55|            }
 6187|  5.98k|        }
 6188|  5.98k|    }
 6189|      0|    else
 6190|      0|    {
 6191|      0|        tmsize_t m;
 6192|      0|        tmsize_t off;
 6193|      0|        if (tif->tif_diroff > (uint64_t)INT64_MAX)
  ------------------
  |  Branch (6193:13): [True: 0, False: 0]
  ------------------
 6194|      0|        {
 6195|      0|            TIFFErrorExtR(tif, module, "Can not read TIFF directory count");
 6196|      0|            return (0);
 6197|      0|        }
 6198|      0|        off = (tmsize_t)tif->tif_diroff;
 6199|       |
 6200|       |        /*
 6201|       |         * Check for integer overflow when validating the dir_off,
 6202|       |         * otherwise a very high offset may cause an OOB read and
 6203|       |         * crash the client. Make two comparisons instead of
 6204|       |         *
 6205|       |         *  off + sizeof(uint16_t) > tif->tif_size
 6206|       |         *
 6207|       |         * to avoid overflow.
 6208|       |         */
 6209|      0|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|      0|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6209:13): [True: 0, False: 0]
  ------------------
 6210|      0|        {
 6211|      0|            m = (tmsize_t)((uint64_t)off + sizeof(uint16_t));
 6212|      0|            if ((m < off) || ((uint64_t)m < sizeof(uint16_t)) ||
  ------------------
  |  Branch (6212:17): [True: 0, False: 0]
  |  Branch (6212:30): [True: 0, False: 0]
  ------------------
 6213|      0|                ((uint64_t)m > (uint64_t)tif->tif_size))
  ------------------
  |  Branch (6213:17): [True: 0, False: 0]
  ------------------
 6214|      0|            {
 6215|      0|                TIFFErrorExtR(tif, module, "Can not read TIFF directory count");
 6216|      0|                return 0;
 6217|      0|            }
 6218|      0|            else
 6219|      0|            {
 6220|      0|                _TIFFmemcpy(&dircount16, tif->tif_base + off, sizeof(uint16_t));
 6221|      0|            }
 6222|      0|            off = (tmsize_t)((uint64_t)off + sizeof(uint16_t));
 6223|      0|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6223:17): [True: 0, False: 0]
  ------------------
 6224|      0|                TIFFSwabShort(&dircount16);
 6225|      0|            if (dircount16 > 4096)
  ------------------
  |  Branch (6225:17): [True: 0, False: 0]
  ------------------
 6226|      0|            {
 6227|      0|                TIFFErrorExtR(tif, module,
 6228|      0|                              "Sanity check on directory count failed, this is "
 6229|      0|                              "probably not a valid IFD offset");
 6230|      0|                return 0;
 6231|      0|            }
 6232|      0|            dirsize = 12;
 6233|      0|        }
 6234|      0|        else
 6235|      0|        {
 6236|      0|            uint64_t dircount64;
 6237|      0|            m = (tmsize_t)((uint64_t)off + sizeof(uint64_t));
 6238|      0|            if ((m < off) || ((uint64_t)m < sizeof(uint64_t)) ||
  ------------------
  |  Branch (6238:17): [True: 0, False: 0]
  |  Branch (6238:30): [True: 0, False: 0]
  ------------------
 6239|      0|                ((uint64_t)m > (uint64_t)tif->tif_size))
  ------------------
  |  Branch (6239:17): [True: 0, False: 0]
  ------------------
 6240|      0|            {
 6241|      0|                TIFFErrorExtR(tif, module, "Can not read TIFF directory count");
 6242|      0|                return 0;
 6243|      0|            }
 6244|      0|            else
 6245|      0|            {
 6246|      0|                _TIFFmemcpy(&dircount64, tif->tif_base + off, sizeof(uint64_t));
 6247|      0|            }
 6248|      0|            off = (tmsize_t)((uint64_t)off + sizeof(uint64_t));
 6249|      0|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6249:17): [True: 0, False: 0]
  ------------------
 6250|      0|                TIFFSwabLong8(&dircount64);
 6251|      0|            if (dircount64 > 4096)
  ------------------
  |  Branch (6251:17): [True: 0, False: 0]
  ------------------
 6252|      0|            {
 6253|      0|                TIFFErrorExtR(tif, module,
 6254|      0|                              "Sanity check on directory count failed, this is "
 6255|      0|                              "probably not a valid IFD offset");
 6256|      0|                return 0;
 6257|      0|            }
 6258|      0|            dircount16 = (uint16_t)dircount64;
 6259|      0|            dirsize = 20;
 6260|      0|        }
 6261|      0|        if (dircount16 == 0)
  ------------------
  |  Branch (6261:13): [True: 0, False: 0]
  ------------------
 6262|      0|        {
 6263|      0|            TIFFErrorExtR(tif, module,
 6264|      0|                          "Sanity check on directory count failed, zero tag "
 6265|      0|                          "directories not supported");
 6266|      0|            return 0;
 6267|      0|        }
 6268|       |        /* Before allocating a huge amount of memory for corrupted files, check
 6269|       |         * if size of requested memory is not greater than file size. */
 6270|      0|        uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|      0|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 6271|      0|        uint64_t allocsize = (uint64_t)dircount16 * dirsize;
 6272|      0|        if (allocsize > filesize)
  ------------------
  |  Branch (6272:13): [True: 0, False: 0]
  ------------------
 6273|      0|        {
 6274|      0|            TIFFWarningExtR(
 6275|      0|                tif, module,
 6276|      0|                "Requested memory size for TIFF directory of %" PRIu64
 6277|      0|                " is greater than filesize %" PRIu64
 6278|      0|                ". Memory not allocated, TIFF directory not read",
 6279|      0|                allocsize, filesize);
 6280|      0|            return 0;
 6281|      0|        }
 6282|      0|        origdir = _TIFFCheckMalloc(tif, dircount16, dirsize,
 6283|      0|                                   "to read TIFF directory");
 6284|      0|        if (origdir == NULL)
  ------------------
  |  Branch (6284:13): [True: 0, False: 0]
  ------------------
 6285|      0|            return 0;
 6286|      0|        m = off + dircount16 * dirsize;
 6287|      0|        if ((m < off) || (m < (tmsize_t)dircount16 * (tmsize_t)dirsize) ||
  ------------------
  |  Branch (6287:13): [True: 0, False: 0]
  |  Branch (6287:26): [True: 0, False: 0]
  ------------------
 6288|      0|            (m > tif->tif_size))
  ------------------
  |  Branch (6288:13): [True: 0, False: 0]
  ------------------
 6289|      0|        {
 6290|      0|            TIFFErrorExtR(tif, module, "Can not read TIFF directory");
 6291|      0|            _TIFFfreeExt(tif, origdir);
 6292|      0|            return 0;
 6293|      0|        }
 6294|      0|        else
 6295|      0|        {
 6296|      0|            _TIFFmemcpy(origdir, tif->tif_base + off,
 6297|      0|                        (tmsize_t)dircount16 * dirsize);
 6298|      0|        }
 6299|      0|        if (nextdiroff)
  ------------------
  |  Branch (6299:13): [True: 0, False: 0]
  ------------------
 6300|      0|        {
 6301|      0|            off += dircount16 * dirsize;
 6302|      0|            if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|      0|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6302:17): [True: 0, False: 0]
  ------------------
 6303|      0|            {
 6304|      0|                uint32_t nextdiroff32;
 6305|      0|                m = (tmsize_t)((uint64_t)off + sizeof(uint32_t));
 6306|      0|                if ((m < off) || ((uint64_t)m < sizeof(uint32_t)) ||
  ------------------
  |  Branch (6306:21): [True: 0, False: 0]
  |  Branch (6306:34): [True: 0, False: 0]
  ------------------
 6307|      0|                    ((uint64_t)m > (uint64_t)tif->tif_size))
  ------------------
  |  Branch (6307:21): [True: 0, False: 0]
  ------------------
 6308|      0|                    nextdiroff32 = 0;
 6309|      0|                else
 6310|      0|                    _TIFFmemcpy(&nextdiroff32, tif->tif_base + off,
 6311|      0|                                sizeof(uint32_t));
 6312|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6312:21): [True: 0, False: 0]
  ------------------
 6313|      0|                    TIFFSwabLong(&nextdiroff32);
 6314|      0|                *nextdiroff = nextdiroff32;
 6315|      0|            }
 6316|      0|            else
 6317|      0|            {
 6318|      0|                m = (tmsize_t)((uint64_t)off + sizeof(uint64_t));
 6319|      0|                if ((m < off) || ((uint64_t)m < sizeof(uint64_t)) ||
  ------------------
  |  Branch (6319:21): [True: 0, False: 0]
  |  Branch (6319:34): [True: 0, False: 0]
  ------------------
 6320|      0|                    ((uint64_t)m > (uint64_t)tif->tif_size))
  ------------------
  |  Branch (6320:21): [True: 0, False: 0]
  ------------------
 6321|      0|                    *nextdiroff = 0;
 6322|      0|                else
 6323|      0|                    _TIFFmemcpy(nextdiroff, tif->tif_base + off,
 6324|      0|                                sizeof(uint64_t));
 6325|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6325:21): [True: 0, False: 0]
  ------------------
 6326|      0|                    TIFFSwabLong8(nextdiroff);
 6327|      0|            }
 6328|      0|        }
 6329|      0|    }
 6330|       |    /* No check against filesize needed here because "dir" should have same size
 6331|       |     * than "origdir" checked above. */
 6332|  5.98k|    dir = (TIFFDirEntry *)_TIFFCheckMalloc(
 6333|  5.98k|        tif, dircount16, sizeof(TIFFDirEntry), "to read TIFF directory");
 6334|  5.98k|    if (dir == 0)
  ------------------
  |  Branch (6334:9): [True: 0, False: 5.98k]
  ------------------
 6335|      0|    {
 6336|      0|        _TIFFfreeExt(tif, origdir);
 6337|      0|        return 0;
 6338|      0|    }
 6339|  5.98k|    ma = (uint8_t *)origdir;
 6340|  5.98k|    mb = dir;
 6341|   353k|    for (n = 0; n < dircount16; n++)
  ------------------
  |  Branch (6341:17): [True: 347k, False: 5.98k]
  ------------------
 6342|   347k|    {
 6343|   347k|        mb->tdir_ignore = FALSE;
  ------------------
  |  |   72|   347k|#define FALSE 0
  ------------------
 6344|   347k|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|   347k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6344:13): [True: 8.56k, False: 338k]
  ------------------
 6345|  8.56k|            TIFFSwabShort((uint16_t *)ma);
 6346|   347k|        mb->tdir_tag = *(uint16_t *)ma;
 6347|   347k|        ma += sizeof(uint16_t);
 6348|   347k|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|   347k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6348:13): [True: 8.56k, False: 338k]
  ------------------
 6349|  8.56k|            TIFFSwabShort((uint16_t *)ma);
 6350|   347k|        mb->tdir_type = *(uint16_t *)ma;
 6351|   347k|        ma += sizeof(uint16_t);
 6352|   347k|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|   347k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (6352:13): [True: 345k, False: 1.41k]
  ------------------
 6353|   345k|        {
 6354|   345k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|   345k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6354:17): [True: 8.23k, False: 337k]
  ------------------
 6355|  8.23k|                TIFFSwabLong((uint32_t *)ma);
 6356|   345k|            mb->tdir_count = (uint64_t)(*(uint32_t *)ma);
 6357|   345k|            ma += sizeof(uint32_t);
 6358|   345k|            mb->tdir_offset.toff_long8 = 0;
 6359|   345k|            *(uint32_t *)(&mb->tdir_offset) = *(uint32_t *)ma;
 6360|   345k|            ma += sizeof(uint32_t);
 6361|   345k|        }
 6362|  1.41k|        else
 6363|  1.41k|        {
 6364|  1.41k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  1.41k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (6364:17): [True: 334, False: 1.08k]
  ------------------
 6365|    334|                TIFFSwabLong8((uint64_t *)ma);
 6366|  1.41k|            mb->tdir_count = TIFFReadUInt64(ma);
 6367|  1.41k|            ma += sizeof(uint64_t);
 6368|  1.41k|            mb->tdir_offset.toff_long8 = TIFFReadUInt64(ma);
 6369|  1.41k|            ma += sizeof(uint64_t);
 6370|  1.41k|        }
 6371|   347k|        mb++;
 6372|   347k|    }
 6373|  5.98k|    _TIFFfreeExt(tif, origdir);
 6374|  5.98k|    *pdir = dir;
 6375|  5.98k|    return dircount16;
 6376|  5.98k|}
tif_dirread.c:TIFFReadUInt64:
  283|  2.83k|{
  284|  2.83k|    UInt64Aligned_t result;
  285|       |
  286|  2.83k|    result.c[0] = value[0];
  287|  2.83k|    result.c[1] = value[1];
  288|  2.83k|    result.c[2] = value[2];
  289|  2.83k|    result.c[3] = value[3];
  290|  2.83k|    result.c[4] = value[4];
  291|  2.83k|    result.c[5] = value[5];
  292|  2.83k|    result.c[6] = value[6];
  293|  2.83k|    result.c[7] = value[7];
  294|       |
  295|  2.83k|    return result.l;
  296|  2.83k|}
tif_dirread.c:TIFFFetchNormalTag:
 6382|   145k|{
 6383|   145k|    static const char module[] = "TIFFFetchNormalTag";
 6384|   145k|    enum TIFFReadDirEntryErr err;
 6385|   145k|    uint32_t fii;
 6386|   145k|    const TIFFField *fip = NULL;
 6387|   145k|    TIFFReadDirectoryFindFieldInfo(tif, dp->tdir_tag, &fii);
 6388|   145k|    if (fii == FAILED_FII)
  ------------------
  |  |   44|   145k|#define FAILED_FII ((uint32_t)-1)
  ------------------
  |  Branch (6388:9): [True: 0, False: 145k]
  ------------------
 6389|      0|    {
 6390|      0|        TIFFErrorExtR(tif, "TIFFFetchNormalTag",
 6391|      0|                      "No definition found for tag %" PRIu16, dp->tdir_tag);
 6392|      0|        return 0;
 6393|      0|    }
 6394|   145k|    fip = tif->tif_fields[fii];
 6395|   145k|    assert(fip != NULL); /* should not happen */
  ------------------
  |  Branch (6395:5): [True: 0, False: 145k]
  |  Branch (6395:5): [True: 145k, False: 0]
  ------------------
 6396|   145k|    assert(fip->set_get_field_type !=
  ------------------
  |  Branch (6396:5): [True: 0, False: 145k]
  |  Branch (6396:5): [True: 145k, False: 0]
  ------------------
 6397|   145k|           TIFF_SETGET_OTHER); /* if so, we shouldn't arrive here but deal with
 6398|       |                                  this in specialized code */
 6399|   145k|    assert(fip->set_get_field_type !=
  ------------------
  |  Branch (6399:5): [True: 0, False: 145k]
  |  Branch (6399:5): [True: 145k, False: 0]
  ------------------
 6400|   145k|           TIFF_SETGET_INT); /* if so, we shouldn't arrive here as this is only
 6401|       |                                the case for pseudo-tags */
 6402|   145k|    err = TIFFReadDirEntryErrOk;
 6403|   145k|    switch (fip->set_get_field_type)
 6404|   145k|    {
 6405|  86.3k|        case TIFF_SETGET_UNDEFINED:
  ------------------
  |  Branch (6405:9): [True: 86.3k, False: 59.4k]
  ------------------
 6406|  86.3k|            TIFFErrorExtR(
 6407|  86.3k|                tif, "TIFFFetchNormalTag",
 6408|  86.3k|                "Defined set_get_field_type of custom tag %u (%s) is "
 6409|  86.3k|                "TIFF_SETGET_UNDEFINED and thus tag is not read from file",
 6410|  86.3k|                fip->field_tag, fip->field_name);
 6411|  86.3k|            break;
 6412|  1.67k|        case TIFF_SETGET_ASCII:
  ------------------
  |  Branch (6412:9): [True: 1.67k, False: 144k]
  ------------------
 6413|  1.67k|        {
 6414|  1.67k|            uint8_t *data;
 6415|  1.67k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6415:13): [True: 0, False: 1.67k]
  |  Branch (6415:13): [True: 1.67k, False: 0]
  ------------------
 6416|  1.67k|            err = TIFFReadDirEntryByteArray(tif, dp, &data);
 6417|  1.67k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6417:17): [True: 1.00k, False: 669]
  ------------------
 6418|  1.00k|            {
 6419|  1.00k|                size_t mb = 0;
 6420|  1.00k|                int n;
 6421|  1.00k|                if (data != NULL)
  ------------------
  |  Branch (6421:21): [True: 985, False: 16]
  ------------------
 6422|    985|                {
 6423|    985|                    if (dp->tdir_count > 0 && data[dp->tdir_count - 1] == 0)
  ------------------
  |  Branch (6423:25): [True: 985, False: 0]
  |  Branch (6423:47): [True: 495, False: 490]
  ------------------
 6424|    495|                    {
 6425|       |                        /* optimization: if data is known to be 0 terminated, we
 6426|       |                         * can use strlen() */
 6427|    495|                        mb = strlen((const char *)data);
 6428|    495|                    }
 6429|    490|                    else
 6430|    490|                    {
 6431|       |                        /* general case. equivalent to non-portable */
 6432|       |                        /* mb = strnlen((const char*)data,
 6433|       |                         * (uint32_t)dp->tdir_count); */
 6434|    490|                        uint8_t *ma = data;
 6435|   116k|                        while (mb < (uint32_t)dp->tdir_count)
  ------------------
  |  Branch (6435:32): [True: 116k, False: 210]
  ------------------
 6436|   116k|                        {
 6437|   116k|                            if (*ma == 0)
  ------------------
  |  Branch (6437:33): [True: 280, False: 115k]
  ------------------
 6438|    280|                                break;
 6439|   115k|                            ma++;
 6440|   115k|                            mb++;
 6441|   115k|                        }
 6442|    490|                    }
 6443|    985|                }
 6444|  1.00k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6444:21): [True: 10, False: 991]
  ------------------
 6445|     10|                {
 6446|     10|                    if (data != NULL)
  ------------------
  |  Branch (6446:25): [True: 10, False: 0]
  ------------------
 6447|     10|                        _TIFFfreeExt(tif, data);
 6448|     10|                    return (0);
 6449|     10|                }
 6450|    991|                if (mb + 1 < (uint32_t)dp->tdir_count)
  ------------------
  |  Branch (6450:21): [True: 401, False: 590]
  ------------------
 6451|    401|                    TIFFWarningExtR(
 6452|    401|                        tif, module,
 6453|    401|                        "ASCII value for tag \"%s\" contains null byte in "
 6454|    401|                        "value; value incorrectly truncated during reading due "
 6455|    401|                        "to implementation limitations",
 6456|    401|                        fip->field_name);
 6457|    590|                else if (mb + 1 > (uint32_t)dp->tdir_count)
  ------------------
  |  Branch (6457:26): [True: 226, False: 364]
  ------------------
 6458|    226|                {
 6459|    226|                    TIFFWarningExtR(tif, module,
 6460|    226|                                    "ASCII value for tag \"%s\" does not end "
 6461|    226|                                    "in null byte. Forcing it to be null",
 6462|    226|                                    fip->field_name);
 6463|       |                    /* TIFFReadDirEntryArrayWithLimit() ensures this can't be
 6464|       |                     * larger than MAX_SIZE_TAG_DATA */
 6465|    226|                    assert((uint32_t)dp->tdir_count + 1 == dp->tdir_count + 1);
  ------------------
  |  Branch (6465:21): [True: 0, False: 226]
  |  Branch (6465:21): [True: 226, False: 0]
  ------------------
 6466|    226|                    uint8_t *o = (uint8_t *)_TIFFmallocExt(
 6467|    226|                        tif, (uint32_t)dp->tdir_count + 1);
 6468|    226|                    if (o == NULL)
  ------------------
  |  Branch (6468:25): [True: 0, False: 226]
  ------------------
 6469|      0|                    {
 6470|      0|                        if (data != NULL)
  ------------------
  |  Branch (6470:29): [True: 0, False: 0]
  ------------------
 6471|      0|                            _TIFFfreeExt(tif, data);
 6472|      0|                        return (0);
 6473|      0|                    }
 6474|    226|                    if (dp->tdir_count > 0)
  ------------------
  |  Branch (6474:25): [True: 210, False: 16]
  ------------------
 6475|    210|                    {
 6476|    210|                        _TIFFmemcpy(o, data, (uint32_t)dp->tdir_count);
 6477|    210|                    }
 6478|    226|                    o[(uint32_t)dp->tdir_count] = 0;
 6479|    226|                    if (data != 0)
  ------------------
  |  Branch (6479:25): [True: 210, False: 16]
  ------------------
 6480|    210|                        _TIFFfreeExt(tif, data);
 6481|    226|                    data = o;
 6482|    226|                }
 6483|    991|                n = TIFFSetField(tif, dp->tdir_tag, data);
 6484|    991|                if (data != 0)
  ------------------
  |  Branch (6484:21): [True: 991, False: 0]
  ------------------
 6485|    991|                    _TIFFfreeExt(tif, data);
 6486|    991|                if (!n)
  ------------------
  |  Branch (6486:21): [True: 0, False: 991]
  ------------------
 6487|      0|                    return (0);
 6488|    991|            }
 6489|  1.67k|        }
 6490|  1.66k|        break;
 6491|  1.66k|        case TIFF_SETGET_UINT8:
  ------------------
  |  Branch (6491:9): [True: 35, False: 145k]
  ------------------
 6492|     35|        {
 6493|     35|            uint8_t data = 0;
 6494|     35|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6494:13): [True: 0, False: 35]
  |  Branch (6494:13): [True: 35, False: 0]
  ------------------
 6495|     35|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6495:13): [True: 0, False: 35]
  |  Branch (6495:13): [True: 35, False: 0]
  ------------------
 6496|     35|            err = TIFFReadDirEntryByte(tif, dp, &data);
 6497|     35|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6497:17): [True: 6, False: 29]
  ------------------
 6498|      6|            {
 6499|      6|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6499:21): [True: 0, False: 6]
  ------------------
 6500|      0|                    return (0);
 6501|      6|            }
 6502|     35|        }
 6503|     35|        break;
 6504|     35|        case TIFF_SETGET_SINT8:
  ------------------
  |  Branch (6504:9): [True: 0, False: 145k]
  ------------------
 6505|      0|        {
 6506|      0|            int8_t data = 0;
 6507|      0|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6507:13): [True: 0, False: 0]
  |  Branch (6507:13): [True: 0, False: 0]
  ------------------
 6508|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6508:13): [True: 0, False: 0]
  |  Branch (6508:13): [True: 0, False: 0]
  ------------------
 6509|      0|            err = TIFFReadDirEntrySbyte(tif, dp, &data);
 6510|      0|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6510:17): [True: 0, False: 0]
  ------------------
 6511|      0|            {
 6512|      0|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6512:21): [True: 0, False: 0]
  ------------------
 6513|      0|                    return (0);
 6514|      0|            }
 6515|      0|        }
 6516|      0|        break;
 6517|  9.99k|        case TIFF_SETGET_UINT16:
  ------------------
  |  Branch (6517:9): [True: 9.99k, False: 135k]
  ------------------
 6518|  9.99k|        {
 6519|  9.99k|            uint16_t data;
 6520|  9.99k|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6520:13): [True: 0, False: 9.99k]
  |  Branch (6520:13): [True: 9.99k, False: 0]
  ------------------
 6521|  9.99k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6521:13): [True: 0, False: 9.99k]
  |  Branch (6521:13): [True: 9.99k, False: 0]
  ------------------
 6522|  9.99k|            err = TIFFReadDirEntryShort(tif, dp, &data);
 6523|  9.99k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6523:17): [True: 7.74k, False: 2.24k]
  ------------------
 6524|  7.74k|            {
 6525|  7.74k|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6525:21): [True: 92, False: 7.65k]
  ------------------
 6526|     92|                    return (0);
 6527|  7.74k|            }
 6528|  9.99k|        }
 6529|  9.89k|        break;
 6530|  9.89k|        case TIFF_SETGET_SINT16:
  ------------------
  |  Branch (6530:9): [True: 0, False: 145k]
  ------------------
 6531|      0|        {
 6532|      0|            int16_t data;
 6533|      0|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6533:13): [True: 0, False: 0]
  |  Branch (6533:13): [True: 0, False: 0]
  ------------------
 6534|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6534:13): [True: 0, False: 0]
  |  Branch (6534:13): [True: 0, False: 0]
  ------------------
 6535|      0|            err = TIFFReadDirEntrySshort(tif, dp, &data);
 6536|      0|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6536:17): [True: 0, False: 0]
  ------------------
 6537|      0|            {
 6538|      0|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6538:21): [True: 0, False: 0]
  ------------------
 6539|      0|                    return (0);
 6540|      0|            }
 6541|      0|        }
 6542|      0|        break;
 6543|  18.3k|        case TIFF_SETGET_UINT32:
  ------------------
  |  Branch (6543:9): [True: 18.3k, False: 127k]
  ------------------
 6544|  18.3k|        {
 6545|  18.3k|            uint32_t data;
 6546|  18.3k|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6546:13): [True: 0, False: 18.3k]
  |  Branch (6546:13): [True: 18.3k, False: 0]
  ------------------
 6547|  18.3k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6547:13): [True: 0, False: 18.3k]
  |  Branch (6547:13): [True: 18.3k, False: 0]
  ------------------
 6548|  18.3k|            err = TIFFReadDirEntryLong(tif, dp, &data);
 6549|  18.3k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6549:17): [True: 18.0k, False: 285]
  ------------------
 6550|  18.0k|            {
 6551|  18.0k|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6551:21): [True: 0, False: 18.0k]
  ------------------
 6552|      0|                    return (0);
 6553|  18.0k|            }
 6554|  18.3k|        }
 6555|  18.3k|        break;
 6556|  18.3k|        case TIFF_SETGET_SINT32:
  ------------------
  |  Branch (6556:9): [True: 0, False: 145k]
  ------------------
 6557|      0|        {
 6558|      0|            int32_t data;
 6559|      0|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6559:13): [True: 0, False: 0]
  |  Branch (6559:13): [True: 0, False: 0]
  ------------------
 6560|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6560:13): [True: 0, False: 0]
  |  Branch (6560:13): [True: 0, False: 0]
  ------------------
 6561|      0|            err = TIFFReadDirEntrySlong(tif, dp, &data);
 6562|      0|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6562:17): [True: 0, False: 0]
  ------------------
 6563|      0|            {
 6564|      0|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6564:21): [True: 0, False: 0]
  ------------------
 6565|      0|                    return (0);
 6566|      0|            }
 6567|      0|        }
 6568|      0|        break;
 6569|    776|        case TIFF_SETGET_UINT64:
  ------------------
  |  Branch (6569:9): [True: 776, False: 145k]
  ------------------
 6570|    776|        {
 6571|    776|            uint64_t data;
 6572|    776|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6572:13): [True: 0, False: 776]
  |  Branch (6572:13): [True: 776, False: 0]
  ------------------
 6573|    776|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6573:13): [True: 0, False: 776]
  |  Branch (6573:13): [True: 776, False: 0]
  ------------------
 6574|    776|            err = TIFFReadDirEntryLong8(tif, dp, &data);
 6575|    776|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6575:17): [True: 334, False: 442]
  ------------------
 6576|    334|            {
 6577|    334|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6577:21): [True: 0, False: 334]
  ------------------
 6578|      0|                    return 0;
 6579|    334|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6579:21): [True: 2, False: 332]
  ------------------
 6580|      2|                    return (0);
 6581|    334|            }
 6582|    776|        }
 6583|    774|        break;
 6584|    774|        case TIFF_SETGET_SINT64:
  ------------------
  |  Branch (6584:9): [True: 0, False: 145k]
  ------------------
 6585|      0|        {
 6586|      0|            int64_t data;
 6587|      0|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6587:13): [True: 0, False: 0]
  |  Branch (6587:13): [True: 0, False: 0]
  ------------------
 6588|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6588:13): [True: 0, False: 0]
  |  Branch (6588:13): [True: 0, False: 0]
  ------------------
 6589|      0|            err = TIFFReadDirEntrySlong8(tif, dp, &data);
 6590|      0|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6590:17): [True: 0, False: 0]
  ------------------
 6591|      0|            {
 6592|      0|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6592:21): [True: 0, False: 0]
  ------------------
 6593|      0|                    return 0;
 6594|      0|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6594:21): [True: 0, False: 0]
  ------------------
 6595|      0|                    return (0);
 6596|      0|            }
 6597|      0|        }
 6598|      0|        break;
 6599|  1.90k|        case TIFF_SETGET_FLOAT:
  ------------------
  |  Branch (6599:9): [True: 1.90k, False: 143k]
  ------------------
 6600|  1.90k|        {
 6601|  1.90k|            float data;
 6602|  1.90k|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6602:13): [True: 0, False: 1.90k]
  |  Branch (6602:13): [True: 1.90k, False: 0]
  ------------------
 6603|  1.90k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6603:13): [True: 0, False: 1.90k]
  |  Branch (6603:13): [True: 1.90k, False: 0]
  ------------------
 6604|  1.90k|            err = TIFFReadDirEntryFloat(tif, dp, &data);
 6605|  1.90k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6605:17): [True: 862, False: 1.04k]
  ------------------
 6606|    862|            {
 6607|    862|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6607:21): [True: 0, False: 862]
  ------------------
 6608|      0|                    return 0;
 6609|    862|                if (!TIFFSetField(tif, dp->tdir_tag, (double)data))
  ------------------
  |  Branch (6609:21): [True: 7, False: 855]
  ------------------
 6610|      7|                    return (0);
 6611|    862|            }
 6612|  1.90k|        }
 6613|  1.89k|        break;
 6614|  1.89k|        case TIFF_SETGET_DOUBLE:
  ------------------
  |  Branch (6614:9): [True: 3, False: 145k]
  ------------------
 6615|      3|        {
 6616|      3|            double data;
 6617|      3|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6617:13): [True: 0, False: 3]
  |  Branch (6617:13): [True: 3, False: 0]
  ------------------
 6618|      3|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6618:13): [True: 0, False: 3]
  |  Branch (6618:13): [True: 3, False: 0]
  ------------------
 6619|      3|            err = TIFFReadDirEntryDouble(tif, dp, &data);
 6620|      3|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6620:17): [True: 0, False: 3]
  ------------------
 6621|      0|            {
 6622|      0|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6622:21): [True: 0, False: 0]
  ------------------
 6623|      0|                    return 0;
 6624|      0|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6624:21): [True: 0, False: 0]
  ------------------
 6625|      0|                    return (0);
 6626|      0|            }
 6627|      3|        }
 6628|      3|        break;
 6629|     59|        case TIFF_SETGET_IFD8:
  ------------------
  |  Branch (6629:9): [True: 59, False: 145k]
  ------------------
 6630|     59|        {
 6631|     59|            uint64_t data;
 6632|     59|            assert(fip->field_readcount == 1);
  ------------------
  |  Branch (6632:13): [True: 0, False: 59]
  |  Branch (6632:13): [True: 59, False: 0]
  ------------------
 6633|     59|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6633:13): [True: 0, False: 59]
  |  Branch (6633:13): [True: 59, False: 0]
  ------------------
 6634|     59|            err = TIFFReadDirEntryIfd8(tif, dp, &data);
 6635|     59|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6635:17): [True: 14, False: 45]
  ------------------
 6636|     14|            {
 6637|     14|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6637:21): [True: 0, False: 14]
  ------------------
 6638|      0|                    return 0;
 6639|     14|                if (!TIFFSetField(tif, dp->tdir_tag, data))
  ------------------
  |  Branch (6639:21): [True: 1, False: 13]
  ------------------
 6640|      1|                    return (0);
 6641|     14|            }
 6642|     59|        }
 6643|     58|        break;
 6644|  1.27k|        case TIFF_SETGET_UINT16_PAIR:
  ------------------
  |  Branch (6644:9): [True: 1.27k, False: 144k]
  ------------------
 6645|  1.27k|        {
 6646|  1.27k|            uint16_t *data;
 6647|  1.27k|            assert(fip->field_readcount == 2);
  ------------------
  |  Branch (6647:13): [True: 0, False: 1.27k]
  |  Branch (6647:13): [True: 1.27k, False: 0]
  ------------------
 6648|  1.27k|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6648:13): [True: 0, False: 1.27k]
  |  Branch (6648:13): [True: 1.27k, False: 0]
  ------------------
 6649|  1.27k|            if (dp->tdir_count != 2)
  ------------------
  |  Branch (6649:17): [True: 153, False: 1.11k]
  ------------------
 6650|    153|            {
 6651|    153|                TIFFWarningExtR(tif, module,
 6652|    153|                                "incorrect count for field \"%s\", expected 2, "
 6653|    153|                                "got %" PRIu64,
 6654|    153|                                fip->field_name, dp->tdir_count);
 6655|    153|                return (0);
 6656|    153|            }
 6657|  1.11k|            err = TIFFReadDirEntryShortArray(tif, dp, &data);
 6658|  1.11k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6658:17): [True: 1.06k, False: 48]
  ------------------
 6659|  1.06k|            {
 6660|  1.06k|                int m;
 6661|  1.06k|                assert(data); /* avoid CLang static Analyzer false positive */
  ------------------
  |  Branch (6661:17): [True: 0, False: 1.06k]
  |  Branch (6661:17): [True: 1.06k, False: 0]
  ------------------
 6662|  1.06k|                m = TIFFSetField(tif, dp->tdir_tag, data[0], data[1]);
 6663|  1.06k|                _TIFFfreeExt(tif, data);
 6664|  1.06k|                if (!m)
  ------------------
  |  Branch (6664:21): [True: 0, False: 1.06k]
  ------------------
 6665|      0|                    return (0);
 6666|  1.06k|            }
 6667|  1.11k|        }
 6668|  1.11k|        break;
 6669|  1.11k|        case TIFF_SETGET_C0_UINT8:
  ------------------
  |  Branch (6669:9): [True: 162, False: 145k]
  ------------------
 6670|    162|        {
 6671|    162|            uint8_t *data;
 6672|    162|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6672:13): [True: 0, False: 162]
  |  Branch (6672:13): [True: 162, False: 0]
  ------------------
 6673|    162|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6673:13): [True: 0, False: 162]
  |  Branch (6673:13): [True: 162, False: 0]
  ------------------
 6674|    162|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6674:17): [True: 131, False: 31]
  ------------------
 6675|    131|            {
 6676|    131|                TIFFWarningExtR(tif, module,
 6677|    131|                                "incorrect count for field \"%s\", expected "
 6678|    131|                                "%d, got %" PRIu64,
 6679|    131|                                fip->field_name, (int)fip->field_readcount,
 6680|    131|                                dp->tdir_count);
 6681|    131|                return (0);
 6682|    131|            }
 6683|     31|            else
 6684|     31|            {
 6685|     31|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 6686|     31|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6686:21): [True: 26, False: 5]
  ------------------
 6687|     26|                {
 6688|     26|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6688:25): [True: 0, False: 26]
  ------------------
 6689|      0|                    {
 6690|      0|                        if (data != 0)
  ------------------
  |  Branch (6690:29): [True: 0, False: 0]
  ------------------
 6691|      0|                            _TIFFfreeExt(tif, data);
 6692|      0|                        return 0;
 6693|      0|                    }
 6694|     26|                    int m;
 6695|     26|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6696|     26|                    if (data != 0)
  ------------------
  |  Branch (6696:25): [True: 26, False: 0]
  ------------------
 6697|     26|                        _TIFFfreeExt(tif, data);
 6698|     26|                    if (!m)
  ------------------
  |  Branch (6698:25): [True: 0, False: 26]
  ------------------
 6699|      0|                        return (0);
 6700|     26|                }
 6701|     31|            }
 6702|    162|        }
 6703|     31|        break;
 6704|     31|        case TIFF_SETGET_C0_SINT8:
  ------------------
  |  Branch (6704:9): [True: 0, False: 145k]
  ------------------
 6705|      0|        {
 6706|      0|            int8_t *data;
 6707|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6707:13): [True: 0, False: 0]
  |  Branch (6707:13): [True: 0, False: 0]
  ------------------
 6708|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6708:13): [True: 0, False: 0]
  |  Branch (6708:13): [True: 0, False: 0]
  ------------------
 6709|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6709:17): [True: 0, False: 0]
  ------------------
 6710|      0|            {
 6711|      0|                TIFFWarningExtR(tif, module,
 6712|      0|                                "incorrect count for field \"%s\", expected "
 6713|      0|                                "%d, got %" PRIu64,
 6714|      0|                                fip->field_name, (int)fip->field_readcount,
 6715|      0|                                dp->tdir_count);
 6716|      0|                return (0);
 6717|      0|            }
 6718|      0|            else
 6719|      0|            {
 6720|      0|                err = TIFFReadDirEntrySbyteArray(tif, dp, &data);
 6721|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6721:21): [True: 0, False: 0]
  ------------------
 6722|      0|                {
 6723|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6723:25): [True: 0, False: 0]
  ------------------
 6724|      0|                    {
 6725|      0|                        if (data != 0)
  ------------------
  |  Branch (6725:29): [True: 0, False: 0]
  ------------------
 6726|      0|                            _TIFFfreeExt(tif, data);
 6727|      0|                        return 0;
 6728|      0|                    }
 6729|      0|                    int m;
 6730|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6731|      0|                    if (data != 0)
  ------------------
  |  Branch (6731:25): [True: 0, False: 0]
  ------------------
 6732|      0|                        _TIFFfreeExt(tif, data);
 6733|      0|                    if (!m)
  ------------------
  |  Branch (6733:25): [True: 0, False: 0]
  ------------------
 6734|      0|                        return (0);
 6735|      0|                }
 6736|      0|            }
 6737|      0|        }
 6738|      0|        break;
 6739|      9|        case TIFF_SETGET_C0_UINT16:
  ------------------
  |  Branch (6739:9): [True: 9, False: 145k]
  ------------------
 6740|      9|        {
 6741|      9|            uint16_t *data;
 6742|      9|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6742:13): [True: 0, False: 9]
  |  Branch (6742:13): [True: 9, False: 0]
  ------------------
 6743|      9|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6743:13): [True: 0, False: 9]
  |  Branch (6743:13): [True: 9, False: 0]
  ------------------
 6744|      9|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6744:17): [True: 9, False: 0]
  ------------------
 6745|      9|            {
 6746|      9|                TIFFWarningExtR(tif, module,
 6747|      9|                                "incorrect count for field \"%s\", expected "
 6748|      9|                                "%d, got %" PRIu64,
 6749|      9|                                fip->field_name, (int)fip->field_readcount,
 6750|      9|                                dp->tdir_count);
 6751|      9|                return (0);
 6752|      9|            }
 6753|      0|            else
 6754|      0|            {
 6755|      0|                err = TIFFReadDirEntryShortArray(tif, dp, &data);
 6756|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6756:21): [True: 0, False: 0]
  ------------------
 6757|      0|                {
 6758|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6758:25): [True: 0, False: 0]
  ------------------
 6759|      0|                    {
 6760|      0|                        if (data != 0)
  ------------------
  |  Branch (6760:29): [True: 0, False: 0]
  ------------------
 6761|      0|                            _TIFFfreeExt(tif, data);
 6762|      0|                        return 0;
 6763|      0|                    }
 6764|      0|                    int m;
 6765|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6766|      0|                    if (data != 0)
  ------------------
  |  Branch (6766:25): [True: 0, False: 0]
  ------------------
 6767|      0|                        _TIFFfreeExt(tif, data);
 6768|      0|                    if (!m)
  ------------------
  |  Branch (6768:25): [True: 0, False: 0]
  ------------------
 6769|      0|                        return (0);
 6770|      0|                }
 6771|      0|            }
 6772|      9|        }
 6773|      0|        break;
 6774|      0|        case TIFF_SETGET_C0_SINT16:
  ------------------
  |  Branch (6774:9): [True: 0, False: 145k]
  ------------------
 6775|      0|        {
 6776|      0|            int16_t *data;
 6777|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6777:13): [True: 0, False: 0]
  |  Branch (6777:13): [True: 0, False: 0]
  ------------------
 6778|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6778:13): [True: 0, False: 0]
  |  Branch (6778:13): [True: 0, False: 0]
  ------------------
 6779|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6779:17): [True: 0, False: 0]
  ------------------
 6780|      0|            {
 6781|      0|                TIFFWarningExtR(tif, module,
 6782|      0|                                "incorrect count for field \"%s\", expected "
 6783|      0|                                "%d, got %" PRIu64,
 6784|      0|                                fip->field_name, (int)fip->field_readcount,
 6785|      0|                                dp->tdir_count);
 6786|      0|                return (0);
 6787|      0|            }
 6788|      0|            else
 6789|      0|            {
 6790|      0|                err = TIFFReadDirEntrySshortArray(tif, dp, &data);
 6791|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6791:21): [True: 0, False: 0]
  ------------------
 6792|      0|                {
 6793|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6793:25): [True: 0, False: 0]
  ------------------
 6794|      0|                    {
 6795|      0|                        if (data != 0)
  ------------------
  |  Branch (6795:29): [True: 0, False: 0]
  ------------------
 6796|      0|                            _TIFFfreeExt(tif, data);
 6797|      0|                        return 0;
 6798|      0|                    }
 6799|      0|                    int m;
 6800|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6801|      0|                    if (data != 0)
  ------------------
  |  Branch (6801:25): [True: 0, False: 0]
  ------------------
 6802|      0|                        _TIFFfreeExt(tif, data);
 6803|      0|                    if (!m)
  ------------------
  |  Branch (6803:25): [True: 0, False: 0]
  ------------------
 6804|      0|                        return (0);
 6805|      0|                }
 6806|      0|            }
 6807|      0|        }
 6808|      0|        break;
 6809|     51|        case TIFF_SETGET_C0_UINT32:
  ------------------
  |  Branch (6809:9): [True: 51, False: 145k]
  ------------------
 6810|     51|        {
 6811|     51|            uint32_t *data;
 6812|     51|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6812:13): [True: 0, False: 51]
  |  Branch (6812:13): [True: 51, False: 0]
  ------------------
 6813|     51|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6813:13): [True: 0, False: 51]
  |  Branch (6813:13): [True: 51, False: 0]
  ------------------
 6814|     51|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6814:17): [True: 3, False: 48]
  ------------------
 6815|      3|            {
 6816|      3|                TIFFWarningExtR(tif, module,
 6817|      3|                                "incorrect count for field \"%s\", expected "
 6818|      3|                                "%d, got %" PRIu64,
 6819|      3|                                fip->field_name, (int)fip->field_readcount,
 6820|      3|                                dp->tdir_count);
 6821|      3|                return (0);
 6822|      3|            }
 6823|     48|            else
 6824|     48|            {
 6825|     48|                err = TIFFReadDirEntryLongArray(tif, dp, &data);
 6826|     48|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6826:21): [True: 15, False: 33]
  ------------------
 6827|     15|                {
 6828|     15|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6828:25): [True: 0, False: 15]
  ------------------
 6829|      0|                    {
 6830|      0|                        if (data != 0)
  ------------------
  |  Branch (6830:29): [True: 0, False: 0]
  ------------------
 6831|      0|                            _TIFFfreeExt(tif, data);
 6832|      0|                        return 0;
 6833|      0|                    }
 6834|     15|                    int m;
 6835|     15|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6836|     15|                    if (data != 0)
  ------------------
  |  Branch (6836:25): [True: 15, False: 0]
  ------------------
 6837|     15|                        _TIFFfreeExt(tif, data);
 6838|     15|                    if (!m)
  ------------------
  |  Branch (6838:25): [True: 0, False: 15]
  ------------------
 6839|      0|                        return (0);
 6840|     15|                }
 6841|     48|            }
 6842|     51|        }
 6843|     48|        break;
 6844|     48|        case TIFF_SETGET_C0_SINT32:
  ------------------
  |  Branch (6844:9): [True: 0, False: 145k]
  ------------------
 6845|      0|        {
 6846|      0|            int32_t *data;
 6847|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6847:13): [True: 0, False: 0]
  |  Branch (6847:13): [True: 0, False: 0]
  ------------------
 6848|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6848:13): [True: 0, False: 0]
  |  Branch (6848:13): [True: 0, False: 0]
  ------------------
 6849|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6849:17): [True: 0, False: 0]
  ------------------
 6850|      0|            {
 6851|      0|                TIFFWarningExtR(tif, module,
 6852|      0|                                "incorrect count for field \"%s\", expected "
 6853|      0|                                "%d, got %" PRIu64,
 6854|      0|                                fip->field_name, (int)fip->field_readcount,
 6855|      0|                                dp->tdir_count);
 6856|      0|                return (0);
 6857|      0|            }
 6858|      0|            else
 6859|      0|            {
 6860|      0|                err = TIFFReadDirEntrySlongArray(tif, dp, &data);
 6861|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6861:21): [True: 0, False: 0]
  ------------------
 6862|      0|                {
 6863|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6863:25): [True: 0, False: 0]
  ------------------
 6864|      0|                    {
 6865|      0|                        if (data != 0)
  ------------------
  |  Branch (6865:29): [True: 0, False: 0]
  ------------------
 6866|      0|                            _TIFFfreeExt(tif, data);
 6867|      0|                        return 0;
 6868|      0|                    }
 6869|      0|                    int m;
 6870|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6871|      0|                    if (data != 0)
  ------------------
  |  Branch (6871:25): [True: 0, False: 0]
  ------------------
 6872|      0|                        _TIFFfreeExt(tif, data);
 6873|      0|                    if (!m)
  ------------------
  |  Branch (6873:25): [True: 0, False: 0]
  ------------------
 6874|      0|                        return (0);
 6875|      0|                }
 6876|      0|            }
 6877|      0|        }
 6878|      0|        break;
 6879|      0|        case TIFF_SETGET_C0_UINT64:
  ------------------
  |  Branch (6879:9): [True: 0, False: 145k]
  ------------------
 6880|      0|        {
 6881|      0|            uint64_t *data;
 6882|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6882:13): [True: 0, False: 0]
  |  Branch (6882:13): [True: 0, False: 0]
  ------------------
 6883|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6883:13): [True: 0, False: 0]
  |  Branch (6883:13): [True: 0, False: 0]
  ------------------
 6884|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6884:17): [True: 0, False: 0]
  ------------------
 6885|      0|            {
 6886|      0|                TIFFWarningExtR(tif, module,
 6887|      0|                                "incorrect count for field \"%s\", expected "
 6888|      0|                                "%d, got %" PRIu64,
 6889|      0|                                fip->field_name, (int)fip->field_readcount,
 6890|      0|                                dp->tdir_count);
 6891|      0|                return (0);
 6892|      0|            }
 6893|      0|            else
 6894|      0|            {
 6895|      0|                err = TIFFReadDirEntryLong8Array(tif, dp, &data);
 6896|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6896:21): [True: 0, False: 0]
  ------------------
 6897|      0|                {
 6898|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6898:25): [True: 0, False: 0]
  ------------------
 6899|      0|                    {
 6900|      0|                        if (data != 0)
  ------------------
  |  Branch (6900:29): [True: 0, False: 0]
  ------------------
 6901|      0|                            _TIFFfreeExt(tif, data);
 6902|      0|                        return 0;
 6903|      0|                    }
 6904|      0|                    int m;
 6905|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6906|      0|                    if (data != 0)
  ------------------
  |  Branch (6906:25): [True: 0, False: 0]
  ------------------
 6907|      0|                        _TIFFfreeExt(tif, data);
 6908|      0|                    if (!m)
  ------------------
  |  Branch (6908:25): [True: 0, False: 0]
  ------------------
 6909|      0|                        return (0);
 6910|      0|                }
 6911|      0|            }
 6912|      0|        }
 6913|      0|        break;
 6914|      0|        case TIFF_SETGET_C0_SINT64:
  ------------------
  |  Branch (6914:9): [True: 0, False: 145k]
  ------------------
 6915|      0|        {
 6916|      0|            int64_t *data;
 6917|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6917:13): [True: 0, False: 0]
  |  Branch (6917:13): [True: 0, False: 0]
  ------------------
 6918|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6918:13): [True: 0, False: 0]
  |  Branch (6918:13): [True: 0, False: 0]
  ------------------
 6919|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6919:17): [True: 0, False: 0]
  ------------------
 6920|      0|            {
 6921|      0|                TIFFWarningExtR(tif, module,
 6922|      0|                                "incorrect count for field \"%s\", expected "
 6923|      0|                                "%d, got %" PRIu64,
 6924|      0|                                fip->field_name, (int)fip->field_readcount,
 6925|      0|                                dp->tdir_count);
 6926|      0|                return (0);
 6927|      0|            }
 6928|      0|            else
 6929|      0|            {
 6930|      0|                err = TIFFReadDirEntrySlong8Array(tif, dp, &data);
 6931|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6931:21): [True: 0, False: 0]
  ------------------
 6932|      0|                {
 6933|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6933:25): [True: 0, False: 0]
  ------------------
 6934|      0|                    {
 6935|      0|                        if (data != 0)
  ------------------
  |  Branch (6935:29): [True: 0, False: 0]
  ------------------
 6936|      0|                            _TIFFfreeExt(tif, data);
 6937|      0|                        return 0;
 6938|      0|                    }
 6939|      0|                    int m;
 6940|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6941|      0|                    if (data != 0)
  ------------------
  |  Branch (6941:25): [True: 0, False: 0]
  ------------------
 6942|      0|                        _TIFFfreeExt(tif, data);
 6943|      0|                    if (!m)
  ------------------
  |  Branch (6943:25): [True: 0, False: 0]
  ------------------
 6944|      0|                        return (0);
 6945|      0|                }
 6946|      0|            }
 6947|      0|        }
 6948|      0|        break;
 6949|    180|        case TIFF_SETGET_C0_FLOAT:
  ------------------
  |  Branch (6949:9): [True: 180, False: 145k]
  ------------------
 6950|    180|        {
 6951|    180|            float *data;
 6952|    180|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6952:13): [True: 0, False: 180]
  |  Branch (6952:13): [True: 180, False: 0]
  ------------------
 6953|    180|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6953:13): [True: 0, False: 180]
  |  Branch (6953:13): [True: 180, False: 0]
  ------------------
 6954|    180|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6954:17): [True: 142, False: 38]
  ------------------
 6955|    142|            {
 6956|    142|                TIFFWarningExtR(tif, module,
 6957|    142|                                "incorrect count for field \"%s\", expected "
 6958|    142|                                "%d, got %" PRIu64,
 6959|    142|                                fip->field_name, (int)fip->field_readcount,
 6960|    142|                                dp->tdir_count);
 6961|    142|                return (0);
 6962|    142|            }
 6963|     38|            else
 6964|     38|            {
 6965|     38|                err = TIFFReadDirEntryFloatArray(tif, dp, &data);
 6966|     38|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (6966:21): [True: 29, False: 9]
  ------------------
 6967|     29|                {
 6968|     29|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (6968:25): [True: 0, False: 29]
  ------------------
 6969|      0|                    {
 6970|      0|                        if (data != 0)
  ------------------
  |  Branch (6970:29): [True: 0, False: 0]
  ------------------
 6971|      0|                            _TIFFfreeExt(tif, data);
 6972|      0|                        return 0;
 6973|      0|                    }
 6974|     29|                    int m;
 6975|     29|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 6976|     29|                    if (data != 0)
  ------------------
  |  Branch (6976:25): [True: 29, False: 0]
  ------------------
 6977|     29|                        _TIFFfreeExt(tif, data);
 6978|     29|                    if (!m)
  ------------------
  |  Branch (6978:25): [True: 0, False: 29]
  ------------------
 6979|      0|                        return (0);
 6980|     29|                }
 6981|     38|            }
 6982|    180|        }
 6983|     38|        break;
 6984|       |        /*--: Rational2Double: Extend for Double Arrays and Rational-Arrays read
 6985|       |         * into Double-Arrays. */
 6986|     38|        case TIFF_SETGET_C0_DOUBLE:
  ------------------
  |  Branch (6986:9): [True: 0, False: 145k]
  ------------------
 6987|      0|        {
 6988|      0|            double *data;
 6989|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (6989:13): [True: 0, False: 0]
  |  Branch (6989:13): [True: 0, False: 0]
  ------------------
 6990|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (6990:13): [True: 0, False: 0]
  |  Branch (6990:13): [True: 0, False: 0]
  ------------------
 6991|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (6991:17): [True: 0, False: 0]
  ------------------
 6992|      0|            {
 6993|      0|                TIFFWarningExtR(tif, module,
 6994|      0|                                "incorrect count for field \"%s\", expected "
 6995|      0|                                "%d, got %" PRIu64,
 6996|      0|                                fip->field_name, (int)fip->field_readcount,
 6997|      0|                                dp->tdir_count);
 6998|      0|                return (0);
 6999|      0|            }
 7000|      0|            else
 7001|      0|            {
 7002|      0|                err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
 7003|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7003:21): [True: 0, False: 0]
  ------------------
 7004|      0|                {
 7005|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7005:25): [True: 0, False: 0]
  ------------------
 7006|      0|                    {
 7007|      0|                        if (data != 0)
  ------------------
  |  Branch (7007:29): [True: 0, False: 0]
  ------------------
 7008|      0|                            _TIFFfreeExt(tif, data);
 7009|      0|                        return 0;
 7010|      0|                    }
 7011|      0|                    int m;
 7012|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 7013|      0|                    if (data != 0)
  ------------------
  |  Branch (7013:25): [True: 0, False: 0]
  ------------------
 7014|      0|                        _TIFFfreeExt(tif, data);
 7015|      0|                    if (!m)
  ------------------
  |  Branch (7015:25): [True: 0, False: 0]
  ------------------
 7016|      0|                        return (0);
 7017|      0|                }
 7018|      0|            }
 7019|      0|        }
 7020|      0|        break;
 7021|      0|        case TIFF_SETGET_C0_IFD8:
  ------------------
  |  Branch (7021:9): [True: 0, False: 145k]
  ------------------
 7022|      0|        {
 7023|      0|            uint64_t *data;
 7024|      0|            assert(fip->field_readcount >= 1);
  ------------------
  |  Branch (7024:13): [True: 0, False: 0]
  |  Branch (7024:13): [True: 0, False: 0]
  ------------------
 7025|      0|            assert(fip->field_passcount == 0);
  ------------------
  |  Branch (7025:13): [True: 0, False: 0]
  |  Branch (7025:13): [True: 0, False: 0]
  ------------------
 7026|      0|            if (dp->tdir_count != (uint64_t)fip->field_readcount)
  ------------------
  |  Branch (7026:17): [True: 0, False: 0]
  ------------------
 7027|      0|            {
 7028|      0|                TIFFWarningExtR(tif, module,
 7029|      0|                                "incorrect count for field \"%s\", expected "
 7030|      0|                                "%d, got %" PRIu64,
 7031|      0|                                fip->field_name, (int)fip->field_readcount,
 7032|      0|                                dp->tdir_count);
 7033|      0|                return (0);
 7034|      0|            }
 7035|      0|            else
 7036|      0|            {
 7037|      0|                err = TIFFReadDirEntryIfd8Array(tif, dp, &data);
 7038|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7038:21): [True: 0, False: 0]
  ------------------
 7039|      0|                {
 7040|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7040:25): [True: 0, False: 0]
  ------------------
 7041|      0|                    {
 7042|      0|                        if (data != 0)
  ------------------
  |  Branch (7042:29): [True: 0, False: 0]
  ------------------
 7043|      0|                            _TIFFfreeExt(tif, data);
 7044|      0|                        return 0;
 7045|      0|                    }
 7046|      0|                    int m;
 7047|      0|                    m = TIFFSetField(tif, dp->tdir_tag, data);
 7048|      0|                    if (data != 0)
  ------------------
  |  Branch (7048:25): [True: 0, False: 0]
  ------------------
 7049|      0|                        _TIFFfreeExt(tif, data);
 7050|      0|                    if (!m)
  ------------------
  |  Branch (7050:25): [True: 0, False: 0]
  ------------------
 7051|      0|                        return (0);
 7052|      0|                }
 7053|      0|            }
 7054|      0|        }
 7055|      0|        break;
 7056|     30|        case TIFF_SETGET_C16_ASCII:
  ------------------
  |  Branch (7056:9): [True: 30, False: 145k]
  ------------------
 7057|     30|        {
 7058|     30|            uint8_t *data;
 7059|     30|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7059:13): [True: 0, False: 30]
  |  Branch (7059:13): [True: 30, False: 0]
  ------------------
 7060|     30|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7060:13): [True: 0, False: 30]
  |  Branch (7060:13): [True: 30, False: 0]
  ------------------
 7061|     30|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7061:17): [True: 14, False: 16]
  ------------------
 7062|     14|                err = TIFFReadDirEntryErrCount;
 7063|     16|            else
 7064|     16|            {
 7065|     16|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7066|     16|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7066:21): [True: 12, False: 4]
  ------------------
 7067|     12|                {
 7068|     12|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7068:25): [True: 1, False: 11]
  ------------------
 7069|      1|                    {
 7070|      1|                        if (data != 0)
  ------------------
  |  Branch (7070:29): [True: 1, False: 0]
  ------------------
 7071|      1|                            _TIFFfreeExt(tif, data);
 7072|      1|                        return 0;
 7073|      1|                    }
 7074|     11|                    int m;
 7075|     11|                    if (data != 0 && dp->tdir_count > 0 &&
  ------------------
  |  Branch (7075:25): [True: 11, False: 0]
  |  Branch (7075:38): [True: 11, False: 0]
  ------------------
 7076|     11|                        data[dp->tdir_count - 1] != '\0')
  ------------------
  |  Branch (7076:25): [True: 5, False: 6]
  ------------------
 7077|      5|                    {
 7078|      5|                        TIFFWarningExtR(tif, module,
 7079|      5|                                        "ASCII value for ASCII array tag "
 7080|      5|                                        "\"%s\" does not end in null "
 7081|      5|                                        "byte. Forcing it to be null",
 7082|      5|                                        fip->field_name);
 7083|       |                        /* Enlarge buffer and add terminating null. */
 7084|      5|                        uint8_t *o = (uint8_t *)_TIFFmallocExt(
 7085|      5|                            tif, (uint32_t)dp->tdir_count + 1);
 7086|      5|                        if (o == NULL)
  ------------------
  |  Branch (7086:29): [True: 0, False: 5]
  ------------------
 7087|      0|                        {
 7088|      0|                            if (data != NULL)
  ------------------
  |  Branch (7088:33): [True: 0, False: 0]
  ------------------
 7089|      0|                                _TIFFfreeExt(tif, data);
 7090|      0|                            return (0);
 7091|      0|                        }
 7092|      5|                        if (dp->tdir_count > 0)
  ------------------
  |  Branch (7092:29): [True: 5, False: 0]
  ------------------
 7093|      5|                        {
 7094|      5|                            _TIFFmemcpy(o, data, (uint32_t)dp->tdir_count);
 7095|      5|                        }
 7096|      5|                        o[(uint32_t)dp->tdir_count] = 0;
 7097|      5|                        dp->tdir_count++; /* Increment for added null. */
 7098|      5|                        if (data != 0)
  ------------------
  |  Branch (7098:29): [True: 5, False: 0]
  ------------------
 7099|      5|                            _TIFFfreeExt(tif, data);
 7100|      5|                        data = o;
 7101|      5|                    }
 7102|     11|                    m = TIFFSetField(tif, dp->tdir_tag,
 7103|     11|                                     (uint16_t)(dp->tdir_count), data);
 7104|     11|                    if (data != 0)
  ------------------
  |  Branch (7104:25): [True: 11, False: 0]
  ------------------
 7105|     11|                        _TIFFfreeExt(tif, data);
 7106|     11|                    if (!m)
  ------------------
  |  Branch (7106:25): [True: 0, False: 11]
  ------------------
 7107|      0|                        return (0);
 7108|     11|                }
 7109|     16|            }
 7110|     30|        }
 7111|     29|        break;
 7112|     29|        case TIFF_SETGET_C16_UINT8:
  ------------------
  |  Branch (7112:9): [True: 17, False: 145k]
  ------------------
 7113|     17|        {
 7114|     17|            uint8_t *data;
 7115|     17|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7115:13): [True: 0, False: 17]
  |  Branch (7115:13): [True: 17, False: 0]
  ------------------
 7116|     17|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7116:13): [True: 0, False: 17]
  |  Branch (7116:13): [True: 17, False: 0]
  ------------------
 7117|     17|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7117:17): [True: 3, False: 14]
  ------------------
 7118|      3|                err = TIFFReadDirEntryErrCount;
 7119|     14|            else
 7120|     14|            {
 7121|     14|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7122|     14|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7122:21): [True: 8, False: 6]
  ------------------
 7123|      8|                {
 7124|      8|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7124:25): [True: 1, False: 7]
  ------------------
 7125|      1|                    {
 7126|      1|                        if (data != 0)
  ------------------
  |  Branch (7126:29): [True: 1, False: 0]
  ------------------
 7127|      1|                            _TIFFfreeExt(tif, data);
 7128|      1|                        return 0;
 7129|      1|                    }
 7130|      7|                    int m;
 7131|      7|                    m = TIFFSetField(tif, dp->tdir_tag,
 7132|      7|                                     (uint16_t)(dp->tdir_count), data);
 7133|      7|                    if (data != 0)
  ------------------
  |  Branch (7133:25): [True: 0, False: 7]
  ------------------
 7134|      0|                        _TIFFfreeExt(tif, data);
 7135|      7|                    if (!m)
  ------------------
  |  Branch (7135:25): [True: 0, False: 7]
  ------------------
 7136|      0|                        return (0);
 7137|      7|                }
 7138|     14|            }
 7139|     17|        }
 7140|     16|        break;
 7141|     16|        case TIFF_SETGET_C16_SINT8:
  ------------------
  |  Branch (7141:9): [True: 0, False: 145k]
  ------------------
 7142|      0|        {
 7143|      0|            int8_t *data;
 7144|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7144:13): [True: 0, False: 0]
  |  Branch (7144:13): [True: 0, False: 0]
  ------------------
 7145|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7145:13): [True: 0, False: 0]
  |  Branch (7145:13): [True: 0, False: 0]
  ------------------
 7146|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7146:17): [True: 0, False: 0]
  ------------------
 7147|      0|                err = TIFFReadDirEntryErrCount;
 7148|      0|            else
 7149|      0|            {
 7150|      0|                err = TIFFReadDirEntrySbyteArray(tif, dp, &data);
 7151|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7151:21): [True: 0, False: 0]
  ------------------
 7152|      0|                {
 7153|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7153:25): [True: 0, False: 0]
  ------------------
 7154|      0|                    {
 7155|      0|                        if (data != 0)
  ------------------
  |  Branch (7155:29): [True: 0, False: 0]
  ------------------
 7156|      0|                            _TIFFfreeExt(tif, data);
 7157|      0|                        return 0;
 7158|      0|                    }
 7159|      0|                    int m;
 7160|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7161|      0|                                     (uint16_t)(dp->tdir_count), data);
 7162|      0|                    if (data != 0)
  ------------------
  |  Branch (7162:25): [True: 0, False: 0]
  ------------------
 7163|      0|                        _TIFFfreeExt(tif, data);
 7164|      0|                    if (!m)
  ------------------
  |  Branch (7164:25): [True: 0, False: 0]
  ------------------
 7165|      0|                        return (0);
 7166|      0|                }
 7167|      0|            }
 7168|      0|        }
 7169|      0|        break;
 7170|    210|        case TIFF_SETGET_C16_UINT16:
  ------------------
  |  Branch (7170:9): [True: 210, False: 145k]
  ------------------
 7171|    210|        {
 7172|    210|            uint16_t *data;
 7173|    210|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7173:13): [True: 0, False: 210]
  |  Branch (7173:13): [True: 210, False: 0]
  ------------------
 7174|    210|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7174:13): [True: 0, False: 210]
  |  Branch (7174:13): [True: 210, False: 0]
  ------------------
 7175|    210|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7175:17): [True: 18, False: 192]
  ------------------
 7176|     18|                err = TIFFReadDirEntryErrCount;
 7177|    192|            else
 7178|    192|            {
 7179|    192|                err = TIFFReadDirEntryShortArray(tif, dp, &data);
 7180|    192|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7180:21): [True: 187, False: 5]
  ------------------
 7181|    187|                {
 7182|    187|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7182:25): [True: 0, False: 187]
  ------------------
 7183|      0|                    {
 7184|      0|                        if (data != 0)
  ------------------
  |  Branch (7184:29): [True: 0, False: 0]
  ------------------
 7185|      0|                            _TIFFfreeExt(tif, data);
 7186|      0|                        return 0;
 7187|      0|                    }
 7188|    187|                    int m;
 7189|    187|                    m = TIFFSetField(tif, dp->tdir_tag,
 7190|    187|                                     (uint16_t)(dp->tdir_count), data);
 7191|    187|                    if (data != 0)
  ------------------
  |  Branch (7191:25): [True: 187, False: 0]
  ------------------
 7192|    187|                        _TIFFfreeExt(tif, data);
 7193|    187|                    if (!m)
  ------------------
  |  Branch (7193:25): [True: 0, False: 187]
  ------------------
 7194|      0|                        return (0);
 7195|    187|                }
 7196|    192|            }
 7197|    210|        }
 7198|    210|        break;
 7199|    210|        case TIFF_SETGET_C16_SINT16:
  ------------------
  |  Branch (7199:9): [True: 0, False: 145k]
  ------------------
 7200|      0|        {
 7201|      0|            int16_t *data;
 7202|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7202:13): [True: 0, False: 0]
  |  Branch (7202:13): [True: 0, False: 0]
  ------------------
 7203|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7203:13): [True: 0, False: 0]
  |  Branch (7203:13): [True: 0, False: 0]
  ------------------
 7204|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7204:17): [True: 0, False: 0]
  ------------------
 7205|      0|                err = TIFFReadDirEntryErrCount;
 7206|      0|            else
 7207|      0|            {
 7208|      0|                err = TIFFReadDirEntrySshortArray(tif, dp, &data);
 7209|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7209:21): [True: 0, False: 0]
  ------------------
 7210|      0|                {
 7211|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7211:25): [True: 0, False: 0]
  ------------------
 7212|      0|                    {
 7213|      0|                        if (data != 0)
  ------------------
  |  Branch (7213:29): [True: 0, False: 0]
  ------------------
 7214|      0|                            _TIFFfreeExt(tif, data);
 7215|      0|                        return 0;
 7216|      0|                    }
 7217|      0|                    int m;
 7218|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7219|      0|                                     (uint16_t)(dp->tdir_count), data);
 7220|      0|                    if (data != 0)
  ------------------
  |  Branch (7220:25): [True: 0, False: 0]
  ------------------
 7221|      0|                        _TIFFfreeExt(tif, data);
 7222|      0|                    if (!m)
  ------------------
  |  Branch (7222:25): [True: 0, False: 0]
  ------------------
 7223|      0|                        return (0);
 7224|      0|                }
 7225|      0|            }
 7226|      0|        }
 7227|      0|        break;
 7228|    161|        case TIFF_SETGET_C16_UINT32:
  ------------------
  |  Branch (7228:9): [True: 161, False: 145k]
  ------------------
 7229|    161|        {
 7230|    161|            uint32_t *data;
 7231|    161|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7231:13): [True: 0, False: 161]
  |  Branch (7231:13): [True: 161, False: 0]
  ------------------
 7232|    161|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7232:13): [True: 0, False: 161]
  |  Branch (7232:13): [True: 161, False: 0]
  ------------------
 7233|    161|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7233:17): [True: 39, False: 122]
  ------------------
 7234|     39|                err = TIFFReadDirEntryErrCount;
 7235|    122|            else
 7236|    122|            {
 7237|    122|                err = TIFFReadDirEntryLongArray(tif, dp, &data);
 7238|    122|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7238:21): [True: 36, False: 86]
  ------------------
 7239|     36|                {
 7240|     36|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7240:25): [True: 0, False: 36]
  ------------------
 7241|      0|                    {
 7242|      0|                        if (data != 0)
  ------------------
  |  Branch (7242:29): [True: 0, False: 0]
  ------------------
 7243|      0|                            _TIFFfreeExt(tif, data);
 7244|      0|                        return 0;
 7245|      0|                    }
 7246|     36|                    int m;
 7247|     36|                    m = TIFFSetField(tif, dp->tdir_tag,
 7248|     36|                                     (uint16_t)(dp->tdir_count), data);
 7249|     36|                    if (data != 0)
  ------------------
  |  Branch (7249:25): [True: 36, False: 0]
  ------------------
 7250|     36|                        _TIFFfreeExt(tif, data);
 7251|     36|                    if (!m)
  ------------------
  |  Branch (7251:25): [True: 0, False: 36]
  ------------------
 7252|      0|                        return (0);
 7253|     36|                }
 7254|    122|            }
 7255|    161|        }
 7256|    161|        break;
 7257|    161|        case TIFF_SETGET_C16_SINT32:
  ------------------
  |  Branch (7257:9): [True: 0, False: 145k]
  ------------------
 7258|      0|        {
 7259|      0|            int32_t *data;
 7260|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7260:13): [True: 0, False: 0]
  |  Branch (7260:13): [True: 0, False: 0]
  ------------------
 7261|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7261:13): [True: 0, False: 0]
  |  Branch (7261:13): [True: 0, False: 0]
  ------------------
 7262|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7262:17): [True: 0, False: 0]
  ------------------
 7263|      0|                err = TIFFReadDirEntryErrCount;
 7264|      0|            else
 7265|      0|            {
 7266|      0|                err = TIFFReadDirEntrySlongArray(tif, dp, &data);
 7267|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7267:21): [True: 0, False: 0]
  ------------------
 7268|      0|                {
 7269|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7269:25): [True: 0, False: 0]
  ------------------
 7270|      0|                    {
 7271|      0|                        if (data != 0)
  ------------------
  |  Branch (7271:29): [True: 0, False: 0]
  ------------------
 7272|      0|                            _TIFFfreeExt(tif, data);
 7273|      0|                        return 0;
 7274|      0|                    }
 7275|      0|                    int m;
 7276|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7277|      0|                                     (uint16_t)(dp->tdir_count), data);
 7278|      0|                    if (data != 0)
  ------------------
  |  Branch (7278:25): [True: 0, False: 0]
  ------------------
 7279|      0|                        _TIFFfreeExt(tif, data);
 7280|      0|                    if (!m)
  ------------------
  |  Branch (7280:25): [True: 0, False: 0]
  ------------------
 7281|      0|                        return (0);
 7282|      0|                }
 7283|      0|            }
 7284|      0|        }
 7285|      0|        break;
 7286|      0|        case TIFF_SETGET_C16_UINT64:
  ------------------
  |  Branch (7286:9): [True: 0, False: 145k]
  ------------------
 7287|      0|        {
 7288|      0|            uint64_t *data;
 7289|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7289:13): [True: 0, False: 0]
  |  Branch (7289:13): [True: 0, False: 0]
  ------------------
 7290|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7290:13): [True: 0, False: 0]
  |  Branch (7290:13): [True: 0, False: 0]
  ------------------
 7291|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7291:17): [True: 0, False: 0]
  ------------------
 7292|      0|                err = TIFFReadDirEntryErrCount;
 7293|      0|            else
 7294|      0|            {
 7295|      0|                err = TIFFReadDirEntryLong8Array(tif, dp, &data);
 7296|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7296:21): [True: 0, False: 0]
  ------------------
 7297|      0|                {
 7298|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7298:25): [True: 0, False: 0]
  ------------------
 7299|      0|                    {
 7300|      0|                        if (data != 0)
  ------------------
  |  Branch (7300:29): [True: 0, False: 0]
  ------------------
 7301|      0|                            _TIFFfreeExt(tif, data);
 7302|      0|                        return 0;
 7303|      0|                    }
 7304|      0|                    int m;
 7305|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7306|      0|                                     (uint16_t)(dp->tdir_count), data);
 7307|      0|                    if (data != 0)
  ------------------
  |  Branch (7307:25): [True: 0, False: 0]
  ------------------
 7308|      0|                        _TIFFfreeExt(tif, data);
 7309|      0|                    if (!m)
  ------------------
  |  Branch (7309:25): [True: 0, False: 0]
  ------------------
 7310|      0|                        return (0);
 7311|      0|                }
 7312|      0|            }
 7313|      0|        }
 7314|      0|        break;
 7315|      0|        case TIFF_SETGET_C16_SINT64:
  ------------------
  |  Branch (7315:9): [True: 0, False: 145k]
  ------------------
 7316|      0|        {
 7317|      0|            int64_t *data;
 7318|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7318:13): [True: 0, False: 0]
  |  Branch (7318:13): [True: 0, False: 0]
  ------------------
 7319|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7319:13): [True: 0, False: 0]
  |  Branch (7319:13): [True: 0, False: 0]
  ------------------
 7320|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7320:17): [True: 0, False: 0]
  ------------------
 7321|      0|                err = TIFFReadDirEntryErrCount;
 7322|      0|            else
 7323|      0|            {
 7324|      0|                err = TIFFReadDirEntrySlong8Array(tif, dp, &data);
 7325|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7325:21): [True: 0, False: 0]
  ------------------
 7326|      0|                {
 7327|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7327:25): [True: 0, False: 0]
  ------------------
 7328|      0|                    {
 7329|      0|                        if (data != 0)
  ------------------
  |  Branch (7329:29): [True: 0, False: 0]
  ------------------
 7330|      0|                            _TIFFfreeExt(tif, data);
 7331|      0|                        return 0;
 7332|      0|                    }
 7333|      0|                    int m;
 7334|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7335|      0|                                     (uint16_t)(dp->tdir_count), data);
 7336|      0|                    if (data != 0)
  ------------------
  |  Branch (7336:25): [True: 0, False: 0]
  ------------------
 7337|      0|                        _TIFFfreeExt(tif, data);
 7338|      0|                    if (!m)
  ------------------
  |  Branch (7338:25): [True: 0, False: 0]
  ------------------
 7339|      0|                        return (0);
 7340|      0|                }
 7341|      0|            }
 7342|      0|        }
 7343|      0|        break;
 7344|    228|        case TIFF_SETGET_C16_FLOAT:
  ------------------
  |  Branch (7344:9): [True: 228, False: 145k]
  ------------------
 7345|    228|        {
 7346|    228|            float *data;
 7347|    228|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7347:13): [True: 0, False: 228]
  |  Branch (7347:13): [True: 228, False: 0]
  ------------------
 7348|    228|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7348:13): [True: 0, False: 228]
  |  Branch (7348:13): [True: 228, False: 0]
  ------------------
 7349|    228|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7349:17): [True: 26, False: 202]
  ------------------
 7350|     26|                err = TIFFReadDirEntryErrCount;
 7351|    202|            else
 7352|    202|            {
 7353|    202|                err = TIFFReadDirEntryFloatArray(tif, dp, &data);
 7354|    202|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7354:21): [True: 116, False: 86]
  ------------------
 7355|    116|                {
 7356|    116|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7356:25): [True: 0, False: 116]
  ------------------
 7357|      0|                    {
 7358|      0|                        if (data != 0)
  ------------------
  |  Branch (7358:29): [True: 0, False: 0]
  ------------------
 7359|      0|                            _TIFFfreeExt(tif, data);
 7360|      0|                        return 0;
 7361|      0|                    }
 7362|    116|                    int m;
 7363|    116|                    m = TIFFSetField(tif, dp->tdir_tag,
 7364|    116|                                     (uint16_t)(dp->tdir_count), data);
 7365|    116|                    if (data != 0)
  ------------------
  |  Branch (7365:25): [True: 115, False: 1]
  ------------------
 7366|    115|                        _TIFFfreeExt(tif, data);
 7367|    116|                    if (!m)
  ------------------
  |  Branch (7367:25): [True: 0, False: 116]
  ------------------
 7368|      0|                        return (0);
 7369|    116|                }
 7370|    202|            }
 7371|    228|        }
 7372|    228|        break;
 7373|    228|        case TIFF_SETGET_C16_DOUBLE:
  ------------------
  |  Branch (7373:9): [True: 0, False: 145k]
  ------------------
 7374|      0|        {
 7375|      0|            double *data;
 7376|      0|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7376:13): [True: 0, False: 0]
  |  Branch (7376:13): [True: 0, False: 0]
  ------------------
 7377|      0|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7377:13): [True: 0, False: 0]
  |  Branch (7377:13): [True: 0, False: 0]
  ------------------
 7378|      0|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7378:17): [True: 0, False: 0]
  ------------------
 7379|      0|                err = TIFFReadDirEntryErrCount;
 7380|      0|            else
 7381|      0|            {
 7382|      0|                err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
 7383|      0|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7383:21): [True: 0, False: 0]
  ------------------
 7384|      0|                {
 7385|      0|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7385:25): [True: 0, False: 0]
  ------------------
 7386|      0|                    {
 7387|      0|                        if (data != 0)
  ------------------
  |  Branch (7387:29): [True: 0, False: 0]
  ------------------
 7388|      0|                            _TIFFfreeExt(tif, data);
 7389|      0|                        return 0;
 7390|      0|                    }
 7391|      0|                    int m;
 7392|      0|                    m = TIFFSetField(tif, dp->tdir_tag,
 7393|      0|                                     (uint16_t)(dp->tdir_count), data);
 7394|      0|                    if (data != 0)
  ------------------
  |  Branch (7394:25): [True: 0, False: 0]
  ------------------
 7395|      0|                        _TIFFfreeExt(tif, data);
 7396|      0|                    if (!m)
  ------------------
  |  Branch (7396:25): [True: 0, False: 0]
  ------------------
 7397|      0|                        return (0);
 7398|      0|                }
 7399|      0|            }
 7400|      0|        }
 7401|      0|        break;
 7402|     44|        case TIFF_SETGET_C16_IFD8:
  ------------------
  |  Branch (7402:9): [True: 44, False: 145k]
  ------------------
 7403|     44|        {
 7404|     44|            uint64_t *data;
 7405|     44|            assert(fip->field_readcount == TIFF_VARIABLE);
  ------------------
  |  Branch (7405:13): [True: 0, False: 44]
  |  Branch (7405:13): [True: 44, False: 0]
  ------------------
 7406|     44|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7406:13): [True: 0, False: 44]
  |  Branch (7406:13): [True: 44, False: 0]
  ------------------
 7407|     44|            if (dp->tdir_count > 0xFFFF)
  ------------------
  |  Branch (7407:17): [True: 34, False: 10]
  ------------------
 7408|     34|                err = TIFFReadDirEntryErrCount;
 7409|     10|            else
 7410|     10|            {
 7411|     10|                err = TIFFReadDirEntryIfd8Array(tif, dp, &data);
 7412|     10|                if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7412:21): [True: 3, False: 7]
  ------------------
 7413|      3|                {
 7414|      3|                    if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7414:25): [True: 0, False: 3]
  ------------------
 7415|      0|                    {
 7416|      0|                        if (data != 0)
  ------------------
  |  Branch (7416:29): [True: 0, False: 0]
  ------------------
 7417|      0|                            _TIFFfreeExt(tif, data);
 7418|      0|                        return 0;
 7419|      0|                    }
 7420|      3|                    int m;
 7421|      3|                    m = TIFFSetField(tif, dp->tdir_tag,
 7422|      3|                                     (uint16_t)(dp->tdir_count), data);
 7423|      3|                    if (data != 0)
  ------------------
  |  Branch (7423:25): [True: 2, False: 1]
  ------------------
 7424|      2|                        _TIFFfreeExt(tif, data);
 7425|      3|                    if (!m)
  ------------------
  |  Branch (7425:25): [True: 0, False: 3]
  ------------------
 7426|      0|                        return (0);
 7427|      3|                }
 7428|     10|            }
 7429|     44|        }
 7430|     44|        break;
 7431|  6.17k|        case TIFF_SETGET_C32_ASCII:
  ------------------
  |  Branch (7431:9): [True: 6.17k, False: 139k]
  ------------------
 7432|  6.17k|        {
 7433|  6.17k|            uint8_t *data;
 7434|  6.17k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7434:13): [True: 0, False: 6.17k]
  |  Branch (7434:13): [True: 6.17k, False: 0]
  ------------------
 7435|  6.17k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7435:13): [True: 0, False: 6.17k]
  |  Branch (7435:13): [True: 6.17k, False: 0]
  ------------------
 7436|  6.17k|            err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7437|  6.17k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7437:17): [True: 3.06k, False: 3.11k]
  ------------------
 7438|  3.06k|            {
 7439|  3.06k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7439:21): [True: 12, False: 3.04k]
  ------------------
 7440|     12|                {
 7441|     12|                    if (data != 0)
  ------------------
  |  Branch (7441:25): [True: 12, False: 0]
  ------------------
 7442|     12|                        _TIFFfreeExt(tif, data);
 7443|     12|                    return 0;
 7444|     12|                }
 7445|  3.04k|                int m;
 7446|  3.04k|                if (data != 0 && dp->tdir_count > 0 &&
  ------------------
  |  Branch (7446:21): [True: 3.00k, False: 42]
  |  Branch (7446:34): [True: 3.00k, False: 0]
  ------------------
 7447|  3.00k|                    data[dp->tdir_count - 1] != '\0')
  ------------------
  |  Branch (7447:21): [True: 1.89k, False: 1.11k]
  ------------------
 7448|  1.89k|                {
 7449|  1.89k|                    TIFFWarningExtR(
 7450|  1.89k|                        tif, module,
 7451|  1.89k|                        "ASCII value for ASCII array tag \"%s\" does not end "
 7452|  1.89k|                        "in null byte. Forcing it to be null",
 7453|  1.89k|                        fip->field_name);
 7454|       |                    /* Enlarge buffer and add terminating null. */
 7455|  1.89k|                    uint8_t *o = (uint8_t *)_TIFFmallocExt(
 7456|  1.89k|                        tif, (uint32_t)dp->tdir_count + 1);
 7457|  1.89k|                    if (o == NULL)
  ------------------
  |  Branch (7457:25): [True: 0, False: 1.89k]
  ------------------
 7458|      0|                    {
 7459|      0|                        if (data != NULL)
  ------------------
  |  Branch (7459:29): [True: 0, False: 0]
  ------------------
 7460|      0|                            _TIFFfreeExt(tif, data);
 7461|      0|                        return (0);
 7462|      0|                    }
 7463|  1.89k|                    if (dp->tdir_count > 0)
  ------------------
  |  Branch (7463:25): [True: 1.89k, False: 0]
  ------------------
 7464|  1.89k|                    {
 7465|  1.89k|                        _TIFFmemcpy(o, data, (uint32_t)dp->tdir_count);
 7466|  1.89k|                    }
 7467|  1.89k|                    o[(uint32_t)dp->tdir_count] = 0;
 7468|  1.89k|                    dp->tdir_count++; /* Increment for added null. */
 7469|  1.89k|                    if (data != 0)
  ------------------
  |  Branch (7469:25): [True: 1.89k, False: 0]
  ------------------
 7470|  1.89k|                        _TIFFfreeExt(tif, data);
 7471|  1.89k|                    data = o;
 7472|  1.89k|                }
 7473|  3.04k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7474|  3.04k|                                 data);
 7475|  3.04k|                if (data != 0)
  ------------------
  |  Branch (7475:21): [True: 3.00k, False: 42]
  ------------------
 7476|  3.00k|                    _TIFFfreeExt(tif, data);
 7477|  3.04k|                if (!m)
  ------------------
  |  Branch (7477:21): [True: 0, False: 3.04k]
  ------------------
 7478|      0|                    return (0);
 7479|  3.04k|            }
 7480|  6.17k|        }
 7481|  6.16k|        break;
 7482|  6.16k|        case TIFF_SETGET_C32_UINT8:
  ------------------
  |  Branch (7482:9): [True: 4.55k, False: 141k]
  ------------------
 7483|  4.55k|        {
 7484|  4.55k|            uint8_t *data;
 7485|  4.55k|            uint32_t count = 0;
 7486|  4.55k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7486:13): [True: 0, False: 4.55k]
  |  Branch (7486:13): [True: 4.55k, False: 0]
  ------------------
 7487|  4.55k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7487:13): [True: 0, False: 4.55k]
  |  Branch (7487:13): [True: 4.55k, False: 0]
  ------------------
 7488|  4.55k|            if (fip->field_tag == TIFFTAG_RICHTIFFIPTC &&
  ------------------
  |  |  448|  9.10k|#define TIFFTAG_RICHTIFFIPTC 33723
  ------------------
  |  Branch (7488:17): [True: 1, False: 4.55k]
  ------------------
 7489|      1|                dp->tdir_type == TIFF_LONG)
  ------------------
  |  Branch (7489:17): [True: 0, False: 1]
  ------------------
 7490|      0|            {
 7491|       |                /* Adobe's software (wrongly) writes RichTIFFIPTC tag with
 7492|       |                 * data type LONG instead of UNDEFINED. Work around this
 7493|       |                 * frequently found issue */
 7494|      0|                void *origdata;
 7495|      0|                err = TIFFReadDirEntryArray(tif, dp, &count, 4, &origdata);
 7496|      0|                if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (7496:21): [True: 0, False: 0]
  |  Branch (7496:55): [True: 0, False: 0]
  ------------------
 7497|      0|                {
 7498|      0|                    data = NULL;
 7499|      0|                }
 7500|      0|                else
 7501|      0|                {
 7502|      0|                    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (7502:25): [True: 0, False: 0]
  ------------------
 7503|      0|                        TIFFSwabArrayOfLong((uint32_t *)origdata, count);
 7504|      0|                    data = (uint8_t *)origdata;
 7505|      0|                    count = (uint32_t)(count * 4);
 7506|      0|                }
 7507|      0|            }
 7508|  4.55k|            else
 7509|  4.55k|            {
 7510|  4.55k|                err = TIFFReadDirEntryByteArray(tif, dp, &data);
 7511|  4.55k|                count = (uint32_t)(dp->tdir_count);
 7512|  4.55k|            }
 7513|  4.55k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7513:17): [True: 2.73k, False: 1.81k]
  ------------------
 7514|  2.73k|            {
 7515|  2.73k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7515:21): [True: 9, False: 2.73k]
  ------------------
 7516|      9|                {
 7517|      9|                    if (data != 0)
  ------------------
  |  Branch (7517:25): [True: 9, False: 0]
  ------------------
 7518|      9|                        _TIFFfreeExt(tif, data);
 7519|      9|                    return 0;
 7520|      9|                }
 7521|  2.73k|                int m;
 7522|  2.73k|                m = TIFFSetField(tif, dp->tdir_tag, count, data);
 7523|  2.73k|                if (data != 0)
  ------------------
  |  Branch (7523:21): [True: 1.39k, False: 1.33k]
  ------------------
 7524|  1.39k|                    _TIFFfreeExt(tif, data);
 7525|  2.73k|                if (!m)
  ------------------
  |  Branch (7525:21): [True: 18, False: 2.71k]
  ------------------
 7526|     18|                    return (0);
 7527|  2.73k|            }
 7528|  4.55k|        }
 7529|  4.52k|        break;
 7530|  4.52k|        case TIFF_SETGET_C32_SINT8:
  ------------------
  |  Branch (7530:9): [True: 476, False: 145k]
  ------------------
 7531|    476|        {
 7532|    476|            int8_t *data = NULL;
 7533|    476|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7533:13): [True: 0, False: 476]
  |  Branch (7533:13): [True: 476, False: 0]
  ------------------
 7534|    476|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7534:13): [True: 0, False: 476]
  |  Branch (7534:13): [True: 476, False: 0]
  ------------------
 7535|    476|            err = TIFFReadDirEntrySbyteArray(tif, dp, &data);
 7536|    476|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7536:17): [True: 59, False: 417]
  ------------------
 7537|     59|            {
 7538|     59|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7538:21): [True: 10, False: 49]
  ------------------
 7539|     10|                {
 7540|     10|                    if (data != 0)
  ------------------
  |  Branch (7540:25): [True: 10, False: 0]
  ------------------
 7541|     10|                        _TIFFfreeExt(tif, data);
 7542|     10|                    return 0;
 7543|     10|                }
 7544|     49|                int m;
 7545|     49|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7546|     49|                                 data);
 7547|     49|                if (data != 0)
  ------------------
  |  Branch (7547:21): [True: 40, False: 9]
  ------------------
 7548|     40|                    _TIFFfreeExt(tif, data);
 7549|     49|                if (!m)
  ------------------
  |  Branch (7549:21): [True: 0, False: 49]
  ------------------
 7550|      0|                    return (0);
 7551|     49|            }
 7552|    476|        }
 7553|    466|        break;
 7554|  4.06k|        case TIFF_SETGET_C32_UINT16:
  ------------------
  |  Branch (7554:9): [True: 4.06k, False: 141k]
  ------------------
 7555|  4.06k|        {
 7556|  4.06k|            uint16_t *data;
 7557|  4.06k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7557:13): [True: 0, False: 4.06k]
  |  Branch (7557:13): [True: 4.06k, False: 0]
  ------------------
 7558|  4.06k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7558:13): [True: 0, False: 4.06k]
  |  Branch (7558:13): [True: 4.06k, False: 0]
  ------------------
 7559|  4.06k|            err = TIFFReadDirEntryShortArray(tif, dp, &data);
 7560|  4.06k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7560:17): [True: 2.36k, False: 1.69k]
  ------------------
 7561|  2.36k|            {
 7562|  2.36k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7562:21): [True: 9, False: 2.35k]
  ------------------
 7563|      9|                {
 7564|      9|                    if (data != 0)
  ------------------
  |  Branch (7564:25): [True: 9, False: 0]
  ------------------
 7565|      9|                        _TIFFfreeExt(tif, data);
 7566|      9|                    return 0;
 7567|      9|                }
 7568|  2.35k|                int m;
 7569|  2.35k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7570|  2.35k|                                 data);
 7571|  2.35k|                if (data != 0)
  ------------------
  |  Branch (7571:21): [True: 2.29k, False: 68]
  ------------------
 7572|  2.29k|                    _TIFFfreeExt(tif, data);
 7573|  2.35k|                if (!m)
  ------------------
  |  Branch (7573:21): [True: 0, False: 2.35k]
  ------------------
 7574|      0|                    return (0);
 7575|  2.35k|            }
 7576|  4.06k|        }
 7577|  4.05k|        break;
 7578|  4.05k|        case TIFF_SETGET_C32_SINT16:
  ------------------
  |  Branch (7578:9): [True: 512, False: 145k]
  ------------------
 7579|    512|        {
 7580|    512|            int16_t *data = NULL;
 7581|    512|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7581:13): [True: 0, False: 512]
  |  Branch (7581:13): [True: 512, False: 0]
  ------------------
 7582|    512|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7582:13): [True: 0, False: 512]
  |  Branch (7582:13): [True: 512, False: 0]
  ------------------
 7583|    512|            err = TIFFReadDirEntrySshortArray(tif, dp, &data);
 7584|    512|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7584:17): [True: 122, False: 390]
  ------------------
 7585|    122|            {
 7586|    122|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7586:21): [True: 10, False: 112]
  ------------------
 7587|     10|                {
 7588|     10|                    if (data != 0)
  ------------------
  |  Branch (7588:25): [True: 10, False: 0]
  ------------------
 7589|     10|                        _TIFFfreeExt(tif, data);
 7590|     10|                    return 0;
 7591|     10|                }
 7592|    112|                int m;
 7593|    112|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7594|    112|                                 data);
 7595|    112|                if (data != 0)
  ------------------
  |  Branch (7595:21): [True: 103, False: 9]
  ------------------
 7596|    103|                    _TIFFfreeExt(tif, data);
 7597|    112|                if (!m)
  ------------------
  |  Branch (7597:21): [True: 0, False: 112]
  ------------------
 7598|      0|                    return (0);
 7599|    112|            }
 7600|    512|        }
 7601|    502|        break;
 7602|  1.27k|        case TIFF_SETGET_C32_UINT32:
  ------------------
  |  Branch (7602:9): [True: 1.27k, False: 144k]
  ------------------
 7603|  1.27k|        {
 7604|  1.27k|            uint32_t *data;
 7605|  1.27k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7605:13): [True: 0, False: 1.27k]
  |  Branch (7605:13): [True: 1.27k, False: 0]
  ------------------
 7606|  1.27k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7606:13): [True: 0, False: 1.27k]
  |  Branch (7606:13): [True: 1.27k, False: 0]
  ------------------
 7607|  1.27k|            err = TIFFReadDirEntryLongArray(tif, dp, &data);
 7608|  1.27k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7608:17): [True: 272, False: 1.00k]
  ------------------
 7609|    272|            {
 7610|    272|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7610:21): [True: 0, False: 272]
  ------------------
 7611|      0|                {
 7612|      0|                    if (data != 0)
  ------------------
  |  Branch (7612:25): [True: 0, False: 0]
  ------------------
 7613|      0|                        _TIFFfreeExt(tif, data);
 7614|      0|                    return 0;
 7615|      0|                }
 7616|    272|                int m;
 7617|    272|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7618|    272|                                 data);
 7619|    272|                if (data != 0)
  ------------------
  |  Branch (7619:21): [True: 107, False: 165]
  ------------------
 7620|    107|                    _TIFFfreeExt(tif, data);
 7621|    272|                if (!m)
  ------------------
  |  Branch (7621:21): [True: 0, False: 272]
  ------------------
 7622|      0|                    return (0);
 7623|    272|            }
 7624|  1.27k|        }
 7625|  1.27k|        break;
 7626|  1.27k|        case TIFF_SETGET_C32_SINT32:
  ------------------
  |  Branch (7626:9): [True: 309, False: 145k]
  ------------------
 7627|    309|        {
 7628|    309|            int32_t *data = NULL;
 7629|    309|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7629:13): [True: 0, False: 309]
  |  Branch (7629:13): [True: 309, False: 0]
  ------------------
 7630|    309|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7630:13): [True: 0, False: 309]
  |  Branch (7630:13): [True: 309, False: 0]
  ------------------
 7631|    309|            err = TIFFReadDirEntrySlongArray(tif, dp, &data);
 7632|    309|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7632:17): [True: 50, False: 259]
  ------------------
 7633|     50|            {
 7634|     50|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7634:21): [True: 0, False: 50]
  ------------------
 7635|      0|                {
 7636|      0|                    if (data != 0)
  ------------------
  |  Branch (7636:25): [True: 0, False: 0]
  ------------------
 7637|      0|                        _TIFFfreeExt(tif, data);
 7638|      0|                    return 0;
 7639|      0|                }
 7640|     50|                int m;
 7641|     50|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7642|     50|                                 data);
 7643|     50|                if (data != 0)
  ------------------
  |  Branch (7643:21): [True: 11, False: 39]
  ------------------
 7644|     11|                    _TIFFfreeExt(tif, data);
 7645|     50|                if (!m)
  ------------------
  |  Branch (7645:21): [True: 0, False: 50]
  ------------------
 7646|      0|                    return (0);
 7647|     50|            }
 7648|    309|        }
 7649|    309|        break;
 7650|  2.62k|        case TIFF_SETGET_C32_UINT64:
  ------------------
  |  Branch (7650:9): [True: 2.62k, False: 143k]
  ------------------
 7651|  2.62k|        {
 7652|  2.62k|            uint64_t *data;
 7653|  2.62k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7653:13): [True: 0, False: 2.62k]
  |  Branch (7653:13): [True: 2.62k, False: 0]
  ------------------
 7654|  2.62k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7654:13): [True: 0, False: 2.62k]
  |  Branch (7654:13): [True: 2.62k, False: 0]
  ------------------
 7655|  2.62k|            err = TIFFReadDirEntryLong8Array(tif, dp, &data);
 7656|  2.62k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7656:17): [True: 2.46k, False: 163]
  ------------------
 7657|  2.46k|            {
 7658|  2.46k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7658:21): [True: 7, False: 2.45k]
  ------------------
 7659|      7|                {
 7660|      7|                    if (data != 0)
  ------------------
  |  Branch (7660:25): [True: 7, False: 0]
  ------------------
 7661|      7|                        _TIFFfreeExt(tif, data);
 7662|      7|                    return 0;
 7663|      7|                }
 7664|  2.45k|                int m;
 7665|  2.45k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7666|  2.45k|                                 data);
 7667|  2.45k|                if (data != 0)
  ------------------
  |  Branch (7667:21): [True: 2.44k, False: 14]
  ------------------
 7668|  2.44k|                    _TIFFfreeExt(tif, data);
 7669|  2.45k|                if (!m)
  ------------------
  |  Branch (7669:21): [True: 21, False: 2.43k]
  ------------------
 7670|     21|                    return (0);
 7671|  2.45k|            }
 7672|  2.62k|        }
 7673|  2.59k|        break;
 7674|  2.59k|        case TIFF_SETGET_C32_SINT64:
  ------------------
  |  Branch (7674:9): [True: 265, False: 145k]
  ------------------
 7675|    265|        {
 7676|    265|            int64_t *data = NULL;
 7677|    265|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7677:13): [True: 0, False: 265]
  |  Branch (7677:13): [True: 265, False: 0]
  ------------------
 7678|    265|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7678:13): [True: 0, False: 265]
  |  Branch (7678:13): [True: 265, False: 0]
  ------------------
 7679|    265|            err = TIFFReadDirEntrySlong8Array(tif, dp, &data);
 7680|    265|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7680:17): [True: 137, False: 128]
  ------------------
 7681|    137|            {
 7682|    137|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7682:21): [True: 0, False: 137]
  ------------------
 7683|      0|                {
 7684|      0|                    if (data != 0)
  ------------------
  |  Branch (7684:25): [True: 0, False: 0]
  ------------------
 7685|      0|                        _TIFFfreeExt(tif, data);
 7686|      0|                    return 0;
 7687|      0|                }
 7688|    137|                int m;
 7689|    137|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7690|    137|                                 data);
 7691|    137|                if (data != 0)
  ------------------
  |  Branch (7691:21): [True: 101, False: 36]
  ------------------
 7692|    101|                    _TIFFfreeExt(tif, data);
 7693|    137|                if (!m)
  ------------------
  |  Branch (7693:21): [True: 82, False: 55]
  ------------------
 7694|     82|                    return (0);
 7695|    137|            }
 7696|    265|        }
 7697|    183|        break;
 7698|  1.19k|        case TIFF_SETGET_C32_FLOAT:
  ------------------
  |  Branch (7698:9): [True: 1.19k, False: 144k]
  ------------------
 7699|  1.19k|        {
 7700|  1.19k|            float *data;
 7701|  1.19k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7701:13): [True: 0, False: 1.19k]
  |  Branch (7701:13): [True: 1.19k, False: 0]
  ------------------
 7702|  1.19k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7702:13): [True: 0, False: 1.19k]
  |  Branch (7702:13): [True: 1.19k, False: 0]
  ------------------
 7703|  1.19k|            err = TIFFReadDirEntryFloatArray(tif, dp, &data);
 7704|  1.19k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7704:17): [True: 218, False: 977]
  ------------------
 7705|    218|            {
 7706|    218|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7706:21): [True: 0, False: 218]
  ------------------
 7707|      0|                {
 7708|      0|                    if (data != 0)
  ------------------
  |  Branch (7708:25): [True: 0, False: 0]
  ------------------
 7709|      0|                        _TIFFfreeExt(tif, data);
 7710|      0|                    return 0;
 7711|      0|                }
 7712|    218|                int m;
 7713|    218|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7714|    218|                                 data);
 7715|    218|                if (data != 0)
  ------------------
  |  Branch (7715:21): [True: 205, False: 13]
  ------------------
 7716|    205|                    _TIFFfreeExt(tif, data);
 7717|    218|                if (!m)
  ------------------
  |  Branch (7717:21): [True: 0, False: 218]
  ------------------
 7718|      0|                    return (0);
 7719|    218|            }
 7720|  1.19k|        }
 7721|  1.19k|        break;
 7722|  2.73k|        case TIFF_SETGET_C32_DOUBLE:
  ------------------
  |  Branch (7722:9): [True: 2.73k, False: 143k]
  ------------------
 7723|  2.73k|        {
 7724|  2.73k|            double *data;
 7725|  2.73k|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7725:13): [True: 0, False: 2.73k]
  |  Branch (7725:13): [True: 2.73k, False: 0]
  ------------------
 7726|  2.73k|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7726:13): [True: 0, False: 2.73k]
  |  Branch (7726:13): [True: 2.73k, False: 0]
  ------------------
 7727|  2.73k|            err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
 7728|  2.73k|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7728:17): [True: 2.33k, False: 404]
  ------------------
 7729|  2.33k|            {
 7730|  2.33k|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7730:21): [True: 0, False: 2.33k]
  ------------------
 7731|      0|                {
 7732|      0|                    if (data != 0)
  ------------------
  |  Branch (7732:25): [True: 0, False: 0]
  ------------------
 7733|      0|                        _TIFFfreeExt(tif, data);
 7734|      0|                    return 0;
 7735|      0|                }
 7736|  2.33k|                int m;
 7737|  2.33k|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7738|  2.33k|                                 data);
 7739|  2.33k|                if (data != 0)
  ------------------
  |  Branch (7739:21): [True: 2.20k, False: 133]
  ------------------
 7740|  2.20k|                    _TIFFfreeExt(tif, data);
 7741|  2.33k|                if (!m)
  ------------------
  |  Branch (7741:21): [True: 0, False: 2.33k]
  ------------------
 7742|      0|                    return (0);
 7743|  2.33k|            }
 7744|  2.73k|        }
 7745|  2.73k|        break;
 7746|  2.73k|        case TIFF_SETGET_C32_IFD8:
  ------------------
  |  Branch (7746:9): [True: 187, False: 145k]
  ------------------
 7747|    187|        {
 7748|    187|            uint64_t *data;
 7749|    187|            assert(fip->field_readcount == TIFF_VARIABLE2);
  ------------------
  |  Branch (7749:13): [True: 0, False: 187]
  |  Branch (7749:13): [True: 187, False: 0]
  ------------------
 7750|    187|            assert(fip->field_passcount == 1);
  ------------------
  |  Branch (7750:13): [True: 0, False: 187]
  |  Branch (7750:13): [True: 187, False: 0]
  ------------------
 7751|    187|            err = TIFFReadDirEntryIfd8Array(tif, dp, &data);
 7752|    187|            if (err == TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7752:17): [True: 47, False: 140]
  ------------------
 7753|     47|            {
 7754|     47|                if (!EvaluateIFDdatasizeReading(tif, dp))
  ------------------
  |  Branch (7754:21): [True: 0, False: 47]
  ------------------
 7755|      0|                {
 7756|      0|                    if (data != 0)
  ------------------
  |  Branch (7756:25): [True: 0, False: 0]
  ------------------
 7757|      0|                        _TIFFfreeExt(tif, data);
 7758|      0|                    return 0;
 7759|      0|                }
 7760|     47|                int m;
 7761|     47|                m = TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count),
 7762|     47|                                 data);
 7763|     47|                if (data != 0)
  ------------------
  |  Branch (7763:21): [True: 33, False: 14]
  ------------------
 7764|     33|                    _TIFFfreeExt(tif, data);
 7765|     47|                if (!m)
  ------------------
  |  Branch (7765:21): [True: 12, False: 35]
  ------------------
 7766|     12|                    return (0);
 7767|     47|            }
 7768|    187|        }
 7769|    175|        break;
 7770|    175|        case TIFF_SETGET_INT:
  ------------------
  |  Branch (7770:9): [True: 0, False: 145k]
  ------------------
 7771|      0|        case TIFF_SETGET_C0_ASCII:
  ------------------
  |  Branch (7771:9): [True: 0, False: 145k]
  ------------------
 7772|      0|        case TIFF_SETGET_OTHER:
  ------------------
  |  Branch (7772:9): [True: 0, False: 145k]
  ------------------
 7773|      0|            assert(0); /* these should not arrive here */
  ------------------
  |  Branch (7773:13): [Folded, False: 0]
  |  Branch (7773:13): [Folded, False: 0]
  ------------------
 7774|      0|            break;
 7775|      0|        default:
  ------------------
  |  Branch (7775:9): [True: 0, False: 145k]
  ------------------
 7776|      0|            assert(0); /* we should never get here */
  ------------------
  |  Branch (7776:13): [Folded, False: 0]
  |  Branch (7776:13): [Folded, False: 0]
  ------------------
 7777|      0|            break;
 7778|   145k|    }
 7779|   145k|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7779:9): [True: 15.6k, False: 129k]
  ------------------
 7780|  15.6k|    {
 7781|  15.6k|        TIFFReadDirEntryOutputErr(tif, err, module, fip->field_name, recover);
 7782|  15.6k|        return (0);
 7783|  15.6k|    }
 7784|   129k|    return (1);
 7785|   145k|}
tif_dirread.c:TIFFReadDirEntryByteArray:
 1397|  12.4k|{
 1398|  12.4k|    enum TIFFReadDirEntryErr err;
 1399|  12.4k|    uint32_t count;
 1400|  12.4k|    void *origdata;
 1401|  12.4k|    uint8_t *data;
 1402|  12.4k|    switch (direntry->tdir_type)
 1403|  12.4k|    {
 1404|  7.17k|        case TIFF_ASCII:
  ------------------
  |  Branch (1404:9): [True: 7.17k, False: 5.28k]
  ------------------
 1405|  8.45k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1405:9): [True: 1.27k, False: 11.1k]
  ------------------
 1406|  11.6k|        case TIFF_BYTE:
  ------------------
  |  Branch (1406:9): [True: 3.19k, False: 9.26k]
  ------------------
 1407|  11.6k|        case TIFF_SBYTE:
  ------------------
  |  Branch (1407:9): [True: 19, False: 12.4k]
  ------------------
 1408|  11.8k|        case TIFF_SHORT:
  ------------------
  |  Branch (1408:9): [True: 187, False: 12.2k]
  ------------------
 1409|  11.8k|        case TIFF_SSHORT:
  ------------------
  |  Branch (1409:9): [True: 15, False: 12.4k]
  ------------------
 1410|  11.8k|        case TIFF_LONG:
  ------------------
  |  Branch (1410:9): [True: 4, False: 12.4k]
  ------------------
 1411|  11.8k|        case TIFF_SLONG:
  ------------------
  |  Branch (1411:9): [True: 5, False: 12.4k]
  ------------------
 1412|  11.8k|        case TIFF_LONG8:
  ------------------
  |  Branch (1412:9): [True: 6, False: 12.4k]
  ------------------
 1413|  11.8k|        case TIFF_SLONG8:
  ------------------
  |  Branch (1413:9): [True: 6, False: 12.4k]
  ------------------
 1414|  11.8k|            break;
 1415|    575|        default:
  ------------------
  |  Branch (1415:9): [True: 575, False: 11.8k]
  ------------------
 1416|    575|            return (TIFFReadDirEntryErrType);
 1417|  12.4k|    }
 1418|  11.8k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 1, &origdata);
 1419|  11.8k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1419:9): [True: 4.97k, False: 6.91k]
  |  Branch (1419:43): [True: 1.39k, False: 5.51k]
  ------------------
 1420|  6.37k|    {
 1421|  6.37k|        *value = 0;
 1422|  6.37k|        return (err);
 1423|  6.37k|    }
 1424|  5.51k|    switch (direntry->tdir_type)
 1425|  5.51k|    {
 1426|  3.88k|        case TIFF_ASCII:
  ------------------
  |  Branch (1426:9): [True: 3.88k, False: 1.63k]
  ------------------
 1427|  4.77k|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1427:9): [True: 897, False: 4.61k]
  ------------------
 1428|  5.31k|        case TIFF_BYTE:
  ------------------
  |  Branch (1428:9): [True: 540, False: 4.97k]
  ------------------
 1429|  5.31k|            *value = (uint8_t *)origdata;
 1430|  5.31k|            return (TIFFReadDirEntryErrOk);
 1431|     12|        case TIFF_SBYTE:
  ------------------
  |  Branch (1431:9): [True: 12, False: 5.50k]
  ------------------
 1432|     12|        {
 1433|     12|            int8_t *m;
 1434|     12|            uint32_t n;
 1435|     12|            m = (int8_t *)origdata;
 1436|     54|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1436:25): [True: 47, False: 7]
  ------------------
 1437|     47|            {
 1438|     47|                err = TIFFReadDirEntryCheckRangeByteSbyte(*m);
 1439|     47|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1439:21): [True: 5, False: 42]
  ------------------
 1440|      5|                {
 1441|      5|                    _TIFFfreeExt(tif, origdata);
 1442|      5|                    return (err);
 1443|      5|                }
 1444|     42|                m++;
 1445|     42|            }
 1446|      7|            *value = (uint8_t *)origdata;
 1447|      7|            return (TIFFReadDirEntryErrOk);
 1448|     12|        }
 1449|    186|        default:
  ------------------
  |  Branch (1449:9): [True: 186, False: 5.32k]
  ------------------
 1450|    186|            break;
 1451|  5.51k|    }
 1452|    186|    data = (uint8_t *)_TIFFmallocExt(tif, count);
 1453|    186|    if (data == 0)
  ------------------
  |  Branch (1453:9): [True: 0, False: 186]
  ------------------
 1454|      0|    {
 1455|      0|        _TIFFfreeExt(tif, origdata);
 1456|      0|        return (TIFFReadDirEntryErrAlloc);
 1457|      0|    }
 1458|    186|    switch (direntry->tdir_type)
 1459|    186|    {
 1460|    165|        case TIFF_SHORT:
  ------------------
  |  Branch (1460:9): [True: 165, False: 21]
  ------------------
 1461|    165|        {
 1462|    165|            uint16_t *ma;
 1463|    165|            uint8_t *mb;
 1464|    165|            uint32_t n;
 1465|    165|            ma = (uint16_t *)origdata;
 1466|    165|            mb = data;
 1467|    678|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1467:25): [True: 557, False: 121]
  ------------------
 1468|    557|            {
 1469|    557|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    557|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1469:21): [True: 176, False: 381]
  ------------------
 1470|    176|                    TIFFSwabShort(ma);
 1471|    557|                err = TIFFReadDirEntryCheckRangeByteShort(*ma);
 1472|    557|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1472:21): [True: 44, False: 513]
  ------------------
 1473|     44|                    break;
 1474|    513|                *mb++ = (uint8_t)(*ma++);
 1475|    513|            }
 1476|    165|        }
 1477|    165|        break;
 1478|      5|        case TIFF_SSHORT:
  ------------------
  |  Branch (1478:9): [True: 5, False: 181]
  ------------------
 1479|      5|        {
 1480|      5|            int16_t *ma;
 1481|      5|            uint8_t *mb;
 1482|      5|            uint32_t n;
 1483|      5|            ma = (int16_t *)origdata;
 1484|      5|            mb = data;
 1485|    285|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1485:25): [True: 283, False: 2]
  ------------------
 1486|    283|            {
 1487|    283|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    283|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1487:21): [True: 130, False: 153]
  ------------------
 1488|    130|                    TIFFSwabShort((uint16_t *)ma);
 1489|    283|                err = TIFFReadDirEntryCheckRangeByteSshort(*ma);
 1490|    283|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1490:21): [True: 3, False: 280]
  ------------------
 1491|      3|                    break;
 1492|    280|                *mb++ = (uint8_t)(*ma++);
 1493|    280|            }
 1494|      5|        }
 1495|      5|        break;
 1496|      3|        case TIFF_LONG:
  ------------------
  |  Branch (1496:9): [True: 3, False: 183]
  ------------------
 1497|      3|        {
 1498|      3|            uint32_t *ma;
 1499|      3|            uint8_t *mb;
 1500|      3|            uint32_t n;
 1501|      3|            ma = (uint32_t *)origdata;
 1502|      3|            mb = data;
 1503|    289|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1503:25): [True: 289, False: 0]
  ------------------
 1504|    289|            {
 1505|    289|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    289|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1505:21): [True: 141, False: 148]
  ------------------
 1506|    141|                    TIFFSwabLong(ma);
 1507|    289|                err = TIFFReadDirEntryCheckRangeByteLong(*ma);
 1508|    289|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1508:21): [True: 3, False: 286]
  ------------------
 1509|      3|                    break;
 1510|    286|                *mb++ = (uint8_t)(*ma++);
 1511|    286|            }
 1512|      3|        }
 1513|      3|        break;
 1514|      3|        case TIFF_SLONG:
  ------------------
  |  Branch (1514:9): [True: 3, False: 183]
  ------------------
 1515|      3|        {
 1516|      3|            int32_t *ma;
 1517|      3|            uint8_t *mb;
 1518|      3|            uint32_t n;
 1519|      3|            ma = (int32_t *)origdata;
 1520|      3|            mb = data;
 1521|    296|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1521:25): [True: 294, False: 2]
  ------------------
 1522|    294|            {
 1523|    294|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    294|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1523:21): [True: 128, False: 166]
  ------------------
 1524|    128|                    TIFFSwabLong((uint32_t *)ma);
 1525|    294|                err = TIFFReadDirEntryCheckRangeByteSlong(*ma);
 1526|    294|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1526:21): [True: 1, False: 293]
  ------------------
 1527|      1|                    break;
 1528|    293|                *mb++ = (uint8_t)(*ma++);
 1529|    293|            }
 1530|      3|        }
 1531|      3|        break;
 1532|      6|        case TIFF_LONG8:
  ------------------
  |  Branch (1532:9): [True: 6, False: 180]
  ------------------
 1533|      6|        {
 1534|      6|            uint64_t *ma;
 1535|      6|            uint8_t *mb;
 1536|      6|            uint32_t n;
 1537|      6|            ma = (uint64_t *)origdata;
 1538|      6|            mb = data;
 1539|    359|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1539:25): [True: 358, False: 1]
  ------------------
 1540|    358|            {
 1541|    358|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    358|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1541:21): [True: 178, False: 180]
  ------------------
 1542|    178|                    TIFFSwabLong8(ma);
 1543|    358|                err = TIFFReadDirEntryCheckRangeByteLong8(*ma);
 1544|    358|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1544:21): [True: 5, False: 353]
  ------------------
 1545|      5|                    break;
 1546|    353|                *mb++ = (uint8_t)(*ma++);
 1547|    353|            }
 1548|      6|        }
 1549|      6|        break;
 1550|      4|        case TIFF_SLONG8:
  ------------------
  |  Branch (1550:9): [True: 4, False: 182]
  ------------------
 1551|      4|        {
 1552|      4|            int64_t *ma;
 1553|      4|            uint8_t *mb;
 1554|      4|            uint32_t n;
 1555|      4|            ma = (int64_t *)origdata;
 1556|      4|            mb = data;
 1557|    300|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1557:25): [True: 300, False: 0]
  ------------------
 1558|    300|            {
 1559|    300|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    300|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1559:21): [True: 238, False: 62]
  ------------------
 1560|    238|                    TIFFSwabLong8((uint64_t *)ma);
 1561|    300|                err = TIFFReadDirEntryCheckRangeByteSlong8(*ma);
 1562|    300|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1562:21): [True: 4, False: 296]
  ------------------
 1563|      4|                    break;
 1564|    296|                *mb++ = (uint8_t)(*ma++);
 1565|    296|            }
 1566|      4|        }
 1567|      4|        break;
 1568|      0|        default:
  ------------------
  |  Branch (1568:9): [True: 0, False: 186]
  ------------------
 1569|      0|            break;
 1570|    186|    }
 1571|    186|    _TIFFfreeExt(tif, origdata);
 1572|    186|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1572:9): [True: 60, False: 126]
  ------------------
 1573|     60|    {
 1574|     60|        _TIFFfreeExt(tif, data);
 1575|     60|        return (err);
 1576|     60|    }
 1577|    126|    *value = data;
 1578|    126|    return (TIFFReadDirEntryErrOk);
 1579|    186|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSbyte:
 3646|     47|{
 3647|     47|    if (value < 0)
  ------------------
  |  Branch (3647:9): [True: 5, False: 42]
  ------------------
 3648|      5|        return (TIFFReadDirEntryErrRange);
 3649|     42|    else
 3650|     42|        return (TIFFReadDirEntryErrOk);
 3651|     47|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteShort:
 3655|    561|{
 3656|    561|    if (value > 0xFF)
  ------------------
  |  Branch (3656:9): [True: 44, False: 517]
  ------------------
 3657|     44|        return (TIFFReadDirEntryErrRange);
 3658|    517|    else
 3659|    517|        return (TIFFReadDirEntryErrOk);
 3660|    561|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSshort:
 3664|    283|{
 3665|    283|    if ((value < 0) || (value > 0xFF))
  ------------------
  |  Branch (3665:9): [True: 0, False: 283]
  |  Branch (3665:24): [True: 3, False: 280]
  ------------------
 3666|      3|        return (TIFFReadDirEntryErrRange);
 3667|    280|    else
 3668|    280|        return (TIFFReadDirEntryErrOk);
 3669|    283|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteLong:
 3673|    289|{
 3674|    289|    if (value > 0xFF)
  ------------------
  |  Branch (3674:9): [True: 3, False: 286]
  ------------------
 3675|      3|        return (TIFFReadDirEntryErrRange);
 3676|    286|    else
 3677|    286|        return (TIFFReadDirEntryErrOk);
 3678|    289|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSlong:
 3682|    294|{
 3683|    294|    if ((value < 0) || (value > 0xFF))
  ------------------
  |  Branch (3683:9): [True: 0, False: 294]
  |  Branch (3683:24): [True: 1, False: 293]
  ------------------
 3684|      1|        return (TIFFReadDirEntryErrRange);
 3685|    293|    else
 3686|    293|        return (TIFFReadDirEntryErrOk);
 3687|    294|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteLong8:
 3691|    361|{
 3692|    361|    if (value > 0xFF)
  ------------------
  |  Branch (3692:9): [True: 6, False: 355]
  ------------------
 3693|      6|        return (TIFFReadDirEntryErrRange);
 3694|    355|    else
 3695|    355|        return (TIFFReadDirEntryErrOk);
 3696|    361|}
tif_dirread.c:TIFFReadDirEntryCheckRangeByteSlong8:
 3700|    301|{
 3701|    301|    if ((value < 0) || (value > 0xFF))
  ------------------
  |  Branch (3701:9): [True: 1, False: 300]
  |  Branch (3701:24): [True: 4, False: 296]
  ------------------
 3702|      5|        return (TIFFReadDirEntryErrRange);
 3703|    296|    else
 3704|    296|        return (TIFFReadDirEntryErrOk);
 3705|    301|}
tif_dirread.c:TIFFReadDirEntryByte:
  300|     35|{
  301|     35|    enum TIFFReadDirEntryErr err;
  302|     35|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (302:9): [True: 27, False: 8]
  ------------------
  303|     27|        return (TIFFReadDirEntryErrCount);
  304|      8|    switch (direntry->tdir_type)
  305|      8|    {
  306|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (306:9): [True: 0, False: 8]
  ------------------
  307|      0|        case TIFF_UNDEFINED: /* Support to read TIFF_UNDEFINED with
  ------------------
  |  Branch (307:9): [True: 0, False: 8]
  ------------------
  308|       |                                field_readcount==1 */
  309|      0|            TIFFReadDirEntryCheckedByte(tif, direntry, value);
  310|      0|            return (TIFFReadDirEntryErrOk);
  311|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (311:9): [True: 0, False: 8]
  ------------------
  312|      0|        {
  313|      0|            int8_t m;
  314|      0|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  315|      0|            err = TIFFReadDirEntryCheckRangeByteSbyte(m);
  316|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (316:17): [True: 0, False: 0]
  ------------------
  317|      0|                return (err);
  318|      0|            *value = (uint8_t)m;
  319|      0|            return (TIFFReadDirEntryErrOk);
  320|      0|        }
  321|      4|        case TIFF_SHORT:
  ------------------
  |  Branch (321:9): [True: 4, False: 4]
  ------------------
  322|      4|        {
  323|      4|            uint16_t m;
  324|      4|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  325|      4|            err = TIFFReadDirEntryCheckRangeByteShort(m);
  326|      4|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (326:17): [True: 0, False: 4]
  ------------------
  327|      0|                return (err);
  328|      4|            *value = (uint8_t)m;
  329|      4|            return (TIFFReadDirEntryErrOk);
  330|      4|        }
  331|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (331:9): [True: 0, False: 8]
  ------------------
  332|      0|        {
  333|      0|            int16_t m;
  334|      0|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
  335|      0|            err = TIFFReadDirEntryCheckRangeByteSshort(m);
  336|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (336:17): [True: 0, False: 0]
  ------------------
  337|      0|                return (err);
  338|      0|            *value = (uint8_t)m;
  339|      0|            return (TIFFReadDirEntryErrOk);
  340|      0|        }
  341|      0|        case TIFF_LONG:
  ------------------
  |  Branch (341:9): [True: 0, False: 8]
  ------------------
  342|      0|        {
  343|      0|            uint32_t m;
  344|      0|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
  345|      0|            err = TIFFReadDirEntryCheckRangeByteLong(m);
  346|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (346:17): [True: 0, False: 0]
  ------------------
  347|      0|                return (err);
  348|      0|            *value = (uint8_t)m;
  349|      0|            return (TIFFReadDirEntryErrOk);
  350|      0|        }
  351|      0|        case TIFF_SLONG:
  ------------------
  |  Branch (351:9): [True: 0, False: 8]
  ------------------
  352|      0|        {
  353|      0|            int32_t m;
  354|      0|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
  355|      0|            err = TIFFReadDirEntryCheckRangeByteSlong(m);
  356|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (356:17): [True: 0, False: 0]
  ------------------
  357|      0|                return (err);
  358|      0|            *value = (uint8_t)m;
  359|      0|            return (TIFFReadDirEntryErrOk);
  360|      0|        }
  361|      3|        case TIFF_LONG8:
  ------------------
  |  Branch (361:9): [True: 3, False: 5]
  ------------------
  362|      3|        {
  363|      3|            uint64_t m;
  364|      3|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
  365|      3|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (365:17): [True: 0, False: 3]
  ------------------
  366|      0|                return (err);
  367|      3|            err = TIFFReadDirEntryCheckRangeByteLong8(m);
  368|      3|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (368:17): [True: 1, False: 2]
  ------------------
  369|      1|                return (err);
  370|      2|            *value = (uint8_t)m;
  371|      2|            return (TIFFReadDirEntryErrOk);
  372|      3|        }
  373|      1|        case TIFF_SLONG8:
  ------------------
  |  Branch (373:9): [True: 1, False: 7]
  ------------------
  374|      1|        {
  375|      1|            int64_t m;
  376|      1|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  377|      1|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (377:17): [True: 0, False: 1]
  ------------------
  378|      0|                return (err);
  379|      1|            err = TIFFReadDirEntryCheckRangeByteSlong8(m);
  380|      1|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (380:17): [True: 1, False: 0]
  ------------------
  381|      1|                return (err);
  382|      0|            *value = (uint8_t)m;
  383|      0|            return (TIFFReadDirEntryErrOk);
  384|      1|        }
  385|      0|        default:
  ------------------
  |  Branch (385:9): [True: 0, False: 8]
  ------------------
  386|      0|            return (TIFFReadDirEntryErrType);
  387|      8|    }
  388|      8|}
tif_dirread.c:TIFFReadDirEntryLong:
  657|  18.3k|{
  658|  18.3k|    enum TIFFReadDirEntryErr err;
  659|  18.3k|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (659:9): [True: 281, False: 18.0k]
  ------------------
  660|    281|        return (TIFFReadDirEntryErrCount);
  661|  18.0k|    switch (direntry->tdir_type)
  662|  18.0k|    {
  663|  3.10k|        case TIFF_BYTE:
  ------------------
  |  Branch (663:9): [True: 3.10k, False: 14.9k]
  ------------------
  664|  3.10k|        {
  665|  3.10k|            uint8_t m;
  666|  3.10k|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
  667|  3.10k|            *value = (uint32_t)m;
  668|  3.10k|            return (TIFFReadDirEntryErrOk);
  669|      0|        }
  670|    372|        case TIFF_SBYTE:
  ------------------
  |  Branch (670:9): [True: 372, False: 17.6k]
  ------------------
  671|    372|        {
  672|    372|            int8_t m;
  673|    372|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  674|    372|            err = TIFFReadDirEntryCheckRangeLongSbyte(m);
  675|    372|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (675:17): [True: 0, False: 372]
  ------------------
  676|      0|                return (err);
  677|    372|            *value = (uint32_t)m;
  678|    372|            return (TIFFReadDirEntryErrOk);
  679|    372|        }
  680|  13.7k|        case TIFF_SHORT:
  ------------------
  |  Branch (680:9): [True: 13.7k, False: 4.24k]
  ------------------
  681|  13.7k|        {
  682|  13.7k|            uint16_t m;
  683|  13.7k|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  684|  13.7k|            *value = (uint32_t)m;
  685|  13.7k|            return (TIFFReadDirEntryErrOk);
  686|    372|        }
  687|    230|        case TIFF_SSHORT:
  ------------------
  |  Branch (687:9): [True: 230, False: 17.8k]
  ------------------
  688|    230|        {
  689|    230|            int16_t m;
  690|    230|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
  691|    230|            err = TIFFReadDirEntryCheckRangeLongSshort(m);
  692|    230|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (692:17): [True: 0, False: 230]
  ------------------
  693|      0|                return (err);
  694|    230|            *value = (uint32_t)m;
  695|    230|            return (TIFFReadDirEntryErrOk);
  696|    230|        }
  697|    388|        case TIFF_LONG:
  ------------------
  |  Branch (697:9): [True: 388, False: 17.6k]
  ------------------
  698|    391|        case TIFF_IFD:
  ------------------
  |  Branch (698:9): [True: 3, False: 18.0k]
  ------------------
  699|    391|            TIFFReadDirEntryCheckedLong(tif, direntry, value);
  700|    391|            return (TIFFReadDirEntryErrOk);
  701|    138|        case TIFF_SLONG:
  ------------------
  |  Branch (701:9): [True: 138, False: 17.8k]
  ------------------
  702|    138|        {
  703|    138|            int32_t m;
  704|    138|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
  705|    138|            err = TIFFReadDirEntryCheckRangeLongSlong(m);
  706|    138|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (706:17): [True: 0, False: 138]
  ------------------
  707|      0|                return (err);
  708|    138|            *value = (uint32_t)m;
  709|    138|            return (TIFFReadDirEntryErrOk);
  710|    138|        }
  711|      3|        case TIFF_LONG8:
  ------------------
  |  Branch (711:9): [True: 3, False: 18.0k]
  ------------------
  712|      6|        case TIFF_IFD8:
  ------------------
  |  Branch (712:9): [True: 3, False: 18.0k]
  ------------------
  713|      6|        {
  714|      6|            uint64_t m;
  715|      6|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
  716|      6|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (716:17): [True: 0, False: 6]
  ------------------
  717|      0|                return (err);
  718|      6|            err = TIFFReadDirEntryCheckRangeLongLong8(m);
  719|      6|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (719:17): [True: 0, False: 6]
  ------------------
  720|      0|                return (err);
  721|      6|            *value = (uint32_t)m;
  722|      6|            return (TIFFReadDirEntryErrOk);
  723|      6|        }
  724|      1|        case TIFF_SLONG8:
  ------------------
  |  Branch (724:9): [True: 1, False: 18.0k]
  ------------------
  725|      1|        {
  726|      1|            int64_t m;
  727|      1|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  728|      1|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (728:17): [True: 0, False: 1]
  ------------------
  729|      0|                return (err);
  730|      1|            err = TIFFReadDirEntryCheckRangeLongSlong8(m);
  731|      1|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (731:17): [True: 0, False: 1]
  ------------------
  732|      0|                return (err);
  733|      1|            *value = (uint32_t)m;
  734|      1|            return (TIFFReadDirEntryErrOk);
  735|      1|        }
  736|      4|        default:
  ------------------
  |  Branch (736:9): [True: 4, False: 18.0k]
  ------------------
  737|      4|            return (TIFFReadDirEntryErrType);
  738|  18.0k|    }
  739|  18.0k|} /*-- TIFFReadDirEntryLong() --*/
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSbyte:
 3871|    372|{
 3872|    372|    if (value < 0)
  ------------------
  |  Branch (3872:9): [True: 0, False: 372]
  ------------------
 3873|      0|        return (TIFFReadDirEntryErrRange);
 3874|    372|    else
 3875|    372|        return (TIFFReadDirEntryErrOk);
 3876|    372|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSshort:
 3880|    418|{
 3881|    418|    if (value < 0)
  ------------------
  |  Branch (3881:9): [True: 4, False: 414]
  ------------------
 3882|      4|        return (TIFFReadDirEntryErrRange);
 3883|    414|    else
 3884|    414|        return (TIFFReadDirEntryErrOk);
 3885|    418|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSlong:
 3889|    466|{
 3890|    466|    if (value < 0)
  ------------------
  |  Branch (3890:9): [True: 0, False: 466]
  ------------------
 3891|      0|        return (TIFFReadDirEntryErrRange);
 3892|    466|    else
 3893|    466|        return (TIFFReadDirEntryErrOk);
 3894|    466|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongLong8:
 3898|    583|{
 3899|    583|    if (value > UINT32_MAX)
  ------------------
  |  Branch (3899:9): [True: 29, False: 554]
  ------------------
 3900|     29|        return (TIFFReadDirEntryErrRange);
 3901|    554|    else
 3902|    554|        return (TIFFReadDirEntryErrOk);
 3903|    583|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLongSlong8:
 3907|    791|{
 3908|    791|    if ((value < 0) || (value > (int64_t)UINT32_MAX))
  ------------------
  |  Branch (3908:9): [True: 20, False: 771]
  |  Branch (3908:24): [True: 26, False: 745]
  ------------------
 3909|     46|        return (TIFFReadDirEntryErrRange);
 3910|    745|    else
 3911|    745|        return (TIFFReadDirEntryErrOk);
 3912|    791|}
tif_dirread.c:TIFFReadDirEntryLong8:
  821|    776|{
  822|    776|    enum TIFFReadDirEntryErr err;
  823|    776|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (823:9): [True: 436, False: 340]
  ------------------
  824|    436|        return (TIFFReadDirEntryErrCount);
  825|    340|    switch (direntry->tdir_type)
  826|    340|    {
  827|     24|        case TIFF_BYTE:
  ------------------
  |  Branch (827:9): [True: 24, False: 316]
  ------------------
  828|     24|        {
  829|     24|            uint8_t m;
  830|     24|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
  831|     24|            *value = (uint64_t)m;
  832|     24|            return (TIFFReadDirEntryErrOk);
  833|      0|        }
  834|     77|        case TIFF_SBYTE:
  ------------------
  |  Branch (834:9): [True: 77, False: 263]
  ------------------
  835|     77|        {
  836|     77|            int8_t m;
  837|     77|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  838|     77|            err = TIFFReadDirEntryCheckRangeLong8Sbyte(m);
  839|     77|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (839:17): [True: 0, False: 77]
  ------------------
  840|      0|                return (err);
  841|     77|            *value = (uint64_t)m;
  842|     77|            return (TIFFReadDirEntryErrOk);
  843|     77|        }
  844|      3|        case TIFF_SHORT:
  ------------------
  |  Branch (844:9): [True: 3, False: 337]
  ------------------
  845|      3|        {
  846|      3|            uint16_t m;
  847|      3|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  848|      3|            *value = (uint64_t)m;
  849|      3|            return (TIFFReadDirEntryErrOk);
  850|     77|        }
  851|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (851:9): [True: 0, False: 340]
  ------------------
  852|      0|        {
  853|      0|            int16_t m;
  854|      0|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
  855|      0|            err = TIFFReadDirEntryCheckRangeLong8Sshort(m);
  856|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (856:17): [True: 0, False: 0]
  ------------------
  857|      0|                return (err);
  858|      0|            *value = (uint64_t)m;
  859|      0|            return (TIFFReadDirEntryErrOk);
  860|      0|        }
  861|    221|        case TIFF_LONG:
  ------------------
  |  Branch (861:9): [True: 221, False: 119]
  ------------------
  862|    223|        case TIFF_IFD:
  ------------------
  |  Branch (862:9): [True: 2, False: 338]
  ------------------
  863|    223|        {
  864|    223|            uint32_t m;
  865|    223|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
  866|    223|            *value = (uint64_t)m;
  867|    223|            return (TIFFReadDirEntryErrOk);
  868|    221|        }
  869|      0|        case TIFF_SLONG:
  ------------------
  |  Branch (869:9): [True: 0, False: 340]
  ------------------
  870|      0|        {
  871|      0|            int32_t m;
  872|      0|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
  873|      0|            err = TIFFReadDirEntryCheckRangeLong8Slong(m);
  874|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (874:17): [True: 0, False: 0]
  ------------------
  875|      0|                return (err);
  876|      0|            *value = (uint64_t)m;
  877|      0|            return (TIFFReadDirEntryErrOk);
  878|      0|        }
  879|      6|        case TIFF_LONG8:
  ------------------
  |  Branch (879:9): [True: 6, False: 334]
  ------------------
  880|      6|        case TIFF_IFD8:
  ------------------
  |  Branch (880:9): [True: 0, False: 340]
  ------------------
  881|      6|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, value);
  882|      6|            return (err);
  883|      4|        case TIFF_SLONG8:
  ------------------
  |  Branch (883:9): [True: 4, False: 336]
  ------------------
  884|      4|        {
  885|      4|            int64_t m;
  886|      4|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
  887|      4|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (887:17): [True: 0, False: 4]
  ------------------
  888|      0|                return (err);
  889|      4|            err = TIFFReadDirEntryCheckRangeLong8Slong8(m);
  890|      4|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (890:17): [True: 2, False: 2]
  ------------------
  891|      2|                return (err);
  892|      2|            *value = (uint64_t)m;
  893|      2|            return (TIFFReadDirEntryErrOk);
  894|      4|        }
  895|      3|        default:
  ------------------
  |  Branch (895:9): [True: 3, False: 337]
  ------------------
  896|      3|            return (TIFFReadDirEntryErrType);
  897|    340|    }
  898|    340|} /*-- TIFFReadDirEntryLong8() --*/
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Sbyte:
 3945|    132|{
 3946|    132|    if (value < 0)
  ------------------
  |  Branch (3946:9): [True: 12, False: 120]
  ------------------
 3947|     12|        return (TIFFReadDirEntryErrRange);
 3948|    120|    else
 3949|    120|        return (TIFFReadDirEntryErrOk);
 3950|    132|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Sshort:
 3954|    494|{
 3955|    494|    if (value < 0)
  ------------------
  |  Branch (3955:9): [True: 0, False: 494]
  ------------------
 3956|      0|        return (TIFFReadDirEntryErrRange);
 3957|    494|    else
 3958|    494|        return (TIFFReadDirEntryErrOk);
 3959|    494|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Slong:
 3963|    618|{
 3964|    618|    if (value < 0)
  ------------------
  |  Branch (3964:9): [True: 0, False: 618]
  ------------------
 3965|      0|        return (TIFFReadDirEntryErrRange);
 3966|    618|    else
 3967|    618|        return (TIFFReadDirEntryErrOk);
 3968|    618|}
tif_dirread.c:TIFFReadDirEntryCheckRangeLong8Slong8:
 3972|    424|{
 3973|    424|    if (value < 0)
  ------------------
  |  Branch (3973:9): [True: 6, False: 418]
  ------------------
 3974|      6|        return (TIFFReadDirEntryErrRange);
 3975|    418|    else
 3976|    418|        return (TIFFReadDirEntryErrOk);
 3977|    424|}
tif_dirread.c:TIFFReadDirEntryFloat:
  972|  1.90k|{
  973|  1.90k|    enum TIFFReadDirEntryErr err;
  974|  1.90k|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (974:9): [True: 898, False: 1.00k]
  ------------------
  975|    898|        return (TIFFReadDirEntryErrCount);
  976|  1.00k|    switch (direntry->tdir_type)
  977|  1.00k|    {
  978|      1|        case TIFF_BYTE:
  ------------------
  |  Branch (978:9): [True: 1, False: 1.00k]
  ------------------
  979|      1|        {
  980|      1|            uint8_t m;
  981|      1|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
  982|      1|            *value = (float)m;
  983|      1|            return (TIFFReadDirEntryErrOk);
  984|      0|        }
  985|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (985:9): [True: 0, False: 1.00k]
  ------------------
  986|      0|        {
  987|      0|            int8_t m;
  988|      0|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
  989|      0|            *value = (float)m;
  990|      0|            return (TIFFReadDirEntryErrOk);
  991|      0|        }
  992|    144|        case TIFF_SHORT:
  ------------------
  |  Branch (992:9): [True: 144, False: 860]
  ------------------
  993|    144|        {
  994|    144|            uint16_t m;
  995|    144|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
  996|    144|            *value = (float)m;
  997|    144|            return (TIFFReadDirEntryErrOk);
  998|      0|        }
  999|      3|        case TIFF_SSHORT:
  ------------------
  |  Branch (999:9): [True: 3, False: 1.00k]
  ------------------
 1000|      3|        {
 1001|      3|            int16_t m;
 1002|      3|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
 1003|      3|            *value = (float)m;
 1004|      3|            return (TIFFReadDirEntryErrOk);
 1005|      0|        }
 1006|      8|        case TIFF_LONG:
  ------------------
  |  Branch (1006:9): [True: 8, False: 996]
  ------------------
 1007|      8|        {
 1008|      8|            uint32_t m;
 1009|      8|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
 1010|      8|            *value = (float)m;
 1011|      8|            return (TIFFReadDirEntryErrOk);
 1012|      0|        }
 1013|      3|        case TIFF_SLONG:
  ------------------
  |  Branch (1013:9): [True: 3, False: 1.00k]
  ------------------
 1014|      3|        {
 1015|      3|            int32_t m;
 1016|      3|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
 1017|      3|            *value = (float)m;
 1018|      3|            return (TIFFReadDirEntryErrOk);
 1019|      0|        }
 1020|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (1020:9): [True: 0, False: 1.00k]
  ------------------
 1021|      0|        {
 1022|      0|            uint64_t m;
 1023|      0|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
 1024|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1024:17): [True: 0, False: 0]
  ------------------
 1025|      0|                return (err);
 1026|      0|            *value = (float)m;
 1027|      0|            return (TIFFReadDirEntryErrOk);
 1028|      0|        }
 1029|      0|        case TIFF_SLONG8:
  ------------------
  |  Branch (1029:9): [True: 0, False: 1.00k]
  ------------------
 1030|      0|        {
 1031|      0|            int64_t m;
 1032|      0|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
 1033|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1033:17): [True: 0, False: 0]
  ------------------
 1034|      0|                return (err);
 1035|      0|            *value = (float)m;
 1036|      0|            return (TIFFReadDirEntryErrOk);
 1037|      0|        }
 1038|    758|        case TIFF_RATIONAL:
  ------------------
  |  Branch (1038:9): [True: 758, False: 246]
  ------------------
 1039|    758|        {
 1040|    758|            double m;
 1041|    758|            err = TIFFReadDirEntryCheckedRational(tif, direntry, &m);
 1042|    758|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1042:17): [True: 79, False: 679]
  ------------------
 1043|     79|                return (err);
 1044|    679|            *value = (float)m;
 1045|    679|            return (TIFFReadDirEntryErrOk);
 1046|    758|        }
 1047|     34|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (1047:9): [True: 34, False: 970]
  ------------------
 1048|     34|        {
 1049|     34|            double m;
 1050|     34|            err = TIFFReadDirEntryCheckedSrational(tif, direntry, &m);
 1051|     34|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1051:17): [True: 16, False: 18]
  ------------------
 1052|     16|                return (err);
 1053|     18|            *value = (float)m;
 1054|     18|            return (TIFFReadDirEntryErrOk);
 1055|     34|        }
 1056|      2|        case TIFF_FLOAT:
  ------------------
  |  Branch (1056:9): [True: 2, False: 1.00k]
  ------------------
 1057|      2|            TIFFReadDirEntryCheckedFloat(tif, direntry, value);
 1058|      2|            return (TIFFReadDirEntryErrOk);
 1059|     21|        case TIFF_DOUBLE:
  ------------------
  |  Branch (1059:9): [True: 21, False: 983]
  ------------------
 1060|     21|        {
 1061|     21|            double m;
 1062|     21|            err = TIFFReadDirEntryCheckedDouble(tif, direntry, &m);
 1063|     21|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1063:17): [True: 8, False: 13]
  ------------------
 1064|      8|                return (err);
 1065|     13|            if ((m > (double)FLT_MAX) || (m < -(double)FLT_MAX))
  ------------------
  |  Branch (1065:17): [True: 6, False: 7]
  |  Branch (1065:42): [True: 3, False: 4]
  ------------------
 1066|      9|                return (TIFFReadDirEntryErrRange);
 1067|      4|            *value = (float)m;
 1068|      4|            return (TIFFReadDirEntryErrOk);
 1069|     13|        }
 1070|     30|        default:
  ------------------
  |  Branch (1070:9): [True: 30, False: 974]
  ------------------
 1071|     30|            return (TIFFReadDirEntryErrType);
 1072|  1.00k|    }
 1073|  1.00k|}
tif_dirread.c:TIFFReadDirEntryCheckedRational:
 3494|    758|{
 3495|    758|    UInt64Aligned_t m;
 3496|       |
 3497|    758|    assert(sizeof(double) == 8);
  ------------------
  |  Branch (3497:5): [True: 0, Folded]
  |  Branch (3497:5): [True: 758, Folded]
  ------------------
 3498|    758|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (3498:5): [True: 0, Folded]
  |  Branch (3498:5): [True: 758, Folded]
  ------------------
 3499|    758|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (3499:5): [True: 0, Folded]
  |  Branch (3499:5): [True: 758, Folded]
  ------------------
 3500|    758|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|    758|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3500:9): [True: 752, False: 6]
  ------------------
 3501|    752|    {
 3502|    752|        enum TIFFReadDirEntryErr err;
 3503|    752|        uint32_t offset = direntry->tdir_offset.toff_long;
 3504|    752|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    752|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3504:13): [True: 2, False: 750]
  ------------------
 3505|      2|            TIFFSwabLong(&offset);
 3506|    752|        err = TIFFReadDirEntryData(tif, offset, 8, m.i);
 3507|    752|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3507:13): [True: 79, False: 673]
  ------------------
 3508|     79|            return (err);
 3509|    752|    }
 3510|      6|    else
 3511|      6|        m.l = direntry->tdir_offset.toff_long8;
 3512|    679|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    679|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3512:9): [True: 2, False: 677]
  ------------------
 3513|      2|        TIFFSwabArrayOfLong(m.i, 2);
 3514|       |    /* Not completely sure what we should do when m.i[1]==0, but some */
 3515|       |    /* sanitizers do not like division by 0.0: */
 3516|       |    /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */
 3517|    679|    if (m.i[0] == 0 || m.i[1] == 0)
  ------------------
  |  Branch (3517:9): [True: 24, False: 655]
  |  Branch (3517:24): [True: 113, False: 542]
  ------------------
 3518|    137|        *value = 0.0;
 3519|    542|    else
 3520|    542|        *value = (double)m.i[0] / (double)m.i[1];
 3521|    679|    return (TIFFReadDirEntryErrOk);
 3522|    758|}
tif_dirread.c:TIFFReadDirEntryCheckedSrational:
 3527|     34|{
 3528|     34|    UInt64Aligned_t m;
 3529|     34|    assert(sizeof(double) == 8);
  ------------------
  |  Branch (3529:5): [True: 0, Folded]
  |  Branch (3529:5): [True: 34, Folded]
  ------------------
 3530|     34|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (3530:5): [True: 0, Folded]
  |  Branch (3530:5): [True: 34, Folded]
  ------------------
 3531|     34|    assert(sizeof(int32_t) == 4);
  ------------------
  |  Branch (3531:5): [True: 0, Folded]
  |  Branch (3531:5): [True: 34, Folded]
  ------------------
 3532|     34|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (3532:5): [True: 0, Folded]
  |  Branch (3532:5): [True: 34, Folded]
  ------------------
 3533|     34|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|     34|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3533:9): [True: 28, False: 6]
  ------------------
 3534|     28|    {
 3535|     28|        enum TIFFReadDirEntryErr err;
 3536|     28|        uint32_t offset = direntry->tdir_offset.toff_long;
 3537|     28|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     28|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3537:13): [True: 0, False: 28]
  ------------------
 3538|      0|            TIFFSwabLong(&offset);
 3539|     28|        err = TIFFReadDirEntryData(tif, offset, 8, m.i);
 3540|     28|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3540:13): [True: 16, False: 12]
  ------------------
 3541|     16|            return (err);
 3542|     28|    }
 3543|      6|    else
 3544|      6|        m.l = direntry->tdir_offset.toff_long8;
 3545|     18|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     18|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3545:9): [True: 0, False: 18]
  ------------------
 3546|      0|        TIFFSwabArrayOfLong(m.i, 2);
 3547|       |    /* Not completely sure what we should do when m.i[1]==0, but some */
 3548|       |    /* sanitizers do not like division by 0.0: */
 3549|       |    /* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */
 3550|     18|    if ((int32_t)m.i[0] == 0 || m.i[1] == 0)
  ------------------
  |  Branch (3550:9): [True: 4, False: 14]
  |  Branch (3550:33): [True: 0, False: 14]
  ------------------
 3551|      4|        *value = 0.0;
 3552|     14|    else
 3553|     14|        *value = (double)((int32_t)m.i[0]) / (double)m.i[1];
 3554|     18|    return (TIFFReadDirEntryErrOk);
 3555|     34|}
tif_dirread.c:TIFFReadDirEntryCheckedFloat:
 3602|      2|{
 3603|      2|    union
 3604|      2|    {
 3605|      2|        float f;
 3606|      2|        uint32_t i;
 3607|      2|    } float_union;
 3608|      2|    assert(sizeof(float) == 4);
  ------------------
  |  Branch (3608:5): [True: 0, Folded]
  |  Branch (3608:5): [True: 2, Folded]
  ------------------
 3609|      2|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (3609:5): [True: 0, Folded]
  |  Branch (3609:5): [True: 2, Folded]
  ------------------
 3610|      2|    assert(sizeof(float_union) == 4);
  ------------------
  |  Branch (3610:5): [True: 0, Folded]
  |  Branch (3610:5): [True: 2, Folded]
  ------------------
 3611|      2|    float_union.i = *(uint32_t *)(&direntry->tdir_offset);
 3612|      2|    *value = float_union.f;
 3613|      2|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      2|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3613:9): [True: 0, False: 2]
  ------------------
 3614|      0|        TIFFSwabLong((uint32_t *)value);
 3615|      2|}
tif_dirread.c:TIFFReadDirEntryCheckedDouble:
 3619|     21|{
 3620|     21|    assert(sizeof(double) == 8);
  ------------------
  |  Branch (3620:5): [True: 0, Folded]
  |  Branch (3620:5): [True: 21, Folded]
  ------------------
 3621|     21|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (3621:5): [True: 0, Folded]
  |  Branch (3621:5): [True: 21, Folded]
  ------------------
 3622|     21|    assert(sizeof(UInt64Aligned_t) == 8);
  ------------------
  |  Branch (3622:5): [True: 0, Folded]
  |  Branch (3622:5): [True: 21, Folded]
  ------------------
 3623|     21|    if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|     21|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (3623:9): [True: 21, False: 0]
  ------------------
 3624|     21|    {
 3625|     21|        enum TIFFReadDirEntryErr err;
 3626|     21|        uint32_t offset = direntry->tdir_offset.toff_long;
 3627|     21|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     21|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3627:13): [True: 2, False: 19]
  ------------------
 3628|      2|            TIFFSwabLong(&offset);
 3629|     21|        err = TIFFReadDirEntryData(tif, offset, 8, value);
 3630|     21|        if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (3630:13): [True: 8, False: 13]
  ------------------
 3631|      8|            return (err);
 3632|     21|    }
 3633|      0|    else
 3634|      0|    {
 3635|      0|        UInt64Aligned_t uint64_union;
 3636|      0|        uint64_union.l = direntry->tdir_offset.toff_long8;
 3637|      0|        *value = uint64_union.d;
 3638|      0|    }
 3639|     13|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     13|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3639:9): [True: 0, False: 13]
  ------------------
 3640|      0|        TIFFSwabLong8((uint64_t *)value);
 3641|     13|    return (TIFFReadDirEntryErrOk);
 3642|     21|}
tif_dirread.c:TIFFReadDirEntryDouble:
 1077|      3|{
 1078|      3|    enum TIFFReadDirEntryErr err;
 1079|      3|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (1079:9): [True: 3, False: 0]
  ------------------
 1080|      3|        return (TIFFReadDirEntryErrCount);
 1081|      0|    switch (direntry->tdir_type)
 1082|      0|    {
 1083|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (1083:9): [True: 0, False: 0]
  ------------------
 1084|      0|        {
 1085|      0|            uint8_t m;
 1086|      0|            TIFFReadDirEntryCheckedByte(tif, direntry, &m);
 1087|      0|            *value = (double)m;
 1088|      0|            return (TIFFReadDirEntryErrOk);
 1089|      0|        }
 1090|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (1090:9): [True: 0, False: 0]
  ------------------
 1091|      0|        {
 1092|      0|            int8_t m;
 1093|      0|            TIFFReadDirEntryCheckedSbyte(tif, direntry, &m);
 1094|      0|            *value = (double)m;
 1095|      0|            return (TIFFReadDirEntryErrOk);
 1096|      0|        }
 1097|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (1097:9): [True: 0, False: 0]
  ------------------
 1098|      0|        {
 1099|      0|            uint16_t m;
 1100|      0|            TIFFReadDirEntryCheckedShort(tif, direntry, &m);
 1101|      0|            *value = (double)m;
 1102|      0|            return (TIFFReadDirEntryErrOk);
 1103|      0|        }
 1104|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (1104:9): [True: 0, False: 0]
  ------------------
 1105|      0|        {
 1106|      0|            int16_t m;
 1107|      0|            TIFFReadDirEntryCheckedSshort(tif, direntry, &m);
 1108|      0|            *value = (double)m;
 1109|      0|            return (TIFFReadDirEntryErrOk);
 1110|      0|        }
 1111|      0|        case TIFF_LONG:
  ------------------
  |  Branch (1111:9): [True: 0, False: 0]
  ------------------
 1112|      0|        {
 1113|      0|            uint32_t m;
 1114|      0|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
 1115|      0|            *value = (double)m;
 1116|      0|            return (TIFFReadDirEntryErrOk);
 1117|      0|        }
 1118|      0|        case TIFF_SLONG:
  ------------------
  |  Branch (1118:9): [True: 0, False: 0]
  ------------------
 1119|      0|        {
 1120|      0|            int32_t m;
 1121|      0|            TIFFReadDirEntryCheckedSlong(tif, direntry, &m);
 1122|      0|            *value = (double)m;
 1123|      0|            return (TIFFReadDirEntryErrOk);
 1124|      0|        }
 1125|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (1125:9): [True: 0, False: 0]
  ------------------
 1126|      0|        {
 1127|      0|            uint64_t m;
 1128|      0|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, &m);
 1129|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1129:17): [True: 0, False: 0]
  ------------------
 1130|      0|                return (err);
 1131|      0|            *value = (double)m;
 1132|      0|            return (TIFFReadDirEntryErrOk);
 1133|      0|        }
 1134|      0|        case TIFF_SLONG8:
  ------------------
  |  Branch (1134:9): [True: 0, False: 0]
  ------------------
 1135|      0|        {
 1136|      0|            int64_t m;
 1137|      0|            err = TIFFReadDirEntryCheckedSlong8(tif, direntry, &m);
 1138|      0|            if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1138:17): [True: 0, False: 0]
  ------------------
 1139|      0|                return (err);
 1140|      0|            *value = (double)m;
 1141|      0|            return (TIFFReadDirEntryErrOk);
 1142|      0|        }
 1143|      0|        case TIFF_RATIONAL:
  ------------------
  |  Branch (1143:9): [True: 0, False: 0]
  ------------------
 1144|      0|            err = TIFFReadDirEntryCheckedRational(tif, direntry, value);
 1145|      0|            return (err);
 1146|      0|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (1146:9): [True: 0, False: 0]
  ------------------
 1147|      0|            err = TIFFReadDirEntryCheckedSrational(tif, direntry, value);
 1148|      0|            return (err);
 1149|      0|        case TIFF_FLOAT:
  ------------------
  |  Branch (1149:9): [True: 0, False: 0]
  ------------------
 1150|      0|        {
 1151|      0|            float m;
 1152|      0|            TIFFReadDirEntryCheckedFloat(tif, direntry, &m);
 1153|      0|            *value = (double)m;
 1154|      0|            return (TIFFReadDirEntryErrOk);
 1155|      0|        }
 1156|      0|        case TIFF_DOUBLE:
  ------------------
  |  Branch (1156:9): [True: 0, False: 0]
  ------------------
 1157|      0|            err = TIFFReadDirEntryCheckedDouble(tif, direntry, value);
 1158|      0|            return (err);
 1159|      0|        default:
  ------------------
  |  Branch (1159:9): [True: 0, False: 0]
  ------------------
 1160|      0|            return (TIFFReadDirEntryErrType);
 1161|      0|    }
 1162|      0|}
tif_dirread.c:TIFFReadDirEntryIfd8:
 1166|     59|{
 1167|     59|    enum TIFFReadDirEntryErr err;
 1168|     59|    if (direntry->tdir_count != 1)
  ------------------
  |  Branch (1168:9): [True: 38, False: 21]
  ------------------
 1169|     38|        return (TIFFReadDirEntryErrCount);
 1170|     21|    switch (direntry->tdir_type)
 1171|     21|    {
 1172|     11|        case TIFF_LONG:
  ------------------
  |  Branch (1172:9): [True: 11, False: 10]
  ------------------
 1173|     13|        case TIFF_IFD:
  ------------------
  |  Branch (1173:9): [True: 2, False: 19]
  ------------------
 1174|     13|        {
 1175|     13|            uint32_t m;
 1176|     13|            TIFFReadDirEntryCheckedLong(tif, direntry, &m);
 1177|     13|            *value = (uint64_t)m;
 1178|     13|            return (TIFFReadDirEntryErrOk);
 1179|     11|        }
 1180|      1|        case TIFF_LONG8:
  ------------------
  |  Branch (1180:9): [True: 1, False: 20]
  ------------------
 1181|      1|        case TIFF_IFD8:
  ------------------
  |  Branch (1181:9): [True: 0, False: 21]
  ------------------
 1182|      1|            err = TIFFReadDirEntryCheckedLong8(tif, direntry, value);
 1183|      1|            return (err);
 1184|      7|        default:
  ------------------
  |  Branch (1184:9): [True: 7, False: 14]
  ------------------
 1185|      7|            return (TIFFReadDirEntryErrType);
 1186|     21|    }
 1187|     21|}
tif_dirread.c:TIFFReadDirEntrySbyteArray:
 1583|    476|{
 1584|    476|    enum TIFFReadDirEntryErr err;
 1585|    476|    uint32_t count;
 1586|    476|    void *origdata;
 1587|    476|    int8_t *data;
 1588|    476|    switch (direntry->tdir_type)
 1589|    476|    {
 1590|      0|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1590:9): [True: 0, False: 476]
  ------------------
 1591|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (1591:9): [True: 0, False: 476]
  ------------------
 1592|    476|        case TIFF_SBYTE:
  ------------------
  |  Branch (1592:9): [True: 476, False: 0]
  ------------------
 1593|    476|        case TIFF_SHORT:
  ------------------
  |  Branch (1593:9): [True: 0, False: 476]
  ------------------
 1594|    476|        case TIFF_SSHORT:
  ------------------
  |  Branch (1594:9): [True: 0, False: 476]
  ------------------
 1595|    476|        case TIFF_LONG:
  ------------------
  |  Branch (1595:9): [True: 0, False: 476]
  ------------------
 1596|    476|        case TIFF_SLONG:
  ------------------
  |  Branch (1596:9): [True: 0, False: 476]
  ------------------
 1597|    476|        case TIFF_LONG8:
  ------------------
  |  Branch (1597:9): [True: 0, False: 476]
  ------------------
 1598|    476|        case TIFF_SLONG8:
  ------------------
  |  Branch (1598:9): [True: 0, False: 476]
  ------------------
 1599|    476|            break;
 1600|      0|        default:
  ------------------
  |  Branch (1600:9): [True: 0, False: 476]
  ------------------
 1601|      0|            return (TIFFReadDirEntryErrType);
 1602|    476|    }
 1603|    476|    err = TIFFReadDirEntryArray(tif, direntry, &count, 1, &origdata);
 1604|    476|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1604:9): [True: 417, False: 59]
  |  Branch (1604:43): [True: 9, False: 50]
  ------------------
 1605|    426|    {
 1606|    426|        *value = 0;
 1607|    426|        return (err);
 1608|    426|    }
 1609|     50|    switch (direntry->tdir_type)
 1610|     50|    {
 1611|      0|        case TIFF_UNDEFINED:
  ------------------
  |  Branch (1611:9): [True: 0, False: 50]
  ------------------
 1612|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (1612:9): [True: 0, False: 50]
  ------------------
 1613|      0|        {
 1614|      0|            uint8_t *m;
 1615|      0|            uint32_t n;
 1616|      0|            m = (uint8_t *)origdata;
 1617|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1617:25): [True: 0, False: 0]
  ------------------
 1618|      0|            {
 1619|      0|                err = TIFFReadDirEntryCheckRangeSbyteByte(*m);
 1620|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1620:21): [True: 0, False: 0]
  ------------------
 1621|      0|                {
 1622|      0|                    _TIFFfreeExt(tif, origdata);
 1623|      0|                    return (err);
 1624|      0|                }
 1625|      0|                m++;
 1626|      0|            }
 1627|      0|            *value = (int8_t *)origdata;
 1628|      0|            return (TIFFReadDirEntryErrOk);
 1629|      0|        }
 1630|     50|        case TIFF_SBYTE:
  ------------------
  |  Branch (1630:9): [True: 50, False: 0]
  ------------------
 1631|     50|            *value = (int8_t *)origdata;
 1632|     50|            return (TIFFReadDirEntryErrOk);
 1633|      0|        default:
  ------------------
  |  Branch (1633:9): [True: 0, False: 50]
  ------------------
 1634|      0|            break;
 1635|     50|    }
 1636|      0|    data = (int8_t *)_TIFFmallocExt(tif, count);
 1637|      0|    if (data == 0)
  ------------------
  |  Branch (1637:9): [True: 0, False: 0]
  ------------------
 1638|      0|    {
 1639|      0|        _TIFFfreeExt(tif, origdata);
 1640|      0|        return (TIFFReadDirEntryErrAlloc);
 1641|      0|    }
 1642|      0|    switch (direntry->tdir_type)
 1643|      0|    {
 1644|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (1644:9): [True: 0, False: 0]
  ------------------
 1645|      0|        {
 1646|      0|            uint16_t *ma;
 1647|      0|            int8_t *mb;
 1648|      0|            uint32_t n;
 1649|      0|            ma = (uint16_t *)origdata;
 1650|      0|            mb = data;
 1651|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1651:25): [True: 0, False: 0]
  ------------------
 1652|      0|            {
 1653|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1653:21): [True: 0, False: 0]
  ------------------
 1654|      0|                    TIFFSwabShort(ma);
 1655|      0|                err = TIFFReadDirEntryCheckRangeSbyteShort(*ma);
 1656|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1656:21): [True: 0, False: 0]
  ------------------
 1657|      0|                    break;
 1658|      0|                *mb++ = (int8_t)(*ma++);
 1659|      0|            }
 1660|      0|        }
 1661|      0|        break;
 1662|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (1662:9): [True: 0, False: 0]
  ------------------
 1663|      0|        {
 1664|      0|            int16_t *ma;
 1665|      0|            int8_t *mb;
 1666|      0|            uint32_t n;
 1667|      0|            ma = (int16_t *)origdata;
 1668|      0|            mb = data;
 1669|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1669:25): [True: 0, False: 0]
  ------------------
 1670|      0|            {
 1671|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1671:21): [True: 0, False: 0]
  ------------------
 1672|      0|                    TIFFSwabShort((uint16_t *)ma);
 1673|      0|                err = TIFFReadDirEntryCheckRangeSbyteSshort(*ma);
 1674|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1674:21): [True: 0, False: 0]
  ------------------
 1675|      0|                    break;
 1676|      0|                *mb++ = (int8_t)(*ma++);
 1677|      0|            }
 1678|      0|        }
 1679|      0|        break;
 1680|      0|        case TIFF_LONG:
  ------------------
  |  Branch (1680:9): [True: 0, False: 0]
  ------------------
 1681|      0|        {
 1682|      0|            uint32_t *ma;
 1683|      0|            int8_t *mb;
 1684|      0|            uint32_t n;
 1685|      0|            ma = (uint32_t *)origdata;
 1686|      0|            mb = data;
 1687|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1687:25): [True: 0, False: 0]
  ------------------
 1688|      0|            {
 1689|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1689:21): [True: 0, False: 0]
  ------------------
 1690|      0|                    TIFFSwabLong(ma);
 1691|      0|                err = TIFFReadDirEntryCheckRangeSbyteLong(*ma);
 1692|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1692:21): [True: 0, False: 0]
  ------------------
 1693|      0|                    break;
 1694|      0|                *mb++ = (int8_t)(*ma++);
 1695|      0|            }
 1696|      0|        }
 1697|      0|        break;
 1698|      0|        case TIFF_SLONG:
  ------------------
  |  Branch (1698:9): [True: 0, False: 0]
  ------------------
 1699|      0|        {
 1700|      0|            int32_t *ma;
 1701|      0|            int8_t *mb;
 1702|      0|            uint32_t n;
 1703|      0|            ma = (int32_t *)origdata;
 1704|      0|            mb = data;
 1705|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1705:25): [True: 0, False: 0]
  ------------------
 1706|      0|            {
 1707|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1707:21): [True: 0, False: 0]
  ------------------
 1708|      0|                    TIFFSwabLong((uint32_t *)ma);
 1709|      0|                err = TIFFReadDirEntryCheckRangeSbyteSlong(*ma);
 1710|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1710:21): [True: 0, False: 0]
  ------------------
 1711|      0|                    break;
 1712|      0|                *mb++ = (int8_t)(*ma++);
 1713|      0|            }
 1714|      0|        }
 1715|      0|        break;
 1716|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (1716:9): [True: 0, False: 0]
  ------------------
 1717|      0|        {
 1718|      0|            uint64_t *ma;
 1719|      0|            int8_t *mb;
 1720|      0|            uint32_t n;
 1721|      0|            ma = (uint64_t *)origdata;
 1722|      0|            mb = data;
 1723|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1723:25): [True: 0, False: 0]
  ------------------
 1724|      0|            {
 1725|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1725:21): [True: 0, False: 0]
  ------------------
 1726|      0|                    TIFFSwabLong8(ma);
 1727|      0|                err = TIFFReadDirEntryCheckRangeSbyteLong8(*ma);
 1728|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1728:21): [True: 0, False: 0]
  ------------------
 1729|      0|                    break;
 1730|      0|                *mb++ = (int8_t)(*ma++);
 1731|      0|            }
 1732|      0|        }
 1733|      0|        break;
 1734|      0|        case TIFF_SLONG8:
  ------------------
  |  Branch (1734:9): [True: 0, False: 0]
  ------------------
 1735|      0|        {
 1736|      0|            int64_t *ma;
 1737|      0|            int8_t *mb;
 1738|      0|            uint32_t n;
 1739|      0|            ma = (int64_t *)origdata;
 1740|      0|            mb = data;
 1741|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1741:25): [True: 0, False: 0]
  ------------------
 1742|      0|            {
 1743|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1743:21): [True: 0, False: 0]
  ------------------
 1744|      0|                    TIFFSwabLong8((uint64_t *)ma);
 1745|      0|                err = TIFFReadDirEntryCheckRangeSbyteSlong8(*ma);
 1746|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1746:21): [True: 0, False: 0]
  ------------------
 1747|      0|                    break;
 1748|      0|                *mb++ = (int8_t)(*ma++);
 1749|      0|            }
 1750|      0|        }
 1751|      0|        break;
 1752|      0|        default:
  ------------------
  |  Branch (1752:9): [True: 0, False: 0]
  ------------------
 1753|      0|            break;
 1754|      0|    }
 1755|      0|    _TIFFfreeExt(tif, origdata);
 1756|      0|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1756:9): [True: 0, False: 0]
  ------------------
 1757|      0|    {
 1758|      0|        _TIFFfreeExt(tif, data);
 1759|      0|        return (err);
 1760|      0|    }
 1761|      0|    *value = data;
 1762|      0|    return (TIFFReadDirEntryErrOk);
 1763|      0|}
tif_dirread.c:TIFFReadDirEntrySshortArray:
 1945|    512|{
 1946|    512|    enum TIFFReadDirEntryErr err;
 1947|    512|    uint32_t count;
 1948|    512|    void *origdata;
 1949|    512|    int16_t *data;
 1950|    512|    switch (direntry->tdir_type)
 1951|    512|    {
 1952|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (1952:9): [True: 0, False: 512]
  ------------------
 1953|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (1953:9): [True: 0, False: 512]
  ------------------
 1954|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (1954:9): [True: 0, False: 512]
  ------------------
 1955|    512|        case TIFF_SSHORT:
  ------------------
  |  Branch (1955:9): [True: 512, False: 0]
  ------------------
 1956|    512|        case TIFF_LONG:
  ------------------
  |  Branch (1956:9): [True: 0, False: 512]
  ------------------
 1957|    512|        case TIFF_SLONG:
  ------------------
  |  Branch (1957:9): [True: 0, False: 512]
  ------------------
 1958|    512|        case TIFF_LONG8:
  ------------------
  |  Branch (1958:9): [True: 0, False: 512]
  ------------------
 1959|    512|        case TIFF_SLONG8:
  ------------------
  |  Branch (1959:9): [True: 0, False: 512]
  ------------------
 1960|    512|            break;
 1961|      0|        default:
  ------------------
  |  Branch (1961:9): [True: 0, False: 512]
  ------------------
 1962|      0|            return (TIFFReadDirEntryErrType);
 1963|    512|    }
 1964|    512|    err = TIFFReadDirEntryArray(tif, direntry, &count, 2, &origdata);
 1965|    512|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (1965:9): [True: 390, False: 122]
  |  Branch (1965:43): [True: 9, False: 113]
  ------------------
 1966|    399|    {
 1967|    399|        *value = 0;
 1968|    399|        return (err);
 1969|    399|    }
 1970|    113|    switch (direntry->tdir_type)
 1971|    113|    {
 1972|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (1972:9): [True: 0, False: 113]
  ------------------
 1973|      0|        {
 1974|      0|            uint16_t *m;
 1975|      0|            uint32_t n;
 1976|      0|            m = (uint16_t *)origdata;
 1977|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (1977:25): [True: 0, False: 0]
  ------------------
 1978|      0|            {
 1979|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1979:21): [True: 0, False: 0]
  ------------------
 1980|      0|                    TIFFSwabShort(m);
 1981|      0|                err = TIFFReadDirEntryCheckRangeSshortShort(*m);
 1982|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (1982:21): [True: 0, False: 0]
  ------------------
 1983|      0|                {
 1984|      0|                    _TIFFfreeExt(tif, origdata);
 1985|      0|                    return (err);
 1986|      0|                }
 1987|      0|                m++;
 1988|      0|            }
 1989|      0|            *value = (int16_t *)origdata;
 1990|      0|            return (TIFFReadDirEntryErrOk);
 1991|      0|        }
 1992|    113|        case TIFF_SSHORT:
  ------------------
  |  Branch (1992:9): [True: 113, False: 0]
  ------------------
 1993|    113|            *value = (int16_t *)origdata;
 1994|    113|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    113|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1994:17): [True: 4, False: 109]
  ------------------
 1995|      4|                TIFFSwabArrayOfShort((uint16_t *)(*value), count);
 1996|    113|            return (TIFFReadDirEntryErrOk);
 1997|      0|        default:
  ------------------
  |  Branch (1997:9): [True: 0, False: 113]
  ------------------
 1998|      0|            break;
 1999|    113|    }
 2000|      0|    data = (int16_t *)_TIFFCheckMalloc(tif, count, sizeof(int16_t),
 2001|      0|                                       "TIFFReadDirEntrySshortArray");
 2002|      0|    if (data == 0)
  ------------------
  |  Branch (2002:9): [True: 0, False: 0]
  ------------------
 2003|      0|    {
 2004|      0|        _TIFFfreeExt(tif, origdata);
 2005|      0|        return (TIFFReadDirEntryErrAlloc);
 2006|      0|    }
 2007|      0|    switch (direntry->tdir_type)
 2008|      0|    {
 2009|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (2009:9): [True: 0, False: 0]
  ------------------
 2010|      0|        {
 2011|      0|            uint8_t *ma;
 2012|      0|            int16_t *mb;
 2013|      0|            uint32_t n;
 2014|      0|            ma = (uint8_t *)origdata;
 2015|      0|            mb = data;
 2016|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2016:25): [True: 0, False: 0]
  ------------------
 2017|      0|                *mb++ = (int16_t)(*ma++);
 2018|      0|        }
 2019|      0|        break;
 2020|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2020:9): [True: 0, False: 0]
  ------------------
 2021|      0|        {
 2022|      0|            int8_t *ma;
 2023|      0|            int16_t *mb;
 2024|      0|            uint32_t n;
 2025|      0|            ma = (int8_t *)origdata;
 2026|      0|            mb = data;
 2027|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2027:25): [True: 0, False: 0]
  ------------------
 2028|      0|                *mb++ = (int16_t)(*ma++);
 2029|      0|        }
 2030|      0|        break;
 2031|      0|        case TIFF_LONG:
  ------------------
  |  Branch (2031:9): [True: 0, False: 0]
  ------------------
 2032|      0|        {
 2033|      0|            uint32_t *ma;
 2034|      0|            int16_t *mb;
 2035|      0|            uint32_t n;
 2036|      0|            ma = (uint32_t *)origdata;
 2037|      0|            mb = data;
 2038|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2038:25): [True: 0, False: 0]
  ------------------
 2039|      0|            {
 2040|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2040:21): [True: 0, False: 0]
  ------------------
 2041|      0|                    TIFFSwabLong(ma);
 2042|      0|                err = TIFFReadDirEntryCheckRangeSshortLong(*ma);
 2043|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2043:21): [True: 0, False: 0]
  ------------------
 2044|      0|                    break;
 2045|      0|                *mb++ = (int16_t)(*ma++);
 2046|      0|            }
 2047|      0|        }
 2048|      0|        break;
 2049|      0|        case TIFF_SLONG:
  ------------------
  |  Branch (2049:9): [True: 0, False: 0]
  ------------------
 2050|      0|        {
 2051|      0|            int32_t *ma;
 2052|      0|            int16_t *mb;
 2053|      0|            uint32_t n;
 2054|      0|            ma = (int32_t *)origdata;
 2055|      0|            mb = data;
 2056|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2056:25): [True: 0, False: 0]
  ------------------
 2057|      0|            {
 2058|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2058:21): [True: 0, False: 0]
  ------------------
 2059|      0|                    TIFFSwabLong((uint32_t *)ma);
 2060|      0|                err = TIFFReadDirEntryCheckRangeSshortSlong(*ma);
 2061|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2061:21): [True: 0, False: 0]
  ------------------
 2062|      0|                    break;
 2063|      0|                *mb++ = (int16_t)(*ma++);
 2064|      0|            }
 2065|      0|        }
 2066|      0|        break;
 2067|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (2067:9): [True: 0, False: 0]
  ------------------
 2068|      0|        {
 2069|      0|            uint64_t *ma;
 2070|      0|            int16_t *mb;
 2071|      0|            uint32_t n;
 2072|      0|            ma = (uint64_t *)origdata;
 2073|      0|            mb = data;
 2074|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2074:25): [True: 0, False: 0]
  ------------------
 2075|      0|            {
 2076|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2076:21): [True: 0, False: 0]
  ------------------
 2077|      0|                    TIFFSwabLong8(ma);
 2078|      0|                err = TIFFReadDirEntryCheckRangeSshortLong8(*ma);
 2079|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2079:21): [True: 0, False: 0]
  ------------------
 2080|      0|                    break;
 2081|      0|                *mb++ = (int16_t)(*ma++);
 2082|      0|            }
 2083|      0|        }
 2084|      0|        break;
 2085|      0|        case TIFF_SLONG8:
  ------------------
  |  Branch (2085:9): [True: 0, False: 0]
  ------------------
 2086|      0|        {
 2087|      0|            int64_t *ma;
 2088|      0|            int16_t *mb;
 2089|      0|            uint32_t n;
 2090|      0|            ma = (int64_t *)origdata;
 2091|      0|            mb = data;
 2092|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2092:25): [True: 0, False: 0]
  ------------------
 2093|      0|            {
 2094|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2094:21): [True: 0, False: 0]
  ------------------
 2095|      0|                    TIFFSwabLong8((uint64_t *)ma);
 2096|      0|                err = TIFFReadDirEntryCheckRangeSshortSlong8(*ma);
 2097|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2097:21): [True: 0, False: 0]
  ------------------
 2098|      0|                    break;
 2099|      0|                *mb++ = (int16_t)(*ma++);
 2100|      0|            }
 2101|      0|        }
 2102|      0|        break;
 2103|      0|        default:
  ------------------
  |  Branch (2103:9): [True: 0, False: 0]
  ------------------
 2104|      0|            break;
 2105|      0|    }
 2106|      0|    _TIFFfreeExt(tif, origdata);
 2107|      0|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2107:9): [True: 0, False: 0]
  ------------------
 2108|      0|    {
 2109|      0|        _TIFFfreeExt(tif, data);
 2110|      0|        return (err);
 2111|      0|    }
 2112|      0|    *value = data;
 2113|      0|    return (TIFFReadDirEntryErrOk);
 2114|      0|}
tif_dirread.c:TIFFReadDirEntryLongArray:
 2118|  1.44k|{
 2119|  1.44k|    enum TIFFReadDirEntryErr err;
 2120|  1.44k|    uint32_t count;
 2121|  1.44k|    void *origdata;
 2122|  1.44k|    uint32_t *data;
 2123|  1.44k|    switch (direntry->tdir_type)
 2124|  1.44k|    {
 2125|      1|        case TIFF_BYTE:
  ------------------
  |  Branch (2125:9): [True: 1, False: 1.44k]
  ------------------
 2126|      1|        case TIFF_SBYTE:
  ------------------
  |  Branch (2126:9): [True: 0, False: 1.44k]
  ------------------
 2127|      1|        case TIFF_SHORT:
  ------------------
  |  Branch (2127:9): [True: 0, False: 1.44k]
  ------------------
 2128|     19|        case TIFF_SSHORT:
  ------------------
  |  Branch (2128:9): [True: 18, False: 1.42k]
  ------------------
 2129|  1.29k|        case TIFF_LONG:
  ------------------
  |  Branch (2129:9): [True: 1.27k, False: 169]
  ------------------
 2130|  1.29k|        case TIFF_SLONG:
  ------------------
  |  Branch (2130:9): [True: 4, False: 1.44k]
  ------------------
 2131|  1.33k|        case TIFF_LONG8:
  ------------------
  |  Branch (2131:9): [True: 33, False: 1.41k]
  ------------------
 2132|  1.40k|        case TIFF_SLONG8:
  ------------------
  |  Branch (2132:9): [True: 75, False: 1.37k]
  ------------------
 2133|  1.42k|        case TIFF_IFD:
  ------------------
  |  Branch (2133:9): [True: 15, False: 1.43k]
  ------------------
 2134|  1.43k|        case TIFF_IFD8:
  ------------------
  |  Branch (2134:9): [True: 16, False: 1.42k]
  ------------------
 2135|  1.43k|            break;
 2136|      7|        default:
  ------------------
  |  Branch (2136:9): [True: 7, False: 1.43k]
  ------------------
 2137|      7|            return (TIFFReadDirEntryErrType);
 2138|  1.44k|    }
 2139|  1.43k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 4, &origdata);
 2140|  1.43k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2140:9): [True: 1.03k, False: 402]
  |  Branch (2140:43): [True: 165, False: 237]
  ------------------
 2141|  1.20k|    {
 2142|  1.20k|        *value = 0;
 2143|  1.20k|        return (err);
 2144|  1.20k|    }
 2145|    237|    switch (direntry->tdir_type)
 2146|    237|    {
 2147|    108|        case TIFF_LONG:
  ------------------
  |  Branch (2147:9): [True: 108, False: 129]
  ------------------
 2148|    116|        case TIFF_IFD:
  ------------------
  |  Branch (2148:9): [True: 8, False: 229]
  ------------------
 2149|    116|            *value = (uint32_t *)origdata;
 2150|    116|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    116|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2150:17): [True: 20, False: 96]
  ------------------
 2151|     20|                TIFFSwabArrayOfLong(*value, count);
 2152|    116|            return (TIFFReadDirEntryErrOk);
 2153|      3|        case TIFF_SLONG:
  ------------------
  |  Branch (2153:9): [True: 3, False: 234]
  ------------------
 2154|      3|        {
 2155|      3|            int32_t *m;
 2156|      3|            uint32_t n;
 2157|      3|            m = (int32_t *)origdata;
 2158|    331|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2158:25): [True: 328, False: 3]
  ------------------
 2159|    328|            {
 2160|    328|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    328|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2160:21): [True: 132, False: 196]
  ------------------
 2161|    132|                    TIFFSwabLong((uint32_t *)m);
 2162|    328|                err = TIFFReadDirEntryCheckRangeLongSlong(*m);
 2163|    328|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2163:21): [True: 0, False: 328]
  ------------------
 2164|      0|                {
 2165|      0|                    _TIFFfreeExt(tif, origdata);
 2166|      0|                    return (err);
 2167|      0|                }
 2168|    328|                m++;
 2169|    328|            }
 2170|      3|            *value = (uint32_t *)origdata;
 2171|      3|            return (TIFFReadDirEntryErrOk);
 2172|      3|        }
 2173|    118|        default:
  ------------------
  |  Branch (2173:9): [True: 118, False: 119]
  ------------------
 2174|    118|            break;
 2175|    237|    }
 2176|    118|    data = (uint32_t *)_TIFFCheckMalloc(tif, count, sizeof(uint32_t),
 2177|    118|                                        "TIFFReadDirEntryLongArray");
 2178|    118|    if (data == 0)
  ------------------
  |  Branch (2178:9): [True: 0, False: 118]
  ------------------
 2179|      0|    {
 2180|      0|        _TIFFfreeExt(tif, origdata);
 2181|      0|        return (TIFFReadDirEntryErrAlloc);
 2182|      0|    }
 2183|    118|    switch (direntry->tdir_type)
 2184|    118|    {
 2185|      1|        case TIFF_BYTE:
  ------------------
  |  Branch (2185:9): [True: 1, False: 117]
  ------------------
 2186|      1|        {
 2187|      1|            uint8_t *ma;
 2188|      1|            uint32_t *mb;
 2189|      1|            uint32_t n;
 2190|      1|            ma = (uint8_t *)origdata;
 2191|      1|            mb = data;
 2192|    388|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2192:25): [True: 387, False: 1]
  ------------------
 2193|    387|                *mb++ = (uint32_t)(*ma++);
 2194|      1|        }
 2195|      1|        break;
 2196|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2196:9): [True: 0, False: 118]
  ------------------
 2197|      0|        {
 2198|      0|            int8_t *ma;
 2199|      0|            uint32_t *mb;
 2200|      0|            uint32_t n;
 2201|      0|            ma = (int8_t *)origdata;
 2202|      0|            mb = data;
 2203|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2203:25): [True: 0, False: 0]
  ------------------
 2204|      0|            {
 2205|      0|                err = TIFFReadDirEntryCheckRangeLongSbyte(*ma);
 2206|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2206:21): [True: 0, False: 0]
  ------------------
 2207|      0|                    break;
 2208|      0|                *mb++ = (uint32_t)(*ma++);
 2209|      0|            }
 2210|      0|        }
 2211|      0|        break;
 2212|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (2212:9): [True: 0, False: 118]
  ------------------
 2213|      0|        {
 2214|      0|            uint16_t *ma;
 2215|      0|            uint32_t *mb;
 2216|      0|            uint32_t n;
 2217|      0|            ma = (uint16_t *)origdata;
 2218|      0|            mb = data;
 2219|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2219:25): [True: 0, False: 0]
  ------------------
 2220|      0|            {
 2221|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2221:21): [True: 0, False: 0]
  ------------------
 2222|      0|                    TIFFSwabShort(ma);
 2223|      0|                *mb++ = (uint32_t)(*ma++);
 2224|      0|            }
 2225|      0|        }
 2226|      0|        break;
 2227|     18|        case TIFF_SSHORT:
  ------------------
  |  Branch (2227:9): [True: 18, False: 100]
  ------------------
 2228|     18|        {
 2229|     18|            int16_t *ma;
 2230|     18|            uint32_t *mb;
 2231|     18|            uint32_t n;
 2232|     18|            ma = (int16_t *)origdata;
 2233|     18|            mb = data;
 2234|    202|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2234:25): [True: 188, False: 14]
  ------------------
 2235|    188|            {
 2236|    188|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    188|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2236:21): [True: 0, False: 188]
  ------------------
 2237|      0|                    TIFFSwabShort((uint16_t *)ma);
 2238|    188|                err = TIFFReadDirEntryCheckRangeLongSshort(*ma);
 2239|    188|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2239:21): [True: 4, False: 184]
  ------------------
 2240|      4|                    break;
 2241|    184|                *mb++ = (uint32_t)(*ma++);
 2242|    184|            }
 2243|     18|        }
 2244|     18|        break;
 2245|     32|        case TIFF_LONG8:
  ------------------
  |  Branch (2245:9): [True: 32, False: 86]
  ------------------
 2246|     41|        case TIFF_IFD8:
  ------------------
  |  Branch (2246:9): [True: 9, False: 109]
  ------------------
 2247|     41|        {
 2248|     41|            uint64_t *ma;
 2249|     41|            uint32_t *mb;
 2250|     41|            uint32_t n;
 2251|     41|            ma = (uint64_t *)origdata;
 2252|     41|            mb = data;
 2253|    589|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2253:25): [True: 577, False: 12]
  ------------------
 2254|    577|            {
 2255|    577|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    577|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2255:21): [True: 165, False: 412]
  ------------------
 2256|    165|                    TIFFSwabLong8(ma);
 2257|    577|                err = TIFFReadDirEntryCheckRangeLongLong8(*ma);
 2258|    577|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2258:21): [True: 29, False: 548]
  ------------------
 2259|     29|                    break;
 2260|    548|                *mb++ = (uint32_t)(*ma++);
 2261|    548|            }
 2262|     41|        }
 2263|     41|        break;
 2264|     58|        case TIFF_SLONG8:
  ------------------
  |  Branch (2264:9): [True: 58, False: 60]
  ------------------
 2265|     58|        {
 2266|     58|            int64_t *ma;
 2267|     58|            uint32_t *mb;
 2268|     58|            uint32_t n;
 2269|     58|            ma = (int64_t *)origdata;
 2270|     58|            mb = data;
 2271|    802|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2271:25): [True: 790, False: 12]
  ------------------
 2272|    790|            {
 2273|    790|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    790|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2273:21): [True: 223, False: 567]
  ------------------
 2274|    223|                    TIFFSwabLong8((uint64_t *)ma);
 2275|    790|                err = TIFFReadDirEntryCheckRangeLongSlong8(*ma);
 2276|    790|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2276:21): [True: 46, False: 744]
  ------------------
 2277|     46|                    break;
 2278|    744|                *mb++ = (uint32_t)(*ma++);
 2279|    744|            }
 2280|     58|        }
 2281|     58|        break;
 2282|      0|        default:
  ------------------
  |  Branch (2282:9): [True: 0, False: 118]
  ------------------
 2283|      0|            break;
 2284|    118|    }
 2285|    118|    _TIFFfreeExt(tif, origdata);
 2286|    118|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2286:9): [True: 79, False: 39]
  ------------------
 2287|     79|    {
 2288|     79|        _TIFFfreeExt(tif, data);
 2289|     79|        return (err);
 2290|     79|    }
 2291|     39|    *value = data;
 2292|     39|    return (TIFFReadDirEntryErrOk);
 2293|    118|}
tif_dirread.c:TIFFReadDirEntrySlongArray:
 2297|    309|{
 2298|    309|    enum TIFFReadDirEntryErr err;
 2299|    309|    uint32_t count;
 2300|    309|    void *origdata;
 2301|    309|    int32_t *data;
 2302|    309|    switch (direntry->tdir_type)
 2303|    309|    {
 2304|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (2304:9): [True: 0, False: 309]
  ------------------
 2305|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2305:9): [True: 0, False: 309]
  ------------------
 2306|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (2306:9): [True: 0, False: 309]
  ------------------
 2307|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (2307:9): [True: 0, False: 309]
  ------------------
 2308|      0|        case TIFF_LONG:
  ------------------
  |  Branch (2308:9): [True: 0, False: 309]
  ------------------
 2309|    309|        case TIFF_SLONG:
  ------------------
  |  Branch (2309:9): [True: 309, False: 0]
  ------------------
 2310|    309|        case TIFF_LONG8:
  ------------------
  |  Branch (2310:9): [True: 0, False: 309]
  ------------------
 2311|    309|        case TIFF_SLONG8:
  ------------------
  |  Branch (2311:9): [True: 0, False: 309]
  ------------------
 2312|    309|            break;
 2313|      0|        default:
  ------------------
  |  Branch (2313:9): [True: 0, False: 309]
  ------------------
 2314|      0|            return (TIFFReadDirEntryErrType);
 2315|    309|    }
 2316|    309|    err = TIFFReadDirEntryArray(tif, direntry, &count, 4, &origdata);
 2317|    309|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2317:9): [True: 259, False: 50]
  |  Branch (2317:43): [True: 39, False: 11]
  ------------------
 2318|    298|    {
 2319|    298|        *value = 0;
 2320|    298|        return (err);
 2321|    298|    }
 2322|     11|    switch (direntry->tdir_type)
 2323|     11|    {
 2324|      0|        case TIFF_LONG:
  ------------------
  |  Branch (2324:9): [True: 0, False: 11]
  ------------------
 2325|      0|        {
 2326|      0|            uint32_t *m;
 2327|      0|            uint32_t n;
 2328|      0|            m = (uint32_t *)origdata;
 2329|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2329:25): [True: 0, False: 0]
  ------------------
 2330|      0|            {
 2331|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2331:21): [True: 0, False: 0]
  ------------------
 2332|      0|                    TIFFSwabLong((uint32_t *)m);
 2333|      0|                err = TIFFReadDirEntryCheckRangeSlongLong(*m);
 2334|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2334:21): [True: 0, False: 0]
  ------------------
 2335|      0|                {
 2336|      0|                    _TIFFfreeExt(tif, origdata);
 2337|      0|                    return (err);
 2338|      0|                }
 2339|      0|                m++;
 2340|      0|            }
 2341|      0|            *value = (int32_t *)origdata;
 2342|      0|            return (TIFFReadDirEntryErrOk);
 2343|      0|        }
 2344|     11|        case TIFF_SLONG:
  ------------------
  |  Branch (2344:9): [True: 11, False: 0]
  ------------------
 2345|     11|            *value = (int32_t *)origdata;
 2346|     11|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     11|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2346:17): [True: 8, False: 3]
  ------------------
 2347|      8|                TIFFSwabArrayOfLong((uint32_t *)(*value), count);
 2348|     11|            return (TIFFReadDirEntryErrOk);
 2349|      0|        default:
  ------------------
  |  Branch (2349:9): [True: 0, False: 11]
  ------------------
 2350|      0|            break;
 2351|     11|    }
 2352|      0|    data = (int32_t *)_TIFFCheckMalloc(tif, count, sizeof(int32_t),
 2353|      0|                                       "TIFFReadDirEntrySlongArray");
 2354|      0|    if (data == 0)
  ------------------
  |  Branch (2354:9): [True: 0, False: 0]
  ------------------
 2355|      0|    {
 2356|      0|        _TIFFfreeExt(tif, origdata);
 2357|      0|        return (TIFFReadDirEntryErrAlloc);
 2358|      0|    }
 2359|      0|    switch (direntry->tdir_type)
 2360|      0|    {
 2361|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (2361:9): [True: 0, False: 0]
  ------------------
 2362|      0|        {
 2363|      0|            uint8_t *ma;
 2364|      0|            int32_t *mb;
 2365|      0|            uint32_t n;
 2366|      0|            ma = (uint8_t *)origdata;
 2367|      0|            mb = data;
 2368|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2368:25): [True: 0, False: 0]
  ------------------
 2369|      0|                *mb++ = (int32_t)(*ma++);
 2370|      0|        }
 2371|      0|        break;
 2372|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2372:9): [True: 0, False: 0]
  ------------------
 2373|      0|        {
 2374|      0|            int8_t *ma;
 2375|      0|            int32_t *mb;
 2376|      0|            uint32_t n;
 2377|      0|            ma = (int8_t *)origdata;
 2378|      0|            mb = data;
 2379|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2379:25): [True: 0, False: 0]
  ------------------
 2380|      0|                *mb++ = (int32_t)(*ma++);
 2381|      0|        }
 2382|      0|        break;
 2383|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (2383:9): [True: 0, False: 0]
  ------------------
 2384|      0|        {
 2385|      0|            uint16_t *ma;
 2386|      0|            int32_t *mb;
 2387|      0|            uint32_t n;
 2388|      0|            ma = (uint16_t *)origdata;
 2389|      0|            mb = data;
 2390|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2390:25): [True: 0, False: 0]
  ------------------
 2391|      0|            {
 2392|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2392:21): [True: 0, False: 0]
  ------------------
 2393|      0|                    TIFFSwabShort(ma);
 2394|      0|                *mb++ = (int32_t)(*ma++);
 2395|      0|            }
 2396|      0|        }
 2397|      0|        break;
 2398|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (2398:9): [True: 0, False: 0]
  ------------------
 2399|      0|        {
 2400|      0|            int16_t *ma;
 2401|      0|            int32_t *mb;
 2402|      0|            uint32_t n;
 2403|      0|            ma = (int16_t *)origdata;
 2404|      0|            mb = data;
 2405|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2405:25): [True: 0, False: 0]
  ------------------
 2406|      0|            {
 2407|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2407:21): [True: 0, False: 0]
  ------------------
 2408|      0|                    TIFFSwabShort((uint16_t *)ma);
 2409|      0|                *mb++ = (int32_t)(*ma++);
 2410|      0|            }
 2411|      0|        }
 2412|      0|        break;
 2413|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (2413:9): [True: 0, False: 0]
  ------------------
 2414|      0|        {
 2415|      0|            uint64_t *ma;
 2416|      0|            int32_t *mb;
 2417|      0|            uint32_t n;
 2418|      0|            ma = (uint64_t *)origdata;
 2419|      0|            mb = data;
 2420|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2420:25): [True: 0, False: 0]
  ------------------
 2421|      0|            {
 2422|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2422:21): [True: 0, False: 0]
  ------------------
 2423|      0|                    TIFFSwabLong8(ma);
 2424|      0|                err = TIFFReadDirEntryCheckRangeSlongLong8(*ma);
 2425|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2425:21): [True: 0, False: 0]
  ------------------
 2426|      0|                    break;
 2427|      0|                *mb++ = (int32_t)(*ma++);
 2428|      0|            }
 2429|      0|        }
 2430|      0|        break;
 2431|      0|        case TIFF_SLONG8:
  ------------------
  |  Branch (2431:9): [True: 0, False: 0]
  ------------------
 2432|      0|        {
 2433|      0|            int64_t *ma;
 2434|      0|            int32_t *mb;
 2435|      0|            uint32_t n;
 2436|      0|            ma = (int64_t *)origdata;
 2437|      0|            mb = data;
 2438|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2438:25): [True: 0, False: 0]
  ------------------
 2439|      0|            {
 2440|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2440:21): [True: 0, False: 0]
  ------------------
 2441|      0|                    TIFFSwabLong8((uint64_t *)ma);
 2442|      0|                err = TIFFReadDirEntryCheckRangeSlongSlong8(*ma);
 2443|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2443:21): [True: 0, False: 0]
  ------------------
 2444|      0|                    break;
 2445|      0|                *mb++ = (int32_t)(*ma++);
 2446|      0|            }
 2447|      0|        }
 2448|      0|        break;
 2449|      0|        default:
  ------------------
  |  Branch (2449:9): [True: 0, False: 0]
  ------------------
 2450|      0|            break;
 2451|      0|    }
 2452|      0|    _TIFFfreeExt(tif, origdata);
 2453|      0|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2453:9): [True: 0, False: 0]
  ------------------
 2454|      0|    {
 2455|      0|        _TIFFfreeExt(tif, data);
 2456|      0|        return (err);
 2457|      0|    }
 2458|      0|    *value = data;
 2459|      0|    return (TIFFReadDirEntryErrOk);
 2460|      0|}
tif_dirread.c:TIFFReadDirEntryLong8Array:
 2642|  2.62k|{
 2643|  2.62k|    return TIFFReadDirEntryLong8ArrayWithLimit(tif, direntry, value,
 2644|  2.62k|                                               ~((uint64_t)0));
 2645|  2.62k|}
tif_dirread.c:TIFFReadDirEntryLong8ArrayWithLimit:
 2465|  13.0k|{
 2466|  13.0k|    enum TIFFReadDirEntryErr err;
 2467|  13.0k|    uint32_t count;
 2468|  13.0k|    void *origdata;
 2469|  13.0k|    uint64_t *data;
 2470|  13.0k|    switch (direntry->tdir_type)
 2471|  13.0k|    {
 2472|  4.26k|        case TIFF_BYTE:
  ------------------
  |  Branch (2472:9): [True: 4.26k, False: 8.83k]
  ------------------
 2473|  4.32k|        case TIFF_SBYTE:
  ------------------
  |  Branch (2473:9): [True: 58, False: 13.0k]
  ------------------
 2474|  6.95k|        case TIFF_SHORT:
  ------------------
  |  Branch (2474:9): [True: 2.62k, False: 10.4k]
  ------------------
 2475|  6.98k|        case TIFF_SSHORT:
  ------------------
  |  Branch (2475:9): [True: 36, False: 13.0k]
  ------------------
 2476|  11.6k|        case TIFF_LONG:
  ------------------
  |  Branch (2476:9): [True: 4.69k, False: 8.40k]
  ------------------
 2477|  11.6k|        case TIFF_SLONG:
  ------------------
  |  Branch (2477:9): [True: 14, False: 13.0k]
  ------------------
 2478|  12.9k|        case TIFF_LONG8:
  ------------------
  |  Branch (2478:9): [True: 1.30k, False: 11.7k]
  ------------------
 2479|  13.0k|        case TIFF_SLONG8:
  ------------------
  |  Branch (2479:9): [True: 10, False: 13.0k]
  ------------------
 2480|  13.0k|        case TIFF_IFD:
  ------------------
  |  Branch (2480:9): [True: 3, False: 13.0k]
  ------------------
 2481|  13.0k|        case TIFF_IFD8:
  ------------------
  |  Branch (2481:9): [True: 37, False: 13.0k]
  ------------------
 2482|  13.0k|            break;
 2483|     50|        default:
  ------------------
  |  Branch (2483:9): [True: 50, False: 13.0k]
  ------------------
 2484|     50|            return (TIFFReadDirEntryErrType);
 2485|  13.0k|    }
 2486|  13.0k|    err = TIFFReadDirEntryArrayWithLimit(tif, direntry, &count, 8, &origdata,
 2487|  13.0k|                                         maxcount);
 2488|  13.0k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2488:9): [True: 254, False: 12.7k]
  |  Branch (2488:43): [True: 198, False: 12.5k]
  ------------------
 2489|    452|    {
 2490|    452|        *value = 0;
 2491|    452|        return (err);
 2492|    452|    }
 2493|  12.5k|    switch (direntry->tdir_type)
 2494|  12.5k|    {
 2495|  1.16k|        case TIFF_LONG8:
  ------------------
  |  Branch (2495:9): [True: 1.16k, False: 11.4k]
  ------------------
 2496|  1.20k|        case TIFF_IFD8:
  ------------------
  |  Branch (2496:9): [True: 37, False: 12.5k]
  ------------------
 2497|  1.20k|            *value = (uint64_t *)origdata;
 2498|  1.20k|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  1.20k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2498:17): [True: 3, False: 1.19k]
  ------------------
 2499|      3|                TIFFSwabArrayOfLong8(*value, count);
 2500|  1.20k|            return (TIFFReadDirEntryErrOk);
 2501|     10|        case TIFF_SLONG8:
  ------------------
  |  Branch (2501:9): [True: 10, False: 12.5k]
  ------------------
 2502|     10|        {
 2503|     10|            int64_t *m;
 2504|     10|            uint32_t n;
 2505|     10|            m = (int64_t *)origdata;
 2506|    426|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2506:25): [True: 420, False: 6]
  ------------------
 2507|    420|            {
 2508|    420|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    420|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2508:21): [True: 150, False: 270]
  ------------------
 2509|    150|                    TIFFSwabLong8((uint64_t *)m);
 2510|    420|                err = TIFFReadDirEntryCheckRangeLong8Slong8(*m);
 2511|    420|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2511:21): [True: 4, False: 416]
  ------------------
 2512|      4|                {
 2513|      4|                    _TIFFfreeExt(tif, origdata);
 2514|      4|                    return (err);
 2515|      4|                }
 2516|    416|                m++;
 2517|    416|            }
 2518|      6|            *value = (uint64_t *)origdata;
 2519|      6|            return (TIFFReadDirEntryErrOk);
 2520|     10|        }
 2521|  11.3k|        default:
  ------------------
  |  Branch (2521:9): [True: 11.3k, False: 1.21k]
  ------------------
 2522|  11.3k|            break;
 2523|  12.5k|    }
 2524|  11.3k|    data = (uint64_t *)_TIFFCheckMalloc(tif, count, sizeof(uint64_t),
 2525|  11.3k|                                        "TIFFReadDirEntryLong8ArrayWithLimit");
 2526|  11.3k|    if (data == 0)
  ------------------
  |  Branch (2526:9): [True: 0, False: 11.3k]
  ------------------
 2527|      0|    {
 2528|      0|        _TIFFfreeExt(tif, origdata);
 2529|      0|        return (TIFFReadDirEntryErrAlloc);
 2530|      0|    }
 2531|  11.3k|    switch (direntry->tdir_type)
 2532|  11.3k|    {
 2533|  4.07k|        case TIFF_BYTE:
  ------------------
  |  Branch (2533:9): [True: 4.07k, False: 7.31k]
  ------------------
 2534|  4.07k|        {
 2535|  4.07k|            uint8_t *ma;
 2536|  4.07k|            uint64_t *mb;
 2537|  4.07k|            uint32_t n;
 2538|  4.07k|            ma = (uint8_t *)origdata;
 2539|  4.07k|            mb = data;
 2540|   610k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2540:25): [True: 606k, False: 4.07k]
  ------------------
 2541|   606k|                *mb++ = (uint64_t)(*ma++);
 2542|  4.07k|        }
 2543|  4.07k|        break;
 2544|     24|        case TIFF_SBYTE:
  ------------------
  |  Branch (2544:9): [True: 24, False: 11.3k]
  ------------------
 2545|     24|        {
 2546|     24|            int8_t *ma;
 2547|     24|            uint64_t *mb;
 2548|     24|            uint32_t n;
 2549|     24|            ma = (int8_t *)origdata;
 2550|     24|            mb = data;
 2551|     67|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2551:25): [True: 55, False: 12]
  ------------------
 2552|     55|            {
 2553|     55|                err = TIFFReadDirEntryCheckRangeLong8Sbyte(*ma);
 2554|     55|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2554:21): [True: 12, False: 43]
  ------------------
 2555|     12|                    break;
 2556|     43|                *mb++ = (uint64_t)(*ma++);
 2557|     43|            }
 2558|     24|        }
 2559|     24|        break;
 2560|  2.60k|        case TIFF_SHORT:
  ------------------
  |  Branch (2560:9): [True: 2.60k, False: 8.77k]
  ------------------
 2561|  2.60k|        {
 2562|  2.60k|            uint16_t *ma;
 2563|  2.60k|            uint64_t *mb;
 2564|  2.60k|            uint32_t n;
 2565|  2.60k|            ma = (uint16_t *)origdata;
 2566|  2.60k|            mb = data;
 2567|  10.7k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2567:25): [True: 8.15k, False: 2.60k]
  ------------------
 2568|  8.15k|            {
 2569|  8.15k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  8.15k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2569:21): [True: 199, False: 7.96k]
  ------------------
 2570|    199|                    TIFFSwabShort(ma);
 2571|  8.15k|                *mb++ = (uint64_t)(*ma++);
 2572|  8.15k|            }
 2573|  2.60k|        }
 2574|  2.60k|        break;
 2575|     27|        case TIFF_SSHORT:
  ------------------
  |  Branch (2575:9): [True: 27, False: 11.3k]
  ------------------
 2576|     27|        {
 2577|     27|            int16_t *ma;
 2578|     27|            uint64_t *mb;
 2579|     27|            uint32_t n;
 2580|     27|            ma = (int16_t *)origdata;
 2581|     27|            mb = data;
 2582|    521|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2582:25): [True: 494, False: 27]
  ------------------
 2583|    494|            {
 2584|    494|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    494|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2584:21): [True: 129, False: 365]
  ------------------
 2585|    129|                    TIFFSwabShort((uint16_t *)ma);
 2586|    494|                err = TIFFReadDirEntryCheckRangeLong8Sshort(*ma);
 2587|    494|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2587:21): [True: 0, False: 494]
  ------------------
 2588|      0|                    break;
 2589|    494|                *mb++ = (uint64_t)(*ma++);
 2590|    494|            }
 2591|     27|        }
 2592|     27|        break;
 2593|  4.63k|        case TIFF_LONG:
  ------------------
  |  Branch (2593:9): [True: 4.63k, False: 6.74k]
  ------------------
 2594|  4.64k|        case TIFF_IFD:
  ------------------
  |  Branch (2594:9): [True: 3, False: 11.3k]
  ------------------
 2595|  4.64k|        {
 2596|  4.64k|            uint32_t *ma;
 2597|  4.64k|            uint64_t *mb;
 2598|  4.64k|            uint32_t n;
 2599|  4.64k|            ma = (uint32_t *)origdata;
 2600|  4.64k|            mb = data;
 2601|  49.1k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2601:25): [True: 44.5k, False: 4.64k]
  ------------------
 2602|  44.5k|            {
 2603|  44.5k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  44.5k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2603:21): [True: 665, False: 43.8k]
  ------------------
 2604|    665|                    TIFFSwabLong(ma);
 2605|  44.5k|                *mb++ = (uint64_t)(*ma++);
 2606|  44.5k|            }
 2607|  4.64k|        }
 2608|  4.64k|        break;
 2609|     13|        case TIFF_SLONG:
  ------------------
  |  Branch (2609:9): [True: 13, False: 11.3k]
  ------------------
 2610|     13|        {
 2611|     13|            int32_t *ma;
 2612|     13|            uint64_t *mb;
 2613|     13|            uint32_t n;
 2614|     13|            ma = (int32_t *)origdata;
 2615|     13|            mb = data;
 2616|    631|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2616:25): [True: 618, False: 13]
  ------------------
 2617|    618|            {
 2618|    618|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    618|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2618:21): [True: 128, False: 490]
  ------------------
 2619|    128|                    TIFFSwabLong((uint32_t *)ma);
 2620|    618|                err = TIFFReadDirEntryCheckRangeLong8Slong(*ma);
 2621|    618|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2621:21): [True: 0, False: 618]
  ------------------
 2622|      0|                    break;
 2623|    618|                *mb++ = (uint64_t)(*ma++);
 2624|    618|            }
 2625|     13|        }
 2626|     13|        break;
 2627|      0|        default:
  ------------------
  |  Branch (2627:9): [True: 0, False: 11.3k]
  ------------------
 2628|      0|            break;
 2629|  11.3k|    }
 2630|  11.3k|    _TIFFfreeExt(tif, origdata);
 2631|  11.3k|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2631:9): [True: 12, False: 11.3k]
  ------------------
 2632|     12|    {
 2633|     12|        _TIFFfreeExt(tif, data);
 2634|     12|        return (err);
 2635|     12|    }
 2636|  11.3k|    *value = data;
 2637|  11.3k|    return (TIFFReadDirEntryErrOk);
 2638|  11.3k|}
tif_dirread.c:TIFFReadDirEntrySlong8Array:
 2649|    265|{
 2650|    265|    enum TIFFReadDirEntryErr err;
 2651|    265|    uint32_t count;
 2652|    265|    void *origdata;
 2653|    265|    int64_t *data;
 2654|    265|    switch (direntry->tdir_type)
 2655|    265|    {
 2656|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (2656:9): [True: 0, False: 265]
  ------------------
 2657|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2657:9): [True: 0, False: 265]
  ------------------
 2658|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (2658:9): [True: 0, False: 265]
  ------------------
 2659|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (2659:9): [True: 0, False: 265]
  ------------------
 2660|      0|        case TIFF_LONG:
  ------------------
  |  Branch (2660:9): [True: 0, False: 265]
  ------------------
 2661|      0|        case TIFF_SLONG:
  ------------------
  |  Branch (2661:9): [True: 0, False: 265]
  ------------------
 2662|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (2662:9): [True: 0, False: 265]
  ------------------
 2663|    265|        case TIFF_SLONG8:
  ------------------
  |  Branch (2663:9): [True: 265, False: 0]
  ------------------
 2664|    265|            break;
 2665|      0|        default:
  ------------------
  |  Branch (2665:9): [True: 0, False: 265]
  ------------------
 2666|      0|            return (TIFFReadDirEntryErrType);
 2667|    265|    }
 2668|    265|    err = TIFFReadDirEntryArray(tif, direntry, &count, 8, &origdata);
 2669|    265|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2669:9): [True: 128, False: 137]
  |  Branch (2669:43): [True: 36, False: 101]
  ------------------
 2670|    164|    {
 2671|    164|        *value = 0;
 2672|    164|        return (err);
 2673|    164|    }
 2674|    101|    switch (direntry->tdir_type)
 2675|    101|    {
 2676|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (2676:9): [True: 0, False: 101]
  ------------------
 2677|      0|        {
 2678|      0|            uint64_t *m;
 2679|      0|            uint32_t n;
 2680|      0|            m = (uint64_t *)origdata;
 2681|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2681:25): [True: 0, False: 0]
  ------------------
 2682|      0|            {
 2683|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2683:21): [True: 0, False: 0]
  ------------------
 2684|      0|                    TIFFSwabLong8(m);
 2685|      0|                err = TIFFReadDirEntryCheckRangeSlong8Long8(*m);
 2686|      0|                if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (2686:21): [True: 0, False: 0]
  ------------------
 2687|      0|                {
 2688|      0|                    _TIFFfreeExt(tif, origdata);
 2689|      0|                    return (err);
 2690|      0|                }
 2691|      0|                m++;
 2692|      0|            }
 2693|      0|            *value = (int64_t *)origdata;
 2694|      0|            return (TIFFReadDirEntryErrOk);
 2695|      0|        }
 2696|    101|        case TIFF_SLONG8:
  ------------------
  |  Branch (2696:9): [True: 101, False: 0]
  ------------------
 2697|    101|            *value = (int64_t *)origdata;
 2698|    101|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    101|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2698:17): [True: 6, False: 95]
  ------------------
 2699|      6|                TIFFSwabArrayOfLong8((uint64_t *)(*value), count);
 2700|    101|            return (TIFFReadDirEntryErrOk);
 2701|      0|        default:
  ------------------
  |  Branch (2701:9): [True: 0, False: 101]
  ------------------
 2702|      0|            break;
 2703|    101|    }
 2704|      0|    data = (int64_t *)_TIFFCheckMalloc(tif, count, sizeof(int64_t),
 2705|      0|                                       "TIFFReadDirEntrySlong8Array");
 2706|      0|    if (data == 0)
  ------------------
  |  Branch (2706:9): [True: 0, False: 0]
  ------------------
 2707|      0|    {
 2708|      0|        _TIFFfreeExt(tif, origdata);
 2709|      0|        return (TIFFReadDirEntryErrAlloc);
 2710|      0|    }
 2711|      0|    switch (direntry->tdir_type)
 2712|      0|    {
 2713|      0|        case TIFF_BYTE:
  ------------------
  |  Branch (2713:9): [True: 0, False: 0]
  ------------------
 2714|      0|        {
 2715|      0|            uint8_t *ma;
 2716|      0|            int64_t *mb;
 2717|      0|            uint32_t n;
 2718|      0|            ma = (uint8_t *)origdata;
 2719|      0|            mb = data;
 2720|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2720:25): [True: 0, False: 0]
  ------------------
 2721|      0|                *mb++ = (int64_t)(*ma++);
 2722|      0|        }
 2723|      0|        break;
 2724|      0|        case TIFF_SBYTE:
  ------------------
  |  Branch (2724:9): [True: 0, False: 0]
  ------------------
 2725|      0|        {
 2726|      0|            int8_t *ma;
 2727|      0|            int64_t *mb;
 2728|      0|            uint32_t n;
 2729|      0|            ma = (int8_t *)origdata;
 2730|      0|            mb = data;
 2731|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2731:25): [True: 0, False: 0]
  ------------------
 2732|      0|                *mb++ = (int64_t)(*ma++);
 2733|      0|        }
 2734|      0|        break;
 2735|      0|        case TIFF_SHORT:
  ------------------
  |  Branch (2735:9): [True: 0, False: 0]
  ------------------
 2736|      0|        {
 2737|      0|            uint16_t *ma;
 2738|      0|            int64_t *mb;
 2739|      0|            uint32_t n;
 2740|      0|            ma = (uint16_t *)origdata;
 2741|      0|            mb = data;
 2742|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2742:25): [True: 0, False: 0]
  ------------------
 2743|      0|            {
 2744|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2744:21): [True: 0, False: 0]
  ------------------
 2745|      0|                    TIFFSwabShort(ma);
 2746|      0|                *mb++ = (int64_t)(*ma++);
 2747|      0|            }
 2748|      0|        }
 2749|      0|        break;
 2750|      0|        case TIFF_SSHORT:
  ------------------
  |  Branch (2750:9): [True: 0, False: 0]
  ------------------
 2751|      0|        {
 2752|      0|            int16_t *ma;
 2753|      0|            int64_t *mb;
 2754|      0|            uint32_t n;
 2755|      0|            ma = (int16_t *)origdata;
 2756|      0|            mb = data;
 2757|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2757:25): [True: 0, False: 0]
  ------------------
 2758|      0|            {
 2759|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2759:21): [True: 0, False: 0]
  ------------------
 2760|      0|                    TIFFSwabShort((uint16_t *)ma);
 2761|      0|                *mb++ = (int64_t)(*ma++);
 2762|      0|            }
 2763|      0|        }
 2764|      0|        break;
 2765|      0|        case TIFF_LONG:
  ------------------
  |  Branch (2765:9): [True: 0, False: 0]
  ------------------
 2766|      0|        {
 2767|      0|            uint32_t *ma;
 2768|      0|            int64_t *mb;
 2769|      0|            uint32_t n;
 2770|      0|            ma = (uint32_t *)origdata;
 2771|      0|            mb = data;
 2772|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2772:25): [True: 0, False: 0]
  ------------------
 2773|      0|            {
 2774|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2774:21): [True: 0, False: 0]
  ------------------
 2775|      0|                    TIFFSwabLong(ma);
 2776|      0|                *mb++ = (int64_t)(*ma++);
 2777|      0|            }
 2778|      0|        }
 2779|      0|        break;
 2780|      0|        case TIFF_SLONG:
  ------------------
  |  Branch (2780:9): [True: 0, False: 0]
  ------------------
 2781|      0|        {
 2782|      0|            int32_t *ma;
 2783|      0|            int64_t *mb;
 2784|      0|            uint32_t n;
 2785|      0|            ma = (int32_t *)origdata;
 2786|      0|            mb = data;
 2787|      0|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2787:25): [True: 0, False: 0]
  ------------------
 2788|      0|            {
 2789|      0|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2789:21): [True: 0, False: 0]
  ------------------
 2790|      0|                    TIFFSwabLong((uint32_t *)ma);
 2791|      0|                *mb++ = (int64_t)(*ma++);
 2792|      0|            }
 2793|      0|        }
 2794|      0|        break;
 2795|      0|        default:
  ------------------
  |  Branch (2795:9): [True: 0, False: 0]
  ------------------
 2796|      0|            break;
 2797|      0|    }
 2798|      0|    _TIFFfreeExt(tif, origdata);
 2799|      0|    *value = data;
 2800|      0|    return (TIFFReadDirEntryErrOk);
 2801|      0|}
tif_dirread.c:TIFFReadDirEntryFloatArray:
 2805|  1.43k|{
 2806|  1.43k|    enum TIFFReadDirEntryErr err;
 2807|  1.43k|    uint32_t count;
 2808|  1.43k|    void *origdata;
 2809|  1.43k|    float *data;
 2810|  1.43k|    switch (direntry->tdir_type)
 2811|  1.43k|    {
 2812|      7|        case TIFF_BYTE:
  ------------------
  |  Branch (2812:9): [True: 7, False: 1.42k]
  ------------------
 2813|     19|        case TIFF_SBYTE:
  ------------------
  |  Branch (2813:9): [True: 12, False: 1.42k]
  ------------------
 2814|     23|        case TIFF_SHORT:
  ------------------
  |  Branch (2814:9): [True: 4, False: 1.43k]
  ------------------
 2815|     24|        case TIFF_SSHORT:
  ------------------
  |  Branch (2815:9): [True: 1, False: 1.43k]
  ------------------
 2816|     33|        case TIFF_LONG:
  ------------------
  |  Branch (2816:9): [True: 9, False: 1.42k]
  ------------------
 2817|     35|        case TIFF_SLONG:
  ------------------
  |  Branch (2817:9): [True: 2, False: 1.43k]
  ------------------
 2818|     60|        case TIFF_LONG8:
  ------------------
  |  Branch (2818:9): [True: 25, False: 1.41k]
  ------------------
 2819|     89|        case TIFF_SLONG8:
  ------------------
  |  Branch (2819:9): [True: 29, False: 1.40k]
  ------------------
 2820|  1.04k|        case TIFF_RATIONAL:
  ------------------
  |  Branch (2820:9): [True: 957, False: 478]
  ------------------
 2821|  1.28k|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (2821:9): [True: 239, False: 1.19k]
  ------------------
 2822|  1.37k|        case TIFF_FLOAT:
  ------------------
  |  Branch (2822:9): [True: 89, False: 1.34k]
  ------------------
 2823|  1.40k|        case TIFF_DOUBLE:
  ------------------
  |  Branch (2823:9): [True: 31, False: 1.40k]
  ------------------
 2824|  1.40k|            break;
 2825|     30|        default:
  ------------------
  |  Branch (2825:9): [True: 30, False: 1.40k]
  ------------------
 2826|     30|            return (TIFFReadDirEntryErrType);
 2827|  1.43k|    }
 2828|  1.40k|    err = TIFFReadDirEntryArray(tif, direntry, &count, 4, &origdata);
 2829|  1.40k|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (2829:9): [True: 1.04k, False: 363]
  |  Branch (2829:43): [True: 14, False: 349]
  ------------------
 2830|  1.05k|    {
 2831|  1.05k|        *value = 0;
 2832|  1.05k|        return (err);
 2833|  1.05k|    }
 2834|    349|    switch (direntry->tdir_type)
 2835|    349|    {
 2836|     12|        case TIFF_FLOAT:
  ------------------
  |  Branch (2836:9): [True: 12, False: 337]
  ------------------
 2837|     12|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     12|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2837:17): [True: 0, False: 12]
  ------------------
 2838|      0|                TIFFSwabArrayOfLong((uint32_t *)origdata, count);
 2839|     12|            TIFFCvtIEEEFloatToNative(tif, count, (float *)origdata);
 2840|     12|            *value = (float *)origdata;
 2841|     12|            return (TIFFReadDirEntryErrOk);
 2842|    337|        default:
  ------------------
  |  Branch (2842:9): [True: 337, False: 12]
  ------------------
 2843|    337|            break;
 2844|    349|    }
 2845|    337|    data = (float *)_TIFFCheckMalloc(tif, count, sizeof(float),
 2846|    337|                                     "TIFFReadDirEntryFloatArray");
 2847|    337|    if (data == 0)
  ------------------
  |  Branch (2847:9): [True: 0, False: 337]
  ------------------
 2848|      0|    {
 2849|      0|        _TIFFfreeExt(tif, origdata);
 2850|      0|        return (TIFFReadDirEntryErrAlloc);
 2851|      0|    }
 2852|    337|    switch (direntry->tdir_type)
 2853|    337|    {
 2854|      7|        case TIFF_BYTE:
  ------------------
  |  Branch (2854:9): [True: 7, False: 330]
  ------------------
 2855|      7|        {
 2856|      7|            uint8_t *ma;
 2857|      7|            float *mb;
 2858|      7|            uint32_t n;
 2859|      7|            ma = (uint8_t *)origdata;
 2860|      7|            mb = data;
 2861|     35|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2861:25): [True: 28, False: 7]
  ------------------
 2862|     28|                *mb++ = (float)(*ma++);
 2863|      7|        }
 2864|      7|        break;
 2865|     11|        case TIFF_SBYTE:
  ------------------
  |  Branch (2865:9): [True: 11, False: 326]
  ------------------
 2866|     11|        {
 2867|     11|            int8_t *ma;
 2868|     11|            float *mb;
 2869|     11|            uint32_t n;
 2870|     11|            ma = (int8_t *)origdata;
 2871|     11|            mb = data;
 2872|  1.69k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2872:25): [True: 1.68k, False: 11]
  ------------------
 2873|  1.68k|                *mb++ = (float)(*ma++);
 2874|     11|        }
 2875|     11|        break;
 2876|      4|        case TIFF_SHORT:
  ------------------
  |  Branch (2876:9): [True: 4, False: 333]
  ------------------
 2877|      4|        {
 2878|      4|            uint16_t *ma;
 2879|      4|            float *mb;
 2880|      4|            uint32_t n;
 2881|      4|            ma = (uint16_t *)origdata;
 2882|      4|            mb = data;
 2883|     72|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2883:25): [True: 68, False: 4]
  ------------------
 2884|     68|            {
 2885|     68|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     68|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2885:21): [True: 0, False: 68]
  ------------------
 2886|      0|                    TIFFSwabShort(ma);
 2887|     68|                *mb++ = (float)(*ma++);
 2888|     68|            }
 2889|      4|        }
 2890|      4|        break;
 2891|      1|        case TIFF_SSHORT:
  ------------------
  |  Branch (2891:9): [True: 1, False: 336]
  ------------------
 2892|      1|        {
 2893|      1|            int16_t *ma;
 2894|      1|            float *mb;
 2895|      1|            uint32_t n;
 2896|      1|            ma = (int16_t *)origdata;
 2897|      1|            mb = data;
 2898|    195|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2898:25): [True: 194, False: 1]
  ------------------
 2899|    194|            {
 2900|    194|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    194|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2900:21): [True: 194, False: 0]
  ------------------
 2901|    194|                    TIFFSwabShort((uint16_t *)ma);
 2902|    194|                *mb++ = (float)(*ma++);
 2903|    194|            }
 2904|      1|        }
 2905|      1|        break;
 2906|      7|        case TIFF_LONG:
  ------------------
  |  Branch (2906:9): [True: 7, False: 330]
  ------------------
 2907|      7|        {
 2908|      7|            uint32_t *ma;
 2909|      7|            float *mb;
 2910|      7|            uint32_t n;
 2911|      7|            ma = (uint32_t *)origdata;
 2912|      7|            mb = data;
 2913|  1.38k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2913:25): [True: 1.37k, False: 7]
  ------------------
 2914|  1.37k|            {
 2915|  1.37k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  1.37k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2915:21): [True: 220, False: 1.15k]
  ------------------
 2916|    220|                    TIFFSwabLong(ma);
 2917|  1.37k|                *mb++ = (float)(*ma++);
 2918|  1.37k|            }
 2919|      7|        }
 2920|      7|        break;
 2921|      2|        case TIFF_SLONG:
  ------------------
  |  Branch (2921:9): [True: 2, False: 335]
  ------------------
 2922|      2|        {
 2923|      2|            int32_t *ma;
 2924|      2|            float *mb;
 2925|      2|            uint32_t n;
 2926|      2|            ma = (int32_t *)origdata;
 2927|      2|            mb = data;
 2928|    325|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2928:25): [True: 323, False: 2]
  ------------------
 2929|    323|            {
 2930|    323|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    323|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2930:21): [True: 194, False: 129]
  ------------------
 2931|    194|                    TIFFSwabLong((uint32_t *)ma);
 2932|    323|                *mb++ = (float)(*ma++);
 2933|    323|            }
 2934|      2|        }
 2935|      2|        break;
 2936|     20|        case TIFF_LONG8:
  ------------------
  |  Branch (2936:9): [True: 20, False: 317]
  ------------------
 2937|     20|        {
 2938|     20|            uint64_t *ma;
 2939|     20|            float *mb;
 2940|     20|            uint32_t n;
 2941|     20|            ma = (uint64_t *)origdata;
 2942|     20|            mb = data;
 2943|  2.99k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2943:25): [True: 2.97k, False: 20]
  ------------------
 2944|  2.97k|            {
 2945|  2.97k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  2.97k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2945:21): [True: 228, False: 2.74k]
  ------------------
 2946|    228|                    TIFFSwabLong8(ma);
 2947|  2.97k|                *mb++ = (float)(*ma++);
 2948|  2.97k|            }
 2949|     20|        }
 2950|     20|        break;
 2951|     14|        case TIFF_SLONG8:
  ------------------
  |  Branch (2951:9): [True: 14, False: 323]
  ------------------
 2952|     14|        {
 2953|     14|            int64_t *ma;
 2954|     14|            float *mb;
 2955|     14|            uint32_t n;
 2956|     14|            ma = (int64_t *)origdata;
 2957|     14|            mb = data;
 2958|    532|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2958:25): [True: 518, False: 14]
  ------------------
 2959|    518|            {
 2960|    518|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    518|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2960:21): [True: 128, False: 390]
  ------------------
 2961|    128|                    TIFFSwabLong8((uint64_t *)ma);
 2962|    518|                *mb++ = (float)(*ma++);
 2963|    518|            }
 2964|     14|        }
 2965|     14|        break;
 2966|    201|        case TIFF_RATIONAL:
  ------------------
  |  Branch (2966:9): [True: 201, False: 136]
  ------------------
 2967|    201|        {
 2968|    201|            uint32_t *ma;
 2969|    201|            uint32_t maa;
 2970|    201|            uint32_t mab;
 2971|    201|            float *mb;
 2972|    201|            uint32_t n;
 2973|    201|            ma = (uint32_t *)origdata;
 2974|    201|            mb = data;
 2975|  4.02k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2975:25): [True: 3.82k, False: 201]
  ------------------
 2976|  3.82k|            {
 2977|  3.82k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  3.82k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2977:21): [True: 377, False: 3.44k]
  ------------------
 2978|    377|                    TIFFSwabLong(ma);
 2979|  3.82k|                maa = *ma++;
 2980|  3.82k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  3.82k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (2980:21): [True: 377, False: 3.44k]
  ------------------
 2981|    377|                    TIFFSwabLong(ma);
 2982|  3.82k|                mab = *ma++;
 2983|  3.82k|                if (mab == 0)
  ------------------
  |  Branch (2983:21): [True: 244, False: 3.57k]
  ------------------
 2984|    244|                    *mb++ = 0.0;
 2985|  3.57k|                else
 2986|  3.57k|                    *mb++ = (float)maa / (float)mab;
 2987|  3.82k|            }
 2988|    201|        }
 2989|    201|        break;
 2990|     50|        case TIFF_SRATIONAL:
  ------------------
  |  Branch (2990:9): [True: 50, False: 287]
  ------------------
 2991|     50|        {
 2992|     50|            uint32_t *ma;
 2993|     50|            int32_t maa;
 2994|     50|            uint32_t mab;
 2995|     50|            float *mb;
 2996|     50|            uint32_t n;
 2997|     50|            ma = (uint32_t *)origdata;
 2998|     50|            mb = data;
 2999|  1.15k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (2999:25): [True: 1.10k, False: 50]
  ------------------
 3000|  1.10k|            {
 3001|  1.10k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  1.10k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3001:21): [True: 152, False: 952]
  ------------------
 3002|    152|                    TIFFSwabLong(ma);
 3003|  1.10k|                maa = *(int32_t *)ma;
 3004|  1.10k|                ma++;
 3005|  1.10k|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  1.10k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3005:21): [True: 152, False: 952]
  ------------------
 3006|    152|                    TIFFSwabLong(ma);
 3007|  1.10k|                mab = *ma++;
 3008|  1.10k|                if (mab == 0)
  ------------------
  |  Branch (3008:21): [True: 259, False: 845]
  ------------------
 3009|    259|                    *mb++ = 0.0;
 3010|    845|                else
 3011|    845|                    *mb++ = (float)maa / (float)mab;
 3012|  1.10k|            }
 3013|     50|        }
 3014|     50|        break;
 3015|     20|        case TIFF_DOUBLE:
  ------------------
  |  Branch (3015:9): [True: 20, False: 317]
  ------------------
 3016|     20|        {
 3017|     20|            double *ma;
 3018|     20|            float *mb;
 3019|     20|            uint32_t n;
 3020|     20|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     20|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3020:17): [True: 2, False: 18]
  ------------------
 3021|      2|                TIFFSwabArrayOfLong8((uint64_t *)origdata, count);
 3022|     20|            TIFFCvtIEEEDoubleToNative(tif, count, (double *)origdata);
 3023|     20|            ma = (double *)origdata;
 3024|     20|            mb = data;
 3025|  1.06k|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3025:25): [True: 1.04k, False: 20]
  ------------------
 3026|  1.04k|            {
 3027|  1.04k|                double val = *ma++;
 3028|  1.04k|                if (val > (double)FLT_MAX)
  ------------------
  |  Branch (3028:21): [True: 381, False: 667]
  ------------------
 3029|    381|                    val = (double)FLT_MAX;
 3030|    667|                else if (val < -(double)FLT_MAX)
  ------------------
  |  Branch (3030:26): [True: 231, False: 436]
  ------------------
 3031|    231|                    val = -(double)FLT_MAX;
 3032|  1.04k|                *mb++ = (float)val;
 3033|  1.04k|            }
 3034|     20|        }
 3035|     20|        break;
 3036|      0|        default:
  ------------------
  |  Branch (3036:9): [True: 0, False: 337]
  ------------------
 3037|      0|            break;
 3038|    337|    }
 3039|    337|    _TIFFfreeExt(tif, origdata);
 3040|    337|    *value = data;
 3041|    337|    return (TIFFReadDirEntryErrOk);
 3042|    337|}
tif_dirread.c:TIFFReadDirEntryIfd8Array:
 3280|    197|{
 3281|    197|    enum TIFFReadDirEntryErr err;
 3282|    197|    uint32_t count;
 3283|    197|    void *origdata;
 3284|    197|    uint64_t *data;
 3285|    197|    switch (direntry->tdir_type)
 3286|    197|    {
 3287|      8|        case TIFF_LONG:
  ------------------
  |  Branch (3287:9): [True: 8, False: 189]
  ------------------
 3288|      8|        case TIFF_LONG8:
  ------------------
  |  Branch (3288:9): [True: 0, False: 197]
  ------------------
 3289|    141|        case TIFF_IFD:
  ------------------
  |  Branch (3289:9): [True: 133, False: 64]
  ------------------
 3290|    195|        case TIFF_IFD8:
  ------------------
  |  Branch (3290:9): [True: 54, False: 143]
  ------------------
 3291|    195|            break;
 3292|      2|        default:
  ------------------
  |  Branch (3292:9): [True: 2, False: 195]
  ------------------
 3293|      2|            return (TIFFReadDirEntryErrType);
 3294|    197|    }
 3295|    195|    err = TIFFReadDirEntryArray(tif, direntry, &count, 8, &origdata);
 3296|    195|    if ((err != TIFFReadDirEntryErrOk) || (origdata == 0))
  ------------------
  |  Branch (3296:9): [True: 145, False: 50]
  |  Branch (3296:43): [True: 15, False: 35]
  ------------------
 3297|    160|    {
 3298|    160|        *value = 0;
 3299|    160|        return (err);
 3300|    160|    }
 3301|     35|    switch (direntry->tdir_type)
 3302|     35|    {
 3303|      0|        case TIFF_LONG8:
  ------------------
  |  Branch (3303:9): [True: 0, False: 35]
  ------------------
 3304|     12|        case TIFF_IFD8:
  ------------------
  |  Branch (3304:9): [True: 12, False: 23]
  ------------------
 3305|     12|            *value = (uint64_t *)origdata;
 3306|     12|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     12|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3306:17): [True: 10, False: 2]
  ------------------
 3307|     10|                TIFFSwabArrayOfLong8(*value, count);
 3308|     12|            return (TIFFReadDirEntryErrOk);
 3309|     23|        default:
  ------------------
  |  Branch (3309:9): [True: 23, False: 12]
  ------------------
 3310|     23|            break;
 3311|     35|    }
 3312|     23|    data = (uint64_t *)_TIFFCheckMalloc(tif, count, sizeof(uint64_t),
 3313|     23|                                        "TIFFReadDirEntryIfd8Array");
 3314|     23|    if (data == 0)
  ------------------
  |  Branch (3314:9): [True: 0, False: 23]
  ------------------
 3315|      0|    {
 3316|      0|        _TIFFfreeExt(tif, origdata);
 3317|      0|        return (TIFFReadDirEntryErrAlloc);
 3318|      0|    }
 3319|     23|    switch (direntry->tdir_type)
 3320|     23|    {
 3321|      2|        case TIFF_LONG:
  ------------------
  |  Branch (3321:9): [True: 2, False: 21]
  ------------------
 3322|     23|        case TIFF_IFD:
  ------------------
  |  Branch (3322:9): [True: 21, False: 2]
  ------------------
 3323|     23|        {
 3324|     23|            uint32_t *ma;
 3325|     23|            uint64_t *mb;
 3326|     23|            uint32_t n;
 3327|     23|            ma = (uint32_t *)origdata;
 3328|     23|            mb = data;
 3329|    609|            for (n = 0; n < count; n++)
  ------------------
  |  Branch (3329:25): [True: 586, False: 23]
  ------------------
 3330|    586|            {
 3331|    586|                if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    586|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (3331:21): [True: 177, False: 409]
  ------------------
 3332|    177|                    TIFFSwabLong(ma);
 3333|    586|                *mb++ = (uint64_t)(*ma++);
 3334|    586|            }
 3335|     23|        }
 3336|     23|        break;
 3337|      0|        default:
  ------------------
  |  Branch (3337:9): [True: 0, False: 23]
  ------------------
 3338|      0|            break;
 3339|     23|    }
 3340|     23|    _TIFFfreeExt(tif, origdata);
 3341|     23|    *value = data;
 3342|     23|    return (TIFFReadDirEntryErrOk);
 3343|     23|}
tif_dirread.c:TIFFFetchStripThing:
 7793|  10.4k|{
 7794|  10.4k|    static const char module[] = "TIFFFetchStripThing";
 7795|  10.4k|    enum TIFFReadDirEntryErr err;
 7796|  10.4k|    uint64_t *data;
 7797|  10.4k|    err = TIFFReadDirEntryLong8ArrayWithLimit(tif, dir, &data, nstrips);
 7798|  10.4k|    if (err != TIFFReadDirEntryErrOk)
  ------------------
  |  Branch (7798:9): [True: 157, False: 10.3k]
  ------------------
 7799|    157|    {
 7800|    157|        const TIFFField *fip = TIFFFieldWithTag(tif, dir->tdir_tag);
 7801|    157|        TIFFReadDirEntryOutputErr(tif, err, module,
 7802|    157|                                  fip ? fip->field_name : "unknown tagname", 0);
  ------------------
  |  Branch (7802:35): [True: 157, False: 0]
  ------------------
 7803|    157|        return (0);
 7804|    157|    }
 7805|  10.3k|    if (dir->tdir_count < (uint64_t)nstrips)
  ------------------
  |  Branch (7805:9): [True: 1.52k, False: 8.79k]
  ------------------
 7806|  1.52k|    {
 7807|  1.52k|        uint64_t *resizeddata;
 7808|  1.52k|        const TIFFField *fip = TIFFFieldWithTag(tif, dir->tdir_tag);
 7809|  1.52k|        const char *pszMax = getenv("LIBTIFF_STRILE_ARRAY_MAX_RESIZE_COUNT");
 7810|  1.52k|        uint32_t max_nstrips = 1000000;
 7811|  1.52k|        if (pszMax)
  ------------------
  |  Branch (7811:13): [True: 0, False: 1.52k]
  ------------------
 7812|      0|            max_nstrips = (uint32_t)atoi(pszMax);
 7813|  1.52k|        TIFFReadDirEntryOutputErr(tif, TIFFReadDirEntryErrCount, module,
 7814|  1.52k|                                  fip ? fip->field_name : "unknown tagname",
  ------------------
  |  Branch (7814:35): [True: 1.52k, False: 0]
  ------------------
 7815|  1.52k|                                  (nstrips <= max_nstrips));
 7816|       |
 7817|  1.52k|        if (nstrips > max_nstrips)
  ------------------
  |  Branch (7817:13): [True: 1, False: 1.52k]
  ------------------
 7818|      1|        {
 7819|      1|            _TIFFfreeExt(tif, data);
 7820|      1|            return (0);
 7821|      1|        }
 7822|       |
 7823|  1.52k|        const uint64_t allocsize = (uint64_t)nstrips * sizeof(uint64_t);
 7824|  1.52k|        if (allocsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (7824:13): [True: 0, False: 1.52k]
  ------------------
 7825|      0|        {
 7826|       |            /* Before allocating a huge amount of memory for corrupted files,
 7827|       |             * check if size of requested memory is not greater than file size.
 7828|       |             */
 7829|      0|            const uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|      0|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 7830|      0|            if (allocsize > filesize)
  ------------------
  |  Branch (7830:17): [True: 0, False: 0]
  ------------------
 7831|      0|            {
 7832|      0|                TIFFWarningExtR(
 7833|      0|                    tif, module,
 7834|      0|                    "Requested memory size for StripArray of %" PRIu64
 7835|      0|                    " is greater than filesize %" PRIu64
 7836|      0|                    ". Memory not allocated",
 7837|      0|                    allocsize, filesize);
 7838|      0|                _TIFFfreeExt(tif, data);
 7839|      0|                return (0);
 7840|      0|            }
 7841|      0|        }
 7842|  1.52k|        resizeddata = (uint64_t *)_TIFFCheckMalloc(
 7843|  1.52k|            tif, nstrips, sizeof(uint64_t), "for strip array");
 7844|  1.52k|        if (resizeddata == 0)
  ------------------
  |  Branch (7844:13): [True: 0, False: 1.52k]
  ------------------
 7845|      0|        {
 7846|      0|            _TIFFfreeExt(tif, data);
 7847|      0|            return (0);
 7848|      0|        }
 7849|  1.52k|        if (dir->tdir_count)
  ------------------
  |  Branch (7849:13): [True: 1.34k, False: 183]
  ------------------
 7850|  1.34k|            _TIFFmemcpy(resizeddata, data,
 7851|  1.34k|                        (tmsize_t)((size_t)dir->tdir_count * sizeof(uint64_t)));
 7852|  1.52k|        _TIFFmemset(resizeddata + (uint32_t)dir->tdir_count, 0,
 7853|  1.52k|                    (tmsize_t)((size_t)(nstrips - (uint32_t)dir->tdir_count) *
 7854|  1.52k|                               sizeof(uint64_t)));
 7855|  1.52k|        _TIFFfreeExt(tif, data);
 7856|  1.52k|        data = resizeddata;
 7857|  1.52k|    }
 7858|  10.3k|    *lpp = data;
 7859|  10.3k|    return (1);
 7860|  10.3k|}
tif_dirread.c:ChopUpSingleUncompressedStrip:
 8017|     77|{
 8018|     77|    TIFFDirectory *td = &tif->tif_dir;
 8019|     77|    uint64_t bytecount;
 8020|     77|    uint64_t offset;
 8021|     77|    uint32_t rowblock;
 8022|     77|    uint64_t rowblockbytes;
 8023|     77|    uint64_t stripbytes;
 8024|     77|    uint32_t nstrips;
 8025|     77|    uint32_t rowsperstrip;
 8026|       |
 8027|     77|    bytecount = TIFFGetStrileByteCount(tif, 0);
 8028|       |    /* On a newly created file, just re-opened to be filled, we */
 8029|       |    /* don't want strip chop to trigger as it is going to cause issues */
 8030|       |    /* later ( StripOffsets and StripByteCounts improperly filled) . */
 8031|     77|    if (bytecount == 0 && tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (8031:9): [True: 15, False: 62]
  |  Branch (8031:27): [True: 0, False: 15]
  ------------------
 8032|      0|        return;
 8033|     77|    offset = TIFFGetStrileOffset(tif, 0);
 8034|     77|    assert(td->td_planarconfig == PLANARCONFIG_CONTIG);
  ------------------
  |  Branch (8034:5): [True: 0, False: 77]
  |  Branch (8034:5): [True: 77, False: 0]
  ------------------
 8035|     77|    if ((td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  227|     77|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
                  if ((td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  281|     21|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  133|     21|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (8035:9): [True: 21, False: 56]
  |  Branch (8035:54): [True: 21, False: 0]
  ------------------
 8036|     21|        rowblock = td->td_ycbcrsubsampling[1];
 8037|     56|    else
 8038|     56|        rowblock = 1;
 8039|     77|    rowblockbytes = TIFFVTileSize64(tif, rowblock);
 8040|       |    /*
 8041|       |     * Make the rows hold at least one scanline, but fill specified amount
 8042|       |     * of data if possible.
 8043|       |     */
 8044|     77|    if (rowblockbytes > STRIP_SIZE_DEFAULT)
  ------------------
  |  |  119|     77|#define STRIP_SIZE_DEFAULT 8192
  ------------------
  |  Branch (8044:9): [True: 21, False: 56]
  ------------------
 8045|     21|    {
 8046|     21|        stripbytes = rowblockbytes;
 8047|     21|        rowsperstrip = rowblock;
 8048|     21|    }
 8049|     56|    else if (rowblockbytes > 0)
  ------------------
  |  Branch (8049:14): [True: 52, False: 4]
  ------------------
 8050|     52|    {
 8051|     52|        uint32_t rowblocksperstrip;
 8052|     52|        rowblocksperstrip = (uint32_t)(STRIP_SIZE_DEFAULT / rowblockbytes);
  ------------------
  |  |  119|     52|#define STRIP_SIZE_DEFAULT 8192
  ------------------
 8053|     52|        rowsperstrip = rowblocksperstrip * rowblock;
 8054|     52|        stripbytes = rowblocksperstrip * rowblockbytes;
 8055|     52|    }
 8056|      4|    else
 8057|      4|        return;
 8058|       |
 8059|       |    /*
 8060|       |     * never increase the number of rows per strip
 8061|       |     */
 8062|     73|    if (rowsperstrip >= td->td_rowsperstrip || rowsperstrip == 0)
  ------------------
  |  Branch (8062:9): [True: 44, False: 29]
  |  Branch (8062:48): [True: 0, False: 29]
  ------------------
 8063|     44|        return;
 8064|     29|    nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
  ------------------
  |  |  312|     29|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 28, False: 1]
  |  |  ------------------
  |  |  313|     29|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|     29|         : 0U)
  ------------------
 8065|     29|    if (nstrips == 0)
  ------------------
  |  Branch (8065:9): [True: 4, False: 25]
  ------------------
 8066|      4|        return;
 8067|       |
 8068|       |    /* If we are going to allocate a lot of memory, make sure that the */
 8069|       |    /* file is as big as needed */
 8070|     25|    if (tif->tif_mode == O_RDONLY && nstrips > 1000000 &&
  ------------------
  |  Branch (8070:9): [True: 25, False: 0]
  |  Branch (8070:38): [True: 12, False: 13]
  ------------------
 8071|     12|        (offset >= TIFFGetFileSize(tif) ||
  ------------------
  |  |  289|     24|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
  |  Branch (8071:10): [True: 9, False: 3]
  ------------------
 8072|      3|         stripbytes > (TIFFGetFileSize(tif) - offset) / (nstrips - 1)))
  ------------------
  |  |  289|      3|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
  |  Branch (8072:10): [True: 3, False: 0]
  ------------------
 8073|     12|    {
 8074|     12|        return;
 8075|     12|    }
 8076|       |
 8077|     13|    allocChoppedUpStripArrays(tif, nstrips, stripbytes, rowsperstrip);
 8078|     13|}
tif_dirread.c:allocChoppedUpStripArrays:
 7922|     16|{
 7923|     16|    TIFFDirectory *td = &tif->tif_dir;
 7924|     16|    uint64_t bytecount;
 7925|     16|    uint64_t offset;
 7926|     16|    uint64_t last_offset;
 7927|     16|    uint64_t last_bytecount;
 7928|     16|    uint32_t i;
 7929|     16|    uint64_t *newcounts;
 7930|     16|    uint64_t *newoffsets;
 7931|       |
 7932|     16|    offset = TIFFGetStrileOffset(tif, 0);
 7933|     16|    last_offset = TIFFGetStrileOffset(tif, td->td_nstrips - 1);
 7934|     16|    last_bytecount = TIFFGetStrileByteCount(tif, td->td_nstrips - 1);
 7935|     16|    if (last_offset > UINT64_MAX - last_bytecount ||
  ------------------
  |  Branch (7935:9): [True: 1, False: 15]
  ------------------
 7936|     15|        last_offset + last_bytecount < offset)
  ------------------
  |  Branch (7936:9): [True: 0, False: 15]
  ------------------
 7937|      1|    {
 7938|      1|        return;
 7939|      1|    }
 7940|     15|    bytecount = last_offset + last_bytecount - offset;
 7941|       |
 7942|       |    /* Before allocating a huge amount of memory for corrupted files, check if
 7943|       |     * size of StripByteCount and StripOffset tags is not greater than
 7944|       |     * file size.
 7945|       |     */
 7946|     15|    const uint64_t allocsize = (uint64_t)nstrips * sizeof(uint64_t) * 2;
 7947|     15|    if (allocsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (7947:9): [True: 0, False: 15]
  ------------------
 7948|      0|    {
 7949|      0|        const uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|      0|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 7950|      0|        if (allocsize > filesize)
  ------------------
  |  Branch (7950:13): [True: 0, False: 0]
  ------------------
 7951|      0|        {
 7952|      0|            TIFFWarningExtR(tif, "allocChoppedUpStripArrays",
 7953|      0|                            "Requested memory size for StripByteCount and "
 7954|      0|                            "StripOffsets %" PRIu64
 7955|      0|                            " is greater than filesize %" PRIu64
 7956|      0|                            ". Memory not allocated",
 7957|      0|                            allocsize, filesize);
 7958|      0|            return;
 7959|      0|        }
 7960|      0|    }
 7961|       |
 7962|     15|    newcounts =
 7963|     15|        (uint64_t *)_TIFFCheckMalloc(tif, nstrips, sizeof(uint64_t),
 7964|     15|                                     "for chopped \"StripByteCounts\" array");
 7965|     15|    newoffsets = (uint64_t *)_TIFFCheckMalloc(
 7966|     15|        tif, nstrips, sizeof(uint64_t), "for chopped \"StripOffsets\" array");
 7967|     15|    if (newcounts == NULL || newoffsets == NULL)
  ------------------
  |  Branch (7967:9): [True: 0, False: 15]
  |  Branch (7967:30): [True: 0, False: 15]
  ------------------
 7968|      0|    {
 7969|       |        /*
 7970|       |         * Unable to allocate new strip information, give up and use
 7971|       |         * the original one strip information.
 7972|       |         */
 7973|      0|        if (newcounts != NULL)
  ------------------
  |  Branch (7973:13): [True: 0, False: 0]
  ------------------
 7974|      0|            _TIFFfreeExt(tif, newcounts);
 7975|      0|        if (newoffsets != NULL)
  ------------------
  |  Branch (7975:13): [True: 0, False: 0]
  ------------------
 7976|      0|            _TIFFfreeExt(tif, newoffsets);
 7977|      0|        return;
 7978|      0|    }
 7979|       |
 7980|       |    /*
 7981|       |     * Fill the strip information arrays with new bytecounts and offsets
 7982|       |     * that reflect the broken-up format.
 7983|       |     */
 7984|   615k|    for (i = 0; i < nstrips; i++)
  ------------------
  |  Branch (7984:17): [True: 615k, False: 15]
  ------------------
 7985|   615k|    {
 7986|   615k|        if (stripbytes > bytecount)
  ------------------
  |  Branch (7986:13): [True: 11, False: 615k]
  ------------------
 7987|     11|            stripbytes = bytecount;
 7988|   615k|        newcounts[i] = stripbytes;
 7989|   615k|        newoffsets[i] = stripbytes ? offset : 0;
  ------------------
  |  Branch (7989:25): [True: 615k, False: 1]
  ------------------
 7990|   615k|        offset += stripbytes;
 7991|   615k|        bytecount -= stripbytes;
 7992|   615k|    }
 7993|       |
 7994|       |    /*
 7995|       |     * Replace old single strip info with multi-strip info.
 7996|       |     */
 7997|     15|    td->td_stripsperimage = td->td_nstrips = nstrips;
 7998|     15|    TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
  ------------------
  |  |  258|     15|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
 7999|       |
 8000|     15|    _TIFFfreeExt(tif, td->td_stripbytecount_p);
 8001|     15|    _TIFFfreeExt(tif, td->td_stripoffset_p);
 8002|     15|    td->td_stripbytecount_p = newcounts;
 8003|     15|    td->td_stripoffset_p = newoffsets;
 8004|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 8005|       |    td->td_stripbytecountsorted = 1;
 8006|       |#endif
 8007|     15|    tif->tif_flags |= TIFF_CHOPPEDUPARRAYS;
  ------------------
  |  |  153|     15|    0x4000000U /* set when allocChoppedUpStripArrays() has modified strip      \
  ------------------
 8008|     15|}
tif_dirread.c:TryChopUpUncompressedBigTiff:
 8087|     15|{
 8088|     15|    TIFFDirectory *td = &tif->tif_dir;
 8089|     15|    uint32_t rowblock;
 8090|     15|    uint64_t rowblockbytes;
 8091|     15|    uint32_t i;
 8092|     15|    uint64_t stripsize;
 8093|     15|    uint32_t rowblocksperstrip;
 8094|     15|    uint32_t rowsperstrip;
 8095|     15|    uint64_t stripbytes;
 8096|     15|    uint32_t nstrips;
 8097|       |
 8098|     15|    stripsize = TIFFStripSize64(tif);
 8099|       |
 8100|     15|    assert(tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG);
  ------------------
  |  Branch (8100:5): [True: 0, False: 15]
  |  Branch (8100:5): [True: 15, False: 0]
  ------------------
 8101|     15|    assert(tif->tif_dir.td_compression == COMPRESSION_NONE);
  ------------------
  |  Branch (8101:5): [True: 0, False: 15]
  |  Branch (8101:5): [True: 15, False: 0]
  ------------------
 8102|     15|    assert((tif->tif_flags & (TIFF_STRIPCHOP | TIFF_ISTILED)) ==
  ------------------
  |  Branch (8102:5): [True: 0, False: 15]
  |  Branch (8102:5): [True: 15, False: 0]
  ------------------
 8103|     15|           TIFF_STRIPCHOP);
 8104|     15|    assert(stripsize > 0x7FFFFFFFUL);
  ------------------
  |  Branch (8104:5): [True: 0, False: 15]
  |  Branch (8104:5): [True: 15, False: 0]
  ------------------
 8105|       |
 8106|       |    /* On a newly created file, just re-opened to be filled, we */
 8107|       |    /* don't want strip chop to trigger as it is going to cause issues */
 8108|       |    /* later ( StripOffsets and StripByteCounts improperly filled) . */
 8109|     15|    if (TIFFGetStrileByteCount(tif, 0) == 0 && tif->tif_mode != O_RDONLY)
  ------------------
  |  Branch (8109:9): [True: 0, False: 15]
  |  Branch (8109:48): [True: 0, False: 0]
  ------------------
 8110|      0|        return;
 8111|       |
 8112|     15|    if ((td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  227|     15|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
                  if ((td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  281|      0|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  133|      0|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (8112:9): [True: 0, False: 15]
  |  Branch (8112:54): [True: 0, False: 0]
  ------------------
 8113|      0|        rowblock = td->td_ycbcrsubsampling[1];
 8114|     15|    else
 8115|     15|        rowblock = 1;
 8116|     15|    rowblockbytes = TIFFVStripSize64(tif, rowblock);
 8117|     15|    if (rowblockbytes == 0 || rowblockbytes > 0x7FFFFFFFUL)
  ------------------
  |  Branch (8117:9): [True: 0, False: 15]
  |  Branch (8117:31): [True: 5, False: 10]
  ------------------
 8118|      5|    {
 8119|       |        /* In case of file with gigantic width */
 8120|      5|        return;
 8121|      5|    }
 8122|       |
 8123|       |    /* Check that the strips are contiguous and of the expected size */
 8124|     20|    for (i = 0; i < td->td_nstrips; i++)
  ------------------
  |  Branch (8124:17): [True: 12, False: 8]
  ------------------
 8125|     12|    {
 8126|     12|        if (i == td->td_nstrips - 1)
  ------------------
  |  Branch (8126:13): [True: 8, False: 4]
  ------------------
 8127|      8|        {
 8128|      8|            if (TIFFGetStrileByteCount(tif, i) <
  ------------------
  |  Branch (8128:17): [True: 0, False: 8]
  ------------------
 8129|      8|                TIFFVStripSize64(tif,
 8130|      8|                                 td->td_imagelength - i * td->td_rowsperstrip))
 8131|      0|            {
 8132|      0|                return;
 8133|      0|            }
 8134|      8|        }
 8135|      4|        else
 8136|      4|        {
 8137|      4|            if (TIFFGetStrileByteCount(tif, i) != stripsize)
  ------------------
  |  Branch (8137:17): [True: 0, False: 4]
  ------------------
 8138|      0|            {
 8139|      0|                return;
 8140|      0|            }
 8141|      4|            if (i > 0 && TIFFGetStrileOffset(tif, i) !=
  ------------------
  |  Branch (8141:17): [True: 2, False: 2]
  |  Branch (8141:26): [True: 2, False: 0]
  ------------------
 8142|      2|                             TIFFGetStrileOffset(tif, i - 1) +
 8143|      2|                                 TIFFGetStrileByteCount(tif, i - 1))
 8144|      2|            {
 8145|      2|                return;
 8146|      2|            }
 8147|      4|        }
 8148|     12|    }
 8149|       |
 8150|       |    /* Aim for 512 MB strips (that will still be manageable by 32 bit builds */
 8151|      8|    rowblocksperstrip = (uint32_t)(512 * 1024 * 1024 / rowblockbytes);
 8152|      8|    if (rowblocksperstrip == 0)
  ------------------
  |  Branch (8152:9): [True: 1, False: 7]
  ------------------
 8153|      1|        rowblocksperstrip = 1;
 8154|      8|    rowsperstrip = rowblocksperstrip * rowblock;
 8155|      8|    stripbytes = rowblocksperstrip * rowblockbytes;
 8156|      8|    assert(stripbytes <= 0x7FFFFFFFUL);
  ------------------
  |  Branch (8156:5): [True: 0, False: 8]
  |  Branch (8156:5): [True: 8, False: 0]
  ------------------
 8157|       |
 8158|      8|    if (rowsperstrip == 0)
  ------------------
  |  Branch (8158:9): [True: 0, False: 8]
  ------------------
 8159|      0|        return;
 8160|      8|    nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
  ------------------
  |  |  312|      8|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 8, False: 0]
  |  |  ------------------
  |  |  313|      8|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|      8|         : 0U)
  ------------------
 8161|      8|    if (nstrips == 0)
  ------------------
  |  Branch (8161:9): [True: 0, False: 8]
  ------------------
 8162|      0|        return;
 8163|       |
 8164|       |    /* If we are going to allocate a lot of memory, make sure that the */
 8165|       |    /* file is as big as needed */
 8166|      8|    if (tif->tif_mode == O_RDONLY && nstrips > 1000000)
  ------------------
  |  Branch (8166:9): [True: 8, False: 0]
  |  Branch (8166:38): [True: 5, False: 3]
  ------------------
 8167|      5|    {
 8168|      5|        uint64_t last_offset = TIFFGetStrileOffset(tif, td->td_nstrips - 1);
 8169|      5|        uint64_t filesize = TIFFGetFileSize(tif);
  ------------------
  |  |  289|      5|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 8170|      5|        uint64_t last_bytecount =
 8171|      5|            TIFFGetStrileByteCount(tif, td->td_nstrips - 1);
 8172|      5|        if (last_offset > filesize || last_bytecount > filesize - last_offset)
  ------------------
  |  Branch (8172:13): [True: 1, False: 4]
  |  Branch (8172:39): [True: 4, False: 0]
  ------------------
 8173|      5|        {
 8174|      5|            return;
 8175|      5|        }
 8176|      5|    }
 8177|       |
 8178|      3|    allocChoppedUpStripArrays(tif, nstrips, stripbytes, rowsperstrip);
 8179|      3|}
tif_dirread.c:_TIFFGetStrileOffsetOrByteCountValue:
 8456|  11.4M|{
 8457|  11.4M|    TIFFDirectory *td = &tif->tif_dir;
 8458|  11.4M|    if (pbErr)
  ------------------
  |  Branch (8458:9): [True: 9.75M, False: 1.72M]
  ------------------
 8459|  9.75M|        *pbErr = 0;
 8460|       |
 8461|  11.4M|    if (strile >= td->td_nstrips)
  ------------------
  |  Branch (8461:9): [True: 0, False: 11.4M]
  ------------------
 8462|      0|    {
 8463|      0|        if (pbErr)
  ------------------
  |  Branch (8463:13): [True: 0, False: 0]
  ------------------
 8464|      0|            *pbErr = 1;
 8465|      0|        return 0;
 8466|      0|    }
 8467|       |
 8468|       |    /* Avoid the "dirent->tdir_count <= 4" code path for one of
 8469|       |     * StripOffsets/StripByteCounts, and the other code path for the other one,
 8470|       |     * which will lead to inconsistencies and potential out-of-bounds reads.
 8471|       |     */
 8472|  11.4M|    if ((td->td_stripoffset_entry.tdir_count <= 4) !=
  ------------------
  |  Branch (8472:9): [True: 353k, False: 11.1M]
  ------------------
 8473|  11.4M|        (td->td_stripbytecount_entry.tdir_count <= 4))
 8474|   353k|    {
 8475|   353k|        TIFFErrorExtR(tif, "_TIFFGetStrileOffsetOrByteCountValue",
 8476|   353k|                      "Inconsistent directory count between StripOffsets and "
 8477|   353k|                      "StripByteCounts");
 8478|   353k|        if (pbErr)
  ------------------
  |  Branch (8478:13): [True: 353k, False: 41]
  ------------------
 8479|   353k|            *pbErr = 1;
 8480|   353k|        return 0;
 8481|   353k|    }
 8482|       |
 8483|  11.1M|    if ((tif->tif_flags & TIFF_DEFERSTRILELOAD) &&
  ------------------
  |  |  147|  11.1M|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (8483:9): [True: 0, False: 11.1M]
  ------------------
 8484|      0|        !(tif->tif_flags & TIFF_CHOPPEDUPARRAYS))
  ------------------
  |  |  153|      0|    0x4000000U /* set when allocChoppedUpStripArrays() has modified strip      \
  ------------------
  |  Branch (8484:9): [True: 0, False: 0]
  ------------------
 8485|      0|    {
 8486|      0|        if (!(tif->tif_flags & TIFF_LAZYSTRILELOAD_ASKED) ||
  ------------------
  |  |  156|      0|    0x8000000U /* set when lazy/ondemand loading of strip/tile                 \
  ------------------
  |  Branch (8486:13): [True: 0, False: 0]
  ------------------
 8487|       |            /* If the values may fit in the toff_long/toff_long8 member */
 8488|       |            /* then use _TIFFFillStriles to simplify _TIFFFetchStrileValue */
 8489|      0|            dirent->tdir_count <= 4)
  ------------------
  |  Branch (8489:13): [True: 0, False: 0]
  ------------------
 8490|      0|        {
 8491|      0|            if (!_TIFFFillStriles(tif))
  ------------------
  |  Branch (8491:17): [True: 0, False: 0]
  ------------------
 8492|      0|            {
 8493|      0|                if (pbErr)
  ------------------
  |  Branch (8493:21): [True: 0, False: 0]
  ------------------
 8494|      0|                    *pbErr = 1;
 8495|       |                /* Do not return, as we want this function to always */
 8496|       |                /* return the same value if called several times with */
 8497|       |                /* the same arguments */
 8498|      0|            }
 8499|      0|        }
 8500|      0|        else
 8501|      0|        {
 8502|      0|            if (!_TIFFFetchStrileValue(tif, strile, dirent, parray))
  ------------------
  |  Branch (8502:17): [True: 0, False: 0]
  ------------------
 8503|      0|            {
 8504|      0|                if (pbErr)
  ------------------
  |  Branch (8504:21): [True: 0, False: 0]
  ------------------
 8505|      0|                    *pbErr = 1;
 8506|      0|                return 0;
 8507|      0|            }
 8508|      0|        }
 8509|      0|    }
 8510|  11.1M|    if (*parray == NULL)
  ------------------
  |  Branch (8510:9): [True: 9.06k, False: 11.1M]
  ------------------
 8511|  9.06k|    {
 8512|  9.06k|        if (pbErr)
  ------------------
  |  Branch (8512:13): [True: 9.06k, False: 0]
  ------------------
 8513|  9.06k|            *pbErr = 1;
 8514|  9.06k|        return 0;
 8515|  9.06k|    }
 8516|  11.1M|    return (*parray)[strile];
 8517|  11.1M|}
tif_dirread.c:_TIFFFillStrilesInternal:
 8556|  1.17k|{
 8557|  1.17k|    TIFFDirectory *td = &tif->tif_dir;
 8558|  1.17k|    int return_value = 1;
 8559|       |
 8560|       |    /* Do not do anything if TIFF_DEFERSTRILELOAD is not set */
 8561|  1.17k|    if (!(tif->tif_flags & TIFF_DEFERSTRILELOAD) ||
  ------------------
  |  |  147|  1.17k|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  |  Branch (8561:9): [True: 1.17k, False: 0]
  ------------------
 8562|      0|        (tif->tif_flags & TIFF_CHOPPEDUPARRAYS) != 0)
  ------------------
  |  |  153|      0|    0x4000000U /* set when allocChoppedUpStripArrays() has modified strip      \
  ------------------
  |  Branch (8562:9): [True: 0, False: 0]
  ------------------
 8563|  1.17k|        return 1;
 8564|       |
 8565|      0|    if ((tif->tif_flags & TIFF_LAZYSTRILELOAD_ASKED) &&
  ------------------
  |  |  156|      0|    0x8000000U /* set when lazy/ondemand loading of strip/tile                 \
  ------------------
  |  Branch (8565:9): [True: 0, False: 0]
  ------------------
 8566|      0|        !(tif->tif_flags & TIFF_LAZYSTRILELOAD_DONE))
  ------------------
  |  |  149|      0|    0x2000000U /* set when lazy/ondemand loading of strip/tile                 \
  ------------------
  |  Branch (8566:9): [True: 0, False: 0]
  ------------------
 8567|      0|    {
 8568|       |        /* In case of lazy loading, reload completely the arrays */
 8569|      0|        _TIFFfreeExt(tif, td->td_stripoffset_p);
 8570|      0|        _TIFFfreeExt(tif, td->td_stripbytecount_p);
 8571|      0|        td->td_stripoffset_p = NULL;
 8572|      0|        td->td_stripbytecount_p = NULL;
 8573|      0|        td->td_stripoffsetbyteallocsize = 0;
 8574|      0|        tif->tif_flags |= TIFF_LAZYSTRILELOAD_DONE;
  ------------------
  |  |  149|      0|    0x2000000U /* set when lazy/ondemand loading of strip/tile                 \
  ------------------
 8575|      0|    }
 8576|       |
 8577|       |    /* If stripoffset array is already loaded, exit with success */
 8578|      0|    if (td->td_stripoffset_p != NULL)
  ------------------
  |  Branch (8578:9): [True: 0, False: 0]
  ------------------
 8579|      0|        return 1;
 8580|       |
 8581|       |    /* If tdir_count was canceled, then we already got there, but in error */
 8582|      0|    if (td->td_stripoffset_entry.tdir_count == 0)
  ------------------
  |  Branch (8582:9): [True: 0, False: 0]
  ------------------
 8583|      0|        return 0;
 8584|       |
 8585|      0|    if (!TIFFFetchStripThing(tif, &(td->td_stripoffset_entry), td->td_nstrips,
  ------------------
  |  Branch (8585:9): [True: 0, False: 0]
  ------------------
 8586|      0|                             &td->td_stripoffset_p))
 8587|      0|    {
 8588|      0|        return_value = 0;
 8589|      0|    }
 8590|       |
 8591|      0|    if (loadStripByteCount &&
  ------------------
  |  Branch (8591:9): [True: 0, False: 0]
  ------------------
 8592|      0|        !TIFFFetchStripThing(tif, &(td->td_stripbytecount_entry),
  ------------------
  |  Branch (8592:9): [True: 0, False: 0]
  ------------------
 8593|      0|                             td->td_nstrips, &td->td_stripbytecount_p))
 8594|      0|    {
 8595|      0|        return_value = 0;
 8596|      0|    }
 8597|       |
 8598|      0|    _TIFFmemset(&(td->td_stripoffset_entry), 0, sizeof(TIFFDirEntry));
 8599|      0|    _TIFFmemset(&(td->td_stripbytecount_entry), 0, sizeof(TIFFDirEntry));
 8600|       |
 8601|       |#ifdef STRIPBYTECOUNTSORTED_UNUSED
 8602|       |    if (tif->tif_dir.td_nstrips > 1 && return_value == 1)
 8603|       |    {
 8604|       |        uint32_t strip;
 8605|       |
 8606|       |        tif->tif_dir.td_stripbytecountsorted = 1;
 8607|       |        for (strip = 1; strip < tif->tif_dir.td_nstrips; strip++)
 8608|       |        {
 8609|       |            if (tif->tif_dir.td_stripoffset_p[strip - 1] >
 8610|       |                tif->tif_dir.td_stripoffset_p[strip])
 8611|       |            {
 8612|       |                tif->tif_dir.td_stripbytecountsorted = 0;
 8613|       |                break;
 8614|       |            }
 8615|       |        }
 8616|       |    }
 8617|       |#endif
 8618|       |
 8619|      0|    return return_value;
 8620|      0|}

TIFFInitDumpMode:
  126|  5.98k|{
  127|  5.98k|    (void)scheme;
  128|  5.98k|    tif->tif_fixuptags = DumpFixupTags;
  129|  5.98k|    tif->tif_decoderow = DumpModeDecode;
  130|  5.98k|    tif->tif_decodestrip = DumpModeDecode;
  131|  5.98k|    tif->tif_decodetile = DumpModeDecode;
  132|  5.98k|    tif->tif_encoderow = DumpModeEncode;
  133|  5.98k|    tif->tif_encodestrip = DumpModeEncode;
  134|  5.98k|    tif->tif_encodetile = DumpModeEncode;
  135|  5.98k|    tif->tif_seek = DumpModeSeek;
  136|  5.98k|    return (1);
  137|  5.98k|}
tif_dumpmode.c:DumpFixupTags:
   33|    291|{
   34|    291|    (void)tif;
   35|    291|    return (1);
   36|    291|}
tif_dumpmode.c:DumpModeDecode:
   74|  2.99k|{
   75|  2.99k|    static const char module[] = "DumpModeDecode";
   76|  2.99k|    (void)s;
   77|  2.99k|    if (tif->tif_rawcc < cc)
  ------------------
  |  Branch (77:9): [True: 320, False: 2.67k]
  ------------------
   78|    320|    {
   79|    320|        TIFFErrorExtR(tif, module,
   80|    320|                      "Not enough data for scanline %" PRIu32
   81|    320|                      ", expected a request for at most %" TIFF_SSIZE_FORMAT
   82|    320|                      " bytes, got a request for %" TIFF_SSIZE_FORMAT " bytes",
   83|    320|                      tif->tif_dir.td_row, tif->tif_rawcc, cc);
   84|    320|        return (0);
   85|    320|    }
   86|       |    /*
   87|       |     * Avoid copy if client has setup raw
   88|       |     * data buffer to avoid extra copy.
   89|       |     */
   90|  2.67k|    if (tif->tif_rawcp != buf)
  ------------------
  |  Branch (90:9): [True: 2.67k, False: 0]
  ------------------
   91|  2.67k|        _TIFFmemcpy(buf, tif->tif_rawcp, cc);
   92|  2.67k|    tif->tif_rawcp += cc;
   93|  2.67k|    tif->tif_rawcc -= cc;
   94|  2.67k|    return (1);
   95|  2.99k|}

TIFFSetErrorHandler:
   33|  5.98k|{
   34|  5.98k|    TIFFErrorHandler prev = _TIFFerrorHandler;
   35|  5.98k|    _TIFFerrorHandler = handler;
   36|  5.98k|    return (prev);
   37|  5.98k|}
TIFFErrorExtR:
  108|  2.16M|{
  109|  2.16M|    va_list ap;
  110|  2.16M|    if (tif && tif->tif_errorhandler)
  ------------------
  |  Branch (110:9): [True: 2.16M, False: 0]
  |  Branch (110:16): [True: 0, False: 2.16M]
  ------------------
  111|      0|    {
  112|      0|        va_start(ap, fmt);
  113|      0|        int stop = (*tif->tif_errorhandler)(
  114|      0|            tif, tif->tif_errorhandler_user_data, module, fmt, ap);
  115|      0|        va_end(ap);
  116|      0|        if (stop)
  ------------------
  |  Branch (116:13): [True: 0, False: 0]
  ------------------
  117|      0|            return;
  118|      0|    }
  119|  2.16M|    if (_TIFFerrorHandler)
  ------------------
  |  Branch (119:9): [True: 2.16M, False: 0]
  ------------------
  120|  2.16M|    {
  121|  2.16M|        va_start(ap, fmt);
  122|  2.16M|        (*_TIFFerrorHandler)(module, fmt, ap);
  123|  2.16M|        va_end(ap);
  124|  2.16M|    }
  125|  2.16M|    if (_TIFFerrorHandlerExt)
  ------------------
  |  Branch (125:9): [True: 0, False: 2.16M]
  ------------------
  126|      0|    {
  127|      0|        va_start(ap, fmt);
  128|      0|        (*_TIFFerrorHandlerExt)(tif ? tif->tif_clientdata : NULL, module, fmt,
  ------------------
  |  Branch (128:33): [True: 0, False: 0]
  ------------------
  129|      0|                                ap);
  130|       |        va_end(ap);
  131|      0|    }
  132|  2.16M|}

_TIFFFax3fillruns:
  464|  1.33M|{
  465|  1.33M|    static const unsigned char _fillmasks[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
  466|  1.33M|                                               0xf8, 0xfc, 0xfe, 0xff};
  467|  1.33M|    unsigned char *cp;
  468|  1.33M|    uint32_t x, bx, run;
  469|  1.33M|    int32_t n, nw;
  470|  1.33M|    int64_t *lp;
  471|       |
  472|  1.33M|    if ((erun - runs) & 1)
  ------------------
  |  Branch (472:9): [True: 1.23M, False: 97.0k]
  ------------------
  473|  1.23M|        *erun++ = 0;
  474|  1.33M|    x = 0;
  475|  3.72M|    for (; runs < erun; runs += 2)
  ------------------
  |  Branch (475:12): [True: 2.39M, False: 1.33M]
  ------------------
  476|  2.39M|    {
  477|  2.39M|        run = runs[0];
  478|  2.39M|        if (x + run > lastx || run > lastx)
  ------------------
  |  Branch (478:13): [True: 231k, False: 2.16M]
  |  Branch (478:32): [True: 0, False: 2.16M]
  ------------------
  479|   231k|            run = runs[0] = (uint32_t)(lastx - x);
  480|  2.39M|        if (run)
  ------------------
  |  Branch (480:13): [True: 1.96M, False: 433k]
  ------------------
  481|  1.96M|        {
  482|  1.96M|            cp = buf + (x >> 3);
  483|  1.96M|            bx = x & 7;
  484|  1.96M|            if (run > 8 - bx)
  ------------------
  |  Branch (484:17): [True: 1.29M, False: 670k]
  ------------------
  485|  1.29M|            {
  486|  1.29M|                if (bx)
  ------------------
  |  Branch (486:21): [True: 271k, False: 1.01M]
  ------------------
  487|   271k|                { /* align to byte boundary */
  488|   271k|                    *cp++ &= (unsigned char)(0xff << (8 - bx));
  489|   271k|                    run -= 8 - bx;
  490|   271k|                }
  491|  1.29M|                if ((n = (int32_t)(run >> 3)) != 0)
  ------------------
  |  Branch (491:21): [True: 1.11M, False: 175k]
  ------------------
  492|  1.11M|                { /* multiple bytes to fill */
  493|  1.11M|                    if (((size_t)n / sizeof(int64_t)) > 1)
  ------------------
  |  Branch (493:25): [True: 237k, False: 877k]
  ------------------
  494|   237k|                    {
  495|       |                        /*
  496|       |                         * Align to int64_tword boundary and fill.
  497|       |                         */
  498|   770k|                        for (; n && !isAligned(cp, int64_t); n--)
  ------------------
  |  |  112|   770k|#define isAligned(p, t) ((((size_t)(p)) & (sizeof(t) - 1)) == 0)
  ------------------
  |  Branch (498:32): [True: 770k, False: 0]
  |  Branch (498:37): [True: 532k, False: 237k]
  ------------------
  499|   532k|                            *cp++ = 0x00;
  500|   237k|                        lp = (int64_t *)cp;
  501|   237k|                        nw = (int32_t)((size_t)n / sizeof(int64_t));
  502|   237k|                        n -= (int32_t)((size_t)nw * sizeof(int64_t));
  503|   237k|                        do
  504|   231M|                        {
  505|   231M|                            *lp++ = 0L;
  506|   231M|                        } while (--nw);
  ------------------
  |  Branch (506:34): [True: 230M, False: 237k]
  ------------------
  507|   237k|                        cp = (unsigned char *)lp;
  508|   237k|                    }
  509|  1.11M|                    ZERO(n, cp);
  ------------------
  |  |  452|  3.16M|    for (int32_t izero = 0; izero < (n); ++izero)                              \
  |  |  ------------------
  |  |  |  Branch (452:29): [True: 2.04M, False: 1.11M]
  |  |  ------------------
  |  |  453|  2.04M|    {                                                                          \
  |  |  454|  2.04M|        (cp)[izero] = 0;                                                       \
  |  |  455|  2.04M|    }                                                                          \
  |  |  456|  1.11M|    (cp) += (n);
  ------------------
  510|  1.11M|                    run &= 7;
  511|  1.11M|                }
  512|  1.29M|                if (run)
  ------------------
  |  Branch (512:21): [True: 1.15M, False: 133k]
  ------------------
  513|  1.15M|                    cp[0] &= (unsigned char)(0xff >> run);
  514|  1.29M|            }
  515|   670k|            else
  516|   670k|                cp[0] &= (unsigned char)~(_fillmasks[run] >> bx);
  517|  1.96M|            x += runs[0];
  518|  1.96M|        }
  519|  2.39M|        run = runs[1];
  520|  2.39M|        if (x + run > lastx || run > lastx)
  ------------------
  |  Branch (520:13): [True: 0, False: 2.39M]
  |  Branch (520:32): [True: 0, False: 2.39M]
  ------------------
  521|      0|            run = runs[1] = lastx - x;
  522|  2.39M|        if (run)
  ------------------
  |  Branch (522:13): [True: 637k, False: 1.75M]
  ------------------
  523|   637k|        {
  524|   637k|            cp = buf + (x >> 3);
  525|   637k|            bx = x & 7;
  526|   637k|            if (run > 8 - bx)
  ------------------
  |  Branch (526:17): [True: 240k, False: 396k]
  ------------------
  527|   240k|            {
  528|   240k|                if (bx)
  ------------------
  |  Branch (528:21): [True: 237k, False: 3.48k]
  ------------------
  529|   237k|                { /* align to byte boundary */
  530|   237k|                    *cp++ |= (unsigned char)(0xff >> bx);
  531|   237k|                    run -= 8 - bx;
  532|   237k|                }
  533|   240k|                if ((n = (int32_t)(run >> 3)) != 0)
  ------------------
  |  Branch (533:21): [True: 21.6k, False: 219k]
  ------------------
  534|  21.6k|                { /* multiple bytes to fill */
  535|  21.6k|                    if (((size_t)n / sizeof(int64_t)) > 1)
  ------------------
  |  Branch (535:25): [True: 6.17k, False: 15.4k]
  ------------------
  536|  6.17k|                    {
  537|       |                        /*
  538|       |                         * Align to int64_t boundary and fill.
  539|       |                         */
  540|  31.1k|                        for (; n && !isAligned(cp, int64_t); n--)
  ------------------
  |  |  112|  31.1k|#define isAligned(p, t) ((((size_t)(p)) & (sizeof(t) - 1)) == 0)
  ------------------
  |  Branch (540:32): [True: 31.1k, False: 0]
  |  Branch (540:37): [True: 24.9k, False: 6.17k]
  ------------------
  541|  24.9k|                            *cp++ = 0xff;
  542|  6.17k|                        lp = (int64_t *)cp;
  543|  6.17k|                        nw = (int32_t)((size_t)n / sizeof(int64_t));
  544|  6.17k|                        n -= (int32_t)((size_t)nw * sizeof(int64_t));
  545|  6.17k|                        do
  546|  5.98M|                        {
  547|  5.98M|                            *lp++ = -1L;
  548|  5.98M|                        } while (--nw);
  ------------------
  |  Branch (548:34): [True: 5.98M, False: 6.17k]
  ------------------
  549|  6.17k|                        cp = (unsigned char *)lp;
  550|  6.17k|                    }
  551|  21.6k|                    FILL(n, cp);
  ------------------
  |  |  445|  80.6k|    for (int32_t ifill = 0; ifill < (n); ++ifill)                              \
  |  |  ------------------
  |  |  |  Branch (445:29): [True: 58.9k, False: 21.6k]
  |  |  ------------------
  |  |  446|  58.9k|    {                                                                          \
  |  |  447|  58.9k|        (cp)[ifill] = 0xff;                                                    \
  |  |  448|  58.9k|    }                                                                          \
  |  |  449|  21.6k|    (cp) += (n);
  ------------------
  552|  21.6k|                    run &= 7;
  553|  21.6k|                }
  554|       |                /* Explicit 0xff masking to make icc -check=conversions happy */
  555|   240k|                if (run)
  ------------------
  |  Branch (555:21): [True: 235k, False: 5.74k]
  ------------------
  556|   235k|                    cp[0] = (unsigned char)((cp[0] | (0xff00 >> run)) & 0xff);
  557|   240k|            }
  558|   396k|            else
  559|   396k|                cp[0] |= (unsigned char)(_fillmasks[run] >> bx);
  560|   637k|            x += runs[1];
  561|   637k|        }
  562|  2.39M|    }
  563|       |    assert(x == lastx);
  ------------------
  |  Branch (563:5): [True: 0, False: 1.33M]
  |  Branch (563:5): [True: 1.33M, False: 0]
  ------------------
  564|  1.33M|}
TIFFInitCCITTFax3:
 1607|    178|{
 1608|    178|    (void)scheme;
 1609|    178|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1609:9): [True: 178, False: 0]
  ------------------
 1610|    178|    {
 1611|       |        /*
 1612|       |         * Merge codec-specific tag information.
 1613|       |         */
 1614|    178|        if (!_TIFFMergeFields(tif, fax3Fields, TIFFArrayCount(fax3Fields)))
  ------------------
  |  |  339|    178|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1614:13): [True: 0, False: 178]
  ------------------
 1615|      0|        {
 1616|      0|            TIFFErrorExtR(tif, "TIFFInitCCITTFax3",
 1617|      0|                          "Merging CCITT Fax 3 codec-specific tags failed");
 1618|      0|            return 0;
 1619|      0|        }
 1620|       |
 1621|       |        /*
 1622|       |         * The default format is Class/F-style w/o RTC.
 1623|       |         */
 1624|    178|        return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
  ------------------
  |  |  697|    178|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
                      return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
  ------------------
  |  |  703|    178|#define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */
  |  |  ------------------
  |  |  |  |  699|    178|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  |  |  ------------------
  ------------------
 1625|    178|    }
 1626|      0|    else
 1627|      0|        return 01;
 1628|    178|}
TIFFInitCCITTFax4:
 1762|     82|{
 1763|     82|    (void)scheme;
 1764|     82|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1764:9): [True: 82, False: 0]
  ------------------
 1765|     82|    { /* reuse G3 support */
 1766|       |        /*
 1767|       |         * Merge codec-specific tag information.
 1768|       |         */
 1769|     82|        if (!_TIFFMergeFields(tif, fax4Fields, TIFFArrayCount(fax4Fields)))
  ------------------
  |  |  339|     82|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1769:13): [True: 0, False: 82]
  ------------------
 1770|      0|        {
 1771|      0|            TIFFErrorExtR(tif, "TIFFInitCCITTFax4",
 1772|      0|                          "Merging CCITT Fax 4 codec-specific tags failed");
 1773|      0|            return 0;
 1774|      0|        }
 1775|       |
 1776|     82|        tif->tif_decoderow = Fax4Decode;
 1777|     82|        tif->tif_decodestrip = Fax4Decode;
 1778|     82|        tif->tif_decodetile = Fax4Decode;
 1779|     82|        tif->tif_encoderow = Fax4Encode;
 1780|     82|        tif->tif_encodestrip = Fax4Encode;
 1781|     82|        tif->tif_encodetile = Fax4Encode;
 1782|     82|        tif->tif_postencode = Fax4PostEncode;
 1783|     82|        tif->tif_getmaxcompressionratio = Fax4GetMaxCompressionRatio;
 1784|       |        /*
 1785|       |         * Suppress RTC at the end of each strip.
 1786|       |         */
 1787|     82|        return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC);
  ------------------
  |  |  697|     82|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
                      return TIFFSetField(tif, TIFFTAG_FAXMODE, FAXMODE_NORTC);
  ------------------
  |  |  699|     82|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  ------------------
 1788|     82|    }
 1789|      0|    else
 1790|      0|        return (0);
 1791|     82|}
TIFFInitCCITTRLE:
 1871|     25|{
 1872|     25|    (void)scheme;
 1873|     25|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1873:9): [True: 25, False: 0]
  ------------------
 1874|     25|    { /* reuse G3 support */
 1875|     25|        tif->tif_decoderow = Fax3DecodeRLE;
 1876|     25|        tif->tif_decodestrip = Fax3DecodeRLE;
 1877|     25|        tif->tif_decodetile = Fax3DecodeRLE;
 1878|     25|        tif->tif_getmaxcompressionratio = Fax3RLEGetMaxCompressionRatio;
 1879|       |        /*
 1880|       |         * Suppress RTC+EOLs when encoding and byte-align data.
 1881|       |         */
 1882|     25|        return TIFFSetField(tif, TIFFTAG_FAXMODE,
  ------------------
  |  |  697|     25|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
 1883|     25|                            FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_BYTEALIGN);
  ------------------
  |  |  699|     25|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_BYTEALIGN);
  ------------------
  |  |  700|     25|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_BYTEALIGN);
  ------------------
  |  |  701|     25|#define FAXMODE_BYTEALIGN 0x0004     /* byte align row */
  ------------------
 1884|     25|    }
 1885|      0|    else
 1886|      0|        return (0);
 1887|     25|}
TIFFInitCCITTRLEW:
 1890|     28|{
 1891|     28|    (void)scheme;
 1892|     28|    if (InitCCITTFax3(tif))
  ------------------
  |  Branch (1892:9): [True: 28, False: 0]
  ------------------
 1893|     28|    { /* reuse G3 support */
 1894|     28|        tif->tif_decoderow = Fax3DecodeRLE;
 1895|     28|        tif->tif_decodestrip = Fax3DecodeRLE;
 1896|     28|        tif->tif_decodetile = Fax3DecodeRLE;
 1897|     28|        tif->tif_getmaxcompressionratio = Fax3RLEGetMaxCompressionRatio;
 1898|       |        /*
 1899|       |         * Suppress RTC+EOLs when encoding and word-align data.
 1900|       |         */
 1901|     28|        return TIFFSetField(tif, TIFFTAG_FAXMODE,
  ------------------
  |  |  697|     28|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
 1902|     28|                            FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_WORDALIGN);
  ------------------
  |  |  699|     28|#define FAXMODE_NORTC 0x0001         /* no RTC at end of data */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_WORDALIGN);
  ------------------
  |  |  700|     28|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  ------------------
                                          FAXMODE_NORTC | FAXMODE_NOEOL | FAXMODE_WORDALIGN);
  ------------------
  |  |  702|     28|#define FAXMODE_WORDALIGN 0x0008     /* word align row */
  ------------------
 1903|     28|    }
 1904|      0|    else
 1905|      0|        return (0);
 1906|     28|}
tif_fax3.c:InitCCITTFax3:
 1538|    313|{
 1539|    313|    static const char module[] = "InitCCITTFax3";
 1540|    313|    Fax3BaseState *sp;
 1541|       |
 1542|       |    /*
 1543|       |     * Merge codec-specific tag information.
 1544|       |     */
 1545|    313|    if (!_TIFFMergeFields(tif, faxFields, TIFFArrayCount(faxFields)))
  ------------------
  |  |  339|    313|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1545:9): [True: 0, False: 313]
  ------------------
 1546|      0|    {
 1547|      0|        TIFFErrorExtR(tif, "InitCCITTFax3",
 1548|      0|                      "Merging common CCITT Fax codec-specific tags failed");
 1549|      0|        return 0;
 1550|      0|    }
 1551|       |
 1552|       |    /*
 1553|       |     * Allocate state block so tag methods have storage to record values.
 1554|       |     */
 1555|    313|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(Fax3CodecState));
 1556|       |
 1557|    313|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (1557:9): [True: 0, False: 313]
  ------------------
 1558|      0|    {
 1559|      0|        TIFFErrorExtR(tif, module, "No space for state block");
 1560|      0|        return (0);
 1561|      0|    }
 1562|    313|    _TIFFmemset(tif->tif_data, 0, sizeof(Fax3CodecState));
 1563|       |
 1564|    313|    sp = Fax3State(tif);
  ------------------
  |  |   72|    313|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
 1565|    313|    sp->rw_mode = tif->tif_mode;
 1566|       |
 1567|       |    /*
 1568|       |     * Override parent get/set field methods.
 1569|       |     */
 1570|    313|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1571|    313|    tif->tif_tagmethods.vgetfield = Fax3VGetField; /* hook for codec tags */
 1572|    313|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1573|    313|    tif->tif_tagmethods.vsetfield = Fax3VSetField; /* hook for codec tags */
 1574|    313|    sp->printdir = tif->tif_tagmethods.printdir;
 1575|    313|    tif->tif_tagmethods.printdir = Fax3PrintDir; /* hook for codec tags */
 1576|    313|    sp->groupoptions = 0;
 1577|       |
 1578|    313|    if (sp->rw_mode == O_RDONLY) /* FIXME: improve for in place update */
  ------------------
  |  Branch (1578:9): [True: 313, False: 0]
  ------------------
 1579|    313|        tif->tif_flags |= TIFF_NOBITREV; /* decoder does bit reversal */
  ------------------
  |  |  127|    313|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
 1580|    313|    DecoderState(tif)->runs = NULL;
  ------------------
  |  |  108|    313|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|    313|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1581|    313|    TIFFSetField(tif, TIFFTAG_FAXFILLFUNC, _TIFFFax3fillruns);
  ------------------
  |  |  713|    313|#define TIFFTAG_FAXFILLFUNC 65540     /* G3/G4 fill function */
  ------------------
 1582|    313|    EncoderState(tif)->refline = NULL;
  ------------------
  |  |  109|    313|#define EncoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|    313|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1583|       |
 1584|       |    /*
 1585|       |     * Install codec methods.
 1586|       |     */
 1587|    313|    tif->tif_fixuptags = Fax3FixupTags;
 1588|    313|    tif->tif_setupdecode = Fax3SetupState;
 1589|    313|    tif->tif_predecode = Fax3PreDecode;
 1590|    313|    tif->tif_decoderow = Fax3Decode1D;
 1591|    313|    tif->tif_decodestrip = Fax3Decode1D;
 1592|    313|    tif->tif_decodetile = Fax3Decode1D;
 1593|    313|    tif->tif_setupencode = Fax3SetupState;
 1594|    313|    tif->tif_preencode = Fax3PreEncode;
 1595|    313|    tif->tif_postencode = Fax3PostEncode;
 1596|    313|    tif->tif_encoderow = Fax3Encode;
 1597|    313|    tif->tif_encodestrip = Fax3Encode;
 1598|    313|    tif->tif_encodetile = Fax3Encode;
 1599|    313|    tif->tif_close = Fax3Close;
 1600|    313|    tif->tif_cleanup = Fax3Cleanup;
 1601|    313|    tif->tif_getmaxcompressionratio = Fax3GetMaxCompressionRatio;
 1602|       |
 1603|    313|    return (1);
 1604|    313|}
tif_fax3.c:Fax3VGetField:
 1424|  2.64k|{
 1425|  2.64k|    Fax3BaseState *sp = Fax3State(tif);
  ------------------
  |  |   72|  2.64k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
 1426|       |
 1427|  2.64k|    assert(sp != 0);
  ------------------
  |  Branch (1427:5): [True: 0, False: 2.64k]
  |  Branch (1427:5): [True: 2.64k, False: 0]
  ------------------
 1428|       |
 1429|  2.64k|    switch (tag)
 1430|  2.64k|    {
 1431|      0|        case TIFFTAG_FAXMODE:
  ------------------
  |  |  697|      0|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
  |  Branch (1431:9): [True: 0, False: 2.64k]
  ------------------
 1432|      0|            *va_arg(ap, int *) = sp->mode;
 1433|      0|            break;
 1434|      0|        case TIFFTAG_FAXFILLFUNC:
  ------------------
  |  |  713|      0|#define TIFFTAG_FAXFILLFUNC 65540     /* G3/G4 fill function */
  ------------------
  |  Branch (1434:9): [True: 0, False: 2.64k]
  ------------------
 1435|      0|            *va_arg(ap, TIFFFaxFillFunc *) = DecoderState(tif)->fill;
  ------------------
  |  |  108|      0|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|      0|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1436|      0|            break;
 1437|      0|        case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  279|      0|#define TIFFTAG_GROUP3OPTIONS 292          /* 32 flag bits */
  ------------------
  |  Branch (1437:9): [True: 0, False: 2.64k]
  ------------------
 1438|      0|        case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|      0|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1438:9): [True: 0, False: 2.64k]
  ------------------
 1439|      0|            *va_arg(ap, uint32_t *) = sp->groupoptions;
 1440|      0|            break;
 1441|      0|        case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  315|      0|#define TIFFTAG_BADFAXLINES 326            /* lines w/ wrong pixel count */
  ------------------
  |  Branch (1441:9): [True: 0, False: 2.64k]
  ------------------
 1442|      0|            *va_arg(ap, uint32_t *) = sp->badfaxlines;
 1443|      0|            break;
 1444|      0|        case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  316|      0|#define TIFFTAG_CLEANFAXDATA 327           /* regenerated line info */
  ------------------
  |  Branch (1444:9): [True: 0, False: 2.64k]
  ------------------
 1445|      0|            *va_arg(ap, uint16_t *) = sp->cleanfaxdata;
 1446|      0|            break;
 1447|      0|        case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  320|      0|#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
  ------------------
  |  Branch (1447:9): [True: 0, False: 2.64k]
  ------------------
 1448|      0|            *va_arg(ap, uint32_t *) = sp->badfaxrun;
 1449|      0|            break;
 1450|  2.64k|        default:
  ------------------
  |  Branch (1450:9): [True: 2.64k, False: 0]
  ------------------
 1451|  2.64k|            return (*sp->vgetparent)(tif, tag, ap);
 1452|  2.64k|    }
 1453|      0|    return (1);
 1454|  2.64k|}
tif_fax3.c:Fax3VSetField:
 1376|  2.66k|{
 1377|  2.66k|    Fax3BaseState *sp = Fax3State(tif);
  ------------------
  |  |   72|  2.66k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
 1378|  2.66k|    const TIFFField *fip;
 1379|       |
 1380|  2.66k|    assert(sp != 0);
  ------------------
  |  Branch (1380:5): [True: 0, False: 2.66k]
  |  Branch (1380:5): [True: 2.66k, False: 0]
  ------------------
 1381|  2.66k|    assert(sp->vsetparent != 0);
  ------------------
  |  Branch (1381:5): [True: 0, False: 2.66k]
  |  Branch (1381:5): [True: 2.66k, False: 0]
  ------------------
 1382|       |
 1383|  2.66k|    switch (tag)
 1384|  2.66k|    {
 1385|    313|        case TIFFTAG_FAXMODE:
  ------------------
  |  |  697|    313|#define TIFFTAG_FAXMODE 65536        /* Group 3/4 format control */
  ------------------
  |  Branch (1385:9): [True: 313, False: 2.35k]
  ------------------
 1386|    313|            sp->mode = (int)va_arg(ap, int);
 1387|    313|            return 1; /* NB: pseudo tag */
 1388|    313|        case TIFFTAG_FAXFILLFUNC:
  ------------------
  |  |  713|    313|#define TIFFTAG_FAXFILLFUNC 65540     /* G3/G4 fill function */
  ------------------
  |  Branch (1388:9): [True: 313, False: 2.35k]
  ------------------
 1389|    313|            DecoderState(tif)->fill = va_arg(ap, TIFFFaxFillFunc);
  ------------------
  |  |  108|    313|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|    313|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1390|    313|            return 1; /* NB: pseudo tag */
 1391|    128|        case TIFFTAG_GROUP3OPTIONS:
  ------------------
  |  |  279|    128|#define TIFFTAG_GROUP3OPTIONS 292          /* 32 flag bits */
  ------------------
  |  Branch (1391:9): [True: 128, False: 2.53k]
  ------------------
 1392|       |            /* XXX: avoid reading options if compression mismatches. */
 1393|    128|            if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
  ------------------
  |  |  184|    128|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (1393:17): [True: 128, False: 0]
  ------------------
 1394|    128|                sp->groupoptions = (uint32_t)va_arg(ap, uint32_t);
 1395|    128|            break;
 1396|      0|        case TIFFTAG_GROUP4OPTIONS:
  ------------------
  |  |  284|      0|#define TIFFTAG_GROUP4OPTIONS 293          /* 32 flag bits */
  ------------------
  |  Branch (1396:9): [True: 0, False: 2.66k]
  ------------------
 1397|       |            /* XXX: avoid reading options if compression mismatches. */
 1398|      0|            if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)
  ------------------
  |  |  186|      0|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (1398:17): [True: 0, False: 0]
  ------------------
 1399|      0|                sp->groupoptions = (uint32_t)va_arg(ap, uint32_t);
 1400|      0|            break;
 1401|      4|        case TIFFTAG_BADFAXLINES:
  ------------------
  |  |  315|      4|#define TIFFTAG_BADFAXLINES 326            /* lines w/ wrong pixel count */
  ------------------
  |  Branch (1401:9): [True: 4, False: 2.66k]
  ------------------
 1402|      4|            sp->badfaxlines = (uint32_t)va_arg(ap, uint32_t);
 1403|      4|            break;
 1404|     10|        case TIFFTAG_CLEANFAXDATA:
  ------------------
  |  |  316|     10|#define TIFFTAG_CLEANFAXDATA 327           /* regenerated line info */
  ------------------
  |  Branch (1404:9): [True: 10, False: 2.65k]
  ------------------
 1405|     10|            sp->cleanfaxdata = (uint16_t)va_arg(ap, uint16_vap);
 1406|     10|            break;
 1407|      3|        case TIFFTAG_CONSECUTIVEBADFAXLINES:
  ------------------
  |  |  320|      3|#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
  ------------------
  |  Branch (1407:9): [True: 3, False: 2.66k]
  ------------------
 1408|      3|            sp->badfaxrun = (uint32_t)va_arg(ap, uint32_t);
 1409|      3|            break;
 1410|  1.89k|        default:
  ------------------
  |  Branch (1410:9): [True: 1.89k, False: 771]
  ------------------
 1411|  1.89k|            return (*sp->vsetparent)(tif, tag, ap);
 1412|  2.66k|    }
 1413|       |
 1414|    145|    if ((fip = TIFFFieldWithTag(tif, tag)) != NULL)
  ------------------
  |  Branch (1414:9): [True: 145, False: 0]
  ------------------
 1415|    145|        TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  249|    145|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|    145|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|    145|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1416|      0|    else
 1417|      0|        return 0;
 1418|       |
 1419|    145|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|    145|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1420|    145|    return 1;
 1421|    145|}
tif_fax3.c:Fax3FixupTags:
  569|    260|{
  570|    260|    (void)tif;
  571|    260|    return (1);
  572|    260|}
tif_fax3.c:Fax3SetupState:
  582|    255|{
  583|    255|    static const char module[] = "Fax3SetupState";
  584|    255|    TIFFDirectory *td = &tif->tif_dir;
  585|    255|    Fax3BaseState *sp = Fax3State(tif);
  ------------------
  |  |   72|    255|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
  586|    255|    int needsRefLine;
  587|    255|    Fax3CodecState *dsp = (Fax3CodecState *)Fax3State(tif);
  ------------------
  |  |   72|    255|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  ------------------
  588|    255|    tmsize_t rowbytes;
  589|    255|    uint32_t rowpixels;
  590|       |
  591|    255|    if (td->td_bitspersample != 1)
  ------------------
  |  Branch (591:9): [True: 3, False: 252]
  ------------------
  592|      3|    {
  593|      3|        TIFFErrorExtR(tif, module,
  594|      3|                      "Bits/sample must be 1 for Group 3/4 encoding/decoding");
  595|      3|        return (0);
  596|      3|    }
  597|    252|    if (td->td_samplesperpixel != 1 &&
  ------------------
  |  Branch (597:9): [True: 1, False: 251]
  ------------------
  598|      1|        td->td_planarconfig != PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|      1|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (598:9): [True: 0, False: 1]
  ------------------
  599|      0|    {
  600|      0|        TIFFErrorExtR(
  601|      0|            tif, module,
  602|      0|            "Samples/pixel shall be 1 for Group 3/4 encoding/decoding, "
  603|      0|            "or PlanarConfiguration must be set to Separate.");
  604|      0|        return 0;
  605|      0|    }
  606|       |    /*
  607|       |     * Calculate the scanline/tile widths.
  608|       |     */
  609|    252|    if (isTiled(tif))
  ------------------
  |  |  278|    252|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    252|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 145, False: 107]
  |  |  ------------------
  ------------------
  610|    145|    {
  611|    145|        rowbytes = TIFFTileRowSize(tif);
  612|    145|        rowpixels = td->td_tilewidth;
  613|    145|    }
  614|    107|    else
  615|    107|    {
  616|    107|        rowbytes = TIFFScanlineSize(tif);
  617|    107|        rowpixels = td->td_imagewidth;
  618|    107|    }
  619|    252|    if ((int64_t)rowbytes < ((int64_t)rowpixels + 7) / 8)
  ------------------
  |  Branch (619:9): [True: 0, False: 252]
  ------------------
  620|      0|    {
  621|      0|        TIFFErrorExtR(tif, module,
  622|      0|                      "Inconsistent number of bytes per row : rowbytes=%" PRId64
  623|      0|                      " rowpixels=%" PRIu32,
  624|      0|                      (int64_t)rowbytes, rowpixels);
  625|      0|        return (0);
  626|      0|    }
  627|    252|    sp->rowbytes = rowbytes;
  628|    252|    sp->rowpixels = rowpixels;
  629|       |    /*
  630|       |     * Allocate any additional space required for decoding/encoding.
  631|       |     */
  632|    252|    needsRefLine = ((sp->groupoptions & GROUP3OPT_2DENCODING) ||
  ------------------
  |  |  281|    252|#define GROUP3OPT_2DENCODING 0x1           /* 2-dimensional coding */
  ------------------
  |  Branch (632:21): [True: 121, False: 131]
  ------------------
  633|    131|                    td->td_compression == COMPRESSION_CCITTFAX4);
  ------------------
  |  |  186|    131|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (633:21): [True: 65, False: 66]
  ------------------
  634|       |
  635|       |    /*
  636|       |      Assure that allocation computations do not overflow.
  637|       |
  638|       |      TIFFroundup and TIFFSafeMultiply return zero on integer overflow
  639|       |    */
  640|    252|    if (dsp->runs != NULL)
  ------------------
  |  Branch (640:9): [True: 0, False: 252]
  ------------------
  641|      0|    {
  642|      0|        _TIFFfreeExt(tif, dsp->runs);
  643|      0|        dsp->runs = (uint32_t *)NULL;
  644|      0|    }
  645|    252|    dsp->nruns = TIFFroundup_32(rowpixels + 1, 32);
  ------------------
  |  |  322|    252|#define TIFFroundup_32(x, y) ((uint32_t)(TIFFhowmany_32(x, y) * (uint32_t)(y)))
  |  |  ------------------
  |  |  |  |  312|    252|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (312:6): [True: 252, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  313|    252|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  |  |  314|    252|         : 0U)
  |  |  ------------------
  ------------------
  646|    252|    if (needsRefLine)
  ------------------
  |  Branch (646:9): [True: 186, False: 66]
  ------------------
  647|    186|    {
  648|    186|        dsp->nruns = TIFFSafeMultiply(uint32_t, dsp->nruns, 2);
  ------------------
  |  |  332|    186|    ((((t)(m) != (t)0) && (((t)((((t)(v)) * ((t)(m))) / ((t)(m)))) == (t)(v))) \
  |  |  ------------------
  |  |  |  Branch (332:7): [True: 186, Folded]
  |  |  |  Branch (332:27): [True: 186, False: 0]
  |  |  ------------------
  |  |  333|    186|         ? (t)(((t)(v)) * ((t)(m)))                                            \
  |  |  334|    186|         : (t)0)
  ------------------
  649|    186|    }
  650|    252|    if ((dsp->nruns == 0) || (TIFFSafeMultiply(uint32_t, dsp->nruns, 2) == 0))
  ------------------
  |  |  332|    252|    ((((t)(m) != (t)0) && (((t)((((t)(v)) * ((t)(m))) / ((t)(m)))) == (t)(v))) \
  |  |  ------------------
  |  |  |  Branch (332:7): [True: 252, Folded]
  |  |  |  Branch (332:27): [True: 252, False: 0]
  |  |  ------------------
  |  |  333|    252|         ? (t)(((t)(v)) * ((t)(m)))                                            \
  |  |  334|    252|         : (t)0)
  ------------------
  |  Branch (650:9): [True: 0, False: 252]
  |  Branch (650:30): [True: 0, False: 252]
  ------------------
  651|      0|    {
  652|      0|        TIFFErrorExtR(tif, tif->tif_name,
  653|      0|                      "Row pixels integer overflow (rowpixels %" PRIu32 ")",
  654|      0|                      rowpixels);
  655|      0|        return (0);
  656|      0|    }
  657|    252|    dsp->runs = (uint32_t *)_TIFFCheckMalloc(
  658|    252|        tif, TIFFSafeMultiply(uint32_t, dsp->nruns, 2), sizeof(uint32_t),
  ------------------
  |  |  332|    252|    ((((t)(m) != (t)0) && (((t)((((t)(v)) * ((t)(m))) / ((t)(m)))) == (t)(v))) \
  |  |  ------------------
  |  |  |  Branch (332:7): [True: 252, Folded]
  |  |  |  Branch (332:27): [True: 252, False: 0]
  |  |  ------------------
  |  |  333|    252|         ? (t)(((t)(v)) * ((t)(m)))                                            \
  |  |  334|    252|         : (t)0)
  ------------------
  659|    252|        "for Group 3/4 run arrays");
  660|    252|    if (dsp->runs == NULL)
  ------------------
  |  Branch (660:9): [True: 0, False: 252]
  ------------------
  661|      0|        return (0);
  662|    252|    memset(dsp->runs, 0,
  663|    252|           TIFFSafeMultiply(uint32_t, dsp->nruns, 2) * sizeof(uint32_t));
  ------------------
  |  |  332|    252|    ((((t)(m) != (t)0) && (((t)((((t)(v)) * ((t)(m))) / ((t)(m)))) == (t)(v))) \
  |  |  ------------------
  |  |  |  Branch (332:7): [True: 252, Folded]
  |  |  |  Branch (332:27): [True: 252, False: 0]
  |  |  ------------------
  |  |  333|    252|         ? (t)(((t)(v)) * ((t)(m)))                                            \
  |  |  334|    252|         : (t)0)
  ------------------
  664|    252|    dsp->curruns = dsp->runs;
  665|    252|    if (needsRefLine)
  ------------------
  |  Branch (665:9): [True: 186, False: 66]
  ------------------
  666|    186|        dsp->refruns = dsp->runs + dsp->nruns;
  667|     66|    else
  668|     66|        dsp->refruns = NULL;
  669|    252|    if (td->td_compression == COMPRESSION_CCITTFAX3 && is2DEncoding(dsp))
  ------------------
  |  |  184|    504|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
                  if (td->td_compression == COMPRESSION_CCITTFAX3 && is2DEncoding(dsp))
  ------------------
  |  |  111|    155|#define is2DEncoding(sp) (sp->b.groupoptions & GROUP3OPT_2DENCODING)
  |  |  ------------------
  |  |  |  |  281|    155|#define GROUP3OPT_2DENCODING 0x1           /* 2-dimensional coding */
  |  |  ------------------
  |  |  |  Branch (111:26): [True: 121, False: 34]
  |  |  ------------------
  ------------------
  |  Branch (669:9): [True: 155, False: 97]
  ------------------
  670|    121|    { /* NB: default is 1D routine */
  671|    121|        tif->tif_decoderow = Fax3Decode2D;
  672|    121|        tif->tif_decodestrip = Fax3Decode2D;
  673|    121|        tif->tif_decodetile = Fax3Decode2D;
  674|    121|    }
  675|       |
  676|    252|    if (needsRefLine)
  ------------------
  |  Branch (676:9): [True: 186, False: 66]
  ------------------
  677|    186|    { /* 2d encoding */
  678|    186|        Fax3CodecState *esp = EncoderState(tif);
  ------------------
  |  |  109|    186|#define EncoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|    186|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  679|       |        /*
  680|       |         * 2d encoding requires a scanline
  681|       |         * buffer for the ``reference line''; the
  682|       |         * scanline against which delta encoding
  683|       |         * is referenced.  The reference line must
  684|       |         * be initialized to be ``white'' (done elsewhere).
  685|       |         */
  686|    186|        if (esp->refline != NULL)
  ------------------
  |  Branch (686:13): [True: 0, False: 186]
  ------------------
  687|      0|        {
  688|      0|            _TIFFfreeExt(tif, esp->refline);
  689|      0|        }
  690|    186|        esp->refline = (unsigned char *)_TIFFmallocExt(tif, rowbytes);
  691|    186|        if (esp->refline == NULL)
  ------------------
  |  Branch (691:13): [True: 0, False: 186]
  ------------------
  692|      0|        {
  693|      0|            TIFFErrorExtR(tif, module, "No space for Group 3/4 reference line");
  694|      0|            return (0);
  695|      0|        }
  696|    186|    }
  697|     66|    else /* 1d encoding */
  698|     66|        EncoderState(tif)->refline = NULL;
  ------------------
  |  |  109|     66|#define EncoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|     66|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  699|       |
  700|    252|    return (1);
  701|    252|}
tif_fax3.c:Fax3Decode2D:
  385|  21.6k|{
  386|  21.6k|    DECLARE_STATE_2D(tif, sp, "Fax3Decode2D");
  ------------------
  |  |  139|  21.6k|    DECLARE_STATE(tif, sp, mod);                                               \
  |  |  ------------------
  |  |  |  |  123|  21.6k|    static const char module[] = mod;                                          \
  |  |  |  |  124|  21.6k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  21.6k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|  21.6k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  125|  21.6k|    int a0;                                   /* reference element */          \
  |  |  |  |  126|  21.6k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  |  |  127|  21.6k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  |  |  128|  21.6k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  |  |  129|  21.6k|    int RunLength;                            /* length of current run */      \
  |  |  |  |  130|  21.6k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  |  |  131|  21.6k|    unsigned char *ep;                        /* end of input data */          \
  |  |  |  |  132|  21.6k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  |  |  133|  21.6k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  |  |  134|  21.6k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  |  |  135|  21.6k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  |  |  136|  21.6k|    const TIFFFaxTabEnt *TabEnt
  |  |  ------------------
  |  |  140|  21.6k|    int b1; /* next change on prev line */                                     \
  |  |  141|  21.6k|    uint32_t                                                                   \
  |  |  142|  21.6k|        *pb /* next run in reference line */ /*                                \
  ------------------
  387|  21.6k|    int is1D; /* current line is 1d/2d-encoded */
  388|  21.6k|    (void)s;
  389|  21.6k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (389:9): [True: 0, False: 21.6k]
  ------------------
  390|      0|    {
  391|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
  392|      0|        return (-1);
  393|      0|    }
  394|  21.6k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (394:9): [True: 1, False: 21.6k]
  ------------------
  395|      1|        return (-1);
  396|  21.7k|RETRY_WITHOUT_EOL_2D:
  397|  21.7k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  21.7k|    do                                                                         \
  |  |  148|  21.7k|    {                                                                          \
  |  |  149|  21.7k|        BitAcc = sp->data;                                                     \
  |  |  150|  21.7k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  21.7k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  21.7k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  21.7k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  21.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 21.7k]
  |  |  ------------------
  ------------------
  398|   785k|    while (occ > 0)
  ------------------
  |  Branch (398:12): [True: 779k, False: 6.73k]
  ------------------
  399|   779k|    {
  400|   779k|        a0 = 0;
  401|   779k|        RunLength = 0;
  402|   779k|        pa = thisrun = sp->curruns;
  403|       |#ifdef FAX3_DEBUG
  404|       |        printf("\nBitAcc=%08" PRIX32 ", BitsAvail = %d EOLcnt = %d", BitAcc,
  405|       |               BitsAvail, EOLcnt);
  406|       |#endif
  407|   779k|        SYNC_EOL(EOF2D, RETRY_WITHOUT_EOL_2D);
  ------------------
  |  |  293|   779k|    do                                                                         \
  |  |  294|   779k|    {                                                                          \
  |  |  295|   779k|        if (!(sp->b.mode & FAXMODE_NOEOL)) /* skip EOL, if not present */      \
  |  |  ------------------
  |  |  |  |  700|   779k|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  |  Branch (295:13): [True: 22.4k, False: 756k]
  |  |  ------------------
  |  |  296|   779k|        {                                                                      \
  |  |  297|  22.4k|            if (EOLcnt == 0)                                                   \
  |  |  ------------------
  |  |  |  Branch (297:17): [True: 17.5k, False: 4.92k]
  |  |  ------------------
  |  |  298|  22.4k|            {                                                                  \
  |  |  299|  17.5k|                for (;;)                                                       \
  |  |  300|  20.2M|                {                                                              \
  |  |  301|  20.2M|                    NeedBits16(11, eoflab);                                    \
  |  |  ------------------
  |  |  |  |  164|  20.2M|    do                                                                         \
  |  |  |  |  165|  20.2M|    {                                                                          \
  |  |  |  |  166|  20.2M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (166:13): [True: 2.53M, False: 17.6M]
  |  |  |  |  ------------------
  |  |  |  |  167|  20.2M|        {                                                                      \
  |  |  |  |  168|  2.53M|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  2.53M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 926, False: 2.53M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  169|  2.53M|            {                                                                  \
  |  |  |  |  170|    926|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:21): [True: 129, False: 797]
  |  |  |  |  ------------------
  |  |  |  |  171|    926|                    goto eoflab;                                               \
  |  |  |  |  172|    926|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  173|    797|            }                                                                  \
  |  |  |  |  174|  2.53M|            else                                                               \
  |  |  |  |  175|  2.53M|            {                                                                  \
  |  |  |  |  176|  2.53M|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  177|  2.53M|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:21): [True: 3.28k, False: 2.53M]
  |  |  |  |  ------------------
  |  |  |  |  178|  2.53M|                {                                                              \
  |  |  |  |  179|  3.28k|                    if (EndOfData())                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  3.28k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 25, False: 3.26k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  180|  3.28k|                    {                                                          \
  |  |  |  |  181|     25|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  182|     25|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  183|     25|                    }                                                          \
  |  |  |  |  184|  3.28k|                    else                                                       \
  |  |  |  |  185|  3.28k|                    {                                                          \
  |  |  |  |  186|  3.26k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  187|  3.26k|                        BitsAvail += 8;                                        \
  |  |  |  |  188|  3.26k|                    }                                                          \
  |  |  |  |  189|  3.28k|                }                                                              \
  |  |  |  |  190|  2.53M|            }                                                                  \
  |  |  |  |  191|  2.53M|        }                                                                      \
  |  |  |  |  192|  20.2M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (192:14): [Folded, False: 20.2M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  302|  20.2M|                    if (GetBits(11) == 0)                                      \
  |  |  ------------------
  |  |  |  |  194|  20.2M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (302:25): [True: 17.3k, False: 20.1M]
  |  |  ------------------
  |  |  303|  20.2M|                        break; /* EOL found */                                 \
  |  |  304|  20.2M|                    ClrBits(1);                                                \
  |  |  ------------------
  |  |  |  |  196|  20.1M|    do                                                                         \
  |  |  |  |  197|  20.1M|    {                                                                          \
  |  |  |  |  198|  20.1M|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  20.1M|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  20.1M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 20.1M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|  20.1M|                }                                                              \
  |  |  306|  17.5k|            }                                                                  \
  |  |  307|  22.4k|            /* Now move after EOL or detect missing EOL. */                    \
  |  |  308|  22.4k|            for (;;)                                                           \
  |  |  309|  56.9k|            {                                                                  \
  |  |  310|  56.9k|                NeedBits8(8, noEOLFound);                                      \
  |  |  ------------------
  |  |  |  |  144|  56.9k|    do                                                                         \
  |  |  |  |  145|  56.9k|    {                                                                          \
  |  |  |  |  146|  56.9k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 29.1k, False: 27.7k]
  |  |  |  |  ------------------
  |  |  |  |  147|  56.9k|        {                                                                      \
  |  |  |  |  148|  29.1k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  29.1k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 357, False: 28.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|  29.1k|            {                                                                  \
  |  |  |  |  150|    357|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 114, False: 243]
  |  |  |  |  ------------------
  |  |  |  |  151|    357|                    goto eoflab;                                               \
  |  |  |  |  152|    357|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|    243|            }                                                                  \
  |  |  |  |  154|  29.1k|            else                                                               \
  |  |  |  |  155|  29.1k|            {                                                                  \
  |  |  |  |  156|  28.8k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|  28.8k|                BitsAvail += 8;                                                \
  |  |  |  |  158|  28.8k|            }                                                                  \
  |  |  |  |  159|  29.1k|        }                                                                      \
  |  |  |  |  160|  56.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 56.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  311|  56.9k|                if (GetBits(8))                                                \
  |  |  ------------------
  |  |  |  |  194|  56.8k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 22.1k, False: 34.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  312|  56.8k|                    break;                                                     \
  |  |  313|  56.8k|                ClrBits(8);                                                    \
  |  |  ------------------
  |  |  |  |  196|  34.6k|    do                                                                         \
  |  |  |  |  197|  34.6k|    {                                                                          \
  |  |  |  |  198|  34.6k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  34.6k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  34.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 34.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  314|  34.6k|            }                                                                  \
  |  |  315|   102k|            while (GetBits(1) == 0)                                            \
  |  |  ------------------
  |  |  |  |  194|   102k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (315:20): [True: 80.3k, False: 22.1k]
  |  |  ------------------
  |  |  316|  80.3k|                ClrBits(1);                                                    \
  |  |  ------------------
  |  |  |  |  196|   102k|    do                                                                         \
  |  |  |  |  197|   102k|    {                                                                          \
  |  |  |  |  198|  80.3k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  80.3k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  80.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 80.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  317|  22.1k|            ClrBits(1); /* EOL bit */                                          \
  |  |  ------------------
  |  |  |  |  196|  22.1k|    do                                                                         \
  |  |  |  |  197|  22.1k|    {                                                                          \
  |  |  |  |  198|  22.1k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  22.1k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  22.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 22.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  318|  22.1k|            EOLcnt = 0; /* reset EOL counter/flag */                           \
  |  |  319|  22.1k|            break;      /* existing EOL skipped, leave macro */                \
  |  |  320|  22.2k|        noEOLFound:                                                            \
  |  |  321|    114|            sp->b.mode |= FAXMODE_NOEOL;                                       \
  |  |  ------------------
  |  |  |  |  700|    114|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  322|    114|            tryG3WithoutEOL(a0);                                               \
  |  |  ------------------
  |  |  |  |  289|    114|    do                                                                         \
  |  |  |  |  290|    114|    {                                                                          \
  |  |  |  |  291|    114|        Fax3TryG3WithoutEOL(module, tif, (uint32_t)sp->line, (uint32_t)(a0));  \
  |  |  |  |  292|    114|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (292:14): [Folded, False: 114]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  323|    114|            goto retrywithouteol;                                              \
  |  |  324|  22.2k|        }                                                                      \
  |  |  325|   779k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (325:14): [Folded, False: 756k]
  |  |  ------------------
  ------------------
  408|   778k|        NeedBits8(1, EOF2D);
  ------------------
  |  |  144|   778k|    do                                                                         \
  |  |  145|   778k|    {                                                                          \
  |  |  146|   778k|        if (BitsAvail < (n))                                                   \
  |  |  ------------------
  |  |  |  Branch (146:13): [True: 49.5k, False: 729k]
  |  |  ------------------
  |  |  147|   778k|        {                                                                      \
  |  |  148|  49.5k|            if (EndOfData())                                                   \
  |  |  ------------------
  |  |  |  |  117|  49.5k|#define EndOfData() (cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (117:21): [True: 575, False: 48.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  149|  49.5k|            {                                                                  \
  |  |  150|    575|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  ------------------
  |  |  |  Branch (150:21): [True: 575, False: 0]
  |  |  ------------------
  |  |  151|    575|                    goto eoflab;                                               \
  |  |  152|    575|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  153|      0|            }                                                                  \
  |  |  154|  49.5k|            else                                                               \
  |  |  155|  49.5k|            {                                                                  \
  |  |  156|  48.9k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  157|  48.9k|                BitsAvail += 8;                                                \
  |  |  158|  48.9k|            }                                                                  \
  |  |  159|  49.5k|        }                                                                      \
  |  |  160|   778k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (160:14): [Folded, False: 778k]
  |  |  ------------------
  ------------------
  409|   778k|        is1D = GetBits(1); /* 1D/2D-encoding tag bit */
  ------------------
  |  |  194|   778k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  ------------------
  410|   778k|        ClrBits(1);
  ------------------
  |  |  196|   778k|    do                                                                         \
  |  |  197|   778k|    {                                                                          \
  |  |  198|   778k|        BitsAvail -= (n);                                                      \
  |  |  199|   778k|        BitAcc >>= (n);                                                        \
  |  |  200|   778k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (200:14): [Folded, False: 778k]
  |  |  ------------------
  ------------------
  411|       |#ifdef FAX3_DEBUG
  412|       |        printf(" %s\n-------------------- %" PRIu32 "\n", is1D ? "1D" : "2D",
  413|       |               tif->tif_dir.td_row);
  414|       |        fflush(stdout);
  415|       |#endif
  416|   778k|        pb = sp->refruns;
  417|   778k|        b1 = (int)*pb++;
  418|   778k|        if (is1D)
  ------------------
  |  Branch (418:13): [True: 276k, False: 501k]
  ------------------
  419|   276k|            EXPAND1D(EOF2Da);
  ------------------
  |  |  371|   276k|    do                                                                         \
  |  |  372|   276k|    {                                                                          \
  |  |  373|   276k|        for (;;)                                                               \
  |  |  374|   466k|        {                                                                      \
  |  |  375|   466k|            for (;;)                                                           \
  |  |  376|  2.50M|            {                                                                  \
  |  |  377|  2.50M|                LOOKUP16(12, TIFFFaxWhiteTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|  2.50M|    do                                                                         \
  |  |  |  |  255|  2.50M|    {                                                                          \
  |  |  |  |  256|  2.50M|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  2.50M|    do                                                                         \
  |  |  |  |  |  |  165|  2.50M|    {                                                                          \
  |  |  |  |  |  |  166|  2.50M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 2.29M, False: 216k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  2.50M|        {                                                                      \
  |  |  |  |  |  |  168|  2.29M|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  2.29M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 5.24k, False: 2.28M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  2.29M|            {                                                                  \
  |  |  |  |  |  |  170|  5.24k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 203, False: 5.04k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  5.24k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  5.24k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  5.04k|            }                                                                  \
  |  |  |  |  |  |  174|  2.29M|            else                                                               \
  |  |  |  |  |  |  175|  2.29M|            {                                                                  \
  |  |  |  |  |  |  176|  2.28M|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  2.28M|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 120k, False: 2.16M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  2.28M|                {                                                              \
  |  |  |  |  |  |  179|   120k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   120k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 112, False: 120k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|   120k|                    {                                                          \
  |  |  |  |  |  |  181|    112|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    112|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    112|                    }                                                          \
  |  |  |  |  |  |  184|   120k|                    else                                                       \
  |  |  |  |  |  |  185|   120k|                    {                                                          \
  |  |  |  |  |  |  186|   120k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|   120k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|   120k|                    }                                                          \
  |  |  |  |  |  |  189|   120k|                }                                                              \
  |  |  |  |  |  |  190|  2.28M|            }                                                                  \
  |  |  |  |  |  |  191|  2.29M|        }                                                                      \
  |  |  |  |  |  |  192|  2.50M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 2.50M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  2.50M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  2.50M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  2.50M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  2.50M|    do                                                                         \
  |  |  |  |  |  |  197|  2.50M|    {                                                                          \
  |  |  |  |  |  |  198|  2.50M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  2.50M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  2.50M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 2.50M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  2.50M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 2.50M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  378|  2.50M|                switch (TabEnt->State)                                         \
  |  |  379|  2.50M|                {                                                              \
  |  |  380|  16.3k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  16.3k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 16.3k, False: 2.49M]
  |  |  ------------------
  |  |  381|  16.3k|                        EOLcnt = 1;                                            \
  |  |  382|  16.3k|                        goto done1d;                                           \
  |  |  383|   444k|                    case S_TermW:                                              \
  |  |  ------------------
  |  |  |  |   77|   444k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (383:21): [True: 444k, False: 2.06M]
  |  |  ------------------
  |  |  384|   444k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   444k|    do                                                                         \
  |  |  |  |  267|   444k|    {                                                                          \
  |  |  |  |  268|   444k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 444k]
  |  |  |  |  ------------------
  |  |  |  |  269|   444k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   444k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   444k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   444k|        RunLength = 0;                                                         \
  |  |  |  |  279|   444k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 444k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  385|   444k|                        goto doneWhite1d;                                      \
  |  |  386|  1.85M|                    case S_MakeUpW:                                            \
  |  |  ------------------
  |  |  |  |   79|  1.85M|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (386:21): [True: 1.85M, False: 656k]
  |  |  ------------------
  |  |  387|  2.04M|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  2.04M|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 190k, False: 2.31M]
  |  |  ------------------
  |  |  388|  2.04M|                        a0 = (int)((uint32_t)a0 + TabEnt->Param);              \
  |  |  389|  2.04M|                        RunLength =                                            \
  |  |  390|  2.04M|                            (int)((uint32_t)RunLength + TabEnt->Param);        \
  |  |  391|  2.04M|                        break;                                                 \
  |  |  392|  1.85M|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (392:21): [True: 5.15k, False: 2.50M]
  |  |  ------------------
  |  |  393|  5.15k|                        unexpected("WhiteTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|  5.15k|    do                                                                         \
  |  |  |  |  221|  5.15k|    {                                                                          \
  |  |  |  |  222|  5.15k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  5.15k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  5.15k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 5.15k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|  5.15k|                        goto done1d;                                           \
  |  |  395|  2.50M|                }                                                              \
  |  |  396|  2.50M|            }                                                                  \
  |  |  397|   466k|        doneWhite1d:                                                           \
  |  |  398|   444k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (398:17): [True: 195k, False: 248k]
  |  |  ------------------
  |  |  399|   444k|                goto done1d;                                                   \
  |  |  400|   444k|            for (;;)                                                           \
  |  |  401|   250k|            {                                                                  \
  |  |  402|   250k|                LOOKUP16(13, TIFFFaxBlackTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|   250k|    do                                                                         \
  |  |  |  |  255|   250k|    {                                                                          \
  |  |  |  |  256|   250k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   250k|    do                                                                         \
  |  |  |  |  |  |  165|   250k|    {                                                                          \
  |  |  |  |  |  |  166|   250k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 170k, False: 79.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   250k|        {                                                                      \
  |  |  |  |  |  |  168|   170k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   170k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 2.40k, False: 168k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   170k|            {                                                                  \
  |  |  |  |  |  |  170|  2.40k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 131, False: 2.27k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  2.40k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  2.40k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  2.27k|            }                                                                  \
  |  |  |  |  |  |  174|   170k|            else                                                               \
  |  |  |  |  |  |  175|   170k|            {                                                                  \
  |  |  |  |  |  |  176|   168k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   168k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 2.71k, False: 165k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   168k|                {                                                              \
  |  |  |  |  |  |  179|  2.71k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  2.71k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 47, False: 2.66k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  2.71k|                    {                                                          \
  |  |  |  |  |  |  181|     47|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|     47|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|     47|                    }                                                          \
  |  |  |  |  |  |  184|  2.71k|                    else                                                       \
  |  |  |  |  |  |  185|  2.71k|                    {                                                          \
  |  |  |  |  |  |  186|  2.66k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  2.66k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  2.66k|                    }                                                          \
  |  |  |  |  |  |  189|  2.71k|                }                                                              \
  |  |  |  |  |  |  190|   168k|            }                                                                  \
  |  |  |  |  |  |  191|   170k|        }                                                                      \
  |  |  |  |  |  |  192|   250k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 250k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   250k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   250k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   250k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   250k|    do                                                                         \
  |  |  |  |  |  |  197|   250k|    {                                                                          \
  |  |  |  |  |  |  198|   250k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   250k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   250k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 250k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   250k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 250k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|   250k|                switch (TabEnt->State)                                         \
  |  |  404|   250k|                {                                                              \
  |  |  405|  8.36k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  8.36k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (405:21): [True: 8.36k, False: 241k]
  |  |  ------------------
  |  |  406|  8.36k|                        EOLcnt = 1;                                            \
  |  |  407|  8.36k|                        goto done1d;                                           \
  |  |  408|   236k|                    case S_TermB:                                              \
  |  |  ------------------
  |  |  |  |   78|   236k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (408:21): [True: 236k, False: 14.0k]
  |  |  ------------------
  |  |  409|   236k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   236k|    do                                                                         \
  |  |  |  |  267|   236k|    {                                                                          \
  |  |  |  |  268|   236k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 236k]
  |  |  |  |  ------------------
  |  |  |  |  269|   236k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   236k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   236k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   236k|        RunLength = 0;                                                         \
  |  |  |  |  279|   236k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 236k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|   236k|                        goto doneBlack1d;                                      \
  |  |  411|   236k|                    case S_MakeUpB:                                            \
  |  |  ------------------
  |  |  |  |   80|    456|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (411:21): [True: 456, False: 249k]
  |  |  ------------------
  |  |  412|  1.36k|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  1.36k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (412:21): [True: 906, False: 249k]
  |  |  ------------------
  |  |  413|  1.36k|                        a0 += (int)TabEnt->Param;                              \
  |  |  414|  1.36k|                        RunLength += (int)TabEnt->Param;                       \
  |  |  415|  1.36k|                        break;                                                 \
  |  |  416|  4.32k|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (416:21): [True: 4.32k, False: 245k]
  |  |  ------------------
  |  |  417|  4.32k|                        unexpected("BlackTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|  4.32k|    do                                                                         \
  |  |  |  |  221|  4.32k|    {                                                                          \
  |  |  |  |  222|  4.32k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  4.32k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  4.32k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 4.32k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  418|  4.32k|                        goto done1d;                                           \
  |  |  419|   250k|                }                                                              \
  |  |  420|   250k|            }                                                                  \
  |  |  421|   248k|        doneBlack1d:                                                           \
  |  |  422|   236k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (422:17): [True: 46.4k, False: 189k]
  |  |  ------------------
  |  |  423|   236k|                goto done1d;                                                   \
  |  |  424|   236k|            if (*(pa - 1) == 0 && *(pa - 2) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (424:17): [True: 181, False: 189k]
  |  |  |  Branch (424:35): [True: 181, False: 0]
  |  |  ------------------
  |  |  425|   189k|                pa -= 2;                                                       \
  |  |  426|   189k|        }                                                                      \
  |  |  427|   276k|    eof1d:                                                                     \
  |  |  428|    334|        prematureEOF(a0);                                                      \
  |  |  ------------------
  |  |  |  |  271|    334|    do                                                                         \
  |  |  |  |  272|    334|    {                                                                          \
  |  |  |  |  273|    334|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|    334|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|    334|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 334]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  429|    334|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|    334|    do                                                                         \
  |  |  |  |  334|    334|    {                                                                          \
  |  |  |  |  335|    334|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 326, False: 8]
  |  |  |  |  ------------------
  |  |  |  |  336|    334|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    326|    do                                                                         \
  |  |  |  |  |  |  267|    326|    {                                                                          \
  |  |  |  |  |  |  268|    326|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 326]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    326|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    326|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    326|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    326|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    326|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 326]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|    334|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 334, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  338|    334|        {                                                                      \
  |  |  |  |  339|    334|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|    334|    do                                                                         \
  |  |  |  |  |  |  254|    334|    {                                                                          \
  |  |  |  |  |  |  255|    334|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|    334|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|    334|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|    334|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 334]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|    660|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 326, False: 334]
  |  |  |  |  |  Branch (340:39): [True: 326, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|    334|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|    334|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 334, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|    334|            {                                                                  \
  |  |  |  |  344|    334|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 334]
  |  |  |  |  ------------------
  |  |  |  |  345|    334|                    a0 = 0;                                                    \
  |  |  |  |  346|    334|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 131, False: 203]
  |  |  |  |  ------------------
  |  |  |  |  347|    334|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    131|    do                                                                         \
  |  |  |  |  |  |  267|    131|    {                                                                          \
  |  |  |  |  |  |  268|    131|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 131]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    131|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    131|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    131|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    131|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    131|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 131]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|    334|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    334|    do                                                                         \
  |  |  |  |  |  |  267|    334|    {                                                                          \
  |  |  |  |  |  |  268|    334|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 334]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    334|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    334|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    334|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    334|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    334|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 334]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|    334|            }                                                                  \
  |  |  |  |  350|    334|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  351|      0|            {                                                                  \
  |  |  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  354|      0|            }                                                                  \
  |  |  |  |  355|    334|        }                                                                      \
  |  |  |  |  356|    334|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 334]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  430|    334|        goto eoflab;                                                           \
  |  |  431|   276k|    done1d:                                                                    \
  |  |  432|   276k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   276k|    do                                                                         \
  |  |  |  |  334|   276k|    {                                                                          \
  |  |  |  |  335|   276k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 4.07k, False: 272k]
  |  |  |  |  ------------------
  |  |  |  |  336|   276k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  4.07k|    do                                                                         \
  |  |  |  |  |  |  267|  4.07k|    {                                                                          \
  |  |  |  |  |  |  268|  4.07k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 4.07k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  4.07k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  4.07k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  4.07k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  4.07k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  4.07k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 4.07k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   276k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 253k, False: 22.5k]
  |  |  |  |  ------------------
  |  |  |  |  338|   276k|        {                                                                      \
  |  |  |  |  339|   253k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   253k|    do                                                                         \
  |  |  |  |  |  |  254|   253k|    {                                                                          \
  |  |  |  |  |  |  255|   253k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   253k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   253k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   253k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 253k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   477k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 223k, False: 253k]
  |  |  |  |  |  Branch (340:39): [True: 223k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   253k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   253k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 253k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|   253k|            {                                                                  \
  |  |  |  |  344|   253k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 253k]
  |  |  |  |  ------------------
  |  |  |  |  345|   253k|                    a0 = 0;                                                    \
  |  |  |  |  346|   253k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 46.4k, False: 207k]
  |  |  |  |  ------------------
  |  |  |  |  347|   253k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  46.4k|    do                                                                         \
  |  |  |  |  |  |  267|  46.4k|    {                                                                          \
  |  |  |  |  |  |  268|  46.4k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 46.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  46.4k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  46.4k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  46.4k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  46.4k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  46.4k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 46.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   253k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   253k|    do                                                                         \
  |  |  |  |  |  |  267|   253k|    {                                                                          \
  |  |  |  |  |  |  268|   253k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 253k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   253k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|   253k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   253k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   253k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   253k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 253k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   253k|            }                                                                  \
  |  |  |  |  350|   253k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  351|      0|            {                                                                  \
  |  |  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  354|      0|            }                                                                  \
  |  |  |  |  355|   253k|        }                                                                      \
  |  |  |  |  356|   276k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 276k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  433|   276k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (433:14): [Folded, False: 276k]
  |  |  ------------------
  ------------------
  420|   501k|        else
  421|   501k|            EXPAND2D(EOF2Da);
  ------------------
  |  |  463|   501k|    do                                                                         \
  |  |  464|   501k|    {                                                                          \
  |  |  465|  1.52M|        while (a0 < (int)lastx)                                                \
  |  |  ------------------
  |  |  |  Branch (465:16): [True: 1.27M, False: 258k]
  |  |  ------------------
  |  |  466|  1.27M|        {                                                                      \
  |  |  467|  1.27M|            if (pa >= thisrun + sp->nruns)                                     \
  |  |  ------------------
  |  |  |  Branch (467:17): [True: 356, False: 1.27M]
  |  |  ------------------
  |  |  468|  1.27M|            {                                                                  \
  |  |  469|    356|                TIFFErrorExtR(tif, module,                                     \
  |  |  470|    356|                              "Buffer overflow at line %d of %s %u", sp->line, \
  |  |  471|    356|                              isTiled(tif) ? "tile" : "strip",                 \
  |  |  ------------------
  |  |  |  |  278|    356|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    356|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 161, False: 195]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  472|    356|                              isTiled(tif) ? tif->tif_dir.td_curtile           \
  |  |  ------------------
  |  |  |  |  278|    356|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    356|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 161, False: 195]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  473|    356|                                           : tif->tif_dir.td_curstrip);        \
  |  |  474|    356|                return (-1);                                                   \
  |  |  475|    356|            }                                                                  \
  |  |  476|  1.27M|            LOOKUP8(7, TIFFFaxMainTable, eof2d);                               \
  |  |  ------------------
  |  |  |  |  247|  1.27M|    do                                                                         \
  |  |  |  |  248|  1.27M|    {                                                                          \
  |  |  |  |  249|  1.27M|        NeedBits8(wid, eoflab);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|  1.27M|    do                                                                         \
  |  |  |  |  |  |  145|  1.27M|    {                                                                          \
  |  |  |  |  |  |  146|  1.27M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:13): [True: 537k, False: 733k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  1.27M|        {                                                                      \
  |  |  |  |  |  |  148|   537k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   537k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 12.6k, False: 524k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  149|   537k|            {                                                                  \
  |  |  |  |  |  |  150|  12.6k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:21): [True: 2.26k, False: 10.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  12.6k|                    goto eoflab;                                               \
  |  |  |  |  |  |  152|  12.6k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  153|  10.3k|            }                                                                  \
  |  |  |  |  |  |  154|   537k|            else                                                               \
  |  |  |  |  |  |  155|   537k|            {                                                                  \
  |  |  |  |  |  |  156|   524k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  157|   524k|                BitsAvail += 8;                                                \
  |  |  |  |  |  |  158|   524k|            }                                                                  \
  |  |  |  |  |  |  159|   537k|        }                                                                      \
  |  |  |  |  |  |  160|  1.27M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (160:14): [Folded, False: 1.26M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  250|  1.27M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  1.26M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  251|  1.26M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  1.26M|    do                                                                         \
  |  |  |  |  |  |  197|  1.26M|    {                                                                          \
  |  |  |  |  |  |  198|  1.26M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  1.26M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  1.26M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 1.26M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  252|  1.26M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (252:14): [Folded, False: 1.26M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  477|  1.27M|            switch (TabEnt->State)                                             \
  |  |  478|  1.26M|            {                                                                  \
  |  |  479|  46.2k|                case S_Pass:                                                   \
  |  |  ------------------
  |  |  |  |   71|  46.2k|#define S_Pass 1
  |  |  ------------------
  |  |  |  Branch (479:17): [True: 46.2k, False: 1.22M]
  |  |  ------------------
  |  |  480|  46.2k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|  46.2k|    do                                                                         \
  |  |  |  |  441|  46.2k|    {                                                                          \
  |  |  |  |  442|  46.2k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 9.67k, False: 36.5k]
  |  |  |  |  ------------------
  |  |  |  |  443|  46.2k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 32.2k, False: 9.28k]
  |  |  |  |  |  Branch (443:32): [True: 32.2k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|  32.2k|            {                                                                  \
  |  |  |  |  445|  32.2k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 387, False: 31.8k]
  |  |  |  |  ------------------
  |  |  |  |  446|  32.2k|                {                                                              \
  |  |  |  |  447|    387|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    387|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    387|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    387|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    387|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 130, False: 257]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    387|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    387|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    387|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 130, False: 257]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    387|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    387|                    return (-1);                                               \
  |  |  |  |  453|    387|                }                                                              \
  |  |  |  |  454|  32.2k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  31.8k|                pb += 2;                                                       \
  |  |  |  |  456|  31.8k|            }                                                                  \
  |  |  |  |  457|  46.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 45.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  481|  46.2k|                    if (pb + 1 >= sp->refruns + sp->nruns)                     \
  |  |  ------------------
  |  |  |  Branch (481:25): [True: 467, False: 45.3k]
  |  |  ------------------
  |  |  482|  45.8k|                    {                                                          \
  |  |  483|    467|                        TIFFErrorExtR(                                         \
  |  |  484|    467|                            tif, module,                                       \
  |  |  485|    467|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  486|    467|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    467|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    467|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 230, False: 237]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  487|    467|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    467|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    467|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 230, False: 237]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|    467|                                         : tif->tif_dir.td_curstrip);          \
  |  |  489|    467|                        return (-1);                                           \
  |  |  490|    467|                    }                                                          \
  |  |  491|  45.8k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  492|  45.3k|                    RunLength =                                                \
  |  |  493|  45.3k|                        (int)((uint32_t)RunLength + (uint32_t)(b1 - a0));      \
  |  |  494|  45.3k|                    a0 = b1;                                                   \
  |  |  495|  45.3k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  496|  45.3k|                    break;                                                     \
  |  |  497|  70.8k|                case S_Horiz:                                                  \
  |  |  ------------------
  |  |  |  |   72|  70.8k|#define S_Horiz 2
  |  |  ------------------
  |  |  |  Branch (497:17): [True: 70.8k, False: 1.19M]
  |  |  ------------------
  |  |  498|  70.8k|                    if ((pa - thisrun) & 1)                                    \
  |  |  ------------------
  |  |  |  Branch (498:25): [True: 28.5k, False: 42.3k]
  |  |  ------------------
  |  |  499|  70.8k|                    {                                                          \
  |  |  500|  28.5k|                        for (;;)                                               \
  |  |  501|  30.5k|                        { /* black first */                                    \
  |  |  502|  30.5k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  30.5k|    do                                                                         \
  |  |  |  |  255|  30.5k|    {                                                                          \
  |  |  |  |  256|  30.5k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  30.5k|    do                                                                         \
  |  |  |  |  |  |  165|  30.5k|    {                                                                          \
  |  |  |  |  |  |  166|  30.5k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 30.3k, False: 170]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  30.5k|        {                                                                      \
  |  |  |  |  |  |  168|  30.3k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  30.3k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 253, False: 30.1k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  30.3k|            {                                                                  \
  |  |  |  |  |  |  170|    253|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 131, False: 122]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    253|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    253|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    122|            }                                                                  \
  |  |  |  |  |  |  174|  30.3k|            else                                                               \
  |  |  |  |  |  |  175|  30.3k|            {                                                                  \
  |  |  |  |  |  |  176|  30.1k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  30.1k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 2.88k, False: 27.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  30.1k|                {                                                              \
  |  |  |  |  |  |  179|  2.88k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  2.88k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 133, False: 2.74k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  2.88k|                    {                                                          \
  |  |  |  |  |  |  181|    133|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    133|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    133|                    }                                                          \
  |  |  |  |  |  |  184|  2.88k|                    else                                                       \
  |  |  |  |  |  |  185|  2.88k|                    {                                                          \
  |  |  |  |  |  |  186|  2.74k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  2.74k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  2.74k|                    }                                                          \
  |  |  |  |  |  |  189|  2.88k|                }                                                              \
  |  |  |  |  |  |  190|  30.1k|            }                                                                  \
  |  |  |  |  |  |  191|  30.3k|        }                                                                      \
  |  |  |  |  |  |  192|  30.5k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 30.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  30.5k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  30.3k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  30.3k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  30.3k|    do                                                                         \
  |  |  |  |  |  |  197|  30.3k|    {                                                                          \
  |  |  |  |  |  |  198|  30.3k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  30.3k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  30.3k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 30.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  30.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 30.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  503|  30.5k|                            switch (TabEnt->State)                             \
  |  |  504|  30.3k|                            {                                                  \
  |  |  505|  26.4k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|  26.4k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (505:33): [True: 26.4k, False: 3.98k]
  |  |  ------------------
  |  |  506|  26.4k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  26.4k|    do                                                                         \
  |  |  |  |  267|  26.4k|    {                                                                          \
  |  |  |  |  268|  26.4k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 26.4k]
  |  |  |  |  ------------------
  |  |  |  |  269|  26.4k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  26.4k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  26.4k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  26.4k|        RunLength = 0;                                                         \
  |  |  |  |  279|  26.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 26.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  507|  26.4k|                                    goto doneWhite2da;                         \
  |  |  508|  26.4k|                                case S_MakeUpB:                                \
  |  |  ------------------
  |  |  |  |   80|    959|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (508:33): [True: 959, False: 29.4k]
  |  |  ------------------
  |  |  509|  1.97k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  1.97k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (509:33): [True: 1.01k, False: 29.3k]
  |  |  ------------------
  |  |  510|  1.97k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  511|  1.97k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  512|  1.97k|                                                      TabEnt->Param);          \
  |  |  513|  1.97k|                                    break;                                     \
  |  |  514|  2.00k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (514:33): [True: 2.00k, False: 28.3k]
  |  |  ------------------
  |  |  515|  2.00k|                                    goto badBlack2d;                           \
  |  |  516|  30.3k|                            }                                                  \
  |  |  517|  30.3k|                        }                                                      \
  |  |  518|  28.5k|                    doneWhite2da:;                                             \
  |  |  519|  26.4k|                        for (;;)                                               \
  |  |  520|   457k|                        { /* then white */                                     \
  |  |  521|   457k|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|   457k|    do                                                                         \
  |  |  |  |  255|   457k|    {                                                                          \
  |  |  |  |  256|   457k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   457k|    do                                                                         \
  |  |  |  |  |  |  165|   457k|    {                                                                          \
  |  |  |  |  |  |  166|   457k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 434k, False: 22.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   457k|        {                                                                      \
  |  |  |  |  |  |  168|   434k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   434k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 1.20k, False: 433k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   434k|            {                                                                  \
  |  |  |  |  |  |  170|  1.20k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 626, False: 574]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  1.20k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  1.20k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    574|            }                                                                  \
  |  |  |  |  |  |  174|   434k|            else                                                               \
  |  |  |  |  |  |  175|   434k|            {                                                                  \
  |  |  |  |  |  |  176|   433k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   433k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 24.8k, False: 408k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   433k|                {                                                              \
  |  |  |  |  |  |  179|  24.8k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  24.8k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 325, False: 24.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  24.8k|                    {                                                          \
  |  |  |  |  |  |  181|    325|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    325|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    325|                    }                                                          \
  |  |  |  |  |  |  184|  24.8k|                    else                                                       \
  |  |  |  |  |  |  185|  24.8k|                    {                                                          \
  |  |  |  |  |  |  186|  24.5k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  24.5k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  24.5k|                    }                                                          \
  |  |  |  |  |  |  189|  24.8k|                }                                                              \
  |  |  |  |  |  |  190|   433k|            }                                                                  \
  |  |  |  |  |  |  191|   434k|        }                                                                      \
  |  |  |  |  |  |  192|   457k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 456k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   457k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   456k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   456k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   456k|    do                                                                         \
  |  |  |  |  |  |  197|   456k|    {                                                                          \
  |  |  |  |  |  |  198|   456k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   456k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   456k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 456k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   456k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 456k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  522|   457k|                            switch (TabEnt->State)                             \
  |  |  523|   456k|                            {                                                  \
  |  |  524|  24.6k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|  24.6k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (524:33): [True: 24.6k, False: 432k]
  |  |  ------------------
  |  |  525|  24.6k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  24.6k|    do                                                                         \
  |  |  |  |  267|  24.6k|    {                                                                          \
  |  |  |  |  268|  24.6k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 358, False: 24.2k]
  |  |  |  |  ------------------
  |  |  |  |  269|  24.6k|        {                                                                      \
  |  |  |  |  270|    358|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|    358|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    358|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    358|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 137, False: 221]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|    358|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    358|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    358|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 137, False: 221]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|    358|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|    358|            return (-1);                                                       \
  |  |  |  |  275|    358|        }                                                                      \
  |  |  |  |  276|  24.6k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  24.2k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  24.2k|        RunLength = 0;                                                         \
  |  |  |  |  279|  24.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 24.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  526|  24.6k|                                    goto doneBlack2da;                         \
  |  |  527|   383k|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|   383k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (527:33): [True: 383k, False: 73.6k]
  |  |  ------------------
  |  |  528|   430k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|   430k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (528:33): [True: 47.8k, False: 408k]
  |  |  ------------------
  |  |  529|   430k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  530|   430k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  531|   430k|                                                      TabEnt->Param);          \
  |  |  532|   430k|                                    break;                                     \
  |  |  533|   383k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (533:33): [True: 1.17k, False: 455k]
  |  |  ------------------
  |  |  534|  1.17k|                                    goto badWhite2d;                           \
  |  |  535|   456k|                            }                                                  \
  |  |  536|   456k|                        }                                                      \
  |  |  537|  26.4k|                    doneBlack2da:;                                             \
  |  |  538|  24.2k|                    }                                                          \
  |  |  539|  70.8k|                    else                                                       \
  |  |  540|  70.8k|                    {                                                          \
  |  |  541|  42.3k|                        for (;;)                                               \
  |  |  542|   195k|                        { /* white first */                                    \
  |  |  543|   195k|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|   195k|    do                                                                         \
  |  |  |  |  255|   195k|    {                                                                          \
  |  |  |  |  256|   195k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   195k|    do                                                                         \
  |  |  |  |  |  |  165|   195k|    {                                                                          \
  |  |  |  |  |  |  166|   195k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 192k, False: 3.67k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   195k|        {                                                                      \
  |  |  |  |  |  |  168|   192k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   192k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 467, False: 191k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   192k|            {                                                                  \
  |  |  |  |  |  |  170|    467|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 15, False: 452]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    467|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    467|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    452|            }                                                                  \
  |  |  |  |  |  |  174|   192k|            else                                                               \
  |  |  |  |  |  |  175|   192k|            {                                                                  \
  |  |  |  |  |  |  176|   191k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   191k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 9.37k, False: 182k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   191k|                {                                                              \
  |  |  |  |  |  |  179|  9.37k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  9.37k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 18, False: 9.35k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  9.37k|                    {                                                          \
  |  |  |  |  |  |  181|     18|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|     18|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|     18|                    }                                                          \
  |  |  |  |  |  |  184|  9.37k|                    else                                                       \
  |  |  |  |  |  |  185|  9.37k|                    {                                                          \
  |  |  |  |  |  |  186|  9.35k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  9.35k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  9.35k|                    }                                                          \
  |  |  |  |  |  |  189|  9.37k|                }                                                              \
  |  |  |  |  |  |  190|   191k|            }                                                                  \
  |  |  |  |  |  |  191|   192k|        }                                                                      \
  |  |  |  |  |  |  192|   195k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 195k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   195k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   195k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   195k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   195k|    do                                                                         \
  |  |  |  |  |  |  197|   195k|    {                                                                          \
  |  |  |  |  |  |  198|   195k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   195k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   195k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 195k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   195k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 195k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  544|   195k|                            switch (TabEnt->State)                             \
  |  |  545|   195k|                            {                                                  \
  |  |  546|  33.1k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|  33.1k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (546:33): [True: 33.1k, False: 162k]
  |  |  ------------------
  |  |  547|  33.1k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  33.1k|    do                                                                         \
  |  |  |  |  267|  33.1k|    {                                                                          \
  |  |  |  |  268|  33.1k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 33.1k]
  |  |  |  |  ------------------
  |  |  |  |  269|  33.1k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  33.1k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  33.1k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  33.1k|        RunLength = 0;                                                         \
  |  |  |  |  279|  33.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 33.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  548|  33.1k|                                    goto doneWhite2db;                         \
  |  |  549|   135k|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|   135k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (549:33): [True: 135k, False: 60.6k]
  |  |  ------------------
  |  |  550|   153k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|   153k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (550:33): [True: 18.2k, False: 177k]
  |  |  ------------------
  |  |  551|   153k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  552|   153k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  553|   153k|                                                      TabEnt->Param);          \
  |  |  554|   153k|                                    break;                                     \
  |  |  555|   135k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (555:33): [True: 9.15k, False: 186k]
  |  |  ------------------
  |  |  556|  9.15k|                                    goto badWhite2d;                           \
  |  |  557|   195k|                            }                                                  \
  |  |  558|   195k|                        }                                                      \
  |  |  559|  42.3k|                    doneWhite2db:;                                             \
  |  |  560|  33.1k|                        for (;;)                                               \
  |  |  561|  34.2k|                        { /* then black */                                     \
  |  |  562|  34.2k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  34.2k|    do                                                                         \
  |  |  |  |  255|  34.2k|    {                                                                          \
  |  |  |  |  256|  34.2k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  34.2k|    do                                                                         \
  |  |  |  |  |  |  165|  34.2k|    {                                                                          \
  |  |  |  |  |  |  166|  34.2k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 27.1k, False: 7.08k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  34.2k|        {                                                                      \
  |  |  |  |  |  |  168|  27.1k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  27.1k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 582, False: 26.5k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  27.1k|            {                                                                  \
  |  |  |  |  |  |  170|    582|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 258, False: 324]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    582|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    582|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    324|            }                                                                  \
  |  |  |  |  |  |  174|  27.1k|            else                                                               \
  |  |  |  |  |  |  175|  27.1k|            {                                                                  \
  |  |  |  |  |  |  176|  26.5k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  26.5k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 1.62k, False: 24.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  26.5k|                {                                                              \
  |  |  |  |  |  |  179|  1.62k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  1.62k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 281, False: 1.34k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  1.62k|                    {                                                          \
  |  |  |  |  |  |  181|    281|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    281|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    281|                    }                                                          \
  |  |  |  |  |  |  184|  1.62k|                    else                                                       \
  |  |  |  |  |  |  185|  1.62k|                    {                                                          \
  |  |  |  |  |  |  186|  1.34k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  1.34k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  1.34k|                    }                                                          \
  |  |  |  |  |  |  189|  1.62k|                }                                                              \
  |  |  |  |  |  |  190|  26.5k|            }                                                                  \
  |  |  |  |  |  |  191|  27.1k|        }                                                                      \
  |  |  |  |  |  |  192|  34.2k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 33.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  34.2k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  33.9k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  33.9k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  33.9k|    do                                                                         \
  |  |  |  |  |  |  197|  33.9k|    {                                                                          \
  |  |  |  |  |  |  198|  33.9k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  33.9k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  33.9k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 33.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  33.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 33.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  563|  34.2k|                            switch (TabEnt->State)                             \
  |  |  564|  33.9k|                            {                                                  \
  |  |  565|  29.2k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|  29.2k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (565:33): [True: 29.2k, False: 4.69k]
  |  |  ------------------
  |  |  566|  29.2k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  29.2k|    do                                                                         \
  |  |  |  |  267|  29.2k|    {                                                                          \
  |  |  |  |  268|  29.2k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 29.2k]
  |  |  |  |  ------------------
  |  |  |  |  269|  29.2k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  29.2k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  29.2k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  29.2k|        RunLength = 0;                                                         \
  |  |  |  |  279|  29.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 29.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  567|  29.2k|                                    goto doneBlack2db;                         \
  |  |  568|  29.2k|                                case S_MakeUpB:                                \
  |  |  ------------------
  |  |  |  |   80|    330|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (568:33): [True: 330, False: 33.6k]
  |  |  ------------------
  |  |  569|  1.05k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  1.05k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (569:33): [True: 721, False: 33.2k]
  |  |  ------------------
  |  |  570|  1.05k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  571|  1.05k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  572|  1.05k|                                                      TabEnt->Param);          \
  |  |  573|  1.05k|                                    break;                                     \
  |  |  574|  3.64k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (574:33): [True: 3.64k, False: 30.3k]
  |  |  ------------------
  |  |  575|  3.64k|                                    goto badBlack2d;                           \
  |  |  576|  33.9k|                            }                                                  \
  |  |  577|  33.9k|                        }                                                      \
  |  |  578|  33.1k|                    doneBlack2db:;                                             \
  |  |  579|  29.2k|                    }                                                          \
  |  |  580|  70.8k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|  53.5k|    do                                                                         \
  |  |  |  |  441|  53.5k|    {                                                                          \
  |  |  |  |  442|  53.5k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 53.5k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  443|  97.1k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 79.0k, False: 18.1k]
  |  |  |  |  |  Branch (443:32): [True: 43.9k, False: 35.1k]
  |  |  |  |  ------------------
  |  |  |  |  444|  53.5k|            {                                                                  \
  |  |  |  |  445|  43.9k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 299, False: 43.6k]
  |  |  |  |  ------------------
  |  |  |  |  446|  43.9k|                {                                                              \
  |  |  |  |  447|    299|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    299|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    299|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    299|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    299|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 157, False: 142]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    299|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    299|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    299|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 157, False: 142]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    299|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    299|                    return (-1);                                               \
  |  |  |  |  453|    299|                }                                                              \
  |  |  |  |  454|  43.9k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  43.6k|                pb += 2;                                                       \
  |  |  |  |  456|  43.6k|            }                                                                  \
  |  |  |  |  457|  53.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 53.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  581|  53.5k|                    break;                                                     \
  |  |  582|   257k|                case S_V0:                                                     \
  |  |  ------------------
  |  |  |  |   73|   257k|#define S_V0 3
  |  |  ------------------
  |  |  |  Branch (582:17): [True: 257k, False: 1.01M]
  |  |  ------------------
  |  |  583|   257k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   257k|    do                                                                         \
  |  |  |  |  441|   257k|    {                                                                          \
  |  |  |  |  442|   257k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 129k, False: 127k]
  |  |  |  |  ------------------
  |  |  |  |  443|   257k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 55.7k, False: 129k]
  |  |  |  |  |  Branch (443:32): [True: 55.7k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   129k|            {                                                                  \
  |  |  |  |  445|  55.7k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 401, False: 55.3k]
  |  |  |  |  ------------------
  |  |  |  |  446|  55.7k|                {                                                              \
  |  |  |  |  447|    401|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    401|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    401|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    401|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    401|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 130, False: 271]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    401|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    401|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    401|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 130, False: 271]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    401|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    401|                    return (-1);                                               \
  |  |  |  |  453|    401|                }                                                              \
  |  |  |  |  454|  55.7k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  55.3k|                pb += 2;                                                       \
  |  |  |  |  456|  55.3k|            }                                                                  \
  |  |  |  |  457|   257k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 257k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  584|   257k|                    SETVALUE(b1 - a0);                                         \
  |  |  ------------------
  |  |  |  |  266|   257k|    do                                                                         \
  |  |  |  |  267|   257k|    {                                                                          \
  |  |  |  |  268|   257k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 257k]
  |  |  |  |  ------------------
  |  |  |  |  269|   257k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   257k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   257k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   257k|        RunLength = 0;                                                         \
  |  |  |  |  279|   257k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 257k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  585|   257k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (585:25): [True: 340, False: 256k]
  |  |  ------------------
  |  |  586|   257k|                    {                                                          \
  |  |  587|    340|                        TIFFErrorExtR(                                         \
  |  |  588|    340|                            tif, module,                                       \
  |  |  589|    340|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  590|    340|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    340|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    340|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 160, False: 180]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  591|    340|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    340|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    340|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 160, False: 180]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  592|    340|                                         : tif->tif_dir.td_curstrip);          \
  |  |  593|    340|                        return (-1);                                           \
  |  |  594|    340|                    }                                                          \
  |  |  595|   257k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  596|   256k|                    break;                                                     \
  |  |  597|   257k|                case S_VR:                                                     \
  |  |  ------------------
  |  |  |  |   74|   118k|#define S_VR 4
  |  |  ------------------
  |  |  |  Branch (597:17): [True: 118k, False: 1.15M]
  |  |  ------------------
  |  |  598|   118k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   118k|    do                                                                         \
  |  |  |  |  441|   118k|    {                                                                          \
  |  |  |  |  442|   118k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 60.6k, False: 57.3k]
  |  |  |  |  ------------------
  |  |  |  |  443|   118k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 35.4k, False: 60.2k]
  |  |  |  |  |  Branch (443:32): [True: 35.4k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|  60.6k|            {                                                                  \
  |  |  |  |  445|  35.4k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 422, False: 35.0k]
  |  |  |  |  ------------------
  |  |  |  |  446|  35.4k|                {                                                              \
  |  |  |  |  447|    422|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    422|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    422|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    422|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    422|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 162, False: 260]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    422|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    422|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    422|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 162, False: 260]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    422|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    422|                    return (-1);                                               \
  |  |  |  |  453|    422|                }                                                              \
  |  |  |  |  454|  35.4k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  35.0k|                pb += 2;                                                       \
  |  |  |  |  456|  35.0k|            }                                                                  \
  |  |  |  |  457|   118k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 117k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  599|   118k|                    SETVALUE((int)((uint32_t)(b1 - a0) + TabEnt->Param));      \
  |  |  ------------------
  |  |  |  |  266|   117k|    do                                                                         \
  |  |  |  |  267|   117k|    {                                                                          \
  |  |  |  |  268|   117k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 117k]
  |  |  |  |  ------------------
  |  |  |  |  269|   117k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   117k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   117k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   117k|        RunLength = 0;                                                         \
  |  |  |  |  279|   117k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 117k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  600|   117k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (600:25): [True: 319, False: 117k]
  |  |  ------------------
  |  |  601|   117k|                    {                                                          \
  |  |  602|    319|                        TIFFErrorExtR(                                         \
  |  |  603|    319|                            tif, module,                                       \
  |  |  604|    319|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  605|    319|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    319|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    319|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 133, False: 186]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  606|    319|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    319|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    319|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 133, False: 186]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  607|    319|                                         : tif->tif_dir.td_curstrip);          \
  |  |  608|    319|                        return (-1);                                           \
  |  |  609|    319|                    }                                                          \
  |  |  610|   117k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  611|   117k|                    break;                                                     \
  |  |  612|   557k|                case S_VL:                                                     \
  |  |  ------------------
  |  |  |  |   75|   557k|#define S_VL 5
  |  |  ------------------
  |  |  |  Branch (612:17): [True: 557k, False: 711k]
  |  |  ------------------
  |  |  613|   557k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   557k|    do                                                                         \
  |  |  |  |  441|   557k|    {                                                                          \
  |  |  |  |  442|   557k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 478k, False: 78.9k]
  |  |  |  |  ------------------
  |  |  |  |  443|   742k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 264k, False: 477k]
  |  |  |  |  |  Branch (443:32): [True: 264k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   478k|            {                                                                  \
  |  |  |  |  445|   264k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 363, False: 264k]
  |  |  |  |  ------------------
  |  |  |  |  446|   264k|                {                                                              \
  |  |  |  |  447|    363|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|    363|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|    363|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    363|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    363|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 130, False: 233]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|    363|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    363|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    363|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 130, False: 233]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|    363|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|    363|                    return (-1);                                               \
  |  |  |  |  453|    363|                }                                                              \
  |  |  |  |  454|   264k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|   264k|                pb += 2;                                                       \
  |  |  |  |  456|   264k|            }                                                                  \
  |  |  |  |  457|   557k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 556k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  614|   557k|                    if (b1 < (int)((uint32_t)a0 + TabEnt->Param))              \
  |  |  ------------------
  |  |  |  Branch (614:25): [True: 1.37k, False: 555k]
  |  |  ------------------
  |  |  615|   556k|                    {                                                          \
  |  |  616|  1.37k|                        unexpected("VL", a0);                                  \
  |  |  ------------------
  |  |  |  |  220|  1.37k|    do                                                                         \
  |  |  |  |  221|  1.37k|    {                                                                          \
  |  |  |  |  222|  1.37k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  1.37k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  1.37k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 1.37k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  617|  1.37k|                        goto eol2d;                                            \
  |  |  618|  1.37k|                    }                                                          \
  |  |  619|   556k|                    SETVALUE((int)((uint32_t)(b1 - a0) - TabEnt->Param));      \
  |  |  ------------------
  |  |  |  |  266|   555k|    do                                                                         \
  |  |  |  |  267|   555k|    {                                                                          \
  |  |  |  |  268|   555k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 555k]
  |  |  |  |  ------------------
  |  |  |  |  269|   555k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   555k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   555k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   555k|        RunLength = 0;                                                         \
  |  |  |  |  279|   555k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 555k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  620|   555k|                    b1 = b1 - (int)*--pb;                                      \
  |  |  621|   555k|                    break;                                                     \
  |  |  622|   555k|                case S_Ext:                                                    \
  |  |  ------------------
  |  |  |  |   76|  55.7k|#define S_Ext 6
  |  |  ------------------
  |  |  |  Branch (622:17): [True: 55.7k, False: 1.21M]
  |  |  ------------------
  |  |  623|  55.7k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  624|  55.7k|                    extension(a0);                                             \
  |  |  ------------------
  |  |  |  |  238|  55.7k|    Fax3Extension(module, tif, (uint32_t)sp->line, (uint32_t)(a0))
  |  |  ------------------
  |  |  625|  55.7k|                    goto eol2d;                                                \
  |  |  626|   555k|                case S_EOL:                                                    \
  |  |  ------------------
  |  |  |  |   82|   163k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (626:17): [True: 163k, False: 1.10M]
  |  |  ------------------
  |  |  627|   163k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  628|   163k|                    NeedBits8(4, eof2d);                                       \
  |  |  ------------------
  |  |  |  |  144|   163k|    do                                                                         \
  |  |  |  |  145|   163k|    {                                                                          \
  |  |  |  |  146|   163k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 87.1k, False: 75.9k]
  |  |  |  |  ------------------
  |  |  |  |  147|   163k|        {                                                                      \
  |  |  |  |  148|  87.1k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  87.1k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 6.11k, False: 81.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|  87.1k|            {                                                                  \
  |  |  |  |  150|  6.11k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 5.80k, False: 308]
  |  |  |  |  ------------------
  |  |  |  |  151|  6.11k|                    goto eoflab;                                               \
  |  |  |  |  152|  6.11k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|    308|            }                                                                  \
  |  |  |  |  154|  87.1k|            else                                                               \
  |  |  |  |  155|  87.1k|            {                                                                  \
  |  |  |  |  156|  81.0k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|  81.0k|                BitsAvail += 8;                                                \
  |  |  |  |  158|  81.0k|            }                                                                  \
  |  |  |  |  159|  87.1k|        }                                                                      \
  |  |  |  |  160|   163k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 157k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  629|   163k|                    if (GetBits(4))                                            \
  |  |  ------------------
  |  |  |  |  194|   157k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 55.5k, False: 101k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  630|   157k|                        unexpected("EOL", a0);                                 \
  |  |  ------------------
  |  |  |  |  220|  55.5k|    do                                                                         \
  |  |  |  |  221|  55.5k|    {                                                                          \
  |  |  |  |  222|  55.5k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  55.5k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  55.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 55.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  631|   157k|                    ClrBits(4);                                                \
  |  |  ------------------
  |  |  |  |  196|   157k|    do                                                                         \
  |  |  |  |  197|   157k|    {                                                                          \
  |  |  |  |  198|   157k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|   157k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|   157k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 157k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  632|   157k|                    EOLcnt = 1;                                                \
  |  |  633|   157k|                    goto eol2d;                                                \
  |  |  634|   163k|                default:                                                       \
  |  |  ------------------
  |  |  |  Branch (634:17): [True: 0, False: 1.26M]
  |  |  ------------------
  |  |  635|      0|                badMain2d:                                                     \
  |  |  636|      0|                    unexpected("MainTable", a0);                               \
  |  |  ------------------
  |  |  |  |  220|      0|    do                                                                         \
  |  |  |  |  221|      0|    {                                                                          \
  |  |  |  |  222|      0|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|      0|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  637|      0|                    goto eol2d;                                                \
  |  |  638|  5.65k|                badBlack2d:                                                    \
  |  |  639|  5.65k|                    unexpected("BlackTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|  5.65k|    do                                                                         \
  |  |  |  |  221|  5.65k|    {                                                                          \
  |  |  |  |  222|  5.65k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  5.65k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  5.65k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 5.65k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  640|  5.65k|                    goto eol2d;                                                \
  |  |  641|  10.3k|                badWhite2d:                                                    \
  |  |  642|  10.3k|                    unexpected("WhiteTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|  10.3k|    do                                                                         \
  |  |  |  |  221|  10.3k|    {                                                                          \
  |  |  |  |  222|  10.3k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  10.3k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  10.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 10.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  643|  10.3k|                    goto eol2d;                                                \
  |  |  644|  9.10k|                eof2d:                                                         \
  |  |  645|  9.10k|                    prematureEOF(a0);                                          \
  |  |  ------------------
  |  |  |  |  271|  9.10k|    do                                                                         \
  |  |  |  |  272|  9.10k|    {                                                                          \
  |  |  |  |  273|  9.10k|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|  9.10k|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|  9.10k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 9.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  646|  9.10k|                    CLEANUP_RUNS();                                            \
  |  |  ------------------
  |  |  |  |  333|  9.10k|    do                                                                         \
  |  |  |  |  334|  9.10k|    {                                                                          \
  |  |  |  |  335|  9.10k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 1.07k, False: 8.02k]
  |  |  |  |  ------------------
  |  |  |  |  336|  9.10k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  1.07k|    do                                                                         \
  |  |  |  |  |  |  267|  1.07k|    {                                                                          \
  |  |  |  |  |  |  268|  1.07k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 493, False: 586]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  1.07k|        {                                                                      \
  |  |  |  |  |  |  270|    493|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    493|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    493|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    493|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 177, False: 316]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    493|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    493|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    493|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 177, False: 316]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    493|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    493|            return (-1);                                                       \
  |  |  |  |  |  |  275|    493|        }                                                                      \
  |  |  |  |  |  |  276|  1.07k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    586|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    586|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    586|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 586]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  9.10k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 8.61k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  338|  8.61k|        {                                                                      \
  |  |  |  |  339|  8.61k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|  8.61k|    do                                                                         \
  |  |  |  |  |  |  254|  8.61k|    {                                                                          \
  |  |  |  |  |  |  255|  8.61k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|  8.61k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|  8.61k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|  8.61k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 8.61k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  9.40k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 795, False: 8.61k]
  |  |  |  |  |  Branch (340:39): [True: 795, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|  8.61k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|  8.61k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 8.47k, False: 133]
  |  |  |  |  ------------------
  |  |  |  |  343|  8.61k|            {                                                                  \
  |  |  |  |  344|  8.47k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 8.47k]
  |  |  |  |  ------------------
  |  |  |  |  345|  8.47k|                    a0 = 0;                                                    \
  |  |  |  |  346|  8.47k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 4.71k, False: 3.76k]
  |  |  |  |  ------------------
  |  |  |  |  347|  8.47k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  4.71k|    do                                                                         \
  |  |  |  |  |  |  267|  4.71k|    {                                                                          \
  |  |  |  |  |  |  268|  4.71k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 4.71k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  4.71k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  4.71k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  4.71k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  4.71k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  4.71k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 4.71k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|  8.47k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  8.47k|    do                                                                         \
  |  |  |  |  |  |  267|  8.47k|    {                                                                          \
  |  |  |  |  |  |  268|  8.47k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 330, False: 8.14k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  8.47k|        {                                                                      \
  |  |  |  |  |  |  270|    330|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    330|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    330|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    330|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 134, False: 196]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    330|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    330|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    330|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 134, False: 196]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    330|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    330|            return (-1);                                                       \
  |  |  |  |  |  |  275|    330|        }                                                                      \
  |  |  |  |  |  |  276|  8.47k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  8.14k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  8.14k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  8.14k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 8.14k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|  8.47k|            }                                                                  \
  |  |  |  |  350|  8.61k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 133]
  |  |  |  |  ------------------
  |  |  |  |  351|    133|            {                                                                  \
  |  |  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  354|      0|            }                                                                  \
  |  |  |  |  355|  8.61k|        }                                                                      \
  |  |  |  |  356|  8.61k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 8.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  647|  9.10k|                    goto eoflab;                                               \
  |  |  648|  1.26M|            }                                                                  \
  |  |  649|  1.26M|        }                                                                      \
  |  |  650|   501k|        if (RunLength)                                                         \
  |  |  ------------------
  |  |  |  Branch (650:13): [True: 34.9k, False: 223k]
  |  |  ------------------
  |  |  651|   258k|        {                                                                      \
  |  |  652|  34.9k|            if (RunLength + a0 < lastx)                                        \
  |  |  ------------------
  |  |  |  Branch (652:17): [True: 0, False: 34.9k]
  |  |  ------------------
  |  |  653|  34.9k|            {                                                                  \
  |  |  654|      0|                /* expect a final V0 */                                        \
  |  |  655|      0|                NeedBits8(1, eof2d);                                           \
  |  |  ------------------
  |  |  |  |  144|      0|    do                                                                         \
  |  |  |  |  145|      0|    {                                                                          \
  |  |  |  |  146|      0|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  147|      0|        {                                                                      \
  |  |  |  |  148|      0|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      0|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|      0|            {                                                                  \
  |  |  |  |  150|      0|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  151|      0|                    goto eoflab;                                               \
  |  |  |  |  152|      0|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|      0|            }                                                                  \
  |  |  |  |  154|      0|            else                                                               \
  |  |  |  |  155|      0|            {                                                                  \
  |  |  |  |  156|      0|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|      0|                BitsAvail += 8;                                                \
  |  |  |  |  158|      0|            }                                                                  \
  |  |  |  |  159|      0|        }                                                                      \
  |  |  |  |  160|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  656|      0|                if (!GetBits(1))                                               \
  |  |  ------------------
  |  |  |  |  194|      0|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (656:21): [True: 0, False: 0]
  |  |  ------------------
  |  |  657|      0|                    goto badMain2d;                                            \
  |  |  658|      0|                ClrBits(1);                                                    \
  |  |  ------------------
  |  |  |  |  196|      0|    do                                                                         \
  |  |  |  |  197|      0|    {                                                                          \
  |  |  |  |  198|      0|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|      0|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  659|      0|            }                                                                  \
  |  |  660|  34.9k|            SETVALUE(0);                                                       \
  |  |  ------------------
  |  |  |  |  266|  34.9k|    do                                                                         \
  |  |  |  |  267|  34.9k|    {                                                                          \
  |  |  |  |  268|  34.9k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 34.9k]
  |  |  |  |  ------------------
  |  |  |  |  269|  34.9k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  34.9k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  34.9k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  34.9k|        RunLength = 0;                                                         \
  |  |  |  |  279|  34.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 34.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  661|  34.9k|        }                                                                      \
  |  |  662|   488k|    eol2d:                                                                     \
  |  |  663|   488k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   488k|    do                                                                         \
  |  |  |  |  334|   488k|    {                                                                          \
  |  |  |  |  335|   488k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 4.00k, False: 484k]
  |  |  |  |  ------------------
  |  |  |  |  336|   488k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  4.00k|    do                                                                         \
  |  |  |  |  |  |  267|  4.00k|    {                                                                          \
  |  |  |  |  |  |  268|  4.00k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 582, False: 3.42k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  4.00k|        {                                                                      \
  |  |  |  |  |  |  270|    582|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    582|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    582|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    582|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 343, False: 239]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    582|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    582|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    582|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 343, False: 239]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    582|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    582|            return (-1);                                                       \
  |  |  |  |  |  |  275|    582|        }                                                                      \
  |  |  |  |  |  |  276|  4.00k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  3.42k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  3.42k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  3.42k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 3.42k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   488k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 318k, False: 169k]
  |  |  |  |  ------------------
  |  |  |  |  338|   487k|        {                                                                      \
  |  |  |  |  339|   318k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   318k|    do                                                                         \
  |  |  |  |  |  |  254|   318k|    {                                                                          \
  |  |  |  |  |  |  255|   318k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   318k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   318k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   318k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 318k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   434k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 116k, False: 318k]
  |  |  |  |  |  Branch (340:39): [True: 116k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   318k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   318k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 313k, False: 4.58k]
  |  |  |  |  ------------------
  |  |  |  |  343|   318k|            {                                                                  \
  |  |  |  |  344|   313k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 313k]
  |  |  |  |  ------------------
  |  |  |  |  345|   313k|                    a0 = 0;                                                    \
  |  |  |  |  346|   313k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 216k, False: 96.9k]
  |  |  |  |  ------------------
  |  |  |  |  347|   313k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   216k|    do                                                                         \
  |  |  |  |  |  |  267|   216k|    {                                                                          \
  |  |  |  |  |  |  268|   216k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 216k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   216k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|   216k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   216k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   216k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   216k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 216k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   313k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   313k|    do                                                                         \
  |  |  |  |  |  |  267|   313k|    {                                                                          \
  |  |  |  |  |  |  268|   313k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 493, False: 313k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   313k|        {                                                                      \
  |  |  |  |  |  |  270|    493|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    493|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    493|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    493|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 280, False: 213]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    493|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    493|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    493|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 280, False: 213]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    493|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    493|            return (-1);                                                       \
  |  |  |  |  |  |  275|    493|        }                                                                      \
  |  |  |  |  |  |  276|   313k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   313k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   313k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   313k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 313k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   313k|            }                                                                  \
  |  |  |  |  350|   318k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 4.58k]
  |  |  |  |  ------------------
  |  |  |  |  351|  4.58k|            {                                                                  \
  |  |  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  354|      0|            }                                                                  \
  |  |  |  |  355|   318k|        }                                                                      \
  |  |  |  |  356|   487k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 487k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  664|   488k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (664:14): [Folded, False: 487k]
  |  |  ------------------
  ------------------
  422|   763k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  423|   763k|        if (pa < thisrun + sp->nruns)
  ------------------
  |  Branch (423:13): [True: 761k, False: 2.44k]
  ------------------
  424|   761k|        {
  425|   761k|            SETVALUE(0); /* imaginary change for reference */
  ------------------
  |  |  266|   761k|    do                                                                         \
  |  |  267|   761k|    {                                                                          \
  |  |  268|   761k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  ------------------
  |  |  |  Branch (268:13): [True: 0, False: 761k]
  |  |  ------------------
  |  |  269|   761k|        {                                                                      \
  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  ------------------
  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  ------------------
  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  274|      0|            return (-1);                                                       \
  |  |  275|      0|        }                                                                      \
  |  |  276|   761k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  277|   761k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  278|   761k|        RunLength = 0;                                                         \
  |  |  279|   761k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (279:14): [Folded, False: 761k]
  |  |  ------------------
  ------------------
  426|   761k|        }
  427|   763k|        SWAP(uint32_t *, sp->curruns, sp->refruns);
  ------------------
  |  |  375|   763k|    {                                                                          \
  |  |  376|   763k|        t x;                                                                   \
  |  |  377|   763k|        x = (a);                                                               \
  |  |  378|   763k|        (a) = (b);                                                             \
  |  |  379|   763k|        (b) = x;                                                               \
  |  |  380|   763k|    }
  ------------------
  428|   763k|        buf += sp->b.rowbytes;
  429|   763k|        occ -= sp->b.rowbytes;
  430|   763k|        sp->line++;
  431|   763k|        continue;
  432|    704|    EOF2D: /* premature EOF */
  433|    704|        CLEANUP_RUNS();
  ------------------
  |  |  333|    704|    do                                                                         \
  |  |  334|    704|    {                                                                          \
  |  |  335|    704|        if (RunLength)                                                         \
  |  |  ------------------
  |  |  |  Branch (335:13): [True: 0, False: 704]
  |  |  ------------------
  |  |  336|    704|            SETVALUE(0);                                                       \
  |  |  ------------------
  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  337|    704|        if (a0 != (int)lastx)                                                  \
  |  |  ------------------
  |  |  |  Branch (337:13): [True: 704, False: 0]
  |  |  ------------------
  |  |  338|    704|        {                                                                      \
  |  |  339|    704|            badlength(a0, lastx);                                              \
  |  |  ------------------
  |  |  |  |  253|    704|    do                                                                         \
  |  |  |  |  254|    704|    {                                                                          \
  |  |  |  |  255|    704|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  256|    704|                      (uint32_t)(lastx));                                      \
  |  |  |  |  257|    704|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  258|    704|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (258:14): [Folded, False: 704]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  340|    704|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  ------------------
  |  |  |  Branch (340:20): [True: 0, False: 704]
  |  |  |  Branch (340:39): [True: 0, False: 0]
  |  |  ------------------
  |  |  341|    704|                a0 -= (int)*--pa;                                              \
  |  |  342|    704|            if (a0 < (int)lastx)                                               \
  |  |  ------------------
  |  |  |  Branch (342:17): [True: 704, False: 0]
  |  |  ------------------
  |  |  343|    704|            {                                                                  \
  |  |  344|    704|                if (a0 < 0)                                                    \
  |  |  ------------------
  |  |  |  Branch (344:21): [True: 0, False: 704]
  |  |  ------------------
  |  |  345|    704|                    a0 = 0;                                                    \
  |  |  346|    704|                if ((pa - thisrun) & 1)                                        \
  |  |  ------------------
  |  |  |  Branch (346:21): [True: 0, False: 704]
  |  |  ------------------
  |  |  347|    704|                    SETVALUE(0);                                               \
  |  |  ------------------
  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  348|    704|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  ------------------
  |  |  |  |  266|    704|    do                                                                         \
  |  |  |  |  267|    704|    {                                                                          \
  |  |  |  |  268|    704|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 704]
  |  |  |  |  ------------------
  |  |  |  |  269|    704|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|    704|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|    704|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|    704|        RunLength = 0;                                                         \
  |  |  |  |  279|    704|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 704]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  349|    704|            }                                                                  \
  |  |  350|    704|            else if (a0 > (int)lastx)                                          \
  |  |  ------------------
  |  |  |  Branch (350:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  351|      0|            {                                                                  \
  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  ------------------
  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  ------------------
  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  354|      0|            }                                                                  \
  |  |  355|    704|        }                                                                      \
  |  |  356|    704|    } while (0)
  |  |  ------------------
  |  |  |  Branch (356:14): [Folded, False: 704]
  |  |  ------------------
  ------------------
  434|  9.31k|    EOF2Da: /* premature EOF */
  435|  9.31k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  436|  9.31k|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  9.31k|    do                                                                         \
  |  |  160|  9.31k|    {                                                                          \
  |  |  161|  9.31k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  9.31k|        sp->data = BitAcc;                                                     \
  |  |  163|  9.31k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  9.31k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  9.31k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  9.31k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 9.31k]
  |  |  ------------------
  ------------------
  437|  9.31k|        return (-1);
  438|    704|    }
  439|  6.73k|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  6.73k|    do                                                                         \
  |  |  160|  6.73k|    {                                                                          \
  |  |  161|  6.73k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  6.73k|        sp->data = BitAcc;                                                     \
  |  |  163|  6.73k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  6.73k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  6.73k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  6.73k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 6.73k]
  |  |  ------------------
  ------------------
  440|  6.73k|    return (1);
  441|  21.7k|}
tif_fax3.c:CheckReachedCounters:
  296|  44.8k|{
  297|  44.8k|    if (sp->eofReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
  ------------------
  |  |   49|  44.8k|#define EOF_REACHED_COUNT_THRESHOLD 8192
  ------------------
  |  Branch (297:9): [True: 0, False: 44.8k]
  ------------------
  298|      0|    {
  299|      0|        TIFFErrorExtR(tif, module,
  300|      0|                      "End of file (EOF) has already been reached %d times "
  301|      0|                      "within that %s.",
  302|      0|                      sp->eofReachedCount, isTiled(tif) ? "tile" : "strip");
  ------------------
  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  303|      0|        return (-1);
  304|      0|    }
  305|  44.8k|    if (sp->eolReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
  ------------------
  |  |   49|  44.8k|#define EOF_REACHED_COUNT_THRESHOLD 8192
  ------------------
  |  Branch (305:9): [True: 1, False: 44.8k]
  ------------------
  306|      1|    {
  307|      1|        TIFFErrorExtR(tif, module,
  308|      1|                      "Bad line length (EOL) has already been reached %d times "
  309|      1|                      "within that %s",
  310|      1|                      sp->eolReachedCount, isTiled(tif) ? "tile" : "strip");
  ------------------
  |  |  278|      1|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|      1|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  311|      1|        return (-1);
  312|      1|    }
  313|  44.8k|    if (sp->unexpectedReachedCount >= EOF_REACHED_COUNT_THRESHOLD)
  ------------------
  |  |   49|  44.8k|#define EOF_REACHED_COUNT_THRESHOLD 8192
  ------------------
  |  Branch (313:9): [True: 1, False: 44.8k]
  ------------------
  314|      1|    {
  315|      1|        TIFFErrorExtR(tif, module,
  316|      1|                      "Bad code word (unexpected) has already been reached %d "
  317|      1|                      "times within that %s",
  318|      1|                      sp->unexpectedReachedCount,
  319|      1|                      isTiled(tif) ? "tile" : "strip");
  ------------------
  |  |  278|      1|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|      1|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  320|      1|        return (-1);
  321|      1|    }
  322|  44.8k|    return (0);
  323|  44.8k|}
tif_fax3.c:Fax3TryG3WithoutEOL:
  279|    142|{
  280|    142|    TIFFWarningExtR(
  281|    142|        tif, module,
  282|    142|        "Try to decode (read) fax Group 3 data without EOL at line %" PRIu32
  283|    142|        " of %s %" PRIu32 " (x %" PRIu32 "). Please check result",
  284|    142|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  278|    142|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    142|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 72, False: 70]
  |  |  ------------------
  ------------------
  285|    142|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  278|    142|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    142|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 72, False: 70]
  |  |  ------------------
  ------------------
  286|    142|        a0);
  287|    142|}
tif_fax3.c:Fax3Unexpected:
  211|   327k|{
  212|   327k|    TIFFErrorExtR(
  213|   327k|        tif, module,
  214|   327k|        "Bad code word at line %" PRIu32 " of %s %" PRIu32 " (x %" PRIu32 ")",
  215|   327k|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  278|   327k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|   327k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 202k, False: 125k]
  |  |  ------------------
  ------------------
  216|   327k|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  278|   327k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|   327k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 202k, False: 125k]
  |  |  ------------------
  ------------------
  217|   327k|        a0);
  218|   327k|}
tif_fax3.c:Fax3PrematureEOF:
  262|  12.5k|{
  263|  12.5k|    TIFFWarningExtR(
  264|  12.5k|        tif, module,
  265|  12.5k|        "Premature EOF at line %" PRIu32 " of %s %" PRIu32 " (x %" PRIu32 ")",
  266|  12.5k|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  278|  12.5k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  12.5k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 7.72k, False: 4.82k]
  |  |  ------------------
  ------------------
  267|  12.5k|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  278|  12.5k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  12.5k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 7.72k, False: 4.82k]
  |  |  ------------------
  ------------------
  268|  12.5k|        a0);
  269|  12.5k|}
tif_fax3.c:Fax3BadLength:
  242|  1.00M|{
  243|  1.00M|    TIFFWarningExtR(
  244|  1.00M|        tif, module,
  245|  1.00M|        "%s at line %" PRIu32 " of %s %" PRIu32 " (got %" PRIu32
  246|  1.00M|        ", expected %" PRIu32 ")",
  247|  1.00M|        a0 < lastx ? "Premature EOL" : "Line length mismatch", line,
  ------------------
  |  Branch (247:9): [True: 546k, False: 457k]
  ------------------
  248|  1.00M|        isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  278|  1.00M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  1.00M|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 592k, False: 412k]
  |  |  ------------------
  ------------------
  249|  1.00M|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip), a0,
  ------------------
  |  |  278|  1.00M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  1.00M|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 592k, False: 412k]
  |  |  ------------------
  ------------------
  250|  1.00M|        lastx);
  251|  1.00M|}
tif_fax3.c:Fax3Extension:
  228|  60.8k|{
  229|  60.8k|    TIFFErrorExtR(
  230|  60.8k|        tif, module,
  231|  60.8k|        "Uncompressed data (not supported) at line %" PRIu32 " of %s %" PRIu32
  232|  60.8k|        " (x %" PRIu32 ")",
  233|  60.8k|        line, isTiled(tif) ? "tile" : "strip",
  ------------------
  |  |  278|  60.8k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  60.8k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 46.5k, False: 14.3k]
  |  |  ------------------
  ------------------
  234|  60.8k|        (isTiled(tif) ? tif->tif_dir.td_curtile : tif->tif_dir.td_curstrip),
  ------------------
  |  |  278|  60.8k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  60.8k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 46.5k, False: 14.3k]
  |  |  ------------------
  ------------------
  235|  60.8k|        a0);
  236|  60.8k|}
tif_fax3.c:Fax3PreDecode:
  172|  27.4k|{
  173|  27.4k|    Fax3CodecState *sp = DecoderState(tif);
  ------------------
  |  |  108|  27.4k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|  27.4k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  174|       |
  175|  27.4k|    (void)s;
  176|  27.4k|    assert(sp != NULL);
  ------------------
  |  Branch (176:5): [True: 0, False: 27.4k]
  |  Branch (176:5): [True: 27.4k, False: 0]
  ------------------
  177|  27.4k|    sp->bit = 0; /* force initial read */
  178|  27.4k|    sp->data = 0;
  179|  27.4k|    sp->EOLcnt = 0; /* force initial scan for EOL */
  180|  27.4k|    sp->eofReachedCount = 0;
  181|  27.4k|    sp->eolReachedCount = 0;
  182|  27.4k|    sp->unexpectedReachedCount = 0;
  183|       |    /*
  184|       |     * Decoder assumes lsb-to-msb bit order.  Note that we select
  185|       |     * this here rather than in Fax3SetupState so that viewers can
  186|       |     * hold the image open, fiddle with the FillOrder tag value,
  187|       |     * and then re-decode the image.  Otherwise they'd need to close
  188|       |     * and open the image to get the state reset.
  189|       |     */
  190|  27.4k|    sp->bitmap =
  191|  27.4k|        TIFFGetBitRevTable(tif->tif_dir.td_fillorder != FILLORDER_LSB2MSB);
  ------------------
  |  |  242|  27.4k|#define FILLORDER_LSB2MSB 2                /* least significant -> most */
  ------------------
  192|  27.4k|    sp->curruns = sp->runs;
  193|  27.4k|    if (sp->refruns)
  ------------------
  |  Branch (193:9): [True: 25.7k, False: 1.69k]
  ------------------
  194|  25.7k|    { /* init reference line to white */
  195|  25.7k|        sp->refruns = sp->runs + sp->nruns;
  196|  25.7k|        sp->refruns[0] = (uint32_t)sp->b.rowpixels;
  197|  25.7k|        sp->refruns[1] = 0;
  198|  25.7k|    }
  199|  27.4k|    sp->line = 0;
  200|  27.4k|    return (1);
  201|  27.4k|}
tif_fax3.c:Fax3Decode1D:
  333|  2.56k|{
  334|  2.56k|    DECLARE_STATE(tif, sp, "Fax3Decode1D");
  ------------------
  |  |  123|  2.56k|    static const char module[] = mod;                                          \
  |  |  124|  2.56k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  ------------------
  |  |  |  |  108|  2.56k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  2.56k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  125|  2.56k|    int a0;                                   /* reference element */          \
  |  |  126|  2.56k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  127|  2.56k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  128|  2.56k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  129|  2.56k|    int RunLength;                            /* length of current run */      \
  |  |  130|  2.56k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  131|  2.56k|    unsigned char *ep;                        /* end of input data */          \
  |  |  132|  2.56k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  133|  2.56k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  134|  2.56k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  135|  2.56k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  136|  2.56k|    const TIFFFaxTabEnt *TabEnt
  ------------------
  335|  2.56k|    (void)s;
  336|  2.56k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (336:9): [True: 0, False: 2.56k]
  ------------------
  337|      0|    {
  338|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
  339|      0|        return (-1);
  340|      0|    }
  341|  2.56k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (341:9): [True: 0, False: 2.56k]
  ------------------
  342|      0|        return (-1);
  343|  2.59k|RETRY_WITHOUT_EOL_1D:
  344|  2.59k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  2.59k|    do                                                                         \
  |  |  148|  2.59k|    {                                                                          \
  |  |  149|  2.59k|        BitAcc = sp->data;                                                     \
  |  |  150|  2.59k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  2.59k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  2.59k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  2.59k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  2.59k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 2.59k]
  |  |  ------------------
  ------------------
  345|  2.59k|    thisrun = sp->curruns;
  346|   132k|    while (occ > 0)
  ------------------
  |  Branch (346:12): [True: 130k, False: 2.05k]
  ------------------
  347|   130k|    {
  348|   130k|        a0 = 0;
  349|   130k|        RunLength = 0;
  350|   130k|        pa = thisrun;
  351|       |#ifdef FAX3_DEBUG
  352|       |        printf("\nBitAcc=%08" PRIX32 ", BitsAvail = %d\n", BitAcc, BitsAvail);
  353|       |        printf("-------------------- %" PRIu32 "\n", tif->tif_dir.td_row);
  354|       |        fflush(stdout);
  355|       |#endif
  356|   130k|        SYNC_EOL(EOF1D, RETRY_WITHOUT_EOL_1D);
  ------------------
  |  |  293|   130k|    do                                                                         \
  |  |  294|   130k|    {                                                                          \
  |  |  295|   130k|        if (!(sp->b.mode & FAXMODE_NOEOL)) /* skip EOL, if not present */      \
  |  |  ------------------
  |  |  |  |  700|   130k|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  |  Branch (295:13): [True: 17.4k, False: 113k]
  |  |  ------------------
  |  |  296|   130k|        {                                                                      \
  |  |  297|  17.4k|            if (EOLcnt == 0)                                                   \
  |  |  ------------------
  |  |  |  Branch (297:17): [True: 5.53k, False: 11.8k]
  |  |  ------------------
  |  |  298|  17.4k|            {                                                                  \
  |  |  299|  5.53k|                for (;;)                                                       \
  |  |  300|  3.12M|                {                                                              \
  |  |  301|  3.12M|                    NeedBits16(11, eoflab);                                    \
  |  |  ------------------
  |  |  |  |  164|  3.12M|    do                                                                         \
  |  |  |  |  165|  3.12M|    {                                                                          \
  |  |  |  |  166|  3.12M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (166:13): [True: 393k, False: 2.73M]
  |  |  |  |  ------------------
  |  |  |  |  167|  3.12M|        {                                                                      \
  |  |  |  |  168|   393k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|   393k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 127, False: 393k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  169|   393k|            {                                                                  \
  |  |  |  |  170|    127|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (170:21): [True: 0, False: 127]
  |  |  |  |  ------------------
  |  |  |  |  171|    127|                    goto eoflab;                                               \
  |  |  |  |  172|    127|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  173|    127|            }                                                                  \
  |  |  |  |  174|   393k|            else                                                               \
  |  |  |  |  175|   393k|            {                                                                  \
  |  |  |  |  176|   393k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  177|   393k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:21): [True: 415, False: 392k]
  |  |  |  |  ------------------
  |  |  |  |  178|   393k|                {                                                              \
  |  |  |  |  179|    415|                    if (EndOfData())                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|    415|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 2, False: 413]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  180|    415|                    {                                                          \
  |  |  |  |  181|      2|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  182|      2|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  183|      2|                    }                                                          \
  |  |  |  |  184|    415|                    else                                                       \
  |  |  |  |  185|    415|                    {                                                          \
  |  |  |  |  186|    413|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  187|    413|                        BitsAvail += 8;                                        \
  |  |  |  |  188|    413|                    }                                                          \
  |  |  |  |  189|    415|                }                                                              \
  |  |  |  |  190|   393k|            }                                                                  \
  |  |  |  |  191|   393k|        }                                                                      \
  |  |  |  |  192|  3.12M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (192:14): [Folded, False: 3.12M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  302|  3.12M|                    if (GetBits(11) == 0)                                      \
  |  |  ------------------
  |  |  |  |  194|  3.12M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (302:25): [True: 5.53k, False: 3.11M]
  |  |  ------------------
  |  |  303|  3.12M|                        break; /* EOL found */                                 \
  |  |  304|  3.12M|                    ClrBits(1);                                                \
  |  |  ------------------
  |  |  |  |  196|  3.11M|    do                                                                         \
  |  |  |  |  197|  3.11M|    {                                                                          \
  |  |  |  |  198|  3.11M|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  3.11M|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  3.11M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 3.11M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|  3.11M|                }                                                              \
  |  |  306|  5.53k|            }                                                                  \
  |  |  307|  17.4k|            /* Now move after EOL or detect missing EOL. */                    \
  |  |  308|  17.4k|            for (;;)                                                           \
  |  |  309|   847k|            {                                                                  \
  |  |  310|   847k|                NeedBits8(8, noEOLFound);                                      \
  |  |  ------------------
  |  |  |  |  144|   847k|    do                                                                         \
  |  |  |  |  145|   847k|    {                                                                          \
  |  |  |  |  146|   847k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 837k, False: 9.82k]
  |  |  |  |  ------------------
  |  |  |  |  147|   847k|        {                                                                      \
  |  |  |  |  148|   837k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|   837k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 56, False: 837k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|   837k|            {                                                                  \
  |  |  |  |  150|     56|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 28, False: 28]
  |  |  |  |  ------------------
  |  |  |  |  151|     56|                    goto eoflab;                                               \
  |  |  |  |  152|     56|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|     28|            }                                                                  \
  |  |  |  |  154|   837k|            else                                                               \
  |  |  |  |  155|   837k|            {                                                                  \
  |  |  |  |  156|   837k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|   837k|                BitsAvail += 8;                                                \
  |  |  |  |  158|   837k|            }                                                                  \
  |  |  |  |  159|   837k|        }                                                                      \
  |  |  |  |  160|   847k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 847k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  311|   847k|                if (GetBits(8))                                                \
  |  |  ------------------
  |  |  |  |  194|   847k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 17.3k, False: 830k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  312|   847k|                    break;                                                     \
  |  |  313|   847k|                ClrBits(8);                                                    \
  |  |  ------------------
  |  |  |  |  196|   830k|    do                                                                         \
  |  |  |  |  197|   830k|    {                                                                          \
  |  |  |  |  198|   830k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|   830k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|   830k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 830k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  314|   830k|            }                                                                  \
  |  |  315|  77.3k|            while (GetBits(1) == 0)                                            \
  |  |  ------------------
  |  |  |  |  194|  77.3k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (315:20): [True: 60.0k, False: 17.3k]
  |  |  ------------------
  |  |  316|  60.0k|                ClrBits(1);                                                    \
  |  |  ------------------
  |  |  |  |  196|  77.3k|    do                                                                         \
  |  |  |  |  197|  77.3k|    {                                                                          \
  |  |  |  |  198|  60.0k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  60.0k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  60.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 60.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  317|  17.3k|            ClrBits(1); /* EOL bit */                                          \
  |  |  ------------------
  |  |  |  |  196|  17.3k|    do                                                                         \
  |  |  |  |  197|  17.3k|    {                                                                          \
  |  |  |  |  198|  17.3k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  17.3k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  17.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 17.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  318|  17.3k|            EOLcnt = 0; /* reset EOL counter/flag */                           \
  |  |  319|  17.3k|            break;      /* existing EOL skipped, leave macro */                \
  |  |  320|  17.4k|        noEOLFound:                                                            \
  |  |  321|     28|            sp->b.mode |= FAXMODE_NOEOL;                                       \
  |  |  ------------------
  |  |  |  |  700|     28|#define FAXMODE_NOEOL 0x0002         /* no EOL code at end of row */
  |  |  ------------------
  |  |  322|     28|            tryG3WithoutEOL(a0);                                               \
  |  |  ------------------
  |  |  |  |  289|     28|    do                                                                         \
  |  |  |  |  290|     28|    {                                                                          \
  |  |  |  |  291|     28|        Fax3TryG3WithoutEOL(module, tif, (uint32_t)sp->line, (uint32_t)(a0));  \
  |  |  |  |  292|     28|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (292:14): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  323|     28|            goto retrywithouteol;                                              \
  |  |  324|  17.4k|        }                                                                      \
  |  |  325|   130k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (325:14): [Folded, False: 113k]
  |  |  ------------------
  ------------------
  357|   130k|        EXPAND1D(EOF1Da);
  ------------------
  |  |  371|   130k|    do                                                                         \
  |  |  372|   130k|    {                                                                          \
  |  |  373|   130k|        for (;;)                                                               \
  |  |  374|   241k|        {                                                                      \
  |  |  375|   241k|            for (;;)                                                           \
  |  |  376|  1.02M|            {                                                                  \
  |  |  377|  1.02M|                LOOKUP16(12, TIFFFaxWhiteTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|  1.02M|    do                                                                         \
  |  |  |  |  255|  1.02M|    {                                                                          \
  |  |  |  |  256|  1.02M|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  1.02M|    do                                                                         \
  |  |  |  |  |  |  165|  1.02M|    {                                                                          \
  |  |  |  |  |  |  166|  1.02M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 851k, False: 172k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  1.02M|        {                                                                      \
  |  |  |  |  |  |  168|   851k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   851k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 7.43k, False: 844k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|   851k|            {                                                                  \
  |  |  |  |  |  |  170|  7.43k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 384, False: 7.05k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  7.43k|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|  7.43k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|  7.05k|            }                                                                  \
  |  |  |  |  |  |  174|   851k|            else                                                               \
  |  |  |  |  |  |  175|   851k|            {                                                                  \
  |  |  |  |  |  |  176|   844k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|   844k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 41.3k, False: 803k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|   844k|                {                                                              \
  |  |  |  |  |  |  179|  41.3k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  41.3k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 27, False: 41.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  41.3k|                    {                                                          \
  |  |  |  |  |  |  181|     27|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|     27|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|     27|                    }                                                          \
  |  |  |  |  |  |  184|  41.3k|                    else                                                       \
  |  |  |  |  |  |  185|  41.3k|                    {                                                          \
  |  |  |  |  |  |  186|  41.2k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  41.2k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  41.2k|                    }                                                          \
  |  |  |  |  |  |  189|  41.3k|                }                                                              \
  |  |  |  |  |  |  190|   844k|            }                                                                  \
  |  |  |  |  |  |  191|   851k|        }                                                                      \
  |  |  |  |  |  |  192|  1.02M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 1.02M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  1.02M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  1.02M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  1.02M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  1.02M|    do                                                                         \
  |  |  |  |  |  |  197|  1.02M|    {                                                                          \
  |  |  |  |  |  |  198|  1.02M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  1.02M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  1.02M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 1.02M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  1.02M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 1.02M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  378|  1.02M|                switch (TabEnt->State)                                         \
  |  |  379|  1.02M|                {                                                              \
  |  |  380|  12.7k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  12.7k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 12.7k, False: 1.01M]
  |  |  ------------------
  |  |  381|  12.7k|                        EOLcnt = 1;                                            \
  |  |  382|  12.7k|                        goto done1d;                                           \
  |  |  383|   128k|                    case S_TermW:                                              \
  |  |  ------------------
  |  |  |  |   77|   128k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (383:21): [True: 128k, False: 895k]
  |  |  ------------------
  |  |  384|   128k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   128k|    do                                                                         \
  |  |  |  |  267|   128k|    {                                                                          \
  |  |  |  |  268|   128k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 128k]
  |  |  |  |  ------------------
  |  |  |  |  269|   128k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   128k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   128k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   128k|        RunLength = 0;                                                         \
  |  |  |  |  279|   128k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 128k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  385|   128k|                        goto doneWhite1d;                                      \
  |  |  386|   706k|                    case S_MakeUpW:                                            \
  |  |  ------------------
  |  |  |  |   79|   706k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (386:21): [True: 706k, False: 317k]
  |  |  ------------------
  |  |  387|   782k|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|   782k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 76.1k, False: 947k]
  |  |  ------------------
  |  |  388|   782k|                        a0 = (int)((uint32_t)a0 + TabEnt->Param);              \
  |  |  389|   782k|                        RunLength =                                            \
  |  |  390|   782k|                            (int)((uint32_t)RunLength + TabEnt->Param);        \
  |  |  391|   782k|                        break;                                                 \
  |  |  392|   706k|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (392:21): [True: 100k, False: 923k]
  |  |  ------------------
  |  |  393|   100k|                        unexpected("WhiteTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|   100k|    do                                                                         \
  |  |  |  |  221|   100k|    {                                                                          \
  |  |  |  |  222|   100k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|   100k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|   100k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 100k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|   100k|                        goto done1d;                                           \
  |  |  395|  1.02M|                }                                                              \
  |  |  396|  1.02M|            }                                                                  \
  |  |  397|   241k|        doneWhite1d:                                                           \
  |  |  398|   128k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (398:17): [True: 5.44k, False: 123k]
  |  |  ------------------
  |  |  399|   128k|                goto done1d;                                                   \
  |  |  400|   128k|            for (;;)                                                           \
  |  |  401|   124k|            {                                                                  \
  |  |  402|   124k|                LOOKUP16(13, TIFFFaxBlackTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|   124k|    do                                                                         \
  |  |  |  |  255|   124k|    {                                                                          \
  |  |  |  |  256|   124k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|   124k|    do                                                                         \
  |  |  |  |  |  |  165|   124k|    {                                                                          \
  |  |  |  |  |  |  166|   124k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 71.9k, False: 52.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|   124k|        {                                                                      \
  |  |  |  |  |  |  168|  71.9k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  71.9k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 317, False: 71.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  71.9k|            {                                                                  \
  |  |  |  |  |  |  170|    317|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 133, False: 184]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    317|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    317|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    184|            }                                                                  \
  |  |  |  |  |  |  174|  71.9k|            else                                                               \
  |  |  |  |  |  |  175|  71.9k|            {                                                                  \
  |  |  |  |  |  |  176|  71.6k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  71.6k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 1.33k, False: 70.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  71.6k|                {                                                              \
  |  |  |  |  |  |  179|  1.33k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  1.33k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 2, False: 1.33k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  1.33k|                    {                                                          \
  |  |  |  |  |  |  181|      2|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|      2|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|      2|                    }                                                          \
  |  |  |  |  |  |  184|  1.33k|                    else                                                       \
  |  |  |  |  |  |  185|  1.33k|                    {                                                          \
  |  |  |  |  |  |  186|  1.33k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  1.33k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  1.33k|                    }                                                          \
  |  |  |  |  |  |  189|  1.33k|                }                                                              \
  |  |  |  |  |  |  190|  71.6k|            }                                                                  \
  |  |  |  |  |  |  191|  71.9k|        }                                                                      \
  |  |  |  |  |  |  192|   124k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 124k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|   124k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   124k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|   124k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   124k|    do                                                                         \
  |  |  |  |  |  |  197|   124k|    {                                                                          \
  |  |  |  |  |  |  198|   124k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   124k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   124k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 124k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|   124k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 124k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|   124k|                switch (TabEnt->State)                                         \
  |  |  404|   124k|                {                                                              \
  |  |  405|  8.15k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  8.15k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (405:21): [True: 8.15k, False: 116k]
  |  |  ------------------
  |  |  406|  8.15k|                        EOLcnt = 1;                                            \
  |  |  407|  8.15k|                        goto done1d;                                           \
  |  |  408|   114k|                    case S_TermB:                                              \
  |  |  ------------------
  |  |  |  |   78|   114k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (408:21): [True: 114k, False: 10.4k]
  |  |  ------------------
  |  |  409|   114k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|   114k|    do                                                                         \
  |  |  |  |  267|   114k|    {                                                                          \
  |  |  |  |  268|   114k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 114k]
  |  |  |  |  ------------------
  |  |  |  |  269|   114k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   114k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   114k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   114k|        RunLength = 0;                                                         \
  |  |  |  |  279|   114k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 114k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|   114k|                        goto doneBlack1d;                                      \
  |  |  411|   114k|                    case S_MakeUpB:                                            \
  |  |  ------------------
  |  |  |  |   80|    596|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (411:21): [True: 596, False: 124k]
  |  |  ------------------
  |  |  412|  1.62k|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  1.62k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (412:21): [True: 1.02k, False: 123k]
  |  |  ------------------
  |  |  413|  1.62k|                        a0 += (int)TabEnt->Param;                              \
  |  |  414|  1.62k|                        RunLength += (int)TabEnt->Param;                       \
  |  |  415|  1.62k|                        break;                                                 \
  |  |  416|    690|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (416:21): [True: 690, False: 124k]
  |  |  ------------------
  |  |  417|    690|                        unexpected("BlackTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|    690|    do                                                                         \
  |  |  |  |  221|    690|    {                                                                          \
  |  |  |  |  222|    690|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|    690|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|    690|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 690]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  418|    690|                        goto done1d;                                           \
  |  |  419|   124k|                }                                                              \
  |  |  420|   124k|            }                                                                  \
  |  |  421|   123k|        doneBlack1d:                                                           \
  |  |  422|   114k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (422:17): [True: 3.34k, False: 111k]
  |  |  ------------------
  |  |  423|   114k|                goto done1d;                                                   \
  |  |  424|   114k|            if (*(pa - 1) == 0 && *(pa - 2) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (424:17): [True: 163, False: 110k]
  |  |  |  Branch (424:35): [True: 161, False: 2]
  |  |  ------------------
  |  |  425|   111k|                pa -= 2;                                                       \
  |  |  426|   111k|        }                                                                      \
  |  |  427|   130k|    eof1d:                                                                     \
  |  |  428|    517|        prematureEOF(a0);                                                      \
  |  |  ------------------
  |  |  |  |  271|    517|    do                                                                         \
  |  |  |  |  272|    517|    {                                                                          \
  |  |  |  |  273|    517|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|    517|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|    517|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 517]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  429|    517|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|    517|    do                                                                         \
  |  |  |  |  334|    517|    {                                                                          \
  |  |  |  |  335|    517|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 136, False: 381]
  |  |  |  |  ------------------
  |  |  |  |  336|    517|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    136|    do                                                                         \
  |  |  |  |  |  |  267|    136|    {                                                                          \
  |  |  |  |  |  |  268|    136|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 136]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    136|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    136|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    136|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    136|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    136|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 136]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|    517|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 517, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  338|    517|        {                                                                      \
  |  |  |  |  339|    517|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|    517|    do                                                                         \
  |  |  |  |  |  |  254|    517|    {                                                                          \
  |  |  |  |  |  |  255|    517|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|    517|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|    517|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|    517|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 517]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|    651|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 134, False: 517]
  |  |  |  |  |  Branch (340:39): [True: 134, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|    517|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|    517|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 517, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|    517|            {                                                                  \
  |  |  |  |  344|    517|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 517]
  |  |  |  |  ------------------
  |  |  |  |  345|    517|                    a0 = 0;                                                    \
  |  |  |  |  346|    517|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 135, False: 382]
  |  |  |  |  ------------------
  |  |  |  |  347|    517|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    135|    do                                                                         \
  |  |  |  |  |  |  267|    135|    {                                                                          \
  |  |  |  |  |  |  268|    135|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 135]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    135|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    135|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    135|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    135|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    135|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 135]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|    517|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    517|    do                                                                         \
  |  |  |  |  |  |  267|    517|    {                                                                          \
  |  |  |  |  |  |  268|    517|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 517]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    517|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    517|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    517|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    517|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    517|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 517]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|    517|            }                                                                  \
  |  |  |  |  350|    517|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  351|      0|            {                                                                  \
  |  |  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  354|      0|            }                                                                  \
  |  |  |  |  355|    517|        }                                                                      \
  |  |  |  |  356|    517|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 517]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  430|    517|        goto eoflab;                                                           \
  |  |  431|   130k|    done1d:                                                                    \
  |  |  432|   130k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   130k|    do                                                                         \
  |  |  |  |  334|   130k|    {                                                                          \
  |  |  |  |  335|   130k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 775, False: 129k]
  |  |  |  |  ------------------
  |  |  |  |  336|   130k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    775|    do                                                                         \
  |  |  |  |  |  |  267|    775|    {                                                                          \
  |  |  |  |  |  |  268|    775|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 775]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    775|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    775|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    775|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    775|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    775|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 775]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   130k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 129k, False: 863]
  |  |  |  |  ------------------
  |  |  |  |  338|   130k|        {                                                                      \
  |  |  |  |  339|   129k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   129k|    do                                                                         \
  |  |  |  |  |  |  254|   129k|    {                                                                          \
  |  |  |  |  |  |  255|   129k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   129k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   129k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   129k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 129k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   137k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 8.22k, False: 129k]
  |  |  |  |  |  Branch (340:39): [True: 8.22k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   129k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   129k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 129k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|   129k|            {                                                                  \
  |  |  |  |  344|   129k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 129k]
  |  |  |  |  ------------------
  |  |  |  |  345|   129k|                    a0 = 0;                                                    \
  |  |  |  |  346|   129k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 12.0k, False: 117k]
  |  |  |  |  ------------------
  |  |  |  |  347|   129k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  12.0k|    do                                                                         \
  |  |  |  |  |  |  267|  12.0k|    {                                                                          \
  |  |  |  |  |  |  268|  12.0k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 12.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  12.0k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  12.0k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  12.0k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  12.0k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  12.0k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 12.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   129k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   129k|    do                                                                         \
  |  |  |  |  |  |  267|   129k|    {                                                                          \
  |  |  |  |  |  |  268|   129k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 129k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   129k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|   129k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   129k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   129k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   129k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 129k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   129k|            }                                                                  \
  |  |  |  |  350|   129k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  351|      0|            {                                                                  \
  |  |  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  354|      0|            }                                                                  \
  |  |  |  |  355|   129k|        }                                                                      \
  |  |  |  |  356|   130k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 130k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  433|   130k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (433:14): [Folded, False: 130k]
  |  |  ------------------
  ------------------
  358|   130k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  359|   130k|        buf += sp->b.rowbytes;
  360|   130k|        occ -= sp->b.rowbytes;
  361|   130k|        sp->line++;
  362|   130k|        continue;
  363|      0|    EOF1D: /* premature EOF */
  364|      0|        CLEANUP_RUNS();
  ------------------
  |  |  333|      0|    do                                                                         \
  |  |  334|      0|    {                                                                          \
  |  |  335|      0|        if (RunLength)                                                         \
  |  |  ------------------
  |  |  |  Branch (335:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  336|      0|            SETVALUE(0);                                                       \
  |  |  ------------------
  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  337|      0|        if (a0 != (int)lastx)                                                  \
  |  |  ------------------
  |  |  |  Branch (337:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  338|      0|        {                                                                      \
  |  |  339|      0|            badlength(a0, lastx);                                              \
  |  |  ------------------
  |  |  |  |  253|      0|    do                                                                         \
  |  |  |  |  254|      0|    {                                                                          \
  |  |  |  |  255|      0|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  256|      0|                      (uint32_t)(lastx));                                      \
  |  |  |  |  257|      0|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  258|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (258:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  340|      0|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  ------------------
  |  |  |  Branch (340:20): [True: 0, False: 0]
  |  |  |  Branch (340:39): [True: 0, False: 0]
  |  |  ------------------
  |  |  341|      0|                a0 -= (int)*--pa;                                              \
  |  |  342|      0|            if (a0 < (int)lastx)                                               \
  |  |  ------------------
  |  |  |  Branch (342:17): [True: 0, False: 0]
  |  |  ------------------
  |  |  343|      0|            {                                                                  \
  |  |  344|      0|                if (a0 < 0)                                                    \
  |  |  ------------------
  |  |  |  Branch (344:21): [True: 0, False: 0]
  |  |  ------------------
  |  |  345|      0|                    a0 = 0;                                                    \
  |  |  346|      0|                if ((pa - thisrun) & 1)                                        \
  |  |  ------------------
  |  |  |  Branch (346:21): [True: 0, False: 0]
  |  |  ------------------
  |  |  347|      0|                    SETVALUE(0);                                               \
  |  |  ------------------
  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  348|      0|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  ------------------
  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  349|      0|            }                                                                  \
  |  |  350|      0|            else if (a0 > (int)lastx)                                          \
  |  |  ------------------
  |  |  |  Branch (350:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  351|      0|            {                                                                  \
  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  ------------------
  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  ------------------
  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  354|      0|            }                                                                  \
  |  |  355|      0|        }                                                                      \
  |  |  356|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (356:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  365|    517|    EOF1Da: /* premature EOF */
  366|    517|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
  367|    517|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|    517|    do                                                                         \
  |  |  160|    517|    {                                                                          \
  |  |  161|    517|        sp->bit = BitsAvail;                                                   \
  |  |  162|    517|        sp->data = BitAcc;                                                     \
  |  |  163|    517|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|    517|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|    517|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|    517|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 517]
  |  |  ------------------
  ------------------
  368|    517|        return (-1);
  369|      0|    }
  370|  2.05k|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  2.05k|    do                                                                         \
  |  |  160|  2.05k|    {                                                                          \
  |  |  161|  2.05k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  2.05k|        sp->data = BitAcc;                                                     \
  |  |  163|  2.05k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  2.05k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  2.05k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  2.05k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 2.05k]
  |  |  ------------------
  ------------------
  371|  2.05k|    return (1);
  372|  2.59k|}
tif_fax3.c:Fax3Cleanup:
 1329|    313|{
 1330|    313|    Fax3CodecState *sp = DecoderState(tif);
  ------------------
  |  |  108|    313|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  ------------------
  |  |  |  |   72|    313|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1331|       |
 1332|    313|    assert(sp != 0);
  ------------------
  |  Branch (1332:5): [True: 0, False: 313]
  |  Branch (1332:5): [True: 313, False: 0]
  ------------------
 1333|       |
 1334|    313|    tif->tif_tagmethods.vgetfield = sp->b.vgetparent;
 1335|    313|    tif->tif_tagmethods.vsetfield = sp->b.vsetparent;
 1336|    313|    tif->tif_tagmethods.printdir = sp->b.printdir;
 1337|       |
 1338|    313|    if (sp->runs)
  ------------------
  |  Branch (1338:9): [True: 252, False: 61]
  ------------------
 1339|    252|        _TIFFfreeExt(tif, sp->runs);
 1340|    313|    if (sp->refline)
  ------------------
  |  Branch (1340:9): [True: 186, False: 127]
  ------------------
 1341|    186|        _TIFFfreeExt(tif, sp->refline);
 1342|       |
 1343|    313|    _TIFFfreeExt(tif, tif->tif_data);
 1344|    313|    tif->tif_data = NULL;
 1345|       |
 1346|    313|    _TIFFSetDefaultCompressionState(tif);
 1347|    313|}
tif_fax3.c:Fax3GetMaxCompressionRatio:
 1522|      2|{
 1523|      2|    (void)tif;
 1524|       |
 1525|       |    /* See README_for_libtiff_developpers.md for raw data used to estimate
 1526|       |     * the maximum compression rate. */
 1527|       |
 1528|       |    /* 1024x1024: 36 */
 1529|       |    /* 4096x4096: 100 */
 1530|       |    /* 16383x16383: 163 */
 1531|       |    /* 65536x65536: 200 */
 1532|       |    /* 200000x200000: 208 */
 1533|       |
 1534|      2|    return 250;
 1535|      2|}
tif_fax3.c:Fax4Decode:
 1646|  10.8k|{
 1647|  10.8k|    DECLARE_STATE_2D(tif, sp, "Fax4Decode");
  ------------------
  |  |  139|  10.8k|    DECLARE_STATE(tif, sp, mod);                                               \
  |  |  ------------------
  |  |  |  |  123|  10.8k|    static const char module[] = mod;                                          \
  |  |  |  |  124|  10.8k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  108|  10.8k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   72|  10.8k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  125|  10.8k|    int a0;                                   /* reference element */          \
  |  |  |  |  126|  10.8k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  |  |  127|  10.8k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  |  |  128|  10.8k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  |  |  129|  10.8k|    int RunLength;                            /* length of current run */      \
  |  |  |  |  130|  10.8k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  |  |  131|  10.8k|    unsigned char *ep;                        /* end of input data */          \
  |  |  |  |  132|  10.8k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  |  |  133|  10.8k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  |  |  134|  10.8k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  |  |  135|  10.8k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  |  |  136|  10.8k|    const TIFFFaxTabEnt *TabEnt
  |  |  ------------------
  |  |  140|  10.8k|    int b1; /* next change on prev line */                                     \
  |  |  141|  10.8k|    uint32_t                                                                   \
  |  |  142|  10.8k|        *pb /* next run in reference line */ /*                                \
  ------------------
 1648|  10.8k|    (void)s;
 1649|  10.8k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (1649:9): [True: 0, False: 10.8k]
  ------------------
 1650|      0|    {
 1651|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
 1652|      0|        return (-1);
 1653|      0|    }
 1654|  10.8k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (1654:9): [True: 0, False: 10.8k]
  ------------------
 1655|      0|        return (-1);
 1656|  10.8k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  10.8k|    do                                                                         \
  |  |  148|  10.8k|    {                                                                          \
  |  |  149|  10.8k|        BitAcc = sp->data;                                                     \
  |  |  150|  10.8k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  10.8k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  10.8k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  10.8k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  10.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 10.8k]
  |  |  ------------------
  ------------------
 1657|  10.8k|    int start = sp->line;
 1658|   264k|    while (occ > 0)
  ------------------
  |  Branch (1658:12): [True: 263k, False: 292]
  ------------------
 1659|   263k|    {
 1660|   263k|        a0 = 0;
 1661|   263k|        RunLength = 0;
 1662|   263k|        pa = thisrun = sp->curruns;
 1663|   263k|        pb = sp->refruns;
 1664|   263k|        b1 = (int)*pb++;
 1665|       |#ifdef FAX3_DEBUG
 1666|       |        printf("\nBitAcc=%08" PRIX32 ", BitsAvail = %d\n", BitAcc, BitsAvail);
 1667|       |        printf("-------------------- %d\n", tif->tif_dir.td_row);
 1668|       |        fflush(stdout);
 1669|       |#endif
 1670|   263k|        EXPAND2D(EOFG4);
  ------------------
  |  |  463|   263k|    do                                                                         \
  |  |  464|   263k|    {                                                                          \
  |  |  465|   942k|        while (a0 < (int)lastx)                                                \
  |  |  ------------------
  |  |  |  Branch (465:16): [True: 696k, False: 245k]
  |  |  ------------------
  |  |  466|   696k|        {                                                                      \
  |  |  467|   696k|            if (pa >= thisrun + sp->nruns)                                     \
  |  |  ------------------
  |  |  |  Branch (467:17): [True: 247, False: 696k]
  |  |  ------------------
  |  |  468|   696k|            {                                                                  \
  |  |  469|    247|                TIFFErrorExtR(tif, module,                                     \
  |  |  470|    247|                              "Buffer overflow at line %d of %s %u", sp->line, \
  |  |  471|    247|                              isTiled(tif) ? "tile" : "strip",                 \
  |  |  ------------------
  |  |  |  |  278|    247|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    247|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 143, False: 104]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  472|    247|                              isTiled(tif) ? tif->tif_dir.td_curtile           \
  |  |  ------------------
  |  |  |  |  278|    247|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    247|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 143, False: 104]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  473|    247|                                           : tif->tif_dir.td_curstrip);        \
  |  |  474|    247|                return (-1);                                                   \
  |  |  475|    247|            }                                                                  \
  |  |  476|   696k|            LOOKUP8(7, TIFFFaxMainTable, eof2d);                               \
  |  |  ------------------
  |  |  |  |  247|   696k|    do                                                                         \
  |  |  |  |  248|   696k|    {                                                                          \
  |  |  |  |  249|   696k|        NeedBits8(wid, eoflab);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|   696k|    do                                                                         \
  |  |  |  |  |  |  145|   696k|    {                                                                          \
  |  |  |  |  |  |  146|   696k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:13): [True: 202k, False: 494k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  147|   696k|        {                                                                      \
  |  |  |  |  |  |  148|   202k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|   202k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 4.77k, False: 197k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  149|   202k|            {                                                                  \
  |  |  |  |  |  |  150|  4.77k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (150:21): [True: 59, False: 4.71k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  151|  4.77k|                    goto eoflab;                                               \
  |  |  |  |  |  |  152|  4.77k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  153|  4.71k|            }                                                                  \
  |  |  |  |  |  |  154|   202k|            else                                                               \
  |  |  |  |  |  |  155|   202k|            {                                                                  \
  |  |  |  |  |  |  156|   197k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  157|   197k|                BitsAvail += 8;                                                \
  |  |  |  |  |  |  158|   197k|            }                                                                  \
  |  |  |  |  |  |  159|   202k|        }                                                                      \
  |  |  |  |  |  |  160|   696k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (160:14): [Folded, False: 696k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  250|   696k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|   696k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  251|   696k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|   696k|    do                                                                         \
  |  |  |  |  |  |  197|   696k|    {                                                                          \
  |  |  |  |  |  |  198|   696k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|   696k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|   696k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 696k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  252|   696k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (252:14): [Folded, False: 696k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  477|   696k|            switch (TabEnt->State)                                             \
  |  |  478|   696k|            {                                                                  \
  |  |  479|  11.3k|                case S_Pass:                                                   \
  |  |  ------------------
  |  |  |  |   71|  11.3k|#define S_Pass 1
  |  |  ------------------
  |  |  |  Branch (479:17): [True: 11.3k, False: 685k]
  |  |  ------------------
  |  |  480|  11.3k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|  11.3k|    do                                                                         \
  |  |  |  |  441|  11.3k|    {                                                                          \
  |  |  |  |  442|  11.3k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 5.18k, False: 6.21k]
  |  |  |  |  ------------------
  |  |  |  |  443|  11.8k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 6.70k, False: 5.18k]
  |  |  |  |  |  Branch (443:32): [True: 6.70k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|  6.70k|            {                                                                  \
  |  |  |  |  445|  6.70k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 6.70k]
  |  |  |  |  ------------------
  |  |  |  |  446|  6.70k|                {                                                              \
  |  |  |  |  447|      0|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|      0|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|      0|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|      0|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|      0|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|      0|                    return (-1);                                               \
  |  |  |  |  453|      0|                }                                                              \
  |  |  |  |  454|  6.70k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  6.70k|                pb += 2;                                                       \
  |  |  |  |  456|  6.70k|            }                                                                  \
  |  |  |  |  457|  11.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 11.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  481|  11.3k|                    if (pb + 1 >= sp->refruns + sp->nruns)                     \
  |  |  ------------------
  |  |  |  Branch (481:25): [True: 328, False: 11.0k]
  |  |  ------------------
  |  |  482|  11.3k|                    {                                                          \
  |  |  483|    328|                        TIFFErrorExtR(                                         \
  |  |  484|    328|                            tif, module,                                       \
  |  |  485|    328|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  486|    328|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    328|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    328|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 132, False: 196]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  487|    328|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    328|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    328|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 132, False: 196]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|    328|                                         : tif->tif_dir.td_curstrip);          \
  |  |  489|    328|                        return (-1);                                           \
  |  |  490|    328|                    }                                                          \
  |  |  491|  11.3k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  492|  11.0k|                    RunLength =                                                \
  |  |  493|  11.0k|                        (int)((uint32_t)RunLength + (uint32_t)(b1 - a0));      \
  |  |  494|  11.0k|                    a0 = b1;                                                   \
  |  |  495|  11.0k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  496|  11.0k|                    break;                                                     \
  |  |  497|  73.1k|                case S_Horiz:                                                  \
  |  |  ------------------
  |  |  |  |   72|  73.1k|#define S_Horiz 2
  |  |  ------------------
  |  |  |  Branch (497:17): [True: 73.1k, False: 623k]
  |  |  ------------------
  |  |  498|  73.1k|                    if ((pa - thisrun) & 1)                                    \
  |  |  ------------------
  |  |  |  Branch (498:25): [True: 11.0k, False: 62.1k]
  |  |  ------------------
  |  |  499|  73.1k|                    {                                                          \
  |  |  500|  11.0k|                        for (;;)                                               \
  |  |  501|  11.0k|                        { /* black first */                                    \
  |  |  502|  11.0k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  11.0k|    do                                                                         \
  |  |  |  |  255|  11.0k|    {                                                                          \
  |  |  |  |  256|  11.0k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  11.0k|    do                                                                         \
  |  |  |  |  |  |  165|  11.0k|    {                                                                          \
  |  |  |  |  |  |  166|  11.0k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 10.9k, False: 131]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  11.0k|        {                                                                      \
  |  |  |  |  |  |  168|  10.9k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  10.9k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 43, False: 10.8k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  10.9k|            {                                                                  \
  |  |  |  |  |  |  170|     43|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 0, False: 43]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     43|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|     43|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|     43|            }                                                                  \
  |  |  |  |  |  |  174|  10.9k|            else                                                               \
  |  |  |  |  |  |  175|  10.9k|            {                                                                  \
  |  |  |  |  |  |  176|  10.8k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  10.8k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 357, False: 10.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  10.8k|                {                                                              \
  |  |  |  |  |  |  179|    357|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|    357|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 2, False: 355]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|    357|                    {                                                          \
  |  |  |  |  |  |  181|      2|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|      2|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|      2|                    }                                                          \
  |  |  |  |  |  |  184|    357|                    else                                                       \
  |  |  |  |  |  |  185|    357|                    {                                                          \
  |  |  |  |  |  |  186|    355|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|    355|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|    355|                    }                                                          \
  |  |  |  |  |  |  189|    357|                }                                                              \
  |  |  |  |  |  |  190|  10.8k|            }                                                                  \
  |  |  |  |  |  |  191|  10.9k|        }                                                                      \
  |  |  |  |  |  |  192|  11.0k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 11.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  11.0k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  11.0k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  11.0k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  11.0k|    do                                                                         \
  |  |  |  |  |  |  197|  11.0k|    {                                                                          \
  |  |  |  |  |  |  198|  11.0k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  11.0k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  11.0k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 11.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  11.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 11.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  503|  11.0k|                            switch (TabEnt->State)                             \
  |  |  504|  11.0k|                            {                                                  \
  |  |  505|  10.9k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|  10.9k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (505:33): [True: 10.9k, False: 75]
  |  |  ------------------
  |  |  506|  10.9k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  10.9k|    do                                                                         \
  |  |  |  |  267|  10.9k|    {                                                                          \
  |  |  |  |  268|  10.9k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 10.9k]
  |  |  |  |  ------------------
  |  |  |  |  269|  10.9k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  10.9k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  10.9k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  10.9k|        RunLength = 0;                                                         \
  |  |  |  |  279|  10.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 10.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  507|  10.9k|                                    goto doneWhite2da;                         \
  |  |  508|  10.9k|                                case S_MakeUpB:                                \
  |  |  ------------------
  |  |  |  |   80|      0|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (508:33): [True: 0, False: 11.0k]
  |  |  ------------------
  |  |  509|      0|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|      0|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (509:33): [True: 0, False: 11.0k]
  |  |  ------------------
  |  |  510|      0|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  511|      0|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  512|      0|                                                      TabEnt->Param);          \
  |  |  513|      0|                                    break;                                     \
  |  |  514|     75|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (514:33): [True: 75, False: 10.9k]
  |  |  ------------------
  |  |  515|     75|                                    goto badBlack2d;                           \
  |  |  516|  11.0k|                            }                                                  \
  |  |  517|  11.0k|                        }                                                      \
  |  |  518|  11.0k|                    doneWhite2da:;                                             \
  |  |  519|  10.9k|                        for (;;)                                               \
  |  |  520|  28.1k|                        { /* then white */                                     \
  |  |  521|  28.1k|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  28.1k|    do                                                                         \
  |  |  |  |  255|  28.1k|    {                                                                          \
  |  |  |  |  256|  28.1k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  28.1k|    do                                                                         \
  |  |  |  |  |  |  165|  28.1k|    {                                                                          \
  |  |  |  |  |  |  166|  28.1k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 16.7k, False: 11.4k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  28.1k|        {                                                                      \
  |  |  |  |  |  |  168|  16.7k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  16.7k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 467, False: 16.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  16.7k|            {                                                                  \
  |  |  |  |  |  |  170|    467|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 271, False: 196]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    467|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    467|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    196|            }                                                                  \
  |  |  |  |  |  |  174|  16.7k|            else                                                               \
  |  |  |  |  |  |  175|  16.7k|            {                                                                  \
  |  |  |  |  |  |  176|  16.2k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  16.2k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 1.23k, False: 15.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  16.2k|                {                                                              \
  |  |  |  |  |  |  179|  1.23k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  1.23k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 35, False: 1.19k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  1.23k|                    {                                                          \
  |  |  |  |  |  |  181|     35|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|     35|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|     35|                    }                                                          \
  |  |  |  |  |  |  184|  1.23k|                    else                                                       \
  |  |  |  |  |  |  185|  1.23k|                    {                                                          \
  |  |  |  |  |  |  186|  1.19k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  1.19k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  1.19k|                    }                                                          \
  |  |  |  |  |  |  189|  1.23k|                }                                                              \
  |  |  |  |  |  |  190|  16.2k|            }                                                                  \
  |  |  |  |  |  |  191|  16.7k|        }                                                                      \
  |  |  |  |  |  |  192|  28.1k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 27.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  28.1k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  27.8k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  27.8k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  27.8k|    do                                                                         \
  |  |  |  |  |  |  197|  27.8k|    {                                                                          \
  |  |  |  |  |  |  198|  27.8k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  27.8k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  27.8k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 27.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  27.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 27.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  522|  28.1k|                            switch (TabEnt->State)                             \
  |  |  523|  27.8k|                            {                                                  \
  |  |  524|  9.66k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|  9.66k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (524:33): [True: 9.66k, False: 18.2k]
  |  |  ------------------
  |  |  525|  9.66k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  9.66k|    do                                                                         \
  |  |  |  |  267|  9.66k|    {                                                                          \
  |  |  |  |  268|  9.66k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 343, False: 9.32k]
  |  |  |  |  ------------------
  |  |  |  |  269|  9.66k|        {                                                                      \
  |  |  |  |  270|    343|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|    343|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    343|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    343|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 192, False: 151]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|    343|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|    343|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|    343|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 192, False: 151]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|    343|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|    343|            return (-1);                                                       \
  |  |  |  |  275|    343|        }                                                                      \
  |  |  |  |  276|  9.66k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  9.32k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  9.32k|        RunLength = 0;                                                         \
  |  |  |  |  279|  9.32k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 9.32k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  526|  9.66k|                                    goto doneBlack2da;                         \
  |  |  527|  15.1k|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|  15.1k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (527:33): [True: 15.1k, False: 12.7k]
  |  |  ------------------
  |  |  528|  17.1k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  17.1k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (528:33): [True: 2.02k, False: 25.8k]
  |  |  ------------------
  |  |  529|  17.1k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  530|  17.1k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  531|  17.1k|                                                      TabEnt->Param);          \
  |  |  532|  17.1k|                                    break;                                     \
  |  |  533|  15.1k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (533:33): [True: 1.04k, False: 26.8k]
  |  |  ------------------
  |  |  534|  1.04k|                                    goto badWhite2d;                           \
  |  |  535|  27.8k|                            }                                                  \
  |  |  536|  27.8k|                        }                                                      \
  |  |  537|  10.9k|                    doneBlack2da:;                                             \
  |  |  538|  9.32k|                    }                                                          \
  |  |  539|  73.1k|                    else                                                       \
  |  |  540|  73.1k|                    {                                                          \
  |  |  541|  62.1k|                        for (;;)                                               \
  |  |  542|  86.8k|                        { /* white first */                                    \
  |  |  543|  86.8k|                            LOOKUP16(12, TIFFFaxWhiteTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  86.8k|    do                                                                         \
  |  |  |  |  255|  86.8k|    {                                                                          \
  |  |  |  |  256|  86.8k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  86.8k|    do                                                                         \
  |  |  |  |  |  |  165|  86.8k|    {                                                                          \
  |  |  |  |  |  |  166|  86.8k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 83.3k, False: 3.55k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  86.8k|        {                                                                      \
  |  |  |  |  |  |  168|  83.3k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  83.3k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 687, False: 82.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  83.3k|            {                                                                  \
  |  |  |  |  |  |  170|    687|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 0, False: 687]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    687|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    687|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    687|            }                                                                  \
  |  |  |  |  |  |  174|  83.3k|            else                                                               \
  |  |  |  |  |  |  175|  83.3k|            {                                                                  \
  |  |  |  |  |  |  176|  82.6k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  82.6k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 9, False: 82.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  82.6k|                {                                                              \
  |  |  |  |  |  |  179|      9|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|      9|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 0, False: 9]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|      9|                    {                                                          \
  |  |  |  |  |  |  181|      0|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|      0|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|      0|                    }                                                          \
  |  |  |  |  |  |  184|      9|                    else                                                       \
  |  |  |  |  |  |  185|      9|                    {                                                          \
  |  |  |  |  |  |  186|      9|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|      9|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|      9|                    }                                                          \
  |  |  |  |  |  |  189|      9|                }                                                              \
  |  |  |  |  |  |  190|  82.6k|            }                                                                  \
  |  |  |  |  |  |  191|  83.3k|        }                                                                      \
  |  |  |  |  |  |  192|  86.8k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 86.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  86.8k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  86.8k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  86.8k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  86.8k|    do                                                                         \
  |  |  |  |  |  |  197|  86.8k|    {                                                                          \
  |  |  |  |  |  |  198|  86.8k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  86.8k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  86.8k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 86.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  86.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 86.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  544|  86.8k|                            switch (TabEnt->State)                             \
  |  |  545|  86.8k|                            {                                                  \
  |  |  546|  61.8k|                                case S_TermW:                                  \
  |  |  ------------------
  |  |  |  |   77|  61.8k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (546:33): [True: 61.8k, False: 25.0k]
  |  |  ------------------
  |  |  547|  61.8k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  61.8k|    do                                                                         \
  |  |  |  |  267|  61.8k|    {                                                                          \
  |  |  |  |  268|  61.8k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 61.8k]
  |  |  |  |  ------------------
  |  |  |  |  269|  61.8k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  61.8k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  61.8k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  61.8k|        RunLength = 0;                                                         \
  |  |  |  |  279|  61.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 61.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  548|  61.8k|                                    goto doneWhite2db;                         \
  |  |  549|  61.8k|                                case S_MakeUpW:                                \
  |  |  ------------------
  |  |  |  |   79|  24.2k|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (549:33): [True: 24.2k, False: 62.6k]
  |  |  ------------------
  |  |  550|  24.7k|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|  24.7k|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (550:33): [True: 541, False: 86.3k]
  |  |  ------------------
  |  |  551|  24.7k|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  552|  24.7k|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  553|  24.7k|                                                      TabEnt->Param);          \
  |  |  554|  24.7k|                                    break;                                     \
  |  |  555|  24.2k|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (555:33): [True: 248, False: 86.6k]
  |  |  ------------------
  |  |  556|    248|                                    goto badWhite2d;                           \
  |  |  557|  86.8k|                            }                                                  \
  |  |  558|  86.8k|                        }                                                      \
  |  |  559|  62.1k|                    doneWhite2db:;                                             \
  |  |  560|  61.8k|                        for (;;)                                               \
  |  |  561|  62.1k|                        { /* then black */                                     \
  |  |  562|  62.1k|                            LOOKUP16(13, TIFFFaxBlackTable, eof2d);            \
  |  |  ------------------
  |  |  |  |  254|  62.1k|    do                                                                         \
  |  |  |  |  255|  62.1k|    {                                                                          \
  |  |  |  |  256|  62.1k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  62.1k|    do                                                                         \
  |  |  |  |  |  |  165|  62.1k|    {                                                                          \
  |  |  |  |  |  |  166|  62.1k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 26.8k, False: 35.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  62.1k|        {                                                                      \
  |  |  |  |  |  |  168|  26.8k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  26.8k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 412, False: 26.4k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  26.8k|            {                                                                  \
  |  |  |  |  |  |  170|    412|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 0, False: 412]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    412|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    412|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    412|            }                                                                  \
  |  |  |  |  |  |  174|  26.8k|            else                                                               \
  |  |  |  |  |  |  175|  26.8k|            {                                                                  \
  |  |  |  |  |  |  176|  26.4k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  26.4k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 811, False: 25.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  26.4k|                {                                                              \
  |  |  |  |  |  |  179|    811|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|    811|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 0, False: 811]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|    811|                    {                                                          \
  |  |  |  |  |  |  181|      0|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|      0|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|      0|                    }                                                          \
  |  |  |  |  |  |  184|    811|                    else                                                       \
  |  |  |  |  |  |  185|    811|                    {                                                          \
  |  |  |  |  |  |  186|    811|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|    811|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|    811|                    }                                                          \
  |  |  |  |  |  |  189|    811|                }                                                              \
  |  |  |  |  |  |  190|  26.4k|            }                                                                  \
  |  |  |  |  |  |  191|  26.8k|        }                                                                      \
  |  |  |  |  |  |  192|  62.1k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 62.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  62.1k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  62.1k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  62.1k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  62.1k|    do                                                                         \
  |  |  |  |  |  |  197|  62.1k|    {                                                                          \
  |  |  |  |  |  |  198|  62.1k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  62.1k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  62.1k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 62.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  62.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 62.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  563|  62.1k|                            switch (TabEnt->State)                             \
  |  |  564|  62.1k|                            {                                                  \
  |  |  565|  61.2k|                                case S_TermB:                                  \
  |  |  ------------------
  |  |  |  |   78|  61.2k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (565:33): [True: 61.2k, False: 923]
  |  |  ------------------
  |  |  566|  61.2k|                                    SETVALUE(TabEnt->Param);                   \
  |  |  ------------------
  |  |  |  |  266|  61.2k|    do                                                                         \
  |  |  |  |  267|  61.2k|    {                                                                          \
  |  |  |  |  268|  61.2k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 61.2k]
  |  |  |  |  ------------------
  |  |  |  |  269|  61.2k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  61.2k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  61.2k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  61.2k|        RunLength = 0;                                                         \
  |  |  |  |  279|  61.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 61.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  567|  61.2k|                                    goto doneBlack2db;                         \
  |  |  568|  61.2k|                                case S_MakeUpB:                                \
  |  |  ------------------
  |  |  |  |   80|    120|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (568:33): [True: 120, False: 62.0k]
  |  |  ------------------
  |  |  569|    280|                                case S_MakeUp:                                 \
  |  |  ------------------
  |  |  |  |   81|    280|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (569:33): [True: 160, False: 62.0k]
  |  |  ------------------
  |  |  570|    280|                                    a0 = (int)((uint32_t)a0 + TabEnt->Param);  \
  |  |  571|    280|                                    RunLength = (int)((uint32_t)RunLength +    \
  |  |  572|    280|                                                      TabEnt->Param);          \
  |  |  573|    280|                                    break;                                     \
  |  |  574|    643|                                default:                                       \
  |  |  ------------------
  |  |  |  Branch (574:33): [True: 643, False: 61.5k]
  |  |  ------------------
  |  |  575|    643|                                    goto badBlack2d;                           \
  |  |  576|  62.1k|                            }                                                  \
  |  |  577|  62.1k|                        }                                                      \
  |  |  578|  61.8k|                    doneBlack2db:;                                             \
  |  |  579|  61.2k|                    }                                                          \
  |  |  580|  73.1k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|  70.5k|    do                                                                         \
  |  |  |  |  441|  70.5k|    {                                                                          \
  |  |  |  |  442|  70.5k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 70.5k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  443|  93.8k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 77.2k, False: 16.6k]
  |  |  |  |  |  Branch (443:32): [True: 23.2k, False: 53.9k]
  |  |  |  |  ------------------
  |  |  |  |  444|  70.5k|            {                                                                  \
  |  |  |  |  445|  23.2k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 23.2k]
  |  |  |  |  ------------------
  |  |  |  |  446|  23.2k|                {                                                              \
  |  |  |  |  447|      0|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|      0|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|      0|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|      0|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|      0|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|      0|                    return (-1);                                               \
  |  |  |  |  453|      0|                }                                                              \
  |  |  |  |  454|  23.2k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  23.2k|                pb += 2;                                                       \
  |  |  |  |  456|  23.2k|            }                                                                  \
  |  |  |  |  457|  70.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 70.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  581|  70.5k|                    break;                                                     \
  |  |  582|   223k|                case S_V0:                                                     \
  |  |  ------------------
  |  |  |  |   73|   223k|#define S_V0 3
  |  |  ------------------
  |  |  |  Branch (582:17): [True: 223k, False: 472k]
  |  |  ------------------
  |  |  583|   223k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   223k|    do                                                                         \
  |  |  |  |  441|   223k|    {                                                                          \
  |  |  |  |  442|   223k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 99.8k, False: 123k]
  |  |  |  |  ------------------
  |  |  |  |  443|   223k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 28.7k, False: 99.8k]
  |  |  |  |  |  Branch (443:32): [True: 28.7k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|  99.8k|            {                                                                  \
  |  |  |  |  445|  28.7k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 28.7k]
  |  |  |  |  ------------------
  |  |  |  |  446|  28.7k|                {                                                              \
  |  |  |  |  447|      0|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|      0|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|      0|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|      0|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|      0|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|      0|                    return (-1);                                               \
  |  |  |  |  453|      0|                }                                                              \
  |  |  |  |  454|  28.7k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  28.7k|                pb += 2;                                                       \
  |  |  |  |  456|  28.7k|            }                                                                  \
  |  |  |  |  457|   223k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 223k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  584|   223k|                    SETVALUE(b1 - a0);                                         \
  |  |  ------------------
  |  |  |  |  266|   223k|    do                                                                         \
  |  |  |  |  267|   223k|    {                                                                          \
  |  |  |  |  268|   223k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 223k]
  |  |  |  |  ------------------
  |  |  |  |  269|   223k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   223k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   223k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   223k|        RunLength = 0;                                                         \
  |  |  |  |  279|   223k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 223k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  585|   223k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (585:25): [True: 153, False: 223k]
  |  |  ------------------
  |  |  586|   223k|                    {                                                          \
  |  |  587|    153|                        TIFFErrorExtR(                                         \
  |  |  588|    153|                            tif, module,                                       \
  |  |  589|    153|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  590|    153|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    153|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    153|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 139, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  591|    153|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    153|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    153|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 139, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  592|    153|                                         : tif->tif_dir.td_curstrip);          \
  |  |  593|    153|                        return (-1);                                           \
  |  |  594|    153|                    }                                                          \
  |  |  595|   223k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  596|   223k|                    break;                                                     \
  |  |  597|   223k|                case S_VR:                                                     \
  |  |  ------------------
  |  |  |  |   74|   116k|#define S_VR 4
  |  |  ------------------
  |  |  |  Branch (597:17): [True: 116k, False: 580k]
  |  |  ------------------
  |  |  598|   116k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   116k|    do                                                                         \
  |  |  |  |  441|   116k|    {                                                                          \
  |  |  |  |  442|   116k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 68.4k, False: 47.5k]
  |  |  |  |  ------------------
  |  |  |  |  443|   116k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 38.0k, False: 68.4k]
  |  |  |  |  |  Branch (443:32): [True: 38.0k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|  68.4k|            {                                                                  \
  |  |  |  |  445|  38.0k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 38.0k]
  |  |  |  |  ------------------
  |  |  |  |  446|  38.0k|                {                                                              \
  |  |  |  |  447|      0|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|      0|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|      0|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|      0|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|      0|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|      0|                    return (-1);                                               \
  |  |  |  |  453|      0|                }                                                              \
  |  |  |  |  454|  38.0k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|  38.0k|                pb += 2;                                                       \
  |  |  |  |  456|  38.0k|            }                                                                  \
  |  |  |  |  457|   116k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 116k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  599|   116k|                    SETVALUE((int)((uint32_t)(b1 - a0) + TabEnt->Param));      \
  |  |  ------------------
  |  |  |  |  266|   116k|    do                                                                         \
  |  |  |  |  267|   116k|    {                                                                          \
  |  |  |  |  268|   116k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 116k]
  |  |  |  |  ------------------
  |  |  |  |  269|   116k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   116k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   116k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   116k|        RunLength = 0;                                                         \
  |  |  |  |  279|   116k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 116k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  600|   116k|                    if (pb >= sp->refruns + sp->nruns)                         \
  |  |  ------------------
  |  |  |  Branch (600:25): [True: 202, False: 115k]
  |  |  ------------------
  |  |  601|   116k|                    {                                                          \
  |  |  602|    202|                        TIFFErrorExtR(                                         \
  |  |  603|    202|                            tif, module,                                       \
  |  |  604|    202|                            "Buffer overflow at line %d of %s %u", sp->line,   \
  |  |  605|    202|                            isTiled(tif) ? "tile" : "strip",                   \
  |  |  ------------------
  |  |  |  |  278|    202|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    202|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 139, False: 63]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  606|    202|                            isTiled(tif) ? tif->tif_dir.td_curtile             \
  |  |  ------------------
  |  |  |  |  278|    202|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    202|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 139, False: 63]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  607|    202|                                         : tif->tif_dir.td_curstrip);          \
  |  |  608|    202|                        return (-1);                                           \
  |  |  609|    202|                    }                                                          \
  |  |  610|   116k|                    b1 = b1 + (int)*pb++;                                      \
  |  |  611|   115k|                    break;                                                     \
  |  |  612|   259k|                case S_VL:                                                     \
  |  |  ------------------
  |  |  |  |   75|   259k|#define S_VL 5
  |  |  ------------------
  |  |  |  Branch (612:17): [True: 259k, False: 437k]
  |  |  ------------------
  |  |  613|   259k|                    CHECK_b1;                                                  \
  |  |  ------------------
  |  |  |  |  440|   259k|    do                                                                         \
  |  |  |  |  441|   259k|    {                                                                          \
  |  |  |  |  442|   259k|        if (pa != thisrun)                                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (442:13): [True: 235k, False: 23.4k]
  |  |  |  |  ------------------
  |  |  |  |  443|   353k|            while (b1 <= a0 && b1 < (int)lastx)                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (443:20): [True: 117k, False: 235k]
  |  |  |  |  |  Branch (443:32): [True: 117k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  444|   235k|            {                                                                  \
  |  |  |  |  445|   117k|                if (pb + 1 >= sp->refruns + sp->nruns)                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (445:21): [True: 0, False: 117k]
  |  |  |  |  ------------------
  |  |  |  |  446|   117k|                {                                                              \
  |  |  |  |  447|      0|                    TIFFErrorExtR(tif, module,                                 \
  |  |  |  |  448|      0|                                  "Buffer overflow at line %d of %s %u",       \
  |  |  |  |  449|      0|                                  sp->line, isTiled(tif) ? "tile" : "strip",   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  450|      0|                                  isTiled(tif) ? tif->tif_dir.td_curtile       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  451|      0|                                               : tif->tif_dir.td_curstrip);    \
  |  |  |  |  452|      0|                    return (-1);                                               \
  |  |  |  |  453|      0|                }                                                              \
  |  |  |  |  454|   117k|                b1 += (int)(pb[0] + pb[1]);                                    \
  |  |  |  |  455|   117k|                pb += 2;                                                       \
  |  |  |  |  456|   117k|            }                                                                  \
  |  |  |  |  457|   259k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (457:14): [Folded, False: 259k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  614|   259k|                    if (b1 < (int)((uint32_t)a0 + TabEnt->Param))              \
  |  |  ------------------
  |  |  |  Branch (614:25): [True: 2.05k, False: 257k]
  |  |  ------------------
  |  |  615|   259k|                    {                                                          \
  |  |  616|  2.05k|                        unexpected("VL", a0);                                  \
  |  |  ------------------
  |  |  |  |  220|  2.05k|    do                                                                         \
  |  |  |  |  221|  2.05k|    {                                                                          \
  |  |  |  |  222|  2.05k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  2.05k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  2.05k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 2.05k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  617|  2.05k|                        goto eol2d;                                            \
  |  |  618|  2.05k|                    }                                                          \
  |  |  619|   259k|                    SETVALUE((int)((uint32_t)(b1 - a0) - TabEnt->Param));      \
  |  |  ------------------
  |  |  |  |  266|   257k|    do                                                                         \
  |  |  |  |  267|   257k|    {                                                                          \
  |  |  |  |  268|   257k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 257k]
  |  |  |  |  ------------------
  |  |  |  |  269|   257k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|   257k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|   257k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|   257k|        RunLength = 0;                                                         \
  |  |  |  |  279|   257k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 257k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  620|   257k|                    b1 = b1 - (int)*--pb;                                      \
  |  |  621|   257k|                    break;                                                     \
  |  |  622|   257k|                case S_Ext:                                                    \
  |  |  ------------------
  |  |  |  |   76|  5.11k|#define S_Ext 6
  |  |  ------------------
  |  |  |  Branch (622:17): [True: 5.11k, False: 691k]
  |  |  ------------------
  |  |  623|  5.11k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  624|  5.11k|                    extension(a0);                                             \
  |  |  ------------------
  |  |  |  |  238|  5.11k|    Fax3Extension(module, tif, (uint32_t)sp->line, (uint32_t)(a0))
  |  |  ------------------
  |  |  625|  5.11k|                    goto eol2d;                                                \
  |  |  626|   257k|                case S_EOL:                                                    \
  |  |  ------------------
  |  |  |  |   82|  7.83k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (626:17): [True: 7.83k, False: 688k]
  |  |  ------------------
  |  |  627|  7.83k|                    *pa++ = (uint32_t)((int)lastx - a0);                       \
  |  |  628|  7.83k|                    NeedBits8(4, eof2d);                                       \
  |  |  ------------------
  |  |  |  |  144|  7.83k|    do                                                                         \
  |  |  |  |  145|  7.83k|    {                                                                          \
  |  |  |  |  146|  7.83k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 6.40k, False: 1.43k]
  |  |  |  |  ------------------
  |  |  |  |  147|  7.83k|        {                                                                      \
  |  |  |  |  148|  6.40k|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|  6.40k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 2.12k, False: 4.28k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|  6.40k|            {                                                                  \
  |  |  |  |  150|  2.12k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 1.86k, False: 263]
  |  |  |  |  ------------------
  |  |  |  |  151|  2.12k|                    goto eoflab;                                               \
  |  |  |  |  152|  2.12k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|    263|            }                                                                  \
  |  |  |  |  154|  6.40k|            else                                                               \
  |  |  |  |  155|  6.40k|            {                                                                  \
  |  |  |  |  156|  4.28k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|  4.28k|                BitsAvail += 8;                                                \
  |  |  |  |  158|  4.28k|            }                                                                  \
  |  |  |  |  159|  6.40k|        }                                                                      \
  |  |  |  |  160|  7.83k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 5.97k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  629|  7.83k|                    if (GetBits(4))                                            \
  |  |  ------------------
  |  |  |  |  194|  5.97k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (194:20): [True: 2.27k, False: 3.70k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  630|  5.97k|                        unexpected("EOL", a0);                                 \
  |  |  ------------------
  |  |  |  |  220|  2.27k|    do                                                                         \
  |  |  |  |  221|  2.27k|    {                                                                          \
  |  |  |  |  222|  2.27k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  2.27k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  2.27k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 2.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  631|  5.97k|                    ClrBits(4);                                                \
  |  |  ------------------
  |  |  |  |  196|  5.97k|    do                                                                         \
  |  |  |  |  197|  5.97k|    {                                                                          \
  |  |  |  |  198|  5.97k|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|  5.97k|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|  5.97k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 5.97k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  632|  5.97k|                    EOLcnt = 1;                                                \
  |  |  633|  5.97k|                    goto eol2d;                                                \
  |  |  634|  7.83k|                default:                                                       \
  |  |  ------------------
  |  |  |  Branch (634:17): [True: 0, False: 696k]
  |  |  ------------------
  |  |  635|      0|                badMain2d:                                                     \
  |  |  636|      0|                    unexpected("MainTable", a0);                               \
  |  |  ------------------
  |  |  |  |  220|      0|    do                                                                         \
  |  |  |  |  221|      0|    {                                                                          \
  |  |  |  |  222|      0|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|      0|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  637|      0|                    goto eol2d;                                                \
  |  |  638|    718|                badBlack2d:                                                    \
  |  |  639|    718|                    unexpected("BlackTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|    718|    do                                                                         \
  |  |  |  |  221|    718|    {                                                                          \
  |  |  |  |  222|    718|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|    718|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|    718|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 718]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  640|    718|                    goto eol2d;                                                \
  |  |  641|  1.29k|                badWhite2d:                                                    \
  |  |  642|  1.29k|                    unexpected("WhiteTable", a0);                              \
  |  |  ------------------
  |  |  |  |  220|  1.29k|    do                                                                         \
  |  |  |  |  221|  1.29k|    {                                                                          \
  |  |  |  |  222|  1.29k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|  1.29k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|  1.29k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 1.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  643|  1.29k|                    goto eol2d;                                                \
  |  |  644|  2.19k|                eof2d:                                                         \
  |  |  645|  2.19k|                    prematureEOF(a0);                                          \
  |  |  ------------------
  |  |  |  |  271|  2.19k|    do                                                                         \
  |  |  |  |  272|  2.19k|    {                                                                          \
  |  |  |  |  273|  2.19k|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|  2.19k|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|  2.19k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 2.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  646|  2.19k|                    CLEANUP_RUNS();                                            \
  |  |  ------------------
  |  |  |  |  333|  2.19k|    do                                                                         \
  |  |  |  |  334|  2.19k|    {                                                                          \
  |  |  |  |  335|  2.19k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 273, False: 1.91k]
  |  |  |  |  ------------------
  |  |  |  |  336|  2.19k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    273|    do                                                                         \
  |  |  |  |  |  |  267|    273|    {                                                                          \
  |  |  |  |  |  |  268|    273|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 213, False: 60]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    273|        {                                                                      \
  |  |  |  |  |  |  270|    213|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    213|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    213|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    213|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 132, False: 81]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    213|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    213|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    213|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 132, False: 81]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    213|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    213|            return (-1);                                                       \
  |  |  |  |  |  |  275|    213|        }                                                                      \
  |  |  |  |  |  |  276|    273|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|     60|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|     60|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|     60|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 60]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|  2.19k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 1.97k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  338|  1.97k|        {                                                                      \
  |  |  |  |  339|  1.97k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|  1.97k|    do                                                                         \
  |  |  |  |  |  |  254|  1.97k|    {                                                                          \
  |  |  |  |  |  |  255|  1.97k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|  1.97k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|  1.97k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|  1.97k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 1.97k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|  2.07k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 102, False: 1.97k]
  |  |  |  |  |  Branch (340:39): [True: 102, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|  1.97k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|  1.97k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 1.97k, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  343|  1.97k|            {                                                                  \
  |  |  |  |  344|  1.97k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 1.97k]
  |  |  |  |  ------------------
  |  |  |  |  345|  1.97k|                    a0 = 0;                                                    \
  |  |  |  |  346|  1.97k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 1.24k, False: 736]
  |  |  |  |  ------------------
  |  |  |  |  347|  1.97k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  1.24k|    do                                                                         \
  |  |  |  |  |  |  267|  1.24k|    {                                                                          \
  |  |  |  |  |  |  268|  1.24k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 1.24k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  1.24k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  1.24k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  1.24k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  1.24k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  1.24k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 1.24k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|  1.97k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  1.97k|    do                                                                         \
  |  |  |  |  |  |  267|  1.97k|    {                                                                          \
  |  |  |  |  |  |  268|  1.97k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 220, False: 1.75k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  1.97k|        {                                                                      \
  |  |  |  |  |  |  270|    220|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    220|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    220|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    220|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 142, False: 78]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    220|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    220|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    220|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 142, False: 78]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    220|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    220|            return (-1);                                                       \
  |  |  |  |  |  |  275|    220|        }                                                                      \
  |  |  |  |  |  |  276|  1.97k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  1.75k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  1.75k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  1.75k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 1.75k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|  1.97k|            }                                                                  \
  |  |  |  |  350|  1.97k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  351|      1|            {                                                                  \
  |  |  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  354|      0|            }                                                                  \
  |  |  |  |  355|  1.97k|        }                                                                      \
  |  |  |  |  356|  1.97k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 1.75k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  647|  2.19k|                    goto eoflab;                                               \
  |  |  648|   696k|            }                                                                  \
  |  |  649|   696k|        }                                                                      \
  |  |  650|   263k|        if (RunLength)                                                         \
  |  |  ------------------
  |  |  |  Branch (650:13): [True: 9.08k, False: 236k]
  |  |  ------------------
  |  |  651|   245k|        {                                                                      \
  |  |  652|  9.08k|            if (RunLength + a0 < lastx)                                        \
  |  |  ------------------
  |  |  |  Branch (652:17): [True: 0, False: 9.08k]
  |  |  ------------------
  |  |  653|  9.08k|            {                                                                  \
  |  |  654|      0|                /* expect a final V0 */                                        \
  |  |  655|      0|                NeedBits8(1, eof2d);                                           \
  |  |  ------------------
  |  |  |  |  144|      0|    do                                                                         \
  |  |  |  |  145|      0|    {                                                                          \
  |  |  |  |  146|      0|        if (BitsAvail < (n))                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  147|      0|        {                                                                      \
  |  |  |  |  148|      0|            if (EndOfData())                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      0|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (117:21): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  149|      0|            {                                                                  \
  |  |  |  |  150|      0|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (150:21): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  151|      0|                    goto eoflab;                                               \
  |  |  |  |  152|      0|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  153|      0|            }                                                                  \
  |  |  |  |  154|      0|            else                                                               \
  |  |  |  |  155|      0|            {                                                                  \
  |  |  |  |  156|      0|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  157|      0|                BitsAvail += 8;                                                \
  |  |  |  |  158|      0|            }                                                                  \
  |  |  |  |  159|      0|        }                                                                      \
  |  |  |  |  160|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (160:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  656|      0|                if (!GetBits(1))                                               \
  |  |  ------------------
  |  |  |  |  194|      0|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  ------------------
  |  |  |  Branch (656:21): [True: 0, False: 0]
  |  |  ------------------
  |  |  657|      0|                    goto badMain2d;                                            \
  |  |  658|      0|                ClrBits(1);                                                    \
  |  |  ------------------
  |  |  |  |  196|      0|    do                                                                         \
  |  |  |  |  197|      0|    {                                                                          \
  |  |  |  |  198|      0|        BitsAvail -= (n);                                                      \
  |  |  |  |  199|      0|        BitAcc >>= (n);                                                        \
  |  |  |  |  200|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (200:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  659|      0|            }                                                                  \
  |  |  660|  9.08k|            SETVALUE(0);                                                       \
  |  |  ------------------
  |  |  |  |  266|  9.08k|    do                                                                         \
  |  |  |  |  267|  9.08k|    {                                                                          \
  |  |  |  |  268|  9.08k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 9.08k]
  |  |  |  |  ------------------
  |  |  |  |  269|  9.08k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  9.08k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  9.08k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  9.08k|        RunLength = 0;                                                         \
  |  |  |  |  279|  9.08k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 9.08k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  661|  9.08k|        }                                                                      \
  |  |  662|   260k|    eol2d:                                                                     \
  |  |  663|   260k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   260k|    do                                                                         \
  |  |  |  |  334|   260k|    {                                                                          \
  |  |  |  |  335|   260k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 1.17k, False: 259k]
  |  |  |  |  ------------------
  |  |  |  |  336|   260k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  1.17k|    do                                                                         \
  |  |  |  |  |  |  267|  1.17k|    {                                                                          \
  |  |  |  |  |  |  268|  1.17k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 672, False: 504]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  1.17k|        {                                                                      \
  |  |  |  |  |  |  270|    672|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    672|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    672|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    672|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 149, False: 523]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    672|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    672|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    672|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 149, False: 523]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    672|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    672|            return (-1);                                                       \
  |  |  |  |  |  |  275|    672|        }                                                                      \
  |  |  |  |  |  |  276|  1.17k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    504|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    504|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    504|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 504]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   260k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 127k, False: 132k]
  |  |  |  |  ------------------
  |  |  |  |  338|   259k|        {                                                                      \
  |  |  |  |  339|   127k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   127k|    do                                                                         \
  |  |  |  |  |  |  254|   127k|    {                                                                          \
  |  |  |  |  |  |  255|   127k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   127k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   127k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   127k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 127k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   286k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 159k, False: 127k]
  |  |  |  |  |  Branch (340:39): [True: 159k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   159k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   127k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 126k, False: 1.02k]
  |  |  |  |  ------------------
  |  |  |  |  343|   127k|            {                                                                  \
  |  |  |  |  344|   126k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 126k]
  |  |  |  |  ------------------
  |  |  |  |  345|   126k|                    a0 = 0;                                                    \
  |  |  |  |  346|   126k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 39.9k, False: 86.1k]
  |  |  |  |  ------------------
  |  |  |  |  347|   126k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  39.9k|    do                                                                         \
  |  |  |  |  |  |  267|  39.9k|    {                                                                          \
  |  |  |  |  |  |  268|  39.9k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 39.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  39.9k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  39.9k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  39.9k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  39.9k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  39.9k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 39.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   126k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   126k|    do                                                                         \
  |  |  |  |  |  |  267|   126k|    {                                                                          \
  |  |  |  |  |  |  268|   126k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 139, False: 125k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   126k|        {                                                                      \
  |  |  |  |  |  |  270|    139|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|    139|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    139|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    139|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 139, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|    139|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|    139|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|    139|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 139, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|    139|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|    139|            return (-1);                                                       \
  |  |  |  |  |  |  275|    139|        }                                                                      \
  |  |  |  |  |  |  276|   126k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   125k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   125k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   125k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 125k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   126k|            }                                                                  \
  |  |  |  |  350|   127k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 1.02k]
  |  |  |  |  ------------------
  |  |  |  |  351|  1.02k|            {                                                                  \
  |  |  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  354|      0|            }                                                                  \
  |  |  |  |  355|   127k|        }                                                                      \
  |  |  |  |  356|   259k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 259k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  664|   260k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (664:14): [Folded, False: 259k]
  |  |  ------------------
  ------------------
 1671|   259k|        if (EOLcnt)
  ------------------
  |  Branch (1671:13): [True: 5.97k, False: 253k]
  ------------------
 1672|  5.97k|            goto EOFG4;
 1673|   253k|        if (((lastx + 7) >> 3) > (int)occ) /* check for buffer overrun */
  ------------------
  |  Branch (1673:13): [True: 0, False: 253k]
  ------------------
 1674|      0|        {
 1675|      0|            TIFFErrorExtR(tif, module,
 1676|      0|                          "Buffer overrun detected : %" TIFF_SSIZE_FORMAT
 1677|      0|                          " bytes available, %d bits needed",
 1678|      0|                          occ, lastx);
 1679|      0|            return -1;
 1680|      0|        }
 1681|   253k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1682|   253k|        SETVALUE(0); /* imaginary change for reference */
  ------------------
  |  |  266|   253k|    do                                                                         \
  |  |  267|   253k|    {                                                                          \
  |  |  268|   253k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  ------------------
  |  |  |  Branch (268:13): [True: 320, False: 253k]
  |  |  ------------------
  |  |  269|   253k|        {                                                                      \
  |  |  270|    320|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  271|    320|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  ------------------
  |  |  |  |  278|    320|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    320|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 135, False: 185]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  272|    320|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  ------------------
  |  |  |  |  278|    320|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|    320|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (278:22): [True: 135, False: 185]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  273|    320|                                       : tif->tif_dir.td_curstrip);            \
  |  |  274|    320|            return (-1);                                                       \
  |  |  275|    320|        }                                                                      \
  |  |  276|   253k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  277|   253k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  278|   253k|        RunLength = 0;                                                         \
  |  |  279|   253k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (279:14): [Folded, False: 253k]
  |  |  ------------------
  ------------------
 1683|   253k|        SWAP(uint32_t *, sp->curruns, sp->refruns);
  ------------------
  |  | 1636|   253k|    {                                                                          \
  |  | 1637|   253k|        t x;                                                                   \
  |  | 1638|   253k|        x = (a);                                                               \
  |  | 1639|   253k|        (a) = (b);                                                             \
  |  | 1640|   253k|        (b) = x;                                                               \
  |  | 1641|   253k|    }
  ------------------
 1684|   253k|        buf += sp->b.rowbytes;
 1685|   253k|        occ -= sp->b.rowbytes;
 1686|   253k|        sp->line++;
 1687|   253k|        continue;
 1688|  7.73k|    EOFG4:
 1689|  7.73k|        NeedBits16(13, BADG4);
  ------------------
  |  |  164|  7.73k|    do                                                                         \
  |  |  165|  7.73k|    {                                                                          \
  |  |  166|  7.73k|        if (BitsAvail < (n))                                                   \
  |  |  ------------------
  |  |  |  Branch (166:13): [True: 7.73k, False: 0]
  |  |  ------------------
  |  |  167|  7.73k|        {                                                                      \
  |  |  168|  7.73k|            if (EndOfData())                                                   \
  |  |  ------------------
  |  |  |  |  117|  7.73k|#define EndOfData() (cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (117:21): [True: 2.08k, False: 5.65k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  169|  7.73k|            {                                                                  \
  |  |  170|  2.08k|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  ------------------
  |  |  |  Branch (170:21): [True: 2.04k, False: 44]
  |  |  ------------------
  |  |  171|  2.08k|                    goto eoflab;                                               \
  |  |  172|  2.08k|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  173|     44|            }                                                                  \
  |  |  174|  7.73k|            else                                                               \
  |  |  175|  7.73k|            {                                                                  \
  |  |  176|  5.65k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  177|  5.65k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  ------------------
  |  |  |  Branch (177:21): [True: 754, False: 4.89k]
  |  |  ------------------
  |  |  178|  5.65k|                {                                                              \
  |  |  179|    754|                    if (EndOfData())                                           \
  |  |  ------------------
  |  |  |  |  117|    754|#define EndOfData() (cp >= ep)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (117:21): [True: 8, False: 746]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  180|    754|                    {                                                          \
  |  |  181|      8|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  182|      8|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  183|      8|                    }                                                          \
  |  |  184|    754|                    else                                                       \
  |  |  185|    754|                    {                                                          \
  |  |  186|    746|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  187|    746|                        BitsAvail += 8;                                        \
  |  |  188|    746|                    }                                                          \
  |  |  189|    754|                }                                                              \
  |  |  190|  5.65k|            }                                                                  \
  |  |  191|  7.73k|        }                                                                      \
  |  |  192|  7.73k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (192:14): [Folded, False: 5.69k]
  |  |  ------------------
  ------------------
 1690|  7.73k|    BADG4:
 1691|       |#ifdef FAX3_DEBUG
 1692|       |        if (GetBits(13) != 0x1001)
 1693|       |            fputs("Bad EOFB\n", stderr);
 1694|       |#endif
 1695|  7.73k|        ClrBits(13);
  ------------------
  |  |  196|  7.73k|    do                                                                         \
  |  |  197|  7.73k|    {                                                                          \
  |  |  198|  7.73k|        BitsAvail -= (n);                                                      \
  |  |  199|  7.73k|        BitAcc >>= (n);                                                        \
  |  |  200|  7.73k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (200:14): [Folded, False: 7.73k]
  |  |  ------------------
  ------------------
 1696|  7.73k|        if (((lastx + 7) >> 3) > (int)occ) /* check for buffer overrun */
  ------------------
  |  Branch (1696:13): [True: 0, False: 7.73k]
  ------------------
 1697|      0|        {
 1698|      0|            TIFFErrorExtR(tif, module,
 1699|      0|                          "Buffer overrun detected : %" TIFF_SSIZE_FORMAT
 1700|      0|                          " bytes available, %d bits needed",
 1701|      0|                          occ, lastx);
 1702|      0|            return -1;
 1703|      0|        }
 1704|  7.73k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1705|  7.73k|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  7.73k|    do                                                                         \
  |  |  160|  7.73k|    {                                                                          \
  |  |  161|  7.73k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  7.73k|        sp->data = BitAcc;                                                     \
  |  |  163|  7.73k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  7.73k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  7.73k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  7.73k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 7.73k]
  |  |  ------------------
  ------------------
 1706|  7.73k|        return (sp->line != start
  ------------------
  |  Branch (1706:17): [True: 4.51k, False: 3.22k]
  ------------------
 1707|  7.73k|                    ? 1
 1708|  7.73k|                    : -1); /* don't error on badly-terminated strips */
 1709|  7.73k|    }
 1710|    292|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|    292|    do                                                                         \
  |  |  160|    292|    {                                                                          \
  |  |  161|    292|        sp->bit = BitsAvail;                                                   \
  |  |  162|    292|        sp->data = BitAcc;                                                     \
  |  |  163|    292|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|    292|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|    292|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|    292|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 292]
  |  |  ------------------
  ------------------
 1711|    292|    return (1);
 1712|  10.8k|}
tif_fax3.c:Fax4GetMaxCompressionRatio:
 1752|    223|{
 1753|       |    /* FAX4 can compress up to almost one byte per line, so the compression
 1754|       |     * ratio can be up to the tile/strip width.
 1755|       |     * See README_for_libtiff_developpers.md for raw data
 1756|       |     */
 1757|    223|    return isTiled(tif) ? tif->tif_dir.td_tilewidth
  ------------------
  |  |  278|    223|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    223|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 223, False: 0]
  |  |  ------------------
  ------------------
 1758|    223|                        : tif->tif_dir.td_imagewidth;
 1759|    223|}
tif_fax3.c:Fax3DecodeRLE:
 1802|  9.72k|{
 1803|  9.72k|    DECLARE_STATE(tif, sp, "Fax3DecodeRLE");
  ------------------
  |  |  123|  9.72k|    static const char module[] = mod;                                          \
  |  |  124|  9.72k|    Fax3CodecState *sp = DecoderState(tif);                                    \
  |  |  ------------------
  |  |  |  |  108|  9.72k|#define DecoderState(tif) ((Fax3CodecState *)Fax3State(tif))
  |  |  |  |  ------------------
  |  |  |  |  |  |   72|  9.72k|#define Fax3State(tif) ((Fax3BaseState *)(tif)->tif_data)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  125|  9.72k|    int a0;                                   /* reference element */          \
  |  |  126|  9.72k|    int lastx = (int)sp->b.rowpixels;         /* last element in row */        \
  |  |  127|  9.72k|    uint32_t BitAcc;                          /* bit accumulator */            \
  |  |  128|  9.72k|    int BitsAvail;                            /* # valid bits in BitAcc */     \
  |  |  129|  9.72k|    int RunLength;                            /* length of current run */      \
  |  |  130|  9.72k|    unsigned char *cp;                        /* next byte of input data */    \
  |  |  131|  9.72k|    unsigned char *ep;                        /* end of input data */          \
  |  |  132|  9.72k|    uint32_t *pa;                             /* place to stuff next run */    \
  |  |  133|  9.72k|    uint32_t *thisrun;                        /* current row's run array */    \
  |  |  134|  9.72k|    int EOLcnt;                               /* # EOL codes recognized */     \
  |  |  135|  9.72k|    const unsigned char *bitmap = sp->bitmap; /* input data bit reverser */    \
  |  |  136|  9.72k|    const TIFFFaxTabEnt *TabEnt
  ------------------
 1804|  9.72k|    int mode = sp->b.mode;
 1805|  9.72k|    (void)s;
 1806|  9.72k|    if (occ % sp->b.rowbytes)
  ------------------
  |  Branch (1806:9): [True: 0, False: 9.72k]
  ------------------
 1807|      0|    {
 1808|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
 1809|      0|        return (-1);
 1810|      0|    }
 1811|  9.72k|    if (CheckReachedCounters(tif, module, sp))
  ------------------
  |  Branch (1811:9): [True: 1, False: 9.72k]
  ------------------
 1812|      1|        return (-1);
 1813|  9.72k|    CACHE_STATE(tif, sp);
  ------------------
  |  |  147|  9.72k|    do                                                                         \
  |  |  148|  9.72k|    {                                                                          \
  |  |  149|  9.72k|        BitAcc = sp->data;                                                     \
  |  |  150|  9.72k|        BitsAvail = sp->bit;                                                   \
  |  |  151|  9.72k|        EOLcnt = sp->EOLcnt;                                                   \
  |  |  152|  9.72k|        cp = (unsigned char *)tif->tif_rawcp;                                  \
  |  |  153|  9.72k|        ep = cp + tif->tif_rawcc;                                              \
  |  |  154|  9.72k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (154:14): [Folded, False: 9.72k]
  |  |  ------------------
  ------------------
 1814|  9.72k|    thisrun = sp->curruns;
 1815|   177k|    while (occ > 0)
  ------------------
  |  Branch (1815:12): [True: 167k, False: 9.32k]
  ------------------
 1816|   167k|    {
 1817|   167k|        a0 = 0;
 1818|   167k|        RunLength = 0;
 1819|   167k|        pa = thisrun;
 1820|       |#ifdef FAX3_DEBUG
 1821|       |        printf("\nBitAcc=%08" PRIX32 ", BitsAvail = %d\n", BitAcc, BitsAvail);
 1822|       |        printf("-------------------- %" PRIu32 "\n", tif->tif_dir.td_row);
 1823|       |        fflush(stdout);
 1824|       |#endif
 1825|   167k|        EXPAND1D(EOFRLE);
  ------------------
  |  |  371|   167k|    do                                                                         \
  |  |  372|   167k|    {                                                                          \
  |  |  373|   167k|        for (;;)                                                               \
  |  |  374|   183k|        {                                                                      \
  |  |  375|   183k|            for (;;)                                                           \
  |  |  376|  1.34M|            {                                                                  \
  |  |  377|  1.34M|                LOOKUP16(12, TIFFFaxWhiteTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|  1.34M|    do                                                                         \
  |  |  |  |  255|  1.34M|    {                                                                          \
  |  |  |  |  256|  1.34M|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  1.34M|    do                                                                         \
  |  |  |  |  |  |  165|  1.34M|    {                                                                          \
  |  |  |  |  |  |  166|  1.34M|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 1.18M, False: 156k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  1.34M|        {                                                                      \
  |  |  |  |  |  |  168|  1.18M|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  1.18M|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 874, False: 1.18M]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  1.18M|            {                                                                  \
  |  |  |  |  |  |  170|    874|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 402, False: 472]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    874|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    874|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    472|            }                                                                  \
  |  |  |  |  |  |  174|  1.18M|            else                                                               \
  |  |  |  |  |  |  175|  1.18M|            {                                                                  \
  |  |  |  |  |  |  176|  1.18M|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  1.18M|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 67.4k, False: 1.11M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  1.18M|                {                                                              \
  |  |  |  |  |  |  179|  67.4k|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  67.4k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 133, False: 67.2k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|  67.4k|                    {                                                          \
  |  |  |  |  |  |  181|    133|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|    133|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|    133|                    }                                                          \
  |  |  |  |  |  |  184|  67.4k|                    else                                                       \
  |  |  |  |  |  |  185|  67.4k|                    {                                                          \
  |  |  |  |  |  |  186|  67.2k|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|  67.2k|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|  67.2k|                    }                                                          \
  |  |  |  |  |  |  189|  67.4k|                }                                                              \
  |  |  |  |  |  |  190|  1.18M|            }                                                                  \
  |  |  |  |  |  |  191|  1.18M|        }                                                                      \
  |  |  |  |  |  |  192|  1.34M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 1.34M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  1.34M|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  1.34M|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  1.34M|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  1.34M|    do                                                                         \
  |  |  |  |  |  |  197|  1.34M|    {                                                                          \
  |  |  |  |  |  |  198|  1.34M|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  1.34M|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  1.34M|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 1.34M]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  1.34M|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 1.34M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  378|  1.34M|                switch (TabEnt->State)                                         \
  |  |  379|  1.34M|                {                                                              \
  |  |  380|  5.73k|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|  5.73k|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 5.73k, False: 1.33M]
  |  |  ------------------
  |  |  381|  5.73k|                        EOLcnt = 1;                                            \
  |  |  382|  5.73k|                        goto done1d;                                           \
  |  |  383|  39.3k|                    case S_TermW:                                              \
  |  |  ------------------
  |  |  |  |   77|  39.3k|#define S_TermW 7
  |  |  ------------------
  |  |  |  Branch (383:21): [True: 39.3k, False: 1.30M]
  |  |  ------------------
  |  |  384|  39.3k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|  39.3k|    do                                                                         \
  |  |  |  |  267|  39.3k|    {                                                                          \
  |  |  |  |  268|  39.3k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 39.3k]
  |  |  |  |  ------------------
  |  |  |  |  269|  39.3k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  39.3k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  39.3k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  39.3k|        RunLength = 0;                                                         \
  |  |  |  |  279|  39.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 39.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  385|  39.3k|                        goto doneWhite1d;                                      \
  |  |  386|  1.03M|                    case S_MakeUpW:                                            \
  |  |  ------------------
  |  |  |  |   79|  1.03M|#define S_MakeUpW 9
  |  |  ------------------
  |  |  |  Branch (386:21): [True: 1.03M, False: 304k]
  |  |  ------------------
  |  |  387|  1.15M|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|  1.15M|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 120k, False: 1.22M]
  |  |  ------------------
  |  |  388|  1.15M|                        a0 = (int)((uint32_t)a0 + TabEnt->Param);              \
  |  |  389|  1.15M|                        RunLength =                                            \
  |  |  390|  1.15M|                            (int)((uint32_t)RunLength + TabEnt->Param);        \
  |  |  391|  1.15M|                        break;                                                 \
  |  |  392|  1.03M|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (392:21): [True: 138k, False: 1.20M]
  |  |  ------------------
  |  |  393|   138k|                        unexpected("WhiteTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|   138k|    do                                                                         \
  |  |  |  |  221|   138k|    {                                                                          \
  |  |  |  |  222|   138k|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|   138k|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|   138k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 138k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|   138k|                        goto done1d;                                           \
  |  |  395|  1.34M|                }                                                              \
  |  |  396|  1.34M|            }                                                                  \
  |  |  397|   183k|        doneWhite1d:                                                           \
  |  |  398|  39.3k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (398:17): [True: 17.6k, False: 21.7k]
  |  |  ------------------
  |  |  399|  39.3k|                goto done1d;                                                   \
  |  |  400|  39.3k|            for (;;)                                                           \
  |  |  401|  21.7k|            {                                                                  \
  |  |  402|  21.7k|                LOOKUP16(13, TIFFFaxBlackTable, eof1d);                        \
  |  |  ------------------
  |  |  |  |  254|  21.7k|    do                                                                         \
  |  |  |  |  255|  21.7k|    {                                                                          \
  |  |  |  |  256|  21.7k|        NeedBits16(wid, eoflab);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|  21.7k|    do                                                                         \
  |  |  |  |  |  |  165|  21.7k|    {                                                                          \
  |  |  |  |  |  |  166|  21.7k|        if (BitsAvail < (n))                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (166:13): [True: 19.7k, False: 1.94k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  21.7k|        {                                                                      \
  |  |  |  |  |  |  168|  19.7k|            if (EndOfData())                                                   \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|  19.7k|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 145, False: 19.6k]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  169|  19.7k|            {                                                                  \
  |  |  |  |  |  |  170|    145|                if (BitsAvail == 0) /* no valid bits */                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (170:21): [True: 0, False: 145]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    145|                    goto eoflab;                                               \
  |  |  |  |  |  |  172|    145|                BitsAvail = (n); /* pad with zeros */                          \
  |  |  |  |  |  |  173|    145|            }                                                                  \
  |  |  |  |  |  |  174|  19.7k|            else                                                               \
  |  |  |  |  |  |  175|  19.7k|            {                                                                  \
  |  |  |  |  |  |  176|  19.6k|                BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;              \
  |  |  |  |  |  |  177|  19.6k|                if ((BitsAvail += 8) < (n))                                    \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (177:21): [True: 2, False: 19.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  178|  19.6k|                {                                                              \
  |  |  |  |  |  |  179|      2|                    if (EndOfData())                                           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  117|      2|#define EndOfData() (cp >= ep)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (117:21): [True: 0, False: 2]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  180|      2|                    {                                                          \
  |  |  |  |  |  |  181|      0|                        /* NB: we know BitsAvail is non-zero here */           \
  |  |  |  |  |  |  182|      0|                        BitsAvail = (n); /* pad with zeros */                  \
  |  |  |  |  |  |  183|      0|                    }                                                          \
  |  |  |  |  |  |  184|      2|                    else                                                       \
  |  |  |  |  |  |  185|      2|                    {                                                          \
  |  |  |  |  |  |  186|      2|                        BitAcc |= ((uint32_t)bitmap[*cp++]) << BitsAvail;      \
  |  |  |  |  |  |  187|      2|                        BitsAvail += 8;                                        \
  |  |  |  |  |  |  188|      2|                    }                                                          \
  |  |  |  |  |  |  189|      2|                }                                                              \
  |  |  |  |  |  |  190|  19.6k|            }                                                                  \
  |  |  |  |  |  |  191|  19.7k|        }                                                                      \
  |  |  |  |  |  |  192|  21.7k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (192:14): [Folded, False: 21.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  257|  21.7k|        TabEnt = tab + GetBits(wid);                                           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  194|  21.7k|#define GetBits(n) (BitAcc & ((1 << (n)) - 1))
  |  |  |  |  ------------------
  |  |  |  |  258|  21.7k|        ClrBits(TabEnt->Width);                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  |  196|  21.7k|    do                                                                         \
  |  |  |  |  |  |  197|  21.7k|    {                                                                          \
  |  |  |  |  |  |  198|  21.7k|        BitsAvail -= (n);                                                      \
  |  |  |  |  |  |  199|  21.7k|        BitAcc >>= (n);                                                        \
  |  |  |  |  |  |  200|  21.7k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (200:14): [Folded, False: 21.7k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  259|  21.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (259:14): [Folded, False: 21.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|  21.7k|                switch (TabEnt->State)                                         \
  |  |  404|  21.7k|                {                                                              \
  |  |  405|    331|                    case S_EOL:                                                \
  |  |  ------------------
  |  |  |  |   82|    331|#define S_EOL 12
  |  |  ------------------
  |  |  |  Branch (405:21): [True: 331, False: 21.4k]
  |  |  ------------------
  |  |  406|    331|                        EOLcnt = 1;                                            \
  |  |  407|    331|                        goto done1d;                                           \
  |  |  408|  21.3k|                    case S_TermB:                                              \
  |  |  ------------------
  |  |  |  |   78|  21.3k|#define S_TermB 8
  |  |  ------------------
  |  |  |  Branch (408:21): [True: 21.3k, False: 389]
  |  |  ------------------
  |  |  409|  21.3k|                        SETVALUE(TabEnt->Param);                               \
  |  |  ------------------
  |  |  |  |  266|  21.3k|    do                                                                         \
  |  |  |  |  267|  21.3k|    {                                                                          \
  |  |  |  |  268|  21.3k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (268:13): [True: 0, False: 21.3k]
  |  |  |  |  ------------------
  |  |  |  |  269|  21.3k|        {                                                                      \
  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  276|  21.3k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  277|  21.3k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  278|  21.3k|        RunLength = 0;                                                         \
  |  |  |  |  279|  21.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:14): [Folded, False: 21.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|  21.3k|                        goto doneBlack1d;                                      \
  |  |  411|  21.3k|                    case S_MakeUpB:                                            \
  |  |  ------------------
  |  |  |  |   80|      3|#define S_MakeUpB 10
  |  |  ------------------
  |  |  |  Branch (411:21): [True: 3, False: 21.7k]
  |  |  ------------------
  |  |  412|     30|                    case S_MakeUp:                                             \
  |  |  ------------------
  |  |  |  |   81|     30|#define S_MakeUp 11
  |  |  ------------------
  |  |  |  Branch (412:21): [True: 27, False: 21.7k]
  |  |  ------------------
  |  |  413|     30|                        a0 += (int)TabEnt->Param;                              \
  |  |  414|     30|                        RunLength += (int)TabEnt->Param;                       \
  |  |  415|     30|                        break;                                                 \
  |  |  416|     28|                    default:                                                   \
  |  |  ------------------
  |  |  |  Branch (416:21): [True: 28, False: 21.7k]
  |  |  ------------------
  |  |  417|     28|                        unexpected("BlackTable", a0);                          \
  |  |  ------------------
  |  |  |  |  220|     28|    do                                                                         \
  |  |  |  |  221|     28|    {                                                                          \
  |  |  |  |  222|     28|        Fax3Unexpected(module, tif, (uint32_t)sp->line, (uint32_t)(a0));       \
  |  |  |  |  223|     28|        ++sp->unexpectedReachedCount;                                          \
  |  |  |  |  224|     28|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (224:14): [Folded, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  418|     28|                        goto done1d;                                           \
  |  |  419|  21.7k|                }                                                              \
  |  |  420|  21.7k|            }                                                                  \
  |  |  421|  21.7k|        doneBlack1d:                                                           \
  |  |  422|  21.3k|            if (a0 >= (int)lastx)                                              \
  |  |  ------------------
  |  |  |  Branch (422:17): [True: 5.65k, False: 15.6k]
  |  |  ------------------
  |  |  423|  21.3k|                goto done1d;                                                   \
  |  |  424|  21.3k|            if (*(pa - 1) == 0 && *(pa - 2) == 0)                              \
  |  |  ------------------
  |  |  |  Branch (424:17): [True: 206, False: 15.4k]
  |  |  |  Branch (424:35): [True: 206, False: 0]
  |  |  ------------------
  |  |  425|  15.6k|                pa -= 2;                                                       \
  |  |  426|  15.6k|        }                                                                      \
  |  |  427|   167k|    eof1d:                                                                     \
  |  |  428|    402|        prematureEOF(a0);                                                      \
  |  |  ------------------
  |  |  |  |  271|    402|    do                                                                         \
  |  |  |  |  272|    402|    {                                                                          \
  |  |  |  |  273|    402|        Fax3PrematureEOF(module, tif, (uint32_t)sp->line, (uint32_t)(a0));     \
  |  |  |  |  274|    402|        ++sp->eofReachedCount;                                                 \
  |  |  |  |  275|    402|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (275:14): [Folded, False: 402]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  429|    402|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|    402|    do                                                                         \
  |  |  |  |  334|    402|    {                                                                          \
  |  |  |  |  335|    402|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 25, False: 377]
  |  |  |  |  ------------------
  |  |  |  |  336|    402|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|     25|    do                                                                         \
  |  |  |  |  |  |  267|     25|    {                                                                          \
  |  |  |  |  |  |  268|     25|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 25]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|     25|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|     25|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|     25|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|     25|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|     25|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 25]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|    402|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 402, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  338|    402|        {                                                                      \
  |  |  |  |  339|    402|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|    402|    do                                                                         \
  |  |  |  |  |  |  254|    402|    {                                                                          \
  |  |  |  |  |  |  255|    402|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|    402|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|    402|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|    402|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 402]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|    426|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 24, False: 402]
  |  |  |  |  |  Branch (340:39): [True: 24, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|    402|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|    402|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 402, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|    402|            {                                                                  \
  |  |  |  |  344|    402|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 402]
  |  |  |  |  ------------------
  |  |  |  |  345|    402|                    a0 = 0;                                                    \
  |  |  |  |  346|    402|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 1, False: 401]
  |  |  |  |  ------------------
  |  |  |  |  347|    402|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      1|    do                                                                         \
  |  |  |  |  |  |  267|      1|    {                                                                          \
  |  |  |  |  |  |  268|      1|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 1]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      1|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      1|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      1|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      1|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      1|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 1]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|    402|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    402|    do                                                                         \
  |  |  |  |  |  |  267|    402|    {                                                                          \
  |  |  |  |  |  |  268|    402|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 402]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    402|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    402|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    402|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    402|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    402|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 402]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|    402|            }                                                                  \
  |  |  |  |  350|    402|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  351|      0|            {                                                                  \
  |  |  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  354|      0|            }                                                                  \
  |  |  |  |  355|    402|        }                                                                      \
  |  |  |  |  356|    402|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 402]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  430|    402|        goto eoflab;                                                           \
  |  |  431|   167k|    done1d:                                                                    \
  |  |  432|   167k|        CLEANUP_RUNS();                                                        \
  |  |  ------------------
  |  |  |  |  333|   167k|    do                                                                         \
  |  |  |  |  334|   167k|    {                                                                          \
  |  |  |  |  335|   167k|        if (RunLength)                                                         \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (335:13): [True: 768, False: 166k]
  |  |  |  |  ------------------
  |  |  |  |  336|   167k|            SETVALUE(0);                                                       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|    768|    do                                                                         \
  |  |  |  |  |  |  267|    768|    {                                                                          \
  |  |  |  |  |  |  268|    768|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 768]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|    768|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|    768|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|    768|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|    768|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|    768|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 768]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  337|   167k|        if (a0 != (int)lastx)                                                  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (337:13): [True: 162k, False: 4.74k]
  |  |  |  |  ------------------
  |  |  |  |  338|   167k|        {                                                                      \
  |  |  |  |  339|   162k|            badlength(a0, lastx);                                              \
  |  |  |  |  ------------------
  |  |  |  |  |  |  253|   162k|    do                                                                         \
  |  |  |  |  |  |  254|   162k|    {                                                                          \
  |  |  |  |  |  |  255|   162k|        Fax3BadLength(module, tif, (uint32_t)sp->line, (uint32_t)(a0),         \
  |  |  |  |  |  |  256|   162k|                      (uint32_t)(lastx));                                      \
  |  |  |  |  |  |  257|   162k|        ++sp->eolReachedCount;                                                 \
  |  |  |  |  |  |  258|   162k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (258:14): [Folded, False: 162k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  340|   181k|            while (a0 > (int)lastx && pa > thisrun)                            \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (340:20): [True: 19.2k, False: 162k]
  |  |  |  |  |  Branch (340:39): [True: 19.2k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  341|   162k|                a0 -= (int)*--pa;                                              \
  |  |  |  |  342|   162k|            if (a0 < (int)lastx)                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (342:17): [True: 162k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  343|   162k|            {                                                                  \
  |  |  |  |  344|   162k|                if (a0 < 0)                                                    \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (344:21): [True: 0, False: 162k]
  |  |  |  |  ------------------
  |  |  |  |  345|   162k|                    a0 = 0;                                                    \
  |  |  |  |  346|   162k|                if ((pa - thisrun) & 1)                                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (346:21): [True: 5.96k, False: 156k]
  |  |  |  |  ------------------
  |  |  |  |  347|   162k|                    SETVALUE(0);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|  5.96k|    do                                                                         \
  |  |  |  |  |  |  267|  5.96k|    {                                                                          \
  |  |  |  |  |  |  268|  5.96k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 5.96k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|  5.96k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|  5.96k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|  5.96k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|  5.96k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|  5.96k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 5.96k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  348|   162k|                SETVALUE((uint32_t)((int)lastx - a0));                         \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|   162k|    do                                                                         \
  |  |  |  |  |  |  267|   162k|    {                                                                          \
  |  |  |  |  |  |  268|   162k|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 162k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|   162k|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|   162k|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|   162k|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|   162k|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|   162k|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 162k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  349|   162k|            }                                                                  \
  |  |  |  |  350|   162k|            else if (a0 > (int)lastx)                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (350:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  351|      0|            {                                                                  \
  |  |  |  |  352|      0|                SETVALUE(lastx);                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  353|      0|                SETVALUE(0);                                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  266|      0|    do                                                                         \
  |  |  |  |  |  |  267|      0|    {                                                                          \
  |  |  |  |  |  |  268|      0|        if (pa >= thisrun + sp->nruns)                                         \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (268:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  269|      0|        {                                                                      \
  |  |  |  |  |  |  270|      0|            TIFFErrorExtR(tif, module, "Buffer overflow at line %d of %s %u",  \
  |  |  |  |  |  |  271|      0|                          sp->line, isTiled(tif) ? "tile" : "strip",           \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  272|      0|                          isTiled(tif) ? tif->tif_dir.td_curtile               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  273|      0|                                       : tif->tif_dir.td_curstrip);            \
  |  |  |  |  |  |  274|      0|            return (-1);                                                       \
  |  |  |  |  |  |  275|      0|        }                                                                      \
  |  |  |  |  |  |  276|      0|        *pa++ = (uint32_t)((uint32_t)RunLength + (uint32_t)(x));               \
  |  |  |  |  |  |  277|      0|        a0 += (int)(uint32_t)(x);                                              \
  |  |  |  |  |  |  278|      0|        RunLength = 0;                                                         \
  |  |  |  |  |  |  279|      0|    } while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (279:14): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  354|      0|            }                                                                  \
  |  |  |  |  355|   162k|        }                                                                      \
  |  |  |  |  356|   167k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (356:14): [Folded, False: 167k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  433|   167k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (433:14): [Folded, False: 167k]
  |  |  ------------------
  ------------------
 1826|   167k|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1827|       |        /*
 1828|       |         * Cleanup at the end of the row.
 1829|       |         */
 1830|   167k|        if (mode & FAXMODE_BYTEALIGN)
  ------------------
  |  |  701|   167k|#define FAXMODE_BYTEALIGN 0x0004     /* byte align row */
  ------------------
  |  Branch (1830:13): [True: 166k, False: 583]
  ------------------
 1831|   166k|        {
 1832|   166k|            int n = BitsAvail - (BitsAvail & ~7);
 1833|   166k|            ClrBits(n);
  ------------------
  |  |  196|   166k|    do                                                                         \
  |  |  197|   166k|    {                                                                          \
  |  |  198|   166k|        BitsAvail -= (n);                                                      \
  |  |  199|   166k|        BitAcc >>= (n);                                                        \
  |  |  200|   166k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (200:14): [Folded, False: 166k]
  |  |  ------------------
  ------------------
 1834|   166k|        }
 1835|    583|        else if (mode & FAXMODE_WORDALIGN)
  ------------------
  |  |  702|    583|#define FAXMODE_WORDALIGN 0x0008     /* word align row */
  ------------------
  |  Branch (1835:18): [True: 583, False: 0]
  ------------------
 1836|    583|        {
 1837|    583|            int n = BitsAvail - (BitsAvail & ~15);
 1838|    583|            ClrBits(n);
  ------------------
  |  |  196|    583|    do                                                                         \
  |  |  197|    583|    {                                                                          \
  |  |  198|    583|        BitsAvail -= (n);                                                      \
  |  |  199|    583|        BitAcc >>= (n);                                                        \
  |  |  200|    583|    } while (0)
  |  |  ------------------
  |  |  |  Branch (200:14): [Folded, False: 583]
  |  |  ------------------
  ------------------
 1839|    583|            if (BitsAvail == 0 && !isAligned(cp, uint16_t))
  ------------------
  |  |  112|    556|#define isAligned(p, t) ((((size_t)(p)) & (sizeof(t) - 1)) == 0)
  ------------------
  |  Branch (1839:17): [True: 556, False: 27]
  |  Branch (1839:35): [True: 322, False: 234]
  ------------------
 1840|    322|                cp++;
 1841|    583|        }
 1842|   167k|        buf += sp->b.rowbytes;
 1843|   167k|        occ -= sp->b.rowbytes;
 1844|   167k|        sp->line++;
 1845|   167k|        continue;
 1846|    402|    EOFRLE: /* premature EOF */
 1847|    402|        (*sp->fill)(buf, thisrun, pa, (uint32_t)lastx);
 1848|    402|        UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|    402|    do                                                                         \
  |  |  160|    402|    {                                                                          \
  |  |  161|    402|        sp->bit = BitsAvail;                                                   \
  |  |  162|    402|        sp->data = BitAcc;                                                     \
  |  |  163|    402|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|    402|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|    402|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|    402|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 402]
  |  |  ------------------
  ------------------
 1849|    402|        return (-1);
 1850|   167k|    }
 1851|  9.32k|    UNCACHE_STATE(tif, sp);
  ------------------
  |  |  159|  9.32k|    do                                                                         \
  |  |  160|  9.32k|    {                                                                          \
  |  |  161|  9.32k|        sp->bit = BitsAvail;                                                   \
  |  |  162|  9.32k|        sp->data = BitAcc;                                                     \
  |  |  163|  9.32k|        sp->EOLcnt = EOLcnt;                                                   \
  |  |  164|  9.32k|        tif->tif_rawcc -= (tmsize_t)((uint8_t *)cp - tif->tif_rawcp);          \
  |  |  165|  9.32k|        tif->tif_rawcp = (uint8_t *)cp;                                        \
  |  |  166|  9.32k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 9.32k]
  |  |  ------------------
  ------------------
 1852|  9.32k|    return (1);
 1853|  9.72k|}

TIFFRGBAImageOK:
   85|  4.33k|{
   86|  4.33k|    TIFFDirectory *td = &tif->tif_dir;
   87|  4.33k|    uint16_t photometric;
   88|  4.33k|    int colorchannels;
   89|       |
   90|  4.33k|    if (!tif->tif_decodestatus)
  ------------------
  |  Branch (90:9): [True: 1, False: 4.33k]
  ------------------
   91|      1|    {
   92|      1|        snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      1|#define EMSG_BUF_SIZE 1024
  ------------------
   93|      1|                 "Sorry, requested compression method is not configured");
   94|      1|        return (0);
   95|      1|    }
   96|  4.33k|    switch (td->td_bitspersample)
   97|  4.33k|    {
   98|    529|        case 1:
  ------------------
  |  Branch (98:9): [True: 529, False: 3.80k]
  ------------------
   99|    596|        case 2:
  ------------------
  |  Branch (99:9): [True: 67, False: 4.26k]
  ------------------
  100|    608|        case 4:
  ------------------
  |  Branch (100:9): [True: 12, False: 4.31k]
  ------------------
  101|  3.03k|        case 8:
  ------------------
  |  Branch (101:9): [True: 2.42k, False: 1.90k]
  ------------------
  102|  3.32k|        case 16:
  ------------------
  |  Branch (102:9): [True: 295, False: 4.03k]
  ------------------
  103|  3.32k|            break;
  104|  1.00k|        default:
  ------------------
  |  Branch (104:9): [True: 1.00k, False: 3.32k]
  ------------------
  105|  1.00k|            snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|  1.00k|#define EMSG_BUF_SIZE 1024
  ------------------
  106|  1.00k|                     "Sorry, can not handle images with %" PRIu16
  107|  1.00k|                     "-bit samples",
  108|  1.00k|                     td->td_bitspersample);
  109|  1.00k|            return (0);
  110|  4.33k|    }
  111|  3.32k|    if (td->td_sampleformat == SAMPLEFORMAT_IEEEFP)
  ------------------
  |  |  336|  3.32k|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  |  Branch (111:9): [True: 31, False: 3.29k]
  ------------------
  112|     31|    {
  113|     31|        snprintf(
  114|     31|            emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     31|#define EMSG_BUF_SIZE 1024
  ------------------
  115|     31|            "Sorry, can not handle images with IEEE floating-point samples");
  116|     31|        return (0);
  117|     31|    }
  118|  3.29k|    colorchannels = td->td_samplesperpixel - td->td_extrasamples;
  119|  3.29k|    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric))
  ------------------
  |  |  220|  3.29k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (119:9): [True: 1.67k, False: 1.61k]
  ------------------
  120|  1.67k|    {
  121|  1.67k|        switch (colorchannels)
  122|  1.67k|        {
  123|  1.67k|            case 1:
  ------------------
  |  Branch (123:13): [True: 1.67k, False: 5]
  ------------------
  124|  1.67k|                photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  222|  1.67k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  125|  1.67k|                break;
  126|      0|            case 3:
  ------------------
  |  Branch (126:13): [True: 0, False: 1.67k]
  ------------------
  127|      0|                photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  223|      0|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  128|      0|                break;
  129|      5|            default:
  ------------------
  |  Branch (129:13): [True: 5, False: 1.67k]
  ------------------
  130|      5|                snprintf(emsg, EMSG_BUF_SIZE, "Missing needed %s tag",
  ------------------
  |  |   53|      5|#define EMSG_BUF_SIZE 1024
  ------------------
  131|      5|                         photoTag);
  132|      5|                return (0);
  133|  1.67k|        }
  134|  1.67k|    }
  135|  3.29k|    switch (photometric)
  136|  3.29k|    {
  137|      8|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|      8|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (137:9): [True: 8, False: 3.28k]
  ------------------
  138|  1.79k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  1.79k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (138:9): [True: 1.78k, False: 1.50k]
  ------------------
  139|  1.82k|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|  1.82k|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (139:9): [True: 33, False: 3.25k]
  ------------------
  140|  1.82k|            if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  3.65k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (140:17): [True: 1.68k, False: 136]
  ------------------
  141|  1.68k|                td->td_samplesperpixel != 1 && td->td_bitspersample < 8)
  ------------------
  |  Branch (141:17): [True: 304, False: 1.38k]
  |  Branch (141:48): [True: 15, False: 289]
  ------------------
  142|     15|            {
  143|     15|                snprintf(
  144|     15|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     15|#define EMSG_BUF_SIZE 1024
  ------------------
  145|     15|                    "Sorry, can not handle contiguous data with %s=%" PRIu16
  146|     15|                    ", "
  147|     15|                    "and %s=%" PRIu16 " and Bits/Sample=%" PRIu16 "",
  148|     15|                    photoTag, photometric, "Samples/pixel",
  149|     15|                    td->td_samplesperpixel, td->td_bitspersample);
  150|     15|                return (0);
  151|     15|            }
  152|       |            /*
  153|       |             * We should likely validate that any extra samples are either
  154|       |             * to be ignored, or are alpha, and if alpha we should try to use
  155|       |             * them.  But for now we won't bother with this.
  156|       |             */
  157|  1.81k|            break;
  158|  1.81k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|  1.27k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (158:9): [True: 1.27k, False: 2.02k]
  ------------------
  159|       |            /*
  160|       |             * TODO: if at all meaningful and useful, make more complete
  161|       |             * support check here, or better still, refactor to let supporting
  162|       |             * code decide whether there is support and what meaningful
  163|       |             * error to return
  164|       |             */
  165|  1.27k|            break;
  166|     85|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|     85|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (166:9): [True: 85, False: 3.20k]
  ------------------
  167|     85|            if (colorchannels < 3)
  ------------------
  |  Branch (167:17): [True: 28, False: 57]
  ------------------
  168|     28|            {
  169|     28|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     28|#define EMSG_BUF_SIZE 1024
  ------------------
  170|     28|                         "Sorry, can not handle RGB image with %s=%d",
  171|     28|                         "Color channels", colorchannels);
  172|     28|                return (0);
  173|     28|            }
  174|     57|            break;
  175|     57|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     52|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (175:9): [True: 52, False: 3.23k]
  ------------------
  176|     52|        {
  177|     52|            uint16_t inkset;
  178|     52|            TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
  ------------------
  |  |  322|     52|#define TIFFTAG_INKSET 332                 /* !inks in separated image */
  ------------------
  179|     52|            if (inkset != INKSET_CMYK)
  ------------------
  |  |  323|     52|#define INKSET_CMYK 1                      /* !cyan-magenta-yellow-black color */
  ------------------
  |  Branch (179:17): [True: 1, False: 51]
  ------------------
  180|      1|            {
  181|      1|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      1|#define EMSG_BUF_SIZE 1024
  ------------------
  182|      1|                         "Sorry, can not handle separated image with %s=%d",
  183|      1|                         "InkSet", inkset);
  184|      1|                return 0;
  185|      1|            }
  186|     51|            if (td->td_samplesperpixel < 4)
  ------------------
  |  Branch (186:17): [True: 1, False: 50]
  ------------------
  187|      1|            {
  188|      1|                snprintf(
  189|      1|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      1|#define EMSG_BUF_SIZE 1024
  ------------------
  190|      1|                    "Sorry, can not handle separated image with %s=%" PRIu16,
  191|      1|                    "Samples/pixel", td->td_samplesperpixel);
  192|      1|                return 0;
  193|      1|            }
  194|     50|            break;
  195|     51|        }
  196|     50|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|     13|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (196:9): [True: 13, False: 3.27k]
  ------------------
  197|     13|            if (td->td_compression != COMPRESSION_SGILOG)
  ------------------
  |  |  210|     13|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (197:17): [True: 2, False: 11]
  ------------------
  198|      2|            {
  199|      2|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      2|#define EMSG_BUF_SIZE 1024
  ------------------
  200|      2|                         "Sorry, LogL data must have %s=%d", "Compression",
  201|      2|                         COMPRESSION_SGILOG);
  ------------------
  |  |  210|      2|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  202|      2|                return (0);
  203|      2|            }
  204|     11|            break;
  205|     13|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|     13|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (205:9): [True: 13, False: 3.27k]
  ------------------
  206|     13|            if (td->td_compression != COMPRESSION_SGILOG &&
  ------------------
  |  |  210|     26|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (206:17): [True: 11, False: 2]
  ------------------
  207|     11|                td->td_compression != COMPRESSION_SGILOG24)
  ------------------
  |  |  211|     11|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  |  Branch (207:17): [True: 1, False: 10]
  ------------------
  208|      1|            {
  209|      1|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      1|#define EMSG_BUF_SIZE 1024
  ------------------
  210|      1|                         "Sorry, LogLuv data must have %s=%d or %d",
  211|      1|                         "Compression", COMPRESSION_SGILOG,
  ------------------
  |  |  210|      1|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  212|      1|                         COMPRESSION_SGILOG24);
  ------------------
  |  |  211|      1|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  213|      1|                return (0);
  214|      1|            }
  215|     12|            if (td->td_planarconfig != PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|     12|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (215:17): [True: 0, False: 12]
  ------------------
  216|      0|            {
  217|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  218|      0|                         "Sorry, can not handle LogLuv images with %s=%" PRIu16,
  219|      0|                         "Planarconfiguration", td->td_planarconfig);
  220|      0|                return (0);
  221|      0|            }
  222|     12|            if (td->td_samplesperpixel != 3 || colorchannels != 3)
  ------------------
  |  Branch (222:17): [True: 0, False: 12]
  |  Branch (222:48): [True: 11, False: 1]
  ------------------
  223|     11|            {
  224|     11|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     11|#define EMSG_BUF_SIZE 1024
  ------------------
  225|     11|                         "Sorry, can not handle image with %s=%" PRIu16
  226|     11|                         ", %s=%d",
  227|     11|                         "Samples/pixel", td->td_samplesperpixel,
  228|     11|                         "colorchannels", colorchannels);
  229|     11|                return 0;
  230|     11|            }
  231|      1|            break;
  232|     10|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|     10|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (232:9): [True: 10, False: 3.28k]
  ------------------
  233|     10|            if (td->td_samplesperpixel != 3 || colorchannels != 3 ||
  ------------------
  |  Branch (233:17): [True: 0, False: 10]
  |  Branch (233:48): [True: 1, False: 9]
  ------------------
  234|      9|                (td->td_bitspersample != 8 && td->td_bitspersample != 16))
  ------------------
  |  Branch (234:18): [True: 2, False: 7]
  |  Branch (234:47): [True: 0, False: 2]
  ------------------
  235|      1|            {
  236|      1|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      1|#define EMSG_BUF_SIZE 1024
  ------------------
  237|      1|                         "Sorry, can not handle image with %s=%" PRIu16
  238|      1|                         ", %s=%d and %s=%" PRIu16,
  239|      1|                         "Samples/pixel", td->td_samplesperpixel,
  240|      1|                         "colorchannels", colorchannels, "Bits/sample",
  241|      1|                         td->td_bitspersample);
  242|      1|                return 0;
  243|      1|            }
  244|      9|            break;
  245|     22|        default:
  ------------------
  |  Branch (245:9): [True: 22, False: 3.26k]
  ------------------
  246|     22|            snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|     22|#define EMSG_BUF_SIZE 1024
  ------------------
  247|     22|                     "Sorry, can not handle image with %s=%" PRIu16, photoTag,
  248|     22|                     photometric);
  249|     22|            return (0);
  250|  3.29k|    }
  251|  3.20k|    return (1);
  252|  3.29k|}
TIFFRGBAImageEnd:
  255|  3.20k|{
  256|  3.20k|    if (img->Map)
  ------------------
  |  Branch (256:9): [True: 2, False: 3.20k]
  ------------------
  257|      2|    {
  258|      2|        _TIFFfreeExt(img->tif, img->Map);
  259|      2|        img->Map = NULL;
  260|      2|    }
  261|  3.20k|    if (img->BWmap)
  ------------------
  |  Branch (261:9): [True: 1.68k, False: 1.52k]
  ------------------
  262|  1.68k|    {
  263|  1.68k|        _TIFFfreeExt(img->tif, img->BWmap);
  264|  1.68k|        img->BWmap = NULL;
  265|  1.68k|    }
  266|  3.20k|    if (img->PALmap)
  ------------------
  |  Branch (266:9): [True: 33, False: 3.17k]
  ------------------
  267|     33|    {
  268|     33|        _TIFFfreeExt(img->tif, img->PALmap);
  269|     33|        img->PALmap = NULL;
  270|     33|    }
  271|  3.20k|    if (img->ycbcr)
  ------------------
  |  Branch (271:9): [True: 1.02k, False: 2.18k]
  ------------------
  272|  1.02k|    {
  273|  1.02k|        _TIFFfreeExt(img->tif, img->ycbcr);
  274|  1.02k|        img->ycbcr = NULL;
  275|  1.02k|    }
  276|  3.20k|    if (img->cielab)
  ------------------
  |  Branch (276:9): [True: 8, False: 3.20k]
  ------------------
  277|      8|    {
  278|      8|        _TIFFfreeExt(img->tif, img->cielab);
  279|      8|        img->cielab = NULL;
  280|      8|    }
  281|  3.20k|    if (img->UaToAa)
  ------------------
  |  Branch (281:9): [True: 55, False: 3.15k]
  ------------------
  282|     55|    {
  283|     55|        _TIFFfreeExt(img->tif, img->UaToAa);
  284|     55|        img->UaToAa = NULL;
  285|     55|    }
  286|  3.20k|    if (img->Bitdepth16To8)
  ------------------
  |  Branch (286:9): [True: 78, False: 3.13k]
  ------------------
  287|     78|    {
  288|     78|        _TIFFfreeExt(img->tif, img->Bitdepth16To8);
  289|     78|        img->Bitdepth16To8 = NULL;
  290|     78|    }
  291|       |
  292|  3.20k|    if (img->redcmap)
  ------------------
  |  Branch (292:9): [True: 33, False: 3.17k]
  ------------------
  293|     33|    {
  294|     33|        _TIFFfreeExt(img->tif, img->redcmap);
  295|     33|        _TIFFfreeExt(img->tif, img->greencmap);
  296|     33|        _TIFFfreeExt(img->tif, img->bluecmap);
  297|       |        img->redcmap = img->greencmap = img->bluecmap = NULL;
  298|     33|    }
  299|  3.20k|}
TIFFRGBAImageBegin:
  313|  4.33k|{
  314|  4.33k|    uint16_t *sampleinfo;
  315|  4.33k|    uint16_t extrasamples;
  316|  4.33k|    uint16_t planarconfig;
  317|  4.33k|    uint16_t compress;
  318|  4.33k|    int colorchannels;
  319|  4.33k|    uint16_t *red_orig, *green_orig, *blue_orig;
  320|  4.33k|    uint32_t n_color;
  321|       |
  322|  4.33k|    if (!TIFFRGBAImageOK(tif, emsg))
  ------------------
  |  Branch (322:9): [True: 1.12k, False: 3.20k]
  ------------------
  323|  1.12k|        return 0;
  324|       |
  325|       |    /* Initialize to normal values */
  326|  3.20k|    img->row_offset = 0;
  327|  3.20k|    img->col_offset = 0;
  328|  3.20k|    img->redcmap = NULL;
  329|  3.20k|    img->greencmap = NULL;
  330|  3.20k|    img->bluecmap = NULL;
  331|  3.20k|    img->Map = NULL;
  332|  3.20k|    img->BWmap = NULL;
  333|  3.20k|    img->PALmap = NULL;
  334|  3.20k|    img->ycbcr = NULL;
  335|  3.20k|    img->cielab = NULL;
  336|  3.20k|    img->UaToAa = NULL;
  337|  3.20k|    img->Bitdepth16To8 = NULL;
  338|  3.20k|    img->req_orientation = ORIENTATION_BOTLEFT; /* It is the default */
  ------------------
  |  |  252|  3.20k|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  339|       |
  340|  3.20k|    img->tif = tif;
  341|  3.20k|    img->stoponerr = stop;
  342|  3.20k|    TIFFGetFieldDefaulted(tif, TIFFTAG_BITSPERSAMPLE, &img->bitspersample);
  ------------------
  |  |  180|  3.20k|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
  343|  3.20k|    switch (img->bitspersample)
  344|  3.20k|    {
  345|    509|        case 1:
  ------------------
  |  Branch (345:9): [True: 509, False: 2.69k]
  ------------------
  346|    575|        case 2:
  ------------------
  |  Branch (346:9): [True: 66, False: 3.14k]
  ------------------
  347|    584|        case 4:
  ------------------
  |  Branch (347:9): [True: 9, False: 3.19k]
  ------------------
  348|  2.97k|        case 8:
  ------------------
  |  Branch (348:9): [True: 2.38k, False: 821]
  ------------------
  349|  3.20k|        case 16:
  ------------------
  |  Branch (349:9): [True: 237, False: 2.97k]
  ------------------
  350|  3.20k|            break;
  351|      0|        default:
  ------------------
  |  Branch (351:9): [True: 0, False: 3.20k]
  ------------------
  352|      0|            snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  353|      0|                     "Sorry, can not handle images with %" PRIu16
  354|      0|                     "-bit samples",
  355|      0|                     img->bitspersample);
  356|      0|            goto fail_return;
  357|  3.20k|    }
  358|  3.20k|    img->alpha = 0;
  359|  3.20k|    TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &img->samplesperpixel);
  ------------------
  |  |  257|  3.20k|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
  360|  3.20k|    TIFFGetFieldDefaulted(tif, TIFFTAG_EXTRASAMPLES, &extrasamples,
  ------------------
  |  |  329|  3.20k|#define TIFFTAG_EXTRASAMPLES 338           /* !info about extra samples */
  ------------------
  361|  3.20k|                          &sampleinfo);
  362|  3.20k|    if (extrasamples >= 1)
  ------------------
  |  Branch (362:9): [True: 489, False: 2.71k]
  ------------------
  363|    489|    {
  364|    489|        switch (sampleinfo[0])
  365|    489|        {
  366|    320|            case EXTRASAMPLE_UNSPECIFIED: /* Workaround for some images without
  ------------------
  |  |  330|    320|#define EXTRASAMPLE_UNSPECIFIED 0          /* !unspecified data */
  ------------------
  |  Branch (366:13): [True: 320, False: 169]
  ------------------
  367|       |                                           */
  368|    320|                if (img->samplesperpixel >
  ------------------
  |  Branch (368:21): [True: 126, False: 194]
  ------------------
  369|    320|                    3) /* correct info about alpha channel */
  370|    126|                    img->alpha = EXTRASAMPLE_ASSOCALPHA;
  ------------------
  |  |  331|    126|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  371|    320|                break;
  372|     92|            case EXTRASAMPLE_ASSOCALPHA: /* data is pre-multiplied */
  ------------------
  |  |  331|     92|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (372:13): [True: 92, False: 397]
  ------------------
  373|    169|            case EXTRASAMPLE_UNASSALPHA: /* data is not pre-multiplied */
  ------------------
  |  |  332|    169|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (373:13): [True: 77, False: 412]
  ------------------
  374|    169|                img->alpha = sampleinfo[0];
  375|    169|                break;
  376|      0|            default:
  ------------------
  |  Branch (376:13): [True: 0, False: 489]
  ------------------
  377|      0|                break;
  378|    489|        }
  379|    489|    }
  380|       |
  381|  3.20k|#ifdef DEFAULT_EXTRASAMPLE_AS_ALPHA
  382|  3.20k|    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric))
  ------------------
  |  |  220|  3.20k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (382:9): [True: 1.65k, False: 1.54k]
  ------------------
  383|  1.65k|        img->photometric = PHOTOMETRIC_MINISWHITE;
  ------------------
  |  |  221|  1.65k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  384|       |
  385|  3.20k|    if (extrasamples == 0 && img->samplesperpixel == 4 &&
  ------------------
  |  Branch (385:9): [True: 2.71k, False: 489]
  |  Branch (385:30): [True: 8, False: 2.71k]
  ------------------
  386|      8|        img->photometric == PHOTOMETRIC_RGB)
  ------------------
  |  |  223|      8|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (386:9): [True: 0, False: 8]
  ------------------
  387|      0|    {
  388|      0|        img->alpha = EXTRASAMPLE_ASSOCALPHA;
  ------------------
  |  |  331|      0|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  389|      0|        extrasamples = 1;
  390|      0|    }
  391|  3.20k|#endif
  392|       |
  393|  3.20k|    colorchannels = img->samplesperpixel - extrasamples;
  394|  3.20k|    TIFFGetFieldDefaulted(tif, TIFFTAG_COMPRESSION, &compress);
  ------------------
  |  |  181|  3.20k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  395|  3.20k|    TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planarconfig);
  ------------------
  |  |  264|  3.20k|#define TIFFTAG_PLANARCONFIG 284           /* storage organization */
  ------------------
  396|  3.20k|    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &img->photometric))
  ------------------
  |  |  220|  3.20k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (396:9): [True: 1.65k, False: 1.54k]
  ------------------
  397|  1.65k|    {
  398|  1.65k|        switch (colorchannels)
  399|  1.65k|        {
  400|  1.65k|            case 1:
  ------------------
  |  Branch (400:13): [True: 1.65k, False: 0]
  ------------------
  401|  1.65k|                if (isCCITTCompression(tif))
  ------------------
  |  Branch (401:21): [True: 256, False: 1.40k]
  ------------------
  402|    256|                    img->photometric = PHOTOMETRIC_MINISWHITE;
  ------------------
  |  |  221|    256|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  403|  1.40k|                else
  404|  1.40k|                    img->photometric = PHOTOMETRIC_MINISBLACK;
  ------------------
  |  |  222|  1.40k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  405|  1.65k|                break;
  406|      0|            case 3:
  ------------------
  |  Branch (406:13): [True: 0, False: 1.65k]
  ------------------
  407|      0|                img->photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  223|      0|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  408|      0|                break;
  409|      0|            default:
  ------------------
  |  Branch (409:13): [True: 0, False: 1.65k]
  ------------------
  410|      0|                snprintf(emsg, EMSG_BUF_SIZE, "Missing needed %s tag",
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  411|      0|                         photoTag);
  412|      0|                goto fail_return;
  413|  1.65k|        }
  414|  1.65k|    }
  415|  3.20k|    switch (img->photometric)
  416|  3.20k|    {
  417|     33|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|     33|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (417:9): [True: 33, False: 3.17k]
  ------------------
  418|     33|            if (!TIFFGetField(tif, TIFFTAG_COLORMAP, &red_orig, &green_orig,
  ------------------
  |  |  309|     33|#define TIFFTAG_COLORMAP 320               /* RGB map for palette image */
  ------------------
  |  Branch (418:17): [True: 0, False: 33]
  ------------------
  419|     33|                              &blue_orig))
  420|      0|            {
  421|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  422|      0|                         "Missing required \"Colormap\" tag");
  423|      0|                goto fail_return;
  424|      0|            }
  425|       |
  426|       |            /* copy the colormaps so we can modify them */
  427|     33|            n_color = (uint32_t)(1U << img->bitspersample);
  428|     33|            img->redcmap = (uint16_t *)_TIFFmallocExt(
  429|     33|                tif, (tmsize_t)(sizeof(uint16_t) * (size_t)n_color));
  430|     33|            img->greencmap = (uint16_t *)_TIFFmallocExt(
  431|     33|                tif, (tmsize_t)(sizeof(uint16_t) * (size_t)n_color));
  432|     33|            img->bluecmap = (uint16_t *)_TIFFmallocExt(
  433|     33|                tif, (tmsize_t)(sizeof(uint16_t) * (size_t)n_color));
  434|     33|            if (!img->redcmap || !img->greencmap || !img->bluecmap)
  ------------------
  |  Branch (434:17): [True: 0, False: 33]
  |  Branch (434:34): [True: 0, False: 33]
  |  Branch (434:53): [True: 0, False: 33]
  ------------------
  435|      0|            {
  436|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  437|      0|                         "Out of memory for colormap copy");
  438|      0|                goto fail_return;
  439|      0|            }
  440|       |
  441|     33|            _TIFFmemcpy(img->redcmap, red_orig, n_color * 2);
  442|     33|            _TIFFmemcpy(img->greencmap, green_orig, n_color * 2);
  443|     33|            _TIFFmemcpy(img->bluecmap, blue_orig, n_color * 2);
  444|       |
  445|       |            /* fall through... */
  446|    297|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|    297|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (446:9): [True: 264, False: 2.94k]
  ------------------
  447|  1.81k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  1.81k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (447:9): [True: 1.51k, False: 1.69k]
  ------------------
  448|  1.81k|            if (planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  3.62k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (448:17): [True: 1.67k, False: 136]
  ------------------
  449|  1.67k|                img->samplesperpixel != 1 && img->bitspersample < 8)
  ------------------
  |  Branch (449:17): [True: 289, False: 1.38k]
  |  Branch (449:46): [True: 0, False: 289]
  ------------------
  450|      0|            {
  451|      0|                snprintf(
  452|      0|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  453|      0|                    "Sorry, can not handle contiguous data with %s=%" PRIu16
  454|      0|                    ", "
  455|      0|                    "and %s=%" PRIu16 " and Bits/Sample=%" PRIu16,
  456|      0|                    photoTag, img->photometric, "Samples/pixel",
  457|      0|                    img->samplesperpixel, img->bitspersample);
  458|      0|                goto fail_return;
  459|      0|            }
  460|  1.81k|            break;
  461|  1.81k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|  1.27k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (461:9): [True: 1.27k, False: 1.93k]
  ------------------
  462|       |            /* It would probably be nice to have a reality check here. */
  463|  1.27k|            if (planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  1.27k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (463:17): [True: 621, False: 649]
  ------------------
  464|       |                /* can rely on libjpeg to convert to RGB */
  465|       |                /* XXX should restore current state on exit */
  466|    621|                switch (compress)
  467|    621|                {
  468|    238|                    case COMPRESSION_JPEG:
  ------------------
  |  |  190|    238|#define COMPRESSION_JPEG 7            /* %JPEG DCT compression */
  ------------------
  |  Branch (468:21): [True: 238, False: 383]
  ------------------
  469|       |                        /*
  470|       |                         * TODO: when complete tests verify complete
  471|       |                         * desubsampling and YCbCr handling, remove use of
  472|       |                         * TIFFTAG_JPEGCOLORMODE in favor of tif_getimage.c
  473|       |                         * native handling
  474|       |                         */
  475|    238|                        TIFFSetField(tif, TIFFTAG_JPEGCOLORMODE,
  ------------------
  |  |  706|    238|#define TIFFTAG_JPEGCOLORMODE 65538  /* Auto RGB<=>YCbCr convert? */
  ------------------
  476|    238|                                     JPEGCOLORMODE_RGB);
  ------------------
  |  |  708|    238|#define JPEGCOLORMODE_RGB 0x0001     /* do auto conversion */
  ------------------
  477|    238|                        img->photometric = PHOTOMETRIC_RGB;
  ------------------
  |  |  223|    238|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  478|    238|                        break;
  479|    383|                    default:
  ------------------
  |  Branch (479:21): [True: 383, False: 238]
  ------------------
  480|    383|                        /* do nothing */;
  481|    383|                        break;
  482|    621|                }
  483|       |            /*
  484|       |             * TODO: if at all meaningful and useful, make more complete
  485|       |             * support check here, or better still, refactor to let supporting
  486|       |             * code decide whether there is support and what meaningful
  487|       |             * error to return
  488|       |             */
  489|  1.27k|            break;
  490|  1.27k|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|     57|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (490:9): [True: 57, False: 3.15k]
  ------------------
  491|     57|            if (colorchannels < 3)
  ------------------
  |  Branch (491:17): [True: 0, False: 57]
  ------------------
  492|      0|            {
  493|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  494|      0|                         "Sorry, can not handle RGB image with %s=%d",
  495|      0|                         "Color channels", colorchannels);
  496|      0|                goto fail_return;
  497|      0|            }
  498|     57|            break;
  499|     57|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     50|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (499:9): [True: 50, False: 3.15k]
  ------------------
  500|     50|        {
  501|     50|            uint16_t inkset;
  502|     50|            TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
  ------------------
  |  |  322|     50|#define TIFFTAG_INKSET 332                 /* !inks in separated image */
  ------------------
  503|     50|            if (inkset != INKSET_CMYK)
  ------------------
  |  |  323|     50|#define INKSET_CMYK 1                      /* !cyan-magenta-yellow-black color */
  ------------------
  |  Branch (503:17): [True: 0, False: 50]
  ------------------
  504|      0|            {
  505|      0|                snprintf(
  506|      0|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  507|      0|                    "Sorry, can not handle separated image with %s=%" PRIu16,
  508|      0|                    "InkSet", inkset);
  509|      0|                goto fail_return;
  510|      0|            }
  511|     50|            if (img->samplesperpixel < 4)
  ------------------
  |  Branch (511:17): [True: 0, False: 50]
  ------------------
  512|      0|            {
  513|      0|                snprintf(
  514|      0|                    emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  515|      0|                    "Sorry, can not handle separated image with %s=%" PRIu16,
  516|      0|                    "Samples/pixel", img->samplesperpixel);
  517|      0|                goto fail_return;
  518|      0|            }
  519|     50|        }
  520|     50|        break;
  521|     50|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|     11|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (521:9): [True: 11, False: 3.19k]
  ------------------
  522|     11|            if (compress != COMPRESSION_SGILOG)
  ------------------
  |  |  210|     11|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (522:17): [True: 0, False: 11]
  ------------------
  523|      0|            {
  524|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  525|      0|                         "Sorry, LogL data must have %s=%d", "Compression",
  526|      0|                         COMPRESSION_SGILOG);
  ------------------
  |  |  210|      0|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  527|      0|                goto fail_return;
  528|      0|            }
  529|     11|            TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  743|     11|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
                          TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  747|     11|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  530|     11|            img->photometric = PHOTOMETRIC_MINISBLACK; /* little white lie */
  ------------------
  |  |  222|     11|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  531|     11|            img->bitspersample = 8;
  532|     11|            break;
  533|      1|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|      1|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (533:9): [True: 1, False: 3.20k]
  ------------------
  534|      1|            if (compress != COMPRESSION_SGILOG &&
  ------------------
  |  |  210|      2|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  |  Branch (534:17): [True: 1, False: 0]
  ------------------
  535|      1|                compress != COMPRESSION_SGILOG24)
  ------------------
  |  |  211|      1|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  |  Branch (535:17): [True: 0, False: 1]
  ------------------
  536|      0|            {
  537|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  538|      0|                         "Sorry, LogLuv data must have %s=%d or %d",
  539|      0|                         "Compression", COMPRESSION_SGILOG,
  ------------------
  |  |  210|      0|#define COMPRESSION_SGILOG 34676   /* SGI Log Luminance RLE */
  ------------------
  540|      0|                         COMPRESSION_SGILOG24);
  ------------------
  |  |  211|      0|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  541|      0|                goto fail_return;
  542|      0|            }
  543|      1|            if (planarconfig != PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|      1|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (543:17): [True: 0, False: 1]
  ------------------
  544|      0|            {
  545|      0|                snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  546|      0|                         "Sorry, can not handle LogLuv images with %s=%" PRIu16,
  547|      0|                         "Planarconfiguration", planarconfig);
  548|      0|                return (0);
  549|      0|            }
  550|      1|            TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  743|      1|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
                          TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_8BIT);
  ------------------
  |  |  747|      1|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  551|      1|            img->photometric = PHOTOMETRIC_RGB; /* little white lie */
  ------------------
  |  |  223|      1|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  552|      1|            img->bitspersample = 8;
  553|      1|            break;
  554|      9|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|      9|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (554:9): [True: 9, False: 3.19k]
  ------------------
  555|      9|            break;
  556|      0|        default:
  ------------------
  |  Branch (556:9): [True: 0, False: 3.20k]
  ------------------
  557|      0|            snprintf(emsg, EMSG_BUF_SIZE,
  ------------------
  |  |   53|      0|#define EMSG_BUF_SIZE 1024
  ------------------
  558|      0|                     "Sorry, can not handle image with %s=%" PRIu16, photoTag,
  559|      0|                     img->photometric);
  560|      0|            goto fail_return;
  561|  3.20k|    }
  562|  3.20k|    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &img->width);
  ------------------
  |  |  178|  3.20k|#define TIFFTAG_IMAGEWIDTH 256        /* image width in pixels */
  ------------------
  563|  3.20k|    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &img->height);
  ------------------
  |  |  179|  3.20k|#define TIFFTAG_IMAGELENGTH 257       /* image height in pixels */
  ------------------
  564|  3.20k|    TIFFGetFieldDefaulted(tif, TIFFTAG_ORIENTATION, &img->orientation);
  ------------------
  |  |  248|  3.20k|#define TIFFTAG_ORIENTATION 274            /* +image orientation */
  ------------------
  565|  3.20k|    img->isContig =
  566|  3.20k|        !(planarconfig == PLANARCONFIG_SEPARATE && img->samplesperpixel > 1);
  ------------------
  |  |  266|  6.41k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (566:11): [True: 832, False: 2.37k]
  |  Branch (566:52): [True: 798, False: 34]
  ------------------
  567|  3.20k|    if (img->isContig)
  ------------------
  |  Branch (567:9): [True: 2.41k, False: 798]
  ------------------
  568|  2.41k|    {
  569|  2.41k|        if (!PickContigCase(img))
  ------------------
  |  Branch (569:13): [True: 37, False: 2.37k]
  ------------------
  570|     37|        {
  571|     37|            snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle image");
  ------------------
  |  |   53|     37|#define EMSG_BUF_SIZE 1024
  ------------------
  572|     37|            goto fail_return;
  573|     37|        }
  574|  2.41k|    }
  575|    798|    else
  576|    798|    {
  577|    798|        if (!PickSeparateCase(img))
  ------------------
  |  Branch (577:13): [True: 33, False: 765]
  ------------------
  578|     33|        {
  579|     33|            snprintf(emsg, EMSG_BUF_SIZE, "Sorry, can not handle image");
  ------------------
  |  |   53|     33|#define EMSG_BUF_SIZE 1024
  ------------------
  580|     33|            goto fail_return;
  581|     33|        }
  582|    798|    }
  583|  3.13k|    return 1;
  584|       |
  585|     70|fail_return:
  586|     70|    TIFFRGBAImageEnd(img);
  587|     70|    return 0;
  588|  3.20k|}
TIFFRGBAImageGet:
  592|  3.13k|{
  593|  3.13k|    if (img->get == NULL)
  ------------------
  |  Branch (593:9): [True: 0, False: 3.13k]
  ------------------
  594|      0|    {
  595|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
  596|      0|                      "No \"get\" routine setup");
  597|      0|        return (0);
  598|      0|    }
  599|  3.13k|    if (img->put.any == NULL)
  ------------------
  |  Branch (599:9): [True: 0, False: 3.13k]
  ------------------
  600|      0|    {
  601|      0|        TIFFErrorExtR(
  602|      0|            img->tif, TIFFFileName(img->tif),
  603|      0|            "No \"put\" routine setupl; probably can not handle image format");
  604|      0|        return (0);
  605|      0|    }
  606|       |    /* Verify raster height against image height.
  607|       |     * Width is checked in img->get() function individually. */
  608|  3.13k|    if (0 <= img->row_offset && (uint32_t)img->row_offset < img->height)
  ------------------
  |  Branch (608:9): [True: 3.13k, False: 0]
  |  Branch (608:33): [True: 3.13k, False: 0]
  ------------------
  609|  3.13k|    {
  610|  3.13k|        uint32_t hx = img->height - (uint32_t)img->row_offset;
  611|  3.13k|        if (h > hx)
  ------------------
  |  Branch (611:13): [True: 0, False: 3.13k]
  ------------------
  612|      0|        {
  613|       |            /* Adapt parameters to read only available lines and put image
  614|       |             * at the bottom of the raster. */
  615|      0|            raster += (size_t)(h - hx) * w;
  616|      0|            h = hx;
  617|      0|        }
  618|  3.13k|    }
  619|      0|    else
  620|      0|    {
  621|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
  622|      0|                      "Error in TIFFRGBAImageGet: row offset %d exceeds "
  623|      0|                      "image height %u",
  624|      0|                      img->row_offset, img->height);
  625|      0|        return 0;
  626|      0|    }
  627|  3.13k|    return (*img->get)(img, raster, w, h);
  628|  3.13k|}
TIFFReadRGBAImageOriented:
  636|  4.33k|{
  637|  4.33k|    char emsg[EMSG_BUF_SIZE] = "";
  638|  4.33k|    TIFFRGBAImage img;
  639|  4.33k|    int ok;
  640|       |
  641|  4.33k|    if (TIFFRGBAImageBegin(&img, tif, stop, emsg))
  ------------------
  |  Branch (641:9): [True: 3.13k, False: 1.19k]
  ------------------
  642|  3.13k|    {
  643|  3.13k|        img.req_orientation = (uint16_t)orientation;
  644|  3.13k|        ok = TIFFRGBAImageGet(&img, raster, rwidth, rheight);
  645|  3.13k|        TIFFRGBAImageEnd(&img);
  646|  3.13k|    }
  647|  1.19k|    else
  648|  1.19k|    {
  649|  1.19k|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s", emsg);
  650|  1.19k|        ok = 0;
  651|  1.19k|    }
  652|  4.33k|    return (ok);
  653|  4.33k|}
TIFFReadRGBAImage:
  661|  4.33k|{
  662|  4.33k|    return TIFFReadRGBAImageOriented(tif, rwidth, rheight, raster,
  663|  4.33k|                                     ORIENTATION_BOTLEFT, stop);
  ------------------
  |  |  252|  4.33k|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  664|  4.33k|}
tif_getimage.c:isCCITTCompression:
  302|  1.65k|{
  303|  1.65k|    uint16_t compress;
  304|  1.65k|    TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
  ------------------
  |  |  181|  1.65k|#define TIFFTAG_COMPRESSION 259       /* data compression technique */
  ------------------
  305|  1.65k|    return (compress == COMPRESSION_CCITTFAX3 ||
  ------------------
  |  |  184|  3.31k|#define COMPRESSION_CCITTFAX3 3       /* CCITT Group 3 fax encoding */
  ------------------
  |  Branch (305:13): [True: 156, False: 1.50k]
  ------------------
  306|  1.50k|            compress == COMPRESSION_CCITTFAX4 ||
  ------------------
  |  |  186|  3.16k|#define COMPRESSION_CCITTFAX4 4       /* CCITT Group 4 fax encoding */
  ------------------
  |  Branch (306:13): [True: 68, False: 1.43k]
  ------------------
  307|  1.43k|            compress == COMPRESSION_CCITTRLE ||
  ------------------
  |  |  183|  3.09k|#define COMPRESSION_CCITTRLE 2        /* CCITT modified Huffman RLE */
  ------------------
  |  Branch (307:13): [True: 7, False: 1.42k]
  ------------------
  308|  1.42k|            compress == COMPRESSION_CCITTRLEW);
  ------------------
  |  |  194|  1.42k|#define COMPRESSION_CCITTRLEW 32771   /* #1 w/ word alignment */
  ------------------
  |  Branch (308:13): [True: 25, False: 1.40k]
  ------------------
  309|  1.65k|}
tif_getimage.c:PickContigCase:
 3123|  2.41k|{
 3124|  2.41k|    img->get = TIFFIsTiled(img->tif) ? gtTileContig : gtStripContig;
  ------------------
  |  Branch (3124:16): [True: 1.85k, False: 559]
  ------------------
 3125|  2.41k|    img->put.contig = NULL;
 3126|  2.41k|    switch (img->photometric)
 3127|  2.41k|    {
 3128|    286|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|    286|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (3128:9): [True: 286, False: 2.12k]
  ------------------
 3129|    286|            switch (img->bitspersample)
 3130|    286|            {
 3131|    243|                case 8:
  ------------------
  |  Branch (3131:17): [True: 243, False: 43]
  ------------------
 3132|    243|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
  ------------------
  |  |  331|    486|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3132:25): [True: 2, False: 241]
  ------------------
 3133|      2|                        img->samplesperpixel >= 4)
  ------------------
  |  Branch (3133:25): [True: 0, False: 2]
  ------------------
 3134|      0|                        img->put.contig = putRGBAAcontig8bittile;
 3135|    243|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
  ------------------
  |  |  332|    486|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3135:30): [True: 7, False: 236]
  ------------------
 3136|      7|                             img->samplesperpixel >= 4)
  ------------------
  |  Branch (3136:30): [True: 7, False: 0]
  ------------------
 3137|      7|                    {
 3138|      7|                        if (BuildMapUaToAa(img))
  ------------------
  |  Branch (3138:29): [True: 7, False: 0]
  ------------------
 3139|      7|                            img->put.contig = putRGBUAcontig8bittile;
 3140|      7|                    }
 3141|    236|                    else if (img->samplesperpixel >= 3)
  ------------------
  |  Branch (3141:30): [True: 236, False: 0]
  ------------------
 3142|    236|                        img->put.contig = putRGBcontig8bittile;
 3143|    243|                    break;
 3144|     32|                case 16:
  ------------------
  |  Branch (3144:17): [True: 32, False: 254]
  ------------------
 3145|     32|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
  ------------------
  |  |  331|     64|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3145:25): [True: 6, False: 26]
  ------------------
 3146|      6|                        img->samplesperpixel >= 4)
  ------------------
  |  Branch (3146:25): [True: 5, False: 1]
  ------------------
 3147|      5|                    {
 3148|      5|                        if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (3148:29): [True: 5, False: 0]
  ------------------
 3149|      5|                            img->put.contig = putRGBAAcontig16bittile;
 3150|      5|                    }
 3151|     27|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
  ------------------
  |  |  332|     54|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3151:30): [True: 7, False: 20]
  ------------------
 3152|      7|                             img->samplesperpixel >= 4)
  ------------------
  |  Branch (3152:30): [True: 7, False: 0]
  ------------------
 3153|      7|                    {
 3154|      7|                        if (BuildMapBitdepth16To8(img) && BuildMapUaToAa(img))
  ------------------
  |  Branch (3154:29): [True: 7, False: 0]
  |  Branch (3154:59): [True: 7, False: 0]
  ------------------
 3155|      7|                            img->put.contig = putRGBUAcontig16bittile;
 3156|      7|                    }
 3157|     20|                    else if (img->samplesperpixel >= 3)
  ------------------
  |  Branch (3157:30): [True: 20, False: 0]
  ------------------
 3158|     20|                    {
 3159|     20|                        if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (3159:29): [True: 20, False: 0]
  ------------------
 3160|     20|                            img->put.contig = putRGBcontig16bittile;
 3161|     20|                    }
 3162|     32|                    break;
 3163|     11|                default:
  ------------------
  |  Branch (3163:17): [True: 11, False: 275]
  ------------------
 3164|     11|                    break;
 3165|    286|            }
 3166|    286|            break;
 3167|    286|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     13|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (3167:9): [True: 13, False: 2.39k]
  ------------------
 3168|     13|            if (img->samplesperpixel >= 4 && buildMap(img))
  ------------------
  |  Branch (3168:17): [True: 13, False: 0]
  |  Branch (3168:46): [True: 13, False: 0]
  ------------------
 3169|     13|            {
 3170|     13|                if (img->bitspersample == 8)
  ------------------
  |  Branch (3170:21): [True: 11, False: 2]
  ------------------
 3171|     11|                {
 3172|     11|                    if (!img->Map)
  ------------------
  |  Branch (3172:25): [True: 11, False: 0]
  ------------------
 3173|     11|                        img->put.contig = putRGBcontig8bitCMYKtile;
 3174|      0|                    else
 3175|      0|                        img->put.contig = putRGBcontig8bitCMYKMaptile;
 3176|     11|                }
 3177|     13|            }
 3178|     13|            break;
 3179|     33|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|     33|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (3179:9): [True: 33, False: 2.37k]
  ------------------
 3180|     33|            if (buildMap(img))
  ------------------
  |  Branch (3180:17): [True: 33, False: 0]
  ------------------
 3181|     33|            {
 3182|     33|                switch (img->bitspersample)
 3183|     33|                {
 3184|     15|                    case 8:
  ------------------
  |  Branch (3184:21): [True: 15, False: 18]
  ------------------
 3185|     15|                        img->put.contig = put8bitcmaptile;
 3186|     15|                        break;
 3187|      0|                    case 4:
  ------------------
  |  Branch (3187:21): [True: 0, False: 33]
  ------------------
 3188|      0|                        img->put.contig = put4bitcmaptile;
 3189|      0|                        break;
 3190|     18|                    case 2:
  ------------------
  |  Branch (3190:21): [True: 18, False: 15]
  ------------------
 3191|     18|                        img->put.contig = put2bitcmaptile;
 3192|     18|                        break;
 3193|      0|                    case 1:
  ------------------
  |  Branch (3193:21): [True: 0, False: 33]
  ------------------
 3194|      0|                        img->put.contig = put1bitcmaptile;
 3195|      0|                        break;
 3196|      0|                    default:
  ------------------
  |  Branch (3196:21): [True: 0, False: 33]
  ------------------
 3197|      0|                        break;
 3198|     33|                }
 3199|     33|            }
 3200|     33|            break;
 3201|    261|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|    261|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (3201:9): [True: 261, False: 2.14k]
  ------------------
 3202|  1.68k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  1.68k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (3202:9): [True: 1.42k, False: 985]
  ------------------
 3203|  1.68k|            if (buildMap(img))
  ------------------
  |  Branch (3203:17): [True: 1.68k, False: 0]
  ------------------
 3204|  1.68k|            {
 3205|  1.68k|                switch (img->bitspersample)
 3206|  1.68k|                {
 3207|    157|                    case 16:
  ------------------
  |  Branch (3207:21): [True: 157, False: 1.52k]
  ------------------
 3208|    157|                        img->put.contig = put16bitbwtile;
 3209|    157|                        break;
 3210|    991|                    case 8:
  ------------------
  |  Branch (3210:21): [True: 991, False: 695]
  ------------------
 3211|    991|                        if (img->alpha && img->samplesperpixel == 2)
  ------------------
  |  Branch (3211:29): [True: 94, False: 897]
  |  Branch (3211:43): [True: 19, False: 75]
  ------------------
 3212|     19|                            img->put.contig = putagreytile;
 3213|    972|                        else
 3214|    972|                            img->put.contig = putgreytile;
 3215|    991|                        break;
 3216|      9|                    case 4:
  ------------------
  |  Branch (3216:21): [True: 9, False: 1.67k]
  ------------------
 3217|      9|                        img->put.contig = put4bitbwtile;
 3218|      9|                        break;
 3219|     46|                    case 2:
  ------------------
  |  Branch (3219:21): [True: 46, False: 1.64k]
  ------------------
 3220|     46|                        img->put.contig = put2bitbwtile;
 3221|     46|                        break;
 3222|    483|                    case 1:
  ------------------
  |  Branch (3222:21): [True: 483, False: 1.20k]
  ------------------
 3223|    483|                        img->put.contig = put1bitbwtile;
 3224|    483|                        break;
 3225|      0|                    default:
  ------------------
  |  Branch (3225:21): [True: 0, False: 1.68k]
  ------------------
 3226|      0|                        break;
 3227|  1.68k|                }
 3228|  1.68k|            }
 3229|  1.68k|            break;
 3230|  1.68k|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|    383|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (3230:9): [True: 383, False: 2.02k]
  ------------------
 3231|    383|            if ((img->bitspersample == 8) && (img->samplesperpixel == 3))
  ------------------
  |  Branch (3231:17): [True: 381, False: 2]
  |  Branch (3231:46): [True: 381, False: 0]
  ------------------
 3232|    381|            {
 3233|    381|                if (initYCbCrConversion(img) != 0)
  ------------------
  |  Branch (3233:21): [True: 381, False: 0]
  ------------------
 3234|    381|                {
 3235|       |                    /*
 3236|       |                     * The 6.0 spec says that subsampling must be
 3237|       |                     * one of 1, 2, or 4, and that vertical subsampling
 3238|       |                     * must always be <= horizontal subsampling; so
 3239|       |                     * there are only a few possibilities and we just
 3240|       |                     * enumerate the cases.
 3241|       |                     * Joris: added support for the [1,2] case, nonetheless, to
 3242|       |                     * accommodate some OJPEG files
 3243|       |                     */
 3244|    381|                    uint16_t SubsamplingHor;
 3245|    381|                    uint16_t SubsamplingVer;
 3246|    381|                    TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|    381|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
 3247|    381|                                          &SubsamplingHor, &SubsamplingVer);
 3248|       |                    /* Validate that the image dimensions are compatible with
 3249|       |                    the subsampling block. All putcontig8bitYCbCrXYtile routines
 3250|       |                    assume width >= X and height >= Y. */
 3251|    381|                    if (img->width < SubsamplingHor ||
  ------------------
  |  Branch (3251:25): [True: 4, False: 377]
  ------------------
 3252|    377|                        img->height < SubsamplingVer)
  ------------------
  |  Branch (3252:25): [True: 16, False: 361]
  ------------------
 3253|     20|                    {
 3254|     20|                        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
 3255|     20|                                      "YCbCr subsampling (%u,%u) incompatible "
 3256|     20|                                      "with image size %ux%u",
 3257|     20|                                      SubsamplingHor, SubsamplingVer,
 3258|     20|                                      img->width, img->height);
 3259|     20|                        return (0);
 3260|     20|                    }
 3261|    361|                    switch ((SubsamplingHor << 4) | SubsamplingVer)
 3262|    361|                    {
 3263|     54|                        case 0x44:
  ------------------
  |  Branch (3263:25): [True: 54, False: 307]
  ------------------
 3264|     54|                            img->put.contig = putcontig8bitYCbCr44tile;
 3265|     54|                            break;
 3266|     43|                        case 0x42:
  ------------------
  |  Branch (3266:25): [True: 43, False: 318]
  ------------------
 3267|     43|                            img->put.contig = putcontig8bitYCbCr42tile;
 3268|     43|                            break;
 3269|     13|                        case 0x41:
  ------------------
  |  Branch (3269:25): [True: 13, False: 348]
  ------------------
 3270|     13|                            img->put.contig = putcontig8bitYCbCr41tile;
 3271|     13|                            break;
 3272|    155|                        case 0x22:
  ------------------
  |  Branch (3272:25): [True: 155, False: 206]
  ------------------
 3273|    155|                            img->put.contig = putcontig8bitYCbCr22tile;
 3274|    155|                            break;
 3275|      4|                        case 0x21:
  ------------------
  |  Branch (3275:25): [True: 4, False: 357]
  ------------------
 3276|      4|                            img->put.contig = putcontig8bitYCbCr21tile;
 3277|      4|                            break;
 3278|     24|                        case 0x12:
  ------------------
  |  Branch (3278:25): [True: 24, False: 337]
  ------------------
 3279|     24|                            img->put.contig = putcontig8bitYCbCr12tile;
 3280|     24|                            break;
 3281|     67|                        case 0x11:
  ------------------
  |  Branch (3281:25): [True: 67, False: 294]
  ------------------
 3282|     67|                            img->put.contig = putcontig8bitYCbCr11tile;
 3283|     67|                            break;
 3284|      1|                        default:
  ------------------
  |  Branch (3284:25): [True: 1, False: 360]
  ------------------
 3285|      1|                            break;
 3286|    361|                    }
 3287|    361|                }
 3288|    381|            }
 3289|    363|            break;
 3290|    363|        case PHOTOMETRIC_CIELAB:
  ------------------
  |  |  228|      9|#define PHOTOMETRIC_CIELAB 8               /* !1976 CIE L*a*b* */
  ------------------
  |  Branch (3290:9): [True: 9, False: 2.40k]
  ------------------
 3291|      9|            if (img->samplesperpixel == 3 && buildMap(img))
  ------------------
  |  Branch (3291:17): [True: 9, False: 0]
  |  Branch (3291:46): [True: 9, False: 0]
  ------------------
 3292|      9|            {
 3293|      9|                if (img->bitspersample == 8 || img->bitspersample == 16)
  ------------------
  |  Branch (3293:21): [True: 7, False: 2]
  |  Branch (3293:48): [True: 2, False: 0]
  ------------------
 3294|      9|                    img->put.contig = initCIELabConversion(img);
 3295|      9|                break;
 3296|      9|            }
 3297|      0|            break;
 3298|      0|        default:
  ------------------
  |  Branch (3298:9): [True: 0, False: 2.41k]
  ------------------
 3299|      0|            break;
 3300|  2.41k|    }
 3301|  2.39k|    return ((img->get != NULL) && (img->put.contig != NULL));
  ------------------
  |  Branch (3301:13): [True: 2.39k, False: 0]
  |  Branch (3301:35): [True: 2.37k, False: 17]
  ------------------
 3302|  2.41k|}
tif_getimage.c:gtTileContig:
  735|  1.83k|{
  736|  1.83k|    TIFF *tif = img->tif;
  737|  1.83k|    tileContigRoutine put = img->put.contig;
  738|  1.83k|    uint32_t col, row, y, rowstoread;
  739|  1.83k|    tmsize_t pos;
  740|  1.83k|    uint32_t tw, th;
  741|  1.83k|    unsigned char *buf = NULL;
  742|  1.83k|    int32_t fromskew, toskew;
  743|  1.83k|    uint32_t nrow;
  744|  1.83k|    int ret = 1, flip;
  745|  1.83k|    uint32_t this_tw, tocol;
  746|  1.83k|    int32_t this_toskew, leftmost_toskew;
  747|  1.83k|    int32_t leftmost_fromskew;
  748|  1.83k|    uint32_t leftmost_tw;
  749|  1.83k|    tmsize_t bufsize;
  750|       |
  751|       |    /* If the raster is smaller than the image,
  752|       |     * or if there is a col_offset, adapt the samples to be copied per row. */
  753|  1.83k|    uint32_t wmin;
  754|       |
  755|  1.83k|    if (0 <= img->col_offset && (uint32_t)img->col_offset < img->width)
  ------------------
  |  Branch (755:9): [True: 1.83k, False: 0]
  |  Branch (755:33): [True: 1.83k, False: 0]
  ------------------
  756|  1.83k|    {
  757|  1.83k|        wmin = TIFFmin(w, img->width - (uint32_t)img->col_offset);
  ------------------
  |  |  337|  1.83k|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 0, False: 1.83k]
  |  |  ------------------
  ------------------
  758|  1.83k|    }
  759|      0|    else
  760|      0|    {
  761|      0|        TIFFErrorExtR(tif, TIFFFileName(tif),
  762|      0|                      "Error in gtTileContig: column offset %d exceeds "
  763|      0|                      "image width %u",
  764|      0|                      img->col_offset, img->width);
  765|      0|        return 0;
  766|      0|    }
  767|  1.83k|    bufsize = TIFFTileSize(tif);
  768|  1.83k|    if (bufsize == 0)
  ------------------
  |  Branch (768:9): [True: 0, False: 1.83k]
  ------------------
  769|      0|    {
  770|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s", "No space for tile buffer");
  771|      0|        return (0);
  772|      0|    }
  773|       |
  774|  1.83k|    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
  ------------------
  |  |  311|  1.83k|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  775|  1.83k|    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
  ------------------
  |  |  312|  1.83k|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  776|       |
  777|  1.83k|    flip = setorientation(img);
  778|  1.83k|    if (flip & FLIP_VERTICALLY)
  ------------------
  |  |   50|  1.83k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (778:9): [True: 1.82k, False: 10]
  ------------------
  779|  1.82k|    {
  780|  1.82k|        if (((int64_t)tw + w) > INT_MAX)
  ------------------
  |  Branch (780:13): [True: 0, False: 1.82k]
  ------------------
  781|      0|        {
  782|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
  783|      0|                          "unsupported tile size (too wide)");
  784|      0|            return (0);
  785|      0|        }
  786|  1.82k|        y = h - 1;
  787|  1.82k|        toskew = -(int32_t)(tw + w);
  788|  1.82k|    }
  789|     10|    else
  790|     10|    {
  791|     10|        if (tw > ((int64_t)INT_MAX + w) || w > ((int64_t)INT_MAX + tw))
  ------------------
  |  Branch (791:13): [True: 0, False: 10]
  |  Branch (791:44): [True: 0, False: 10]
  ------------------
  792|      0|        {
  793|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
  794|      0|                          "unsupported tile size (too wide)");
  795|      0|            return (0);
  796|      0|        }
  797|     10|        y = 0;
  798|     10|        toskew = -(int32_t)(tw - w);
  799|     10|    }
  800|       |
  801|  1.83k|    if (tw == 0 || th == 0)
  ------------------
  |  Branch (801:9): [True: 0, False: 1.83k]
  |  Branch (801:20): [True: 0, False: 1.83k]
  ------------------
  802|      0|    {
  803|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "tile width or height is zero");
  804|      0|        return (0);
  805|      0|    }
  806|       |
  807|       |    /*
  808|       |     *	Leftmost tile is clipped on left side if col_offset > 0.
  809|       |     */
  810|  1.83k|    leftmost_fromskew = (int32_t)((uint32_t)img->col_offset % tw);
  811|  1.83k|    leftmost_tw = (uint32_t)((int32_t)tw - leftmost_fromskew);
  812|  1.83k|    int64_t skew_i64 = (int64_t)toskew + (int64_t)(int32_t)leftmost_fromskew;
  813|  1.83k|    if (skew_i64 > INT_MAX || skew_i64 < INT_MIN)
  ------------------
  |  Branch (813:9): [True: 0, False: 1.83k]
  |  Branch (813:31): [True: 0, False: 1.83k]
  ------------------
  814|      0|    {
  815|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s %" PRId64, "Invalid skew",
  816|      0|                      skew_i64);
  817|      0|        return (0);
  818|      0|    }
  819|  1.83k|    leftmost_toskew = (int32_t)skew_i64;
  820|   172k|    for (row = 0; ret != 0 && row < h; row += nrow)
  ------------------
  |  Branch (820:19): [True: 172k, False: 224]
  |  Branch (820:31): [True: 170k, False: 1.61k]
  ------------------
  821|   170k|    {
  822|   170k|        rowstoread = th - ((uint32_t)row + (uint32_t)img->row_offset) % th;
  823|   170k|        nrow = (row + rowstoread > h ? h - row : rowstoread);
  ------------------
  |  Branch (823:17): [True: 1.64k, False: 169k]
  ------------------
  824|   170k|        fromskew = leftmost_fromskew;
  825|   170k|        this_tw = leftmost_tw;
  826|   170k|        this_toskew = leftmost_toskew;
  827|   170k|        tocol = 0;
  828|   170k|        col = (uint32_t)img->col_offset;
  829|       |        /* wmin: only write imagewidth if raster is bigger. */
  830|   829k|        while (tocol < wmin)
  ------------------
  |  Branch (830:16): [True: 658k, False: 170k]
  ------------------
  831|   658k|        {
  832|   658k|            if (_TIFFReadTileAndAllocBuffer(tif, (void **)&buf, bufsize, col,
  ------------------
  |  Branch (832:17): [True: 600k, False: 57.9k]
  ------------------
  833|   658k|                                            (uint32_t)row +
  834|   658k|                                                (uint32_t)img->row_offset,
  835|   658k|                                            0, 0) == (tmsize_t)(-1) &&
  836|   600k|                (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (836:18): [True: 224, False: 600k]
  |  Branch (836:33): [True: 0, False: 600k]
  ------------------
  837|    224|            {
  838|    224|                ret = 0;
  839|    224|                break;
  840|    224|            }
  841|   658k|            pos = (((uint32_t)row + (uint32_t)img->row_offset) % th) *
  842|   658k|                      TIFFTileRowSize(tif) +
  843|   658k|                  ((tmsize_t)fromskew * img->samplesperpixel);
  844|   658k|            if (tocol + this_tw > wmin)
  ------------------
  |  Branch (844:17): [True: 155k, False: 502k]
  ------------------
  845|   155k|            {
  846|       |                /*
  847|       |                 * Rightmost tile is clipped on right side.
  848|       |                 */
  849|   155k|                fromskew = (int32_t)(tw - (wmin - tocol));
  850|   155k|                this_tw = (uint32_t)((int32_t)tw - fromskew);
  851|   155k|                this_toskew = (int32_t)(toskew + (int32_t)(uint32_t)fromskew);
  852|   155k|            }
  853|   658k|            tmsize_t roffset = (tmsize_t)y * w + tocol;
  854|   658k|            (*put)(img, raster + roffset, tocol, y, this_tw, nrow, fromskew,
  855|   658k|                   this_toskew, buf + pos);
  856|   658k|            tocol += this_tw;
  857|   658k|            col += this_tw;
  858|       |            /*
  859|       |             * After the leftmost tile, tiles are no longer clipped on left
  860|       |             * side.
  861|       |             */
  862|   658k|            fromskew = 0;
  863|   658k|            this_tw = tw;
  864|   658k|            this_toskew = toskew;
  865|   658k|        }
  866|       |
  867|   170k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|   170k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (867:25): [True: 105k, False: 65.5k]
  ------------------
  868|   170k|                                                 : (int32_t)nrow);
  869|   170k|    }
  870|  1.83k|    _TIFFfreeExt(img->tif, buf);
  871|       |
  872|  1.83k|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|  1.83k|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (872:9): [True: 7, False: 1.82k]
  ------------------
  873|      7|    {
  874|      7|        uint32_t line;
  875|       |
  876|  65.6k|        for (line = 0; line < h; line++)
  ------------------
  |  Branch (876:24): [True: 65.6k, False: 7]
  ------------------
  877|  65.6k|        {
  878|  65.6k|            uint32_t *left = raster + (size_t)line * w;
  879|       |            /* Use wmin to only flip horizontally data in place and not complete
  880|       |             * raster-row. */
  881|  65.6k|            uint32_t *right = left + wmin - 1;
  882|       |
  883|  1.11M|            while (left < right)
  ------------------
  |  Branch (883:20): [True: 1.04M, False: 65.6k]
  ------------------
  884|  1.04M|            {
  885|  1.04M|                uint32_t temp = *left;
  886|  1.04M|                *left = *right;
  887|  1.04M|                *right = temp;
  888|  1.04M|                left++;
  889|  1.04M|                right--;
  890|  1.04M|            }
  891|  65.6k|        }
  892|      7|    }
  893|       |
  894|  1.83k|    return (ret);
  895|  1.83k|}
tif_getimage.c:setorientation:
  667|  3.13k|{
  668|  3.13k|    switch (img->orientation)
  669|  3.13k|    {
  670|  3.05k|        case ORIENTATION_TOPLEFT:
  ------------------
  |  |  249|  3.05k|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
  |  Branch (670:9): [True: 3.05k, False: 87]
  ------------------
  671|  3.05k|        case ORIENTATION_LEFTTOP:
  ------------------
  |  |  253|  3.05k|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (671:9): [True: 2, False: 3.13k]
  ------------------
  672|  3.05k|            if (img->req_orientation == ORIENTATION_TOPRIGHT ||
  ------------------
  |  |  250|  6.10k|#define ORIENTATION_TOPRIGHT 2             /* row 0 top, col 0 rhs */
  ------------------
  |  Branch (672:17): [True: 0, False: 3.05k]
  ------------------
  673|  3.05k|                img->req_orientation == ORIENTATION_RIGHTTOP)
  ------------------
  |  |  254|  3.05k|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (673:17): [True: 0, False: 3.05k]
  ------------------
  674|      0|                return FLIP_HORIZONTALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
  675|  3.05k|            else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
  ------------------
  |  |  251|  6.10k|#define ORIENTATION_BOTRIGHT 3             /* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (675:22): [True: 0, False: 3.05k]
  ------------------
  676|  3.05k|                     img->req_orientation == ORIENTATION_RIGHTBOT)
  ------------------
  |  |  255|  3.05k|#define ORIENTATION_RIGHTBOT 7             /* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (676:22): [True: 0, False: 3.05k]
  ------------------
  677|      0|                return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
                              return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  678|  3.05k|            else if (img->req_orientation == ORIENTATION_BOTLEFT ||
  ------------------
  |  |  252|  6.10k|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (678:22): [True: 3.05k, False: 0]
  ------------------
  679|      0|                     img->req_orientation == ORIENTATION_LEFTBOT)
  ------------------
  |  |  256|      0|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (679:22): [True: 0, False: 0]
  ------------------
  680|  3.05k|                return FLIP_VERTICALLY;
  ------------------
  |  |   50|  3.05k|#define FLIP_VERTICALLY 0x01
  ------------------
  681|      0|            else
  682|      0|                return 0;
  683|      3|        case ORIENTATION_TOPRIGHT:
  ------------------
  |  |  250|      3|#define ORIENTATION_TOPRIGHT 2             /* row 0 top, col 0 rhs */
  ------------------
  |  Branch (683:9): [True: 3, False: 3.13k]
  ------------------
  684|      3|        case ORIENTATION_RIGHTTOP:
  ------------------
  |  |  254|      3|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (684:9): [True: 0, False: 3.13k]
  ------------------
  685|      3|            if (img->req_orientation == ORIENTATION_TOPLEFT ||
  ------------------
  |  |  249|      6|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
  |  Branch (685:17): [True: 0, False: 3]
  ------------------
  686|      3|                img->req_orientation == ORIENTATION_LEFTTOP)
  ------------------
  |  |  253|      3|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (686:17): [True: 0, False: 3]
  ------------------
  687|      0|                return FLIP_HORIZONTALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
  688|      3|            else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
  ------------------
  |  |  251|      6|#define ORIENTATION_BOTRIGHT 3             /* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (688:22): [True: 0, False: 3]
  ------------------
  689|      3|                     img->req_orientation == ORIENTATION_RIGHTBOT)
  ------------------
  |  |  255|      3|#define ORIENTATION_RIGHTBOT 7             /* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (689:22): [True: 0, False: 3]
  ------------------
  690|      0|                return FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  691|      3|            else if (img->req_orientation == ORIENTATION_BOTLEFT ||
  ------------------
  |  |  252|      6|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (691:22): [True: 3, False: 0]
  ------------------
  692|      0|                     img->req_orientation == ORIENTATION_LEFTBOT)
  ------------------
  |  |  256|      0|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (692:22): [True: 0, False: 0]
  ------------------
  693|      3|                return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   51|      3|#define FLIP_HORIZONTALLY 0x02
  ------------------
                              return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|      3|#define FLIP_VERTICALLY 0x01
  ------------------
  694|      0|            else
  695|      0|                return 0;
  696|     71|        case ORIENTATION_BOTRIGHT:
  ------------------
  |  |  251|     71|#define ORIENTATION_BOTRIGHT 3             /* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (696:9): [True: 71, False: 3.06k]
  ------------------
  697|     72|        case ORIENTATION_RIGHTBOT:
  ------------------
  |  |  255|     72|#define ORIENTATION_RIGHTBOT 7             /* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (697:9): [True: 1, False: 3.13k]
  ------------------
  698|     72|            if (img->req_orientation == ORIENTATION_TOPLEFT ||
  ------------------
  |  |  249|    144|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
  |  Branch (698:17): [True: 0, False: 72]
  ------------------
  699|     72|                img->req_orientation == ORIENTATION_LEFTTOP)
  ------------------
  |  |  253|     72|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (699:17): [True: 0, False: 72]
  ------------------
  700|      0|                return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
                              return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  701|     72|            else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
  ------------------
  |  |  250|    144|#define ORIENTATION_TOPRIGHT 2             /* row 0 top, col 0 rhs */
  ------------------
  |  Branch (701:22): [True: 0, False: 72]
  ------------------
  702|     72|                     img->req_orientation == ORIENTATION_RIGHTTOP)
  ------------------
  |  |  254|     72|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (702:22): [True: 0, False: 72]
  ------------------
  703|      0|                return FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  704|     72|            else if (img->req_orientation == ORIENTATION_BOTLEFT ||
  ------------------
  |  |  252|    144|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (704:22): [True: 72, False: 0]
  ------------------
  705|      0|                     img->req_orientation == ORIENTATION_LEFTBOT)
  ------------------
  |  |  256|      0|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (705:22): [True: 0, False: 0]
  ------------------
  706|     72|                return FLIP_HORIZONTALLY;
  ------------------
  |  |   51|     72|#define FLIP_HORIZONTALLY 0x02
  ------------------
  707|      0|            else
  708|      0|                return 0;
  709|      6|        case ORIENTATION_BOTLEFT:
  ------------------
  |  |  252|      6|#define ORIENTATION_BOTLEFT 4              /* row 0 bottom, col 0 lhs */
  ------------------
  |  Branch (709:9): [True: 6, False: 3.13k]
  ------------------
  710|     10|        case ORIENTATION_LEFTBOT:
  ------------------
  |  |  256|     10|#define ORIENTATION_LEFTBOT 8              /* row 0 lhs, col 0 bottom */
  ------------------
  |  Branch (710:9): [True: 4, False: 3.13k]
  ------------------
  711|     10|            if (img->req_orientation == ORIENTATION_TOPLEFT ||
  ------------------
  |  |  249|     20|#define ORIENTATION_TOPLEFT 1              /* row 0 top, col 0 lhs */
  ------------------
  |  Branch (711:17): [True: 0, False: 10]
  ------------------
  712|     10|                img->req_orientation == ORIENTATION_LEFTTOP)
  ------------------
  |  |  253|     10|#define ORIENTATION_LEFTTOP 5              /* row 0 lhs, col 0 top */
  ------------------
  |  Branch (712:17): [True: 0, False: 10]
  ------------------
  713|      0|                return FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  714|     10|            else if (img->req_orientation == ORIENTATION_TOPRIGHT ||
  ------------------
  |  |  250|     20|#define ORIENTATION_TOPRIGHT 2             /* row 0 top, col 0 rhs */
  ------------------
  |  Branch (714:22): [True: 0, False: 10]
  ------------------
  715|     10|                     img->req_orientation == ORIENTATION_RIGHTTOP)
  ------------------
  |  |  254|     10|#define ORIENTATION_RIGHTTOP 6             /* row 0 rhs, col 0 top */
  ------------------
  |  Branch (715:22): [True: 0, False: 10]
  ------------------
  716|      0|                return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
                              return FLIP_HORIZONTALLY | FLIP_VERTICALLY;
  ------------------
  |  |   50|      0|#define FLIP_VERTICALLY 0x01
  ------------------
  717|     10|            else if (img->req_orientation == ORIENTATION_BOTRIGHT ||
  ------------------
  |  |  251|     20|#define ORIENTATION_BOTRIGHT 3             /* row 0 bottom, col 0 rhs */
  ------------------
  |  Branch (717:22): [True: 0, False: 10]
  ------------------
  718|     10|                     img->req_orientation == ORIENTATION_RIGHTBOT)
  ------------------
  |  |  255|     10|#define ORIENTATION_RIGHTBOT 7             /* row 0 rhs, col 0 bottom */
  ------------------
  |  Branch (718:22): [True: 0, False: 10]
  ------------------
  719|      0|                return FLIP_HORIZONTALLY;
  ------------------
  |  |   51|      0|#define FLIP_HORIZONTALLY 0x02
  ------------------
  720|     10|            else
  721|     10|                return 0;
  722|      0|        default: /* NOTREACHED */
  ------------------
  |  Branch (722:9): [True: 0, False: 3.13k]
  ------------------
  723|      0|            return 0;
  724|  3.13k|    }
  725|  3.13k|}
tif_getimage.c:gtStripContig:
 1150|    539|{
 1151|    539|    TIFF *tif = img->tif;
 1152|    539|    tileContigRoutine put = img->put.contig;
 1153|    539|    uint32_t row, y, nrow, nrowsub, rowstoread;
 1154|    539|    tmsize_t pos;
 1155|    539|    unsigned char *buf = NULL;
 1156|    539|    uint32_t rowsperstrip;
 1157|    539|    uint16_t subsamplinghor, subsamplingver;
 1158|    539|    uint32_t imagewidth = img->width;
 1159|    539|    tmsize_t scanline;
 1160|       |    /* fromskew, toskew are the increments within the input image or the raster
 1161|       |     * from the end of a line to the start of the next line to read or write. */
 1162|    539|    int32_t fromskew, toskew;
 1163|    539|    int ret = 1, flip;
 1164|    539|    tmsize_t maxstripsize;
 1165|       |
 1166|       |    /* If the raster is smaller than the image,
 1167|       |     * or if there is a col_offset, adapt the samples to be copied per row. */
 1168|    539|    uint32_t wmin;
 1169|    539|    if (0 <= img->col_offset && (uint32_t)img->col_offset < imagewidth)
  ------------------
  |  Branch (1169:9): [True: 539, False: 0]
  |  Branch (1169:33): [True: 539, False: 0]
  ------------------
 1170|    539|    {
 1171|    539|        wmin = TIFFmin(w, imagewidth - (uint32_t)img->col_offset);
  ------------------
  |  |  337|    539|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 0, False: 539]
  |  |  ------------------
  ------------------
 1172|    539|    }
 1173|      0|    else
 1174|      0|    {
 1175|      0|        TIFFErrorExtR(tif, TIFFFileName(tif),
 1176|      0|                      "Error in gtStripContig: column offset %d exceeds "
 1177|      0|                      "image width %u",
 1178|      0|                      img->col_offset, imagewidth);
 1179|      0|        return 0;
 1180|      0|    }
 1181|       |
 1182|    539|    TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING, &subsamplinghor,
  ------------------
  |  |  388|    539|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
 1183|    539|                          &subsamplingver);
 1184|    539|    if (subsamplingver == 0)
  ------------------
  |  Branch (1184:9): [True: 1, False: 538]
  ------------------
 1185|      1|    {
 1186|      1|        TIFFErrorExtR(tif, TIFFFileName(tif),
 1187|      1|                      "Invalid vertical YCbCr subsampling");
 1188|      1|        return (0);
 1189|      1|    }
 1190|       |
 1191|    538|    maxstripsize = TIFFStripSize(tif);
 1192|       |
 1193|    538|    flip = setorientation(img);
 1194|    538|    if (flip & FLIP_VERTICALLY)
  ------------------
  |  |   50|    538|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1194:9): [True: 529, False: 9]
  ------------------
 1195|    529|    {
 1196|    529|        if (w > INT_MAX / 2)
  ------------------
  |  Branch (1196:13): [True: 0, False: 529]
  ------------------
 1197|      0|        {
 1198|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "Width overflow");
 1199|      0|            return (0);
 1200|      0|        }
 1201|    529|        y = h - 1;
 1202|       |        /* Skew back to the raster row before the currently written row
 1203|       |         * -> one raster width plus copied image pixels. */
 1204|    529|        toskew = -(int32_t)(w + wmin);
 1205|    529|    }
 1206|      9|    else
 1207|      9|    {
 1208|      9|        y = 0;
 1209|       |        /* Skew forward to the end of the raster width of the row currently
 1210|       |         * copied. */
 1211|      9|        toskew = (int32_t)(w - wmin);
 1212|      9|    }
 1213|       |
 1214|    538|    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
  ------------------
  |  |  258|    538|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
 1215|    538|    if (rowsperstrip == 0)
  ------------------
  |  Branch (1215:9): [True: 0, False: 538]
  ------------------
 1216|      0|    {
 1217|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "rowsperstrip is zero");
 1218|      0|        return (0);
 1219|      0|    }
 1220|       |
 1221|    538|    scanline = TIFFScanlineSize(tif);
 1222|    538|    fromskew = (int32_t)(w < imagewidth ? imagewidth - w : 0);
  ------------------
  |  Branch (1222:26): [True: 0, False: 538]
  ------------------
 1223|   349k|    for (row = 0; row < h; row += nrow)
  ------------------
  |  Branch (1223:19): [True: 348k, False: 442]
  ------------------
 1224|   348k|    {
 1225|   348k|        uint32_t temp;
 1226|   348k|        rowstoread = rowsperstrip -
 1227|   348k|                     (uint32_t)((int32_t)row + img->row_offset) % rowsperstrip;
 1228|   348k|        nrow = (row + rowstoread > h ? h - row : rowstoread);
  ------------------
  |  Branch (1228:17): [True: 440, False: 348k]
  ------------------
 1229|   348k|        nrowsub = nrow;
 1230|   348k|        if ((nrowsub % subsamplingver) != 0)
  ------------------
  |  Branch (1230:13): [True: 130k, False: 218k]
  ------------------
 1231|   130k|            nrowsub += subsamplingver - nrowsub % subsamplingver;
 1232|   348k|        temp =
 1233|   348k|            (uint32_t)((int32_t)row + img->row_offset) % rowsperstrip + nrowsub;
 1234|   348k|        if (scanline > 0 && temp > (size_t)(TIFF_TMSIZE_T_MAX / scanline))
  ------------------
  |  |   68|   348k|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (1234:13): [True: 348k, False: 0]
  |  Branch (1234:29): [True: 0, False: 348k]
  ------------------
 1235|      0|        {
 1236|      0|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1237|      0|                          "Integer overflow in gtStripContig");
 1238|      0|            return 0;
 1239|      0|        }
 1240|   348k|        if (_TIFFReadEncodedStripAndAllocBuffer(
  ------------------
  |  Branch (1240:13): [True: 311k, False: 36.6k]
  ------------------
 1241|   348k|                tif,
 1242|   348k|                TIFFComputeStrip(tif,
 1243|   348k|                                 (uint32_t)((int32_t)row + img->row_offset), 0),
 1244|   348k|                (void **)(&buf), maxstripsize,
 1245|   348k|                (tmsize_t)((size_t)temp * (size_t)scanline)) ==
 1246|   348k|                (tmsize_t)(-1) &&
 1247|   311k|            (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (1247:14): [True: 96, False: 311k]
  |  Branch (1247:29): [True: 0, False: 311k]
  ------------------
 1248|     96|        {
 1249|     96|            ret = 0;
 1250|     96|            break;
 1251|     96|        }
 1252|       |
 1253|   348k|        pos = (tmsize_t)((uint32_t)((int32_t)row + img->row_offset) %
 1254|   348k|                         rowsperstrip) *
 1255|   348k|                  scanline +
 1256|   348k|              ((tmsize_t)img->col_offset * img->samplesperpixel);
 1257|   348k|        tmsize_t roffset = (tmsize_t)y * w;
 1258|   348k|        (*put)(img, raster + roffset, 0, y, wmin, nrow, fromskew, toskew,
 1259|   348k|               buf + pos);
 1260|   348k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|   348k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1260:25): [True: 347k, False: 622]
  ------------------
 1261|   348k|                                                 : (int32_t)nrow);
 1262|   348k|    }
 1263|       |
 1264|    538|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|    538|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (1264:9): [True: 11, False: 527]
  ------------------
 1265|     11|    {
 1266|       |        /* Flips the complete raster matrix horizontally. If raster width is
 1267|       |         * larger than image width, data are moved horizontally to the right
 1268|       |         * side.
 1269|       |         * Use wmin to only flip data in place. */
 1270|     11|        uint32_t line;
 1271|       |
 1272|   288k|        for (line = 0; line < h; line++)
  ------------------
  |  Branch (1272:24): [True: 288k, False: 11]
  ------------------
 1273|   288k|        {
 1274|   288k|            uint32_t *left = raster + (size_t)line * w;
 1275|       |            /* Use wmin to only flip horizontally data in place and not complete
 1276|       |             * raster-row. */
 1277|   288k|            uint32_t *right = left + wmin - 1;
 1278|       |
 1279|  3.42M|            while (left < right)
  ------------------
  |  Branch (1279:20): [True: 3.14M, False: 288k]
  ------------------
 1280|  3.14M|            {
 1281|  3.14M|                uint32_t temp = *left;
 1282|  3.14M|                *left = *right;
 1283|  3.14M|                *right = temp;
 1284|  3.14M|                left++;
 1285|  3.14M|                right--;
 1286|  3.14M|            }
 1287|   288k|        }
 1288|     11|    }
 1289|       |
 1290|    538|    _TIFFfreeExt(img->tif, buf);
 1291|    538|    return (ret);
 1292|    538|}
tif_getimage.c:BuildMapUaToAa:
 3390|     55|{
 3391|     55|    static const char module[] = "BuildMapUaToAa";
 3392|     55|    uint8_t *m;
 3393|     55|    uint16_t na, nv;
 3394|     55|    assert(img->UaToAa == NULL);
  ------------------
  |  Branch (3394:5): [True: 0, False: 55]
  |  Branch (3394:5): [True: 55, False: 0]
  ------------------
 3395|     55|    img->UaToAa = (uint8_t *)_TIFFmallocExt(img->tif, 65536);
 3396|     55|    if (img->UaToAa == NULL)
  ------------------
  |  Branch (3396:9): [True: 0, False: 55]
  ------------------
 3397|      0|    {
 3398|      0|        TIFFErrorExtR(img->tif, module, "Out of memory");
 3399|      0|        return (0);
 3400|      0|    }
 3401|     55|    m = img->UaToAa;
 3402|  14.1k|    for (na = 0; na < 256; na++)
  ------------------
  |  Branch (3402:18): [True: 14.0k, False: 55]
  ------------------
 3403|  14.0k|    {
 3404|  3.61M|        for (nv = 0; nv < 256; nv++)
  ------------------
  |  Branch (3404:22): [True: 3.60M, False: 14.0k]
  ------------------
 3405|  3.60M|            *m++ = (uint8_t)((nv * na + 127) / 255);
 3406|  14.0k|    }
 3407|     55|    return (1);
 3408|     55|}
tif_getimage.c:putRGBUAcontig8bittile:
 1883|  15.0k|{
 1884|  15.0k|    int samplesperpixel = img->samplesperpixel;
 1885|  15.0k|    (void)y;
 1886|  15.0k|    const tmsize_t fromskewLocal =
 1887|  15.0k|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1888|  14.7M|    for (; h > 0; --h)
  ------------------
  |  Branch (1888:12): [True: 14.7M, False: 15.0k]
  ------------------
 1889|  14.7M|    {
 1890|  14.7M|        uint32_t r, g, b, a;
 1891|  14.7M|        uint8_t *m;
 1892|   122M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1892:21): [True: 108M, False: 14.7M]
  ------------------
 1893|   108M|        {
 1894|   108M|            a = pp[3];
 1895|   108M|            m = img->UaToAa + ((size_t)a << 8);
 1896|   108M|            r = m[pp[0]];
 1897|   108M|            g = m[pp[1]];
 1898|   108M|            b = m[pp[2]];
 1899|   108M|            *cp++ = PACK4(r, g, b, a);
  ------------------
  |  | 1614|   108M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|   108M|     ((uint32_t)(a) << 24))
  ------------------
 1900|   108M|            pp += samplesperpixel;
 1901|   108M|        }
 1902|  14.7M|        cp += toskew;
 1903|  14.7M|        pp += fromskewLocal;
 1904|  14.7M|    }
 1905|  15.0k|}
tif_getimage.c:putRGBcontig8bittile:
 1841|  67.7k|{
 1842|  67.7k|    int samplesperpixel = img->samplesperpixel;
 1843|       |
 1844|  67.7k|    (void)x;
 1845|  67.7k|    (void)y;
 1846|  67.7k|    const tmsize_t fromskewLocal =
 1847|  67.7k|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1848|  3.43M|    for (; h > 0; --h)
  ------------------
  |  Branch (1848:12): [True: 3.36M, False: 67.7k]
  ------------------
 1849|  3.36M|    {
 1850|  3.36M|        UNROLL8(w, NOP, *cp++ = PACK(pp[0], pp[1], pp[2]);
  ------------------
  |  | 1554|  3.36M|    {                                                                          \
  |  | 1555|  3.36M|        uint32_t _x;                                                           \
  |  | 1556|  48.3M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1556:22): [True: 44.9M, False: 3.36M]
  |  |  ------------------
  |  | 1557|  44.9M|        {                                                                      \
  |  | 1558|  44.9M|            op1;                                                               \
  |  | 1559|  44.9M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1509|  44.9M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|  44.9M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  44.9M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  44.9M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|  44.9M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  44.9M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  44.9M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1510|  44.9M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|  44.9M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  44.9M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  44.9M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|  44.9M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  44.9M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  44.9M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1560|  44.9M|        }                                                                      \
  |  | 1561|  3.36M|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1561:13): [True: 3.11M, False: 249k]
  |  |  ------------------
  |  | 1562|  3.36M|        {                                                                      \
  |  | 1563|  3.11M|            op1;                                                               \
  |  | 1564|  3.11M|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1518|  3.11M|    switch (x)                                                                 \
  |  |  |  | 1519|  3.11M|    {                                                                          \
  |  |  |  | 1520|   615k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1520:9): [True: 615k, False: 2.50M]
  |  |  |  |  ------------------
  |  |  |  | 1521|   615k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1522|   689k|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1522:9): [True: 73.4k, False: 3.04M]
  |  |  |  |  ------------------
  |  |  |  | 1523|   689k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1524|   749k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1524:9): [True: 60.0k, False: 3.05M]
  |  |  |  |  ------------------
  |  |  |  | 1525|   749k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1526|   767k|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1526:9): [True: 17.6k, False: 3.10M]
  |  |  |  |  ------------------
  |  |  |  | 1527|   767k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1528|   987k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1528:9): [True: 220k, False: 2.89M]
  |  |  |  |  ------------------
  |  |  |  | 1529|   987k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1530|  2.81M|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1530:9): [True: 1.82M, False: 1.29M]
  |  |  |  |  ------------------
  |  |  |  | 1531|  2.81M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1532|  3.11M|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1532:9): [True: 304k, False: 2.81M]
  |  |  |  |  ------------------
  |  |  |  | 1533|  3.11M|            op;                                                                \
  |  |  |  | 1534|  3.11M|            break;                                                             \
  |  |  |  | 1535|  2.81M|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1535:9): [True: 0, False: 3.11M]
  |  |  |  |  ------------------
  |  |  |  | 1536|      0|            break;                                                             \
  |  |  |  | 1537|  3.11M|    }
  |  |  ------------------
  |  | 1565|  3.11M|        }                                                                      \
  |  | 1566|  3.36M|    }
  ------------------
 1851|  3.36M|                pp += samplesperpixel);
 1852|  3.36M|        cp += toskew;
 1853|  3.36M|        pp += fromskewLocal;
 1854|  3.36M|    }
 1855|  67.7k|}
tif_getimage.c:BuildMapBitdepth16To8:
 3411|     78|{
 3412|     78|    static const char module[] = "BuildMapBitdepth16To8";
 3413|     78|    uint8_t *m;
 3414|     78|    uint32_t n;
 3415|     78|    assert(img->Bitdepth16To8 == NULL);
  ------------------
  |  Branch (3415:5): [True: 0, False: 78]
  |  Branch (3415:5): [True: 78, False: 0]
  ------------------
 3416|     78|    img->Bitdepth16To8 = (uint8_t *)_TIFFmallocExt(img->tif, 65536);
 3417|     78|    if (img->Bitdepth16To8 == NULL)
  ------------------
  |  Branch (3417:9): [True: 0, False: 78]
  ------------------
 3418|      0|    {
 3419|      0|        TIFFErrorExtR(img->tif, module, "Out of memory");
 3420|      0|        return (0);
 3421|      0|    }
 3422|     78|    m = img->Bitdepth16To8;
 3423|  5.11M|    for (n = 0; n < 65536; n++)
  ------------------
  |  Branch (3423:17): [True: 5.11M, False: 78]
  ------------------
 3424|  5.11M|        *m++ = (uint8_t)((n + 128) / 257);
 3425|     78|    return (1);
 3426|     78|}
tif_getimage.c:putRGBAAcontig16bittile:
 1935|    324|{
 1936|    324|    int samplesperpixel = img->samplesperpixel;
 1937|    324|    uint16_t *wp = (uint16_t *)pp;
 1938|    324|    (void)y;
 1939|    324|    const tmsize_t fromskewLocal =
 1940|    324|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1941|  2.94k|    for (; h > 0; --h)
  ------------------
  |  Branch (1941:12): [True: 2.62k, False: 324]
  ------------------
 1942|  2.62k|    {
 1943|  8.65k|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1943:21): [True: 6.02k, False: 2.62k]
  ------------------
 1944|  6.02k|        {
 1945|  6.02k|            *cp++ = PACK4(img->Bitdepth16To8[wp[0]], img->Bitdepth16To8[wp[1]],
  ------------------
  |  | 1614|  6.02k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|  6.02k|     ((uint32_t)(a) << 24))
  ------------------
 1946|  6.02k|                          img->Bitdepth16To8[wp[2]], img->Bitdepth16To8[wp[3]]);
 1947|  6.02k|            wp += samplesperpixel;
 1948|  6.02k|        }
 1949|  2.62k|        cp += toskew;
 1950|  2.62k|        wp += fromskewLocal;
 1951|  2.62k|    }
 1952|    324|}
tif_getimage.c:putRGBUAcontig16bittile:
 1959|     83|{
 1960|     83|    int samplesperpixel = img->samplesperpixel;
 1961|     83|    uint16_t *wp = (uint16_t *)pp;
 1962|     83|    (void)y;
 1963|     83|    const tmsize_t fromskewLocal =
 1964|     83|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1965|   303k|    for (; h > 0; --h)
  ------------------
  |  Branch (1965:12): [True: 303k, False: 83]
  ------------------
 1966|   303k|    {
 1967|   303k|        uint32_t r, g, b, a;
 1968|   303k|        uint8_t *m;
 1969|  1.18M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1969:21): [True: 879k, False: 303k]
  ------------------
 1970|   879k|        {
 1971|   879k|            a = img->Bitdepth16To8[wp[3]];
 1972|   879k|            m = img->UaToAa + ((size_t)a << 8);
 1973|   879k|            r = m[img->Bitdepth16To8[wp[0]]];
 1974|   879k|            g = m[img->Bitdepth16To8[wp[1]]];
 1975|   879k|            b = m[img->Bitdepth16To8[wp[2]]];
 1976|   879k|            *cp++ = PACK4(r, g, b, a);
  ------------------
  |  | 1614|   879k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|   879k|     ((uint32_t)(a) << 24))
  ------------------
 1977|   879k|            wp += samplesperpixel;
 1978|   879k|        }
 1979|   303k|        cp += toskew;
 1980|   303k|        wp += fromskewLocal;
 1981|   303k|    }
 1982|     83|}
tif_getimage.c:putRGBcontig16bittile:
 1911|    522|{
 1912|    522|    int samplesperpixel = img->samplesperpixel;
 1913|    522|    uint16_t *wp = (uint16_t *)pp;
 1914|    522|    (void)y;
 1915|    522|    const tmsize_t fromskewLocal =
 1916|    522|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1917|  10.1k|    for (; h > 0; --h)
  ------------------
  |  Branch (1917:12): [True: 9.59k, False: 522]
  ------------------
 1918|  9.59k|    {
 1919|   191M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1919:21): [True: 191M, False: 9.59k]
  ------------------
 1920|   191M|        {
 1921|   191M|            *cp++ = PACK(img->Bitdepth16To8[wp[0]], img->Bitdepth16To8[wp[1]],
  ------------------
  |  | 1612|   191M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1610|   191M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 1922|   191M|                         img->Bitdepth16To8[wp[2]]);
 1923|   191M|            wp += samplesperpixel;
 1924|   191M|        }
 1925|  9.59k|        cp += toskew;
 1926|  9.59k|        wp += fromskewLocal;
 1927|  9.59k|    }
 1928|    522|}
tif_getimage.c:buildMap:
 3082|  1.74k|{
 3083|  1.74k|    switch (img->photometric)
 3084|  1.74k|    {
 3085|      0|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|      0|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (3085:9): [True: 0, False: 1.74k]
  ------------------
 3086|      0|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|      0|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (3086:9): [True: 0, False: 1.74k]
  ------------------
 3087|     13|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     13|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (3087:9): [True: 13, False: 1.72k]
  ------------------
 3088|     13|            if (img->bitspersample == 8)
  ------------------
  |  Branch (3088:17): [True: 11, False: 2]
  ------------------
 3089|     11|                break;
 3090|       |            /* fall through... */
 3091|  1.42k|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|  1.42k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (3091:9): [True: 1.42k, False: 316]
  ------------------
 3092|  1.68k|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|  1.68k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (3092:9): [True: 261, False: 1.48k]
  ------------------
 3093|  1.68k|            if (!setupMap(img))
  ------------------
  |  Branch (3093:17): [True: 0, False: 1.68k]
  ------------------
 3094|      0|                return (0);
 3095|  1.68k|            break;
 3096|  1.68k|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|     33|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (3096:9): [True: 33, False: 1.70k]
  ------------------
 3097|       |            /*
 3098|       |             * Convert 16-bit colormap to 8-bit (unless it looks
 3099|       |             * like an old-style 8-bit colormap).
 3100|       |             */
 3101|     33|            if (checkcmap(img) == 16)
  ------------------
  |  Branch (3101:17): [True: 18, False: 15]
  ------------------
 3102|     18|                cvtcmap(img);
 3103|     15|            else
 3104|     15|                TIFFWarningExtR(img->tif, TIFFFileName(img->tif),
 3105|     15|                                "Assuming 8-bit colormap");
 3106|       |            /*
 3107|       |             * Use mapping table and colormap to construct
 3108|       |             * unpacking tables for samples < 8 bits.
 3109|       |             */
 3110|     33|            if (img->bitspersample <= 8 && !makecmap(img))
  ------------------
  |  Branch (3110:17): [True: 33, False: 0]
  |  Branch (3110:44): [True: 0, False: 33]
  ------------------
 3111|      0|                return (0);
 3112|     33|            break;
 3113|     33|        default:
  ------------------
  |  Branch (3113:9): [True: 9, False: 1.73k]
  ------------------
 3114|      9|            break;
 3115|  1.74k|    }
 3116|  1.74k|    return (1);
 3117|  1.74k|}
tif_getimage.c:setupMap:
 2935|  1.68k|{
 2936|  1.68k|    int32_t x, range;
 2937|       |
 2938|  1.68k|    range = (int32_t)((1U << img->bitspersample) - 1U);
 2939|       |
 2940|       |    /* treat 16 bit the same as eight bit */
 2941|  1.68k|    if (img->bitspersample == 16)
  ------------------
  |  Branch (2941:9): [True: 157, False: 1.53k]
  ------------------
 2942|    157|        range = 255;
 2943|       |
 2944|  1.68k|    img->Map = (TIFFRGBValue *)_TIFFmallocExt(
 2945|  1.68k|        img->tif, (tmsize_t)((size_t)(range + 1) * sizeof(TIFFRGBValue)));
 2946|  1.68k|    if (img->Map == NULL)
  ------------------
  |  Branch (2946:9): [True: 0, False: 1.68k]
  ------------------
 2947|      0|    {
 2948|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
 2949|      0|                      "No space for photometric conversion table");
 2950|      0|        return (0);
 2951|      0|    }
 2952|  1.68k|    if (img->photometric == PHOTOMETRIC_MINISWHITE)
  ------------------
  |  |  221|  1.68k|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (2952:9): [True: 261, False: 1.42k]
  ------------------
 2953|    261|    {
 2954|  2.05k|        for (x = 0; x <= range; x++)
  ------------------
  |  Branch (2954:21): [True: 1.79k, False: 261]
  ------------------
 2955|  1.79k|            img->Map[x] = (TIFFRGBValue)(((range - x) * 255) / range);
 2956|    261|    }
 2957|  1.42k|    else
 2958|  1.42k|    {
 2959|   294k|        for (x = 0; x <= range; x++)
  ------------------
  |  Branch (2959:21): [True: 293k, False: 1.42k]
  ------------------
 2960|   293k|            img->Map[x] = (TIFFRGBValue)((x * 255) / range);
 2961|  1.42k|    }
 2962|  1.68k|    if (img->bitspersample <= 16 &&
  ------------------
  |  Branch (2962:9): [True: 1.68k, False: 0]
  ------------------
 2963|  1.68k|        (img->photometric == PHOTOMETRIC_MINISBLACK ||
  ------------------
  |  |  222|  3.37k|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (2963:10): [True: 1.42k, False: 263]
  ------------------
 2964|    263|         img->photometric == PHOTOMETRIC_MINISWHITE))
  ------------------
  |  |  221|    263|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (2964:10): [True: 261, False: 2]
  ------------------
 2965|  1.68k|    {
 2966|       |        /*
 2967|       |         * Use photometric mapping table to construct
 2968|       |         * unpacking tables for samples <= 8 bits.
 2969|       |         */
 2970|  1.68k|        if (!makebwmap(img))
  ------------------
  |  Branch (2970:13): [True: 0, False: 1.68k]
  ------------------
 2971|      0|            return (0);
 2972|       |        /* no longer need Map, free it */
 2973|  1.68k|        _TIFFfreeExt(img->tif, img->Map);
 2974|  1.68k|        img->Map = NULL;
 2975|  1.68k|    }
 2976|  1.68k|    return (1);
 2977|  1.68k|}
tif_getimage.c:makebwmap:
 2867|  1.68k|{
 2868|  1.68k|    TIFFRGBValue *Map = img->Map;
 2869|  1.68k|    int bitspersample = img->bitspersample;
 2870|  1.68k|    int nsamples = 8 / bitspersample;
 2871|  1.68k|    int i;
 2872|  1.68k|    uint32_t *p;
 2873|       |
 2874|  1.68k|    if (nsamples == 0)
  ------------------
  |  Branch (2874:9): [True: 157, False: 1.52k]
  ------------------
 2875|    157|        nsamples = 1;
 2876|       |
 2877|  1.68k|    img->BWmap = (uint32_t **)_TIFFmallocExt(
 2878|  1.68k|        img->tif,
 2879|  1.68k|        (tmsize_t)((size_t)256 * sizeof(uint32_t *) +
 2880|  1.68k|                   ((size_t)256 * (size_t)nsamples * sizeof(uint32_t))));
 2881|  1.68k|    if (img->BWmap == NULL)
  ------------------
  |  Branch (2881:9): [True: 0, False: 1.68k]
  ------------------
 2882|      0|    {
 2883|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
 2884|      0|                      "No space for B&W mapping table");
 2885|      0|        return (0);
 2886|      0|    }
 2887|  1.68k|    p = (uint32_t *)(img->BWmap + 256);
 2888|   433k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (2888:17): [True: 431k, False: 1.68k]
  ------------------
 2889|   431k|    {
 2890|   431k|        TIFFRGBValue c;
 2891|   431k|        img->BWmap[i] = p;
 2892|   431k|        switch (bitspersample)
 2893|   431k|        {
 2894|      0|#define GREY(x)                                                                \
 2895|      0|    c = Map[x];                                                                \
 2896|      0|    *p++ = PACK(c, c, c);
 2897|   123k|            case 1:
  ------------------
  |  Branch (2897:13): [True: 123k, False: 307k]
  ------------------
 2898|   123k|                GREY(i >> 7);
  ------------------
  |  | 2895|   123k|    c = Map[x];                                                                \
  |  | 2896|   123k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   123k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   123k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2899|   123k|                GREY((i >> 6) & 1);
  ------------------
  |  | 2895|   123k|    c = Map[x];                                                                \
  |  | 2896|   123k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   123k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   123k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2900|   123k|                GREY((i >> 5) & 1);
  ------------------
  |  | 2895|   123k|    c = Map[x];                                                                \
  |  | 2896|   123k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   123k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   123k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2901|   123k|                GREY((i >> 4) & 1);
  ------------------
  |  | 2895|   123k|    c = Map[x];                                                                \
  |  | 2896|   123k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   123k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   123k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2902|   123k|                GREY((i >> 3) & 1);
  ------------------
  |  | 2895|   123k|    c = Map[x];                                                                \
  |  | 2896|   123k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   123k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   123k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2903|   123k|                GREY((i >> 2) & 1);
  ------------------
  |  | 2895|   123k|    c = Map[x];                                                                \
  |  | 2896|   123k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   123k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   123k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2904|   123k|                GREY((i >> 1) & 1);
  ------------------
  |  | 2895|   123k|    c = Map[x];                                                                \
  |  | 2896|   123k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   123k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   123k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2905|   123k|                GREY(i & 1);
  ------------------
  |  | 2895|   123k|    c = Map[x];                                                                \
  |  | 2896|   123k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   123k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   123k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2906|   123k|                break;
 2907|  11.7k|            case 2:
  ------------------
  |  Branch (2907:13): [True: 11.7k, False: 419k]
  ------------------
 2908|  11.7k|                GREY(i >> 6);
  ------------------
  |  | 2895|  11.7k|    c = Map[x];                                                                \
  |  | 2896|  11.7k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  11.7k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  11.7k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2909|  11.7k|                GREY((i >> 4) & 3);
  ------------------
  |  | 2895|  11.7k|    c = Map[x];                                                                \
  |  | 2896|  11.7k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  11.7k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  11.7k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2910|  11.7k|                GREY((i >> 2) & 3);
  ------------------
  |  | 2895|  11.7k|    c = Map[x];                                                                \
  |  | 2896|  11.7k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  11.7k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  11.7k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2911|  11.7k|                GREY(i & 3);
  ------------------
  |  | 2895|  11.7k|    c = Map[x];                                                                \
  |  | 2896|  11.7k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  11.7k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  11.7k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2912|  11.7k|                break;
 2913|  2.30k|            case 4:
  ------------------
  |  Branch (2913:13): [True: 2.30k, False: 429k]
  ------------------
 2914|  2.30k|                GREY(i >> 4);
  ------------------
  |  | 2895|  2.30k|    c = Map[x];                                                                \
  |  | 2896|  2.30k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  2.30k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  2.30k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2915|  2.30k|                GREY(i & 0xf);
  ------------------
  |  | 2895|  2.30k|    c = Map[x];                                                                \
  |  | 2896|  2.30k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|  2.30k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  2.30k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2916|  2.30k|                break;
 2917|   253k|            case 8:
  ------------------
  |  Branch (2917:13): [True: 253k, False: 177k]
  ------------------
 2918|   293k|            case 16:
  ------------------
  |  Branch (2918:13): [True: 40.1k, False: 391k]
  ------------------
 2919|   293k|                GREY(i);
  ------------------
  |  | 2895|   293k|    c = Map[x];                                                                \
  |  | 2896|   293k|    *p++ = PACK(c, c, c);
  |  |  ------------------
  |  |  |  | 1612|   293k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   293k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2920|   293k|                break;
 2921|      0|            default:
  ------------------
  |  Branch (2921:13): [True: 0, False: 431k]
  ------------------
 2922|      0|                break;
 2923|   431k|        }
 2924|   431k|#undef GREY
 2925|   431k|    }
 2926|  1.68k|    return (1);
 2927|  1.68k|}
tif_getimage.c:checkcmap:
 2980|     33|{
 2981|     33|    uint16_t *r = img->redcmap;
 2982|     33|    uint16_t *g = img->greencmap;
 2983|     33|    uint16_t *b = img->bluecmap;
 2984|     33|    long n = 1L << img->bitspersample;
 2985|       |
 2986|  3.42k|    while (n-- > 0)
  ------------------
  |  Branch (2986:12): [True: 3.41k, False: 15]
  ------------------
 2987|  3.41k|        if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
  ------------------
  |  Branch (2987:13): [True: 16, False: 3.39k]
  |  Branch (2987:28): [True: 1, False: 3.39k]
  |  Branch (2987:43): [True: 1, False: 3.39k]
  ------------------
 2988|     18|            return (16);
 2989|     15|    return (8);
 2990|     33|}
tif_getimage.c:cvtcmap:
 2993|     18|{
 2994|     18|    uint16_t *r = img->redcmap;
 2995|     18|    uint16_t *g = img->greencmap;
 2996|     18|    uint16_t *b = img->bluecmap;
 2997|     18|    long i;
 2998|       |
 2999|    594|    for (i = (1L << img->bitspersample) - 1; i >= 0; i--)
  ------------------
  |  Branch (2999:46): [True: 576, False: 18]
  ------------------
 3000|    576|    {
 3001|    576|#define CVT(x) ((uint16_t)((x) >> 8))
 3002|    576|        r[i] = CVT(r[i]);
  ------------------
  |  | 3001|    576|#define CVT(x) ((uint16_t)((x) >> 8))
  ------------------
 3003|    576|        g[i] = CVT(g[i]);
  ------------------
  |  | 3001|    576|#define CVT(x) ((uint16_t)((x) >> 8))
  ------------------
 3004|    576|        b[i] = CVT(b[i]);
  ------------------
  |  | 3001|    576|#define CVT(x) ((uint16_t)((x) >> 8))
  ------------------
 3005|    576|#undef CVT
 3006|    576|    }
 3007|     18|}
tif_getimage.c:makecmap:
 3017|     33|{
 3018|     33|    int bitspersample = img->bitspersample;
 3019|     33|    int nsamples = 8 / bitspersample;
 3020|     33|    uint16_t *r = img->redcmap;
 3021|     33|    uint16_t *g = img->greencmap;
 3022|     33|    uint16_t *b = img->bluecmap;
 3023|     33|    uint32_t *p;
 3024|     33|    int i;
 3025|       |
 3026|     33|    img->PALmap = (uint32_t **)_TIFFmallocExt(
 3027|     33|        img->tif,
 3028|     33|        (tmsize_t)((size_t)256 * sizeof(uint32_t *) +
 3029|     33|                   ((size_t)256 * (size_t)nsamples * sizeof(uint32_t))));
 3030|     33|    if (img->PALmap == NULL)
  ------------------
  |  Branch (3030:9): [True: 0, False: 33]
  ------------------
 3031|      0|    {
 3032|      0|        TIFFErrorExtR(img->tif, TIFFFileName(img->tif),
 3033|      0|                      "No space for Palette mapping table");
 3034|      0|        return (0);
 3035|      0|    }
 3036|     33|    p = (uint32_t *)(img->PALmap + 256);
 3037|  8.48k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (3037:17): [True: 8.44k, False: 33]
  ------------------
 3038|  8.44k|    {
 3039|  8.44k|        TIFFRGBValue c;
 3040|  8.44k|        img->PALmap[i] = p;
 3041|  8.44k|#define CMAP(x)                                                                \
 3042|  8.44k|    c = (TIFFRGBValue)x;                                                       \
 3043|  8.44k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
 3044|  8.44k|        switch (bitspersample)
 3045|  8.44k|        {
 3046|      0|            case 1:
  ------------------
  |  Branch (3046:13): [True: 0, False: 8.44k]
  ------------------
 3047|      0|                CMAP(i >> 7);
  ------------------
  |  | 3042|      0|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|      0|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|      0|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|      0|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3048|      0|                CMAP((i >> 6) & 1);
  ------------------
  |  | 3042|      0|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|      0|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|      0|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|      0|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3049|      0|                CMAP((i >> 5) & 1);
  ------------------
  |  | 3042|      0|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|      0|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|      0|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|      0|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3050|      0|                CMAP((i >> 4) & 1);
  ------------------
  |  | 3042|      0|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|      0|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|      0|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|      0|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3051|      0|                CMAP((i >> 3) & 1);
  ------------------
  |  | 3042|      0|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|      0|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|      0|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|      0|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3052|      0|                CMAP((i >> 2) & 1);
  ------------------
  |  | 3042|      0|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|      0|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|      0|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|      0|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3053|      0|                CMAP((i >> 1) & 1);
  ------------------
  |  | 3042|      0|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|      0|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|      0|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|      0|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3054|      0|                CMAP(i & 1);
  ------------------
  |  | 3042|      0|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|      0|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|      0|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|      0|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3055|      0|                break;
 3056|  4.60k|            case 2:
  ------------------
  |  Branch (3056:13): [True: 4.60k, False: 3.84k]
  ------------------
 3057|  4.60k|                CMAP(i >> 6);
  ------------------
  |  | 3042|  4.60k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|  4.60k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|  4.60k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  4.60k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3058|  4.60k|                CMAP((i >> 4) & 3);
  ------------------
  |  | 3042|  4.60k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|  4.60k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|  4.60k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  4.60k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3059|  4.60k|                CMAP((i >> 2) & 3);
  ------------------
  |  | 3042|  4.60k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|  4.60k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|  4.60k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  4.60k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3060|  4.60k|                CMAP(i & 3);
  ------------------
  |  | 3042|  4.60k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|  4.60k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|  4.60k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  4.60k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3061|  4.60k|                break;
 3062|      0|            case 4:
  ------------------
  |  Branch (3062:13): [True: 0, False: 8.44k]
  ------------------
 3063|      0|                CMAP(i >> 4);
  ------------------
  |  | 3042|      0|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|      0|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|      0|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|      0|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3064|      0|                CMAP(i & 0xf);
  ------------------
  |  | 3042|      0|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|      0|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|      0|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|      0|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3065|      0|                break;
 3066|  3.84k|            case 8:
  ------------------
  |  Branch (3066:13): [True: 3.84k, False: 4.60k]
  ------------------
 3067|  3.84k|                CMAP(i);
  ------------------
  |  | 3042|  3.84k|    c = (TIFFRGBValue)x;                                                       \
  |  | 3043|  3.84k|    *p++ = PACK(r[c] & 0xff, g[c] & 0xff, b[c] & 0xff);
  |  |  ------------------
  |  |  |  | 1612|  3.84k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  3.84k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3068|  3.84k|                break;
 3069|      0|            default:
  ------------------
  |  Branch (3069:13): [True: 0, False: 8.44k]
  ------------------
 3070|      0|                break;
 3071|  8.44k|        }
 3072|  8.44k|#undef CMAP
 3073|  8.44k|    }
 3074|     33|    return (1);
 3075|     33|}
tif_getimage.c:putRGBcontig8bitCMYKtile:
 1990|    590|{
 1991|    590|    int samplesperpixel = img->samplesperpixel;
 1992|    590|    uint16_t r, g, b, k;
 1993|       |
 1994|    590|    (void)x;
 1995|    590|    (void)y;
 1996|    590|    const tmsize_t fromskewLocal =
 1997|    590|        (tmsize_t)fromskew * (tmsize_t)samplesperpixel;
 1998|   256k|    for (; h > 0; --h)
  ------------------
  |  Branch (1998:12): [True: 256k, False: 590]
  ------------------
 1999|   256k|    {
 2000|   256k|        UNROLL8(w, NOP, k = (uint16_t)(255 - pp[3]);
  ------------------
  |  | 1554|   256k|    {                                                                          \
  |  | 1555|   256k|        uint32_t _x;                                                           \
  |  | 1556|   846k|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1556:22): [True: 590k, False: 256k]
  |  |  ------------------
  |  | 1557|   590k|        {                                                                      \
  |  | 1558|   590k|            op1;                                                               \
  |  | 1559|   590k|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1509|   590k|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|   590k|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   590k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   590k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|   590k|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   590k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   590k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1510|   590k|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|   590k|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   590k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   590k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|   590k|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   590k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   590k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1560|   590k|        }                                                                      \
  |  | 1561|   256k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1561:13): [True: 256k, False: 0]
  |  |  ------------------
  |  | 1562|   256k|        {                                                                      \
  |  | 1563|   256k|            op1;                                                               \
  |  | 1564|   256k|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1518|   256k|    switch (x)                                                                 \
  |  |  |  | 1519|   256k|    {                                                                          \
  |  |  |  | 1520|      0|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1520:9): [True: 0, False: 256k]
  |  |  |  |  ------------------
  |  |  |  | 1521|      0|            op; /*-fallthrough*/                                               \
  |  |  |  | 1522|      0|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1522:9): [True: 0, False: 256k]
  |  |  |  |  ------------------
  |  |  |  | 1523|      0|            op; /*-fallthrough*/                                               \
  |  |  |  | 1524|    260|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1524:9): [True: 260, False: 255k]
  |  |  |  |  ------------------
  |  |  |  | 1525|    260|            op; /*-fallthrough*/                                               \
  |  |  |  | 1526|  65.7k|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1526:9): [True: 65.5k, False: 190k]
  |  |  |  |  ------------------
  |  |  |  | 1527|  65.7k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1528|  65.7k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1528:9): [True: 5, False: 256k]
  |  |  |  |  ------------------
  |  |  |  | 1529|  65.7k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1530|   191k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1530:9): [True: 125k, False: 130k]
  |  |  |  |  ------------------
  |  |  |  | 1531|   191k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1532|   256k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1532:9): [True: 64.5k, False: 191k]
  |  |  |  |  ------------------
  |  |  |  | 1533|   256k|            op;                                                                \
  |  |  |  | 1534|   256k|            break;                                                             \
  |  |  |  | 1535|   191k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1535:9): [True: 0, False: 256k]
  |  |  |  |  ------------------
  |  |  |  | 1536|      0|            break;                                                             \
  |  |  |  | 1537|   256k|    }
  |  |  ------------------
  |  | 1565|   256k|        }                                                                      \
  |  | 1566|   256k|    }
  ------------------
 2001|   256k|                r = (uint16_t)((k * (uint16_t)(255 - pp[0])) / 255);
 2002|   256k|                g = (uint16_t)((k * (uint16_t)(255 - pp[1])) / 255);
 2003|   256k|                b = (uint16_t)((k * (uint16_t)(255 - pp[2])) / 255);
 2004|   256k|                *cp++ = PACK(r, g, b); pp += samplesperpixel);
 2005|   256k|        cp += toskew;
 2006|   256k|        pp += fromskewLocal;
 2007|   256k|    }
 2008|    590|}
tif_getimage.c:put8bitcmaptile:
 1626|  2.12k|{
 1627|  2.12k|    uint32_t **PALmap = img->PALmap;
 1628|  2.12k|    int samplesperpixel = img->samplesperpixel;
 1629|       |    /* Convert pixel skew to byte skew (8-bit samples) */
 1630|  2.12k|    const tmsize_t fromskewLocal =
 1631|  2.12k|        (tmsize_t)fromskew * +(tmsize_t)samplesperpixel;
 1632|       |
 1633|  2.12k|    (void)y;
 1634|  6.46k|    for (; h > 0; --h)
  ------------------
  |  Branch (1634:12): [True: 4.33k, False: 2.12k]
  ------------------
 1635|  4.33k|    {
 1636|   489k|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1636:21): [True: 485k, False: 4.33k]
  ------------------
 1637|   485k|        {
 1638|   485k|            *cp++ = PALmap[*pp][0];
 1639|   485k|            pp += samplesperpixel;
 1640|   485k|        }
 1641|  4.33k|        cp += toskew;
 1642|  4.33k|        pp += fromskewLocal;
 1643|  4.33k|    }
 1644|  2.12k|}
tif_getimage.c:put2bitcmaptile:
 1669|    104|{
 1670|    104|    uint32_t **PALmap = img->PALmap;
 1671|       |
 1672|    104|    (void)x;
 1673|    104|    (void)y;
 1674|    104|    fromskew /= 4;
 1675|  66.5k|    for (; h > 0; --h)
  ------------------
  |  Branch (1675:12): [True: 66.4k, False: 104]
  ------------------
 1676|  66.4k|    {
 1677|  66.4k|        uint32_t *bw;
 1678|  66.4k|        UNROLL4(w, bw = PALmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1568|  66.4k|    {                                                                          \
  |  | 1569|  66.4k|        uint32_t _x;                                                           \
  |  | 1570|   598k|        for (_x = w; _x >= 4; _x -= 4)                                         \
  |  |  ------------------
  |  |  |  Branch (1570:22): [True: 531k, False: 66.4k]
  |  |  ------------------
  |  | 1571|   531k|        {                                                                      \
  |  | 1572|   531k|            op1;                                                               \
  |  | 1573|   531k|            REPEAT4(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1512|   531k|    REPEAT2(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1515|   531k|    op;                                                                        \
  |  |  |  |  |  | 1516|   531k|    op
  |  |  |  |  ------------------
  |  |  |  | 1513|   531k|    REPEAT2(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1515|   531k|    op;                                                                        \
  |  |  |  |  |  | 1516|   531k|    op
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1574|   531k|        }                                                                      \
  |  | 1575|  66.4k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1575:13): [True: 66.3k, False: 120]
  |  |  ------------------
  |  | 1576|  66.4k|        {                                                                      \
  |  | 1577|  66.3k|            op1;                                                               \
  |  | 1578|  66.3k|            CASE4(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1539|  66.3k|    switch (x)                                                                 \
  |  |  |  | 1540|  66.3k|    {                                                                          \
  |  |  |  | 1541|      0|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1541:9): [True: 0, False: 66.3k]
  |  |  |  |  ------------------
  |  |  |  | 1542|      0|            op; /*-fallthrough*/                                               \
  |  |  |  | 1543|  65.3k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1543:9): [True: 65.3k, False: 1.02k]
  |  |  |  |  ------------------
  |  |  |  | 1544|  65.3k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1545|  66.3k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1545:9): [True: 1.02k, False: 65.3k]
  |  |  |  |  ------------------
  |  |  |  | 1546|  66.3k|            op;                                                                \
  |  |  |  | 1547|  66.3k|            break;                                                             \
  |  |  |  | 1548|  65.3k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1548:9): [True: 0, False: 66.3k]
  |  |  |  |  ------------------
  |  |  |  | 1549|      0|            break;                                                             \
  |  |  |  | 1550|  66.3k|    }
  |  |  ------------------
  |  | 1579|  66.3k|        }                                                                      \
  |  | 1580|  66.4k|    }
  ------------------
 1679|  66.4k|        cp += toskew;
 1680|  66.4k|        pp += fromskew;
 1681|  66.4k|    }
 1682|    104|}
tif_getimage.c:put16bitbwtile:
 1755|  6.09k|{
 1756|  6.09k|    int samplesperpixel = img->samplesperpixel;
 1757|  6.09k|    uint32_t **BWmap = img->BWmap;
 1758|       |    /* Convert pixel skew to byte skew (16-bit samples) */
 1759|  6.09k|    const tmsize_t fromskewLocal =
 1760|  6.09k|        (tmsize_t)fromskew * (tmsize_t)(2 * samplesperpixel);
 1761|       |
 1762|  6.09k|    (void)y;
 1763|   129k|    for (; h > 0; --h)
  ------------------
  |  Branch (1763:12): [True: 122k, False: 6.09k]
  ------------------
 1764|   122k|    {
 1765|   122k|        uint16_t *wp = (uint16_t *)pp;
 1766|       |
 1767|  10.8M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1767:21): [True: 10.7M, False: 122k]
  ------------------
 1768|  10.7M|        {
 1769|       |            /* use high order byte of 16bit value */
 1770|       |
 1771|  10.7M|            *cp++ = BWmap[*wp >> 8][0];
 1772|  10.7M|            pp += 2 * samplesperpixel;
 1773|  10.7M|            wp += samplesperpixel;
 1774|  10.7M|        }
 1775|   122k|        cp += toskew;
 1776|   122k|        pp += fromskewLocal;
 1777|   122k|    }
 1778|  6.09k|}
tif_getimage.c:putagreytile:
 1731|    353|{
 1732|    353|    int samplesperpixel = img->samplesperpixel;
 1733|    353|    uint32_t **BWmap = img->BWmap;
 1734|       |    /* Convert pixel skew to byte skew (8-bit samples) */
 1735|    353|    const tmsize_t fromskewLocal =
 1736|    353|        (tmsize_t)fromskew * +(tmsize_t)samplesperpixel;
 1737|       |
 1738|    353|    (void)y;
 1739|   132k|    for (; h > 0; --h)
  ------------------
  |  Branch (1739:12): [True: 132k, False: 353]
  ------------------
 1740|   132k|    {
 1741|  1.49M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1741:21): [True: 1.36M, False: 132k]
  ------------------
 1742|  1.36M|        {
 1743|  1.36M|            *cp++ = BWmap[*pp][0] & ((uint32_t)*(pp + 1) << 24 | ~A1);
  ------------------
  |  | 1610|  1.36M|#define A1 (((uint32_t)0xffL) << 24)
  ------------------
 1744|  1.36M|            pp += samplesperpixel;
 1745|  1.36M|        }
 1746|   132k|        cp += toskew;
 1747|   132k|        pp += fromskewLocal;
 1748|   132k|    }
 1749|    353|}
tif_getimage.c:putgreytile:
 1707|   406k|{
 1708|   406k|    int samplesperpixel = img->samplesperpixel;
 1709|   406k|    uint32_t **BWmap = img->BWmap;
 1710|       |    /* Convert pixel skew to byte skew (8-bit samples) */
 1711|   406k|    const tmsize_t fromskewLocal =
 1712|   406k|        (tmsize_t)fromskew * +(tmsize_t)samplesperpixel;
 1713|       |
 1714|   406k|    (void)y;
 1715|  26.3M|    for (; h > 0; --h)
  ------------------
  |  Branch (1715:12): [True: 25.9M, False: 406k]
  ------------------
 1716|  25.9M|    {
 1717|  1.73G|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (1717:21): [True: 1.71G, False: 25.9M]
  ------------------
 1718|  1.71G|        {
 1719|  1.71G|            *cp++ = BWmap[*pp][0];
 1720|  1.71G|            pp += samplesperpixel;
 1721|  1.71G|        }
 1722|  25.9M|        cp += toskew;
 1723|  25.9M|        pp += fromskewLocal;
 1724|  25.9M|    }
 1725|   406k|}
tif_getimage.c:put4bitbwtile:
 1822|    716|{
 1823|    716|    uint32_t **BWmap = img->BWmap;
 1824|       |
 1825|    716|    (void)x;
 1826|    716|    (void)y;
 1827|    716|    fromskew /= 2;
 1828|  93.1k|    for (; h > 0; --h)
  ------------------
  |  Branch (1828:12): [True: 92.3k, False: 716]
  ------------------
 1829|  92.3k|    {
 1830|  92.3k|        uint32_t *bw;
 1831|  92.3k|        UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1582|  92.3k|    {                                                                          \
  |  | 1583|  92.3k|        uint32_t _x;                                                           \
  |  | 1584|  37.7M|        for (_x = w; _x >= 2; _x -= 2)                                         \
  |  |  ------------------
  |  |  |  Branch (1584:22): [True: 37.6M, False: 92.3k]
  |  |  ------------------
  |  | 1585|  37.6M|        {                                                                      \
  |  | 1586|  37.6M|            op1;                                                               \
  |  | 1587|  37.6M|            REPEAT2(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1515|  37.6M|    op;                                                                        \
  |  |  |  | 1516|  37.6M|    op
  |  |  ------------------
  |  | 1588|  37.6M|        }                                                                      \
  |  | 1589|  92.3k|        if (_x)                                                                \
  |  |  ------------------
  |  |  |  Branch (1589:13): [True: 91.6k, False: 771]
  |  |  ------------------
  |  | 1590|  92.3k|        {                                                                      \
  |  | 1591|  91.6k|            op1;                                                               \
  |  | 1592|  91.6k|            op2;                                                               \
  |  | 1593|  91.6k|        }                                                                      \
  |  | 1594|  92.3k|    }
  ------------------
 1832|  92.3k|        cp += toskew;
 1833|  92.3k|        pp += fromskew;
 1834|  92.3k|    }
 1835|    716|}
tif_getimage.c:put2bitbwtile:
 1803|  2.16k|{
 1804|  2.16k|    uint32_t **BWmap = img->BWmap;
 1805|       |
 1806|  2.16k|    (void)x;
 1807|  2.16k|    (void)y;
 1808|  2.16k|    fromskew /= 4;
 1809|   343k|    for (; h > 0; --h)
  ------------------
  |  Branch (1809:12): [True: 341k, False: 2.16k]
  ------------------
 1810|   341k|    {
 1811|   341k|        uint32_t *bw;
 1812|   341k|        UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1568|   341k|    {                                                                          \
  |  | 1569|   341k|        uint32_t _x;                                                           \
  |  | 1570|  2.31M|        for (_x = w; _x >= 4; _x -= 4)                                         \
  |  |  ------------------
  |  |  |  Branch (1570:22): [True: 1.97M, False: 341k]
  |  |  ------------------
  |  | 1571|  1.97M|        {                                                                      \
  |  | 1572|  1.97M|            op1;                                                               \
  |  | 1573|  1.97M|            REPEAT4(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1512|  1.97M|    REPEAT2(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1515|  1.97M|    op;                                                                        \
  |  |  |  |  |  | 1516|  1.97M|    op
  |  |  |  |  ------------------
  |  |  |  | 1513|  1.97M|    REPEAT2(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1515|  1.97M|    op;                                                                        \
  |  |  |  |  |  | 1516|  1.97M|    op
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1574|  1.97M|        }                                                                      \
  |  | 1575|   341k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1575:13): [True: 340k, False: 651]
  |  |  ------------------
  |  | 1576|   341k|        {                                                                      \
  |  | 1577|   340k|            op1;                                                               \
  |  | 1578|   340k|            CASE4(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1539|   340k|    switch (x)                                                                 \
  |  |  |  | 1540|   340k|    {                                                                          \
  |  |  |  | 1541|  29.6k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1541:9): [True: 29.6k, False: 311k]
  |  |  |  |  ------------------
  |  |  |  | 1542|  29.6k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1543|   162k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1543:9): [True: 132k, False: 208k]
  |  |  |  |  ------------------
  |  |  |  | 1544|   162k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1545|   340k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1545:9): [True: 178k, False: 162k]
  |  |  |  |  ------------------
  |  |  |  | 1546|   340k|            op;                                                                \
  |  |  |  | 1547|   340k|            break;                                                             \
  |  |  |  | 1548|   162k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1548:9): [True: 0, False: 340k]
  |  |  |  |  ------------------
  |  |  |  | 1549|      0|            break;                                                             \
  |  |  |  | 1550|   340k|    }
  |  |  ------------------
  |  | 1579|   340k|        }                                                                      \
  |  | 1580|   341k|    }
  ------------------
 1813|   341k|        cp += toskew;
 1814|   341k|        pp += fromskew;
 1815|   341k|    }
 1816|  2.16k|}
tif_getimage.c:put1bitbwtile:
 1784|  83.5k|{
 1785|  83.5k|    uint32_t **BWmap = img->BWmap;
 1786|       |
 1787|  83.5k|    (void)x;
 1788|  83.5k|    (void)y;
 1789|  83.5k|    fromskew /= 8;
 1790|  8.14M|    for (; h > 0; --h)
  ------------------
  |  Branch (1790:12): [True: 8.06M, False: 83.5k]
  ------------------
 1791|  8.06M|    {
 1792|  8.06M|        uint32_t *bw;
 1793|  8.06M|        UNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++);
  ------------------
  |  | 1554|  8.06M|    {                                                                          \
  |  | 1555|  8.06M|        uint32_t _x;                                                           \
  |  | 1556|   163M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1556:22): [True: 155M, False: 8.06M]
  |  |  ------------------
  |  | 1557|   155M|        {                                                                      \
  |  | 1558|   155M|            op1;                                                               \
  |  | 1559|   155M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1509|   155M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|   155M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   155M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   155M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|   155M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   155M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   155M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1510|   155M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|   155M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   155M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   155M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|   155M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   155M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   155M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1560|   155M|        }                                                                      \
  |  | 1561|  8.06M|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1561:13): [True: 7.94M, False: 119k]
  |  |  ------------------
  |  | 1562|  8.06M|        {                                                                      \
  |  | 1563|  7.94M|            op1;                                                               \
  |  | 1564|  7.94M|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1518|  7.94M|    switch (x)                                                                 \
  |  |  |  | 1519|  7.94M|    {                                                                          \
  |  |  |  | 1520|  65.4k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1520:9): [True: 65.4k, False: 7.87M]
  |  |  |  |  ------------------
  |  |  |  | 1521|  65.4k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1522|   129k|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1522:9): [True: 64.2k, False: 7.88M]
  |  |  |  |  ------------------
  |  |  |  | 1523|   129k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1524|   918k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1524:9): [True: 788k, False: 7.15M]
  |  |  |  |  ------------------
  |  |  |  | 1525|   918k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1526|  6.75M|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1526:9): [True: 5.83M, False: 2.10M]
  |  |  |  |  ------------------
  |  |  |  | 1527|  6.75M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1528|  7.55M|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1528:9): [True: 793k, False: 7.15M]
  |  |  |  |  ------------------
  |  |  |  | 1529|  7.55M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1530|  7.62M|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1530:9): [True: 69.4k, False: 7.87M]
  |  |  |  |  ------------------
  |  |  |  | 1531|  7.62M|            op; /*-fallthrough*/                                               \
  |  |  |  | 1532|  7.94M|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1532:9): [True: 323k, False: 7.62M]
  |  |  |  |  ------------------
  |  |  |  | 1533|  7.94M|            op;                                                                \
  |  |  |  | 1534|  7.94M|            break;                                                             \
  |  |  |  | 1535|  7.62M|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1535:9): [True: 0, False: 7.94M]
  |  |  |  |  ------------------
  |  |  |  | 1536|      0|            break;                                                             \
  |  |  |  | 1537|  7.94M|    }
  |  |  ------------------
  |  | 1565|  7.94M|        }                                                                      \
  |  | 1566|  8.06M|    }
  ------------------
 1794|  8.06M|        cp += toskew;
 1795|  8.06M|        pp += fromskew;
 1796|  8.06M|    }
 1797|  83.5k|}
tif_getimage.c:initYCbCrConversion:
 2764|  1.02k|{
 2765|  1.02k|    static const char module[] = "initYCbCrConversion";
 2766|       |
 2767|  1.02k|    float *luma, *refBlackWhite;
 2768|       |
 2769|  1.02k|    if (img->ycbcr == NULL)
  ------------------
  |  Branch (2769:9): [True: 1.02k, False: 0]
  ------------------
 2770|  1.02k|    {
 2771|  1.02k|        img->ycbcr = (TIFFYCbCrToRGB *)_TIFFmallocExt(
 2772|  1.02k|            img->tif, TIFFroundup_32(sizeof(TIFFYCbCrToRGB), sizeof(long)) +
  ------------------
  |  |  322|  1.02k|#define TIFFroundup_32(x, y) ((uint32_t)(TIFFhowmany_32(x, y) * (uint32_t)(y)))
  |  |  ------------------
  |  |  |  |  312|  1.02k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (312:6): [True: 1.02k, Folded]
  |  |  |  |  ------------------
  |  |  |  |  313|  1.02k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  |  |  314|  1.02k|         : 0U)
  |  |  ------------------
  ------------------
 2773|  1.02k|                          4 * 256 * sizeof(TIFFRGBValue) +
 2774|  1.02k|                          2 * 256 * sizeof(int) + 3 * 256 * sizeof(int32_t));
 2775|  1.02k|        if (img->ycbcr == NULL)
  ------------------
  |  Branch (2775:13): [True: 0, False: 1.02k]
  ------------------
 2776|      0|        {
 2777|      0|            TIFFErrorExtR(img->tif, module,
 2778|      0|                          "No space for YCbCr->RGB conversion state");
 2779|      0|            return (0);
 2780|      0|        }
 2781|  1.02k|    }
 2782|       |
 2783|  1.02k|    TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRCOEFFICIENTS, &luma);
  ------------------
  |  |  387|  1.02k|#define TIFFTAG_YCBCRCOEFFICIENTS 529      /* !RGB -> YCbCr transform */
  ------------------
 2784|  1.02k|    TIFFGetFieldDefaulted(img->tif, TIFFTAG_REFERENCEBLACKWHITE,
  ------------------
  |  |  392|  1.02k|#define TIFFTAG_REFERENCEBLACKWHITE 532    /* !colorimetry info */
  ------------------
 2785|  1.02k|                          &refBlackWhite);
 2786|       |
 2787|       |    /* Do some validation to avoid later issues. Detect NaN for now */
 2788|       |    /* and also if lumaGreen is zero since we divide by it later */
 2789|  1.02k|    if (isnan(luma[0]) || isnan(luma[1]) || TIFF_FLOAT_EQ(luma[1], 0.0f) ||
  ------------------
  |  |  342|  2.04k|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (342:29): [True: 1, False: 1.02k]
  |  |  ------------------
  ------------------
  |  Branch (2789:9): [True: 0, False: 1.02k]
  |  Branch (2789:27): [True: 0, False: 1.02k]
  ------------------
 2790|  1.02k|        isnan(luma[2]))
  ------------------
  |  Branch (2790:9): [True: 0, False: 1.02k]
  ------------------
 2791|      1|    {
 2792|      1|        TIFFErrorExtR(img->tif, module,
 2793|      1|                      "Invalid values for YCbCrCoefficients tag");
 2794|      1|        return (0);
 2795|      1|    }
 2796|       |
 2797|  1.02k|    if (!isInRefBlackWhiteRange(refBlackWhite[0]) ||
  ------------------
  |  Branch (2797:9): [True: 0, False: 1.02k]
  ------------------
 2798|  1.02k|        !isInRefBlackWhiteRange(refBlackWhite[1]) ||
  ------------------
  |  Branch (2798:9): [True: 0, False: 1.02k]
  ------------------
 2799|  1.02k|        !isInRefBlackWhiteRange(refBlackWhite[2]) ||
  ------------------
  |  Branch (2799:9): [True: 0, False: 1.02k]
  ------------------
 2800|  1.02k|        !isInRefBlackWhiteRange(refBlackWhite[3]) ||
  ------------------
  |  Branch (2800:9): [True: 1, False: 1.02k]
  ------------------
 2801|  1.02k|        !isInRefBlackWhiteRange(refBlackWhite[4]) ||
  ------------------
  |  Branch (2801:9): [True: 0, False: 1.02k]
  ------------------
 2802|  1.02k|        !isInRefBlackWhiteRange(refBlackWhite[5]))
  ------------------
  |  Branch (2802:9): [True: 0, False: 1.02k]
  ------------------
 2803|      1|    {
 2804|      1|        TIFFErrorExtR(img->tif, module,
 2805|      1|                      "Invalid values for ReferenceBlackWhite tag");
 2806|      1|        return (0);
 2807|      1|    }
 2808|       |
 2809|  1.02k|    if (TIFFYCbCrToRGBInit(img->ycbcr, luma, refBlackWhite) < 0)
  ------------------
  |  Branch (2809:9): [True: 0, False: 1.02k]
  ------------------
 2810|      0|        return (0);
 2811|  1.02k|    return (1);
 2812|  1.02k|}
tif_getimage.c:isInRefBlackWhiteRange:
 2759|  6.13k|{
 2760|  6.13k|    return f > (float)(-0x7FFFFFFF + 128) && f < (float)0x7FFFFFFF;
  ------------------
  |  Branch (2760:12): [True: 6.13k, False: 1]
  |  Branch (2760:46): [True: 6.13k, False: 0]
  ------------------
 2761|  6.13k|}
tif_getimage.c:putcontig8bitYCbCr44tile:
 2262|   128k|{
 2263|   128k|    uint32_t *cp1 = cp + w + toskew;
 2264|   128k|    uint32_t *cp2 = cp1 + w + toskew;
 2265|   128k|    uint32_t *cp3 = cp2 + w + toskew;
 2266|   128k|    const tmsize_t incr = 3 * (tmsize_t)w + 4 * (tmsize_t)toskew;
 2267|       |
 2268|   128k|    (void)y;
 2269|       |    /* adjust fromskew */
 2270|   128k|    const tmsize_t fromskewLocal =
 2271|   128k|        (tmsize_t)(fromskew / 4) * (tmsize_t)(4 * 4 + 2);
 2272|   128k|    if ((h & 3) == 0 && (w & 3) == 0)
  ------------------
  |  Branch (2272:9): [True: 7.28k, False: 120k]
  |  Branch (2272:25): [True: 1.66k, False: 5.61k]
  ------------------
 2273|  1.66k|    {
 2274|  15.8k|        for (; h >= 4; h -= 4)
  ------------------
  |  Branch (2274:16): [True: 14.1k, False: 1.66k]
  ------------------
 2275|  14.1k|        {
 2276|  14.1k|            x = w >> 2;
 2277|  14.1k|            do
 2278|   314k|            {
 2279|   314k|                int32_t Cb = pp[16];
 2280|   314k|                int32_t Cr = pp[17];
 2281|       |
 2282|   314k|                YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2283|   314k|                YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2284|   314k|                YCbCrtoRGB(cp[2], pp[2]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2285|   314k|                YCbCrtoRGB(cp[3], pp[3]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2286|   314k|                YCbCrtoRGB(cp1[0], pp[4]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2287|   314k|                YCbCrtoRGB(cp1[1], pp[5]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2288|   314k|                YCbCrtoRGB(cp1[2], pp[6]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2289|   314k|                YCbCrtoRGB(cp1[3], pp[7]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2290|   314k|                YCbCrtoRGB(cp2[0], pp[8]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2291|   314k|                YCbCrtoRGB(cp2[1], pp[9]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2292|   314k|                YCbCrtoRGB(cp2[2], pp[10]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2293|   314k|                YCbCrtoRGB(cp2[3], pp[11]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2294|   314k|                YCbCrtoRGB(cp3[0], pp[12]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2295|   314k|                YCbCrtoRGB(cp3[1], pp[13]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2296|   314k|                YCbCrtoRGB(cp3[2], pp[14]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2297|   314k|                YCbCrtoRGB(cp3[3], pp[15]);
  ------------------
  |  | 2252|   314k|    {                                                                          \
  |  | 2253|   314k|        uint32_t r, g, b;                                                      \
  |  | 2254|   314k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   314k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   314k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   314k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   314k|    }
  ------------------
 2298|       |
 2299|   314k|                cp += 4;
 2300|   314k|                cp1 += 4;
 2301|   314k|                cp2 += 4;
 2302|   314k|                cp3 += 4;
 2303|   314k|                pp += 18;
 2304|   314k|            } while (--x);
  ------------------
  |  Branch (2304:22): [True: 300k, False: 14.1k]
  ------------------
 2305|  14.1k|            cp += incr;
 2306|  14.1k|            cp1 += incr;
 2307|  14.1k|            cp2 += incr;
 2308|  14.1k|            cp3 += incr;
 2309|  14.1k|            pp += fromskewLocal;
 2310|  14.1k|        }
 2311|  1.66k|    }
 2312|   126k|    else
 2313|   126k|    {
 2314|   149k|        while (h > 0)
  ------------------
  |  Branch (2314:16): [True: 149k, False: 0]
  ------------------
 2315|   149k|        {
 2316|  1.35M|            for (x = w; x > 0;)
  ------------------
  |  Branch (2316:25): [True: 1.20M, False: 149k]
  ------------------
 2317|  1.20M|            {
 2318|  1.20M|                int32_t Cb = pp[16];
 2319|  1.20M|                int32_t Cr = pp[17];
 2320|  1.20M|                switch (x)
 2321|  1.20M|                {
 2322|  1.05M|                    default:
  ------------------
  |  Branch (2322:21): [True: 1.05M, False: 146k]
  ------------------
 2323|  1.05M|                        switch (h)
 2324|  1.05M|                        {
 2325|   773k|                            default:
  ------------------
  |  Branch (2325:29): [True: 773k, False: 286k]
  ------------------
 2326|   773k|                                YCbCrtoRGB(cp3[3], pp[15]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   773k|    {                                                                          \
  |  | 2253|   773k|        uint32_t r, g, b;                                                      \
  |  | 2254|   773k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   773k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   773k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   773k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   773k|    }
  ------------------
 2327|   778k|                            case 3:
  ------------------
  |  Branch (2327:29): [True: 5.56k, False: 1.05M]
  ------------------
 2328|   778k|                                YCbCrtoRGB(cp2[3], pp[11]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   778k|    {                                                                          \
  |  | 2253|   778k|        uint32_t r, g, b;                                                      \
  |  | 2254|   778k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   778k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   778k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   778k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   778k|    }
  ------------------
 2329|   802k|                            case 2:
  ------------------
  |  Branch (2329:29): [True: 23.4k, False: 1.03M]
  ------------------
 2330|   802k|                                YCbCrtoRGB(cp1[3], pp[7]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   802k|    {                                                                          \
  |  | 2253|   802k|        uint32_t r, g, b;                                                      \
  |  | 2254|   802k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   802k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   802k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   802k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   802k|    }
  ------------------
 2331|  1.05M|                            case 1:
  ------------------
  |  Branch (2331:29): [True: 257k, False: 802k]
  ------------------
 2332|  1.05M|                                YCbCrtoRGB(cp[3], pp[3]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.05M|    {                                                                          \
  |  | 2253|  1.05M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.05M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.05M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.05M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.05M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.05M|    }
  ------------------
 2333|  1.05M|                        } /* FALLTHROUGH */
 2334|  1.19M|                    case 3:
  ------------------
  |  Branch (2334:21): [True: 136k, False: 1.07M]
  ------------------
 2335|  1.19M|                        switch (h)
 2336|  1.19M|                        {
 2337|   789k|                            default:
  ------------------
  |  Branch (2337:29): [True: 789k, False: 406k]
  ------------------
 2338|   789k|                                YCbCrtoRGB(cp3[2], pp[14]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   789k|    {                                                                          \
  |  | 2253|   789k|        uint32_t r, g, b;                                                      \
  |  | 2254|   789k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   789k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   789k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   789k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   789k|    }
  ------------------
 2339|   795k|                            case 3:
  ------------------
  |  Branch (2339:29): [True: 5.57k, False: 1.19M]
  ------------------
 2340|   795k|                                YCbCrtoRGB(cp2[2], pp[10]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   795k|    {                                                                          \
  |  | 2253|   795k|        uint32_t r, g, b;                                                      \
  |  | 2254|   795k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   795k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   795k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   795k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   795k|    }
  ------------------
 2341|   818k|                            case 2:
  ------------------
  |  Branch (2341:29): [True: 23.4k, False: 1.17M]
  ------------------
 2342|   818k|                                YCbCrtoRGB(cp1[2], pp[6]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   818k|    {                                                                          \
  |  | 2253|   818k|        uint32_t r, g, b;                                                      \
  |  | 2254|   818k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   818k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   818k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   818k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   818k|    }
  ------------------
 2343|  1.19M|                            case 1:
  ------------------
  |  Branch (2343:29): [True: 377k, False: 818k]
  ------------------
 2344|  1.19M|                                YCbCrtoRGB(cp[2], pp[2]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.19M|    {                                                                          \
  |  | 2253|  1.19M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.19M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.19M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.19M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.19M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.19M|    }
  ------------------
 2345|  1.19M|                        } /* FALLTHROUGH */
 2346|  1.19M|                    case 2:
  ------------------
  |  Branch (2346:21): [True: 539, False: 1.20M]
  ------------------
 2347|  1.19M|                        switch (h)
 2348|  1.19M|                        {
 2349|   790k|                            default:
  ------------------
  |  Branch (2349:29): [True: 790k, False: 406k]
  ------------------
 2350|   790k|                                YCbCrtoRGB(cp3[1], pp[13]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   790k|    {                                                                          \
  |  | 2253|   790k|        uint32_t r, g, b;                                                      \
  |  | 2254|   790k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   790k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   790k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   790k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   790k|    }
  ------------------
 2351|   795k|                            case 3:
  ------------------
  |  Branch (2351:29): [True: 5.57k, False: 1.19M]
  ------------------
 2352|   795k|                                YCbCrtoRGB(cp2[1], pp[9]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   795k|    {                                                                          \
  |  | 2253|   795k|        uint32_t r, g, b;                                                      \
  |  | 2254|   795k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   795k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   795k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   795k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   795k|    }
  ------------------
 2353|   819k|                            case 2:
  ------------------
  |  Branch (2353:29): [True: 23.4k, False: 1.17M]
  ------------------
 2354|   819k|                                YCbCrtoRGB(cp1[1], pp[5]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   819k|    {                                                                          \
  |  | 2253|   819k|        uint32_t r, g, b;                                                      \
  |  | 2254|   819k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   819k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   819k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   819k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   819k|    }
  ------------------
 2355|  1.19M|                            case 1:
  ------------------
  |  Branch (2355:29): [True: 377k, False: 819k]
  ------------------
 2356|  1.19M|                                YCbCrtoRGB(cp[1], pp[1]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.19M|    {                                                                          \
  |  | 2253|  1.19M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.19M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.19M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.19M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.19M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.19M|    }
  ------------------
 2357|  1.19M|                        } /* FALLTHROUGH */
 2358|  1.20M|                    case 1:
  ------------------
  |  Branch (2358:21): [True: 9.93k, False: 1.19M]
  ------------------
 2359|  1.20M|                        switch (h)
 2360|  1.20M|                        {
 2361|   799k|                            default:
  ------------------
  |  Branch (2361:29): [True: 799k, False: 407k]
  ------------------
 2362|   799k|                                YCbCrtoRGB(cp3[0], pp[12]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   799k|    {                                                                          \
  |  | 2253|   799k|        uint32_t r, g, b;                                                      \
  |  | 2254|   799k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   799k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   799k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   799k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   799k|    }
  ------------------
 2363|   805k|                            case 3:
  ------------------
  |  Branch (2363:29): [True: 5.57k, False: 1.20M]
  ------------------
 2364|   805k|                                YCbCrtoRGB(cp2[0], pp[8]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   805k|    {                                                                          \
  |  | 2253|   805k|        uint32_t r, g, b;                                                      \
  |  | 2254|   805k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   805k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   805k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   805k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   805k|    }
  ------------------
 2365|   828k|                            case 2:
  ------------------
  |  Branch (2365:29): [True: 23.4k, False: 1.18M]
  ------------------
 2366|   828k|                                YCbCrtoRGB(cp1[0], pp[4]); /* FALLTHROUGH */
  ------------------
  |  | 2252|   828k|    {                                                                          \
  |  | 2253|   828k|        uint32_t r, g, b;                                                      \
  |  | 2254|   828k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   828k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   828k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   828k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   828k|    }
  ------------------
 2367|  1.20M|                            case 1:
  ------------------
  |  Branch (2367:29): [True: 378k, False: 828k]
  ------------------
 2368|  1.20M|                                YCbCrtoRGB(cp[0], pp[0]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  1.20M|    {                                                                          \
  |  | 2253|  1.20M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.20M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.20M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.20M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.20M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.20M|    }
  ------------------
 2369|  1.20M|                        } /* FALLTHROUGH */
 2370|  1.20M|                }
 2371|  1.20M|                if (x < 4)
  ------------------
  |  Branch (2371:21): [True: 146k, False: 1.05M]
  ------------------
 2372|   146k|                {
 2373|   146k|                    cp += x;
 2374|   146k|                    cp1 += x;
 2375|   146k|                    cp2 += x;
 2376|   146k|                    cp3 += x;
 2377|   146k|                    x = 0;
 2378|   146k|                }
 2379|  1.05M|                else
 2380|  1.05M|                {
 2381|  1.05M|                    cp += 4;
 2382|  1.05M|                    cp1 += 4;
 2383|  1.05M|                    cp2 += 4;
 2384|  1.05M|                    cp3 += 4;
 2385|  1.05M|                    x -= 4;
 2386|  1.05M|                }
 2387|  1.20M|                pp += 18;
 2388|  1.20M|            }
 2389|   149k|            if (h <= 4)
  ------------------
  |  Branch (2389:17): [True: 126k, False: 22.6k]
  ------------------
 2390|   126k|                break;
 2391|  22.6k|            h -= 4;
 2392|  22.6k|            cp += incr;
 2393|  22.6k|            cp1 += incr;
 2394|  22.6k|            cp2 += incr;
 2395|  22.6k|            cp3 += incr;
 2396|  22.6k|            pp += fromskewLocal;
 2397|  22.6k|        }
 2398|   126k|    }
 2399|   128k|}
tif_getimage.c:putcontig8bitYCbCr42tile:
 2405|   185k|{
 2406|   185k|    uint32_t *cp1 = cp + w + toskew;
 2407|   185k|    const tmsize_t incr = 2 * (tmsize_t)toskew + (tmsize_t)w;
 2408|       |
 2409|   185k|    (void)y;
 2410|   185k|    const tmsize_t fromskewLocal =
 2411|   185k|        (tmsize_t)(fromskew / 4) * (tmsize_t)(4 * 2 + 2);
 2412|   185k|    if ((w & 3) == 0 && (h & 1) == 0)
  ------------------
  |  Branch (2412:9): [True: 20.2k, False: 164k]
  |  Branch (2412:25): [True: 2.14k, False: 18.1k]
  ------------------
 2413|  2.14k|    {
 2414|   148k|        for (; h >= 2; h -= 2)
  ------------------
  |  Branch (2414:16): [True: 146k, False: 2.14k]
  ------------------
 2415|   146k|        {
 2416|   146k|            x = w >> 2;
 2417|   146k|            do
 2418|  1.76M|            {
 2419|  1.76M|                int32_t Cb = pp[8];
 2420|  1.76M|                int32_t Cr = pp[9];
 2421|       |
 2422|  1.76M|                YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  1.76M|    {                                                                          \
  |  | 2253|  1.76M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.76M|    }
  ------------------
 2423|  1.76M|                YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|  1.76M|    {                                                                          \
  |  | 2253|  1.76M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.76M|    }
  ------------------
 2424|  1.76M|                YCbCrtoRGB(cp[2], pp[2]);
  ------------------
  |  | 2252|  1.76M|    {                                                                          \
  |  | 2253|  1.76M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.76M|    }
  ------------------
 2425|  1.76M|                YCbCrtoRGB(cp[3], pp[3]);
  ------------------
  |  | 2252|  1.76M|    {                                                                          \
  |  | 2253|  1.76M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.76M|    }
  ------------------
 2426|  1.76M|                YCbCrtoRGB(cp1[0], pp[4]);
  ------------------
  |  | 2252|  1.76M|    {                                                                          \
  |  | 2253|  1.76M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.76M|    }
  ------------------
 2427|  1.76M|                YCbCrtoRGB(cp1[1], pp[5]);
  ------------------
  |  | 2252|  1.76M|    {                                                                          \
  |  | 2253|  1.76M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.76M|    }
  ------------------
 2428|  1.76M|                YCbCrtoRGB(cp1[2], pp[6]);
  ------------------
  |  | 2252|  1.76M|    {                                                                          \
  |  | 2253|  1.76M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.76M|    }
  ------------------
 2429|  1.76M|                YCbCrtoRGB(cp1[3], pp[7]);
  ------------------
  |  | 2252|  1.76M|    {                                                                          \
  |  | 2253|  1.76M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.76M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.76M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.76M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.76M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.76M|    }
  ------------------
 2430|       |
 2431|  1.76M|                cp += 4;
 2432|  1.76M|                cp1 += 4;
 2433|  1.76M|                pp += 10;
 2434|  1.76M|            } while (--x);
  ------------------
  |  Branch (2434:22): [True: 1.61M, False: 146k]
  ------------------
 2435|   146k|            cp += incr;
 2436|   146k|            cp1 += incr;
 2437|   146k|            pp += fromskewLocal;
 2438|   146k|        }
 2439|  2.14k|    }
 2440|   183k|    else
 2441|   183k|    {
 2442|   777k|        while (h > 0)
  ------------------
  |  Branch (2442:16): [True: 777k, False: 0]
  ------------------
 2443|   777k|        {
 2444|  8.83M|            for (x = w; x > 0;)
  ------------------
  |  Branch (2444:25): [True: 8.06M, False: 777k]
  ------------------
 2445|  8.06M|            {
 2446|  8.06M|                int32_t Cb = pp[8];
 2447|  8.06M|                int32_t Cr = pp[9];
 2448|  8.06M|                switch (x)
 2449|  8.06M|                {
 2450|  7.38M|                    default:
  ------------------
  |  Branch (2450:21): [True: 7.38M, False: 680k]
  ------------------
 2451|  7.38M|                        switch (h)
 2452|  7.38M|                        {
 2453|  7.27M|                            default:
  ------------------
  |  Branch (2453:29): [True: 7.27M, False: 106k]
  ------------------
 2454|  7.27M|                                YCbCrtoRGB(cp1[3], pp[7]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  7.27M|    {                                                                          \
  |  | 2253|  7.27M|        uint32_t r, g, b;                                                      \
  |  | 2254|  7.27M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  7.27M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  7.27M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  7.27M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  7.27M|    }
  ------------------
 2455|  7.38M|                            case 1:
  ------------------
  |  Branch (2455:29): [True: 106k, False: 7.27M]
  ------------------
 2456|  7.38M|                                YCbCrtoRGB(cp[3], pp[3]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  7.38M|    {                                                                          \
  |  | 2253|  7.38M|        uint32_t r, g, b;                                                      \
  |  | 2254|  7.38M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  7.38M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  7.38M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  7.38M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  7.38M|    }
  ------------------
 2457|  7.38M|                        } /* FALLTHROUGH */
 2458|  8.02M|                    case 3:
  ------------------
  |  Branch (2458:21): [True: 640k, False: 7.42M]
  ------------------
 2459|  8.02M|                        switch (h)
 2460|  8.02M|                        {
 2461|  7.91M|                            default:
  ------------------
  |  Branch (2461:29): [True: 7.91M, False: 106k]
  ------------------
 2462|  7.91M|                                YCbCrtoRGB(cp1[2], pp[6]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  7.91M|    {                                                                          \
  |  | 2253|  7.91M|        uint32_t r, g, b;                                                      \
  |  | 2254|  7.91M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  7.91M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  7.91M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  7.91M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  7.91M|    }
  ------------------
 2463|  8.02M|                            case 1:
  ------------------
  |  Branch (2463:29): [True: 106k, False: 7.91M]
  ------------------
 2464|  8.02M|                                YCbCrtoRGB(cp[2], pp[2]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  8.02M|    {                                                                          \
  |  | 2253|  8.02M|        uint32_t r, g, b;                                                      \
  |  | 2254|  8.02M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  8.02M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  8.02M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  8.02M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  8.02M|    }
  ------------------
 2465|  8.02M|                        } /* FALLTHROUGH */
 2466|  8.05M|                    case 2:
  ------------------
  |  Branch (2466:21): [True: 29.3k, False: 8.03M]
  ------------------
 2467|  8.05M|                        switch (h)
 2468|  8.05M|                        {
 2469|  7.94M|                            default:
  ------------------
  |  Branch (2469:29): [True: 7.94M, False: 106k]
  ------------------
 2470|  7.94M|                                YCbCrtoRGB(cp1[1], pp[5]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  7.94M|    {                                                                          \
  |  | 2253|  7.94M|        uint32_t r, g, b;                                                      \
  |  | 2254|  7.94M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  7.94M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  7.94M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  7.94M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  7.94M|    }
  ------------------
 2471|  8.05M|                            case 1:
  ------------------
  |  Branch (2471:29): [True: 106k, False: 7.94M]
  ------------------
 2472|  8.05M|                                YCbCrtoRGB(cp[1], pp[1]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  8.05M|    {                                                                          \
  |  | 2253|  8.05M|        uint32_t r, g, b;                                                      \
  |  | 2254|  8.05M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  8.05M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  8.05M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  8.05M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  8.05M|    }
  ------------------
 2473|  8.05M|                        } /* FALLTHROUGH */
 2474|  8.06M|                    case 1:
  ------------------
  |  Branch (2474:21): [True: 9.77k, False: 8.05M]
  ------------------
 2475|  8.06M|                        switch (h)
 2476|  8.06M|                        {
 2477|  7.95M|                            default:
  ------------------
  |  Branch (2477:29): [True: 7.95M, False: 107k]
  ------------------
 2478|  7.95M|                                YCbCrtoRGB(cp1[0], pp[4]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  7.95M|    {                                                                          \
  |  | 2253|  7.95M|        uint32_t r, g, b;                                                      \
  |  | 2254|  7.95M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  7.95M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  7.95M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  7.95M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  7.95M|    }
  ------------------
 2479|  8.06M|                            case 1:
  ------------------
  |  Branch (2479:29): [True: 107k, False: 7.95M]
  ------------------
 2480|  8.06M|                                YCbCrtoRGB(cp[0], pp[0]); /* FALLTHROUGH */
  ------------------
  |  | 2252|  8.06M|    {                                                                          \
  |  | 2253|  8.06M|        uint32_t r, g, b;                                                      \
  |  | 2254|  8.06M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  8.06M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  8.06M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  8.06M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  8.06M|    }
  ------------------
 2481|  8.06M|                        } /* FALLTHROUGH */
 2482|  8.06M|                }
 2483|  8.06M|                if (x < 4)
  ------------------
  |  Branch (2483:21): [True: 680k, False: 7.38M]
  ------------------
 2484|   680k|                {
 2485|   680k|                    cp += x;
 2486|   680k|                    cp1 += x;
 2487|   680k|                    x = 0;
 2488|   680k|                }
 2489|  7.38M|                else
 2490|  7.38M|                {
 2491|  7.38M|                    cp += 4;
 2492|  7.38M|                    cp1 += 4;
 2493|  7.38M|                    x -= 4;
 2494|  7.38M|                }
 2495|  8.06M|                pp += 10;
 2496|  8.06M|            }
 2497|   777k|            if (h <= 2)
  ------------------
  |  Branch (2497:17): [True: 183k, False: 594k]
  ------------------
 2498|   183k|                break;
 2499|   594k|            h -= 2;
 2500|   594k|            cp += incr;
 2501|   594k|            cp1 += incr;
 2502|   594k|            pp += fromskewLocal;
 2503|   594k|        }
 2504|   183k|    }
 2505|   185k|}
tif_getimage.c:putcontig8bitYCbCr41tile:
 2511|  54.0k|{
 2512|  54.0k|    (void)y;
 2513|  54.0k|    const tmsize_t fromskewLocal =
 2514|  54.0k|        (tmsize_t)(fromskew / 4) * (tmsize_t)(4 * 1 + 2);
 2515|  54.0k|    do
 2516|  1.70M|    {
 2517|  1.70M|        x = w >> 2;
 2518|  3.59M|        while (x > 0)
  ------------------
  |  Branch (2518:16): [True: 1.89M, False: 1.70M]
  ------------------
 2519|  1.89M|        {
 2520|  1.89M|            int32_t Cb = pp[4];
 2521|  1.89M|            int32_t Cr = pp[5];
 2522|       |
 2523|  1.89M|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  1.89M|    {                                                                          \
  |  | 2253|  1.89M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.89M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.89M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.89M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.89M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.89M|    }
  ------------------
 2524|  1.89M|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|  1.89M|    {                                                                          \
  |  | 2253|  1.89M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.89M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.89M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.89M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.89M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.89M|    }
  ------------------
 2525|  1.89M|            YCbCrtoRGB(cp[2], pp[2]);
  ------------------
  |  | 2252|  1.89M|    {                                                                          \
  |  | 2253|  1.89M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.89M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.89M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.89M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.89M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.89M|    }
  ------------------
 2526|  1.89M|            YCbCrtoRGB(cp[3], pp[3]);
  ------------------
  |  | 2252|  1.89M|    {                                                                          \
  |  | 2253|  1.89M|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.89M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.89M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.89M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.89M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.89M|    }
  ------------------
 2527|       |
 2528|  1.89M|            cp += 4;
 2529|  1.89M|            pp += 6;
 2530|  1.89M|            x--;
 2531|  1.89M|        }
 2532|       |
 2533|  1.70M|        if ((w & 3) != 0)
  ------------------
  |  Branch (2533:13): [True: 67.0k, False: 1.63M]
  ------------------
 2534|  67.0k|        {
 2535|  67.0k|            int32_t Cb = pp[4];
 2536|  67.0k|            int32_t Cr = pp[5];
 2537|       |
 2538|  67.0k|            switch ((w & 3))
 2539|  67.0k|            {
 2540|     79|                case 3:
  ------------------
  |  Branch (2540:17): [True: 79, False: 66.9k]
  ------------------
 2541|     79|                    YCbCrtoRGB(cp[2], pp[2]); /*-fallthrough*/
  ------------------
  |  | 2252|     79|    {                                                                          \
  |  | 2253|     79|        uint32_t r, g, b;                                                      \
  |  | 2254|     79|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|     79|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|     79|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|     79|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|     79|    }
  ------------------
 2542|  1.17k|                case 2:
  ------------------
  |  Branch (2542:17): [True: 1.09k, False: 65.9k]
  ------------------
 2543|  1.17k|                    YCbCrtoRGB(cp[1], pp[1]); /*-fallthrough*/
  ------------------
  |  | 2252|  1.17k|    {                                                                          \
  |  | 2253|  1.17k|        uint32_t r, g, b;                                                      \
  |  | 2254|  1.17k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  1.17k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  1.17k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  1.17k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  1.17k|    }
  ------------------
 2544|  67.0k|                case 1:
  ------------------
  |  Branch (2544:17): [True: 65.9k, False: 1.17k]
  ------------------
 2545|  67.0k|                    YCbCrtoRGB(cp[0], pp[0]); /*-fallthrough*/
  ------------------
  |  | 2252|  67.0k|    {                                                                          \
  |  | 2253|  67.0k|        uint32_t r, g, b;                                                      \
  |  | 2254|  67.0k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  67.0k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  67.0k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  67.0k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  67.0k|    }
  ------------------
 2546|  67.0k|                case 0:
  ------------------
  |  Branch (2546:17): [True: 0, False: 67.0k]
  ------------------
 2547|  67.0k|                    break;
 2548|      0|                default:
  ------------------
  |  Branch (2548:17): [True: 0, False: 67.0k]
  ------------------
 2549|      0|                    break;
 2550|  67.0k|            }
 2551|       |
 2552|  67.0k|            cp += (w & 3);
 2553|  67.0k|            pp += 6;
 2554|  67.0k|        }
 2555|       |
 2556|  1.70M|        cp += toskew;
 2557|  1.70M|        pp += fromskewLocal;
 2558|  1.70M|    } while (--h);
  ------------------
  |  Branch (2558:14): [True: 1.64M, False: 54.0k]
  ------------------
 2559|  54.0k|}
tif_getimage.c:putcontig8bitYCbCr22tile:
 2565|  4.47k|{
 2566|  4.47k|    uint32_t *cp2;
 2567|  4.47k|    const tmsize_t incr = 2 * (tmsize_t)toskew + (tmsize_t)w;
 2568|  4.47k|    (void)y;
 2569|  4.47k|    const tmsize_t fromskewLocal =
 2570|  4.47k|        (tmsize_t)(fromskew / 2) * (tmsize_t)(2 * 2 + 2);
 2571|  4.47k|    cp2 = cp + w + toskew;
 2572|   163k|    while (h >= 2)
  ------------------
  |  Branch (2572:12): [True: 158k, False: 4.47k]
  ------------------
 2573|   158k|    {
 2574|   158k|        x = w;
 2575|  4.43M|        while (x >= 2)
  ------------------
  |  Branch (2575:16): [True: 4.27M, False: 158k]
  ------------------
 2576|  4.27M|        {
 2577|  4.27M|            uint32_t Cb = pp[4];
 2578|  4.27M|            uint32_t Cr = pp[5];
 2579|  4.27M|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  4.27M|    {                                                                          \
  |  | 2253|  4.27M|        uint32_t r, g, b;                                                      \
  |  | 2254|  4.27M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  4.27M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  4.27M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  4.27M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  4.27M|    }
  ------------------
 2580|  4.27M|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|  4.27M|    {                                                                          \
  |  | 2253|  4.27M|        uint32_t r, g, b;                                                      \
  |  | 2254|  4.27M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  4.27M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  4.27M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  4.27M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  4.27M|    }
  ------------------
 2581|  4.27M|            YCbCrtoRGB(cp2[0], pp[2]);
  ------------------
  |  | 2252|  4.27M|    {                                                                          \
  |  | 2253|  4.27M|        uint32_t r, g, b;                                                      \
  |  | 2254|  4.27M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  4.27M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  4.27M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  4.27M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  4.27M|    }
  ------------------
 2582|  4.27M|            YCbCrtoRGB(cp2[1], pp[3]);
  ------------------
  |  | 2252|  4.27M|    {                                                                          \
  |  | 2253|  4.27M|        uint32_t r, g, b;                                                      \
  |  | 2254|  4.27M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  4.27M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  4.27M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  4.27M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  4.27M|    }
  ------------------
 2583|  4.27M|            cp += 2;
 2584|  4.27M|            cp2 += 2;
 2585|  4.27M|            pp += 6;
 2586|  4.27M|            x -= 2;
 2587|  4.27M|        }
 2588|   158k|        if (x == 1)
  ------------------
  |  Branch (2588:13): [True: 88.1k, False: 70.6k]
  ------------------
 2589|  88.1k|        {
 2590|  88.1k|            uint32_t Cb = pp[4];
 2591|  88.1k|            uint32_t Cr = pp[5];
 2592|  88.1k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  88.1k|    {                                                                          \
  |  | 2253|  88.1k|        uint32_t r, g, b;                                                      \
  |  | 2254|  88.1k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  88.1k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  88.1k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  88.1k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  88.1k|    }
  ------------------
 2593|  88.1k|            YCbCrtoRGB(cp2[0], pp[2]);
  ------------------
  |  | 2252|  88.1k|    {                                                                          \
  |  | 2253|  88.1k|        uint32_t r, g, b;                                                      \
  |  | 2254|  88.1k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  88.1k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  88.1k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  88.1k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  88.1k|    }
  ------------------
 2594|  88.1k|            cp++;
 2595|  88.1k|            cp2++;
 2596|  88.1k|            pp += 6;
 2597|  88.1k|        }
 2598|   158k|        cp += incr;
 2599|   158k|        cp2 += incr;
 2600|   158k|        pp += fromskewLocal;
 2601|   158k|        h -= 2;
 2602|   158k|    }
 2603|  4.47k|    if (h == 1)
  ------------------
  |  Branch (2603:9): [True: 2.97k, False: 1.49k]
  ------------------
 2604|  2.97k|    {
 2605|  2.97k|        x = w;
 2606|  49.5k|        while (x >= 2)
  ------------------
  |  Branch (2606:16): [True: 46.5k, False: 2.97k]
  ------------------
 2607|  46.5k|        {
 2608|  46.5k|            uint32_t Cb = pp[4];
 2609|  46.5k|            uint32_t Cr = pp[5];
 2610|  46.5k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  46.5k|    {                                                                          \
  |  | 2253|  46.5k|        uint32_t r, g, b;                                                      \
  |  | 2254|  46.5k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  46.5k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  46.5k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  46.5k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  46.5k|    }
  ------------------
 2611|  46.5k|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|  46.5k|    {                                                                          \
  |  | 2253|  46.5k|        uint32_t r, g, b;                                                      \
  |  | 2254|  46.5k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  46.5k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  46.5k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  46.5k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  46.5k|    }
  ------------------
 2612|  46.5k|            cp += 2;
 2613|  46.5k|            cp2 += 2;
 2614|  46.5k|            pp += 6;
 2615|  46.5k|            x -= 2;
 2616|  46.5k|        }
 2617|  2.97k|        if (x == 1)
  ------------------
  |  Branch (2617:13): [True: 2.77k, False: 200]
  ------------------
 2618|  2.77k|        {
 2619|  2.77k|            uint32_t Cb = pp[4];
 2620|  2.77k|            uint32_t Cr = pp[5];
 2621|  2.77k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  2.77k|    {                                                                          \
  |  | 2253|  2.77k|        uint32_t r, g, b;                                                      \
  |  | 2254|  2.77k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  2.77k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  2.77k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  2.77k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  2.77k|    }
  ------------------
 2622|  2.77k|        }
 2623|  2.97k|    }
 2624|  4.47k|}
tif_getimage.c:putcontig8bitYCbCr21tile:
 2630|  9.04k|{
 2631|  9.04k|    (void)y;
 2632|  9.04k|    const tmsize_t fromskewLocal =
 2633|  9.04k|        (tmsize_t)(fromskew / 2) * (tmsize_t)(2 * 1 + 2);
 2634|  9.04k|    do
 2635|  9.04k|    {
 2636|  9.04k|        x = w >> 1;
 2637|  91.9k|        while (x > 0)
  ------------------
  |  Branch (2637:16): [True: 82.9k, False: 9.04k]
  ------------------
 2638|  82.9k|        {
 2639|  82.9k|            int32_t Cb = pp[2];
 2640|  82.9k|            int32_t Cr = pp[3];
 2641|       |
 2642|  82.9k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  82.9k|    {                                                                          \
  |  | 2253|  82.9k|        uint32_t r, g, b;                                                      \
  |  | 2254|  82.9k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  82.9k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  82.9k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  82.9k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  82.9k|    }
  ------------------
 2643|  82.9k|            YCbCrtoRGB(cp[1], pp[1]);
  ------------------
  |  | 2252|  82.9k|    {                                                                          \
  |  | 2253|  82.9k|        uint32_t r, g, b;                                                      \
  |  | 2254|  82.9k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  82.9k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  82.9k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  82.9k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  82.9k|    }
  ------------------
 2644|       |
 2645|  82.9k|            cp += 2;
 2646|  82.9k|            pp += 4;
 2647|  82.9k|            x--;
 2648|  82.9k|        }
 2649|       |
 2650|  9.04k|        if ((w & 1) != 0)
  ------------------
  |  Branch (2650:13): [True: 9.04k, False: 1]
  ------------------
 2651|  9.04k|        {
 2652|  9.04k|            int32_t Cb = pp[2];
 2653|  9.04k|            int32_t Cr = pp[3];
 2654|       |
 2655|  9.04k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  9.04k|    {                                                                          \
  |  | 2253|  9.04k|        uint32_t r, g, b;                                                      \
  |  | 2254|  9.04k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  9.04k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  9.04k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  9.04k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  9.04k|    }
  ------------------
 2656|       |
 2657|  9.04k|            cp += 1;
 2658|  9.04k|            pp += 4;
 2659|  9.04k|        }
 2660|       |
 2661|  9.04k|        cp += toskew;
 2662|  9.04k|        pp += fromskewLocal;
 2663|  9.04k|    } while (--h);
  ------------------
  |  Branch (2663:14): [True: 0, False: 9.04k]
  ------------------
 2664|  9.04k|}
tif_getimage.c:putcontig8bitYCbCr12tile:
 2670|  1.84k|{
 2671|  1.84k|    uint32_t *cp2;
 2672|  1.84k|    const tmsize_t incr = 2 * (tmsize_t)toskew + (tmsize_t)w;
 2673|  1.84k|    (void)y;
 2674|  1.84k|    const tmsize_t fromskewLocal =
 2675|  1.84k|        (tmsize_t)(fromskew / 1) * (tmsize_t)(1 * 2 + 2);
 2676|  1.84k|    cp2 = cp + w + toskew;
 2677|  62.6k|    while (h >= 2)
  ------------------
  |  Branch (2677:12): [True: 60.7k, False: 1.84k]
  ------------------
 2678|  60.7k|    {
 2679|  60.7k|        x = w;
 2680|  60.7k|        do
 2681|   437k|        {
 2682|   437k|            uint32_t Cb = pp[2];
 2683|   437k|            uint32_t Cr = pp[3];
 2684|   437k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|   437k|    {                                                                          \
  |  | 2253|   437k|        uint32_t r, g, b;                                                      \
  |  | 2254|   437k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   437k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   437k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   437k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   437k|    }
  ------------------
 2685|   437k|            YCbCrtoRGB(cp2[0], pp[1]);
  ------------------
  |  | 2252|   437k|    {                                                                          \
  |  | 2253|   437k|        uint32_t r, g, b;                                                      \
  |  | 2254|   437k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|   437k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|   437k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|   437k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|   437k|    }
  ------------------
 2686|   437k|            cp++;
 2687|   437k|            cp2++;
 2688|   437k|            pp += 4;
 2689|   437k|        } while (--x);
  ------------------
  |  Branch (2689:18): [True: 376k, False: 60.7k]
  ------------------
 2690|  60.7k|        cp += incr;
 2691|  60.7k|        cp2 += incr;
 2692|  60.7k|        pp += fromskewLocal;
 2693|  60.7k|        h -= 2;
 2694|  60.7k|    }
 2695|  1.84k|    if (h == 1)
  ------------------
  |  Branch (2695:9): [True: 917, False: 926]
  ------------------
 2696|    917|    {
 2697|    917|        x = w;
 2698|    917|        do
 2699|  14.2k|        {
 2700|  14.2k|            uint32_t Cb = pp[2];
 2701|  14.2k|            uint32_t Cr = pp[3];
 2702|  14.2k|            YCbCrtoRGB(cp[0], pp[0]);
  ------------------
  |  | 2252|  14.2k|    {                                                                          \
  |  | 2253|  14.2k|        uint32_t r, g, b;                                                      \
  |  | 2254|  14.2k|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  14.2k|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  14.2k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  14.2k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  14.2k|    }
  ------------------
 2703|  14.2k|            cp++;
 2704|  14.2k|            pp += 4;
 2705|  14.2k|        } while (--x);
  ------------------
  |  Branch (2705:18): [True: 13.3k, False: 917]
  ------------------
 2706|    917|    }
 2707|  1.84k|}
tif_getimage.c:putcontig8bitYCbCr11tile:
 2713|    830|{
 2714|    830|    (void)y;
 2715|    830|    const tmsize_t fromskewLocal =
 2716|    830|        (tmsize_t)(fromskew / 1) * (tmsize_t)(1 * 1 + 2);
 2717|    830|    do
 2718|  28.4k|    {
 2719|  28.4k|        x = w; /* was x = w>>1; patched 2000/09/25 warmerda@home.com */
 2720|  28.4k|        do
 2721|  59.8M|        {
 2722|  59.8M|            int32_t Cb = pp[1];
 2723|  59.8M|            int32_t Cr = pp[2];
 2724|       |
 2725|  59.8M|            YCbCrtoRGB(*cp++, pp[0]);
  ------------------
  |  | 2252|  59.8M|    {                                                                          \
  |  | 2253|  59.8M|        uint32_t r, g, b;                                                      \
  |  | 2254|  59.8M|        TIFFYCbCrtoRGB(img->ycbcr, (Y), (int32_t)Cb, (int32_t)Cr, &r, &g, &b); \
  |  | 2255|  59.8M|        dst = PACK(r, g, b);                                                   \
  |  |  ------------------
  |  |  |  | 1612|  59.8M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1610|  59.8M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 2256|  59.8M|    }
  ------------------
 2726|       |
 2727|  59.8M|            pp += 3;
 2728|  59.8M|        } while (--x);
  ------------------
  |  Branch (2728:18): [True: 59.8M, False: 28.4k]
  ------------------
 2729|  28.4k|        cp += toskew;
 2730|  28.4k|        pp += fromskewLocal;
 2731|  28.4k|    } while (--h);
  ------------------
  |  Branch (2731:14): [True: 27.6k, False: 830]
  ------------------
 2732|    830|}
tif_getimage.c:initCIELabConversion:
 2815|      9|{
 2816|      9|    static const char module[] = "initCIELabConversion";
 2817|       |
 2818|      9|    float *whitePoint;
 2819|      9|    float refWhite[3];
 2820|       |
 2821|      9|    TIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &whitePoint);
  ------------------
  |  |  307|      9|#define TIFFTAG_WHITEPOINT 318             /* image white point */
  ------------------
 2822|      9|    if (TIFF_FLOAT_EQ(whitePoint[1], 0.0f))
  ------------------
  |  |  342|      9|#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
  |  |  ------------------
  |  |  |  Branch (342:29): [True: 1, False: 8]
  |  |  ------------------
  ------------------
 2823|      1|    {
 2824|      1|        TIFFErrorExtR(img->tif, module, "Invalid value for WhitePoint tag.");
 2825|      1|        return NULL;
 2826|      1|    }
 2827|       |
 2828|      8|    if (!img->cielab)
  ------------------
  |  Branch (2828:9): [True: 8, False: 0]
  ------------------
 2829|      8|    {
 2830|      8|        img->cielab = (TIFFCIELabToRGB *)_TIFFmallocExt(
 2831|      8|            img->tif, sizeof(TIFFCIELabToRGB));
 2832|      8|        if (!img->cielab)
  ------------------
  |  Branch (2832:13): [True: 0, False: 8]
  ------------------
 2833|      0|        {
 2834|      0|            TIFFErrorExtR(img->tif, module,
 2835|      0|                          "No space for CIE L*a*b*->RGB conversion state.");
 2836|      0|            return NULL;
 2837|      0|        }
 2838|      8|    }
 2839|       |
 2840|      8|    refWhite[1] = 100.0f;
 2841|      8|    refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
 2842|      8|    refWhite[2] =
 2843|      8|        (1.0f - whitePoint[0] - whitePoint[1]) / whitePoint[1] * refWhite[1];
 2844|      8|    if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0)
  ------------------
  |  Branch (2844:9): [True: 0, False: 8]
  ------------------
 2845|      0|    {
 2846|      0|        TIFFErrorExtR(img->tif, module,
 2847|      0|                      "Failed to initialize CIE L*a*b*->RGB conversion state.");
 2848|      0|        _TIFFfreeExt(img->tif, img->cielab);
 2849|      0|        return NULL;
 2850|      0|    }
 2851|       |
 2852|      8|    if (img->bitspersample == 8)
  ------------------
  |  Branch (2852:9): [True: 6, False: 2]
  ------------------
 2853|      6|        return putcontig8bitCIELab8;
 2854|      2|    else if (img->bitspersample == 16)
  ------------------
  |  Branch (2854:14): [True: 2, False: 0]
  ------------------
 2855|      2|        return putcontig8bitCIELab16;
 2856|      0|    return NULL;
 2857|      8|}
tif_getimage.c:putcontig8bitCIELab8:
 2202|  36.8k|{
 2203|  36.8k|    float X, Y, Z;
 2204|  36.8k|    uint32_t r, g, b;
 2205|  36.8k|    (void)y;
 2206|  36.8k|    const tmsize_t fromskewLocal = (tmsize_t)fromskew * (tmsize_t)3;
 2207|   467M|    for (; h > 0; --h)
  ------------------
  |  Branch (2207:12): [True: 467M, False: 36.8k]
  ------------------
 2208|   467M|    {
 2209|   935M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2209:21): [True: 467M, False: 467M]
  ------------------
 2210|   467M|        {
 2211|   467M|            TIFFCIELabToXYZ(img->cielab, (unsigned char)pp[0],
 2212|   467M|                            (signed char)pp[1], (signed char)pp[2], &X, &Y, &Z);
 2213|   467M|            TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b);
 2214|   467M|            *cp++ = PACK(r, g, b);
  ------------------
  |  | 1612|   467M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1610|   467M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2215|   467M|            pp += 3;
 2216|   467M|        }
 2217|   467M|        cp += toskew;
 2218|   467M|        pp += fromskewLocal;
 2219|   467M|    }
 2220|  36.8k|}
tif_getimage.c:putcontig8bitCIELab16:
 2226|      2|{
 2227|      2|    float X, Y, Z;
 2228|      2|    uint32_t r, g, b;
 2229|      2|    uint16_t *wp = (uint16_t *)pp;
 2230|      2|    (void)y;
 2231|      2|    const tmsize_t fromskewLocal = (tmsize_t)fromskew * (tmsize_t)3;
 2232|    252|    for (; h > 0; --h)
  ------------------
  |  Branch (2232:12): [True: 250, False: 2]
  ------------------
 2233|    250|    {
 2234|  73.5k|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2234:21): [True: 73.2k, False: 250]
  ------------------
 2235|  73.2k|        {
 2236|  73.2k|            TIFFCIELab16ToXYZ(img->cielab, (uint16_t)wp[0], (int16_t)wp[1],
 2237|  73.2k|                              (int16_t)wp[2], &X, &Y, &Z);
 2238|  73.2k|            TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b);
 2239|  73.2k|            *cp++ = PACK(r, g, b);
  ------------------
  |  | 1612|  73.2k|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1610|  73.2k|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2240|  73.2k|            wp += 3;
 2241|  73.2k|        }
 2242|    250|        cp += toskew;
 2243|    250|        wp += fromskewLocal;
 2244|    250|    }
 2245|      2|}
tif_getimage.c:PickSeparateCase:
 3311|    798|{
 3312|    798|    img->get = TIFFIsTiled(img->tif) ? gtTileSeparate : gtStripSeparate;
  ------------------
  |  Branch (3312:16): [True: 614, False: 184]
  ------------------
 3313|    798|    img->put.separate = NULL;
 3314|    798|    switch (img->photometric)
 3315|    798|    {
 3316|      3|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|      3|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (3316:9): [True: 3, False: 795]
  ------------------
 3317|    102|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|    102|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (3317:9): [True: 99, False: 699]
  ------------------
 3318|       |            /* greyscale images processed pretty much as RGB by gtTileSeparate
 3319|       |             */
 3320|    112|        case PHOTOMETRIC_RGB:
  ------------------
  |  |  223|    112|#define PHOTOMETRIC_RGB 2                  /* RGB color model */
  ------------------
  |  Branch (3320:9): [True: 10, False: 788]
  ------------------
 3321|    112|            switch (img->bitspersample)
 3322|    112|            {
 3323|     65|                case 8:
  ------------------
  |  Branch (3323:17): [True: 65, False: 47]
  ------------------
 3324|     65|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
  ------------------
  |  |  331|     65|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3324:25): [True: 34, False: 31]
  ------------------
 3325|     34|                        img->put.separate = putRGBAAseparate8bittile;
 3326|     31|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
  ------------------
  |  |  332|     31|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3326:30): [True: 21, False: 10]
  ------------------
 3327|     21|                    {
 3328|     21|                        if (BuildMapUaToAa(img))
  ------------------
  |  Branch (3328:29): [True: 21, False: 0]
  ------------------
 3329|     21|                            img->put.separate = putRGBUAseparate8bittile;
 3330|     21|                    }
 3331|     10|                    else
 3332|     10|                        img->put.separate = putRGBseparate8bittile;
 3333|     65|                    break;
 3334|     46|                case 16:
  ------------------
  |  Branch (3334:17): [True: 46, False: 66]
  ------------------
 3335|     46|                    if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
  ------------------
  |  |  331|     46|#define EXTRASAMPLE_ASSOCALPHA 1           /* !associated alpha data */
  ------------------
  |  Branch (3335:25): [True: 14, False: 32]
  ------------------
 3336|     14|                    {
 3337|     14|                        if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (3337:29): [True: 14, False: 0]
  ------------------
 3338|     14|                            img->put.separate = putRGBAAseparate16bittile;
 3339|     14|                    }
 3340|     32|                    else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
  ------------------
  |  |  332|     32|#define EXTRASAMPLE_UNASSALPHA 2           /* !unassociated alpha data */
  ------------------
  |  Branch (3340:30): [True: 20, False: 12]
  ------------------
 3341|     20|                    {
 3342|     20|                        if (BuildMapBitdepth16To8(img) && BuildMapUaToAa(img))
  ------------------
  |  Branch (3342:29): [True: 20, False: 0]
  |  Branch (3342:59): [True: 20, False: 0]
  ------------------
 3343|     20|                            img->put.separate = putRGBUAseparate16bittile;
 3344|     20|                    }
 3345|     12|                    else
 3346|     12|                    {
 3347|     12|                        if (BuildMapBitdepth16To8(img))
  ------------------
  |  Branch (3347:29): [True: 12, False: 0]
  ------------------
 3348|     12|                            img->put.separate = putRGBseparate16bittile;
 3349|     12|                    }
 3350|     46|                    break;
 3351|      1|                default:
  ------------------
  |  Branch (3351:17): [True: 1, False: 111]
  ------------------
 3352|      1|                    break;
 3353|    112|            }
 3354|    112|            break;
 3355|    112|        case PHOTOMETRIC_SEPARATED:
  ------------------
  |  |  226|     37|#define PHOTOMETRIC_SEPARATED 5            /* !color separations */
  ------------------
  |  Branch (3355:9): [True: 37, False: 761]
  ------------------
 3356|     37|            if (img->bitspersample == 8 && img->samplesperpixel == 4)
  ------------------
  |  Branch (3356:17): [True: 37, False: 0]
  |  Branch (3356:44): [True: 36, False: 1]
  ------------------
 3357|     36|            {
 3358|       |                /* Not alpha, but seems like the only way to get 4th band */
 3359|     36|                img->alpha = 1;
 3360|     36|                img->put.separate = putCMYKseparate8bittile;
 3361|     36|            }
 3362|     37|            break;
 3363|    649|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|    649|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (3363:9): [True: 649, False: 149]
  ------------------
 3364|    649|            if ((img->bitspersample == 8) && (img->samplesperpixel == 3))
  ------------------
  |  Branch (3364:17): [True: 649, False: 0]
  |  Branch (3364:46): [True: 643, False: 6]
  ------------------
 3365|    643|            {
 3366|    643|                if (initYCbCrConversion(img) != 0)
  ------------------
  |  Branch (3366:21): [True: 641, False: 2]
  ------------------
 3367|    641|                {
 3368|    641|                    uint16_t hs, vs;
 3369|    641|                    TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|    641|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
 3370|    641|                                          &hs, &vs);
 3371|    641|                    switch ((hs << 4) | vs)
 3372|    641|                    {
 3373|    618|                        case 0x11:
  ------------------
  |  Branch (3373:25): [True: 618, False: 23]
  ------------------
 3374|    618|                            img->put.separate = putseparate8bitYCbCr11tile;
 3375|    618|                            break;
 3376|       |                            /* TODO: add other cases here */
 3377|     23|                        default:
  ------------------
  |  Branch (3377:25): [True: 23, False: 618]
  ------------------
 3378|     23|                            break;
 3379|    641|                    }
 3380|    641|                }
 3381|    643|            }
 3382|    649|            break;
 3383|    649|        default:
  ------------------
  |  Branch (3383:9): [True: 0, False: 798]
  ------------------
 3384|      0|            break;
 3385|    798|    }
 3386|    798|    return ((img->get != NULL) && (img->put.separate != NULL));
  ------------------
  |  Branch (3386:13): [True: 798, False: 0]
  |  Branch (3386:35): [True: 765, False: 33]
  ------------------
 3387|    798|}
tif_getimage.c:gtTileSeparate:
  905|    602|{
  906|    602|    TIFF *tif = img->tif;
  907|    602|    tileSeparateRoutine put = img->put.separate;
  908|    602|    uint32_t col, row, y, rowstoread;
  909|    602|    tmsize_t pos;
  910|    602|    uint32_t tw, th;
  911|    602|    unsigned char *buf = NULL;
  912|    602|    unsigned char *p0 = NULL;
  913|    602|    unsigned char *p1 = NULL;
  914|    602|    unsigned char *p2 = NULL;
  915|    602|    unsigned char *pa = NULL;
  916|    602|    tmsize_t tilesize;
  917|    602|    tmsize_t bufsize;
  918|    602|    int32_t fromskew, toskew;
  919|    602|    int alpha = img->alpha;
  920|    602|    uint32_t nrow;
  921|    602|    int ret = 1, flip;
  922|    602|    uint16_t colorchannels;
  923|    602|    uint32_t this_tw, tocol;
  924|    602|    int32_t this_toskew, leftmost_toskew;
  925|    602|    int32_t leftmost_fromskew;
  926|    602|    uint32_t leftmost_tw;
  927|       |
  928|       |    /* If the raster is smaller than the image,
  929|       |     * or if there is a col_offset, adapt the samples to be copied per row. */
  930|    602|    uint32_t wmin;
  931|    602|    if (0 <= img->col_offset && (uint32_t)img->col_offset < img->width)
  ------------------
  |  Branch (931:9): [True: 602, False: 0]
  |  Branch (931:33): [True: 602, False: 0]
  ------------------
  932|    602|    {
  933|    602|        wmin = TIFFmin(w, img->width - (uint32_t)img->col_offset);
  ------------------
  |  |  337|    602|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 0, False: 602]
  |  |  ------------------
  ------------------
  934|    602|    }
  935|      0|    else
  936|      0|    {
  937|      0|        TIFFErrorExtR(tif, TIFFFileName(tif),
  938|      0|                      "Error in gtTileSeparate: column offset %d exceeds "
  939|      0|                      "image width %u",
  940|      0|                      img->col_offset, img->width);
  941|      0|        return 0;
  942|      0|    }
  943|       |
  944|    602|    tilesize = TIFFTileSize(tif);
  945|    602|    bufsize =
  946|    602|        _TIFFMultiplySSize(tif, alpha ? 4 : 3, tilesize, "gtTileSeparate");
  ------------------
  |  Branch (946:33): [True: 58, False: 544]
  ------------------
  947|    602|    if (bufsize == 0)
  ------------------
  |  Branch (947:9): [True: 0, False: 602]
  ------------------
  948|      0|    {
  949|      0|        return (0);
  950|      0|    }
  951|       |
  952|    602|    TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tw);
  ------------------
  |  |  311|    602|#define TIFFTAG_TILEWIDTH 322              /* !tile width in pixels */
  ------------------
  953|    602|    TIFFGetField(tif, TIFFTAG_TILELENGTH, &th);
  ------------------
  |  |  312|    602|#define TIFFTAG_TILELENGTH 323             /* !tile height in pixels */
  ------------------
  954|       |
  955|    602|    flip = setorientation(img);
  956|    602|    if (flip & FLIP_VERTICALLY)
  ------------------
  |  |   50|    602|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (956:9): [True: 579, False: 23]
  ------------------
  957|    579|    {
  958|    579|        if (((int64_t)tw + w) > INT_MAX)
  ------------------
  |  Branch (958:13): [True: 0, False: 579]
  ------------------
  959|      0|        {
  960|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
  961|      0|                          "unsupported tile size (too wide)");
  962|      0|            return (0);
  963|      0|        }
  964|    579|        y = h - 1;
  965|    579|        toskew = -(int32_t)(tw + w);
  966|    579|    }
  967|     23|    else
  968|     23|    {
  969|     23|        if (tw > ((int64_t)INT_MAX + w) || w > ((int64_t)INT_MAX + tw))
  ------------------
  |  Branch (969:13): [True: 0, False: 23]
  |  Branch (969:44): [True: 0, False: 23]
  ------------------
  970|      0|        {
  971|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "%s",
  972|      0|                          "unsupported tile size (too wide)");
  973|      0|            return (0);
  974|      0|        }
  975|     23|        y = 0;
  976|     23|        toskew = -(int32_t)(tw - w);
  977|     23|    }
  978|       |
  979|    602|    switch (img->photometric)
  980|    602|    {
  981|      0|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|      0|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (981:9): [True: 0, False: 602]
  ------------------
  982|     45|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|     45|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (982:9): [True: 45, False: 557]
  ------------------
  983|     45|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|     45|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (983:9): [True: 0, False: 602]
  ------------------
  984|     45|            colorchannels = 1;
  985|     45|            break;
  986|       |
  987|    557|        default:
  ------------------
  |  Branch (987:9): [True: 557, False: 45]
  ------------------
  988|    557|            colorchannels = 3;
  989|    557|            break;
  990|    602|    }
  991|       |
  992|    602|    if (tw == 0 || th == 0)
  ------------------
  |  Branch (992:9): [True: 0, False: 602]
  |  Branch (992:20): [True: 0, False: 602]
  ------------------
  993|      0|    {
  994|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "tile width or height is zero");
  995|      0|        return (0);
  996|      0|    }
  997|       |
  998|       |    /*
  999|       |     *	Leftmost tile is clipped on left side if col_offset > 0.
 1000|       |     */
 1001|    602|    leftmost_fromskew = (int32_t)((uint32_t)img->col_offset % tw);
 1002|    602|    leftmost_tw = (uint32_t)((int32_t)tw - leftmost_fromskew);
 1003|    602|    int64_t skew_i64 = (int64_t)toskew + (int64_t)(int32_t)leftmost_fromskew;
 1004|    602|    if (skew_i64 > INT_MAX || skew_i64 < INT_MIN)
  ------------------
  |  Branch (1004:9): [True: 0, False: 602]
  |  Branch (1004:31): [True: 0, False: 602]
  ------------------
 1005|      0|    {
 1006|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "%s %" PRId64, "Invalid skew",
 1007|      0|                      skew_i64);
 1008|      0|        return (0);
 1009|      0|    }
 1010|    602|    leftmost_toskew = (int32_t)skew_i64;
 1011|  61.1k|    for (row = 0; ret != 0 && row < h; row += nrow)
  ------------------
  |  Branch (1011:19): [True: 61.1k, False: 63]
  |  Branch (1011:31): [True: 60.5k, False: 539]
  ------------------
 1012|  60.5k|    {
 1013|  60.5k|        rowstoread = th - ((uint32_t)row + (uint32_t)img->row_offset) % th;
 1014|  60.5k|        nrow = (row + rowstoread > h ? h - row : rowstoread);
  ------------------
  |  Branch (1014:17): [True: 553, False: 60.0k]
  ------------------
 1015|  60.5k|        fromskew = leftmost_fromskew;
 1016|  60.5k|        this_tw = leftmost_tw;
 1017|  60.5k|        this_toskew = leftmost_toskew;
 1018|  60.5k|        tocol = 0;
 1019|  60.5k|        col = (uint32_t)img->col_offset;
 1020|       |        /* wmin: only write imagewidth if raster is bigger. */
 1021|   335k|        while (tocol < wmin)
  ------------------
  |  Branch (1021:16): [True: 275k, False: 60.5k]
  ------------------
 1022|   275k|        {
 1023|   275k|            if (buf == NULL)
  ------------------
  |  Branch (1023:17): [True: 602, False: 274k]
  ------------------
 1024|    602|            {
 1025|    602|                if (_TIFFReadTileAndAllocBuffer(
  ------------------
  |  Branch (1025:21): [True: 86, False: 516]
  ------------------
 1026|    602|                        tif, (void **)&buf, bufsize, col,
 1027|    602|                        (uint32_t)((int32_t)row + img->row_offset), 0,
 1028|    602|                        0) == (tmsize_t)(-1) &&
 1029|     86|                    (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (1029:22): [True: 63, False: 23]
  |  Branch (1029:37): [True: 0, False: 23]
  ------------------
 1030|     63|                {
 1031|     63|                    ret = 0;
 1032|     63|                    break;
 1033|     63|                }
 1034|    539|                p0 = buf;
 1035|    539|                if (colorchannels == 1)
  ------------------
  |  Branch (1035:21): [True: 36, False: 503]
  ------------------
 1036|     36|                {
 1037|     36|                    p2 = p1 = p0;
 1038|     36|                    pa = (alpha ? (p0 + 3 * tilesize) : NULL);
  ------------------
  |  Branch (1038:27): [True: 31, False: 5]
  ------------------
 1039|     36|                }
 1040|    503|                else
 1041|    503|                {
 1042|    503|                    p1 = p0 + tilesize;
 1043|    503|                    p2 = p1 + tilesize;
 1044|    503|                    pa = (alpha ? (p2 + tilesize) : NULL);
  ------------------
  |  Branch (1044:27): [True: 19, False: 484]
  ------------------
 1045|    503|                }
 1046|    539|            }
 1047|   274k|            else if (TIFFReadTile(tif, p0, col,
  ------------------
  |  Branch (1047:22): [True: 77.6k, False: 196k]
  ------------------
 1048|   274k|                                  (uint32_t)((int32_t)row + img->row_offset), 0,
 1049|   274k|                                  0) == (tmsize_t)(-1) &&
 1050|  77.6k|                     img->stoponerr)
  ------------------
  |  Branch (1050:22): [True: 0, False: 77.6k]
  ------------------
 1051|      0|            {
 1052|      0|                ret = 0;
 1053|      0|                break;
 1054|      0|            }
 1055|   275k|            if (colorchannels > 1 &&
  ------------------
  |  Branch (1055:17): [True: 259k, False: 15.0k]
  ------------------
 1056|   259k|                TIFFReadTile(tif, p1, col,
  ------------------
  |  Branch (1056:17): [True: 245k, False: 14.6k]
  ------------------
 1057|   259k|                             (uint32_t)((int32_t)row + img->row_offset), 0,
 1058|   259k|                             (uint16_t)1) == (tmsize_t)(-1) &&
 1059|   245k|                img->stoponerr)
  ------------------
  |  Branch (1059:17): [True: 0, False: 245k]
  ------------------
 1060|      0|            {
 1061|      0|                ret = 0;
 1062|      0|                break;
 1063|      0|            }
 1064|   275k|            if (colorchannels > 1 &&
  ------------------
  |  Branch (1064:17): [True: 259k, False: 15.0k]
  ------------------
 1065|   259k|                TIFFReadTile(tif, p2, col,
  ------------------
  |  Branch (1065:17): [True: 259k, False: 580]
  ------------------
 1066|   259k|                             (uint32_t)((int32_t)row + img->row_offset), 0,
 1067|   259k|                             (uint16_t)2) == (tmsize_t)(-1) &&
 1068|   259k|                img->stoponerr)
  ------------------
  |  Branch (1068:17): [True: 0, False: 259k]
  ------------------
 1069|      0|            {
 1070|      0|                ret = 0;
 1071|      0|                break;
 1072|      0|            }
 1073|   275k|            if (alpha &&
  ------------------
  |  Branch (1073:17): [True: 75.1k, False: 199k]
  ------------------
 1074|  75.1k|                TIFFReadTile(tif, pa, col,
  ------------------
  |  Branch (1074:17): [True: 74.8k, False: 284]
  ------------------
 1075|  75.1k|                             (uint32_t)((int32_t)row + img->row_offset), 0,
 1076|  75.1k|                             (uint16_t)colorchannels) == (tmsize_t)(-1) &&
 1077|  74.8k|                img->stoponerr)
  ------------------
  |  Branch (1077:17): [True: 0, False: 74.8k]
  ------------------
 1078|      0|            {
 1079|      0|                ret = 0;
 1080|      0|                break;
 1081|      0|            }
 1082|       |
 1083|       |            /* For SEPARATE the pos-offset is per sample and should not be
 1084|       |             * multiplied by img->samplesperpixel. */
 1085|   275k|            pos = (tmsize_t)((uint32_t)((int32_t)row + img->row_offset) % th) *
 1086|   275k|                      TIFFTileRowSize(tif) +
 1087|   275k|                  (tmsize_t)fromskew;
 1088|   275k|            if (tocol + this_tw > wmin)
  ------------------
  |  Branch (1088:17): [True: 60.4k, False: 214k]
  ------------------
 1089|  60.4k|            {
 1090|       |                /*
 1091|       |                 * Rightmost tile is clipped on right side.
 1092|       |                 */
 1093|  60.4k|                fromskew = (int32_t)(tw - (wmin - tocol));
 1094|  60.4k|                this_tw = (uint32_t)((int32_t)tw - fromskew);
 1095|  60.4k|                this_toskew = (int32_t)(toskew + (int32_t)(uint32_t)fromskew);
 1096|  60.4k|            }
 1097|   275k|            tmsize_t roffset = (tmsize_t)y * w + tocol;
 1098|   275k|            (*put)(img, raster + roffset, tocol, y, this_tw, nrow, fromskew,
 1099|   275k|                   this_toskew, p0 + pos, p1 + pos, p2 + pos,
 1100|   275k|                   (alpha ? (pa + pos) : NULL));
  ------------------
  |  Branch (1100:21): [True: 75.1k, False: 199k]
  ------------------
 1101|   275k|            tocol += this_tw;
 1102|   275k|            col += this_tw;
 1103|       |            /*
 1104|       |             * After the leftmost tile, tiles are no longer clipped on left
 1105|       |             * side.
 1106|       |             */
 1107|   275k|            fromskew = 0;
 1108|   275k|            this_tw = tw;
 1109|   275k|            this_toskew = toskew;
 1110|   275k|        }
 1111|       |
 1112|  60.5k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|  60.5k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1112:25): [True: 60.3k, False: 241]
  ------------------
 1113|  60.5k|                                                 : (int32_t)nrow);
 1114|  60.5k|    }
 1115|       |
 1116|    602|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|    602|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (1116:9): [True: 21, False: 581]
  ------------------
 1117|     21|    {
 1118|     21|        uint32_t line;
 1119|       |
 1120|  31.8k|        for (line = 0; line < h; line++)
  ------------------
  |  Branch (1120:24): [True: 31.8k, False: 21]
  ------------------
 1121|  31.8k|        {
 1122|  31.8k|            uint32_t *left = raster + (size_t)line * w;
 1123|       |            /* Use wmin to only flip horizontally data in place and not complete
 1124|       |             * raster-row. */
 1125|  31.8k|            uint32_t *right = left + wmin - 1;
 1126|       |
 1127|  1.28M|            while (left < right)
  ------------------
  |  Branch (1127:20): [True: 1.25M, False: 31.8k]
  ------------------
 1128|  1.25M|            {
 1129|  1.25M|                uint32_t temp = *left;
 1130|  1.25M|                *left = *right;
 1131|  1.25M|                *right = temp;
 1132|  1.25M|                left++;
 1133|  1.25M|                right--;
 1134|  1.25M|            }
 1135|  31.8k|        }
 1136|     21|    }
 1137|       |
 1138|    602|    _TIFFfreeExt(img->tif, buf);
 1139|    602|    return (ret);
 1140|    602|}
tif_getimage.c:gtStripSeparate:
 1302|    163|{
 1303|    163|    TIFF *tif = img->tif;
 1304|    163|    tileSeparateRoutine put = img->put.separate;
 1305|    163|    unsigned char *buf = NULL;
 1306|    163|    unsigned char *p0 = NULL, *p1 = NULL, *p2 = NULL, *pa = NULL;
 1307|    163|    uint32_t row, y, nrow, rowstoread;
 1308|    163|    tmsize_t pos;
 1309|    163|    tmsize_t scanline;
 1310|    163|    uint32_t rowsperstrip, offset_row;
 1311|    163|    uint32_t imagewidth = img->width;
 1312|    163|    tmsize_t stripsize;
 1313|    163|    tmsize_t bufsize;
 1314|    163|    int32_t fromskew, toskew;
 1315|    163|    int alpha = img->alpha;
 1316|    163|    int ret = 1, flip;
 1317|    163|    uint16_t colorchannels;
 1318|       |
 1319|       |    /* If the raster is smaller than the image,
 1320|       |     * or if there is a col_offset, adapt the samples to be copied per row. */
 1321|    163|    uint32_t wmin;
 1322|    163|    if (0 <= img->col_offset && (uint32_t)img->col_offset < imagewidth)
  ------------------
  |  Branch (1322:9): [True: 163, False: 0]
  |  Branch (1322:33): [True: 163, False: 0]
  ------------------
 1323|    163|    {
 1324|    163|        wmin = TIFFmin(w, imagewidth - (uint32_t)img->col_offset);
  ------------------
  |  |  337|    163|#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
  |  |  ------------------
  |  |  |  Branch (337:24): [True: 0, False: 163]
  |  |  ------------------
  ------------------
 1325|    163|    }
 1326|      0|    else
 1327|      0|    {
 1328|      0|        TIFFErrorExtR(tif, TIFFFileName(tif),
 1329|      0|                      "Error in gtStripSeparate: column offset %d exceeds "
 1330|      0|                      "image width %u",
 1331|      0|                      img->col_offset, imagewidth);
 1332|      0|        return 0;
 1333|      0|    }
 1334|       |
 1335|    163|    stripsize = TIFFStripSize(tif);
 1336|    163|    bufsize =
 1337|    163|        _TIFFMultiplySSize(tif, alpha ? 4 : 3, stripsize, "gtStripSeparate");
  ------------------
  |  Branch (1337:33): [True: 84, False: 79]
  ------------------
 1338|    163|    if (bufsize == 0)
  ------------------
  |  Branch (1338:9): [True: 0, False: 163]
  ------------------
 1339|      0|    {
 1340|      0|        return (0);
 1341|      0|    }
 1342|       |
 1343|    163|    flip = setorientation(img);
 1344|    163|    if (flip & FLIP_VERTICALLY)
  ------------------
  |  |   50|    163|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1344:9): [True: 123, False: 40]
  ------------------
 1345|    123|    {
 1346|    123|        if (w > INT_MAX / 2)
  ------------------
  |  Branch (1346:13): [True: 0, False: 123]
  ------------------
 1347|      0|        {
 1348|      0|            TIFFErrorExtR(tif, TIFFFileName(tif), "Width overflow");
 1349|      0|            return (0);
 1350|      0|        }
 1351|    123|        y = h - 1;
 1352|       |        /* Skew back to the raster row before the currently written row
 1353|       |         * -> one raster width plus one image width. */
 1354|    123|        toskew = -(int32_t)(w + wmin);
 1355|    123|    }
 1356|     40|    else
 1357|     40|    {
 1358|     40|        y = 0;
 1359|       |        /* Skew forward to the end of the raster width of the row currently
 1360|       |         * written. */
 1361|     40|        toskew = (int32_t)(w - wmin);
 1362|     40|    }
 1363|       |
 1364|    163|    switch (img->photometric)
 1365|    163|    {
 1366|      2|        case PHOTOMETRIC_MINISWHITE:
  ------------------
  |  |  221|      2|#define PHOTOMETRIC_MINISWHITE 0           /* min value is white */
  ------------------
  |  Branch (1366:9): [True: 2, False: 161]
  ------------------
 1367|     56|        case PHOTOMETRIC_MINISBLACK:
  ------------------
  |  |  222|     56|#define PHOTOMETRIC_MINISBLACK 1           /* min value is black */
  ------------------
  |  Branch (1367:9): [True: 54, False: 109]
  ------------------
 1368|     56|        case PHOTOMETRIC_PALETTE:
  ------------------
  |  |  224|     56|#define PHOTOMETRIC_PALETTE 3              /* color map indexed */
  ------------------
  |  Branch (1368:9): [True: 0, False: 163]
  ------------------
 1369|     56|            colorchannels = 1;
 1370|     56|            break;
 1371|       |
 1372|    107|        default:
  ------------------
  |  Branch (1372:9): [True: 107, False: 56]
  ------------------
 1373|    107|            colorchannels = 3;
 1374|    107|            break;
 1375|    163|    }
 1376|       |
 1377|    163|    TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
  ------------------
  |  |  258|    163|#define TIFFTAG_ROWSPERSTRIP 278           /* rows per strip of data */
  ------------------
 1378|    163|    if (rowsperstrip == 0)
  ------------------
  |  Branch (1378:9): [True: 0, False: 163]
  ------------------
 1379|      0|    {
 1380|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "rowsperstrip is zero");
 1381|      0|        return (0);
 1382|      0|    }
 1383|       |
 1384|    163|    scanline = TIFFScanlineSize(tif);
 1385|    163|    fromskew = (int32_t)(w < imagewidth ? imagewidth - w : 0);
  ------------------
  |  Branch (1385:26): [True: 0, False: 163]
  ------------------
 1386|  98.7k|    for (row = 0; row < h; row += nrow)
  ------------------
  |  Branch (1386:19): [True: 98.6k, False: 140]
  ------------------
 1387|  98.6k|    {
 1388|  98.6k|        uint32_t temp;
 1389|  98.6k|        rowstoread =
 1390|  98.6k|            rowsperstrip -
 1391|  98.6k|            ((uint32_t)((int32_t)row + img->row_offset) % rowsperstrip);
 1392|  98.6k|        nrow = (row + rowstoread > h ? h - row : rowstoread);
  ------------------
  |  Branch (1392:17): [True: 143, False: 98.4k]
  ------------------
 1393|  98.6k|        offset_row = (uint32_t)((int32_t)row + img->row_offset);
 1394|  98.6k|        temp = (uint32_t)((int32_t)row + img->row_offset) % rowsperstrip + nrow;
 1395|  98.6k|        if (scanline > 0 && temp > (size_t)(TIFF_TMSIZE_T_MAX / scanline))
  ------------------
  |  |   68|  98.6k|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (1395:13): [True: 98.6k, False: 0]
  |  Branch (1395:29): [True: 0, False: 98.6k]
  ------------------
 1396|      0|        {
 1397|      0|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1398|      0|                          "Integer overflow in gtStripSeparate");
 1399|      0|            return 0;
 1400|      0|        }
 1401|  98.6k|        if (buf == NULL)
  ------------------
  |  Branch (1401:13): [True: 163, False: 98.4k]
  ------------------
 1402|    163|        {
 1403|    163|            if (_TIFFReadEncodedStripAndAllocBuffer(
  ------------------
  |  Branch (1403:17): [True: 83, False: 80]
  ------------------
 1404|    163|                    tif, TIFFComputeStrip(tif, offset_row, 0), (void **)&buf,
 1405|    163|                    bufsize, temp * scanline) == (tmsize_t)(-1) &&
 1406|     83|                (buf == NULL || img->stoponerr))
  ------------------
  |  Branch (1406:18): [True: 23, False: 60]
  |  Branch (1406:33): [True: 0, False: 60]
  ------------------
 1407|     23|            {
 1408|     23|                ret = 0;
 1409|     23|                break;
 1410|     23|            }
 1411|    140|            p0 = buf;
 1412|    140|            if (colorchannels == 1)
  ------------------
  |  Branch (1412:17): [True: 52, False: 88]
  ------------------
 1413|     52|            {
 1414|     52|                p2 = p1 = p0;
 1415|     52|                pa = (alpha ? (p0 + 3 * stripsize) : NULL);
  ------------------
  |  Branch (1415:23): [True: 46, False: 6]
  ------------------
 1416|     52|            }
 1417|     88|            else
 1418|     88|            {
 1419|     88|                p1 = p0 + stripsize;
 1420|     88|                p2 = p1 + stripsize;
 1421|     88|                pa = (alpha ? (p2 + stripsize) : NULL);
  ------------------
  |  Branch (1421:23): [True: 34, False: 54]
  ------------------
 1422|     88|            }
 1423|    140|        }
 1424|  98.4k|        else if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 0),
  ------------------
  |  Branch (1424:18): [True: 67.0k, False: 31.4k]
  ------------------
 1425|  98.4k|                                      p0, temp * scanline) == (tmsize_t)(-1) &&
 1426|  67.0k|                 img->stoponerr)
  ------------------
  |  Branch (1426:18): [True: 0, False: 67.0k]
  ------------------
 1427|      0|        {
 1428|      0|            ret = 0;
 1429|      0|            break;
 1430|      0|        }
 1431|  98.6k|        if (colorchannels > 1 &&
  ------------------
  |  Branch (1431:13): [True: 3.88k, False: 94.7k]
  ------------------
 1432|  3.88k|            TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 1), p1,
  ------------------
  |  Branch (1432:13): [True: 736, False: 3.14k]
  ------------------
 1433|  3.88k|                                 temp * scanline) == (tmsize_t)(-1) &&
 1434|    736|            img->stoponerr)
  ------------------
  |  Branch (1434:13): [True: 0, False: 736]
  ------------------
 1435|      0|        {
 1436|      0|            ret = 0;
 1437|      0|            break;
 1438|      0|        }
 1439|  98.6k|        if (colorchannels > 1 &&
  ------------------
  |  Branch (1439:13): [True: 3.88k, False: 94.7k]
  ------------------
 1440|  3.88k|            TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 2), p2,
  ------------------
  |  Branch (1440:13): [True: 755, False: 3.12k]
  ------------------
 1441|  3.88k|                                 temp * scanline) == (tmsize_t)(-1) &&
 1442|    755|            img->stoponerr)
  ------------------
  |  Branch (1442:13): [True: 0, False: 755]
  ------------------
 1443|      0|        {
 1444|      0|            ret = 0;
 1445|      0|            break;
 1446|      0|        }
 1447|  98.6k|        if (alpha)
  ------------------
  |  Branch (1447:13): [True: 98.3k, False: 294]
  ------------------
 1448|  98.3k|        {
 1449|  98.3k|            if (TIFFReadEncodedStrip(
  ------------------
  |  Branch (1449:17): [True: 66.8k, False: 31.4k]
  ------------------
 1450|  98.3k|                    tif, TIFFComputeStrip(tif, offset_row, colorchannels), pa,
 1451|  98.3k|                    temp * scanline) == (tmsize_t)(-1) &&
 1452|  66.8k|                img->stoponerr)
  ------------------
  |  Branch (1452:17): [True: 0, False: 66.8k]
  ------------------
 1453|      0|            {
 1454|      0|                ret = 0;
 1455|      0|                break;
 1456|      0|            }
 1457|  98.3k|        }
 1458|       |
 1459|       |        /* For SEPARATE the pos-offset is per sample and should not be
 1460|       |         * multiplied by img->samplesperpixel. */
 1461|  98.6k|        pos = (tmsize_t)((uint32_t)((int32_t)row + img->row_offset) %
 1462|  98.6k|                         rowsperstrip) *
 1463|  98.6k|                  scanline +
 1464|  98.6k|              (tmsize_t)img->col_offset;
 1465|  98.6k|        tmsize_t roffset = (tmsize_t)y * w;
 1466|  98.6k|        (*put)(img, raster + roffset, 0, y, wmin, nrow, fromskew, toskew,
 1467|  98.6k|               p0 + pos, p1 + pos, p2 + pos, (alpha ? (pa + pos) : NULL));
  ------------------
  |  Branch (1467:47): [True: 98.3k, False: 294]
  ------------------
 1468|  98.6k|        y += (uint32_t)((flip & FLIP_VERTICALLY) ? -(int32_t)nrow
  ------------------
  |  |   50|  98.6k|#define FLIP_VERTICALLY 0x01
  ------------------
  |  Branch (1468:25): [True: 3.92k, False: 94.6k]
  ------------------
 1469|  98.6k|                                                 : (int32_t)nrow);
 1470|  98.6k|    }
 1471|       |
 1472|    163|    if (flip & FLIP_HORIZONTALLY)
  ------------------
  |  |   51|    163|#define FLIP_HORIZONTALLY 0x02
  ------------------
  |  Branch (1472:9): [True: 36, False: 127]
  ------------------
 1473|     36|    {
 1474|     36|        uint32_t line;
 1475|       |
 1476|  67.3M|        for (line = 0; line < h; line++)
  ------------------
  |  Branch (1476:24): [True: 67.3M, False: 36]
  ------------------
 1477|  67.3M|        {
 1478|  67.3M|            uint32_t *left = raster + (size_t)line * w;
 1479|       |            /* Use wmin to only flip horizontally data in place and not complete
 1480|       |             * raster-row. */
 1481|  67.3M|            uint32_t *right = left + wmin - 1;
 1482|       |
 1483|   163M|            while (left < right)
  ------------------
  |  Branch (1483:20): [True: 96.6M, False: 67.3M]
  ------------------
 1484|  96.6M|            {
 1485|  96.6M|                uint32_t temp = *left;
 1486|  96.6M|                *left = *right;
 1487|  96.6M|                *right = temp;
 1488|  96.6M|                left++;
 1489|  96.6M|                right--;
 1490|  96.6M|            }
 1491|  67.3M|        }
 1492|     36|    }
 1493|       |
 1494|    163|    _TIFFfreeExt(img->tif, buf);
 1495|    163|    return (ret);
 1496|    163|}
tif_getimage.c:putRGBAAseparate8bittile:
 2067|  1.01k|{
 2068|  1.01k|    (void)img;
 2069|  1.01k|    (void)x;
 2070|  1.01k|    (void)y;
 2071|  21.3k|    for (; h > 0; --h)
  ------------------
  |  Branch (2071:12): [True: 20.3k, False: 1.01k]
  ------------------
 2072|  20.3k|    {
 2073|  20.3k|        UNROLL8(w, NOP, *cp++ = PACK4(*r++, *g++, *b++, *a++));
  ------------------
  |  | 1554|  20.3k|    {                                                                          \
  |  | 1555|  20.3k|        uint32_t _x;                                                           \
  |  | 1556|   598k|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1556:22): [True: 578k, False: 20.3k]
  |  |  ------------------
  |  | 1557|   578k|        {                                                                      \
  |  | 1558|   578k|            op1;                                                               \
  |  | 1559|   578k|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1509|   578k|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|   578k|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   578k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   578k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|   578k|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   578k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   578k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1510|   578k|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|   578k|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   578k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   578k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|   578k|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|   578k|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|   578k|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1560|   578k|        }                                                                      \
  |  | 1561|  20.3k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1561:13): [True: 20.3k, False: 3]
  |  |  ------------------
  |  | 1562|  20.3k|        {                                                                      \
  |  | 1563|  20.3k|            op1;                                                               \
  |  | 1564|  20.3k|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1518|  20.3k|    switch (x)                                                                 \
  |  |  |  | 1519|  20.3k|    {                                                                          \
  |  |  |  | 1520|  2.09k|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1520:9): [True: 2.09k, False: 18.2k]
  |  |  |  |  ------------------
  |  |  |  | 1521|  2.09k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1522|  2.37k|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1522:9): [True: 272, False: 20.1k]
  |  |  |  |  ------------------
  |  |  |  | 1523|  2.37k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1524|  14.8k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1524:9): [True: 12.5k, False: 7.86k]
  |  |  |  |  ------------------
  |  |  |  | 1525|  14.8k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1526|  15.9k|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1526:9): [True: 1.04k, False: 19.3k]
  |  |  |  |  ------------------
  |  |  |  | 1527|  15.9k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1528|  17.5k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1528:9): [True: 1.61k, False: 18.7k]
  |  |  |  |  ------------------
  |  |  |  | 1529|  17.5k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1530|  17.8k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1530:9): [True: 353, False: 20.0k]
  |  |  |  |  ------------------
  |  |  |  | 1531|  17.8k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1532|  20.3k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1532:9): [True: 2.48k, False: 17.8k]
  |  |  |  |  ------------------
  |  |  |  | 1533|  20.3k|            op;                                                                \
  |  |  |  | 1534|  20.3k|            break;                                                             \
  |  |  |  | 1535|  17.8k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1535:9): [True: 0, False: 20.3k]
  |  |  |  |  ------------------
  |  |  |  | 1536|      0|            break;                                                             \
  |  |  |  | 1537|  20.3k|    }
  |  |  ------------------
  |  | 1565|  20.3k|        }                                                                      \
  |  | 1566|  20.3k|    }
  ------------------
 2074|  20.3k|        SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1603|  20.3k|    {                                                                          \
  |  | 1604|  20.3k|        r += skew;                                                             \
  |  | 1605|  20.3k|        g += skew;                                                             \
  |  | 1606|  20.3k|        b += skew;                                                             \
  |  | 1607|  20.3k|        a += skew;                                                             \
  |  | 1608|  20.3k|    }
  ------------------
 2075|  20.3k|        cp += toskew;
 2076|  20.3k|    }
 2077|  1.01k|}
tif_getimage.c:putRGBUAseparate8bittile:
 2106|    311|{
 2107|    311|    (void)img;
 2108|    311|    (void)y;
 2109|  71.0k|    for (; h > 0; --h)
  ------------------
  |  Branch (2109:12): [True: 70.7k, False: 311]
  ------------------
 2110|  70.7k|    {
 2111|  70.7k|        uint32_t rv, gv, bv, av;
 2112|  70.7k|        uint8_t *m;
 2113|  26.0M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2113:21): [True: 25.9M, False: 70.7k]
  ------------------
 2114|  25.9M|        {
 2115|  25.9M|            av = *a++;
 2116|  25.9M|            m = img->UaToAa + ((size_t)av << 8);
 2117|  25.9M|            rv = m[*r++];
 2118|  25.9M|            gv = m[*g++];
 2119|  25.9M|            bv = m[*b++];
 2120|  25.9M|            *cp++ = PACK4(rv, gv, bv, av);
  ------------------
  |  | 1614|  25.9M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|  25.9M|     ((uint32_t)(a) << 24))
  ------------------
 2121|  25.9M|        }
 2122|  70.7k|        SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1603|  70.7k|    {                                                                          \
  |  | 1604|  70.7k|        r += skew;                                                             \
  |  | 1605|  70.7k|        g += skew;                                                             \
  |  | 1606|  70.7k|        b += skew;                                                             \
  |  | 1607|  70.7k|        a += skew;                                                             \
  |  | 1608|  70.7k|    }
  ------------------
 2123|  70.7k|        cp += toskew;
 2124|  70.7k|    }
 2125|    311|}
tif_getimage.c:putRGBseparate8bittile:
 2050|    122|{
 2051|    122|    (void)img;
 2052|    122|    (void)x;
 2053|    122|    (void)y;
 2054|    122|    (void)a;
 2055|   116k|    for (; h > 0; --h)
  ------------------
  |  Branch (2055:12): [True: 116k, False: 122]
  ------------------
 2056|   116k|    {
 2057|   116k|        UNROLL8(w, NOP, *cp++ = PACK(*r++, *g++, *b++));
  ------------------
  |  | 1554|   116k|    {                                                                          \
  |  | 1555|   116k|        uint32_t _x;                                                           \
  |  | 1556|  13.4M|        for (_x = w; _x >= 8; _x -= 8)                                         \
  |  |  ------------------
  |  |  |  Branch (1556:22): [True: 13.3M, False: 116k]
  |  |  ------------------
  |  | 1557|  13.3M|        {                                                                      \
  |  | 1558|  13.3M|            op1;                                                               \
  |  | 1559|  13.3M|            REPEAT8(op2);                                                      \
  |  |  ------------------
  |  |  |  | 1509|  13.3M|    REPEAT4(op);                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|  13.3M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  13.3M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  13.3M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|  13.3M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  13.3M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  13.3M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1510|  13.3M|    REPEAT4(op)
  |  |  |  |  ------------------
  |  |  |  |  |  | 1512|  13.3M|    REPEAT2(op);                                                               \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  13.3M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  13.3M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1513|  13.3M|    REPEAT2(op)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1515|  13.3M|    op;                                                                        \
  |  |  |  |  |  |  |  | 1516|  13.3M|    op
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1560|  13.3M|        }                                                                      \
  |  | 1561|   116k|        if (_x > 0)                                                            \
  |  |  ------------------
  |  |  |  Branch (1561:13): [True: 116k, False: 0]
  |  |  ------------------
  |  | 1562|   116k|        {                                                                      \
  |  | 1563|   116k|            op1;                                                               \
  |  | 1564|   116k|            CASE8(_x, op2);                                                    \
  |  |  ------------------
  |  |  |  | 1518|   116k|    switch (x)                                                                 \
  |  |  |  | 1519|   116k|    {                                                                          \
  |  |  |  | 1520|    745|        case 7:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1520:9): [True: 745, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1521|    745|            op; /*-fallthrough*/                                               \
  |  |  |  | 1522|    745|        case 6:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1522:9): [True: 0, False: 116k]
  |  |  |  |  ------------------
  |  |  |  | 1523|    745|            op; /*-fallthrough*/                                               \
  |  |  |  | 1524|  57.8k|        case 5:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1524:9): [True: 57.0k, False: 59.3k]
  |  |  |  |  ------------------
  |  |  |  | 1525|  57.8k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1526|  57.8k|        case 4:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1526:9): [True: 0, False: 116k]
  |  |  |  |  ------------------
  |  |  |  | 1527|  57.8k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1528|   115k|        case 3:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1528:9): [True: 57.8k, False: 58.6k]
  |  |  |  |  ------------------
  |  |  |  | 1529|   115k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1530|   115k|        case 2:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1530:9): [True: 32, False: 116k]
  |  |  |  |  ------------------
  |  |  |  | 1531|   115k|            op; /*-fallthrough*/                                               \
  |  |  |  | 1532|   116k|        case 1:                                                                \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1532:9): [True: 771, False: 115k]
  |  |  |  |  ------------------
  |  |  |  | 1533|   116k|            op;                                                                \
  |  |  |  | 1534|   116k|            break;                                                             \
  |  |  |  | 1535|   115k|        default:                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1535:9): [True: 0, False: 116k]
  |  |  |  |  ------------------
  |  |  |  | 1536|      0|            break;                                                             \
  |  |  |  | 1537|   116k|    }
  |  |  ------------------
  |  | 1565|   116k|        }                                                                      \
  |  | 1566|   116k|    }
  ------------------
 2058|   116k|        SKEW(r, g, b, fromskew);
  ------------------
  |  | 1597|   116k|    {                                                                          \
  |  | 1598|   116k|        r += skew;                                                             \
  |  | 1599|   116k|        g += skew;                                                             \
  |  | 1600|   116k|        b += skew;                                                             \
  |  | 1601|   116k|    }
  ------------------
 2059|   116k|        cp += toskew;
 2060|   116k|    }
 2061|    122|}
tif_getimage.c:putRGBAAseparate16bittile:
 2152|  42.1k|{
 2153|  42.1k|    uint16_t *wr = (uint16_t *)r;
 2154|  42.1k|    uint16_t *wg = (uint16_t *)g;
 2155|  42.1k|    uint16_t *wb = (uint16_t *)b;
 2156|  42.1k|    uint16_t *wa = (uint16_t *)a;
 2157|  42.1k|    (void)img;
 2158|  42.1k|    (void)y;
 2159|   192k|    for (; h > 0; --h)
  ------------------
  |  Branch (2159:12): [True: 150k, False: 42.1k]
  ------------------
 2160|   150k|    {
 2161|  59.9M|        for (x = 0; x < w; x++)
  ------------------
  |  Branch (2161:21): [True: 59.7M, False: 150k]
  ------------------
 2162|  59.7M|            *cp++ = PACK4(img->Bitdepth16To8[*wr++], img->Bitdepth16To8[*wg++],
  ------------------
  |  | 1614|  59.7M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|  59.7M|     ((uint32_t)(a) << 24))
  ------------------
 2163|   150k|                          img->Bitdepth16To8[*wb++], img->Bitdepth16To8[*wa++]);
 2164|   150k|        SKEW4(wr, wg, wb, wa, fromskew);
  ------------------
  |  | 1603|   150k|    {                                                                          \
  |  | 1604|   150k|        r += skew;                                                             \
  |  | 1605|   150k|        g += skew;                                                             \
  |  | 1606|   150k|        b += skew;                                                             \
  |  | 1607|   150k|        a += skew;                                                             \
  |  | 1608|   150k|    }
  ------------------
 2165|   150k|        cp += toskew;
 2166|   150k|    }
 2167|  42.1k|}
tif_getimage.c:putRGBUAseparate16bittile:
 2173|  66.1k|{
 2174|  66.1k|    uint16_t *wr = (uint16_t *)r;
 2175|  66.1k|    uint16_t *wg = (uint16_t *)g;
 2176|  66.1k|    uint16_t *wb = (uint16_t *)b;
 2177|  66.1k|    uint16_t *wa = (uint16_t *)a;
 2178|  66.1k|    (void)img;
 2179|  66.1k|    (void)y;
 2180|  67.4M|    for (; h > 0; --h)
  ------------------
  |  Branch (2180:12): [True: 67.3M, False: 66.1k]
  ------------------
 2181|  67.3M|    {
 2182|  67.3M|        uint32_t r2, g2, b2, a2;
 2183|  67.3M|        uint8_t *m;
 2184|   236M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2184:21): [True: 169M, False: 67.3M]
  ------------------
 2185|   169M|        {
 2186|   169M|            a2 = img->Bitdepth16To8[*wa++];
 2187|   169M|            m = img->UaToAa + ((size_t)a2 << 8);
 2188|   169M|            r2 = m[img->Bitdepth16To8[*wr++]];
 2189|   169M|            g2 = m[img->Bitdepth16To8[*wg++]];
 2190|   169M|            b2 = m[img->Bitdepth16To8[*wb++]];
 2191|   169M|            *cp++ = PACK4(r2, g2, b2, a2);
  ------------------
  |  | 1614|   169M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|   169M|     ((uint32_t)(a) << 24))
  ------------------
 2192|   169M|        }
 2193|  67.3M|        SKEW4(wr, wg, wb, wa, fromskew);
  ------------------
  |  | 1603|  67.3M|    {                                                                          \
  |  | 1604|  67.3M|        r += skew;                                                             \
  |  | 1605|  67.3M|        g += skew;                                                             \
  |  | 1606|  67.3M|        b += skew;                                                             \
  |  | 1607|  67.3M|        a += skew;                                                             \
  |  | 1608|  67.3M|    }
  ------------------
 2194|  67.3M|        cp += toskew;
 2195|  67.3M|    }
 2196|  66.1k|}
tif_getimage.c:putRGBseparate16bittile:
 2131|     59|{
 2132|     59|    uint16_t *wr = (uint16_t *)r;
 2133|     59|    uint16_t *wg = (uint16_t *)g;
 2134|     59|    uint16_t *wb = (uint16_t *)b;
 2135|     59|    (void)img;
 2136|     59|    (void)y;
 2137|     59|    (void)a;
 2138|  31.1k|    for (; h > 0; --h)
  ------------------
  |  Branch (2138:12): [True: 31.1k, False: 59]
  ------------------
 2139|  31.1k|    {
 2140|  16.2M|        for (x = 0; x < w; x++)
  ------------------
  |  Branch (2140:21): [True: 16.2M, False: 31.1k]
  ------------------
 2141|  16.2M|            *cp++ = PACK(img->Bitdepth16To8[*wr++], img->Bitdepth16To8[*wg++],
  ------------------
  |  | 1612|  16.2M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1610|  16.2M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2142|  31.1k|                         img->Bitdepth16To8[*wb++]);
 2143|  31.1k|        SKEW(wr, wg, wb, fromskew);
  ------------------
  |  | 1597|  31.1k|    {                                                                          \
  |  | 1598|  31.1k|        r += skew;                                                             \
  |  | 1599|  31.1k|        g += skew;                                                             \
  |  | 1600|  31.1k|        b += skew;                                                             \
  |  | 1601|  31.1k|    }
  ------------------
 2144|  31.1k|        cp += toskew;
 2145|  31.1k|    }
 2146|     59|}
tif_getimage.c:putCMYKseparate8bittile:
 2083|  61.1k|{
 2084|  61.1k|    (void)img;
 2085|  61.1k|    (void)y;
 2086|   267k|    for (; h > 0; --h)
  ------------------
  |  Branch (2086:12): [True: 206k, False: 61.1k]
  ------------------
 2087|   206k|    {
 2088|   206k|        unsigned int rv, gv, bv, kv;
 2089|  16.2M|        for (x = w; x > 0; --x)
  ------------------
  |  Branch (2089:21): [True: 16.0M, False: 206k]
  ------------------
 2090|  16.0M|        {
 2091|  16.0M|            kv = 255U - *a++;
 2092|  16.0M|            rv = (kv * (255U - *r++)) / 255U;
 2093|  16.0M|            gv = (kv * (255U - *g++)) / 255U;
 2094|  16.0M|            bv = (kv * (255U - *b++)) / 255U;
 2095|  16.0M|            *cp++ = PACK4(rv, gv, bv, 255);
  ------------------
  |  | 1614|  16.0M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) |            \
  |  | 1615|  16.0M|     ((uint32_t)(a) << 24))
  ------------------
 2096|  16.0M|        }
 2097|   206k|        SKEW4(r, g, b, a, fromskew);
  ------------------
  |  | 1603|   206k|    {                                                                          \
  |  | 1604|   206k|        r += skew;                                                             \
  |  | 1605|   206k|        g += skew;                                                             \
  |  | 1606|   206k|        b += skew;                                                             \
  |  | 1607|   206k|        a += skew;                                                             \
  |  | 1608|   206k|    }
  ------------------
 2098|   206k|        cp += toskew;
 2099|   206k|    }
 2100|  61.1k|}
tif_getimage.c:putseparate8bitYCbCr11tile:
 2738|   202k|{
 2739|   202k|    (void)y;
 2740|   202k|    (void)a;
 2741|       |    /* TODO: naming of input vars is still off, change obfuscating declaration
 2742|       |     * inside define, or resolve obfuscation */
 2743|   613k|    for (; h > 0; --h)
  ------------------
  |  Branch (2743:12): [True: 410k, False: 202k]
  ------------------
 2744|   410k|    {
 2745|   410k|        x = w;
 2746|   410k|        do
 2747|  88.1M|        {
 2748|  88.1M|            uint32_t dr, dg, db;
 2749|  88.1M|            TIFFYCbCrtoRGB(img->ycbcr, *r++, *g++, *b++, &dr, &dg, &db);
 2750|  88.1M|            *cp++ = PACK(dr, dg, db);
  ------------------
  |  | 1612|  88.1M|    ((uint32_t)(r) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 16) | A1)
  |  |  ------------------
  |  |  |  | 1610|  88.1M|#define A1 (((uint32_t)0xffL) << 24)
  |  |  ------------------
  ------------------
 2751|  88.1M|        } while (--x);
  ------------------
  |  Branch (2751:18): [True: 87.7M, False: 410k]
  ------------------
 2752|   410k|        SKEW(r, g, b, fromskew);
  ------------------
  |  | 1597|   410k|    {                                                                          \
  |  | 1598|   410k|        r += skew;                                                             \
  |  | 1599|   410k|        g += skew;                                                             \
  |  | 1600|   410k|        b += skew;                                                             \
  |  | 1601|   410k|    }
  ------------------
 2753|   410k|        cp += toskew;
 2754|   410k|    }
 2755|   202k|}

TIFFHashSetNew:
  141|  11.9k|{
  142|  11.9k|    TIFFHashSet *set = (TIFFHashSet *)malloc(sizeof(TIFFHashSet));
  143|  11.9k|    if (set == NULL)
  ------------------
  |  Branch (143:9): [True: 0, False: 11.9k]
  ------------------
  144|      0|        return NULL;
  145|  11.9k|    set->fnHashFunc = fnHashFunc ? fnHashFunc : TIFFHashSetHashPointer;
  ------------------
  |  Branch (145:23): [True: 11.9k, False: 0]
  ------------------
  146|  11.9k|    set->fnEqualFunc = fnEqualFunc ? fnEqualFunc : TIFFHashSetEqualPointer;
  ------------------
  |  Branch (146:24): [True: 11.9k, False: 0]
  ------------------
  147|  11.9k|    set->fnFreeEltFunc = fnFreeEltFunc;
  148|  11.9k|    set->nSize = 0;
  149|  11.9k|    set->tabList = (TIFFList **)(calloc(53, sizeof(TIFFList *)));
  150|  11.9k|    if (set->tabList == NULL)
  ------------------
  |  Branch (150:9): [True: 0, False: 11.9k]
  ------------------
  151|      0|    {
  152|      0|        free(set);
  153|      0|        return NULL;
  154|      0|    }
  155|  11.9k|    set->nIndiceAllocatedSize = 0;
  156|  11.9k|    set->nAllocatedSize = 53;
  157|  11.9k|    set->psRecyclingList = NULL;
  158|  11.9k|    set->nRecyclingListSize = 0;
  159|  11.9k|    set->bRehash = false;
  160|       |#ifdef HASH_DEBUG
  161|       |    set->nCollisions = 0;
  162|       |#endif
  163|  11.9k|    return set;
  164|  11.9k|}
TIFFHashSetSize:
  181|  5.98k|{
  182|  5.98k|    assert(set != NULL);
  ------------------
  |  Branch (182:5): [True: 0, False: 5.98k]
  |  Branch (182:5): [True: 5.98k, False: 0]
  ------------------
  183|  5.98k|    return set->nSize;
  184|  5.98k|}
TIFFHashSetDestroy:
  286|  11.9k|{
  287|  11.9k|    if (set)
  ------------------
  |  Branch (287:9): [True: 11.9k, False: 0]
  ------------------
  288|  11.9k|    {
  289|       |        TIFFHashSetClearInternal(set, true);
  290|  11.9k|        free(set->tabList);
  291|  11.9k|        TIFFListDestroy(set->psRecyclingList);
  292|  11.9k|        free(set);
  293|  11.9k|    }
  294|  11.9k|}
TIFFHashSetInsert:
  442|  11.9k|{
  443|  11.9k|    assert(set != NULL);
  ------------------
  |  Branch (443:5): [True: 0, False: 11.9k]
  |  Branch (443:5): [True: 11.9k, False: 0]
  ------------------
  444|  11.9k|    void **pElt = TIFFHashSetFindPtr(set, elt);
  445|  11.9k|    if (pElt)
  ------------------
  |  Branch (445:9): [True: 0, False: 11.9k]
  ------------------
  446|      0|    {
  447|      0|        if (set->fnFreeEltFunc)
  ------------------
  |  Branch (447:13): [True: 0, False: 0]
  ------------------
  448|      0|            set->fnFreeEltFunc(*pElt);
  449|       |
  450|      0|        *pElt = elt;
  451|      0|        return true;
  452|      0|    }
  453|       |
  454|  11.9k|    if (set->nSize >= 2 * set->nAllocatedSize / 3 ||
  ------------------
  |  Branch (454:9): [True: 0, False: 11.9k]
  ------------------
  455|  11.9k|        (set->bRehash && set->nIndiceAllocatedSize > 0 &&
  ------------------
  |  Branch (455:10): [True: 0, False: 11.9k]
  |  Branch (455:26): [True: 0, False: 0]
  ------------------
  456|      0|         set->nSize <= set->nAllocatedSize / 2))
  ------------------
  |  Branch (456:10): [True: 0, False: 0]
  ------------------
  457|      0|    {
  458|      0|        set->nIndiceAllocatedSize++;
  459|      0|        if (!TIFFHashSetRehash(set))
  ------------------
  |  Branch (459:13): [True: 0, False: 0]
  ------------------
  460|      0|        {
  461|      0|            set->nIndiceAllocatedSize--;
  462|      0|            if (set->fnFreeEltFunc)
  ------------------
  |  Branch (462:17): [True: 0, False: 0]
  ------------------
  463|      0|                set->fnFreeEltFunc(elt);
  464|      0|            return false;
  465|      0|        }
  466|      0|    }
  467|       |
  468|  11.9k|    const unsigned long nHashVal =
  469|  11.9k|        set->fnHashFunc(elt) % (unsigned long)set->nAllocatedSize;
  470|       |#ifdef HASH_DEBUG
  471|       |    if (set->tabList[nHashVal])
  472|       |        set->nCollisions++;
  473|       |#endif
  474|       |
  475|  11.9k|    TIFFList *new_elt = TIFFHashSetGetNewListElt(set);
  476|  11.9k|    if (new_elt == NULL)
  ------------------
  |  Branch (476:9): [True: 0, False: 11.9k]
  ------------------
  477|      0|    {
  478|      0|        if (set->fnFreeEltFunc)
  ------------------
  |  Branch (478:13): [True: 0, False: 0]
  ------------------
  479|      0|            set->fnFreeEltFunc(elt);
  480|      0|        return false;
  481|      0|    }
  482|  11.9k|    new_elt->pData = elt;
  483|  11.9k|    new_elt->psNext = set->tabList[nHashVal];
  484|  11.9k|    set->tabList[nHashVal] = new_elt;
  485|  11.9k|    set->nSize++;
  486|       |
  487|       |    return true;
  488|  11.9k|}
TIFFHashSetLookup:
  505|  11.9k|{
  506|  11.9k|    assert(set != NULL);
  ------------------
  |  Branch (506:5): [True: 0, False: 11.9k]
  |  Branch (506:5): [True: 11.9k, False: 0]
  ------------------
  507|  11.9k|    void **pElt = TIFFHashSetFindPtr(set, elt);
  508|  11.9k|    if (pElt)
  ------------------
  |  Branch (508:9): [True: 0, False: 11.9k]
  ------------------
  509|      0|        return *pElt;
  510|       |
  511|  11.9k|    return NULL;
  512|  11.9k|}
tif_hash_set.c:TIFFHashSetClearInternal:
  227|  11.9k|{
  228|  11.9k|    assert(set != NULL);
  ------------------
  |  Branch (228:5): [True: 0, False: 11.9k]
  |  Branch (228:5): [True: 11.9k, False: 0]
  ------------------
  229|   646k|    for (int i = 0; i < set->nAllocatedSize; i++)
  ------------------
  |  Branch (229:21): [True: 634k, False: 11.9k]
  ------------------
  230|   634k|    {
  231|   634k|        TIFFList *cur = set->tabList[i];
  232|   646k|        while (cur)
  ------------------
  |  Branch (232:16): [True: 11.9k, False: 634k]
  ------------------
  233|  11.9k|        {
  234|  11.9k|            if (set->fnFreeEltFunc)
  ------------------
  |  Branch (234:17): [True: 5.98k, False: 5.98k]
  ------------------
  235|  5.98k|                set->fnFreeEltFunc(cur->pData);
  236|  11.9k|            TIFFList *psNext = cur->psNext;
  237|  11.9k|            if (bFinalize)
  ------------------
  |  Branch (237:17): [True: 11.9k, False: 0]
  ------------------
  238|  11.9k|                free(cur);
  239|      0|            else
  240|      0|                TIFFHashSetReturnListElt(set, cur);
  241|  11.9k|            cur = psNext;
  242|  11.9k|        }
  243|   634k|        set->tabList[i] = NULL;
  244|   634k|    }
  245|       |    set->bRehash = false;
  246|  11.9k|}
tif_hash_set.c:TIFFListDestroy:
  261|  11.9k|{
  262|  11.9k|    TIFFList *psCurrent = psList;
  263|       |
  264|  11.9k|    while (psCurrent)
  ------------------
  |  Branch (264:12): [True: 0, False: 11.9k]
  ------------------
  265|      0|    {
  266|      0|        TIFFList *const psNext = psCurrent->psNext;
  267|      0|        free(psCurrent);
  268|      0|        psCurrent = psNext;
  269|      0|    }
  270|  11.9k|}
tif_hash_set.c:TIFFHashSetFindPtr:
  410|  23.9k|{
  411|  23.9k|    const unsigned long nHashVal =
  412|  23.9k|        set->fnHashFunc(elt) % (unsigned long)set->nAllocatedSize;
  413|  23.9k|    TIFFList *cur = set->tabList[nHashVal];
  414|  23.9k|    while (cur)
  ------------------
  |  Branch (414:12): [True: 0, False: 23.9k]
  ------------------
  415|      0|    {
  416|      0|        if (set->fnEqualFunc(cur->pData, elt))
  ------------------
  |  Branch (416:13): [True: 0, False: 0]
  ------------------
  417|      0|            return &cur->pData;
  418|      0|        cur = cur->psNext;
  419|      0|    }
  420|  23.9k|    return NULL;
  421|  23.9k|}
tif_hash_set.c:TIFFHashSetGetNewListElt:
  191|  11.9k|{
  192|  11.9k|    if (set->psRecyclingList)
  ------------------
  |  Branch (192:9): [True: 0, False: 11.9k]
  ------------------
  193|      0|    {
  194|      0|        TIFFList *psRet = set->psRecyclingList;
  195|      0|        psRet->pData = NULL;
  196|      0|        set->nRecyclingListSize--;
  197|      0|        set->psRecyclingList = psRet->psNext;
  198|      0|        return psRet;
  199|      0|    }
  200|       |
  201|  11.9k|    return (TIFFList *)malloc(sizeof(TIFFList));
  202|  11.9k|}

TIFFInitJBIG:
  241|      3|{
  242|      3|    (void)scheme;
  243|      3|    assert(scheme == COMPRESSION_JBIG);
  ------------------
  |  Branch (243:5): [True: 0, False: 3]
  |  Branch (243:5): [True: 3, False: 0]
  ------------------
  244|       |
  245|       |    /*
  246|       |     * These flags are set so the JBIG Codec can control when to reverse
  247|       |     * bits and when not to and to allow the jbig decoder and bit reverser
  248|       |     * to write to memory when necessary.
  249|       |     */
  250|      3|    tif->tif_flags |= TIFF_NOBITREV;
  ------------------
  |  |  127|      3|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  251|      3|    tif->tif_flags &= ~TIFF_MAPPED;
  ------------------
  |  |  130|      3|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  ------------------
  252|       |    /* We may have read from a previous IFD and thus set TIFF_BUFFERMMAP and
  253|       |     * cleared TIFF_MYBUFFER. It is necessary to restore them to their initial
  254|       |     * value to be consistent with the state of a non-memory mapped file.
  255|       |     */
  256|      3|    if (tif->tif_flags & TIFF_BUFFERMMAP)
  ------------------
  |  |  145|      3|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  |  Branch (256:9): [True: 0, False: 3]
  ------------------
  257|      0|    {
  258|      0|        tif->tif_rawdata = NULL;
  259|      0|        tif->tif_rawdatasize = 0;
  260|      0|        tif->tif_flags &= ~TIFF_BUFFERMMAP;
  ------------------
  |  |  145|      0|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  261|      0|        tif->tif_flags |= TIFF_MYBUFFER;
  ------------------
  |  |  128|      0|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  262|      0|    }
  263|       |
  264|       |    /* Setup the function pointers for encode, decode, and cleanup. */
  265|      3|    tif->tif_setupdecode = JBIGSetupDecode;
  266|      3|    tif->tif_decodestrip = JBIGDecode;
  267|       |
  268|      3|    tif->tif_setupencode = JBIGSetupEncode;
  269|      3|    tif->tif_encodestrip = JBIGEncode;
  270|       |
  271|      3|    return 1;
  272|      3|}
tif_jbig.c:JBIGSetupDecode:
   46|      3|{
   47|      3|    if (TIFFNumberOfStrips(tif) != 1)
  ------------------
  |  Branch (47:9): [True: 1, False: 2]
  ------------------
   48|      1|    {
   49|      1|        TIFFErrorExtR(tif, "JBIG",
   50|      1|                      "Multistrip images not supported in decoder");
   51|      1|        return 0;
   52|      1|    }
   53|       |
   54|      2|    return 1;
   55|      3|}

TIFFInitJPEG:
 3013|  2.96k|{
 3014|  2.96k|    JPEGState *sp;
 3015|       |
 3016|  2.96k|    (void)scheme;
 3017|  2.96k|    assert(scheme == COMPRESSION_JPEG);
  ------------------
  |  Branch (3017:5): [True: 0, False: 2.96k]
  |  Branch (3017:5): [True: 2.96k, False: 0]
  ------------------
 3018|       |
 3019|       |    /*
 3020|       |     * Merge codec-specific tag information.
 3021|       |     */
 3022|  2.96k|    if (!_TIFFMergeFields(tif, jpegFields, TIFFArrayCount(jpegFields)))
  ------------------
  |  |  339|  2.96k|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (3022:9): [True: 0, False: 2.96k]
  ------------------
 3023|      0|    {
 3024|      0|        TIFFErrorExtR(tif, "TIFFInitJPEG",
 3025|      0|                      "Merging JPEG codec-specific tags failed");
 3026|      0|        return 0;
 3027|      0|    }
 3028|       |
 3029|       |    /*
 3030|       |     * Allocate state block so tag methods have storage to record values.
 3031|       |     */
 3032|  2.96k|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(JPEGState));
 3033|       |
 3034|  2.96k|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (3034:9): [True: 0, False: 2.96k]
  ------------------
 3035|      0|    {
 3036|      0|        TIFFErrorExtR(tif, "TIFFInitJPEG", "No space for JPEG state block");
 3037|      0|        return 0;
 3038|      0|    }
 3039|  2.96k|    _TIFFmemset(tif->tif_data, 0, sizeof(JPEGState));
 3040|       |
 3041|  2.96k|    sp = JState(tif);
  ------------------
  |  |  208|  2.96k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 3042|       |    /*
 3043|       |     * Override parent get/set field methods.
 3044|       |     */
 3045|  2.96k|    sp->otherSettings.vgetparent = tif->tif_tagmethods.vgetfield;
 3046|  2.96k|    sp->otherSettings.vsetparent = tif->tif_tagmethods.vsetfield;
 3047|  2.96k|    sp->otherSettings.printdir = tif->tif_tagmethods.printdir;
 3048|       |
 3049|  2.96k|    sp->otherSettings.defsparent = tif->tif_defstripsize;
 3050|  2.96k|    sp->otherSettings.deftparent = tif->tif_deftilesize;
 3051|       |
 3052|  2.96k|    TIFFInitJPEGCommon(tif);
 3053|       |
 3054|       |    /*
 3055|       |    ** Create a JPEGTables field if no directory has yet been created.
 3056|       |    ** We do this just to ensure that sufficient space is reserved for
 3057|       |    ** the JPEGTables field.  It will be properly created the right
 3058|       |    ** size later.
 3059|       |    */
 3060|  2.96k|    if (tif->tif_diroff == 0)
  ------------------
  |  Branch (3060:9): [True: 0, False: 2.96k]
  ------------------
 3061|      0|    {
 3062|      0|#define SIZE_OF_JPEGTABLES 2000
 3063|       |        /*
 3064|       |        The following line assumes incorrectly that all JPEG-in-TIFF files will
 3065|       |        have a JPEGTABLES tag generated and causes null-filled JPEGTABLES tags
 3066|       |        to be written when the JPEG data is placed with TIFFWriteRawStrip.  The
 3067|       |        field bit should be set, anyway, later when actual JPEGTABLES header is
 3068|       |        generated, so removing it here hopefully is harmless.
 3069|       |        TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
 3070|       |        */
 3071|      0|        sp->otherSettings.jpegtables_length = SIZE_OF_JPEGTABLES;
  ------------------
  |  | 3062|      0|#define SIZE_OF_JPEGTABLES 2000
  ------------------
 3072|      0|        sp->otherSettings.jpegtables =
 3073|      0|            (void *)_TIFFmallocExt(tif, sp->otherSettings.jpegtables_length);
 3074|      0|        if (sp->otherSettings.jpegtables)
  ------------------
  |  Branch (3074:13): [True: 0, False: 0]
  ------------------
 3075|      0|        {
 3076|      0|            _TIFFmemset(sp->otherSettings.jpegtables, 0, SIZE_OF_JPEGTABLES);
  ------------------
  |  | 3062|      0|#define SIZE_OF_JPEGTABLES 2000
  ------------------
 3077|      0|        }
 3078|      0|        else
 3079|      0|        {
 3080|      0|            TIFFErrorExtR(tif, "TIFFInitJPEG",
 3081|      0|                          "Failed to allocate memory for JPEG tables");
 3082|      0|            return 0;
 3083|      0|        }
 3084|      0|#undef SIZE_OF_JPEGTABLES
 3085|      0|    }
 3086|  2.96k|    return 1;
 3087|  2.96k|}
tif_jpeg.c:TIFFjpeg_create_decompress:
  318|  1.07k|{
  319|       |    /* initialize JPEG error handling */
  320|  1.07k|    sp->cinfo.d.err = jpeg_std_error(&sp->err);
  321|  1.07k|    sp->err.error_exit = TIFFjpeg_error_exit;
  322|  1.07k|    sp->err.output_message = TIFFjpeg_output_message;
  323|       |
  324|       |    /* set client_data to avoid UMR warning from tools like Purify */
  325|  1.07k|    sp->cinfo.d.client_data = NULL;
  326|       |
  327|       |    return CALLVJPEG(sp, jpeg_create_decompress(&sp->cinfo.d));
  ------------------
  |  |  302|  1.07k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  1.07k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  1.07k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (327:12): [True: 0, False: 1.07k]
  ------------------
  328|  1.07k|}
tif_jpeg.c:TIFFjpeg_error_exit:
  244|   111k|{
  245|   111k|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  246|   111k|    char buffer[JMSG_LENGTH_MAX];
  247|       |
  248|   111k|    (*cinfo->err->format_message)(cinfo, buffer);
  249|   111k|    TIFFErrorExtR(sp->tif, "JPEGLib", "%s",
  250|   111k|                  buffer);       /* display the error message */
  251|   111k|    jpeg_abort(cinfo);           /* clean up libjpeg state */
  252|   111k|    LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
  ------------------
  |  |  143|   111k|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
  253|   111k|}
tif_jpeg.c:TIFFjpeg_output_message:
  261|  66.7k|{
  262|  66.7k|    char buffer[JMSG_LENGTH_MAX];
  263|       |
  264|  66.7k|    (*cinfo->err->format_message)(cinfo, buffer);
  265|  66.7k|    TIFFWarningExtR(((JPEGState *)cinfo)->tif, "JPEGLib", "%s", buffer);
  266|  66.7k|}
tif_jpeg.c:TIFFjpeg_data_src:
  744|  1.22k|{
  745|  1.22k|    sp->cinfo.d.src = &sp->src;
  746|  1.22k|    sp->src.init_source = std_init_source;
  747|  1.22k|    sp->src.fill_input_buffer = std_fill_input_buffer;
  748|  1.22k|    sp->src.skip_input_data = std_skip_input_data;
  749|  1.22k|    sp->src.resync_to_restart = jpeg_resync_to_restart;
  750|  1.22k|    sp->src.term_source = std_term_source;
  751|  1.22k|    sp->src.bytes_in_buffer = 0; /* for safety */
  752|       |    sp->src.next_input_byte = NULL;
  753|  1.22k|}
tif_jpeg.c:std_init_source:
  674|   139k|{
  675|   139k|    JPEGState *sp = (JPEGState *)cinfo;
  676|   139k|    TIFF *tif = sp->tif;
  677|       |
  678|   139k|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawdata;
  679|   139k|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
  680|   139k|}
tif_jpeg.c:std_fill_input_buffer:
  683|   174k|{
  684|   174k|    JPEGState *sp = (JPEGState *)cinfo;
  685|   174k|    static const JOCTET dummy_EOI[2] = {0xFF, JPEG_EOI};
  686|       |
  687|       |#ifdef IPPJ_HUFF
  688|       |    /*
  689|       |     * The Intel IPP performance library does not necessarily read the whole
  690|       |     * input buffer in one pass, so it is possible to get here with data
  691|       |     * yet to read.
  692|       |     *
  693|       |     * We just return without doing anything, until the entire buffer has
  694|       |     * been read.
  695|       |     * http://trac.osgeo.org/gdal/wiki/JpegIPP
  696|       |     */
  697|       |    if (sp->src.bytes_in_buffer > 0)
  698|       |    {
  699|       |        return (TRUE);
  700|       |    }
  701|       |#endif
  702|       |
  703|       |    /*
  704|       |     * Normally the whole strip/tile is read and so we don't need to do
  705|       |     * a fill.  In the case of CHUNKY_STRIP_READ_SUPPORT we might not have
  706|       |     * all the data, but the rawdata is refreshed between scanlines and
  707|       |     * we push this into the io machinery in JPEGDecode().
  708|       |     * http://trac.osgeo.org/gdal/ticket/3894
  709|       |     */
  710|       |
  711|   174k|    WARNMS(cinfo, JWRN_JPEG_EOF);
  712|       |    /* insert a fake EOI marker */
  713|   174k|    sp->src.next_input_byte = dummy_EOI;
  714|   174k|    sp->src.bytes_in_buffer = 2;
  715|   174k|    return (TRUE);
  ------------------
  |  |   71|   174k|#define TRUE 1
  ------------------
  716|   174k|}
tif_jpeg.c:std_skip_input_data:
  719|  10.9k|{
  720|  10.9k|    JPEGState *sp = (JPEGState *)cinfo;
  721|       |
  722|  10.9k|    if (num_bytes > 0)
  ------------------
  |  Branch (722:9): [True: 10.9k, False: 0]
  ------------------
  723|  10.9k|    {
  724|  10.9k|        if ((size_t)num_bytes > sp->src.bytes_in_buffer)
  ------------------
  |  Branch (724:13): [True: 6.10k, False: 4.85k]
  ------------------
  725|  6.10k|        {
  726|       |            /* oops, buffer overrun */
  727|  6.10k|            (void)std_fill_input_buffer(cinfo);
  728|  6.10k|        }
  729|  4.85k|        else
  730|  4.85k|        {
  731|  4.85k|            sp->src.next_input_byte += (size_t)num_bytes;
  732|  4.85k|            sp->src.bytes_in_buffer -= (size_t)num_bytes;
  733|  4.85k|        }
  734|  10.9k|    }
  735|  10.9k|}
tif_jpeg.c:std_term_source:
  738|  23.7k|{
  739|       |    /* No work necessary here */
  740|  23.7k|    (void)cinfo;
  741|  23.7k|}
tif_jpeg.c:TIFFjpeg_read_header:
  396|   139k|{
  397|       |    return CALLJPEG(sp, -1, jpeg_read_header(&sp->cinfo.d, require_image));
  ------------------
  |  |  301|   139k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|   139k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (397:12): [True: 96.7k, False: 42.4k]
  ------------------
  398|   139k|}
tif_jpeg.c:TIFFjpeg_destroy:
  525|  1.07k|{
  526|       |    return CALLVJPEG(sp, jpeg_destroy(&sp->cinfo.comm));
  ------------------
  |  |  302|  1.07k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  1.07k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  1.07k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (526:12): [True: 0, False: 1.07k]
  ------------------
  527|  1.07k|}
tif_jpeg.c:TIFFjpeg_has_multiple_scans:
  401|  39.0k|{
  402|       |    return CALLJPEG(sp, 0, jpeg_has_multiple_scans(&sp->cinfo.d));
  ------------------
  |  |  301|  39.0k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  39.0k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (402:12): [True: 0, False: 39.0k]
  ------------------
  403|  39.0k|}
tif_jpeg.c:TIFFInitJPEGCommon:
 2969|  2.96k|{
 2970|  2.96k|    JPEGState *sp;
 2971|       |
 2972|  2.96k|    sp = JState(tif);
  ------------------
  |  |  208|  2.96k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2973|  2.96k|    sp->tif = tif; /* back link */
 2974|       |
 2975|       |    /* Default values for codec-specific fields */
 2976|  2.96k|    sp->otherSettings.jpegtables = NULL;
 2977|  2.96k|    sp->otherSettings.jpegtables_length = 0;
 2978|  2.96k|    sp->otherSettings.jpegquality = 75; /* Default IJG quality */
 2979|  2.96k|    sp->otherSettings.jpegcolormode = JPEGCOLORMODE_RAW;
  ------------------
  |  |  707|  2.96k|#define JPEGCOLORMODE_RAW 0x0000     /* no conversion (default) */
  ------------------
 2980|  2.96k|    sp->otherSettings.jpegtablesmode =
 2981|  2.96k|        JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  710|  2.96k|#define JPEGTABLESMODE_QUANT 0x0001  /* include quantization tbls */
  ------------------
                      JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  711|  2.96k|#define JPEGTABLESMODE_HUFF 0x0002   /* include Huffman tbls */
  ------------------
 2982|  2.96k|    sp->otherSettings.ycbcrsampling_fetched = 0;
 2983|       |
 2984|  2.96k|    tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */
 2985|  2.96k|    tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */
 2986|  2.96k|    tif->tif_tagmethods.printdir = JPEGPrintDir;   /* hook for codec tags */
 2987|       |
 2988|       |    /*
 2989|       |     * Install codec methods.
 2990|       |     */
 2991|  2.96k|    tif->tif_fixuptags = JPEGFixupTags;
 2992|  2.96k|    tif->tif_setupdecode = JPEGSetupDecode;
 2993|  2.96k|    tif->tif_predecode = JPEGPreDecode;
 2994|  2.96k|    tif->tif_decoderow = JPEGDecode;
 2995|  2.96k|    tif->tif_decodestrip = JPEGDecode;
 2996|  2.96k|    tif->tif_decodetile = JPEGDecode;
 2997|  2.96k|    tif->tif_setupencode = JPEGSetupEncode;
 2998|  2.96k|    tif->tif_preencode = JPEGPreEncode;
 2999|  2.96k|    tif->tif_postencode = JPEGPostEncode;
 3000|  2.96k|    tif->tif_encoderow = JPEGEncode;
 3001|  2.96k|    tif->tif_encodestrip = JPEGEncode;
 3002|  2.96k|    tif->tif_encodetile = JPEGEncode;
 3003|  2.96k|    tif->tif_getmaxcompressionratio = JPEGGetMaxCompressionRatio;
 3004|  2.96k|    tif->tif_cleanup = JPEGCleanup;
 3005|       |
 3006|  2.96k|    tif->tif_defstripsize = JPEGDefaultStripSize;
 3007|  2.96k|    tif->tif_deftilesize = JPEGDefaultTileSize;
 3008|  2.96k|    tif->tif_flags |= TIFF_NOBITREV; /* no bit reversal, please */
  ------------------
  |  |  127|  2.96k|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
 3009|  2.96k|    sp->cinfo_initialized = FALSE;
  ------------------
  |  |   72|  2.96k|#define FALSE 0
  ------------------
 3010|  2.96k|}
tif_jpeg.c:JPEGVGetField:
 2796|  16.2k|{
 2797|  16.2k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  16.2k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2798|       |
 2799|  16.2k|    assert(sp != NULL);
  ------------------
  |  Branch (2799:5): [True: 0, False: 16.2k]
  |  Branch (2799:5): [True: 16.2k, False: 0]
  ------------------
 2800|       |
 2801|  16.2k|    switch (tag)
 2802|  16.2k|    {
 2803|      0|        case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  346|      0|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (2803:9): [True: 0, False: 16.2k]
  ------------------
 2804|      0|            *va_arg(ap, uint32_t *) = sp->otherSettings.jpegtables_length;
 2805|      0|            *va_arg(ap, const void **) = sp->otherSettings.jpegtables;
 2806|      0|            break;
 2807|      0|        case TIFFTAG_JPEGQUALITY:
  ------------------
  |  |  704|      0|#define TIFFTAG_JPEGQUALITY 65537    /* Compression quality level */
  ------------------
  |  Branch (2807:9): [True: 0, False: 16.2k]
  ------------------
 2808|      0|            *va_arg(ap, int *) = sp->otherSettings.jpegquality;
 2809|      0|            break;
 2810|      0|        case TIFFTAG_JPEGCOLORMODE:
  ------------------
  |  |  706|      0|#define TIFFTAG_JPEGCOLORMODE 65538  /* Auto RGB<=>YCbCr convert? */
  ------------------
  |  Branch (2810:9): [True: 0, False: 16.2k]
  ------------------
 2811|      0|            *va_arg(ap, int *) = sp->otherSettings.jpegcolormode;
 2812|      0|            break;
 2813|      0|        case TIFFTAG_JPEGTABLESMODE:
  ------------------
  |  |  709|      0|#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */
  ------------------
  |  Branch (2813:9): [True: 0, False: 16.2k]
  ------------------
 2814|      0|            *va_arg(ap, int *) = sp->otherSettings.jpegtablesmode;
 2815|      0|            break;
 2816|  16.2k|        default:
  ------------------
  |  Branch (2816:9): [True: 16.2k, False: 0]
  ------------------
 2817|  16.2k|            return (*sp->otherSettings.vgetparent)(tif, tag, ap);
 2818|  16.2k|    }
 2819|      0|    return (1);
 2820|  16.2k|}
tif_jpeg.c:JPEGVSetField:
 2736|  18.4k|{
 2737|  18.4k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  18.4k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2738|  18.4k|    const TIFFField *fip;
 2739|  18.4k|    uint32_t v32;
 2740|       |
 2741|  18.4k|    assert(sp != NULL);
  ------------------
  |  Branch (2741:5): [True: 0, False: 18.4k]
  |  Branch (2741:5): [True: 18.4k, False: 0]
  ------------------
 2742|       |
 2743|  18.4k|    switch (tag)
 2744|  18.4k|    {
 2745|    766|        case TIFFTAG_JPEGTABLES:
  ------------------
  |  |  346|    766|#define TIFFTAG_JPEGTABLES 347             /* %JPEG table stream */
  ------------------
  |  Branch (2745:9): [True: 766, False: 17.6k]
  ------------------
 2746|    766|            v32 = (uint32_t)va_arg(ap, uint32_t);
 2747|    766|            if (v32 == 0)
  ------------------
  |  Branch (2747:17): [True: 18, False: 748]
  ------------------
 2748|     18|            {
 2749|       |                /* XXX */
 2750|     18|                return (0);
 2751|     18|            }
 2752|    748|            _TIFFsetByteArrayExt(tif, &sp->otherSettings.jpegtables,
 2753|    748|                                 va_arg(ap, void *), v32);
 2754|    748|            sp->otherSettings.jpegtables_length = v32;
 2755|    748|            TIFFSetFieldBit(tif, FIELD_JPEGTABLES);
  ------------------
  |  |  249|    748|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|    748|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|    748|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 2756|    748|            break;
 2757|      0|        case TIFFTAG_JPEGQUALITY:
  ------------------
  |  |  704|      0|#define TIFFTAG_JPEGQUALITY 65537    /* Compression quality level */
  ------------------
  |  Branch (2757:9): [True: 0, False: 18.4k]
  ------------------
 2758|      0|            sp->otherSettings.jpegquality = (int)va_arg(ap, int);
 2759|      0|            return (1); /* pseudo tag */
 2760|    238|        case TIFFTAG_JPEGCOLORMODE:
  ------------------
  |  |  706|    238|#define TIFFTAG_JPEGCOLORMODE 65538  /* Auto RGB<=>YCbCr convert? */
  ------------------
  |  Branch (2760:9): [True: 238, False: 18.1k]
  ------------------
 2761|    238|            sp->otherSettings.jpegcolormode = (int)va_arg(ap, int);
 2762|    238|            JPEGResetUpsampled(tif);
 2763|    238|            return (1); /* pseudo tag */
 2764|  1.44k|        case TIFFTAG_PHOTOMETRIC:
  ------------------
  |  |  220|  1.44k|#define TIFFTAG_PHOTOMETRIC 262            /* photometric interpretation */
  ------------------
  |  Branch (2764:9): [True: 1.44k, False: 16.9k]
  ------------------
 2765|  1.44k|        {
 2766|  1.44k|            int ret_value = (*sp->otherSettings.vsetparent)(tif, tag, ap);
 2767|  1.44k|            JPEGResetUpsampled(tif);
 2768|  1.44k|            return ret_value;
 2769|    766|        }
 2770|      0|        case TIFFTAG_JPEGTABLESMODE:
  ------------------
  |  |  709|      0|#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */
  ------------------
  |  Branch (2770:9): [True: 0, False: 18.4k]
  ------------------
 2771|      0|            sp->otherSettings.jpegtablesmode = (int)va_arg(ap, int);
 2772|      0|            return (1); /* pseudo tag */
 2773|      1|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|      1|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (2773:9): [True: 1, False: 18.4k]
  ------------------
 2774|       |            /* mark the fact that we have a real ycbcrsubsampling! */
 2775|      1|            sp->otherSettings.ycbcrsampling_fetched = 1;
 2776|       |            /* should we be recomputing upsampling info here? */
 2777|      1|            return (*sp->otherSettings.vsetparent)(tif, tag, ap);
 2778|  15.9k|        default:
  ------------------
  |  Branch (2778:9): [True: 15.9k, False: 2.44k]
  ------------------
 2779|  15.9k|            return (*sp->otherSettings.vsetparent)(tif, tag, ap);
 2780|  18.4k|    }
 2781|       |
 2782|    748|    if ((fip = TIFFFieldWithTag(tif, tag)) != NULL)
  ------------------
  |  Branch (2782:9): [True: 748, False: 0]
  ------------------
 2783|    748|    {
 2784|    748|        TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  249|    748|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|    748|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|    748|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 2785|    748|    }
 2786|      0|    else
 2787|      0|    {
 2788|      0|        return (0);
 2789|      0|    }
 2790|       |
 2791|    748|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|    748|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 2792|    748|    return (1);
 2793|    748|}
tif_jpeg.c:JPEGResetUpsampled:
 2697|  1.68k|{
 2698|  1.68k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.68k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2699|  1.68k|    TIFFDirectory *td = &tif->tif_dir;
 2700|       |
 2701|       |    /*
 2702|       |     * Mark whether returned data is up-sampled or not so TIFFStripSize
 2703|       |     * and TIFFTileSize return values that reflect the true amount of
 2704|       |     * data.
 2705|       |     */
 2706|  1.68k|    tif->tif_flags &= ~TIFF_UPSAMPLED;
  ------------------
  |  |  133|  1.68k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  ------------------
 2707|  1.68k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  1.68k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (2707:9): [True: 1.57k, False: 103]
  ------------------
 2708|  1.57k|    {
 2709|  1.57k|        if (td->td_photometric == PHOTOMETRIC_YCBCR &&
  ------------------
  |  |  227|  3.15k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (2709:13): [True: 1.53k, False: 44]
  ------------------
 2710|  1.53k|            sp->otherSettings.jpegcolormode == JPEGCOLORMODE_RGB)
  ------------------
  |  |  708|  1.53k|#define JPEGCOLORMODE_RGB 0x0001     /* do auto conversion */
  ------------------
  |  Branch (2710:13): [True: 238, False: 1.29k]
  ------------------
 2711|    238|        {
 2712|    238|            tif->tif_flags |= TIFF_UPSAMPLED;
  ------------------
  |  |  133|    238|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  ------------------
 2713|    238|        }
 2714|  1.33k|        else
 2715|  1.33k|        {
 2716|       |#ifdef notdef
 2717|       |            if (td->td_ycbcrsubsampling[0] != 1 ||
 2718|       |                td->td_ycbcrsubsampling[1] != 1)
 2719|       |                ; /* XXX what about up-sampling? */
 2720|       |#endif
 2721|  1.33k|        }
 2722|  1.57k|    }
 2723|       |
 2724|       |    /*
 2725|       |     * Must recalculate cached tile size in case sampling state changed.
 2726|       |     * Should we really be doing this now if image size isn't set?
 2727|       |     */
 2728|  1.68k|    if (tif->tif_dir.td_tilesize > 0)
  ------------------
  |  Branch (2728:9): [True: 216, False: 1.46k]
  ------------------
 2729|    216|        tif->tif_dir.td_tilesize =
 2730|    216|            isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)(-1);
  ------------------
  |  |  278|    216|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    216|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 216, False: 0]
  |  |  ------------------
  ------------------
 2731|  1.68k|    if (tif->tif_dir.td_scanlinesize > 0)
  ------------------
  |  Branch (2731:9): [True: 238, False: 1.44k]
  ------------------
 2732|    238|        tif->tif_dir.td_scanlinesize = TIFFScanlineSize(tif);
 2733|  1.68k|}
tif_jpeg.c:JPEGFixupTags:
  849|  2.92k|{
  850|  2.92k|#ifdef CHECK_JPEG_YCBCR_SUBSAMPLING
  851|  2.92k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  2.92k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
  852|  2.92k|    if ((tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|  2.92k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (852:9): [True: 1.28k, False: 1.64k]
  ------------------
  853|  1.28k|        (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|  1.28k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (853:9): [True: 1.28k, False: 1]
  ------------------
  854|  1.28k|        (tif->tif_dir.td_samplesperpixel == 3) &&
  ------------------
  |  Branch (854:9): [True: 1.28k, False: 1]
  ------------------
  855|  1.28k|        !sp->otherSettings.ycbcrsampling_fetched)
  ------------------
  |  Branch (855:9): [True: 1.28k, False: 0]
  ------------------
  856|  1.28k|        JPEGFixupTagsSubsampling(tif);
  857|  2.92k|#endif
  858|       |
  859|  2.92k|    return (1);
  860|  2.92k|}
tif_jpeg.c:JPEGFixupTagsSubsampling:
  865|  1.28k|{
  866|       |    /*
  867|       |     * Some JPEG-in-TIFF produces do not emit the YCBCRSUBSAMPLING values in
  868|       |     * the TIFF tags, but still use non-default (2,2) values within the jpeg
  869|       |     * data stream itself.  In order for TIFF applications to work properly
  870|       |     * - for instance to get the strip buffer size right - it is imperative
  871|       |     * that the subsampling be available before we start reading the image
  872|       |     * data normally.  This function will attempt to analyze the first strip in
  873|       |     * order to get the sampling values from the jpeg data stream.
  874|       |     *
  875|       |     * Note that JPEGPreDeocode() will produce a fairly loud warning when the
  876|       |     * discovered sampling does not match the default sampling (2,2) or whatever
  877|       |     * was actually in the tiff tags.
  878|       |     *
  879|       |     * See the bug in bugzilla for details:
  880|       |     *
  881|       |     * http://bugzilla.remotesensing.org/show_bug.cgi?id=168
  882|       |     *
  883|       |     * Frank Warmerdam, July 2002
  884|       |     * Joris Van Damme, May 2007
  885|       |     */
  886|  1.28k|    static const char module[] = "JPEGFixupTagsSubsampling";
  887|  1.28k|    struct JPEGFixupTagsSubsamplingData m;
  888|  1.28k|    uint64_t fileoffset = TIFFGetStrileOffset(tif, 0);
  889|       |
  890|  1.28k|    if (fileoffset == 0)
  ------------------
  |  Branch (890:9): [True: 1, False: 1.28k]
  ------------------
  891|      1|    {
  892|       |        /* Do not even try to check if the first strip/tile does not
  893|       |           yet exist, as occurs when GDAL has created a new NULL file
  894|       |           for instance. */
  895|      1|        return;
  896|      1|    }
  897|       |
  898|  1.28k|    m.tif = tif;
  899|  1.28k|    m.buffersize = 2048;
  900|  1.28k|    m.buffer = _TIFFmallocExt(tif, m.buffersize);
  901|  1.28k|    if (m.buffer == NULL)
  ------------------
  |  Branch (901:9): [True: 0, False: 1.28k]
  ------------------
  902|      0|    {
  903|      0|        TIFFWarningExtR(tif, module,
  904|      0|                        "Unable to allocate memory for auto-correcting of "
  905|      0|                        "subsampling values; auto-correcting skipped");
  906|      0|        return;
  907|      0|    }
  908|  1.28k|    m.buffercurrentbyte = NULL;
  909|  1.28k|    m.bufferbytesleft = 0;
  910|  1.28k|    m.fileoffset = fileoffset;
  911|  1.28k|    m.filepositioned = 0;
  912|  1.28k|    m.filebytesleft = TIFFGetStrileByteCount(tif, 0);
  913|  1.28k|    if (!JPEGFixupTagsSubsamplingSec(&m))
  ------------------
  |  Branch (913:9): [True: 1.06k, False: 220]
  ------------------
  914|  1.06k|        TIFFWarningExtR(
  915|  1.06k|            tif, module,
  916|  1.06k|            "Unable to auto-correct subsampling values, likely corrupt JPEG "
  917|  1.06k|            "compressed data in first strip/tile; auto-correcting skipped");
  918|  1.28k|    _TIFFfreeExt(tif, m.buffer);
  919|  1.28k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingSec:
  923|  1.28k|{
  924|  1.28k|    static const char module[] = "JPEGFixupTagsSubsamplingSec";
  925|  1.28k|    uint8_t m;
  926|   178k|    while (1)
  ------------------
  |  Branch (926:12): [True: 178k, Folded]
  ------------------
  927|   178k|    {
  928|  2.16M|        while (1)
  ------------------
  |  Branch (928:16): [True: 2.16M, Folded]
  ------------------
  929|  2.16M|        {
  930|  2.16M|            if (!JPEGFixupTagsSubsamplingReadByte(data, &m))
  ------------------
  |  Branch (930:17): [True: 131, False: 2.16M]
  ------------------
  931|    131|                return (0);
  932|  2.16M|            if (m == 255)
  ------------------
  |  Branch (932:17): [True: 178k, False: 1.98M]
  ------------------
  933|   178k|                break;
  934|  2.16M|        }
  935|   702k|        while (1)
  ------------------
  |  Branch (935:16): [True: 702k, Folded]
  ------------------
  936|   702k|        {
  937|   702k|            if (!JPEGFixupTagsSubsamplingReadByte(data, &m))
  ------------------
  |  Branch (937:17): [True: 88, False: 702k]
  ------------------
  938|     88|                return (0);
  939|   702k|            if (m != 255)
  ------------------
  |  Branch (939:17): [True: 178k, False: 523k]
  ------------------
  940|   178k|                break;
  941|   702k|        }
  942|   178k|        switch (m)
  943|   178k|        {
  944|  3.89k|            case JPEG_MARKER_SOI:
  ------------------
  |  |  816|  3.89k|#define JPEG_MARKER_SOI 0xD8
  ------------------
  |  Branch (944:13): [True: 3.89k, False: 174k]
  ------------------
  945|       |                /* this type of marker has no data and should be skipped */
  946|  3.89k|                break;
  947|  2.45k|            case JPEG_MARKER_COM:
  ------------------
  |  |  821|  2.45k|#define JPEG_MARKER_COM 0xFE
  ------------------
  |  Branch (947:13): [True: 2.45k, False: 176k]
  ------------------
  948|  8.28k|            case JPEG_MARKER_APP0:
  ------------------
  |  |  820|  8.28k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (948:13): [True: 5.82k, False: 172k]
  ------------------
  949|  12.8k|            case JPEG_MARKER_APP0 + 1:
  ------------------
  |  |  820|  12.8k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (949:13): [True: 4.61k, False: 173k]
  ------------------
  950|  13.5k|            case JPEG_MARKER_APP0 + 2:
  ------------------
  |  |  820|  13.5k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (950:13): [True: 686, False: 177k]
  ------------------
  951|  13.8k|            case JPEG_MARKER_APP0 + 3:
  ------------------
  |  |  820|  13.8k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (951:13): [True: 277, False: 178k]
  ------------------
  952|  33.2k|            case JPEG_MARKER_APP0 + 4:
  ------------------
  |  |  820|  33.2k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (952:13): [True: 19.4k, False: 159k]
  ------------------
  953|  33.5k|            case JPEG_MARKER_APP0 + 5:
  ------------------
  |  |  820|  33.5k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (953:13): [True: 257, False: 178k]
  ------------------
  954|  35.6k|            case JPEG_MARKER_APP0 + 6:
  ------------------
  |  |  820|  35.6k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (954:13): [True: 2.13k, False: 176k]
  ------------------
  955|  35.8k|            case JPEG_MARKER_APP0 + 7:
  ------------------
  |  |  820|  35.8k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (955:13): [True: 124, False: 178k]
  ------------------
  956|  38.7k|            case JPEG_MARKER_APP0 + 8:
  ------------------
  |  |  820|  38.7k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (956:13): [True: 2.97k, False: 175k]
  ------------------
  957|  39.1k|            case JPEG_MARKER_APP0 + 9:
  ------------------
  |  |  820|  39.1k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (957:13): [True: 325, False: 178k]
  ------------------
  958|  42.3k|            case JPEG_MARKER_APP0 + 10:
  ------------------
  |  |  820|  42.3k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (958:13): [True: 3.24k, False: 175k]
  ------------------
  959|  48.1k|            case JPEG_MARKER_APP0 + 11:
  ------------------
  |  |  820|  48.1k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (959:13): [True: 5.82k, False: 172k]
  ------------------
  960|  49.1k|            case JPEG_MARKER_APP0 + 12:
  ------------------
  |  |  820|  49.1k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (960:13): [True: 990, False: 177k]
  ------------------
  961|  68.6k|            case JPEG_MARKER_APP0 + 13:
  ------------------
  |  |  820|  68.6k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (961:13): [True: 19.4k, False: 159k]
  ------------------
  962|  74.3k|            case JPEG_MARKER_APP0 + 14:
  ------------------
  |  |  820|  74.3k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (962:13): [True: 5.74k, False: 172k]
  ------------------
  963|  79.5k|            case JPEG_MARKER_APP0 + 15:
  ------------------
  |  |  820|  79.5k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (963:13): [True: 5.17k, False: 173k]
  ------------------
  964|  80.0k|            case JPEG_MARKER_DQT:
  ------------------
  |  |  818|  80.0k|#define JPEG_MARKER_DQT 0xDB
  ------------------
  |  Branch (964:13): [True: 532, False: 177k]
  ------------------
  965|  80.4k|            case JPEG_MARKER_SOS:
  ------------------
  |  |  817|  80.4k|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (965:13): [True: 430, False: 178k]
  ------------------
  966|   173k|            case JPEG_MARKER_DHT:
  ------------------
  |  |  815|   173k|#define JPEG_MARKER_DHT 0xC4
  ------------------
  |  Branch (966:13): [True: 93.0k, False: 85.4k]
  ------------------
  967|   173k|            case JPEG_MARKER_DRI:
  ------------------
  |  |  819|   173k|#define JPEG_MARKER_DRI 0xDD
  ------------------
  |  Branch (967:13): [True: 287, False: 178k]
  ------------------
  968|       |                /* this type of marker has data, but it has no use to us and
  969|       |                 * should be skipped */
  970|   173k|                {
  971|   173k|                    uint16_t n;
  972|   173k|                    if (!JPEGFixupTagsSubsamplingReadWord(data, &n))
  ------------------
  |  Branch (972:25): [True: 257, False: 173k]
  ------------------
  973|    257|                        return (0);
  974|   173k|                    if (n < 2)
  ------------------
  |  Branch (974:25): [True: 11, False: 173k]
  ------------------
  975|     11|                        return (0);
  976|   173k|                    n = (uint16_t)(n - 2);
  977|   173k|                    if (n > 0)
  ------------------
  |  Branch (977:25): [True: 154k, False: 19.1k]
  ------------------
  978|   154k|                        JPEGFixupTagsSubsamplingSkip(data, n);
  979|   173k|                }
  980|      0|                break;
  981|     51|            case JPEG_MARKER_SOF0:  /* Baseline sequential Huffman */
  ------------------
  |  |  810|     51|#define JPEG_MARKER_SOF0 0xC0
  ------------------
  |  Branch (981:13): [True: 51, False: 178k]
  ------------------
  982|     63|            case JPEG_MARKER_SOF1:  /* Extended sequential Huffman */
  ------------------
  |  |  811|     63|#define JPEG_MARKER_SOF1 0xC1
  ------------------
  |  Branch (982:13): [True: 12, False: 178k]
  ------------------
  983|    122|            case JPEG_MARKER_SOF2:  /* Progressive Huffman: normally not allowed
  ------------------
  |  |  812|    122|#define JPEG_MARKER_SOF2 0xC2
  ------------------
  |  Branch (983:13): [True: 59, False: 178k]
  ------------------
  984|       |                                       by  TechNote, but that doesn't hurt
  985|       |                                       supporting it */
  986|    585|            case JPEG_MARKER_SOF9:  /* Extended sequential arithmetic */
  ------------------
  |  |  813|    585|#define JPEG_MARKER_SOF9 0xC9
  ------------------
  |  Branch (986:13): [True: 463, False: 178k]
  ------------------
  987|    743|            case JPEG_MARKER_SOF10: /* Progressive arithmetic: normally not
  ------------------
  |  |  814|    743|#define JPEG_MARKER_SOF10 0xCA
  ------------------
  |  Branch (987:13): [True: 158, False: 178k]
  ------------------
  988|       |                                       allowed by TechNote, but that doesn't
  989|       |                                       hurt supporting it */
  990|       |                /* this marker contains the subsampling factors we're scanning
  991|       |                 * for */
  992|    743|                {
  993|    743|                    uint16_t n;
  994|    743|                    uint16_t o;
  995|    743|                    uint8_t p;
  996|    743|                    uint8_t ph, pv;
  997|    743|                    if (!JPEGFixupTagsSubsamplingReadWord(data, &n))
  ------------------
  |  Branch (997:25): [True: 130, False: 613]
  ------------------
  998|    130|                        return (0);
  999|    613|                    if (n != 8 + data->tif->tif_dir.td_samplesperpixel * 3)
  ------------------
  |  Branch (999:25): [True: 1, False: 612]
  ------------------
 1000|      1|                        return (0);
 1001|    612|                    JPEGFixupTagsSubsamplingSkip(data, 7);
 1002|    612|                    if (!JPEGFixupTagsSubsamplingReadByte(data, &p))
  ------------------
  |  Branch (1002:25): [True: 186, False: 426]
  ------------------
 1003|    186|                        return (0);
 1004|    426|                    ph = (p >> 4);
 1005|    426|                    pv = (p & 15);
 1006|    426|                    JPEGFixupTagsSubsamplingSkip(data, 1);
 1007|    931|                    for (o = 1; o < data->tif->tif_dir.td_samplesperpixel; o++)
  ------------------
  |  Branch (1007:33): [True: 712, False: 219]
  ------------------
 1008|    712|                    {
 1009|    712|                        JPEGFixupTagsSubsamplingSkip(data, 1);
 1010|    712|                        if (!JPEGFixupTagsSubsamplingReadByte(data, &p))
  ------------------
  |  Branch (1010:29): [True: 206, False: 506]
  ------------------
 1011|    206|                            return (0);
 1012|    506|                        if (p != 0x11)
  ------------------
  |  Branch (1012:29): [True: 1, False: 505]
  ------------------
 1013|      1|                        {
 1014|      1|                            TIFFWarningExtR(data->tif, module,
 1015|      1|                                            "Subsampling values inside JPEG "
 1016|      1|                                            "compressed data "
 1017|      1|                                            "have no TIFF equivalent, "
 1018|      1|                                            "auto-correction of TIFF "
 1019|      1|                                            "subsampling values failed");
 1020|      1|                            return (1);
 1021|      1|                        }
 1022|    505|                        JPEGFixupTagsSubsamplingSkip(data, 1);
 1023|    505|                    }
 1024|    219|                    if (((ph != 1) && (ph != 2) && (ph != 4)) ||
  ------------------
  |  Branch (1024:26): [True: 192, False: 27]
  |  Branch (1024:39): [True: 31, False: 161]
  |  Branch (1024:52): [True: 1, False: 30]
  ------------------
 1025|    218|                        ((pv != 1) && (pv != 2) && (pv != 4)))
  ------------------
  |  Branch (1025:26): [True: 126, False: 92]
  |  Branch (1025:39): [True: 24, False: 102]
  |  Branch (1025:52): [True: 3, False: 21]
  ------------------
 1026|      4|                    {
 1027|      4|                        TIFFWarningExtR(data->tif, module,
 1028|      4|                                        "Subsampling values inside JPEG "
 1029|      4|                                        "compressed data have no TIFF "
 1030|      4|                                        "equivalent, auto-correction of TIFF "
 1031|      4|                                        "subsampling values failed");
 1032|      4|                        return (1);
 1033|      4|                    }
 1034|    215|                    if ((ph != data->tif->tif_dir.td_ycbcrsubsampling[0]) ||
  ------------------
  |  Branch (1034:25): [True: 57, False: 158]
  ------------------
 1035|    158|                        (pv != data->tif->tif_dir.td_ycbcrsubsampling[1]))
  ------------------
  |  Branch (1035:25): [True: 89, False: 69]
  ------------------
 1036|    146|                    {
 1037|    146|                        TIFFWarningExtR(
 1038|    146|                            data->tif, module,
 1039|    146|                            "Auto-corrected former TIFF subsampling values "
 1040|    146|                            "[%" PRIu16 ",%" PRIu16
 1041|    146|                            "] to match subsampling values inside JPEG "
 1042|    146|                            "compressed data [%" PRIu8 ",%" PRIu8 "]",
 1043|    146|                            data->tif->tif_dir.td_ycbcrsubsampling[0],
 1044|    146|                            data->tif->tif_dir.td_ycbcrsubsampling[1], ph, pv);
 1045|    146|                        data->tif->tif_dir.td_ycbcrsubsampling[0] = ph;
 1046|    146|                        data->tif->tif_dir.td_ycbcrsubsampling[1] = pv;
 1047|    146|                    }
 1048|    215|                }
 1049|      0|                return (1);
 1050|     53|            default:
  ------------------
  |  Branch (1050:13): [True: 53, False: 178k]
  ------------------
 1051|     53|                return (0);
 1052|   178k|        }
 1053|   178k|    }
 1054|  1.28k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingReadByte:
 1059|  3.21M|{
 1060|  3.21M|    if (data->bufferbytesleft == 0)
  ------------------
  |  Branch (1060:9): [True: 4.05k, False: 3.21M]
  ------------------
 1061|  4.05k|    {
 1062|  4.05k|        uint32_t m;
 1063|  4.05k|        if (data->filebytesleft == 0)
  ------------------
  |  Branch (1063:13): [True: 49, False: 4.01k]
  ------------------
 1064|     49|            return (0);
 1065|  4.01k|        if (!data->filepositioned)
  ------------------
  |  Branch (1065:13): [True: 2.03k, False: 1.97k]
  ------------------
 1066|  2.03k|        {
 1067|  2.03k|            if (TIFFSeekFile(data->tif, data->fileoffset, SEEK_SET) ==
  ------------------
  |  |  287|  2.03k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
  |  Branch (1067:17): [True: 114, False: 1.91k]
  ------------------
 1068|  2.03k|                (toff_t)-1)
 1069|    114|            {
 1070|    114|                return 0;
 1071|    114|            }
 1072|  1.91k|            data->filepositioned = 1;
 1073|  1.91k|        }
 1074|  3.89k|        m = data->buffersize;
 1075|  3.89k|        if ((uint64_t)m > data->filebytesleft)
  ------------------
  |  Branch (1075:13): [True: 318, False: 3.57k]
  ------------------
 1076|    318|            m = (uint32_t)data->filebytesleft;
 1077|  3.89k|        assert(m < 0x80000000UL);
  ------------------
  |  Branch (1077:9): [True: 0, False: 3.89k]
  |  Branch (1077:9): [True: 3.89k, False: 0]
  ------------------
 1078|  3.89k|        if (TIFFReadFile(data->tif, data->buffer, (tmsize_t)m) != (tmsize_t)m)
  ------------------
  |  |  283|  3.89k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
  |  Branch (1078:13): [True: 835, False: 3.06k]
  ------------------
 1079|    835|            return (0);
 1080|  3.06k|        data->buffercurrentbyte = (uint8_t *)data->buffer;
 1081|  3.06k|        data->bufferbytesleft = m;
 1082|  3.06k|        data->fileoffset += m;
 1083|  3.06k|        data->filebytesleft -= m;
 1084|  3.06k|    }
 1085|  3.21M|    *result = *data->buffercurrentbyte;
 1086|  3.21M|    data->buffercurrentbyte++;
 1087|  3.21M|    data->bufferbytesleft--;
 1088|  3.21M|    return (1);
 1089|  3.21M|}
tif_jpeg.c:JPEGFixupTagsSubsamplingReadWord:
 1094|   174k|{
 1095|   174k|    uint8_t ma;
 1096|   174k|    uint8_t mb;
 1097|   174k|    if (!JPEGFixupTagsSubsamplingReadByte(data, &ma))
  ------------------
  |  Branch (1097:9): [True: 153, False: 174k]
  ------------------
 1098|    153|        return (0);
 1099|   174k|    if (!JPEGFixupTagsSubsamplingReadByte(data, &mb))
  ------------------
  |  Branch (1099:9): [True: 234, False: 174k]
  ------------------
 1100|    234|        return (0);
 1101|   174k|    *result = (uint16_t)((ma << 8) | mb);
 1102|   174k|    return (1);
 1103|   174k|}
tif_jpeg.c:JPEGFixupTagsSubsamplingSkip:
 1108|   156k|{
 1109|   156k|    if ((uint32_t)skiplength <= data->bufferbytesleft)
  ------------------
  |  Branch (1109:9): [True: 155k, False: 860]
  ------------------
 1110|   155k|    {
 1111|   155k|        data->buffercurrentbyte += skiplength;
 1112|   155k|        data->bufferbytesleft -= skiplength;
 1113|   155k|    }
 1114|    860|    else
 1115|    860|    {
 1116|    860|        uint16_t m;
 1117|    860|        m = (uint16_t)(skiplength - data->bufferbytesleft);
 1118|    860|        if (m <= data->filebytesleft)
  ------------------
  |  Branch (1118:13): [True: 843, False: 17]
  ------------------
 1119|    843|        {
 1120|    843|            data->bufferbytesleft = 0;
 1121|    843|            data->fileoffset += m;
 1122|    843|            data->filebytesleft -= m;
 1123|    843|            data->filepositioned = 0;
 1124|    843|        }
 1125|     17|        else
 1126|     17|        {
 1127|     17|            data->bufferbytesleft = 0;
 1128|     17|            data->filebytesleft = 0;
 1129|     17|        }
 1130|    860|    }
 1131|   156k|}
tif_jpeg.c:JPEGSetupDecode:
 1136|  1.86k|{
 1137|  1.86k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.86k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1138|  1.86k|    TIFFDirectory *td = &tif->tif_dir;
 1139|       |
 1140|  1.86k|#if defined(JPEG_DUAL_MODE_8_12) && !defined(FROM_TIF_JPEG_12)
 1141|  1.86k|    if (tif->tif_dir.td_bitspersample == 12)
  ------------------
  |  Branch (1141:9): [True: 787, False: 1.08k]
  ------------------
 1142|    787|    {
 1143|       |        /* We pass a pointer to a copy of otherSettings, since */
 1144|       |        /* TIFFReInitJPEG_12() will clear sp */
 1145|    787|        JPEGOtherSettings savedOtherSettings = sp->otherSettings;
 1146|    787|        return TIFFReInitJPEG_12(tif, &savedOtherSettings, COMPRESSION_JPEG, 0);
  ------------------
  |  |  190|    787|#define COMPRESSION_JPEG 7            /* %JPEG DCT compression */
  ------------------
 1147|    787|    }
 1148|  1.08k|#endif
 1149|       |
 1150|  1.08k|    JPEGInitializeLibJPEG(tif, TRUE);
  ------------------
  |  |   71|  1.08k|#define TRUE 1
  ------------------
 1151|       |
 1152|  1.08k|    assert(sp != NULL);
  ------------------
  |  Branch (1152:5): [True: 0, False: 1.08k]
  |  Branch (1152:5): [True: 1.08k, False: 0]
  ------------------
 1153|  1.08k|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1153:5): [True: 0, False: 1.08k]
  |  Branch (1153:5): [True: 1.08k, False: 0]
  ------------------
 1154|       |
 1155|       |    /* Read JPEGTables if it is present */
 1156|  1.08k|    if (TIFFFieldSet(tif, FIELD_JPEGTABLES))
  ------------------
  |  |  248|  1.08k|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|  1.08k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|  1.08k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 155, False: 925]
  |  |  ------------------
  ------------------
 1157|    155|    {
 1158|    155|        TIFFjpeg_tables_src(sp);
 1159|    155|        if (TIFFjpeg_read_header(sp, FALSE) != JPEG_HEADER_TABLES_ONLY)
  ------------------
  |  |   72|    155|#define FALSE 0
  ------------------
  |  Branch (1159:13): [True: 6, False: 149]
  ------------------
 1160|      6|        {
 1161|      6|            TIFFErrorExtR(tif, "JPEGSetupDecode", "Bogus JPEGTables field");
 1162|      6|            return (0);
 1163|      6|        }
 1164|    155|    }
 1165|       |
 1166|       |    /* Grab parameters that are same for all strips/tiles */
 1167|  1.07k|    sp->photometric = td->td_photometric;
 1168|  1.07k|    switch (sp->photometric)
 1169|  1.07k|    {
 1170|    231|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|    231|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1170:9): [True: 231, False: 843]
  ------------------
 1171|    231|            sp->h_sampling = td->td_ycbcrsubsampling[0];
 1172|    231|            sp->v_sampling = td->td_ycbcrsubsampling[1];
 1173|    231|            break;
 1174|    843|        default:
  ------------------
  |  Branch (1174:9): [True: 843, False: 231]
  ------------------
 1175|       |            /* TIFF 6.0 forbids subsampling of all other color spaces */
 1176|    843|            sp->h_sampling = 1;
 1177|    843|            sp->v_sampling = 1;
 1178|    843|            break;
 1179|  1.07k|    }
 1180|       |
 1181|       |    /* Set up for reading normal data */
 1182|  1.07k|    TIFFjpeg_data_src(sp);
 1183|  1.07k|    tif->tif_postdecode = _TIFFNoPostDecode; /* override byte swapping */
 1184|  1.07k|    return (1);
 1185|  1.07k|}
tif_jpeg.c:JPEGInitializeLibJPEG:
 2883|  1.08k|{
 2884|  1.08k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.08k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2885|       |
 2886|  1.08k|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2886:9): [True: 2, False: 1.07k]
  ------------------
 2887|      2|    {
 2888|      2|        if (!decompress && sp->cinfo.comm.is_decompressor)
  ------------------
  |  Branch (2888:13): [True: 0, False: 2]
  |  Branch (2888:28): [True: 0, False: 0]
  ------------------
 2889|      0|            TIFFjpeg_destroy(sp);
 2890|      2|        else if (decompress && !sp->cinfo.comm.is_decompressor)
  ------------------
  |  Branch (2890:18): [True: 2, False: 0]
  |  Branch (2890:32): [True: 0, False: 2]
  ------------------
 2891|      0|            TIFFjpeg_destroy(sp);
 2892|      2|        else
 2893|      2|            return 1;
 2894|       |
 2895|      0|        sp->cinfo_initialized = 0;
 2896|      0|    }
 2897|       |
 2898|       |    /*
 2899|       |     * Initialize libjpeg.
 2900|       |     */
 2901|  1.07k|    if (decompress)
  ------------------
  |  Branch (2901:9): [True: 1.07k, False: 0]
  ------------------
 2902|  1.07k|    {
 2903|  1.07k|        if (!TIFFjpeg_create_decompress(sp))
  ------------------
  |  Branch (2903:13): [True: 0, False: 1.07k]
  ------------------
 2904|      0|            return (0);
 2905|  1.07k|    }
 2906|      0|    else
 2907|      0|    {
 2908|      0|        if (!TIFFjpeg_create_compress(sp))
  ------------------
  |  Branch (2908:13): [True: 0, False: 0]
  ------------------
 2909|      0|            return (0);
 2910|      0|#ifndef TIFF_JPEG_MAX_MEMORY_TO_USE
 2911|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
 2912|      0|#endif
 2913|       |        /* libjpeg turbo 1.5.2 honours max_memory_to_use, but has no backing */
 2914|       |        /* store implementation, so better not set max_memory_to_use ourselves.
 2915|       |         */
 2916|       |        /* See https://github.com/libjpeg-turbo/libjpeg-turbo/issues/162 */
 2917|      0|        if (sp->cinfo.c.mem->max_memory_to_use > 0)
  ------------------
  |  Branch (2917:13): [True: 0, False: 0]
  ------------------
 2918|      0|        {
 2919|       |            /* This is to address bug related in ticket GDAL #1795. */
 2920|      0|            if (getenv("JPEGMEM") == NULL)
  ------------------
  |  Branch (2920:17): [True: 0, False: 0]
  ------------------
 2921|      0|            {
 2922|       |                /* Increase the max memory usable. This helps when creating
 2923|       |                 * files */
 2924|       |                /* with "big" tile, without using libjpeg temporary files. */
 2925|       |                /* For example a 512x512 tile with 3 bands */
 2926|       |                /* requires 1.5 MB which is above libjpeg 1MB default */
 2927|      0|                if (sp->cinfo.c.mem->max_memory_to_use <
  ------------------
  |  Branch (2927:21): [True: 0, False: 0]
  ------------------
 2928|      0|                    TIFF_JPEG_MAX_MEMORY_TO_USE)
  ------------------
  |  | 2911|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
  ------------------
 2929|      0|                    sp->cinfo.c.mem->max_memory_to_use =
 2930|      0|                        TIFF_JPEG_MAX_MEMORY_TO_USE;
  ------------------
  |  | 2911|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
  ------------------
 2931|      0|            }
 2932|      0|        }
 2933|      0|    }
 2934|       |
 2935|  1.07k|    sp->cinfo_initialized = TRUE;
  ------------------
  |  |   71|  1.07k|#define TRUE 1
  ------------------
 2936|       |
 2937|  1.07k|    return 1;
 2938|  1.07k|}
tif_jpeg.c:TIFFjpeg_tables_src:
  769|    155|{
  770|    155|    TIFFjpeg_data_src(sp);
  771|    155|    sp->src.init_source = tables_init_source;
  772|    155|}
tif_jpeg.c:tables_init_source:
  761|    154|{
  762|    154|    JPEGState *sp = (JPEGState *)cinfo;
  763|       |
  764|    154|    sp->src.next_input_byte = (const JOCTET *)sp->otherSettings.jpegtables;
  765|    154|    sp->src.bytes_in_buffer = (size_t)sp->otherSettings.jpegtables_length;
  766|    154|}
tif_jpeg.c:JPEGPreDecode:
 1268|   139k|{
 1269|   139k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|   139k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1270|   139k|    TIFFDirectory *td = &tif->tif_dir;
 1271|   139k|    static const char module[] = "JPEGPreDecode";
 1272|   139k|    int downsampled_output;
 1273|   139k|    int ci;
 1274|       |
 1275|   139k|    assert(sp != NULL);
  ------------------
  |  Branch (1275:5): [True: 0, False: 139k]
  |  Branch (1275:5): [True: 139k, False: 0]
  ------------------
 1276|       |
 1277|   139k|    if (sp->cinfo.comm.is_decompressor == 0)
  ------------------
  |  Branch (1277:9): [True: 0, False: 139k]
  ------------------
 1278|      0|    {
 1279|      0|        tif->tif_setupdecode(tif);
 1280|      0|    }
 1281|       |
 1282|   139k|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1282:5): [True: 0, False: 139k]
  |  Branch (1282:5): [True: 139k, False: 0]
  ------------------
 1283|       |    /*
 1284|       |     * Reset decoder state from any previous strip/tile,
 1285|       |     * in case application didn't read the whole strip.
 1286|       |     */
 1287|   139k|    if (!TIFFjpeg_abort(sp))
  ------------------
  |  Branch (1287:9): [True: 0, False: 139k]
  ------------------
 1288|      0|        return (0);
 1289|       |    /*
 1290|       |     * Read the header for this strip/tile.
 1291|       |     */
 1292|       |
 1293|   139k|    if (TIFFjpeg_read_header(sp, TRUE) != JPEG_HEADER_OK)
  ------------------
  |  |   71|   139k|#define TRUE 1
  ------------------
  |  Branch (1293:9): [True: 96.7k, False: 42.3k]
  ------------------
 1294|  96.7k|        return (0);
 1295|       |
 1296|  42.3k|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1297|  42.3k|    tif->tif_rawcc = (tmsize_t)sp->src.bytes_in_buffer;
 1298|       |
 1299|  42.3k|    if (!JPEGComputeStrileWidthHeightBytesPerLine(tif, s))
  ------------------
  |  Branch (1299:9): [True: 0, False: 42.3k]
  ------------------
 1300|      0|        return 0;
 1301|       |
 1302|  42.3k|    if (sp->cinfo.d.image_width < sp->strile_width ||
  ------------------
  |  Branch (1302:9): [True: 39.8k, False: 2.53k]
  ------------------
 1303|  2.53k|        sp->cinfo.d.image_height < sp->strile_height)
  ------------------
  |  Branch (1303:9): [True: 1.61k, False: 919]
  ------------------
 1304|  41.4k|    {
 1305|  41.4k|        TIFFWarningExtR(tif, module,
 1306|  41.4k|                        "Improper JPEG strip/tile size, "
 1307|  41.4k|                        "expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1308|  41.4k|                        sp->strile_width, sp->strile_height,
 1309|  41.4k|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1310|  41.4k|    }
 1311|  42.3k|    if (sp->cinfo.d.image_width == sp->strile_width &&
  ------------------
  |  Branch (1311:9): [True: 1.09k, False: 41.2k]
  ------------------
 1312|  1.09k|        sp->cinfo.d.image_height > sp->strile_height &&
  ------------------
  |  Branch (1312:9): [True: 650, False: 445]
  ------------------
 1313|    650|        tif->tif_dir.td_row + sp->strile_height == td->td_imagelength &&
  ------------------
  |  Branch (1313:9): [True: 16, False: 634]
  ------------------
 1314|     16|        !isTiled(tif))
  ------------------
  |  |  278|     16|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     16|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (1314:9): [True: 15, False: 1]
  ------------------
 1315|     15|    {
 1316|       |        /* Some files have a last strip, that should be truncated, */
 1317|       |        /* but their JPEG codestream has still the maximum strip */
 1318|       |        /* height. Warn about this as this is non compliant, but */
 1319|       |        /* we can safely recover from that. */
 1320|     15|        TIFFWarningExtR(tif, module,
 1321|     15|                        "JPEG strip size exceeds expected dimensions,"
 1322|     15|                        " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1323|     15|                        sp->strile_width, sp->strile_height,
 1324|     15|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1325|     15|    }
 1326|  42.3k|    else if (sp->cinfo.d.image_width > sp->strile_width ||
  ------------------
  |  Branch (1326:14): [True: 1.43k, False: 40.8k]
  ------------------
 1327|  40.8k|             sp->cinfo.d.image_height > sp->strile_height)
  ------------------
  |  Branch (1327:14): [True: 675, False: 40.2k]
  ------------------
 1328|  2.11k|    {
 1329|       |        /*
 1330|       |         * This case could be dangerous, if the strip or tile size has
 1331|       |         * been reported as less than the amount of data jpeg will
 1332|       |         * return, some potential security issues arise. Catch this
 1333|       |         * case and error out.
 1334|       |         */
 1335|  2.11k|        TIFFErrorExtR(tif, module,
 1336|  2.11k|                      "JPEG strip/tile size exceeds expected dimensions,"
 1337|  2.11k|                      " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1338|  2.11k|                      sp->strile_width, sp->strile_height,
 1339|  2.11k|                      sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1340|  2.11k|        return (0);
 1341|  2.11k|    }
 1342|  40.2k|    if (sp->cinfo.d.num_components !=
  ------------------
  |  Branch (1342:9): [True: 951, False: 39.2k]
  ------------------
 1343|  40.2k|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|  40.2k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1343:10): [True: 38.3k, False: 1.89k]
  ------------------
 1344|  40.2k|                                                    : 1))
 1345|    951|    {
 1346|    951|        TIFFErrorExtR(tif, module, "Improper JPEG component count");
 1347|    951|        return (0);
 1348|    951|    }
 1349|       |#ifdef JPEG_LIB_MK1
 1350|       |    if (12 != td->td_bitspersample && 8 != td->td_bitspersample)
 1351|       |    {
 1352|       |        TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1353|       |        return (0);
 1354|       |    }
 1355|       |    sp->cinfo.d.data_precision = td->td_bitspersample;
 1356|       |    sp->cinfo.d.bits_in_jsample = td->td_bitspersample;
 1357|       |#else
 1358|  39.2k|    if (td->td_bitspersample != BITS_IN_JSAMPLE ||
  ------------------
  |  |  108|  78.5k|#define BITS_IN_JSAMPLE 8
  ------------------
  |  Branch (1358:9): [True: 0, False: 39.2k]
  ------------------
 1359|  39.2k|        sp->cinfo.d.data_precision != td->td_bitspersample)
  ------------------
  |  Branch (1359:9): [True: 234, False: 39.0k]
  ------------------
 1360|    234|    {
 1361|    234|        TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1362|    234|        return (0);
 1363|    234|    }
 1364|  39.0k|#endif
 1365|       |
 1366|  39.0k|    if (sp->cinfo.d.progressive_mode &&
  ------------------
  |  Branch (1366:9): [True: 20.1k, False: 18.9k]
  ------------------
 1367|  20.1k|        !sp->otherSettings.has_warned_about_progressive_mode)
  ------------------
  |  Branch (1367:9): [True: 447, False: 19.6k]
  ------------------
 1368|    447|    {
 1369|    447|        TIFFWarningExtR(tif, module,
 1370|    447|                        "The JPEG strip/tile is encoded with progressive mode, "
 1371|    447|                        "which is normally not legal for JPEG-in-TIFF.\n"
 1372|    447|                        "libtiff should be able to decode it, but it might "
 1373|    447|                        "cause compatibility issues with other readers");
 1374|    447|        sp->otherSettings.has_warned_about_progressive_mode = TRUE;
  ------------------
  |  |   71|    447|#define TRUE 1
  ------------------
 1375|    447|    }
 1376|       |
 1377|       |    /* In some cases, libjpeg needs to allocate a lot of memory */
 1378|       |    /* http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf
 1379|       |     */
 1380|  39.0k|    if (TIFFjpeg_has_multiple_scans(sp))
  ------------------
  |  Branch (1380:9): [True: 22.2k, False: 16.8k]
  ------------------
 1381|  22.2k|    {
 1382|       |        /* In this case libjpeg will need to allocate memory or backing */
 1383|       |        /* store for all coefficients */
 1384|       |        /* See call to jinit_d_coef_controller() from master_selection() */
 1385|       |        /* in libjpeg */
 1386|       |
 1387|       |        /* 1 MB for regular libjpeg usage */
 1388|  22.2k|        toff_t nRequiredMemory = 1024 * 1024;
 1389|       |
 1390|  69.9k|        for (ci = 0; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1390:22): [True: 47.6k, False: 22.2k]
  ------------------
 1391|  47.6k|        {
 1392|  47.6k|            const jpeg_component_info *compptr = &(sp->cinfo.d.comp_info[ci]);
 1393|  47.6k|            if (compptr->h_samp_factor > 0 && compptr->v_samp_factor > 0)
  ------------------
  |  Branch (1393:17): [True: 47.6k, False: 0]
  |  Branch (1393:47): [True: 47.6k, False: 0]
  ------------------
 1394|  47.6k|            {
 1395|  47.6k|                nRequiredMemory +=
 1396|  47.6k|                    (toff_t)((JDIMENSION)(((int)compptr->width_in_blocks +
 1397|  47.6k|                                           compptr->h_samp_factor - 1) /
 1398|  47.6k|                                          compptr->h_samp_factor)) *
 1399|  47.6k|                    (JDIMENSION)(((int)compptr->height_in_blocks +
 1400|  47.6k|                                  compptr->v_samp_factor - 1) /
 1401|  47.6k|                                 compptr->v_samp_factor) *
 1402|  47.6k|                    sizeof(JBLOCK);
 1403|  47.6k|            }
 1404|  47.6k|        }
 1405|       |
 1406|  22.2k|        if (sp->cinfo.d.mem->max_memory_to_use > 0 &&
  ------------------
  |  Branch (1406:13): [True: 0, False: 22.2k]
  ------------------
 1407|      0|            nRequiredMemory > (toff_t)(sp->cinfo.d.mem->max_memory_to_use) &&
  ------------------
  |  Branch (1407:13): [True: 0, False: 0]
  ------------------
 1408|      0|            getenv("LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC") == NULL)
  ------------------
  |  Branch (1408:13): [True: 0, False: 0]
  ------------------
 1409|      0|        {
 1410|      0|            TIFFErrorExtR(
 1411|      0|                tif, module,
 1412|      0|                "Reading this image would require libjpeg to allocate "
 1413|      0|                "at least %" PRIu64 " bytes. "
 1414|      0|                "This is disabled since above the %ld threshold. "
 1415|      0|                "You may override this restriction by defining the "
 1416|      0|                "LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC environment variable, "
 1417|      0|                "or setting the JPEGMEM environment variable to a value "
 1418|      0|                "greater "
 1419|      0|                "or equal to '%" PRIu64 "M'",
 1420|      0|                nRequiredMemory, sp->cinfo.d.mem->max_memory_to_use,
 1421|      0|                (nRequiredMemory + 1000000u - 1u) / 1000000u);
 1422|      0|            return 0;
 1423|      0|        }
 1424|  22.2k|    }
 1425|       |
 1426|  39.0k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  39.0k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1426:9): [True: 37.1k, False: 1.89k]
  ------------------
 1427|  37.1k|    {
 1428|       |        /* Component 0 should have expected sampling factors */
 1429|  37.1k|        if (sp->cinfo.d.comp_info[0].h_samp_factor != sp->h_sampling ||
  ------------------
  |  Branch (1429:13): [True: 218, False: 36.9k]
  ------------------
 1430|  36.9k|            sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling)
  ------------------
  |  Branch (1430:13): [True: 232, False: 36.7k]
  ------------------
 1431|    450|        {
 1432|    450|            TIFFErrorExtR(tif, module,
 1433|    450|                          "Improper JPEG sampling factors %d,%d\n"
 1434|    450|                          "Apparently should be %" PRIu16 ",%" PRIu16 ".",
 1435|    450|                          sp->cinfo.d.comp_info[0].h_samp_factor,
 1436|    450|                          sp->cinfo.d.comp_info[0].v_samp_factor,
 1437|    450|                          sp->h_sampling, sp->v_sampling);
 1438|    450|            return (0);
 1439|    450|        }
 1440|       |        /* Rest should have sampling factors 1,1 */
 1441|  62.6k|        for (ci = 1; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1441:22): [True: 25.9k, False: 36.6k]
  ------------------
 1442|  25.9k|        {
 1443|  25.9k|            if (sp->cinfo.d.comp_info[ci].h_samp_factor != 1 ||
  ------------------
  |  Branch (1443:17): [True: 9, False: 25.9k]
  ------------------
 1444|  25.9k|                sp->cinfo.d.comp_info[ci].v_samp_factor != 1)
  ------------------
  |  Branch (1444:17): [True: 9, False: 25.9k]
  ------------------
 1445|     18|            {
 1446|     18|                TIFFErrorExtR(tif, module, "Improper JPEG sampling factors");
 1447|     18|                return (0);
 1448|     18|            }
 1449|  25.9k|        }
 1450|  36.7k|    }
 1451|  1.89k|    else
 1452|  1.89k|    {
 1453|       |        /* PC 2's single component should have sampling factors 1,1 */
 1454|  1.89k|        if (sp->cinfo.d.comp_info[0].h_samp_factor != 1 ||
  ------------------
  |  Branch (1454:13): [True: 2, False: 1.89k]
  ------------------
 1455|  1.89k|            sp->cinfo.d.comp_info[0].v_samp_factor != 1)
  ------------------
  |  Branch (1455:13): [True: 2, False: 1.89k]
  ------------------
 1456|      4|        {
 1457|      4|            TIFFErrorExtR(tif, module, "Improper JPEG sampling factors");
 1458|      4|            return (0);
 1459|      4|        }
 1460|  1.89k|    }
 1461|  38.5k|    downsampled_output = FALSE;
  ------------------
  |  |   72|  38.5k|#define FALSE 0
  ------------------
 1462|  38.5k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  77.1k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1462:9): [True: 36.6k, False: 1.89k]
  ------------------
 1463|  36.6k|        sp->photometric == PHOTOMETRIC_YCBCR &&
  ------------------
  |  |  227|  75.2k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1463:9): [True: 12.7k, False: 23.9k]
  ------------------
 1464|  12.7k|        sp->otherSettings.jpegcolormode == JPEGCOLORMODE_RGB)
  ------------------
  |  |  708|  12.7k|#define JPEGCOLORMODE_RGB 0x0001     /* do auto conversion */
  ------------------
  |  Branch (1464:9): [True: 12.7k, False: 3]
  ------------------
 1465|  12.7k|    {
 1466|       |        /* Convert YCbCr to RGB */
 1467|  12.7k|        sp->cinfo.d.jpeg_color_space = JCS_YCbCr;
 1468|  12.7k|        sp->cinfo.d.out_color_space = JCS_RGB;
 1469|  12.7k|    }
 1470|  25.8k|    else
 1471|  25.8k|    {
 1472|       |        /* Suppress colorspace handling */
 1473|  25.8k|        sp->cinfo.d.jpeg_color_space = JCS_UNKNOWN;
 1474|  25.8k|        sp->cinfo.d.out_color_space = JCS_UNKNOWN;
 1475|  25.8k|        if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  51.7k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1475:13): [True: 23.9k, False: 1.89k]
  ------------------
 1476|  23.9k|            (sp->h_sampling != 1 || sp->v_sampling != 1))
  ------------------
  |  Branch (1476:14): [True: 2, False: 23.9k]
  |  Branch (1476:37): [True: 1, False: 23.9k]
  ------------------
 1477|      3|            downsampled_output = TRUE;
  ------------------
  |  |   71|      3|#define TRUE 1
  ------------------
 1478|       |        /* XXX what about up-sampling? */
 1479|  25.8k|    }
 1480|  38.5k|    if (downsampled_output)
  ------------------
  |  Branch (1480:9): [True: 3, False: 38.5k]
  ------------------
 1481|      3|    {
 1482|       |        /* Need to use raw-data interface to libjpeg */
 1483|      3|        sp->cinfo.d.raw_data_out = TRUE;
  ------------------
  |  |   71|      3|#define TRUE 1
  ------------------
 1484|       |#if JPEG_LIB_VERSION >= 70
 1485|       |        sp->cinfo.d.do_fancy_upsampling = FALSE;
 1486|       |#endif /* JPEG_LIB_VERSION >= 70 */
 1487|      3|        tif->tif_decoderow = DecodeRowError;
 1488|      3|        tif->tif_decodestrip = JPEGDecodeRaw;
 1489|      3|        tif->tif_decodetile = JPEGDecodeRaw;
 1490|      3|    }
 1491|  38.5k|    else
 1492|  38.5k|    {
 1493|       |        /* Use normal interface to libjpeg */
 1494|  38.5k|        sp->cinfo.d.raw_data_out = FALSE;
  ------------------
  |  |   72|  38.5k|#define FALSE 0
  ------------------
 1495|  38.5k|        tif->tif_decoderow = JPEGDecode;
 1496|  38.5k|        tif->tif_decodestrip = JPEGDecode;
 1497|  38.5k|        tif->tif_decodetile = JPEGDecode;
 1498|  38.5k|    }
 1499|       |    /* Start JPEG decompressor */
 1500|  38.5k|    if (!TIFFjpeg_start_decompress(sp))
  ------------------
  |  Branch (1500:9): [True: 9.37k, False: 29.2k]
  ------------------
 1501|  9.37k|        return (0);
 1502|       |    /* Allocate downsampled-data buffers if needed */
 1503|  29.2k|    if (downsampled_output)
  ------------------
  |  Branch (1503:9): [True: 2, False: 29.2k]
  ------------------
 1504|      2|    {
 1505|      2|        if (!alloc_downsampled_buffers(tif, sp->cinfo.d.comp_info,
  ------------------
  |  Branch (1505:13): [True: 0, False: 2]
  ------------------
 1506|      2|                                       sp->cinfo.d.num_components))
 1507|      0|            return (0);
 1508|      2|        sp->scancount = DCTSIZE; /* mark buffer empty */
 1509|      2|    }
 1510|  29.2k|    return (1);
 1511|  29.2k|}
tif_jpeg.c:TIFFjpeg_abort:
  520|   139k|{
  521|       |    return CALLVJPEG(sp, jpeg_abort(&sp->cinfo.comm));
  ------------------
  |  |  302|   139k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|   139k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|   139k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (521:12): [True: 0, False: 139k]
  ------------------
  522|   139k|}
tif_jpeg.c:JPEGComputeStrileWidthHeightBytesPerLine:
 1224|  42.3k|{
 1225|  42.3k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  42.3k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1226|  42.3k|    TIFFDirectory *td = &tif->tif_dir;
 1227|       |
 1228|       |    /*
 1229|       |     * Check image parameters and set decompression parameters.
 1230|       |     */
 1231|  42.3k|    if (isTiled(tif))
  ------------------
  |  |  278|  42.3k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  42.3k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 42.1k, False: 222]
  |  |  ------------------
  ------------------
 1232|  42.1k|    {
 1233|  42.1k|        sp->strile_width = td->td_tilewidth;
 1234|  42.1k|        sp->strile_height = td->td_tilelength;
 1235|  42.1k|        sp->bytesperline = TIFFTileRowSize(tif);
 1236|  42.1k|    }
 1237|    222|    else
 1238|    222|    {
 1239|    222|        sp->strile_width = td->td_imagewidth;
 1240|    222|        sp->strile_height = td->td_imagelength - tif->tif_dir.td_row;
 1241|    222|        if (sp->strile_height > td->td_rowsperstrip)
  ------------------
  |  Branch (1241:13): [True: 197, False: 25]
  ------------------
 1242|    197|            sp->strile_height = td->td_rowsperstrip;
 1243|    222|        sp->bytesperline = TIFFScanlineSize(tif);
 1244|    222|    }
 1245|  42.3k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0)
  ------------------
  |  |  266|  84.6k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (1245:9): [True: 1.89k, False: 40.4k]
  |  Branch (1245:57): [True: 313, False: 1.58k]
  ------------------
 1246|    313|    {
 1247|       |        /*
 1248|       |         * For PC 2, scale down the expected strip/tile size
 1249|       |         * to match a downsampled component
 1250|       |         */
 1251|    313|        if (sp->h_sampling == 0 || sp->v_sampling == 0)
  ------------------
  |  Branch (1251:13): [True: 0, False: 313]
  |  Branch (1251:36): [True: 0, False: 313]
  ------------------
 1252|      0|        {
 1253|      0|            TIFFErrorExtR(tif, "JPEGComputeStrileWidthHeightBytesPerLine",
 1254|      0|                          "JPEG horizontal or vertical sampling is zero");
 1255|      0|            return (0);
 1256|      0|        }
 1257|    313|        sp->strile_width = TIFFhowmany_32(sp->strile_width, sp->h_sampling);
  ------------------
  |  |  312|    313|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 313, False: 0]
  |  |  ------------------
  |  |  313|    313|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|    313|         : 0U)
  ------------------
 1258|    313|        sp->strile_height = TIFFhowmany_32(sp->strile_height, sp->v_sampling);
  ------------------
  |  |  312|    313|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 313, False: 0]
  |  |  ------------------
  |  |  313|    313|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|    313|         : 0U)
  ------------------
 1259|    313|    }
 1260|       |
 1261|  42.3k|    return 1;
 1262|  42.3k|}
tif_jpeg.c:DecodeRowError:
 1721|      2|{
 1722|      2|    (void)buf;
 1723|      2|    (void)cc;
 1724|      2|    (void)s;
 1725|       |
 1726|      2|    TIFFErrorExtR(
 1727|      2|        tif, "TIFFReadScanline",
 1728|      2|        "scanline oriented access is not supported for downsampled JPEG "
 1729|      2|        "compressed images, consider enabling TIFFTAG_JPEGCOLORMODE as "
 1730|      2|        "JPEGCOLORMODE_RGB.");
 1731|      2|    return 0;
 1732|      2|}
tif_jpeg.c:TIFFjpeg_finish_decompress:
  515|  29.1k|{
  516|       |    return CALLJPEG(sp, -1, (int)jpeg_finish_decompress(&sp->cinfo.d));
  ------------------
  |  |  301|  29.1k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  29.1k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (516:12): [True: 5.44k, False: 23.7k]
  ------------------
  517|  29.1k|}
tif_jpeg.c:TIFFjpeg_start_decompress:
  406|  38.5k|{
  407|  38.5k|    const char *sz_max_allowed_scan_number;
  408|       |    /* progress monitor */
  409|  38.5k|    sp->cinfo.d.progress = &sp->progress;
  410|  38.5k|    sp->progress.progress_monitor = TIFFjpeg_progress_monitor;
  411|  38.5k|    sp->otherSettings.max_allowed_scan_number = 100;
  412|  38.5k|    sz_max_allowed_scan_number = getenv("LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER");
  413|  38.5k|    if (sz_max_allowed_scan_number)
  ------------------
  |  Branch (413:9): [True: 0, False: 38.5k]
  ------------------
  414|      0|        sp->otherSettings.max_allowed_scan_number =
  415|      0|            atoi(sz_max_allowed_scan_number);
  416|       |
  417|       |    return CALLVJPEG(sp, jpeg_start_decompress(&sp->cinfo.d));
  ------------------
  |  |  302|  38.5k|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|  38.5k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|  38.5k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (417:12): [True: 9.37k, False: 29.2k]
  ------------------
  418|  38.5k|}
tif_jpeg.c:TIFFjpeg_progress_monitor:
  274|  3.48M|{
  275|  3.48M|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  276|  3.48M|    if (cinfo->is_decompressor)
  ------------------
  |  Branch (276:9): [True: 3.48M, False: 0]
  ------------------
  277|  3.48M|    {
  278|  3.48M|        const int scan_no = ((j_decompress_ptr)cinfo)->input_scan_number;
  279|  3.48M|        if (scan_no >= sp->otherSettings.max_allowed_scan_number)
  ------------------
  |  Branch (279:13): [True: 2, False: 3.48M]
  ------------------
  280|      2|        {
  281|      2|            TIFFErrorExtR(
  282|      2|                ((JPEGState *)cinfo)->tif, "TIFFjpeg_progress_monitor",
  283|      2|                "Scan number %d exceeds maximum scans (%d). This limit "
  284|      2|                "can be raised through the "
  285|      2|                "LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER "
  286|      2|                "environment variable.",
  287|      2|                scan_no, sp->otherSettings.max_allowed_scan_number);
  288|       |
  289|      2|            jpeg_abort(cinfo);           /* clean up libjpeg state */
  290|      2|            LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
  ------------------
  |  |  143|      2|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
  291|      2|        }
  292|  3.48M|    }
  293|  3.48M|}
tif_jpeg.c:alloc_downsampled_buffers:
  783|      2|{
  784|      2|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|      2|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
  785|      2|    int ci;
  786|      2|    jpeg_component_info *compptr;
  787|      2|    TIFF_JSAMPARRAY buf;
  ------------------
  |  |  110|      2|#define TIFF_JSAMPARRAY JSAMPARRAY
  ------------------
  788|      2|    int samples_per_clump = 0;
  789|       |
  790|      8|    for (ci = 0, compptr = comp_info; ci < num_components; ci++, compptr++)
  ------------------
  |  Branch (790:39): [True: 6, False: 2]
  ------------------
  791|      6|    {
  792|      6|        samples_per_clump += compptr->h_samp_factor * compptr->v_samp_factor;
  793|      6|        buf = (TIFF_JSAMPARRAY)TIFFjpeg_alloc_sarray(
  794|      6|            sp, JPOOL_IMAGE, compptr->width_in_blocks * DCTSIZE,
  795|      6|            (JDIMENSION)(compptr->v_samp_factor * DCTSIZE));
  796|      6|        if (buf == NULL)
  ------------------
  |  Branch (796:13): [True: 0, False: 6]
  ------------------
  797|      0|            return (0);
  798|      6|        sp->ds_buffer[ci] = buf;
  799|      6|    }
  800|      2|    sp->samplesperclump = samples_per_clump;
  801|      2|    return (1);
  802|      2|}
tif_jpeg.c:TIFFjpeg_alloc_sarray:
  532|      6|{
  533|       |    return CALLJPEG(sp, (JSAMPARRAY)NULL,
  ------------------
  |  |  301|      6|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|      6|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (533:12): [True: 0, False: 6]
  ------------------
  534|      6|                    (*sp->cinfo.comm.mem->alloc_sarray)(
  535|      6|                        &sp->cinfo.comm, pool_id, samplesperrow, numrows));
  536|      6|}
tif_jpeg.c:JPEGDecode:
 1519|  29.5k|{
 1520|  29.5k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  29.5k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1521|  29.5k|    tmsize_t nrows;
 1522|  29.5k|    (void)s;
 1523|       |
 1524|       |    /*
 1525|       |    ** Update available information, buffer may have been refilled
 1526|       |    ** between decode requests
 1527|       |    */
 1528|  29.5k|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawcp;
 1529|  29.5k|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
 1530|       |
 1531|  29.5k|    if (sp->bytesperline == 0)
  ------------------
  |  Branch (1531:9): [True: 0, False: 29.5k]
  ------------------
 1532|      0|    {
 1533|      0|        memset(buf, 0, (size_t)cc);
 1534|      0|        return 0;
 1535|      0|    }
 1536|       |
 1537|  29.5k|    nrows = cc / sp->bytesperline;
 1538|  29.5k|    if (cc % sp->bytesperline)
  ------------------
  |  Branch (1538:9): [True: 0, False: 29.5k]
  ------------------
 1539|      0|        TIFFWarningExtR(tif, tif->tif_name, "fractional scanline not read");
 1540|       |
 1541|  29.5k|    if (nrows > (tmsize_t)sp->cinfo.d.image_height)
  ------------------
  |  Branch (1541:9): [True: 28.4k, False: 1.10k]
  ------------------
 1542|  28.4k|    {
 1543|       |        /* Initialize the output buffer if the JPEG image is smaller than the
 1544|       |         * strile height. */
 1545|  28.4k|        memset(buf, 0, (size_t)cc);
 1546|  28.4k|        nrows = sp->cinfo.d.image_height;
 1547|  28.4k|    }
 1548|  1.10k|    else if (sp->strile_width > sp->cinfo.d.image_width)
  ------------------
  |  Branch (1548:14): [True: 1.07k, False: 32]
  ------------------
 1549|  1.07k|    {
 1550|       |        /* Initialize the output buffer if the JPEG image is smaller than the
 1551|       |         * strile width. */
 1552|  1.07k|        memset(buf, 0, (size_t)cc);
 1553|  1.07k|    }
 1554|       |
 1555|       |    /* data is expected to be read in multiples of a scanline */
 1556|  29.5k|    if (nrows)
  ------------------
  |  Branch (1556:9): [True: 29.5k, False: 0]
  ------------------
 1557|  29.5k|    {
 1558|  29.5k|        do
 1559|  3.11M|        {
 1560|       |            /*
 1561|       |             * In the libjpeg6b-9a 8bit case.  We read directly into
 1562|       |             * the TIFF buffer.
 1563|       |             */
 1564|  3.11M|            JSAMPROW bufptr = (JSAMPROW)buf;
 1565|       |
 1566|  3.11M|            if (TIFFjpeg_read_scanlines(sp, &bufptr, 1) != 1)
  ------------------
  |  Branch (1566:17): [True: 29, False: 3.11M]
  ------------------
 1567|     29|            {
 1568|     29|                memset(buf, 0, (size_t)cc);
 1569|     29|                return (0);
 1570|     29|            }
 1571|       |
 1572|  3.11M|            ++tif->tif_dir.td_row;
 1573|  3.11M|            buf += sp->bytesperline;
 1574|  3.11M|            cc -= sp->bytesperline;
 1575|  3.11M|        } while (--nrows > 0);
  ------------------
  |  Branch (1575:18): [True: 3.08M, False: 29.5k]
  ------------------
 1576|  29.5k|    }
 1577|       |
 1578|       |    /* Update information on consumed data */
 1579|  29.5k|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1580|  29.5k|    tif->tif_rawcc = (tmsize_t)sp->src.bytes_in_buffer;
 1581|       |
 1582|       |    /* Close down the decompressor if we've finished the strip or tile. */
 1583|  29.5k|    return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height ||
  ------------------
  |  Branch (1583:12): [True: 385, False: 29.1k]
  ------------------
 1584|  29.1k|           TIFFjpeg_finish_decompress(sp);
  ------------------
  |  Branch (1584:12): [True: 29.1k, False: 0]
  ------------------
 1585|  29.5k|}
tif_jpeg.c:TIFFjpeg_read_scanlines:
  422|  3.11M|{
  423|       |#if defined(HAVE_JPEGTURBO_DUAL_MODE_8_12) && BITS_IN_JSAMPLE == 12
  424|       |    return CALLJPEG(sp, -1,
  425|       |                    (int)jpeg12_read_scanlines(&sp->cinfo.d, scanlines,
  426|       |                                               (JDIMENSION)max_lines));
  427|       |#else
  428|       |    return CALLJPEG(sp, -1,
  ------------------
  |  |  301|  3.11M|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  3.11M|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (428:12): [True: 29, False: 3.11M]
  ------------------
  429|  3.11M|                    (int)jpeg_read_scanlines(&sp->cinfo.d, scanlines,
  430|  3.11M|                                             (JDIMENSION)max_lines));
  431|  3.11M|#endif
  432|  3.11M|}
tif_jpeg.c:JPEGGetMaxCompressionRatio:
 2941|     12|{
 2942|       |    /* See README_for_libtiff_developpers.md for raw data used to estimate
 2943|       |     * the maximum compression rate. */
 2944|       |
 2945|     12|    const JPEGState *sp = JState(tif);
  ------------------
  |  |  208|     12|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2946|     12|    if ((tif->tif_dir.td_photometric == PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|     12|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (2946:9): [True: 9, False: 3]
  ------------------
 2947|      9|        (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|      9|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (2947:9): [True: 9, False: 0]
  ------------------
 2948|      9|        (tif->tif_dir.td_samplesperpixel == 3))
  ------------------
  |  Branch (2948:9): [True: 9, False: 0]
  ------------------
 2949|      9|    {
 2950|      9|        if (sp->h_sampling == 2 && sp->v_sampling == 2)
  ------------------
  |  Branch (2950:13): [True: 1, False: 8]
  |  Branch (2950:36): [True: 1, False: 0]
  ------------------
 2951|      1|        {
 2952|      1|            if (tif->tif_dir.td_bitspersample == 12)
  ------------------
  |  Branch (2952:17): [True: 0, False: 1]
  ------------------
 2953|      0|                return 768;
 2954|      1|            else
 2955|      1|                return 512;
 2956|      1|        }
 2957|       |
 2958|      8|        return 0; /* unknown */
 2959|      9|    }
 2960|       |
 2961|      3|    if (tif->tif_dir.td_bitspersample == 12)
  ------------------
  |  Branch (2961:9): [True: 1, False: 2]
  ------------------
 2962|      1|        return 384;
 2963|      2|    else
 2964|      2|        return 256;
 2965|      3|}
tif_jpeg.c:JPEGCleanup:
 2678|  2.17k|{
 2679|  2.17k|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  2.17k|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2680|       |
 2681|  2.17k|    assert(sp != 0);
  ------------------
  |  Branch (2681:5): [True: 0, False: 2.17k]
  |  Branch (2681:5): [True: 2.17k, False: 0]
  ------------------
 2682|       |
 2683|  2.17k|    tif->tif_tagmethods.vgetfield = sp->otherSettings.vgetparent;
 2684|  2.17k|    tif->tif_tagmethods.vsetfield = sp->otherSettings.vsetparent;
 2685|  2.17k|    tif->tif_tagmethods.printdir = sp->otherSettings.printdir;
 2686|  2.17k|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2686:9): [True: 1.07k, False: 1.09k]
  ------------------
 2687|  1.07k|        TIFFjpeg_destroy(sp);         /* release libjpeg resources */
 2688|  2.17k|    if (sp->otherSettings.jpegtables) /* tag value */
  ------------------
  |  Branch (2688:9): [True: 158, False: 2.01k]
  ------------------
 2689|    158|        _TIFFfreeExt(tif, sp->otherSettings.jpegtables);
 2690|  2.17k|    _TIFFfreeExt(tif, tif->tif_data); /* release local state */
 2691|  2.17k|    tif->tif_data = NULL;
 2692|       |
 2693|  2.17k|    _TIFFSetDefaultCompressionState(tif);
 2694|  2.17k|}
tif_jpeg_12.c:TIFFjpeg_create_decompress:
  318|    787|{
  319|       |    /* initialize JPEG error handling */
  320|    787|    sp->cinfo.d.err = jpeg_std_error(&sp->err);
  321|    787|    sp->err.error_exit = TIFFjpeg_error_exit;
  322|    787|    sp->err.output_message = TIFFjpeg_output_message;
  323|       |
  324|       |    /* set client_data to avoid UMR warning from tools like Purify */
  325|    787|    sp->cinfo.d.client_data = NULL;
  326|       |
  327|       |    return CALLVJPEG(sp, jpeg_create_decompress(&sp->cinfo.d));
  ------------------
  |  |  302|    787|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|    787|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|    787|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (327:12): [True: 0, False: 787]
  ------------------
  328|    787|}
tif_jpeg_12.c:TIFFjpeg_error_exit:
  244|    423|{
  245|    423|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  246|    423|    char buffer[JMSG_LENGTH_MAX];
  247|       |
  248|    423|    (*cinfo->err->format_message)(cinfo, buffer);
  249|    423|    TIFFErrorExtR(sp->tif, "JPEGLib", "%s",
  250|    423|                  buffer);       /* display the error message */
  251|    423|    jpeg_abort(cinfo);           /* clean up libjpeg state */
  252|    423|    LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
  ------------------
  |  |  143|    423|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
  253|    423|}
tif_jpeg_12.c:TIFFjpeg_output_message:
  261|  1.31k|{
  262|  1.31k|    char buffer[JMSG_LENGTH_MAX];
  263|       |
  264|  1.31k|    (*cinfo->err->format_message)(cinfo, buffer);
  265|  1.31k|    TIFFWarningExtR(((JPEGState *)cinfo)->tif, "JPEGLib", "%s", buffer);
  266|  1.31k|}
tif_jpeg_12.c:TIFFjpeg_data_src:
  744|  1.37k|{
  745|  1.37k|    sp->cinfo.d.src = &sp->src;
  746|  1.37k|    sp->src.init_source = std_init_source;
  747|  1.37k|    sp->src.fill_input_buffer = std_fill_input_buffer;
  748|  1.37k|    sp->src.skip_input_data = std_skip_input_data;
  749|  1.37k|    sp->src.resync_to_restart = jpeg_resync_to_restart;
  750|  1.37k|    sp->src.term_source = std_term_source;
  751|  1.37k|    sp->src.bytes_in_buffer = 0; /* for safety */
  752|       |    sp->src.next_input_byte = NULL;
  753|  1.37k|}
tif_jpeg_12.c:std_init_source:
  674|    835|{
  675|    835|    JPEGState *sp = (JPEGState *)cinfo;
  676|    835|    TIFF *tif = sp->tif;
  677|       |
  678|    835|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawdata;
  679|    835|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
  680|    835|}
tif_jpeg_12.c:std_fill_input_buffer:
  683|  1.85k|{
  684|  1.85k|    JPEGState *sp = (JPEGState *)cinfo;
  685|  1.85k|    static const JOCTET dummy_EOI[2] = {0xFF, JPEG_EOI};
  686|       |
  687|       |#ifdef IPPJ_HUFF
  688|       |    /*
  689|       |     * The Intel IPP performance library does not necessarily read the whole
  690|       |     * input buffer in one pass, so it is possible to get here with data
  691|       |     * yet to read.
  692|       |     *
  693|       |     * We just return without doing anything, until the entire buffer has
  694|       |     * been read.
  695|       |     * http://trac.osgeo.org/gdal/wiki/JpegIPP
  696|       |     */
  697|       |    if (sp->src.bytes_in_buffer > 0)
  698|       |    {
  699|       |        return (TRUE);
  700|       |    }
  701|       |#endif
  702|       |
  703|       |    /*
  704|       |     * Normally the whole strip/tile is read and so we don't need to do
  705|       |     * a fill.  In the case of CHUNKY_STRIP_READ_SUPPORT we might not have
  706|       |     * all the data, but the rawdata is refreshed between scanlines and
  707|       |     * we push this into the io machinery in JPEGDecode().
  708|       |     * http://trac.osgeo.org/gdal/ticket/3894
  709|       |     */
  710|       |
  711|  1.85k|    WARNMS(cinfo, JWRN_JPEG_EOF);
  712|       |    /* insert a fake EOI marker */
  713|  1.85k|    sp->src.next_input_byte = dummy_EOI;
  714|  1.85k|    sp->src.bytes_in_buffer = 2;
  715|  1.85k|    return (TRUE);
  ------------------
  |  |   71|  1.85k|#define TRUE 1
  ------------------
  716|  1.85k|}
tif_jpeg_12.c:std_skip_input_data:
  719|    564|{
  720|    564|    JPEGState *sp = (JPEGState *)cinfo;
  721|       |
  722|    564|    if (num_bytes > 0)
  ------------------
  |  Branch (722:9): [True: 564, False: 0]
  ------------------
  723|    564|    {
  724|    564|        if ((size_t)num_bytes > sp->src.bytes_in_buffer)
  ------------------
  |  Branch (724:13): [True: 197, False: 367]
  ------------------
  725|    197|        {
  726|       |            /* oops, buffer overrun */
  727|    197|            (void)std_fill_input_buffer(cinfo);
  728|    197|        }
  729|    367|        else
  730|    367|        {
  731|    367|            sp->src.next_input_byte += (size_t)num_bytes;
  732|    367|            sp->src.bytes_in_buffer -= (size_t)num_bytes;
  733|    367|        }
  734|    564|    }
  735|    564|}
tif_jpeg_12.c:std_term_source:
  738|    240|{
  739|       |    /* No work necessary here */
  740|    240|    (void)cinfo;
  741|    240|}
tif_jpeg_12.c:TIFFjpeg_read_header:
  396|  1.42k|{
  397|       |    return CALLJPEG(sp, -1, jpeg_read_header(&sp->cinfo.d, require_image));
  ------------------
  |  |  301|  1.42k|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  1.42k|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (397:12): [True: 30, False: 1.39k]
  ------------------
  398|  1.42k|}
tif_jpeg_12.c:TIFFjpeg_destroy:
  525|    787|{
  526|       |    return CALLVJPEG(sp, jpeg_destroy(&sp->cinfo.comm));
  ------------------
  |  |  302|    787|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|    787|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|    787|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (526:12): [True: 0, False: 787]
  ------------------
  527|    787|}
tif_jpeg_12.c:TIFFjpeg_has_multiple_scans:
  401|    801|{
  402|       |    return CALLJPEG(sp, 0, jpeg_has_multiple_scans(&sp->cinfo.d));
  ------------------
  |  |  301|    801|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|    801|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (402:12): [True: 0, False: 801]
  ------------------
  403|    801|}
tif_jpeg_12.c:TIFFInitJPEGCommon:
 2969|    787|{
 2970|    787|    JPEGState *sp;
 2971|       |
 2972|    787|    sp = JState(tif);
  ------------------
  |  |  208|    787|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2973|    787|    sp->tif = tif; /* back link */
 2974|       |
 2975|       |    /* Default values for codec-specific fields */
 2976|    787|    sp->otherSettings.jpegtables = NULL;
 2977|    787|    sp->otherSettings.jpegtables_length = 0;
 2978|    787|    sp->otherSettings.jpegquality = 75; /* Default IJG quality */
 2979|    787|    sp->otherSettings.jpegcolormode = JPEGCOLORMODE_RAW;
  ------------------
  |  |  707|    787|#define JPEGCOLORMODE_RAW 0x0000     /* no conversion (default) */
  ------------------
 2980|    787|    sp->otherSettings.jpegtablesmode =
 2981|    787|        JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  710|    787|#define JPEGTABLESMODE_QUANT 0x0001  /* include quantization tbls */
  ------------------
                      JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF;
  ------------------
  |  |  711|    787|#define JPEGTABLESMODE_HUFF 0x0002   /* include Huffman tbls */
  ------------------
 2982|    787|    sp->otherSettings.ycbcrsampling_fetched = 0;
 2983|       |
 2984|    787|    tif->tif_tagmethods.vgetfield = JPEGVGetField; /* hook for codec tags */
 2985|    787|    tif->tif_tagmethods.vsetfield = JPEGVSetField; /* hook for codec tags */
 2986|    787|    tif->tif_tagmethods.printdir = JPEGPrintDir;   /* hook for codec tags */
 2987|       |
 2988|       |    /*
 2989|       |     * Install codec methods.
 2990|       |     */
 2991|    787|    tif->tif_fixuptags = JPEGFixupTags;
 2992|    787|    tif->tif_setupdecode = JPEGSetupDecode;
 2993|    787|    tif->tif_predecode = JPEGPreDecode;
 2994|    787|    tif->tif_decoderow = JPEGDecode;
 2995|    787|    tif->tif_decodestrip = JPEGDecode;
 2996|    787|    tif->tif_decodetile = JPEGDecode;
 2997|    787|    tif->tif_setupencode = JPEGSetupEncode;
 2998|    787|    tif->tif_preencode = JPEGPreEncode;
 2999|    787|    tif->tif_postencode = JPEGPostEncode;
 3000|    787|    tif->tif_encoderow = JPEGEncode;
 3001|    787|    tif->tif_encodestrip = JPEGEncode;
 3002|    787|    tif->tif_encodetile = JPEGEncode;
 3003|    787|    tif->tif_getmaxcompressionratio = JPEGGetMaxCompressionRatio;
 3004|    787|    tif->tif_cleanup = JPEGCleanup;
 3005|       |
 3006|    787|    tif->tif_defstripsize = JPEGDefaultStripSize;
 3007|    787|    tif->tif_deftilesize = JPEGDefaultTileSize;
 3008|    787|    tif->tif_flags |= TIFF_NOBITREV; /* no bit reversal, please */
  ------------------
  |  |  127|    787|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
 3009|    787|    sp->cinfo_initialized = FALSE;
  ------------------
  |  |   72|    787|#define FALSE 0
  ------------------
 3010|    787|}
tif_jpeg_12.c:JPEGPreDecode:
 1268|    835|{
 1269|    835|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|    835|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1270|    835|    TIFFDirectory *td = &tif->tif_dir;
 1271|    835|    static const char module[] = "JPEGPreDecode";
 1272|    835|    int downsampled_output;
 1273|    835|    int ci;
 1274|       |
 1275|    835|    assert(sp != NULL);
  ------------------
  |  Branch (1275:5): [True: 0, False: 835]
  |  Branch (1275:5): [True: 835, False: 0]
  ------------------
 1276|       |
 1277|    835|    if (sp->cinfo.comm.is_decompressor == 0)
  ------------------
  |  Branch (1277:9): [True: 0, False: 835]
  ------------------
 1278|      0|    {
 1279|      0|        tif->tif_setupdecode(tif);
 1280|      0|    }
 1281|       |
 1282|    835|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1282:5): [True: 0, False: 835]
  |  Branch (1282:5): [True: 835, False: 0]
  ------------------
 1283|       |    /*
 1284|       |     * Reset decoder state from any previous strip/tile,
 1285|       |     * in case application didn't read the whole strip.
 1286|       |     */
 1287|    835|    if (!TIFFjpeg_abort(sp))
  ------------------
  |  Branch (1287:9): [True: 0, False: 835]
  ------------------
 1288|      0|        return (0);
 1289|       |    /*
 1290|       |     * Read the header for this strip/tile.
 1291|       |     */
 1292|       |
 1293|    835|    if (TIFFjpeg_read_header(sp, TRUE) != JPEG_HEADER_OK)
  ------------------
  |  |   71|    835|#define TRUE 1
  ------------------
  |  Branch (1293:9): [True: 27, False: 808]
  ------------------
 1294|     27|        return (0);
 1295|       |
 1296|    808|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1297|    808|    tif->tif_rawcc = (tmsize_t)sp->src.bytes_in_buffer;
 1298|       |
 1299|    808|    if (!JPEGComputeStrileWidthHeightBytesPerLine(tif, s))
  ------------------
  |  Branch (1299:9): [True: 0, False: 808]
  ------------------
 1300|      0|        return 0;
 1301|       |
 1302|    808|    if (sp->cinfo.d.image_width < sp->strile_width ||
  ------------------
  |  Branch (1302:9): [True: 362, False: 446]
  ------------------
 1303|    446|        sp->cinfo.d.image_height < sp->strile_height)
  ------------------
  |  Branch (1303:9): [True: 12, False: 434]
  ------------------
 1304|    374|    {
 1305|    374|        TIFFWarningExtR(tif, module,
 1306|    374|                        "Improper JPEG strip/tile size, "
 1307|    374|                        "expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1308|    374|                        sp->strile_width, sp->strile_height,
 1309|    374|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1310|    374|    }
 1311|    808|    if (sp->cinfo.d.image_width == sp->strile_width &&
  ------------------
  |  Branch (1311:9): [True: 443, False: 365]
  ------------------
 1312|    443|        sp->cinfo.d.image_height > sp->strile_height &&
  ------------------
  |  Branch (1312:9): [True: 368, False: 75]
  ------------------
 1313|    368|        tif->tif_dir.td_row + sp->strile_height == td->td_imagelength &&
  ------------------
  |  Branch (1313:9): [True: 367, False: 1]
  ------------------
 1314|    367|        !isTiled(tif))
  ------------------
  |  |  278|    367|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    367|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (1314:9): [True: 367, False: 0]
  ------------------
 1315|    367|    {
 1316|       |        /* Some files have a last strip, that should be truncated, */
 1317|       |        /* but their JPEG codestream has still the maximum strip */
 1318|       |        /* height. Warn about this as this is non compliant, but */
 1319|       |        /* we can safely recover from that. */
 1320|    367|        TIFFWarningExtR(tif, module,
 1321|    367|                        "JPEG strip size exceeds expected dimensions,"
 1322|    367|                        " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1323|    367|                        sp->strile_width, sp->strile_height,
 1324|    367|                        sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1325|    367|    }
 1326|    441|    else if (sp->cinfo.d.image_width > sp->strile_width ||
  ------------------
  |  Branch (1326:14): [True: 3, False: 438]
  ------------------
 1327|    438|             sp->cinfo.d.image_height > sp->strile_height)
  ------------------
  |  Branch (1327:14): [True: 2, False: 436]
  ------------------
 1328|      5|    {
 1329|       |        /*
 1330|       |         * This case could be dangerous, if the strip or tile size has
 1331|       |         * been reported as less than the amount of data jpeg will
 1332|       |         * return, some potential security issues arise. Catch this
 1333|       |         * case and error out.
 1334|       |         */
 1335|      5|        TIFFErrorExtR(tif, module,
 1336|      5|                      "JPEG strip/tile size exceeds expected dimensions,"
 1337|      5|                      " expected %" PRIu32 "x%" PRIu32 ", got %ux%u",
 1338|      5|                      sp->strile_width, sp->strile_height,
 1339|      5|                      sp->cinfo.d.image_width, sp->cinfo.d.image_height);
 1340|      5|        return (0);
 1341|      5|    }
 1342|    803|    if (sp->cinfo.d.num_components !=
  ------------------
  |  Branch (1342:9): [True: 1, False: 802]
  ------------------
 1343|    803|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|    803|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1343:10): [True: 520, False: 283]
  ------------------
 1344|    803|                                                    : 1))
 1345|      1|    {
 1346|      1|        TIFFErrorExtR(tif, module, "Improper JPEG component count");
 1347|      1|        return (0);
 1348|      1|    }
 1349|       |#ifdef JPEG_LIB_MK1
 1350|       |    if (12 != td->td_bitspersample && 8 != td->td_bitspersample)
 1351|       |    {
 1352|       |        TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1353|       |        return (0);
 1354|       |    }
 1355|       |    sp->cinfo.d.data_precision = td->td_bitspersample;
 1356|       |    sp->cinfo.d.bits_in_jsample = td->td_bitspersample;
 1357|       |#else
 1358|    802|    if (td->td_bitspersample != BITS_IN_JSAMPLE ||
  ------------------
  |  |  102|  1.60k|#define BITS_IN_JSAMPLE 12
  ------------------
  |  Branch (1358:9): [True: 0, False: 802]
  ------------------
 1359|    802|        sp->cinfo.d.data_precision != td->td_bitspersample)
  ------------------
  |  Branch (1359:9): [True: 1, False: 801]
  ------------------
 1360|      1|    {
 1361|      1|        TIFFErrorExtR(tif, module, "Improper JPEG data precision");
 1362|      1|        return (0);
 1363|      1|    }
 1364|    801|#endif
 1365|       |
 1366|    801|    if (sp->cinfo.d.progressive_mode &&
  ------------------
  |  Branch (1366:9): [True: 447, False: 354]
  ------------------
 1367|    447|        !sp->otherSettings.has_warned_about_progressive_mode)
  ------------------
  |  Branch (1367:9): [True: 409, False: 38]
  ------------------
 1368|    409|    {
 1369|    409|        TIFFWarningExtR(tif, module,
 1370|    409|                        "The JPEG strip/tile is encoded with progressive mode, "
 1371|    409|                        "which is normally not legal for JPEG-in-TIFF.\n"
 1372|    409|                        "libtiff should be able to decode it, but it might "
 1373|    409|                        "cause compatibility issues with other readers");
 1374|    409|        sp->otherSettings.has_warned_about_progressive_mode = TRUE;
  ------------------
  |  |   71|    409|#define TRUE 1
  ------------------
 1375|    409|    }
 1376|       |
 1377|       |    /* In some cases, libjpeg needs to allocate a lot of memory */
 1378|       |    /* http://www.libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf
 1379|       |     */
 1380|    801|    if (TIFFjpeg_has_multiple_scans(sp))
  ------------------
  |  Branch (1380:9): [True: 447, False: 354]
  ------------------
 1381|    447|    {
 1382|       |        /* In this case libjpeg will need to allocate memory or backing */
 1383|       |        /* store for all coefficients */
 1384|       |        /* See call to jinit_d_coef_controller() from master_selection() */
 1385|       |        /* in libjpeg */
 1386|       |
 1387|       |        /* 1 MB for regular libjpeg usage */
 1388|    447|        toff_t nRequiredMemory = 1024 * 1024;
 1389|       |
 1390|    894|        for (ci = 0; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1390:22): [True: 447, False: 447]
  ------------------
 1391|    447|        {
 1392|    447|            const jpeg_component_info *compptr = &(sp->cinfo.d.comp_info[ci]);
 1393|    447|            if (compptr->h_samp_factor > 0 && compptr->v_samp_factor > 0)
  ------------------
  |  Branch (1393:17): [True: 447, False: 0]
  |  Branch (1393:47): [True: 447, False: 0]
  ------------------
 1394|    447|            {
 1395|    447|                nRequiredMemory +=
 1396|    447|                    (toff_t)((JDIMENSION)(((int)compptr->width_in_blocks +
 1397|    447|                                           compptr->h_samp_factor - 1) /
 1398|    447|                                          compptr->h_samp_factor)) *
 1399|    447|                    (JDIMENSION)(((int)compptr->height_in_blocks +
 1400|    447|                                  compptr->v_samp_factor - 1) /
 1401|    447|                                 compptr->v_samp_factor) *
 1402|    447|                    sizeof(JBLOCK);
 1403|    447|            }
 1404|    447|        }
 1405|       |
 1406|    447|        if (sp->cinfo.d.mem->max_memory_to_use > 0 &&
  ------------------
  |  Branch (1406:13): [True: 0, False: 447]
  ------------------
 1407|      0|            nRequiredMemory > (toff_t)(sp->cinfo.d.mem->max_memory_to_use) &&
  ------------------
  |  Branch (1407:13): [True: 0, False: 0]
  ------------------
 1408|      0|            getenv("LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC") == NULL)
  ------------------
  |  Branch (1408:13): [True: 0, False: 0]
  ------------------
 1409|      0|        {
 1410|      0|            TIFFErrorExtR(
 1411|      0|                tif, module,
 1412|      0|                "Reading this image would require libjpeg to allocate "
 1413|      0|                "at least %" PRIu64 " bytes. "
 1414|      0|                "This is disabled since above the %ld threshold. "
 1415|      0|                "You may override this restriction by defining the "
 1416|      0|                "LIBTIFF_ALLOW_LARGE_LIBJPEG_MEM_ALLOC environment variable, "
 1417|      0|                "or setting the JPEGMEM environment variable to a value "
 1418|      0|                "greater "
 1419|      0|                "or equal to '%" PRIu64 "M'",
 1420|      0|                nRequiredMemory, sp->cinfo.d.mem->max_memory_to_use,
 1421|      0|                (nRequiredMemory + 1000000u - 1u) / 1000000u);
 1422|      0|            return 0;
 1423|      0|        }
 1424|    447|    }
 1425|       |
 1426|    801|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|    801|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1426:9): [True: 518, False: 283]
  ------------------
 1427|    518|    {
 1428|       |        /* Component 0 should have expected sampling factors */
 1429|    518|        if (sp->cinfo.d.comp_info[0].h_samp_factor != sp->h_sampling ||
  ------------------
  |  Branch (1429:13): [True: 1, False: 517]
  ------------------
 1430|    517|            sp->cinfo.d.comp_info[0].v_samp_factor != sp->v_sampling)
  ------------------
  |  Branch (1430:13): [True: 1, False: 516]
  ------------------
 1431|      2|        {
 1432|      2|            TIFFErrorExtR(tif, module,
 1433|      2|                          "Improper JPEG sampling factors %d,%d\n"
 1434|      2|                          "Apparently should be %" PRIu16 ",%" PRIu16 ".",
 1435|      2|                          sp->cinfo.d.comp_info[0].h_samp_factor,
 1436|      2|                          sp->cinfo.d.comp_info[0].v_samp_factor,
 1437|      2|                          sp->h_sampling, sp->v_sampling);
 1438|      2|            return (0);
 1439|      2|        }
 1440|       |        /* Rest should have sampling factors 1,1 */
 1441|    516|        for (ci = 1; ci < sp->cinfo.d.num_components; ci++)
  ------------------
  |  Branch (1441:22): [True: 0, False: 516]
  ------------------
 1442|      0|        {
 1443|      0|            if (sp->cinfo.d.comp_info[ci].h_samp_factor != 1 ||
  ------------------
  |  Branch (1443:17): [True: 0, False: 0]
  ------------------
 1444|      0|                sp->cinfo.d.comp_info[ci].v_samp_factor != 1)
  ------------------
  |  Branch (1444:17): [True: 0, False: 0]
  ------------------
 1445|      0|            {
 1446|      0|                TIFFErrorExtR(tif, module, "Improper JPEG sampling factors");
 1447|      0|                return (0);
 1448|      0|            }
 1449|      0|        }
 1450|    516|    }
 1451|    283|    else
 1452|    283|    {
 1453|       |        /* PC 2's single component should have sampling factors 1,1 */
 1454|    283|        if (sp->cinfo.d.comp_info[0].h_samp_factor != 1 ||
  ------------------
  |  Branch (1454:13): [True: 1, False: 282]
  ------------------
 1455|    282|            sp->cinfo.d.comp_info[0].v_samp_factor != 1)
  ------------------
  |  Branch (1455:13): [True: 1, False: 281]
  ------------------
 1456|      2|        {
 1457|      2|            TIFFErrorExtR(tif, module, "Improper JPEG sampling factors");
 1458|      2|            return (0);
 1459|      2|        }
 1460|    283|    }
 1461|    797|    downsampled_output = FALSE;
  ------------------
  |  |   72|    797|#define FALSE 0
  ------------------
 1462|    797|    if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  1.59k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1462:9): [True: 516, False: 281]
  ------------------
 1463|    516|        sp->photometric == PHOTOMETRIC_YCBCR &&
  ------------------
  |  |  227|  1.31k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1463:9): [True: 0, False: 516]
  ------------------
 1464|      0|        sp->otherSettings.jpegcolormode == JPEGCOLORMODE_RGB)
  ------------------
  |  |  708|      0|#define JPEGCOLORMODE_RGB 0x0001     /* do auto conversion */
  ------------------
  |  Branch (1464:9): [True: 0, False: 0]
  ------------------
 1465|      0|    {
 1466|       |        /* Convert YCbCr to RGB */
 1467|      0|        sp->cinfo.d.jpeg_color_space = JCS_YCbCr;
 1468|      0|        sp->cinfo.d.out_color_space = JCS_RGB;
 1469|      0|    }
 1470|    797|    else
 1471|    797|    {
 1472|       |        /* Suppress colorspace handling */
 1473|    797|        sp->cinfo.d.jpeg_color_space = JCS_UNKNOWN;
 1474|    797|        sp->cinfo.d.out_color_space = JCS_UNKNOWN;
 1475|    797|        if (td->td_planarconfig == PLANARCONFIG_CONTIG &&
  ------------------
  |  |  265|  1.59k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1475:13): [True: 516, False: 281]
  ------------------
 1476|    516|            (sp->h_sampling != 1 || sp->v_sampling != 1))
  ------------------
  |  Branch (1476:14): [True: 0, False: 516]
  |  Branch (1476:37): [True: 0, False: 516]
  ------------------
 1477|      0|            downsampled_output = TRUE;
  ------------------
  |  |   71|      0|#define TRUE 1
  ------------------
 1478|       |        /* XXX what about up-sampling? */
 1479|    797|    }
 1480|    797|    if (downsampled_output)
  ------------------
  |  Branch (1480:9): [True: 0, False: 797]
  ------------------
 1481|      0|    {
 1482|       |        /* Need to use raw-data interface to libjpeg */
 1483|      0|        sp->cinfo.d.raw_data_out = TRUE;
  ------------------
  |  |   71|      0|#define TRUE 1
  ------------------
 1484|       |#if JPEG_LIB_VERSION >= 70
 1485|       |        sp->cinfo.d.do_fancy_upsampling = FALSE;
 1486|       |#endif /* JPEG_LIB_VERSION >= 70 */
 1487|      0|        tif->tif_decoderow = DecodeRowError;
 1488|      0|        tif->tif_decodestrip = JPEGDecodeRaw;
 1489|      0|        tif->tif_decodetile = JPEGDecodeRaw;
 1490|      0|    }
 1491|    797|    else
 1492|    797|    {
 1493|       |        /* Use normal interface to libjpeg */
 1494|    797|        sp->cinfo.d.raw_data_out = FALSE;
  ------------------
  |  |   72|    797|#define FALSE 0
  ------------------
 1495|    797|        tif->tif_decoderow = JPEGDecode;
 1496|    797|        tif->tif_decodestrip = JPEGDecode;
 1497|    797|        tif->tif_decodetile = JPEGDecode;
 1498|    797|    }
 1499|       |    /* Start JPEG decompressor */
 1500|    797|    if (!TIFFjpeg_start_decompress(sp))
  ------------------
  |  Branch (1500:9): [True: 16, False: 781]
  ------------------
 1501|     16|        return (0);
 1502|       |    /* Allocate downsampled-data buffers if needed */
 1503|    781|    if (downsampled_output)
  ------------------
  |  Branch (1503:9): [True: 0, False: 781]
  ------------------
 1504|      0|    {
 1505|      0|        if (!alloc_downsampled_buffers(tif, sp->cinfo.d.comp_info,
  ------------------
  |  Branch (1505:13): [True: 0, False: 0]
  ------------------
 1506|      0|                                       sp->cinfo.d.num_components))
 1507|      0|            return (0);
 1508|      0|        sp->scancount = DCTSIZE; /* mark buffer empty */
 1509|      0|    }
 1510|    781|    return (1);
 1511|    781|}
tif_jpeg_12.c:TIFFjpeg_abort:
  520|    835|{
  521|       |    return CALLVJPEG(sp, jpeg_abort(&sp->cinfo.comm));
  ------------------
  |  |  302|    835|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|    835|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|    835|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (521:12): [True: 0, False: 835]
  ------------------
  522|    835|}
tif_jpeg_12.c:JPEGComputeStrileWidthHeightBytesPerLine:
 1224|    808|{
 1225|    808|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|    808|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1226|    808|    TIFFDirectory *td = &tif->tif_dir;
 1227|       |
 1228|       |    /*
 1229|       |     * Check image parameters and set decompression parameters.
 1230|       |     */
 1231|    808|    if (isTiled(tif))
  ------------------
  |  |  278|    808|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    808|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 0, False: 808]
  |  |  ------------------
  ------------------
 1232|      0|    {
 1233|      0|        sp->strile_width = td->td_tilewidth;
 1234|      0|        sp->strile_height = td->td_tilelength;
 1235|      0|        sp->bytesperline = TIFFTileRowSize(tif);
 1236|      0|    }
 1237|    808|    else
 1238|    808|    {
 1239|    808|        sp->strile_width = td->td_imagewidth;
 1240|    808|        sp->strile_height = td->td_imagelength - tif->tif_dir.td_row;
 1241|    808|        if (sp->strile_height > td->td_rowsperstrip)
  ------------------
  |  Branch (1241:13): [True: 153, False: 655]
  ------------------
 1242|    153|            sp->strile_height = td->td_rowsperstrip;
 1243|    808|        sp->bytesperline = TIFFScanlineSize(tif);
 1244|    808|    }
 1245|    808|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s > 0)
  ------------------
  |  |  266|  1.61k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (1245:9): [True: 283, False: 525]
  |  Branch (1245:57): [True: 0, False: 283]
  ------------------
 1246|      0|    {
 1247|       |        /*
 1248|       |         * For PC 2, scale down the expected strip/tile size
 1249|       |         * to match a downsampled component
 1250|       |         */
 1251|      0|        if (sp->h_sampling == 0 || sp->v_sampling == 0)
  ------------------
  |  Branch (1251:13): [True: 0, False: 0]
  |  Branch (1251:36): [True: 0, False: 0]
  ------------------
 1252|      0|        {
 1253|      0|            TIFFErrorExtR(tif, "JPEGComputeStrileWidthHeightBytesPerLine",
 1254|      0|                          "JPEG horizontal or vertical sampling is zero");
 1255|      0|            return (0);
 1256|      0|        }
 1257|      0|        sp->strile_width = TIFFhowmany_32(sp->strile_width, sp->h_sampling);
  ------------------
  |  |  312|      0|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 0, False: 0]
  |  |  ------------------
  |  |  313|      0|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|      0|         : 0U)
  ------------------
 1258|      0|        sp->strile_height = TIFFhowmany_32(sp->strile_height, sp->v_sampling);
  ------------------
  |  |  312|      0|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 0, False: 0]
  |  |  ------------------
  |  |  313|      0|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|      0|         : 0U)
  ------------------
 1259|      0|    }
 1260|       |
 1261|    808|    return 1;
 1262|    808|}
tif_jpeg_12.c:JPEGWritePacked12Sample:
  499|   122k|{
  500|   122k|    uint16_t v = (uint16_t)sample & 0x0fff;
  501|   122k|    uint8_t *p = buf + (sample_index / 2) * 3;
  502|   122k|    if ((sample_index & 1) != 0)
  ------------------
  |  Branch (502:9): [True: 0, False: 122k]
  ------------------
  503|      0|    {
  504|      0|        p[1] = (uint8_t)((p[1] & 0xf0) | ((v >> 8) & 0x0f));
  505|      0|        p[2] = (uint8_t)(v & 0xff);
  506|      0|    }
  507|   122k|    else
  508|   122k|    {
  509|   122k|        p[0] = (uint8_t)(v >> 4);
  510|   122k|        p[1] = (uint8_t)((v & 0x0f) << 4);
  511|   122k|    }
  512|   122k|}
tif_jpeg_12.c:TIFFjpeg_finish_decompress:
  515|    420|{
  516|       |    return CALLJPEG(sp, -1, (int)jpeg_finish_decompress(&sp->cinfo.d));
  ------------------
  |  |  301|    420|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|    420|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (516:12): [True: 180, False: 240]
  ------------------
  517|    420|}
tif_jpeg_12.c:TIFFjpeg_start_decompress:
  406|    797|{
  407|    797|    const char *sz_max_allowed_scan_number;
  408|       |    /* progress monitor */
  409|    797|    sp->cinfo.d.progress = &sp->progress;
  410|    797|    sp->progress.progress_monitor = TIFFjpeg_progress_monitor;
  411|    797|    sp->otherSettings.max_allowed_scan_number = 100;
  412|    797|    sz_max_allowed_scan_number = getenv("LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER");
  413|    797|    if (sz_max_allowed_scan_number)
  ------------------
  |  Branch (413:9): [True: 0, False: 797]
  ------------------
  414|      0|        sp->otherSettings.max_allowed_scan_number =
  415|      0|            atoi(sz_max_allowed_scan_number);
  416|       |
  417|       |    return CALLVJPEG(sp, jpeg_start_decompress(&sp->cinfo.d));
  ------------------
  |  |  302|    797|#define CALLVJPEG(sp, op) CALLJPEG(sp, 0, ((op), 1))
  |  |  ------------------
  |  |  |  |  301|    797|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  |  |  ------------------
  |  |  |  |  |  |  142|    797|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (417:12): [True: 16, False: 781]
  ------------------
  418|    797|}
tif_jpeg_12.c:TIFFjpeg_progress_monitor:
  274|  2.61M|{
  275|  2.61M|    JPEGState *sp = (JPEGState *)cinfo; /* NB: cinfo assumed first */
  276|  2.61M|    if (cinfo->is_decompressor)
  ------------------
  |  Branch (276:9): [True: 2.61M, False: 0]
  ------------------
  277|  2.61M|    {
  278|  2.61M|        const int scan_no = ((j_decompress_ptr)cinfo)->input_scan_number;
  279|  2.61M|        if (scan_no >= sp->otherSettings.max_allowed_scan_number)
  ------------------
  |  Branch (279:13): [True: 0, False: 2.61M]
  ------------------
  280|      0|        {
  281|      0|            TIFFErrorExtR(
  282|      0|                ((JPEGState *)cinfo)->tif, "TIFFjpeg_progress_monitor",
  283|      0|                "Scan number %d exceeds maximum scans (%d). This limit "
  284|      0|                "can be raised through the "
  285|      0|                "LIBTIFF_JPEG_MAX_ALLOWED_SCAN_NUMBER "
  286|      0|                "environment variable.",
  287|      0|                scan_no, sp->otherSettings.max_allowed_scan_number);
  288|       |
  289|      0|            jpeg_abort(cinfo);           /* clean up libjpeg state */
  290|      0|            LONGJMP(sp->exit_jmpbuf, 1); /* return to libtiff caller */
  ------------------
  |  |  143|      0|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
  291|      0|        }
  292|  2.61M|    }
  293|  2.61M|}
tif_jpeg_12.c:JPEGDecode:
 1591|  1.74M|{
 1592|  1.74M|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|  1.74M|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1593|  1.74M|    tmsize_t nrows;
 1594|  1.74M|    (void)s;
 1595|       |
 1596|       |    /*
 1597|       |    ** Update available information, buffer may have been refilled
 1598|       |    ** between decode requests
 1599|       |    */
 1600|  1.74M|    sp->src.next_input_byte = (const JOCTET *)tif->tif_rawcp;
 1601|  1.74M|    sp->src.bytes_in_buffer = (size_t)tif->tif_rawcc;
 1602|       |
 1603|  1.74M|    if (sp->bytesperline == 0)
  ------------------
  |  Branch (1603:9): [True: 0, False: 1.74M]
  ------------------
 1604|      0|    {
 1605|      0|        memset(buf, 0, (size_t)cc);
 1606|      0|        return 0;
 1607|      0|    }
 1608|       |
 1609|  1.74M|    nrows = cc / sp->bytesperline;
 1610|  1.74M|    if (cc % sp->bytesperline)
  ------------------
  |  Branch (1610:9): [True: 0, False: 1.74M]
  ------------------
 1611|      0|        TIFFWarningExtR(tif, tif->tif_name, "fractional scanline not read");
 1612|       |
 1613|  1.74M|    if (nrows > (tmsize_t)sp->cinfo.d.image_height)
  ------------------
  |  Branch (1613:9): [True: 0, False: 1.74M]
  ------------------
 1614|      0|    {
 1615|       |        /* Initialize the output buffer if the JPEG image is smaller than the
 1616|       |         * strile height. */
 1617|      0|        memset(buf, 0, (size_t)cc);
 1618|      0|        nrows = sp->cinfo.d.image_height;
 1619|      0|    }
 1620|  1.74M|    else if (sp->strile_width > sp->cinfo.d.image_width)
  ------------------
  |  Branch (1620:14): [True: 139k, False: 1.60M]
  ------------------
 1621|   139k|    {
 1622|       |        /* Initialize the output buffer if the JPEG image is smaller than the
 1623|       |         * strile width. */
 1624|   139k|        memset(buf, 0, (size_t)cc);
 1625|   139k|    }
 1626|       |
 1627|       |    /* data is expected to be read in multiples of a scanline */
 1628|  1.74M|    if (nrows)
  ------------------
  |  Branch (1628:9): [True: 1.74M, False: 0]
  ------------------
 1629|  1.74M|    {
 1630|  1.74M|        TIFF_JSAMPROW line_work_buf = NULL;
  ------------------
  |  |  106|  1.74M|#define TIFF_JSAMPROW J12SAMPROW
  ------------------
 1631|       |
 1632|       |        /*
 1633|       |         * For 6B, only use temporary buffer for 12 bit imagery.
 1634|       |         * For Mk1 always use it.
 1635|       |         */
 1636|  1.74M|        if (sp->cinfo.d.data_precision == 12)
  ------------------
  |  Branch (1636:13): [True: 1.74M, False: 0]
  ------------------
 1637|  1.74M|        {
 1638|  1.74M|            line_work_buf = (TIFF_JSAMPROW)_TIFFmallocExt(
 1639|  1.74M|                tif, (tmsize_t)((size_t)sizeof(short) *
 1640|  1.74M|                                (size_t)sp->cinfo.d.output_width *
 1641|  1.74M|                                (size_t)sp->cinfo.d.num_components));
 1642|  1.74M|        }
 1643|       |
 1644|  1.74M|        do
 1645|  1.74M|        {
 1646|  1.74M|            if (line_work_buf != NULL)
  ------------------
  |  Branch (1646:17): [True: 1.74M, False: 0]
  ------------------
 1647|  1.74M|            {
 1648|       |                /*
 1649|       |                 * In the MK1 case, we always read into a 16bit
 1650|       |                 * buffer, and then pack down to 12bit or 8bit.
 1651|       |                 * In 6B case we only read into 16 bit buffer
 1652|       |                 * for 12bit data, which we need to repack.
 1653|       |                 */
 1654|  1.74M|                if (TIFFjpeg_read_scanlines(sp, &line_work_buf, 1) != 1)
  ------------------
  |  Branch (1654:21): [True: 197, False: 1.74M]
  ------------------
 1655|    197|                {
 1656|    197|                    memset(buf, 0, (size_t)cc);
 1657|    197|                    _TIFFfreeExt(tif, line_work_buf);
 1658|    197|                    return (0);
 1659|    197|                }
 1660|       |
 1661|  1.74M|                if (sp->cinfo.d.data_precision == 12)
  ------------------
  |  Branch (1661:21): [True: 1.74M, False: 0]
  ------------------
 1662|  1.74M|                {
 1663|  1.74M|                    tmsize_t value_count =
 1664|  1.74M|                        (tmsize_t)((JDIMENSION)sp->cinfo.d.output_width *
 1665|  1.74M|                                   (JDIMENSION)sp->cinfo.d.num_components);
 1666|  1.74M|                    tmsize_t iPair;
 1667|       |
 1668|   110M|                    for (iPair = 0; iPair < value_count / 2; iPair++)
  ------------------
  |  Branch (1668:37): [True: 108M, False: 1.74M]
  ------------------
 1669|   108M|                    {
 1670|   108M|                        unsigned char *out_ptr =
 1671|   108M|                            ((unsigned char *)buf) + iPair * 3;
 1672|   108M|                        TIFF_JSAMPLE *in_ptr = line_work_buf + iPair * 2;
  ------------------
  |  |  103|   108M|#define TIFF_JSAMPLE J12SAMPLE
  ------------------
 1673|       |
 1674|   108M|                        out_ptr[0] = (unsigned char)((in_ptr[0] & 0xff0) >> 4);
 1675|   108M|                        out_ptr[1] =
 1676|   108M|                            (unsigned char)(((in_ptr[0] & 0xf) << 4) |
 1677|   108M|                                            ((in_ptr[1] & 0xf00) >> 8));
 1678|   108M|                        out_ptr[2] = (unsigned char)(((in_ptr[1] & 0xff) >> 0));
 1679|   108M|                    }
 1680|  1.74M|                    if ((value_count & 1) != 0)
  ------------------
  |  Branch (1680:25): [True: 122k, False: 1.62M]
  ------------------
 1681|   122k|                        JPEGWritePacked12Sample((uint8_t *)buf, value_count - 1,
 1682|   122k|                                                line_work_buf[value_count - 1]);
 1683|  1.74M|                }
 1684|      0|                else if (sp->cinfo.d.data_precision == 8)
  ------------------
  |  Branch (1684:26): [True: 0, False: 0]
  ------------------
 1685|      0|                {
 1686|      0|                    int value_count =
 1687|      0|                        (int)((JDIMENSION)sp->cinfo.d.output_width *
 1688|      0|                              (JDIMENSION)sp->cinfo.d.num_components);
 1689|      0|                    int iValue;
 1690|       |
 1691|      0|                    for (iValue = 0; iValue < value_count; iValue++)
  ------------------
  |  Branch (1691:38): [True: 0, False: 0]
  ------------------
 1692|      0|                    {
 1693|      0|                        ((unsigned char *)buf)[iValue] =
 1694|      0|                            (unsigned char)(line_work_buf[iValue] & 0xff);
 1695|      0|                    }
 1696|      0|                }
 1697|  1.74M|            }
 1698|       |
 1699|  1.74M|            ++tif->tif_dir.td_row;
 1700|  1.74M|            buf += sp->bytesperline;
 1701|  1.74M|            cc -= sp->bytesperline;
 1702|  1.74M|        } while (--nrows > 0);
  ------------------
  |  Branch (1702:18): [True: 0, False: 1.74M]
  ------------------
 1703|       |
 1704|  1.74M|        if (line_work_buf != NULL)
  ------------------
  |  Branch (1704:13): [True: 1.74M, False: 0]
  ------------------
 1705|  1.74M|            _TIFFfreeExt(tif, line_work_buf);
 1706|  1.74M|    }
 1707|       |
 1708|       |    /* Update information on consumed data */
 1709|  1.74M|    tif->tif_rawcp = (uint8_t *)sp->src.next_input_byte;
 1710|  1.74M|    tif->tif_rawcc = (tmsize_t)sp->src.bytes_in_buffer;
 1711|       |
 1712|       |    /* Close down the decompressor if we've finished the strip or tile. */
 1713|  1.74M|    return sp->cinfo.d.output_scanline < sp->cinfo.d.output_height ||
  ------------------
  |  Branch (1713:12): [True: 1.74M, False: 420]
  ------------------
 1714|    420|           TIFFjpeg_finish_decompress(sp);
  ------------------
  |  Branch (1714:12): [True: 420, False: 0]
  ------------------
 1715|  1.74M|}
tif_jpeg_12.c:TIFFjpeg_read_scanlines:
  422|  1.74M|{
  423|  1.74M|#if defined(HAVE_JPEGTURBO_DUAL_MODE_8_12) && BITS_IN_JSAMPLE == 12
  424|  1.74M|    return CALLJPEG(sp, -1,
  ------------------
  |  |  301|  1.74M|#define CALLJPEG(sp, fail, op) (SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
  |  |  ------------------
  |  |  |  |  142|  1.74M|#define SETJMP(jbuf) setjmp(jbuf)
  |  |  ------------------
  ------------------
  |  Branch (424:12): [True: 197, False: 1.74M]
  ------------------
  425|  1.74M|                    (int)jpeg12_read_scanlines(&sp->cinfo.d, scanlines,
  426|  1.74M|                                               (JDIMENSION)max_lines));
  427|       |#else
  428|       |    return CALLJPEG(sp, -1,
  429|       |                    (int)jpeg_read_scanlines(&sp->cinfo.d, scanlines,
  430|       |                                             (JDIMENSION)max_lines));
  431|       |#endif
  432|  1.74M|}
tif_jpeg_12.c:JPEGCleanup:
 2678|    787|{
 2679|    787|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|    787|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2680|       |
 2681|    787|    assert(sp != 0);
  ------------------
  |  Branch (2681:5): [True: 0, False: 787]
  |  Branch (2681:5): [True: 787, False: 0]
  ------------------
 2682|       |
 2683|    787|    tif->tif_tagmethods.vgetfield = sp->otherSettings.vgetparent;
 2684|    787|    tif->tif_tagmethods.vsetfield = sp->otherSettings.vsetparent;
 2685|    787|    tif->tif_tagmethods.printdir = sp->otherSettings.printdir;
 2686|    787|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2686:9): [True: 787, False: 0]
  ------------------
 2687|    787|        TIFFjpeg_destroy(sp);         /* release libjpeg resources */
 2688|    787|    if (sp->otherSettings.jpegtables) /* tag value */
  ------------------
  |  Branch (2688:9): [True: 590, False: 197]
  ------------------
 2689|    590|        _TIFFfreeExt(tif, sp->otherSettings.jpegtables);
 2690|    787|    _TIFFfreeExt(tif, tif->tif_data); /* release local state */
 2691|    787|    tif->tif_data = NULL;
 2692|       |
 2693|    787|    _TIFFSetDefaultCompressionState(tif);
 2694|    787|}
tif_jpeg_12.c:JPEGInitializeLibJPEG:
 2883|    787|{
 2884|    787|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|    787|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 2885|       |
 2886|    787|    if (sp->cinfo_initialized)
  ------------------
  |  Branch (2886:9): [True: 0, False: 787]
  ------------------
 2887|      0|    {
 2888|      0|        if (!decompress && sp->cinfo.comm.is_decompressor)
  ------------------
  |  Branch (2888:13): [True: 0, False: 0]
  |  Branch (2888:28): [True: 0, False: 0]
  ------------------
 2889|      0|            TIFFjpeg_destroy(sp);
 2890|      0|        else if (decompress && !sp->cinfo.comm.is_decompressor)
  ------------------
  |  Branch (2890:18): [True: 0, False: 0]
  |  Branch (2890:32): [True: 0, False: 0]
  ------------------
 2891|      0|            TIFFjpeg_destroy(sp);
 2892|      0|        else
 2893|      0|            return 1;
 2894|       |
 2895|      0|        sp->cinfo_initialized = 0;
 2896|      0|    }
 2897|       |
 2898|       |    /*
 2899|       |     * Initialize libjpeg.
 2900|       |     */
 2901|    787|    if (decompress)
  ------------------
  |  Branch (2901:9): [True: 787, False: 0]
  ------------------
 2902|    787|    {
 2903|    787|        if (!TIFFjpeg_create_decompress(sp))
  ------------------
  |  Branch (2903:13): [True: 0, False: 787]
  ------------------
 2904|      0|            return (0);
 2905|    787|    }
 2906|      0|    else
 2907|      0|    {
 2908|      0|        if (!TIFFjpeg_create_compress(sp))
  ------------------
  |  Branch (2908:13): [True: 0, False: 0]
  ------------------
 2909|      0|            return (0);
 2910|      0|#ifndef TIFF_JPEG_MAX_MEMORY_TO_USE
 2911|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
 2912|      0|#endif
 2913|       |        /* libjpeg turbo 1.5.2 honours max_memory_to_use, but has no backing */
 2914|       |        /* store implementation, so better not set max_memory_to_use ourselves.
 2915|       |         */
 2916|       |        /* See https://github.com/libjpeg-turbo/libjpeg-turbo/issues/162 */
 2917|      0|        if (sp->cinfo.c.mem->max_memory_to_use > 0)
  ------------------
  |  Branch (2917:13): [True: 0, False: 0]
  ------------------
 2918|      0|        {
 2919|       |            /* This is to address bug related in ticket GDAL #1795. */
 2920|      0|            if (getenv("JPEGMEM") == NULL)
  ------------------
  |  Branch (2920:17): [True: 0, False: 0]
  ------------------
 2921|      0|            {
 2922|       |                /* Increase the max memory usable. This helps when creating
 2923|       |                 * files */
 2924|       |                /* with "big" tile, without using libjpeg temporary files. */
 2925|       |                /* For example a 512x512 tile with 3 bands */
 2926|       |                /* requires 1.5 MB which is above libjpeg 1MB default */
 2927|      0|                if (sp->cinfo.c.mem->max_memory_to_use <
  ------------------
  |  Branch (2927:21): [True: 0, False: 0]
  ------------------
 2928|      0|                    TIFF_JPEG_MAX_MEMORY_TO_USE)
  ------------------
  |  | 2911|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
  ------------------
 2929|      0|                    sp->cinfo.c.mem->max_memory_to_use =
 2930|      0|                        TIFF_JPEG_MAX_MEMORY_TO_USE;
  ------------------
  |  | 2911|      0|#define TIFF_JPEG_MAX_MEMORY_TO_USE (10 * 1024 * 1024)
  ------------------
 2931|      0|            }
 2932|      0|        }
 2933|      0|    }
 2934|       |
 2935|    787|    sp->cinfo_initialized = TRUE;
  ------------------
  |  |   71|    787|#define TRUE 1
  ------------------
 2936|       |
 2937|    787|    return 1;
 2938|    787|}
tif_jpeg_12.c:JPEGSetupDecode:
 1136|    787|{
 1137|    787|    JPEGState *sp = JState(tif);
  ------------------
  |  |  208|    787|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
 1138|    787|    TIFFDirectory *td = &tif->tif_dir;
 1139|       |
 1140|       |#if defined(JPEG_DUAL_MODE_8_12) && !defined(FROM_TIF_JPEG_12)
 1141|       |    if (tif->tif_dir.td_bitspersample == 12)
 1142|       |    {
 1143|       |        /* We pass a pointer to a copy of otherSettings, since */
 1144|       |        /* TIFFReInitJPEG_12() will clear sp */
 1145|       |        JPEGOtherSettings savedOtherSettings = sp->otherSettings;
 1146|       |        return TIFFReInitJPEG_12(tif, &savedOtherSettings, COMPRESSION_JPEG, 0);
 1147|       |    }
 1148|       |#endif
 1149|       |
 1150|    787|    JPEGInitializeLibJPEG(tif, TRUE);
  ------------------
  |  |   71|    787|#define TRUE 1
  ------------------
 1151|       |
 1152|    787|    assert(sp != NULL);
  ------------------
  |  Branch (1152:5): [True: 0, False: 787]
  |  Branch (1152:5): [True: 787, False: 0]
  ------------------
 1153|    787|    assert(sp->cinfo.comm.is_decompressor);
  ------------------
  |  Branch (1153:5): [True: 0, False: 787]
  |  Branch (1153:5): [True: 787, False: 0]
  ------------------
 1154|       |
 1155|       |    /* Read JPEGTables if it is present */
 1156|    787|    if (TIFFFieldSet(tif, FIELD_JPEGTABLES))
  ------------------
  |  |  248|    787|#define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  247|    787|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFFieldSet(tif, field) (BITFIELDn(tif, field) & BITn(field))
  |  |  ------------------
  |  |  |  |  246|    787|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  |  |  |  Branch (248:34): [True: 590, False: 197]
  |  |  ------------------
  ------------------
 1157|    590|    {
 1158|    590|        TIFFjpeg_tables_src(sp);
 1159|    590|        if (TIFFjpeg_read_header(sp, FALSE) != JPEG_HEADER_TABLES_ONLY)
  ------------------
  |  |   72|    590|#define FALSE 0
  ------------------
  |  Branch (1159:13): [True: 3, False: 587]
  ------------------
 1160|      3|        {
 1161|      3|            TIFFErrorExtR(tif, "JPEGSetupDecode", "Bogus JPEGTables field");
 1162|      3|            return (0);
 1163|      3|        }
 1164|    590|    }
 1165|       |
 1166|       |    /* Grab parameters that are same for all strips/tiles */
 1167|    784|    sp->photometric = td->td_photometric;
 1168|    784|    switch (sp->photometric)
 1169|    784|    {
 1170|      1|        case PHOTOMETRIC_YCBCR:
  ------------------
  |  |  227|      1|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1170:9): [True: 1, False: 783]
  ------------------
 1171|      1|            sp->h_sampling = td->td_ycbcrsubsampling[0];
 1172|      1|            sp->v_sampling = td->td_ycbcrsubsampling[1];
 1173|      1|            break;
 1174|    783|        default:
  ------------------
  |  Branch (1174:9): [True: 783, False: 1]
  ------------------
 1175|       |            /* TIFF 6.0 forbids subsampling of all other color spaces */
 1176|    783|            sp->h_sampling = 1;
 1177|    783|            sp->v_sampling = 1;
 1178|    783|            break;
 1179|    784|    }
 1180|       |
 1181|       |    /* Set up for reading normal data */
 1182|    784|    TIFFjpeg_data_src(sp);
 1183|    784|    tif->tif_postdecode = _TIFFNoPostDecode; /* override byte swapping */
 1184|    784|    return (1);
 1185|    784|}
tif_jpeg_12.c:TIFFjpeg_tables_src:
  769|    590|{
  770|    590|    TIFFjpeg_data_src(sp);
  771|    590|    sp->src.init_source = tables_init_source;
  772|    590|}
tif_jpeg_12.c:tables_init_source:
  761|    590|{
  762|    590|    JPEGState *sp = (JPEGState *)cinfo;
  763|       |
  764|    590|    sp->src.next_input_byte = (const JOCTET *)sp->otherSettings.jpegtables;
  765|    590|    sp->src.bytes_in_buffer = (size_t)sp->otherSettings.jpegtables_length;
  766|    590|}

TIFFReInitJPEG_12:
   32|    787|{
   33|    787|    JPEGState *sp;
   34|    787|    uint8_t *new_tif_data;
   35|       |
   36|    787|    (void)scheme;
   37|    787|    assert(scheme == COMPRESSION_JPEG);
  ------------------
  |  Branch (37:5): [True: 0, False: 787]
  |  Branch (37:5): [True: 787, False: 0]
  ------------------
   38|       |
   39|    787|    new_tif_data =
   40|    787|        (uint8_t *)_TIFFreallocExt(tif, tif->tif_data, sizeof(JPEGState));
   41|       |
   42|    787|    if (new_tif_data == NULL)
  ------------------
  |  Branch (42:9): [True: 0, False: 787]
  ------------------
   43|      0|    {
   44|      0|        TIFFErrorExtR(tif, "TIFFReInitJPEG_12",
   45|      0|                      "No space for JPEG state block");
   46|      0|        return 0;
   47|      0|    }
   48|       |
   49|    787|    tif->tif_data = new_tif_data;
   50|    787|    _TIFFmemset(tif->tif_data, 0, sizeof(JPEGState));
   51|       |
   52|    787|    TIFFInitJPEGCommon(tif);
   53|       |
   54|    787|    sp = JState(tif);
  ------------------
  |  |  208|    787|#define JState(tif) ((JPEGState *)(tif)->tif_data)
  ------------------
   55|    787|    sp->otherSettings = *otherSettings;
   56|       |
   57|    787|    if (is_encode)
  ------------------
  |  Branch (57:9): [True: 0, False: 787]
  ------------------
   58|      0|        return JPEGSetupEncode(tif);
   59|    787|    else
   60|    787|        return JPEGSetupDecode(tif);
   61|    787|}

LogL16toY:
  790|   668k|{
  791|   668k|    int Le = p16 & 0x7fff;
  792|   668k|    double Y;
  793|       |
  794|   668k|    if (!Le)
  ------------------
  |  Branch (794:9): [True: 21.5k, False: 646k]
  ------------------
  795|  21.5k|        return (0.);
  796|   646k|    Y = exp(M_LN2 / 256. * (Le + .5) - M_LN2 * 64.);
  797|   646k|    return (!(p16 & 0x8000) ? Y : -Y);
  ------------------
  |  Branch (797:13): [True: 154k, False: 492k]
  ------------------
  798|   668k|}
XYZtoRGB24:
  945|     21|{
  946|     21|    double r, g, b;
  947|       |    /* assume CCIR-709 primaries */
  948|     21|    r = 2.690 * (double)xyz[0] + -1.276 * (double)xyz[1] +
  949|     21|        -0.414 * (double)xyz[2];
  950|     21|    g = -1.022 * (double)xyz[0] + 1.978 * (double)xyz[1] +
  951|     21|        0.044 * (double)xyz[2];
  952|     21|    b = 0.061 * (double)xyz[0] + -0.224 * (double)xyz[1] +
  953|     21|        1.163 * (double)xyz[2];
  954|       |    /* assume 2.0 gamma for speed */
  955|       |    /* could use integer sqrt approx., but this is probably faster */
  956|     21|    rgb[0] = (uint8_t)((r <= 0.) ? 0 : (r >= 1.) ? 255 : (int)(256. * sqrt(r)));
  ------------------
  |  Branch (956:24): [True: 8, False: 13]
  |  Branch (956:40): [True: 0, False: 13]
  ------------------
  957|     21|    rgb[1] = (uint8_t)((g <= 0.) ? 0 : (g >= 1.) ? 255 : (int)(256. * sqrt(g)));
  ------------------
  |  Branch (957:24): [True: 20, False: 1]
  |  Branch (957:40): [True: 0, False: 1]
  ------------------
  958|     21|    rgb[2] = (uint8_t)((b <= 0.) ? 0 : (b >= 1.) ? 255 : (int)(256. * sqrt(b)));
  ------------------
  |  Branch (958:24): [True: 7, False: 14]
  |  Branch (958:40): [True: 0, False: 14]
  ------------------
  959|     21|}
LogL10toY:
  965|    533|{
  966|    533|    if (p10 == 0)
  ------------------
  |  Branch (966:9): [True: 141, False: 392]
  ------------------
  967|    141|        return (0.);
  968|    392|    return (exp(M_LN2 / 64. * (p10 + .5) - M_LN2 * 12.));
  969|    533|}
uv_decode:
 1080|  2.00k|{
 1081|  2.00k|    unsigned int upper, lower;
 1082|  2.00k|    int ui;
 1083|  2.00k|    unsigned int vi;
 1084|       |
 1085|  2.00k|    if (c < 0 || c >= UV_NDIVS)
  ------------------
  |  |    3|  2.00k|#define UV_NDIVS 16289
  ------------------
  |  Branch (1085:9): [True: 0, False: 2.00k]
  |  Branch (1085:18): [True: 327, False: 1.67k]
  ------------------
 1086|    327|        return (-1);
 1087|  1.67k|    lower = 0; /* binary search */
 1088|  1.67k|    upper = UV_NVS;
  ------------------
  |  |    5|  1.67k|#define UV_NVS 163
  ------------------
 1089|  13.2k|    while (upper - lower > 1)
  ------------------
  |  Branch (1089:12): [True: 11.8k, False: 1.39k]
  ------------------
 1090|  11.8k|    {
 1091|  11.8k|        vi = (lower + upper) >> 1;
 1092|  11.8k|        ui = c - uv_row[vi].ncum;
 1093|  11.8k|        if (ui > 0)
  ------------------
  |  Branch (1093:13): [True: 4.35k, False: 7.54k]
  ------------------
 1094|  4.35k|            lower = vi;
 1095|  7.54k|        else if (ui < 0)
  ------------------
  |  Branch (1095:18): [True: 7.26k, False: 279]
  ------------------
 1096|  7.26k|            upper = vi;
 1097|    279|        else
 1098|    279|        {
 1099|    279|            lower = vi;
 1100|    279|            break;
 1101|    279|        }
 1102|  11.8k|    }
 1103|  1.67k|    vi = lower;
 1104|  1.67k|    ui = c - uv_row[vi].ncum;
 1105|  1.67k|    *up = (double)uv_row[vi].ustart + ((double)ui + .5) * (double)UV_SQSIZ;
  ------------------
  |  |    2|  1.67k|#define UV_SQSIZ (float)0.003500
  ------------------
 1106|  1.67k|    *vp = (double)UV_VSTART + ((double)vi + .5) * (double)UV_SQSIZ;
  ------------------
  |  |    4|  1.67k|#define UV_VSTART (float)0.016940
  ------------------
                  *vp = (double)UV_VSTART + ((double)vi + .5) * (double)UV_SQSIZ;
  ------------------
  |  |    2|  1.67k|#define UV_SQSIZ (float)0.003500
  ------------------
 1107|  1.67k|    return (0);
 1108|  2.00k|}
LogLuv24toXYZ:
 1114|    533|{
 1115|    533|    int Ce;
 1116|    533|    double L, u, v, s, x, y;
 1117|       |    /* decode luminance */
 1118|    533|    L = LogL10toY(p >> 14 & 0x3ff);
 1119|    533|    if (L <= 0.)
  ------------------
  |  Branch (1119:9): [True: 141, False: 392]
  ------------------
 1120|    141|    {
 1121|    141|        XYZ[0] = XYZ[1] = XYZ[2] = 0.;
 1122|    141|        return;
 1123|    141|    }
 1124|       |    /* decode color */
 1125|    392|    Ce = p & 0x3fff;
 1126|    392|    if (uv_decode(&u, &v, Ce) < 0)
  ------------------
  |  Branch (1126:9): [True: 26, False: 366]
  ------------------
 1127|     26|    {
 1128|     26|        u = U_NEU;
  ------------------
  |  |  613|     26|#define U_NEU 0.210526316
  ------------------
 1129|     26|        v = V_NEU;
  ------------------
  |  |  614|     26|#define V_NEU 0.473684211
  ------------------
 1130|     26|    }
 1131|    392|    s = 1. / (6. * u - 16. * v + 12.);
 1132|    392|    x = 9. * u * s;
 1133|    392|    y = 4. * v * s;
 1134|       |    /* convert to XYZ */
 1135|    392|    XYZ[0] = (float)(x / y * L);
 1136|    392|    XYZ[1] = (float)L;
 1137|    392|    XYZ[2] = (float)((1. - x - y) / y * L);
 1138|    392|}
LogLuv32toXYZ:
 1274|    670|{
 1275|    670|    double L, u, v, s, x, y;
 1276|       |    /* decode luminance */
 1277|    670|    L = LogL16toY((int)p >> 16);
 1278|    670|    if (L <= 0.)
  ------------------
  |  Branch (1278:9): [True: 402, False: 268]
  ------------------
 1279|    402|    {
 1280|    402|        XYZ[0] = XYZ[1] = XYZ[2] = 0.;
 1281|    402|        return;
 1282|    402|    }
 1283|       |    /* decode color */
 1284|    268|    u = 1. / UVSCALE * ((p >> 8 & 0xff) + .5);
  ------------------
  |  |  615|    268|#define UVSCALE 410.
  ------------------
 1285|    268|    v = 1. / UVSCALE * ((p & 0xff) + .5);
  ------------------
  |  |  615|    268|#define UVSCALE 410.
  ------------------
 1286|    268|    s = 1. / (6. * u - 16. * v + 12.);
 1287|    268|    x = 9. * u * s;
 1288|    268|    y = 4. * v * s;
 1289|       |    /* convert to XYZ */
 1290|    268|    XYZ[0] = (float)(x / y * L);
 1291|    268|    XYZ[1] = (float)L;
 1292|    268|    XYZ[2] = (float)((1. - x - y) / y * L);
 1293|    268|}
TIFFInitSGILog:
 1917|     45|{
 1918|     45|    static const char module[] = "TIFFInitSGILog";
 1919|     45|    LogLuvState *sp;
 1920|       |
 1921|     45|    assert(scheme == COMPRESSION_SGILOG24 || scheme == COMPRESSION_SGILOG);
  ------------------
  |  Branch (1921:5): [True: 45, False: 0]
  |  Branch (1921:5): [True: 0, False: 0]
  |  Branch (1921:5): [True: 23, False: 22]
  |  Branch (1921:5): [True: 22, False: 0]
  ------------------
 1922|       |
 1923|       |    /*
 1924|       |     * Merge codec-specific tag information.
 1925|       |     */
 1926|     45|    if (!_TIFFMergeFields(tif, LogLuvFields, TIFFArrayCount(LogLuvFields)))
  ------------------
  |  |  339|     45|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1926:9): [True: 0, False: 45]
  ------------------
 1927|      0|    {
 1928|      0|        TIFFErrorExtR(tif, module, "Merging SGILog codec-specific tags failed");
 1929|      0|        return 0;
 1930|      0|    }
 1931|       |
 1932|       |    /*
 1933|       |     * Allocate state block so tag methods have storage to record values.
 1934|       |     */
 1935|     45|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LogLuvState));
 1936|     45|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (1936:9): [True: 0, False: 45]
  ------------------
 1937|      0|        goto bad;
 1938|     45|    sp = (LogLuvState *)tif->tif_data;
 1939|     45|    _TIFFmemset((void *)sp, 0, sizeof(*sp));
 1940|     45|    sp->user_datafmt = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|     45|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1941|     45|    sp->encode_meth = (scheme == COMPRESSION_SGILOG24) ? SGILOGENCODE_RANDITHER
  ------------------
  |  |  211|     45|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
                  sp->encode_meth = (scheme == COMPRESSION_SGILOG24) ? SGILOGENCODE_RANDITHER
  ------------------
  |  |  750|     23|#define SGILOGENCODE_RANDITHER 1       /* randomly dither encd values */
  ------------------
  |  Branch (1941:23): [True: 23, False: 22]
  ------------------
 1942|     45|                                                       : SGILOGENCODE_NODITHER;
  ------------------
  |  |  749|     67|#define SGILOGENCODE_NODITHER 0        /* do not dither encoded values*/
  ------------------
 1943|     45|    sp->tfunc = _logLuvNop;
 1944|       |
 1945|       |    /*
 1946|       |     * Install codec methods.
 1947|       |     * NB: tif_decoderow & tif_encoderow are filled
 1948|       |     *     in at setup time.
 1949|       |     */
 1950|     45|    tif->tif_fixuptags = LogLuvFixupTags;
 1951|     45|    tif->tif_setupdecode = LogLuvSetupDecode;
 1952|     45|    tif->tif_decodestrip = LogLuvDecodeStrip;
 1953|     45|    tif->tif_decodetile = LogLuvDecodeTile;
 1954|     45|    tif->tif_setupencode = LogLuvSetupEncode;
 1955|     45|    tif->tif_encodestrip = LogLuvEncodeStrip;
 1956|     45|    tif->tif_encodetile = LogLuvEncodeTile;
 1957|     45|    tif->tif_close = LogLuvClose;
 1958|     45|    tif->tif_cleanup = LogLuvCleanup;
 1959|       |
 1960|       |    /*
 1961|       |     * Override parent get/set field methods.
 1962|       |     */
 1963|     45|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1964|     45|    tif->tif_tagmethods.vgetfield = LogLuvVGetField; /* hook for codec tags */
 1965|     45|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1966|     45|    tif->tif_tagmethods.vsetfield = LogLuvVSetField; /* hook for codec tags */
 1967|       |
 1968|     45|    return (1);
 1969|      0|bad:
 1970|      0|    TIFFErrorExtR(tif, module, "%s: No space for LogLuv state block",
 1971|      0|                  tif->tif_name);
 1972|      0|    return (0);
 1973|     45|}
tif_luv.c:LogLuvFixupTags:
 1630|     38|{
 1631|     38|    (void)tif;
 1632|     38|    return (1);
 1633|     38|}
tif_luv.c:LogLuvSetupDecode:
 1636|     37|{
 1637|     37|    static const char module[] = "LogLuvSetupDecode";
 1638|     37|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|     37|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1639|     37|    TIFFDirectory *td = &tif->tif_dir;
 1640|       |
 1641|     37|    tif->tif_postdecode = _TIFFNoPostDecode;
 1642|     37|    switch (td->td_photometric)
 1643|     37|    {
 1644|     21|        case PHOTOMETRIC_LOGLUV:
  ------------------
  |  |  233|     21|#define PHOTOMETRIC_LOGLUV 32845           /* CIE Log2(L) (u',v') */
  ------------------
  |  Branch (1644:9): [True: 21, False: 16]
  ------------------
 1645|     21|            if (!LogLuvInitState(tif))
  ------------------
  |  Branch (1645:17): [True: 1, False: 20]
  ------------------
 1646|      1|                break;
 1647|     20|            if (td->td_compression == COMPRESSION_SGILOG24)
  ------------------
  |  |  211|     20|#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
  ------------------
  |  Branch (1647:17): [True: 14, False: 6]
  ------------------
 1648|     14|            {
 1649|     14|                tif->tif_decoderow = LogLuvDecode24;
 1650|     14|                switch (sp->user_datafmt)
 1651|     14|                {
 1652|      2|                    case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|      2|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1652:21): [True: 2, False: 12]
  ------------------
 1653|      2|                        sp->tfunc = Luv24toXYZ;
 1654|      2|                        break;
 1655|      9|                    case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|      9|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1655:21): [True: 9, False: 5]
  ------------------
 1656|      9|                        sp->tfunc = Luv24toLuv48;
 1657|      9|                        break;
 1658|      1|                    case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|      1|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1658:21): [True: 1, False: 13]
  ------------------
 1659|      1|                        sp->tfunc = Luv24toRGB;
 1660|      1|                        break;
 1661|      2|                    default:
  ------------------
  |  Branch (1661:21): [True: 2, False: 12]
  ------------------
 1662|      2|                        break;
 1663|     14|                }
 1664|     14|            }
 1665|      6|            else
 1666|      6|            {
 1667|      6|                tif->tif_decoderow = LogLuvDecode32;
 1668|      6|                switch (sp->user_datafmt)
 1669|      6|                {
 1670|      2|                    case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|      2|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1670:21): [True: 2, False: 4]
  ------------------
 1671|      2|                        sp->tfunc = Luv32toXYZ;
 1672|      2|                        break;
 1673|      2|                    case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|      2|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1673:21): [True: 2, False: 4]
  ------------------
 1674|      2|                        sp->tfunc = Luv32toLuv48;
 1675|      2|                        break;
 1676|      0|                    case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|      0|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1676:21): [True: 0, False: 6]
  ------------------
 1677|      0|                        sp->tfunc = Luv32toRGB;
 1678|      0|                        break;
 1679|      2|                    default:
  ------------------
  |  Branch (1679:21): [True: 2, False: 4]
  ------------------
 1680|      2|                        break;
 1681|      6|                }
 1682|      6|            }
 1683|     20|            return (1);
 1684|     16|        case PHOTOMETRIC_LOGL:
  ------------------
  |  |  232|     16|#define PHOTOMETRIC_LOGL 32844             /* CIE Log2(L) */
  ------------------
  |  Branch (1684:9): [True: 16, False: 21]
  ------------------
 1685|     16|            if (!LogL16InitState(tif))
  ------------------
  |  Branch (1685:17): [True: 2, False: 14]
  ------------------
 1686|      2|                break;
 1687|     14|            tif->tif_decoderow = LogL16Decode;
 1688|     14|            switch (sp->user_datafmt)
 1689|     14|            {
 1690|      3|                case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|      3|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1690:17): [True: 3, False: 11]
  ------------------
 1691|      3|                    sp->tfunc = L16toY;
 1692|      3|                    break;
 1693|     10|                case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|     10|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1693:17): [True: 10, False: 4]
  ------------------
 1694|     10|                    sp->tfunc = L16toGry;
 1695|     10|                    break;
 1696|      1|                default:
  ------------------
  |  Branch (1696:17): [True: 1, False: 13]
  ------------------
 1697|      1|                    break;
 1698|     14|            }
 1699|     14|            return (1);
 1700|      0|        default:
  ------------------
  |  Branch (1700:9): [True: 0, False: 37]
  ------------------
 1701|      0|            TIFFErrorExtR(tif, module,
 1702|      0|                          "Inappropriate photometric interpretation %" PRIu16
 1703|      0|                          " for SGILog compression; %s",
 1704|      0|                          td->td_photometric, "must be either LogLUV or LogL");
 1705|      0|            break;
 1706|     37|    }
 1707|      3|    return (0);
 1708|     37|}
tif_luv.c:LogLuvInitState:
 1576|     21|{
 1577|     21|    static const char module[] = "LogLuvInitState";
 1578|     21|    TIFFDirectory *td = &tif->tif_dir;
 1579|     21|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|     21|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1580|       |
 1581|     21|    assert(sp != NULL);
  ------------------
  |  Branch (1581:5): [True: 0, False: 21]
  |  Branch (1581:5): [True: 21, False: 0]
  ------------------
 1582|     21|    assert(td->td_photometric == PHOTOMETRIC_LOGLUV);
  ------------------
  |  Branch (1582:5): [True: 0, False: 21]
  |  Branch (1582:5): [True: 21, False: 0]
  ------------------
 1583|       |
 1584|       |    /* for some reason, we can't do this in TIFFInitLogLuv */
 1585|     21|    if (td->td_planarconfig != PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|     21|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1585:9): [True: 0, False: 21]
  ------------------
 1586|      0|    {
 1587|      0|        TIFFErrorExtR(tif, module,
 1588|      0|                      "SGILog compression cannot handle non-contiguous data");
 1589|      0|        return (0);
 1590|      0|    }
 1591|     21|    if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
  ------------------
  |  |  178|     21|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (1591:9): [True: 20, False: 1]
  ------------------
 1592|     20|        sp->user_datafmt = LogLuvGuessDataFmt(td);
 1593|     21|    switch (sp->user_datafmt)
 1594|     21|    {
 1595|      4|        case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|      4|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1595:9): [True: 4, False: 17]
  ------------------
 1596|      4|            sp->pixel_size = 3 * sizeof(float);
 1597|      4|            break;
 1598|     11|        case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|     11|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1598:9): [True: 11, False: 10]
  ------------------
 1599|     11|            sp->pixel_size = 3 * sizeof(int16_t);
 1600|     11|            break;
 1601|      4|        case SGILOGDATAFMT_RAW:
  ------------------
  |  |  746|      4|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (1601:9): [True: 4, False: 17]
  ------------------
 1602|      4|            sp->pixel_size = sizeof(uint32_t);
 1603|      4|            break;
 1604|      1|        case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|      1|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1604:9): [True: 1, False: 20]
  ------------------
 1605|      1|            sp->pixel_size = 3 * sizeof(uint8_t);
 1606|      1|            break;
 1607|      1|        default:
  ------------------
  |  Branch (1607:9): [True: 1, False: 20]
  ------------------
 1608|      1|            TIFFErrorExtR(
 1609|      1|                tif, module,
 1610|      1|                "No support for converting user data format to LogLuv");
 1611|      1|            return (0);
 1612|     21|    }
 1613|     20|    if (isTiled(tif))
  ------------------
  |  |  278|     20|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     20|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 1, False: 19]
  |  |  ------------------
  ------------------
 1614|      1|        sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength);
 1615|     19|    else if (td->td_rowsperstrip < td->td_imagelength)
  ------------------
  |  Branch (1615:14): [True: 0, False: 19]
  ------------------
 1616|      0|        sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
 1617|     19|    else
 1618|     19|        sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_imagelength);
 1619|     20|    if (multiply_ms(sp->tbuflen, sizeof(uint32_t)) == 0 ||
  ------------------
  |  Branch (1619:9): [True: 0, False: 20]
  ------------------
 1620|     20|        (sp->tbuf = (uint8_t *)_TIFFmallocExt(
  ------------------
  |  Branch (1620:9): [True: 0, False: 20]
  ------------------
 1621|     20|             tif, (tmsize_t)((size_t)sp->tbuflen * sizeof(uint32_t)))) == NULL)
 1622|      0|    {
 1623|      0|        TIFFErrorExtR(tif, module, "No space for SGILog translation buffer");
 1624|      0|        return (0);
 1625|      0|    }
 1626|     20|    return (1);
 1627|     20|}
tif_luv.c:LogLuvGuessDataFmt:
 1523|     20|{
 1524|     20|    int guess;
 1525|       |
 1526|       |    /*
 1527|       |     * If the user didn't tell us their datafmt,
 1528|       |     * take our best guess from the bitspersample.
 1529|       |     */
 1530|     20|#define PACK(a, b) (((a) << 3) | (b))
 1531|     20|    switch (PACK(td->td_bitspersample, td->td_sampleformat))
  ------------------
  |  | 1530|     20|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
 1532|     20|    {
 1533|      4|        case PACK(32, SAMPLEFORMAT_IEEEFP):
  ------------------
  |  | 1530|      4|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1533:9): [True: 4, False: 16]
  ------------------
 1534|      4|            guess = SGILOGDATAFMT_FLOAT;
  ------------------
  |  |  744|      4|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
 1535|      4|            break;
 1536|      2|        case PACK(32, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1530|      2|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1536:9): [True: 2, False: 18]
  ------------------
 1537|      5|        case PACK(32, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1530|      5|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1537:9): [True: 3, False: 17]
  ------------------
 1538|      5|        case PACK(32, SAMPLEFORMAT_INT):
  ------------------
  |  | 1530|      5|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1538:9): [True: 0, False: 20]
  ------------------
 1539|      5|            guess = SGILOGDATAFMT_RAW;
  ------------------
  |  |  746|      5|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
 1540|      5|            break;
 1541|      0|        case PACK(16, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1530|      0|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1541:9): [True: 0, False: 20]
  ------------------
 1542|      0|        case PACK(16, SAMPLEFORMAT_INT):
  ------------------
  |  | 1530|      0|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1542:9): [True: 0, False: 20]
  ------------------
 1543|     11|        case PACK(16, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1530|     11|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1543:9): [True: 11, False: 9]
  ------------------
 1544|     11|            guess = SGILOGDATAFMT_16BIT;
  ------------------
  |  |  745|     11|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
 1545|     11|            break;
 1546|      0|        case PACK(8, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1530|      0|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1546:9): [True: 0, False: 20]
  ------------------
 1547|      0|        case PACK(8, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1530|      0|#define PACK(a, b) (((a) << 3) | (b))
  ------------------
  |  Branch (1547:9): [True: 0, False: 20]
  ------------------
 1548|      0|            guess = SGILOGDATAFMT_8BIT;
  ------------------
  |  |  747|      0|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
 1549|      0|            break;
 1550|      0|        default:
  ------------------
  |  Branch (1550:9): [True: 0, False: 20]
  ------------------
 1551|      0|            guess = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|      0|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1552|      0|            break;
 1553|     20|#undef PACK
 1554|     20|    }
 1555|       |    /*
 1556|       |     * Double-check samples per pixel.
 1557|       |     */
 1558|     20|    switch (td->td_samplesperpixel)
 1559|     20|    {
 1560|      4|        case 1:
  ------------------
  |  Branch (1560:9): [True: 4, False: 16]
  ------------------
 1561|      4|            if (guess != SGILOGDATAFMT_RAW)
  ------------------
  |  |  746|      4|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (1561:17): [True: 0, False: 4]
  ------------------
 1562|      0|                guess = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|      0|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1563|      4|            break;
 1564|     16|        case 3:
  ------------------
  |  Branch (1564:9): [True: 16, False: 4]
  ------------------
 1565|     16|            if (guess == SGILOGDATAFMT_RAW)
  ------------------
  |  |  746|     16|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (1565:17): [True: 1, False: 15]
  ------------------
 1566|      1|                guess = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|      1|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1567|     16|            break;
 1568|      0|        default:
  ------------------
  |  Branch (1568:9): [True: 0, False: 20]
  ------------------
 1569|      0|            guess = SGILOGDATAFMT_UNKNOWN;
  ------------------
  |  |  178|      0|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1570|      0|            break;
 1571|     20|    }
 1572|     20|    return (guess);
 1573|     20|}
tif_luv.c:multiply_ms:
 1466|     68|{
 1467|     68|    return _TIFFMultiplySSize(NULL, m1, m2, NULL);
 1468|     68|}
tif_luv.c:LogLuvDecode24:
  265|  1.33k|{
  266|  1.33k|    static const char module[] = "LogLuvDecode24";
  267|  1.33k|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|  1.33k|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
  268|  1.33k|    tmsize_t cc;
  269|  1.33k|    tmsize_t i;
  270|  1.33k|    tmsize_t npixels;
  271|  1.33k|    unsigned char *bp;
  272|  1.33k|    uint32_t *tp;
  273|       |
  274|  1.33k|    (void)s;
  275|  1.33k|    assert(s == 0);
  ------------------
  |  Branch (275:5): [True: 0, False: 1.33k]
  |  Branch (275:5): [True: 1.33k, False: 0]
  ------------------
  276|  1.33k|    assert(sp != NULL);
  ------------------
  |  Branch (276:5): [True: 0, False: 1.33k]
  |  Branch (276:5): [True: 1.33k, False: 0]
  ------------------
  277|       |
  278|  1.33k|    npixels = occ / sp->pixel_size;
  279|       |
  280|  1.33k|    if (sp->tbuflen < npixels)
  ------------------
  |  Branch (280:9): [True: 0, False: 1.33k]
  ------------------
  281|      0|    {
  282|      0|        TIFFErrorExtR(tif, module, "Translation buffer too short");
  283|      0|        return (0);
  284|      0|    }
  285|  1.33k|    tp = (uint32_t *)sp->tbuf;
  286|       |    /* copy to array of uint32_t */
  287|  1.33k|    bp = (unsigned char *)tif->tif_rawcp;
  288|  1.33k|    cc = tif->tif_rawcc;
  289|  3.83k|    for (i = 0; i < npixels && cc >= 3; i++)
  ------------------
  |  Branch (289:17): [True: 2.51k, False: 1.32k]
  |  Branch (289:32): [True: 2.50k, False: 8]
  ------------------
  290|  2.50k|    {
  291|  2.50k|        tp[i] = (uint32_t)bp[0] << 16 | (uint32_t)bp[1] << 8 | bp[2];
  292|  2.50k|        bp += 3;
  293|  2.50k|        cc -= 3;
  294|  2.50k|    }
  295|  1.33k|    tif->tif_rawcp = (uint8_t *)bp;
  296|  1.33k|    tif->tif_rawcc = cc;
  297|  1.33k|    if (i != npixels)
  ------------------
  |  Branch (297:9): [True: 8, False: 1.32k]
  ------------------
  298|      8|    {
  299|      8|        TIFFErrorExtR(tif, module,
  300|      8|                      "Not enough data at row %" PRIu32
  301|      8|                      " (short %" TIFF_SSIZE_FORMAT " pixels)",
  302|      8|                      tif->tif_dir.td_row, npixels - i);
  303|      8|        return (0);
  304|      8|    }
  305|  1.32k|    if (sp->user_datafmt == SGILOGDATAFMT_RAW)
  ------------------
  |  |  746|  1.32k|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (305:9): [True: 191, False: 1.13k]
  ------------------
  306|    191|        LuvRawToRaw(sp, op, npixels);
  307|  1.13k|    else
  308|  1.13k|        (*sp->tfunc)(sp, op, npixels);
  309|  1.32k|    return (1);
  310|  1.33k|}
tif_luv.c:LuvRawToRaw:
  883|    360|{
  884|    360|    uint32_t *luv = (uint32_t *)sp->tbuf;
  885|       |
  886|    867|    while (n-- > 0)
  ------------------
  |  Branch (886:12): [True: 507, False: 360]
  ------------------
  887|    507|    {
  888|    507|        LogLuvStore32NativeUnaligned(op, *luv++);
  889|    507|        op += sizeof(uint32_t);
  890|    507|    }
  891|    360|}
tif_luv.c:LogLuvStore32NativeUnaligned:
  856|    507|{
  857|    507|    memcpy(cp, &v, sizeof(v));
  858|    507|}
tif_luv.c:Luv24toXYZ:
 1169|    256|{
 1170|    256|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1171|       |
 1172|    768|    while (n-- > 0)
  ------------------
  |  Branch (1172:12): [True: 512, False: 256]
  ------------------
 1173|    512|    {
 1174|    512|        float xyz[3];
 1175|    512|        LogLuv24toXYZ(*luv, xyz);
 1176|    512|        LogLuvStoreFloatNativeUnaligned(op, xyz[0]);
 1177|    512|        LogLuvStoreFloatNativeUnaligned(op + sizeof(float), xyz[1]);
 1178|    512|        LogLuvStoreFloatNativeUnaligned(op + 2 * sizeof(float), xyz[2]);
 1179|    512|        op += 3 * sizeof(float);
 1180|    512|        luv++;
 1181|    512|    }
 1182|    256|}
tif_luv.c:LogLuvStoreFloatNativeUnaligned:
  832|  5.48k|{
  833|  5.48k|    memcpy(cp, &v, sizeof(v));
  834|  5.48k|}
tif_luv.c:Luv24toLuv48:
 1185|    874|{
 1186|    874|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1187|       |
 1188|  2.48k|    while (n-- > 0)
  ------------------
  |  Branch (1188:12): [True: 1.61k, False: 874]
  ------------------
 1189|  1.61k|    {
 1190|  1.61k|        double u, v;
 1191|  1.61k|        int16_t luv0;
 1192|  1.61k|        int16_t luv1;
 1193|  1.61k|        int16_t luv2;
 1194|       |
 1195|  1.61k|        luv0 = (int16_t)((*luv >> 12 & 0xffd) + 13314);
 1196|  1.61k|        if (uv_decode(&u, &v, *luv & 0x3fff) < 0)
  ------------------
  |  Branch (1196:13): [True: 301, False: 1.30k]
  ------------------
 1197|    301|        {
 1198|    301|            u = U_NEU;
  ------------------
  |  |  613|    301|#define U_NEU 0.210526316
  ------------------
 1199|    301|            v = V_NEU;
  ------------------
  |  |  614|    301|#define V_NEU 0.473684211
  ------------------
 1200|    301|        }
 1201|  1.61k|        luv1 = (int16_t)(u * (1 << 15));
 1202|  1.61k|        luv2 = (int16_t)(v * (1 << 15));
 1203|  1.61k|        LogLuvStore16NativeUnaligned(op, luv0);
 1204|  1.61k|        LogLuvStore16NativeUnaligned(op + sizeof(int16_t), luv1);
 1205|  1.61k|        LogLuvStore16NativeUnaligned(op + 2 * sizeof(int16_t), luv2);
 1206|  1.61k|        op += 3 * sizeof(int16_t);
 1207|  1.61k|        luv++;
 1208|  1.61k|    }
 1209|    874|}
tif_luv.c:LogLuvStore16NativeUnaligned:
  844|  6.27k|{
  845|  6.27k|    memcpy(cp, &v, sizeof(v));
  846|  6.27k|}
tif_luv.c:Luv24toRGB:
 1212|      3|{
 1213|      3|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1214|      3|    uint8_t *rgb = (uint8_t *)op;
 1215|       |
 1216|     24|    while (n-- > 0)
  ------------------
  |  Branch (1216:12): [True: 21, False: 3]
  ------------------
 1217|     21|    {
 1218|     21|        float xyz[3];
 1219|       |
 1220|     21|        LogLuv24toXYZ(*luv++, xyz);
 1221|     21|        XYZtoRGB24(xyz, rgb);
 1222|     21|        rgb += 3;
 1223|     21|    }
 1224|      3|}
tif_luv.c:LogLuvDecode32:
  316|    483|{
  317|    483|    static const char module[] = "LogLuvDecode32";
  318|    483|    LogLuvState *sp;
  319|    483|    int shft;
  320|    483|    tmsize_t i;
  321|    483|    tmsize_t npixels;
  322|    483|    unsigned char *bp;
  323|    483|    uint32_t *tp;
  324|    483|    uint32_t b;
  325|    483|    tmsize_t cc;
  326|    483|    int rc;
  327|       |
  328|    483|    (void)s;
  329|    483|    assert(s == 0);
  ------------------
  |  Branch (329:5): [True: 0, False: 483]
  |  Branch (329:5): [True: 483, False: 0]
  ------------------
  330|    483|    sp = DecoderState(tif);
  ------------------
  |  |  175|    483|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
  331|    483|    assert(sp != NULL);
  ------------------
  |  Branch (331:5): [True: 0, False: 483]
  |  Branch (331:5): [True: 483, False: 0]
  ------------------
  332|       |
  333|    483|    npixels = occ / sp->pixel_size;
  334|       |
  335|    483|    if (sp->tbuflen < npixels)
  ------------------
  |  Branch (335:9): [True: 0, False: 483]
  ------------------
  336|      0|    {
  337|      0|        TIFFErrorExtR(tif, module, "Translation buffer too short");
  338|      0|        return (0);
  339|      0|    }
  340|    483|    tp = (uint32_t *)sp->tbuf;
  341|    483|    _TIFFmemset((void *)tp, 0, (tmsize_t)((size_t)npixels * sizeof(tp[0])));
  342|       |
  343|    483|    bp = (unsigned char *)tif->tif_rawcp;
  344|    483|    cc = tif->tif_rawcc;
  345|       |    /* get each byte string */
  346|  2.40k|    for (shft = 24; shft >= 0; shft -= 8)
  ------------------
  |  Branch (346:21): [True: 1.92k, False: 479]
  ------------------
  347|  1.92k|    {
  348|  4.37k|        for (i = 0; i < npixels && cc > 0;)
  ------------------
  |  Branch (348:21): [True: 2.45k, False: 1.92k]
  |  Branch (348:36): [True: 2.44k, False: 3]
  ------------------
  349|  2.44k|        {
  350|  2.44k|            if (*bp >= 128)
  ------------------
  |  Branch (350:17): [True: 749, False: 1.69k]
  ------------------
  351|    749|            { /* run */
  352|    749|                if (cc < 2)
  ------------------
  |  Branch (352:21): [True: 1, False: 748]
  ------------------
  353|      1|                    break;
  354|    748|                rc = *bp++ + (2 - 128);
  355|    748|                b = (uint32_t)*bp++ << shft;
  356|    748|                cc -= 2;
  357|  3.72k|                while (rc-- && i < npixels)
  ------------------
  |  Branch (357:24): [True: 3.70k, False: 17]
  |  Branch (357:32): [True: 2.97k, False: 731]
  ------------------
  358|  2.97k|                    tp[i++] |= b;
  359|    748|            }
  360|  1.69k|            else
  361|  1.69k|            {               /* non-run */
  362|  1.69k|                rc = *bp++; /* nul is noop */
  363|  3.40k|                while (--cc && rc-- && i < npixels)
  ------------------
  |  Branch (363:24): [True: 3.40k, False: 3]
  |  Branch (363:32): [True: 2.74k, False: 662]
  |  Branch (363:40): [True: 1.70k, False: 1.03k]
  ------------------
  364|  1.70k|                    tp[i++] |= (uint32_t)*bp++ << shft;
  365|  1.69k|            }
  366|  2.44k|        }
  367|  1.92k|        if (i != npixels)
  ------------------
  |  Branch (367:13): [True: 4, False: 1.92k]
  ------------------
  368|      4|        {
  369|      4|            TIFFErrorExtR(tif, module,
  370|      4|                          "Not enough data at row %" PRIu32
  371|      4|                          " (short %" TIFF_SSIZE_FORMAT " pixels)",
  372|      4|                          tif->tif_dir.td_row, npixels - i);
  373|      4|            tif->tif_rawcp = (uint8_t *)bp;
  374|      4|            tif->tif_rawcc = cc;
  375|      4|            return (0);
  376|      4|        }
  377|  1.92k|    }
  378|    479|    if (sp->user_datafmt == SGILOGDATAFMT_RAW)
  ------------------
  |  |  746|    479|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (378:9): [True: 169, False: 310]
  ------------------
  379|    169|        LuvRawToRaw(sp, op, npixels);
  380|    310|    else
  381|    310|        (*sp->tfunc)(sp, op, npixels);
  382|    479|    tif->tif_rawcp = (uint8_t *)bp;
  383|    479|    tif->tif_rawcc = cc;
  384|    479|    return (1);
  385|    483|}
tif_luv.c:Luv32toXYZ:
 1333|    145|{
 1334|    145|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1335|       |
 1336|    815|    while (n-- > 0)
  ------------------
  |  Branch (1336:12): [True: 670, False: 145]
  ------------------
 1337|    670|    {
 1338|    670|        float xyz[3];
 1339|    670|        LogLuv32toXYZ(*luv++, xyz);
 1340|    670|        LogLuvStoreFloatNativeUnaligned(op, xyz[0]);
 1341|    670|        LogLuvStoreFloatNativeUnaligned(op + sizeof(float), xyz[1]);
 1342|    670|        LogLuvStoreFloatNativeUnaligned(op + 2 * sizeof(float), xyz[2]);
 1343|    670|        op += 3 * sizeof(float);
 1344|    670|    }
 1345|    145|}
tif_luv.c:Luv32toLuv48:
 1348|    165|{
 1349|    165|    uint32_t *luv = (uint32_t *)sp->tbuf;
 1350|       |
 1351|    495|    while (n-- > 0)
  ------------------
  |  Branch (1351:12): [True: 330, False: 165]
  ------------------
 1352|    330|    {
 1353|    330|        double u, v;
 1354|    330|        int16_t luv0 = (int16_t)(*luv >> 16);
 1355|    330|        int16_t luv1;
 1356|    330|        int16_t luv2;
 1357|       |
 1358|    330|        u = 1. / UVSCALE * ((*luv >> 8 & 0xff) + .5);
  ------------------
  |  |  615|    330|#define UVSCALE 410.
  ------------------
 1359|    330|        v = 1. / UVSCALE * ((*luv & 0xff) + .5);
  ------------------
  |  |  615|    330|#define UVSCALE 410.
  ------------------
 1360|    330|        luv1 = (int16_t)(u * (1 << 15));
 1361|    330|        luv2 = (int16_t)(v * (1 << 15));
 1362|    330|        LogLuvStore16NativeUnaligned(op, luv0);
 1363|    330|        LogLuvStore16NativeUnaligned(op + sizeof(int16_t), luv1);
 1364|    330|        LogLuvStore16NativeUnaligned(op + 2 * sizeof(int16_t), luv2);
 1365|    330|        op += 3 * sizeof(int16_t);
 1366|    330|        luv++;
 1367|    330|    }
 1368|    165|}
tif_luv.c:LogL16InitState:
 1471|     16|{
 1472|     16|    static const char module[] = "LogL16InitState";
 1473|     16|    TIFFDirectory *td = &tif->tif_dir;
 1474|     16|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|     16|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1475|       |
 1476|     16|    assert(sp != NULL);
  ------------------
  |  Branch (1476:5): [True: 0, False: 16]
  |  Branch (1476:5): [True: 16, False: 0]
  ------------------
 1477|     16|    assert(td->td_photometric == PHOTOMETRIC_LOGL);
  ------------------
  |  Branch (1477:5): [True: 0, False: 16]
  |  Branch (1477:5): [True: 16, False: 0]
  ------------------
 1478|       |
 1479|     16|    if (td->td_samplesperpixel != 1)
  ------------------
  |  Branch (1479:9): [True: 2, False: 14]
  ------------------
 1480|      2|    {
 1481|      2|        TIFFErrorExtR(tif, module,
 1482|      2|                      "Sorry, can not handle LogL image with %s=%" PRIu16,
 1483|      2|                      "Samples/pixel", td->td_samplesperpixel);
 1484|      2|        return 0;
 1485|      2|    }
 1486|       |
 1487|       |    /* for some reason, we can't do this in TIFFInitLogL16 */
 1488|     14|    if (sp->user_datafmt == SGILOGDATAFMT_UNKNOWN)
  ------------------
  |  |  178|     14|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (1488:9): [True: 4, False: 10]
  ------------------
 1489|      4|        sp->user_datafmt = LogL16GuessDataFmt(td);
 1490|     14|    switch (sp->user_datafmt)
 1491|     14|    {
 1492|      3|        case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|      3|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1492:9): [True: 3, False: 11]
  ------------------
 1493|      3|            sp->pixel_size = sizeof(float);
 1494|      3|            break;
 1495|      1|        case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|      1|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1495:9): [True: 1, False: 13]
  ------------------
 1496|      1|            sp->pixel_size = sizeof(int16_t);
 1497|      1|            break;
 1498|     10|        case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|     10|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1498:9): [True: 10, False: 4]
  ------------------
 1499|     10|            sp->pixel_size = sizeof(uint8_t);
 1500|     10|            break;
 1501|      0|        default:
  ------------------
  |  Branch (1501:9): [True: 0, False: 14]
  ------------------
 1502|      0|            TIFFErrorExtR(tif, module,
 1503|      0|                          "No support for converting user data format to LogL");
 1504|      0|            return (0);
 1505|     14|    }
 1506|     14|    if (isTiled(tif))
  ------------------
  |  |  278|     14|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     14|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 7, False: 7]
  |  |  ------------------
  ------------------
 1507|      7|        sp->tbuflen = multiply_ms(td->td_tilewidth, td->td_tilelength);
 1508|      7|    else if (td->td_rowsperstrip < td->td_imagelength)
  ------------------
  |  Branch (1508:14): [True: 2, False: 5]
  ------------------
 1509|      2|        sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
 1510|      5|    else
 1511|      5|        sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_imagelength);
 1512|     14|    if (multiply_ms(sp->tbuflen, sizeof(int16_t)) == 0 ||
  ------------------
  |  Branch (1512:9): [True: 0, False: 14]
  ------------------
 1513|     14|        (sp->tbuf = (uint8_t *)_TIFFmallocExt(
  ------------------
  |  Branch (1513:9): [True: 0, False: 14]
  ------------------
 1514|     14|             tif, (tmsize_t)((size_t)sp->tbuflen * sizeof(int16_t)))) == NULL)
 1515|      0|    {
 1516|      0|        TIFFErrorExtR(tif, module, "No space for SGILog translation buffer");
 1517|      0|        return (0);
 1518|      0|    }
 1519|     14|    return (1);
 1520|     14|}
tif_luv.c:LogL16GuessDataFmt:
 1444|      4|{
 1445|      4|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
 1446|      4|    switch (
 1447|      4|        PACK(td->td_samplesperpixel, td->td_bitspersample, td->td_sampleformat))
  ------------------
  |  | 1445|      4|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
 1448|      4|    {
 1449|      3|        case PACK(1, 32, SAMPLEFORMAT_IEEEFP):
  ------------------
  |  | 1445|      3|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1449:9): [True: 3, False: 1]
  ------------------
 1450|      3|            return (SGILOGDATAFMT_FLOAT);
  ------------------
  |  |  744|      3|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
 1451|      0|        case PACK(1, 16, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1445|      0|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1451:9): [True: 0, False: 4]
  ------------------
 1452|      0|        case PACK(1, 16, SAMPLEFORMAT_INT):
  ------------------
  |  | 1445|      0|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1452:9): [True: 0, False: 4]
  ------------------
 1453|      1|        case PACK(1, 16, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1445|      1|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1453:9): [True: 1, False: 3]
  ------------------
 1454|      1|            return (SGILOGDATAFMT_16BIT);
  ------------------
  |  |  745|      1|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
 1455|      0|        case PACK(1, 8, SAMPLEFORMAT_VOID):
  ------------------
  |  | 1445|      0|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1455:9): [True: 0, False: 4]
  ------------------
 1456|      0|        case PACK(1, 8, SAMPLEFORMAT_UINT):
  ------------------
  |  | 1445|      0|#define PACK(s, b, f) (((b) << 6) | ((s) << 3) | (f))
  ------------------
  |  Branch (1456:9): [True: 0, False: 4]
  ------------------
 1457|      0|            return (SGILOGDATAFMT_8BIT);
  ------------------
  |  |  747|      0|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
 1458|      0|        default:
  ------------------
  |  Branch (1458:9): [True: 0, False: 4]
  ------------------
 1459|      0|            break;
 1460|      4|    }
 1461|      0|#undef PACK
 1462|      0|    return (SGILOGDATAFMT_UNKNOWN);
  ------------------
  |  |  178|      0|#define SGILOGDATAFMT_UNKNOWN -1
  ------------------
 1463|      4|}
tif_luv.c:LogL16Decode:
  191|   213k|{
  192|   213k|    static const char module[] = "LogL16Decode";
  193|   213k|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|   213k|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
  194|   213k|    int shft;
  195|   213k|    tmsize_t i;
  196|   213k|    tmsize_t npixels;
  197|   213k|    unsigned char *bp;
  198|   213k|    int16_t *tp;
  199|   213k|    int16_t b;
  200|   213k|    tmsize_t cc;
  201|   213k|    int rc;
  202|       |
  203|   213k|    (void)s;
  204|   213k|    assert(s == 0);
  ------------------
  |  Branch (204:5): [True: 0, False: 213k]
  |  Branch (204:5): [True: 213k, False: 0]
  ------------------
  205|   213k|    assert(sp != NULL);
  ------------------
  |  Branch (205:5): [True: 0, False: 213k]
  |  Branch (205:5): [True: 213k, False: 0]
  ------------------
  206|       |
  207|   213k|    npixels = occ / sp->pixel_size;
  208|       |
  209|   213k|    if (sp->tbuflen < npixels)
  ------------------
  |  Branch (209:9): [True: 0, False: 213k]
  ------------------
  210|      0|    {
  211|      0|        TIFFErrorExtR(tif, module, "Translation buffer too short");
  212|      0|        return (0);
  213|      0|    }
  214|   213k|    tp = (int16_t *)sp->tbuf;
  215|   213k|    _TIFFmemset((void *)tp, 0, (tmsize_t)((size_t)npixels * sizeof(tp[0])));
  216|       |
  217|   213k|    bp = (unsigned char *)tif->tif_rawcp;
  218|   213k|    cc = tif->tif_rawcc;
  219|       |    /* get each byte string */
  220|   639k|    for (shft = 8; shft >= 0; shft -= 8)
  ------------------
  |  Branch (220:20): [True: 426k, False: 212k]
  ------------------
  221|   426k|    {
  222|  1.32M|        for (i = 0; i < npixels && cc > 0;)
  ------------------
  |  Branch (222:21): [True: 901k, False: 426k]
  |  Branch (222:36): [True: 901k, False: 209]
  ------------------
  223|   901k|        {
  224|   901k|            if (*bp >= 128)
  ------------------
  |  Branch (224:17): [True: 326k, False: 574k]
  ------------------
  225|   326k|            { /* run */
  226|   326k|                if (cc < 2)
  ------------------
  |  Branch (226:21): [True: 3, False: 326k]
  ------------------
  227|      3|                    break;
  228|   326k|                rc = *bp++ + (2 - 128);
  229|   326k|                b = (int16_t)(*bp++ << shft);
  230|   326k|                cc -= 2;
  231|  1.37M|                while (rc-- && i < npixels)
  ------------------
  |  Branch (231:24): [True: 1.37M, False: 2.57k]
  |  Branch (231:32): [True: 1.05M, False: 324k]
  ------------------
  232|  1.05M|                    tp[i++] |= b;
  233|   326k|            }
  234|   574k|            else
  235|   574k|            {               /* non-run */
  236|   574k|                rc = *bp++; /* nul is noop */
  237|   859k|                while (--cc && rc-- && i < npixels)
  ------------------
  |  Branch (237:24): [True: 859k, False: 209]
  |  Branch (237:32): [True: 377k, False: 481k]
  |  Branch (237:40): [True: 284k, False: 93.0k]
  ------------------
  238|   284k|                    tp[i++] |= (int16_t)(*bp++ << shft);
  239|   574k|            }
  240|   901k|        }
  241|   426k|        if (i != npixels)
  ------------------
  |  Branch (241:13): [True: 212, False: 426k]
  ------------------
  242|    212|        {
  243|    212|            TIFFErrorExtR(tif, module,
  244|    212|                          "Not enough data at row %" PRIu32
  245|    212|                          " (short %" TIFF_SSIZE_FORMAT " pixels)",
  246|    212|                          tif->tif_dir.td_row, npixels - i);
  247|    212|            tif->tif_rawcp = (uint8_t *)bp;
  248|    212|            tif->tif_rawcc = cc;
  249|    212|            return (0);
  250|    212|        }
  251|   426k|    }
  252|   212k|    if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
  ------------------
  |  |  745|   212k|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (252:9): [True: 151, False: 212k]
  ------------------
  253|    151|        L16toL16(sp, op, npixels);
  254|   212k|    else
  255|   212k|        (*sp->tfunc)(sp, op, npixels);
  256|   212k|    tif->tif_rawcp = (uint8_t *)bp;
  257|   212k|    tif->tif_rawcc = cc;
  258|   212k|    return (1);
  259|   213k|}
tif_luv.c:L16toL16:
  861|    151|{
  862|    151|    int16_t *l16 = (int16_t *)sp->tbuf;
  863|       |
  864|    604|    while (n-- > 0)
  ------------------
  |  Branch (864:12): [True: 453, False: 151]
  ------------------
  865|    453|    {
  866|    453|        LogLuvStore16NativeUnaligned(op, *l16++);
  867|    453|        op += sizeof(int16_t);
  868|    453|    }
  869|    151|}
tif_luv.c:L16toY:
  905|    135|{
  906|    135|    int16_t *l16 = (int16_t *)sp->tbuf;
  907|       |
  908|  2.06k|    while (n-- > 0)
  ------------------
  |  Branch (908:12): [True: 1.93k, False: 135]
  ------------------
  909|  1.93k|    {
  910|  1.93k|        LogLuvStoreFloatNativeUnaligned(op, (float)LogL16toY(*l16++));
  911|  1.93k|        op += sizeof(float);
  912|  1.93k|    }
  913|    135|}
tif_luv.c:L16toGry:
  916|   212k|{
  917|   212k|    int16_t *l16 = (int16_t *)sp->tbuf;
  918|   212k|    uint8_t *gp = (uint8_t *)op;
  919|       |
  920|   878k|    while (n-- > 0)
  ------------------
  |  Branch (920:12): [True: 665k, False: 212k]
  ------------------
  921|   665k|    {
  922|   665k|        double Y = LogL16toY(*l16++);
  923|   665k|        *gp++ = (uint8_t)((Y <= 0.)   ? 0
  ------------------
  |  Branch (923:27): [True: 511k, False: 153k]
  ------------------
  924|   665k|                          : (Y >= 1.) ? 255
  ------------------
  |  Branch (924:29): [True: 39.8k, False: 113k]
  ------------------
  925|   153k|                                      : (int)(256. * sqrt(Y)));
  926|   665k|    }
  927|   212k|}
tif_luv.c:LogLuvDecodeStrip:
  393|    339|{
  394|    339|    tmsize_t rowlen = TIFFScanlineSize(tif);
  395|       |
  396|    339|    if (rowlen == 0)
  ------------------
  |  Branch (396:9): [True: 0, False: 339]
  ------------------
  397|      0|        return 0;
  398|       |
  399|    339|    assert(cc % rowlen == 0);
  ------------------
  |  Branch (399:5): [True: 0, False: 339]
  |  Branch (399:5): [True: 339, False: 0]
  ------------------
  400|  2.70k|    while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))
  ------------------
  |  Branch (400:12): [True: 2.56k, False: 134]
  |  Branch (400:18): [True: 2.36k, False: 205]
  ------------------
  401|  2.36k|    {
  402|  2.36k|        bp += rowlen;
  403|  2.36k|        cc -= rowlen;
  404|  2.36k|    }
  405|    339|    return (cc == 0);
  406|    339|}
tif_luv.c:LogLuvDecodeTile:
  414|      8|{
  415|      8|    tmsize_t rowlen = TIFFTileRowSize(tif);
  416|       |
  417|      8|    if (rowlen == 0)
  ------------------
  |  Branch (417:9): [True: 0, False: 8]
  ------------------
  418|      0|        return 0;
  419|       |
  420|      8|    assert(cc % rowlen == 0);
  ------------------
  |  Branch (420:5): [True: 0, False: 8]
  |  Branch (420:5): [True: 8, False: 0]
  ------------------
  421|   210k|    while (cc && (*tif->tif_decoderow)(tif, bp, rowlen, s))
  ------------------
  |  Branch (421:12): [True: 210k, False: 4]
  |  Branch (421:18): [True: 210k, False: 4]
  ------------------
  422|   210k|    {
  423|   210k|        bp += rowlen;
  424|   210k|        cc -= rowlen;
  425|   210k|    }
  426|      8|    return (cc == 0);
  427|      8|}
tif_luv.c:LogLuvCleanup:
 1813|     45|{
 1814|     45|    LogLuvState *sp = (LogLuvState *)tif->tif_data;
 1815|       |
 1816|     45|    assert(sp != 0);
  ------------------
  |  Branch (1816:5): [True: 0, False: 45]
  |  Branch (1816:5): [True: 45, False: 0]
  ------------------
 1817|       |
 1818|     45|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1819|     45|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1820|       |
 1821|     45|    if (sp->tbuf)
  ------------------
  |  Branch (1821:9): [True: 34, False: 11]
  ------------------
 1822|     34|        _TIFFfreeExt(tif, sp->tbuf);
 1823|     45|    _TIFFfreeExt(tif, sp);
 1824|     45|    tif->tif_data = NULL;
 1825|       |
 1826|     45|    _TIFFSetDefaultCompressionState(tif);
 1827|     45|}
tif_luv.c:LogLuvVGetField:
 1897|    264|{
 1898|    264|    LogLuvState *sp = (LogLuvState *)tif->tif_data;
 1899|       |
 1900|    264|    switch (tag)
 1901|    264|    {
 1902|      0|        case TIFFTAG_SGILOGDATAFMT:
  ------------------
  |  |  743|      0|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
  |  Branch (1902:9): [True: 0, False: 264]
  ------------------
 1903|      0|            *va_arg(ap, int *) = sp->user_datafmt;
 1904|      0|            return (1);
 1905|    264|        default:
  ------------------
  |  Branch (1905:9): [True: 264, False: 0]
  ------------------
 1906|    264|            return (*sp->vgetparent)(tif, tag, ap);
 1907|    264|    }
 1908|    264|}
tif_luv.c:LogLuvVSetField:
 1830|    609|{
 1831|    609|    static const char module[] = "LogLuvVSetField";
 1832|    609|    LogLuvState *sp = DecoderState(tif);
  ------------------
  |  |  175|    609|#define DecoderState(tif) ((LogLuvState *)(tif)->tif_data)
  ------------------
 1833|    609|    int bps, fmt;
 1834|       |
 1835|    609|    switch (tag)
 1836|    609|    {
 1837|     12|        case TIFFTAG_SGILOGDATAFMT:
  ------------------
  |  |  743|     12|#define TIFFTAG_SGILOGDATAFMT 65560    /* SGILog user data format */
  ------------------
  |  Branch (1837:9): [True: 12, False: 597]
  ------------------
 1838|     12|            sp->user_datafmt = (int)va_arg(ap, int);
 1839|       |            /*
 1840|       |             * Tweak the TIFF header so that the rest of libtiff knows what
 1841|       |             * size of data will be passed between app and library, and
 1842|       |             * assume that the app knows what it is doing and is not
 1843|       |             * confused by these header manipulations...
 1844|       |             */
 1845|     12|            switch (sp->user_datafmt)
 1846|     12|            {
 1847|      0|                case SGILOGDATAFMT_FLOAT:
  ------------------
  |  |  744|      0|#define SGILOGDATAFMT_FLOAT 0          /* IEEE float samples */
  ------------------
  |  Branch (1847:17): [True: 0, False: 12]
  ------------------
 1848|      0|                    bps = 32;
 1849|      0|                    fmt = SAMPLEFORMAT_IEEEFP;
  ------------------
  |  |  336|      0|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
 1850|      0|                    break;
 1851|      0|                case SGILOGDATAFMT_16BIT:
  ------------------
  |  |  745|      0|#define SGILOGDATAFMT_16BIT 1          /* 16-bit samples */
  ------------------
  |  Branch (1851:17): [True: 0, False: 12]
  ------------------
 1852|      0|                    bps = 16;
 1853|      0|                    fmt = SAMPLEFORMAT_INT;
  ------------------
  |  |  335|      0|#define SAMPLEFORMAT_INT 2                 /* !signed integer data */
  ------------------
 1854|      0|                    break;
 1855|      0|                case SGILOGDATAFMT_RAW:
  ------------------
  |  |  746|      0|#define SGILOGDATAFMT_RAW 2            /* uninterpreted data */
  ------------------
  |  Branch (1855:17): [True: 0, False: 12]
  ------------------
 1856|      0|                    bps = 32;
 1857|      0|                    fmt = SAMPLEFORMAT_UINT;
  ------------------
  |  |  334|      0|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
 1858|      0|                    TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
  ------------------
  |  |  257|      0|#define TIFFTAG_SAMPLESPERPIXEL 277        /* samples per pixel */
  ------------------
 1859|      0|                    break;
 1860|     12|                case SGILOGDATAFMT_8BIT:
  ------------------
  |  |  747|     12|#define SGILOGDATAFMT_8BIT 3           /* 8-bit RGB monitor values */
  ------------------
  |  Branch (1860:17): [True: 12, False: 0]
  ------------------
 1861|     12|                    bps = 8;
 1862|     12|                    fmt = SAMPLEFORMAT_UINT;
  ------------------
  |  |  334|     12|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
 1863|     12|                    break;
 1864|      0|                default:
  ------------------
  |  Branch (1864:17): [True: 0, False: 12]
  ------------------
 1865|      0|                    TIFFErrorExtR(
 1866|      0|                        tif, tif->tif_name,
 1867|      0|                        "Unknown data format %d for LogLuv compression",
 1868|      0|                        sp->user_datafmt);
 1869|      0|                    return (0);
 1870|     12|            }
 1871|     12|            TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, bps);
  ------------------
  |  |  180|     12|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1872|     12|            TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, fmt);
  ------------------
  |  |  333|     12|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
 1873|       |            /*
 1874|       |             * Must recalculate sizes should bits/sample change.
 1875|       |             */
 1876|     12|            tif->tif_dir.td_tilesize =
 1877|     12|                isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)-1;
  ------------------
  |  |  278|     12|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|     12|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 8, False: 4]
  |  |  ------------------
  ------------------
 1878|     12|            tif->tif_dir.td_scanlinesize = TIFFScanlineSize(tif);
 1879|     12|            return (1);
 1880|      0|        case TIFFTAG_SGILOGENCODE:
  ------------------
  |  |  748|      0|#define TIFFTAG_SGILOGENCODE 65561     /* SGILog data encoding control*/
  ------------------
  |  Branch (1880:9): [True: 0, False: 609]
  ------------------
 1881|      0|            sp->encode_meth = (int)va_arg(ap, int);
 1882|      0|            if (sp->encode_meth != SGILOGENCODE_NODITHER &&
  ------------------
  |  |  749|      0|#define SGILOGENCODE_NODITHER 0        /* do not dither encoded values*/
  ------------------
  |  Branch (1882:17): [True: 0, False: 0]
  ------------------
 1883|      0|                sp->encode_meth != SGILOGENCODE_RANDITHER)
  ------------------
  |  |  750|      0|#define SGILOGENCODE_RANDITHER 1       /* randomly dither encd values */
  ------------------
  |  Branch (1883:17): [True: 0, False: 0]
  ------------------
 1884|      0|            {
 1885|      0|                TIFFErrorExtR(tif, module,
 1886|      0|                              "Unknown encoding %d for LogLuv compression",
 1887|      0|                              sp->encode_meth);
 1888|      0|                return (0);
 1889|      0|            }
 1890|      0|            return (1);
 1891|    597|        default:
  ------------------
  |  Branch (1891:9): [True: 597, False: 12]
  ------------------
 1892|    597|            return (*sp->vsetparent)(tif, tag, ap);
 1893|    609|    }
 1894|    609|}

TIFFInitLZMA:
  505|     23|{
  506|     23|    static const char module[] = "TIFFInitLZMA";
  507|     23|    LZMAState *sp;
  508|     23|    lzma_stream tmp_stream = LZMA_STREAM_INIT;
  509|       |
  510|     23|    (void)scheme;
  511|     23|    assert(scheme == COMPRESSION_LZMA);
  ------------------
  |  Branch (511:5): [True: 0, False: 23]
  |  Branch (511:5): [True: 23, False: 0]
  ------------------
  512|       |
  513|       |    /*
  514|       |     * Merge codec-specific tag information.
  515|       |     */
  516|     23|    if (!_TIFFMergeFields(tif, lzmaFields, TIFFArrayCount(lzmaFields)))
  ------------------
  |  |  339|     23|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (516:9): [True: 0, False: 23]
  ------------------
  517|      0|    {
  518|      0|        TIFFErrorExtR(tif, module, "Merging LZMA2 codec-specific tags failed");
  519|      0|        return 0;
  520|      0|    }
  521|       |
  522|       |    /*
  523|       |     * Allocate state block so tag methods have storage to record values.
  524|       |     */
  525|     23|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LZMAState));
  526|     23|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (526:9): [True: 0, False: 23]
  ------------------
  527|      0|        goto bad;
  528|     23|    sp = GetLZMAState(tif);
  ------------------
  |  |   63|     23|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  529|     23|    memcpy(&sp->stream, &tmp_stream, sizeof(lzma_stream));
  530|       |
  531|       |    /*
  532|       |     * Override parent get/set field methods.
  533|       |     */
  534|     23|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
  535|     23|    tif->tif_tagmethods.vgetfield = LZMAVGetField; /* hook for codec tags */
  536|     23|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
  537|     23|    tif->tif_tagmethods.vsetfield = LZMAVSetField; /* hook for codec tags */
  538|       |
  539|       |    /* Default values for codec-specific fields */
  540|     23|    sp->preset = LZMA_PRESET_DEFAULT; /* default comp. level */
  541|     23|    sp->check = LZMA_CHECK_NONE;
  542|     23|    sp->state = 0;
  543|       |
  544|       |    /* Data filters. So far we are using delta and LZMA2 filters only. */
  545|     23|    sp->opt_delta.type = LZMA_DELTA_TYPE_BYTE;
  546|       |    /*
  547|       |     * The sample size in bytes seems to be reasonable distance for delta
  548|       |     * filter.
  549|       |     */
  550|     23|    sp->opt_delta.dist = (tif->tif_dir.td_bitspersample % 8)
  ------------------
  |  Branch (550:26): [True: 23, False: 0]
  ------------------
  551|     23|                             ? 1
  552|     23|                             : tif->tif_dir.td_bitspersample / 8;
  553|     23|    sp->filters[0].id = LZMA_FILTER_DELTA;
  554|     23|    sp->filters[0].options = &sp->opt_delta;
  555|       |
  556|     23|    lzma_lzma_preset(&sp->opt_lzma, (uint32_t)sp->preset);
  557|     23|    sp->filters[1].id = LZMA_FILTER_LZMA2;
  558|     23|    sp->filters[1].options = &sp->opt_lzma;
  559|       |
  560|     23|    sp->filters[2].id = LZMA_VLI_UNKNOWN;
  561|     23|    sp->filters[2].options = NULL;
  562|       |
  563|       |    /*
  564|       |     * Install codec methods.
  565|       |     */
  566|     23|    tif->tif_fixuptags = LZMAFixupTags;
  567|     23|    tif->tif_setupdecode = LZMASetupDecode;
  568|     23|    tif->tif_predecode = LZMAPreDecode;
  569|     23|    tif->tif_decoderow = LZMADecode;
  570|     23|    tif->tif_decodestrip = LZMADecode;
  571|     23|    tif->tif_decodetile = LZMADecode;
  572|     23|    tif->tif_setupencode = LZMASetupEncode;
  573|     23|    tif->tif_preencode = LZMAPreEncode;
  574|     23|    tif->tif_postencode = LZMAPostEncode;
  575|     23|    tif->tif_encoderow = LZMAEncode;
  576|     23|    tif->tif_encodestrip = LZMAEncode;
  577|     23|    tif->tif_encodetile = LZMAEncode;
  578|     23|    tif->tif_cleanup = LZMACleanup;
  579|     23|    tif->tif_getmaxcompressionratio = LZMAGetMaxCompressionRatio;
  580|       |
  581|       |    /*
  582|       |     * Setup predictor setup.
  583|       |     */
  584|     23|    (void)TIFFPredictorInit(tif);
  585|     23|    return 1;
  586|      0|bad:
  587|      0|    TIFFErrorExtR(tif, module, "No space for LZMA2 state block");
  588|      0|    return 0;
  589|     23|}
tif_lzma.c:LZMAVGetField:
  470|    532|{
  471|    532|    LZMAState *sp = GetLZMAState(tif);
  ------------------
  |  |   63|    532|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  472|       |
  473|    532|    switch (tag)
  474|    532|    {
  475|      0|        case TIFFTAG_LZMAPRESET:
  ------------------
  |  |  751|      0|#define TIFFTAG_LZMAPRESET 65562       /* LZMA2 preset (compression level) */
  ------------------
  |  Branch (475:9): [True: 0, False: 532]
  ------------------
  476|      0|            *va_arg(ap, int *) = sp->preset;
  477|      0|            break;
  478|    532|        default:
  ------------------
  |  Branch (478:9): [True: 532, False: 0]
  ------------------
  479|    532|            return (*sp->vgetparent)(tif, tag, ap);
  480|    532|    }
  481|      0|    return 1;
  482|    532|}
tif_lzma.c:LZMAVSetField:
  443|    363|{
  444|    363|    static const char module[] = "LZMAVSetField";
  445|    363|    LZMAState *sp = GetLZMAState(tif);
  ------------------
  |  |   63|    363|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  446|       |
  447|    363|    switch (tag)
  448|    363|    {
  449|      0|        case TIFFTAG_LZMAPRESET:
  ------------------
  |  |  751|      0|#define TIFFTAG_LZMAPRESET 65562       /* LZMA2 preset (compression level) */
  ------------------
  |  Branch (449:9): [True: 0, False: 363]
  ------------------
  450|      0|            sp->preset = (int)va_arg(ap, int);
  451|      0|            lzma_lzma_preset(&sp->opt_lzma, (uint32_t)sp->preset);
  452|      0|            if (sp->state & LSTATE_INIT_ENCODE)
  ------------------
  |  |   57|      0|#define LSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (452:17): [True: 0, False: 0]
  ------------------
  453|      0|            {
  454|      0|                lzma_ret ret =
  455|      0|                    lzma_stream_encoder(&sp->stream, sp->filters, sp->check);
  456|      0|                if (ret != LZMA_OK)
  ------------------
  |  Branch (456:21): [True: 0, False: 0]
  ------------------
  457|      0|                {
  458|      0|                    TIFFErrorExtR(tif, module, "Liblzma error: %s",
  459|      0|                                  LZMAStrerror(ret));
  460|      0|                }
  461|      0|            }
  462|      0|            return 1;
  463|    363|        default:
  ------------------
  |  Branch (463:9): [True: 363, False: 0]
  ------------------
  464|    363|            return (*sp->vsetparent)(tif, tag, ap);
  465|    363|    }
  466|       |    /*NOTREACHED*/
  467|    363|}
tif_lzma.c:LZMAStrerror:
   71|    256|{
   72|    256|    switch (ret)
   73|    256|    {
   74|      0|        case LZMA_OK:
  ------------------
  |  Branch (74:9): [True: 0, False: 256]
  ------------------
   75|      0|            return "operation completed successfully";
   76|      0|        case LZMA_STREAM_END:
  ------------------
  |  Branch (76:9): [True: 0, False: 256]
  ------------------
   77|      0|            return "end of stream was reached";
   78|      0|        case LZMA_NO_CHECK:
  ------------------
  |  Branch (78:9): [True: 0, False: 256]
  ------------------
   79|      0|            return "input stream has no integrity check";
   80|      0|        case LZMA_UNSUPPORTED_CHECK:
  ------------------
  |  Branch (80:9): [True: 0, False: 256]
  ------------------
   81|      0|            return "cannot calculate the integrity check";
   82|      0|        case LZMA_GET_CHECK:
  ------------------
  |  Branch (82:9): [True: 0, False: 256]
  ------------------
   83|      0|            return "integrity check type is now available";
   84|      0|        case LZMA_MEM_ERROR:
  ------------------
  |  Branch (84:9): [True: 0, False: 256]
  ------------------
   85|      0|            return "cannot allocate memory";
   86|      0|        case LZMA_MEMLIMIT_ERROR:
  ------------------
  |  Branch (86:9): [True: 0, False: 256]
  ------------------
   87|      0|            return "memory usage limit was reached";
   88|    160|        case LZMA_FORMAT_ERROR:
  ------------------
  |  Branch (88:9): [True: 160, False: 96]
  ------------------
   89|    160|            return "file format not recognized";
   90|      0|        case LZMA_OPTIONS_ERROR:
  ------------------
  |  Branch (90:9): [True: 0, False: 256]
  ------------------
   91|      0|            return "invalid or unsupported options";
   92|      0|        case LZMA_DATA_ERROR:
  ------------------
  |  Branch (92:9): [True: 0, False: 256]
  ------------------
   93|      0|            return "data is corrupt";
   94|     96|        case LZMA_BUF_ERROR:
  ------------------
  |  Branch (94:9): [True: 96, False: 160]
  ------------------
   95|     96|            return "no progress is possible (stream is truncated or corrupt)";
   96|      0|        case LZMA_PROG_ERROR:
  ------------------
  |  Branch (96:9): [True: 0, False: 256]
  ------------------
   97|      0|            return "programming error";
   98|       |#if LZMA_VERSION >= 50040000 /* 5.4.0 */
   99|       |        case LZMA_SEEK_NEEDED:
  100|       |        case LZMA_RET_INTERNAL1:
  101|       |        case LZMA_RET_INTERNAL2:
  102|       |        case LZMA_RET_INTERNAL3:
  103|       |        case LZMA_RET_INTERNAL4:
  104|       |        case LZMA_RET_INTERNAL5:
  105|       |        case LZMA_RET_INTERNAL6:
  106|       |        case LZMA_RET_INTERNAL7:
  107|       |        case LZMA_RET_INTERNAL8:
  108|       |#endif
  109|      0|        default:
  ------------------
  |  Branch (109:9): [True: 0, False: 256]
  ------------------
  110|      0|            return "unidentified liblzma error";
  111|    256|    }
  112|    256|}
tif_lzma.c:LZMAFixupTags:
  115|     19|{
  116|     19|    (void)tif;
  117|     19|    return 1;
  118|     19|}
tif_lzma.c:LZMASetupDecode:
  121|     16|{
  122|     16|    LZMAState *sp = LZMADecoderState(tif);
  ------------------
  |  |   64|     16|#define LZMADecoderState(tif) GetLZMAState(tif)
  |  |  ------------------
  |  |  |  |   63|     16|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  123|       |
  124|     16|    assert(sp != NULL);
  ------------------
  |  Branch (124:5): [True: 0, False: 16]
  |  Branch (124:5): [True: 16, False: 0]
  ------------------
  125|       |
  126|       |    /* if we were last encoding, terminate this mode */
  127|     16|    if (sp->state & LSTATE_INIT_ENCODE)
  ------------------
  |  |   57|     16|#define LSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (127:9): [True: 0, False: 16]
  ------------------
  128|      0|    {
  129|      0|        lzma_end(&sp->stream);
  130|      0|        sp->state = 0;
  131|      0|    }
  132|       |
  133|     16|    sp->state |= LSTATE_INIT_DECODE;
  ------------------
  |  |   56|     16|#define LSTATE_INIT_DECODE 0x01
  ------------------
  134|     16|    return 1;
  135|     16|}
tif_lzma.c:LZMAPreDecode:
  141|    256|{
  142|    256|    static const char module[] = "LZMAPreDecode";
  143|    256|    LZMAState *sp = LZMADecoderState(tif);
  ------------------
  |  |   64|    256|#define LZMADecoderState(tif) GetLZMAState(tif)
  |  |  ------------------
  |  |  |  |   63|    256|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  144|    256|    lzma_ret ret;
  145|       |
  146|    256|    (void)s;
  147|    256|    assert(sp != NULL);
  ------------------
  |  Branch (147:5): [True: 0, False: 256]
  |  Branch (147:5): [True: 256, False: 0]
  ------------------
  148|       |
  149|    256|    if ((sp->state & LSTATE_INIT_DECODE) == 0)
  ------------------
  |  |   56|    256|#define LSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (149:9): [True: 0, False: 256]
  ------------------
  150|      0|        tif->tif_setupdecode(tif);
  151|       |
  152|    256|    sp->stream.next_in = tif->tif_rawdata;
  153|    256|    sp->stream.avail_in = (size_t)tif->tif_rawcc;
  154|    256|    if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc)
  ------------------
  |  Branch (154:9): [True: 0, False: 256]
  ------------------
  155|      0|    {
  156|      0|        TIFFErrorExtR(tif, module,
  157|      0|                      "Liblzma cannot deal with buffers this size");
  158|      0|        return 0;
  159|      0|    }
  160|       |
  161|       |    /*
  162|       |     * Disable memory limit when decoding. UINT64_MAX is a flag to disable
  163|       |     * the limit, we are passing (uint64_t)-1 which should be the same.
  164|       |     */
  165|    256|    ret = lzma_stream_decoder(&sp->stream, (uint64_t)-1, 0);
  166|    256|    if (ret != LZMA_OK)
  ------------------
  |  Branch (166:9): [True: 0, False: 256]
  ------------------
  167|      0|    {
  168|      0|        TIFFErrorExtR(tif, module, "Error initializing the stream decoder, %s",
  169|      0|                      LZMAStrerror(ret));
  170|      0|        return 0;
  171|      0|    }
  172|       |
  173|    256|    sp->read_error = 0;
  174|       |
  175|    256|    return 1;
  176|    256|}
tif_lzma.c:LZMADecode:
  179|    259|{
  180|    259|    static const char module[] = "LZMADecode";
  181|    259|    LZMAState *sp = LZMADecoderState(tif);
  ------------------
  |  |   64|    259|#define LZMADecoderState(tif) GetLZMAState(tif)
  |  |  ------------------
  |  |  |  |   63|    259|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  182|       |
  183|    259|    (void)s;
  184|    259|    assert(sp != NULL);
  ------------------
  |  Branch (184:5): [True: 0, False: 259]
  |  Branch (184:5): [True: 259, False: 0]
  ------------------
  185|    259|    assert(sp->state == LSTATE_INIT_DECODE);
  ------------------
  |  Branch (185:5): [True: 0, False: 259]
  |  Branch (185:5): [True: 259, False: 0]
  ------------------
  186|       |
  187|    259|    if (sp->read_error)
  ------------------
  |  Branch (187:9): [True: 3, False: 256]
  ------------------
  188|      3|    {
  189|      3|        memset(op, 0, (size_t)occ);
  190|      3|        TIFFErrorExtR(tif, module,
  191|      3|                      "LZMADecode: Scanline %" PRIu32 " cannot be read due to "
  192|      3|                      "previous error",
  193|      3|                      tif->tif_dir.td_row);
  194|      3|        return 0;
  195|      3|    }
  196|       |
  197|    256|    sp->stream.next_in = tif->tif_rawcp;
  198|    256|    sp->stream.avail_in = (size_t)tif->tif_rawcc;
  199|       |
  200|    256|    sp->stream.next_out = op;
  201|    256|    sp->stream.avail_out = (size_t)occ;
  202|    256|    if ((tmsize_t)sp->stream.avail_out != occ)
  ------------------
  |  Branch (202:9): [True: 0, False: 256]
  ------------------
  203|      0|    {
  204|       |        // read_error not set here as this is a usage issue that can be
  205|       |        // recovered in a following call.
  206|      0|        memset(op, 0, (size_t)occ);
  207|      0|        TIFFErrorExtR(tif, module,
  208|      0|                      "Liblzma cannot deal with buffers this size");
  209|      0|        return 0;
  210|      0|    }
  211|       |
  212|    256|    do
  213|    448|    {
  214|       |        /*
  215|       |         * Save the current stream state to properly recover from the
  216|       |         * decoding errors later.
  217|       |         */
  218|    448|        const uint8_t *next_in = sp->stream.next_in;
  219|    448|        size_t avail_in = sp->stream.avail_in;
  220|       |
  221|    448|        lzma_ret ret = lzma_code(&sp->stream, LZMA_RUN);
  222|    448|        if (ret == LZMA_STREAM_END)
  ------------------
  |  Branch (222:13): [True: 0, False: 448]
  ------------------
  223|      0|            break;
  224|    448|        if (ret == LZMA_MEMLIMIT_ERROR)
  ------------------
  |  Branch (224:13): [True: 0, False: 448]
  ------------------
  225|      0|        {
  226|      0|            lzma_ret r =
  227|      0|                lzma_stream_decoder(&sp->stream, lzma_memusage(&sp->stream), 0);
  228|      0|            if (r != LZMA_OK)
  ------------------
  |  Branch (228:17): [True: 0, False: 0]
  ------------------
  229|      0|            {
  230|      0|                sp->read_error = 1;
  231|      0|                memset(op, 0, (size_t)occ);
  232|      0|                TIFFErrorExtR(tif, module,
  233|      0|                              "Error initializing the stream decoder, %s",
  234|      0|                              LZMAStrerror(r));
  235|      0|                break;
  236|      0|            }
  237|      0|            sp->stream.next_in = next_in;
  238|      0|            sp->stream.avail_in = avail_in;
  239|      0|            continue;
  240|      0|        }
  241|    448|        if (ret != LZMA_OK)
  ------------------
  |  Branch (241:13): [True: 256, False: 192]
  ------------------
  242|    256|        {
  243|    256|            TIFFErrorExtR(tif, module,
  244|    256|                          "Decoding error at scanline %" PRIu32 ", %s",
  245|    256|                          tif->tif_dir.td_row, LZMAStrerror(ret));
  246|    256|            break;
  247|    256|        }
  248|    448|    } while (sp->stream.avail_out > 0);
  ------------------
  |  Branch (248:14): [True: 192, False: 0]
  ------------------
  249|    256|    if (sp->stream.avail_out != 0)
  ------------------
  |  Branch (249:9): [True: 256, False: 0]
  ------------------
  250|    256|    {
  251|    256|        sp->read_error = 1;
  252|    256|        memset(sp->stream.next_out, 0, sp->stream.avail_out);
  253|    256|        TIFFErrorExtR(tif, module,
  254|    256|                      "Not enough data at scanline %" PRIu32
  255|    256|                      " (short %" TIFF_SIZE_FORMAT " bytes)",
  256|    256|                      tif->tif_dir.td_row, sp->stream.avail_out);
  257|    256|        return 0;
  258|    256|    }
  259|       |
  260|      0|    tif->tif_rawcp = (uint8_t *)sp->stream.next_in; /* cast away const */
  261|      0|    tif->tif_rawcc = (tmsize_t)sp->stream.avail_in;
  262|       |
  263|      0|    return 1;
  264|    256|}
tif_lzma.c:LZMACleanup:
  421|     23|{
  422|     23|    LZMAState *sp = GetLZMAState(tif);
  ------------------
  |  |   63|     23|#define GetLZMAState(tif) ((LZMAState *)(tif)->tif_data)
  ------------------
  423|       |
  424|     23|    assert(sp != 0);
  ------------------
  |  Branch (424:5): [True: 0, False: 23]
  |  Branch (424:5): [True: 23, False: 0]
  ------------------
  425|       |
  426|     23|    (void)TIFFPredictorCleanup(tif);
  427|       |
  428|     23|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
  429|     23|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
  430|       |
  431|     23|    if (sp->state)
  ------------------
  |  Branch (431:9): [True: 15, False: 8]
  ------------------
  432|     15|    {
  433|     15|        lzma_end(&sp->stream);
  434|     15|        sp->state = 0;
  435|     15|    }
  436|     23|    _TIFFfreeExt(tif, sp);
  437|     23|    tif->tif_data = NULL;
  438|       |
  439|     23|    _TIFFSetDefaultCompressionState(tif);
  440|     23|}
tif_lzma.c:LZMAGetMaxCompressionRatio:
  490|      2|{
  491|      2|    (void)tif;
  492|       |
  493|       |    /* See README_for_libtiff_developpers.md for raw data used to estimate
  494|       |     * the maximum compression rate. */
  495|       |
  496|       |    /* 1024x1024: 3800 */
  497|       |    /* 4096x4096: 6534 */
  498|       |    /* 16383x16383: 6846 */
  499|       |    /* 65536x65536: 6874 */
  500|       |
  501|      2|    return 7000;
  502|      2|}

TIFFInitLZW:
 1411|    481|{
 1412|    481|    static const char module[] = "TIFFInitLZW";
 1413|    481|    (void)scheme;
 1414|    481|    assert(scheme == COMPRESSION_LZW);
  ------------------
  |  Branch (1414:5): [True: 0, False: 481]
  |  Branch (1414:5): [True: 481, False: 0]
  ------------------
 1415|       |    /*
 1416|       |     * Allocate state block so tag methods have storage to record values.
 1417|       |     */
 1418|    481|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LZWCodecState));
 1419|    481|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (1419:9): [True: 0, False: 481]
  ------------------
 1420|      0|        goto bad;
 1421|    481|    LZWDecoderState(tif)->dec_codetab = NULL;
  ------------------
  |  |  164|    481|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    481|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1422|    481|    LZWDecoderState(tif)->dec_decode = NULL;
  ------------------
  |  |  164|    481|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    481|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1423|    481|    LZWEncoderState(tif)->enc_hashtab = NULL;
  ------------------
  |  |  165|    481|#define LZWEncoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    481|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1424|    481|    LZWState(tif)->rw_mode = tif->tif_mode;
  ------------------
  |  |  163|    481|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  ------------------
 1425|       |
 1426|       |    /*
 1427|       |     * Install codec methods.
 1428|       |     */
 1429|    481|    tif->tif_fixuptags = LZWFixupTags;
 1430|    481|    tif->tif_setupdecode = LZWSetupDecode;
 1431|    481|    tif->tif_predecode = LZWPreDecode;
 1432|    481|    tif->tif_decoderow = LZWDecode;
 1433|    481|    tif->tif_decodestrip = LZWDecode;
 1434|    481|    tif->tif_decodetile = LZWDecode;
 1435|    481|#ifndef LZW_READ_ONLY
 1436|    481|    tif->tif_setupencode = LZWSetupEncode;
 1437|    481|    tif->tif_preencode = LZWPreEncode;
 1438|    481|    tif->tif_postencode = LZWPostEncode;
 1439|    481|    tif->tif_encoderow = LZWEncode;
 1440|    481|    tif->tif_encodestrip = LZWEncode;
 1441|    481|    tif->tif_encodetile = LZWEncode;
 1442|    481|#endif
 1443|    481|    tif->tif_getmaxcompressionratio = LZWGetMaxCompressionRatio;
 1444|    481|    tif->tif_cleanup = LZWCleanup;
 1445|       |    /*
 1446|       |     * Setup predictor setup.
 1447|       |     */
 1448|    481|    (void)TIFFPredictorInit(tif);
 1449|    481|    return (1);
 1450|      0|bad:
 1451|      0|    TIFFErrorExtR(tif, module, "No space for LZW state block");
 1452|      0|    return (0);
 1453|    481|}
tif_lzw.c:LZWFixupTags:
  177|    460|{
  178|    460|    (void)tif;
  179|    460|    return (1);
  180|    460|}
tif_lzw.c:LZWSetupDecode:
  183|    532|{
  184|    532|    static const char module[] = "LZWSetupDecode";
  185|    532|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|    532|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    532|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  186|    532|    int code;
  187|       |
  188|    532|    if (sp == NULL)
  ------------------
  |  Branch (188:9): [True: 0, False: 532]
  ------------------
  189|      0|    {
  190|       |        /*
  191|       |         * Allocate state block so tag methods have storage to record
  192|       |         * values.
  193|       |         */
  194|      0|        tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(LZWCodecState));
  195|      0|        if (tif->tif_data == NULL)
  ------------------
  |  Branch (195:13): [True: 0, False: 0]
  ------------------
  196|      0|        {
  197|      0|            TIFFErrorExtR(tif, module, "No space for LZW state block");
  198|      0|            return (0);
  199|      0|        }
  200|       |
  201|      0|        sp = LZWDecoderState(tif);
  ------------------
  |  |  164|      0|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|      0|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  202|      0|        sp->dec_codetab = NULL;
  203|      0|        sp->dec_decode = NULL;
  204|       |
  205|       |        /*
  206|       |         * Setup predictor setup.
  207|       |         */
  208|      0|        (void)TIFFPredictorInit(tif);
  209|      0|    }
  210|       |
  211|    532|    if (sp->dec_codetab == NULL)
  ------------------
  |  Branch (211:9): [True: 451, False: 81]
  ------------------
  212|    451|    {
  213|    451|        sp->dec_codetab = (code_t *)_TIFFmallocExt(tif, CSIZE * sizeof(code_t));
  ------------------
  |  |   79|    451|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|    451|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  214|    451|        if (sp->dec_codetab == NULL)
  ------------------
  |  Branch (214:13): [True: 0, False: 451]
  ------------------
  215|      0|        {
  216|      0|            TIFFErrorExtR(tif, module, "No space for LZW code table");
  217|      0|            return (0);
  218|      0|        }
  219|       |        /*
  220|       |         * Pre-load the table.
  221|       |         */
  222|    451|        code = 255;
  223|    451|        do
  224|   115k|        {
  225|   115k|            sp->dec_codetab[code].firstchar = (unsigned char)code;
  226|   115k|            sp->dec_codetab[code].value = (unsigned char)code;
  227|   115k|            sp->dec_codetab[code].repeated = true;
  228|   115k|            sp->dec_codetab[code].length = 1;
  229|   115k|            sp->dec_codetab[code].next = NULL;
  230|   115k|        } while (code--);
  ------------------
  |  Branch (230:18): [True: 115k, False: 451]
  ------------------
  231|       |        /*
  232|       |         * Zero-out the unused entries  */
  233|       |        /* Silence false positive */
  234|       |        /* coverity[overrun-buffer-arg] */
  235|    451|        memset(&sp->dec_codetab[CODE_CLEAR], 0,
  ------------------
  |  |   71|    451|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  236|    451|               (CODE_FIRST - CODE_CLEAR) * sizeof(code_t));
  ------------------
  |  |   73|    451|#define CODE_FIRST 258 /* first free code entry */
  ------------------
                             (CODE_FIRST - CODE_CLEAR) * sizeof(code_t));
  ------------------
  |  |   71|    451|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  237|    451|    }
  238|    532|    return (1);
  239|    532|}
tif_lzw.c:LZWPreDecode:
  245|  19.5k|{
  246|  19.5k|    static const char module[] = "LZWPreDecode";
  247|  19.5k|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|  19.5k|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|  19.5k|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  248|       |
  249|  19.5k|    (void)s;
  250|  19.5k|    assert(sp != NULL);
  ------------------
  |  Branch (250:5): [True: 0, False: 19.5k]
  |  Branch (250:5): [True: 19.5k, False: 0]
  ------------------
  251|  19.5k|    if (sp->dec_codetab == NULL)
  ------------------
  |  Branch (251:9): [True: 0, False: 19.5k]
  ------------------
  252|      0|    {
  253|      0|        tif->tif_setupdecode(tif);
  254|      0|        if (sp->dec_codetab == NULL)
  ------------------
  |  Branch (254:13): [True: 0, False: 0]
  ------------------
  255|      0|            return (0);
  256|      0|    }
  257|       |
  258|       |    /*
  259|       |     * Check for old bit-reversed codes.
  260|       |     */
  261|  19.5k|    if (tif->tif_rawcc >= 2 && tif->tif_rawdata[0] == 0 &&
  ------------------
  |  Branch (261:9): [True: 17.5k, False: 1.90k]
  |  Branch (261:32): [True: 3.72k, False: 13.8k]
  ------------------
  262|  3.72k|        (tif->tif_rawdata[1] & 0x1))
  ------------------
  |  Branch (262:9): [True: 1.73k, False: 1.99k]
  ------------------
  263|  1.73k|    {
  264|  1.73k|#ifdef LZW_COMPAT
  265|  1.73k|        if (!sp->dec_decode)
  ------------------
  |  Branch (265:13): [True: 80, False: 1.65k]
  ------------------
  266|     80|        {
  267|     80|            TIFFWarningExtR(tif, module, "Old-style LZW codes, convert file");
  268|       |            /*
  269|       |             * Override default decoding methods with
  270|       |             * ones that deal with the old coding.
  271|       |             * Otherwise the predictor versions set
  272|       |             * above will call the compatibility routines
  273|       |             * through the dec_decode method.
  274|       |             */
  275|     80|            tif->tif_decoderow = LZWDecodeCompat;
  276|     80|            tif->tif_decodestrip = LZWDecodeCompat;
  277|     80|            tif->tif_decodetile = LZWDecodeCompat;
  278|       |            /*
  279|       |             * If doing horizontal differencing, must
  280|       |             * re-setup the predictor logic since we
  281|       |             * switched the basic decoder methods...
  282|       |             */
  283|     80|            (*tif->tif_setupdecode)(tif);
  284|     80|            sp->dec_decode = LZWDecodeCompat;
  285|     80|        }
  286|  1.73k|        sp->lzw_maxcode = MAXCODE(BITS_MIN);
  ------------------
  |  |  103|  1.73k|#define lzw_maxcode base.maxcode
  ------------------
                      sp->lzw_maxcode = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  1.73k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  287|       |#else  /* !LZW_COMPAT */
  288|       |        if (!sp->dec_decode)
  289|       |        {
  290|       |            TIFFErrorExtR(tif, module, "Old-style LZW codes not supported");
  291|       |            sp->dec_decode = LZWDecode;
  292|       |        }
  293|       |        return (0);
  294|       |#endif /* !LZW_COMPAT */
  295|  1.73k|    }
  296|  17.7k|    else
  297|  17.7k|    {
  298|  17.7k|        sp->lzw_maxcode = MAXCODE(BITS_MIN) - 1;
  ------------------
  |  |  103|  17.7k|#define lzw_maxcode base.maxcode
  ------------------
                      sp->lzw_maxcode = MAXCODE(BITS_MIN) - 1;
  ------------------
  |  |   63|  17.7k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  299|  17.7k|        sp->dec_decode = LZWDecode;
  300|  17.7k|    }
  301|  19.5k|    sp->lzw_nbits = BITS_MIN;
  ------------------
  |  |  102|  19.5k|#define lzw_nbits base.nbits
  ------------------
                  sp->lzw_nbits = BITS_MIN;
  ------------------
  |  |   68|  19.5k|#define BITS_MIN 9  /* start with 9 bits */
  ------------------
  302|  19.5k|    sp->lzw_nextbits = 0;
  ------------------
  |  |  106|  19.5k|#define lzw_nextbits base.nextbits
  ------------------
  303|  19.5k|    sp->lzw_nextdata = 0;
  ------------------
  |  |  105|  19.5k|#define lzw_nextdata base.nextdata
  ------------------
  304|       |
  305|  19.5k|    sp->dec_restart = 0;
  306|  19.5k|    sp->dec_nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  19.5k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  307|  19.5k|    sp->dec_bitsleft = 0;
  308|  19.5k|    sp->old_tif_rawcc = 0;
  309|  19.5k|    sp->dec_free_entp = sp->dec_codetab - 1; // + CODE_FIRST;
  310|       |    /*
  311|       |     * Zero entries that are not yet filled in.  We do
  312|       |     * this to guard against bogus input data that causes
  313|       |     * us to index into undefined entries.  If you can
  314|       |     * come up with a way to safely bounds-check input codes
  315|       |     * while decoding then you can remove this operation.
  316|       |     */
  317|  19.5k|    sp->dec_oldcodep = &sp->dec_codetab[0];
  318|  19.5k|    sp->dec_maxcodep = &sp->dec_codetab[sp->dec_nbitsmask - 1];
  319|  19.5k|    sp->read_error = 0;
  320|  19.5k|    return (1);
  321|  19.5k|}
tif_lzw.c:LZWDecodeCompat:
  800|  10.1k|{
  801|  10.1k|    static const char module[] = "LZWDecodeCompat";
  802|  10.1k|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|  10.1k|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|  10.1k|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  803|  10.1k|    uint8_t *op = (uint8_t *)op0;
  804|  10.1k|    tmsize_t occ = occ0;
  805|  10.1k|    uint8_t *tp;
  806|  10.1k|    uint8_t *bp;
  807|  10.1k|    int code, nbits;
  808|  10.1k|    int len;
  809|  10.1k|    long nextbits, nbitsmask;
  810|  10.1k|    WordType nextdata;
  811|  10.1k|    code_t *codep, *free_entp, *maxcodep, *oldcodep;
  812|       |
  813|  10.1k|    (void)s;
  814|  10.1k|    assert(sp != NULL);
  ------------------
  |  Branch (814:5): [True: 0, False: 10.1k]
  |  Branch (814:5): [True: 10.1k, False: 0]
  ------------------
  815|       |
  816|       |    /*
  817|       |     * Restart interrupted output operation.
  818|       |     */
  819|  10.1k|    if (sp->dec_restart)
  ------------------
  |  Branch (819:9): [True: 1.70k, False: 8.47k]
  ------------------
  820|  1.70k|    {
  821|  1.70k|        tmsize_t residue;
  822|       |
  823|  1.70k|        codep = sp->dec_codep;
  824|  1.70k|        residue = codep->length - sp->dec_restart;
  825|  1.70k|        if (residue > occ)
  ------------------
  |  Branch (825:13): [True: 589, False: 1.11k]
  ------------------
  826|    589|        {
  827|       |            /*
  828|       |             * Residue from previous decode is sufficient
  829|       |             * to satisfy decode request.  Skip to the
  830|       |             * start of the decoded string, place decoded
  831|       |             * values in the output buffer, and return.
  832|       |             */
  833|    589|            sp->dec_restart += occ;
  834|    589|            do
  835|    824|            {
  836|    824|                codep = codep->next;
  837|    824|            } while (--residue > occ);
  ------------------
  |  Branch (837:22): [True: 235, False: 589]
  ------------------
  838|    589|            tp = op + occ;
  839|    589|            do
  840|  1.03k|            {
  841|  1.03k|                *--tp = codep->value;
  842|  1.03k|                codep = codep->next;
  843|  1.03k|            } while (--occ);
  ------------------
  |  Branch (843:22): [True: 447, False: 589]
  ------------------
  844|    589|            return (1);
  845|    589|        }
  846|       |        /*
  847|       |         * Residue satisfies only part of the decode request.
  848|       |         */
  849|  1.11k|        op += residue;
  850|  1.11k|        occ -= residue;
  851|  1.11k|        tp = op;
  852|  1.11k|        do
  853|  1.56k|        {
  854|  1.56k|            *--tp = codep->value;
  855|  1.56k|            codep = codep->next;
  856|  1.56k|        } while (--residue);
  ------------------
  |  Branch (856:18): [True: 453, False: 1.11k]
  ------------------
  857|  1.11k|        sp->dec_restart = 0;
  858|  1.11k|    }
  859|       |
  860|  9.58k|    bp = (uint8_t *)tif->tif_rawcp;
  861|       |
  862|  9.58k|    sp->dec_bitsleft +=
  863|  9.58k|        (((uint64_t)tif->tif_rawcc - (uint64_t)sp->old_tif_rawcc) << 3);
  864|  9.58k|    uint64_t dec_bitsleft = sp->dec_bitsleft;
  865|       |
  866|  9.58k|    nbits = sp->lzw_nbits;
  ------------------
  |  |  102|  9.58k|#define lzw_nbits base.nbits
  ------------------
  867|  9.58k|    nextdata = sp->lzw_nextdata;
  ------------------
  |  |  105|  9.58k|#define lzw_nextdata base.nextdata
  ------------------
  868|  9.58k|    nextbits = sp->lzw_nextbits;
  ------------------
  |  |  106|  9.58k|#define lzw_nextbits base.nextbits
  ------------------
  869|  9.58k|    nbitsmask = sp->dec_nbitsmask;
  870|  9.58k|    oldcodep = sp->dec_oldcodep;
  871|  9.58k|    free_entp = sp->dec_free_entp;
  872|  9.58k|    maxcodep = sp->dec_maxcodep;
  873|       |
  874|  90.6k|    while (occ > 0)
  ------------------
  |  Branch (874:12): [True: 87.2k, False: 3.40k]
  ------------------
  875|  87.2k|    {
  876|  87.2k|        NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  ------------------
  |  |  766|  87.2k|    {                                                                          \
  |  |  767|  87.2k|        if (dec_bitsleft < (uint64_t)nbits)                                    \
  |  |  ------------------
  |  |  |  Branch (767:13): [True: 646, False: 86.5k]
  |  |  ------------------
  |  |  768|  87.2k|        {                                                                      \
  |  |  769|    646|            TIFFWarningExtR(_tif, module,                                      \
  |  |  770|    646|                            "LZWDecode: Strip %" PRIu32                        \
  |  |  771|    646|                            " not terminated with EOI code",                   \
  |  |  772|    646|                            _tif->tif_dir.td_curstrip);                        \
  |  |  773|    646|            _code = CODE_EOI;                                                  \
  |  |  ------------------
  |  |  |  |   72|    646|#define CODE_EOI 257   /* end-of-information code */
  |  |  ------------------
  |  |  774|    646|        }                                                                      \
  |  |  775|  87.2k|        else                                                                   \
  |  |  776|  87.2k|        {                                                                      \
  |  |  777|  86.5k|            _get(_sp, _bp, _code);                                             \
  |  |  ------------------
  |  |  |  |  876|  86.5k|        NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  |  |  |  |  ------------------
  |  |  |  |  |  |  786|  86.5k|    {                                                                          \
  |  |  |  |  |  |  787|  86.5k|        nextdata |= (unsigned long)*(bp)++ << nextbits;                        \
  |  |  |  |  |  |  788|  86.5k|        nextbits += 8;                                                         \
  |  |  |  |  |  |  789|  86.5k|        if (nextbits < nbits)                                                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (789:13): [True: 25.7k, False: 60.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  86.5k|        {                                                                      \
  |  |  |  |  |  |  791|  25.7k|            nextdata |= (unsigned long)*(bp)++ << nextbits;                    \
  |  |  |  |  |  |  792|  25.7k|            nextbits += 8;                                                     \
  |  |  |  |  |  |  793|  25.7k|        }                                                                      \
  |  |  |  |  |  |  794|  86.5k|        code = (hcode_t)(nextdata & (unsigned long)nbitsmask);                 \
  |  |  |  |  |  |  795|  86.5k|        nextdata >>= nbits;                                                    \
  |  |  |  |  |  |  796|  86.5k|        nextbits -= nbits;                                                     \
  |  |  |  |  |  |  797|  86.5k|    }
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  778|  86.5k|            dec_bitsleft -= (uint64_t)nbits;                                   \
  |  |  779|  86.5k|        }                                                                      \
  |  |  780|  87.2k|    }
  ------------------
  877|  87.2k|        if (code == CODE_EOI)
  ------------------
  |  |   72|  87.2k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (877:13): [True: 769, False: 86.4k]
  ------------------
  878|    769|            break;
  879|  86.4k|        if (code == CODE_CLEAR)
  ------------------
  |  |   71|  86.4k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (879:13): [True: 1.65k, False: 84.7k]
  ------------------
  880|  1.65k|        {
  881|  1.65k|            do
  882|  1.65k|            {
  883|  1.65k|                free_entp = sp->dec_codetab + CODE_FIRST;
  ------------------
  |  |   73|  1.65k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  884|  1.65k|                _TIFFmemset(free_entp, 0,
  885|  1.65k|                            (CSIZE - CODE_FIRST) * sizeof(code_t));
  ------------------
  |  |   79|  1.65k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|  1.65k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
                                          (CSIZE - CODE_FIRST) * sizeof(code_t));
  ------------------
  |  |   73|  1.65k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  886|  1.65k|                nbits = BITS_MIN;
  ------------------
  |  |   68|  1.65k|#define BITS_MIN 9  /* start with 9 bits */
  ------------------
  887|  1.65k|                nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  1.65k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  888|  1.65k|                maxcodep = sp->dec_codetab + nbitsmask;
  889|  1.65k|                NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  ------------------
  |  |  766|  1.65k|    {                                                                          \
  |  |  767|  1.65k|        if (dec_bitsleft < (uint64_t)nbits)                                    \
  |  |  ------------------
  |  |  |  Branch (767:13): [True: 188, False: 1.46k]
  |  |  ------------------
  |  |  768|  1.65k|        {                                                                      \
  |  |  769|    188|            TIFFWarningExtR(_tif, module,                                      \
  |  |  770|    188|                            "LZWDecode: Strip %" PRIu32                        \
  |  |  771|    188|                            " not terminated with EOI code",                   \
  |  |  772|    188|                            _tif->tif_dir.td_curstrip);                        \
  |  |  773|    188|            _code = CODE_EOI;                                                  \
  |  |  ------------------
  |  |  |  |   72|    188|#define CODE_EOI 257   /* end-of-information code */
  |  |  ------------------
  |  |  774|    188|        }                                                                      \
  |  |  775|  1.65k|        else                                                                   \
  |  |  776|  1.65k|        {                                                                      \
  |  |  777|  1.46k|            _get(_sp, _bp, _code);                                             \
  |  |  ------------------
  |  |  |  |  889|  1.46k|                NextCode(tif, sp, bp, code, GetNextCodeCompat, dec_bitsleft);
  |  |  |  |  ------------------
  |  |  |  |  |  |  786|  1.46k|    {                                                                          \
  |  |  |  |  |  |  787|  1.46k|        nextdata |= (unsigned long)*(bp)++ << nextbits;                        \
  |  |  |  |  |  |  788|  1.46k|        nextbits += 8;                                                         \
  |  |  |  |  |  |  789|  1.46k|        if (nextbits < nbits)                                                  \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (789:13): [True: 14, False: 1.45k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  790|  1.46k|        {                                                                      \
  |  |  |  |  |  |  791|     14|            nextdata |= (unsigned long)*(bp)++ << nextbits;                    \
  |  |  |  |  |  |  792|     14|            nextbits += 8;                                                     \
  |  |  |  |  |  |  793|     14|        }                                                                      \
  |  |  |  |  |  |  794|  1.46k|        code = (hcode_t)(nextdata & (unsigned long)nbitsmask);                 \
  |  |  |  |  |  |  795|  1.46k|        nextdata >>= nbits;                                                    \
  |  |  |  |  |  |  796|  1.46k|        nextbits -= nbits;                                                     \
  |  |  |  |  |  |  797|  1.46k|    }
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  778|  1.46k|            dec_bitsleft -= (uint64_t)nbits;                                   \
  |  |  779|  1.46k|        }                                                                      \
  |  |  780|  1.65k|    }
  ------------------
  890|  1.65k|            } while (code == CODE_CLEAR); /* consecutive CODE_CLEAR codes */
  ------------------
  |  |   71|  1.65k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (890:22): [True: 1, False: 1.65k]
  ------------------
  891|  1.65k|            if (code == CODE_EOI)
  ------------------
  |  |   72|  1.65k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (891:17): [True: 325, False: 1.32k]
  ------------------
  892|    325|                break;
  893|  1.32k|            if (code > CODE_CLEAR)
  ------------------
  |  |   71|  1.32k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (893:17): [True: 117, False: 1.20k]
  ------------------
  894|    117|            {
  895|    117|                TIFFErrorExtR(
  896|    117|                    tif, tif->tif_name,
  897|    117|                    "LZWDecode: Corrupted LZW table at scanline %" PRIu32,
  898|    117|                    tif->tif_dir.td_row);
  899|    117|                return (0);
  900|    117|            }
  901|  1.20k|            *op++ = (uint8_t)code;
  902|  1.20k|            occ--;
  903|  1.20k|            oldcodep = sp->dec_codetab + code;
  904|  1.20k|            continue;
  905|  1.32k|        }
  906|  84.7k|        codep = sp->dec_codetab + code;
  907|       |
  908|       |        /*
  909|       |         * Add the new entry to the code table.
  910|       |         */
  911|  84.7k|        if (free_entp < &sp->dec_codetab[0] ||
  ------------------
  |  Branch (911:13): [True: 3.37k, False: 81.4k]
  ------------------
  912|  81.4k|            free_entp >= &sp->dec_codetab[CSIZE])
  ------------------
  |  |   79|  81.4k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|  81.4k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (912:13): [True: 1, False: 81.4k]
  ------------------
  913|  3.37k|        {
  914|  3.37k|            TIFFErrorExtR(tif, module,
  915|  3.37k|                          "Corrupted LZW table at scanline %" PRIu32,
  916|  3.37k|                          tif->tif_dir.td_row);
  917|  3.37k|            return (0);
  918|  3.37k|        }
  919|       |
  920|  81.4k|        free_entp->next = oldcodep;
  921|  81.4k|        if (free_entp->next < &sp->dec_codetab[0] ||
  ------------------
  |  Branch (921:13): [True: 0, False: 81.4k]
  ------------------
  922|  81.4k|            free_entp->next >= &sp->dec_codetab[CSIZE])
  ------------------
  |  |   79|  81.4k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|  81.4k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (922:13): [True: 0, False: 81.4k]
  ------------------
  923|      0|        {
  924|      0|            TIFFErrorExtR(tif, module,
  925|      0|                          "Corrupted LZW table at scanline %" PRIu32,
  926|      0|                          tif->tif_dir.td_row);
  927|      0|            return (0);
  928|      0|        }
  929|  81.4k|        free_entp->firstchar = free_entp->next->firstchar;
  930|  81.4k|        free_entp->length = (uint16_t)(free_entp->next->length + 1);
  931|  81.4k|        free_entp->value =
  932|  81.4k|            (codep < free_entp) ? codep->firstchar : free_entp->firstchar;
  ------------------
  |  Branch (932:13): [True: 81.2k, False: 186]
  ------------------
  933|  81.4k|        if (++free_entp > maxcodep)
  ------------------
  |  Branch (933:13): [True: 3.13k, False: 78.2k]
  ------------------
  934|  3.13k|        {
  935|  3.13k|            if (++nbits > BITS_MAX) /* should not happen */
  ------------------
  |  |   69|  3.13k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  |  Branch (935:17): [True: 3.06k, False: 69]
  ------------------
  936|  3.06k|                nbits = BITS_MAX;
  ------------------
  |  |   69|  3.06k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  937|  3.13k|            nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|  3.13k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  938|  3.13k|            maxcodep = sp->dec_codetab + nbitsmask;
  939|  3.13k|        }
  940|  81.4k|        oldcodep = codep;
  941|  81.4k|        if (code >= 256)
  ------------------
  |  Branch (941:13): [True: 4.74k, False: 76.6k]
  ------------------
  942|  4.74k|        {
  943|       |            /*
  944|       |             * Code maps to a string, copy string
  945|       |             * value to output (written in reverse).
  946|       |             */
  947|  4.74k|            if (codep->length == 0)
  ------------------
  |  Branch (947:17): [True: 183, False: 4.56k]
  ------------------
  948|    183|            {
  949|    183|                TIFFErrorExtR(
  950|    183|                    tif, module,
  951|    183|                    "Wrong length of decoded "
  952|    183|                    "string: data probably corrupted at scanline %" PRIu32,
  953|    183|                    tif->tif_dir.td_row);
  954|    183|                return (0);
  955|    183|            }
  956|  4.56k|            if (codep->length > occ)
  ------------------
  |  Branch (956:17): [True: 1.40k, False: 3.15k]
  ------------------
  957|  1.40k|            {
  958|       |                /*
  959|       |                 * String is too long for decode buffer,
  960|       |                 * locate portion that will fit, copy to
  961|       |                 * the decode buffer, and setup restart
  962|       |                 * logic for the next decoding call.
  963|       |                 */
  964|  1.40k|                sp->dec_codep = codep;
  965|  1.40k|                do
  966|  2.98k|                {
  967|  2.98k|                    codep = codep->next;
  968|  2.98k|                } while (codep->length > occ);
  ------------------
  |  Branch (968:26): [True: 1.58k, False: 1.40k]
  ------------------
  969|  1.40k|                sp->dec_restart = occ;
  970|  1.40k|                tp = op + occ;
  971|  1.40k|                do
  972|  1.83k|                {
  973|  1.83k|                    *--tp = codep->value;
  974|  1.83k|                    codep = codep->next;
  975|  1.83k|                } while (--occ);
  ------------------
  |  Branch (975:26): [True: 433, False: 1.40k]
  ------------------
  976|  1.40k|                break;
  977|  1.40k|            }
  978|  3.15k|            len = codep->length;
  979|  3.15k|            tp = op + len;
  980|  3.15k|            do
  981|  7.16k|            {
  982|  7.16k|                *--tp = codep->value;
  983|  7.16k|                codep = codep->next;
  984|  7.16k|            } while (codep && tp > op);
  ------------------
  |  Branch (984:22): [True: 4.00k, False: 3.15k]
  |  Branch (984:31): [True: 4.00k, False: 0]
  ------------------
  985|  3.15k|            assert(occ >= len);
  ------------------
  |  Branch (985:13): [True: 0, False: 3.15k]
  |  Branch (985:13): [True: 3.15k, False: 0]
  ------------------
  986|  3.15k|            op += len;
  987|  3.15k|            occ -= len;
  988|  3.15k|        }
  989|  76.6k|        else
  990|  76.6k|        {
  991|  76.6k|            *op++ = (uint8_t)code;
  992|  76.6k|            occ--;
  993|  76.6k|        }
  994|  81.4k|    }
  995|       |
  996|  5.90k|    tif->tif_rawcc -= (tmsize_t)((uint8_t *)bp - tif->tif_rawcp);
  997|  5.90k|    tif->tif_rawcp = (uint8_t *)bp;
  998|       |
  999|  5.90k|    sp->old_tif_rawcc = tif->tif_rawcc;
 1000|  5.90k|    sp->dec_bitsleft = dec_bitsleft;
 1001|       |
 1002|  5.90k|    sp->lzw_nbits = (unsigned short)nbits;
  ------------------
  |  |  102|  5.90k|#define lzw_nbits base.nbits
  ------------------
 1003|  5.90k|    sp->lzw_nextdata = nextdata;
  ------------------
  |  |  105|  5.90k|#define lzw_nextdata base.nextdata
  ------------------
 1004|  5.90k|    sp->lzw_nextbits = nextbits;
  ------------------
  |  |  106|  5.90k|#define lzw_nextbits base.nextbits
  ------------------
 1005|  5.90k|    sp->dec_nbitsmask = nbitsmask;
 1006|  5.90k|    sp->dec_oldcodep = oldcodep;
 1007|  5.90k|    sp->dec_free_entp = free_entp;
 1008|  5.90k|    sp->dec_maxcodep = maxcodep;
 1009|       |
 1010|  5.90k|    if (occ > 0)
  ------------------
  |  Branch (1010:9): [True: 1.09k, False: 4.81k]
  ------------------
 1011|  1.09k|    {
 1012|  1.09k|        TIFFErrorExtR(tif, module,
 1013|  1.09k|                      "Not enough data at scanline %" PRIu32 " (short %" PRIu64
 1014|  1.09k|                      " bytes)",
 1015|  1.09k|                      tif->tif_dir.td_row, (uint64_t)occ);
 1016|  1.09k|        return (0);
 1017|  1.09k|    }
 1018|  4.81k|    return (1);
 1019|  5.90k|}
tif_lzw.c:LZWDecode:
  403|  18.6k|{
  404|  18.6k|    static const char module[] = "LZWDecode";
  405|  18.6k|    LZWCodecState *sp = LZWDecoderState(tif);
  ------------------
  |  |  164|  18.6k|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|  18.6k|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  406|  18.6k|    uint8_t *op = (uint8_t *)op0;
  407|  18.6k|    tmsize_t occ = occ0;
  408|  18.6k|    uint8_t *bp;
  409|  18.6k|    long nbits, nextbits, nbitsmask;
  410|  18.6k|    WordType nextdata;
  411|  18.6k|    code_t *free_entp, *maxcodep, *oldcodep;
  412|       |
  413|  18.6k|    (void)s;
  414|  18.6k|    assert(sp != NULL);
  ------------------
  |  Branch (414:5): [True: 0, False: 18.6k]
  |  Branch (414:5): [True: 18.6k, False: 0]
  ------------------
  415|  18.6k|    assert(sp->dec_codetab != NULL);
  ------------------
  |  Branch (415:5): [True: 0, False: 18.6k]
  |  Branch (415:5): [True: 18.6k, False: 0]
  ------------------
  416|       |
  417|  18.6k|    if (sp->read_error)
  ------------------
  |  Branch (417:9): [True: 41, False: 18.6k]
  ------------------
  418|     41|    {
  419|     41|        memset(op, 0, (size_t)occ);
  420|     41|        TIFFErrorExtR(tif, module,
  421|     41|                      "LZWDecode: Scanline %" PRIu32 " cannot be read due to "
  422|     41|                      "previous error",
  423|     41|                      tif->tif_dir.td_row);
  424|     41|        return 0;
  425|     41|    }
  426|       |
  427|       |    /*
  428|       |     * Restart interrupted output operation.
  429|       |     */
  430|  18.6k|    if (sp->dec_restart)
  ------------------
  |  Branch (430:9): [True: 1.88k, False: 16.7k]
  ------------------
  431|  1.88k|    {
  432|  1.88k|        tmsize_t residue;
  433|       |
  434|  1.88k|        code_t *codep = sp->dec_codep;
  435|  1.88k|        residue = codep->length - sp->dec_restart;
  436|  1.88k|        if (residue > occ)
  ------------------
  |  Branch (436:13): [True: 400, False: 1.48k]
  ------------------
  437|    400|        {
  438|       |            /*
  439|       |             * Residue from previous decode is sufficient
  440|       |             * to satisfy decode request.  Skip to the
  441|       |             * start of the decoded string, place decoded
  442|       |             * values in the output buffer, and return.
  443|       |             */
  444|    400|            sp->dec_restart += occ;
  445|    400|            do
  446|    708|            {
  447|    708|                codep = codep->next;
  448|    708|            } while (--residue > occ && codep);
  ------------------
  |  Branch (448:22): [True: 308, False: 400]
  |  Branch (448:41): [True: 308, False: 0]
  ------------------
  449|    400|            if (codep)
  ------------------
  |  Branch (449:17): [True: 400, False: 0]
  ------------------
  450|    400|            {
  451|    400|                uint8_t *tp = op + occ;
  452|    400|                do
  453|    746|                {
  454|    746|                    *--tp = codep->value;
  455|    746|                    codep = codep->next;
  456|    746|                } while (--occ && codep);
  ------------------
  |  Branch (456:26): [True: 346, False: 400]
  |  Branch (456:35): [True: 346, False: 0]
  ------------------
  457|    400|            }
  458|    400|            return (1);
  459|    400|        }
  460|       |        /*
  461|       |         * Residue satisfies only part of the decode request.
  462|       |         */
  463|  1.48k|        op += residue;
  464|  1.48k|        occ -= residue;
  465|  1.48k|        uint8_t *tp = op;
  466|  1.48k|        do
  467|  2.50k|        {
  468|  2.50k|            *--tp = codep->value;
  469|  2.50k|            codep = codep->next;
  470|  2.50k|        } while (--residue && codep);
  ------------------
  |  Branch (470:18): [True: 1.01k, False: 1.48k]
  |  Branch (470:31): [True: 1.01k, False: 0]
  ------------------
  471|  1.48k|        sp->dec_restart = 0;
  472|  1.48k|    }
  473|       |
  474|  18.2k|    bp = (uint8_t *)tif->tif_rawcp;
  475|  18.2k|    sp->dec_bitsleft +=
  476|  18.2k|        (((uint64_t)tif->tif_rawcc - (uint64_t)sp->old_tif_rawcc) << 3);
  477|  18.2k|    uint64_t dec_bitsleft = sp->dec_bitsleft;
  478|  18.2k|    nbits = sp->lzw_nbits;
  ------------------
  |  |  102|  18.2k|#define lzw_nbits base.nbits
  ------------------
  479|  18.2k|    nextdata = sp->lzw_nextdata;
  ------------------
  |  |  105|  18.2k|#define lzw_nextdata base.nextdata
  ------------------
  480|  18.2k|    nextbits = sp->lzw_nextbits;
  ------------------
  |  |  106|  18.2k|#define lzw_nextbits base.nextbits
  ------------------
  481|  18.2k|    nbitsmask = sp->dec_nbitsmask;
  482|  18.2k|    oldcodep = sp->dec_oldcodep;
  483|  18.2k|    free_entp = sp->dec_free_entp;
  484|  18.2k|    maxcodep = sp->dec_maxcodep;
  485|  18.2k|    code_t *const dec_codetab = sp->dec_codetab;
  486|  18.2k|    code_t *codep;
  487|       |
  488|  18.2k|    if (occ == 0)
  ------------------
  |  Branch (488:9): [True: 424, False: 17.7k]
  ------------------
  489|    424|    {
  490|    424|        goto after_loop;
  491|    424|    }
  492|       |
  493|   354k|begin:
  494|   354k|{
  495|   354k|    WordType code;
  496|   354k|    GetNextCodeLZW();
  ------------------
  |  |  362|   354k|    do                                                                         \
  |  |  363|   354k|    {                                                                          \
  |  |  364|   354k|        nextbits -= nbits;                                                     \
  |  |  365|   354k|        if (nextbits < 0)                                                      \
  |  |  ------------------
  |  |  |  Branch (365:13): [True: 67.3k, False: 287k]
  |  |  ------------------
  |  |  366|   354k|        {                                                                      \
  |  |  367|  67.3k|            if (dec_bitsleft >= 8 * SIZEOF_WORDTYPE)                           \
  |  |  ------------------
  |  |  |  |   45|  67.3k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  67.3k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (367:17): [True: 63.2k, False: 4.11k]
  |  |  ------------------
  |  |  368|  67.3k|            {                                                                  \
  |  |  369|  63.2k|                unsigned codetmp = (unsigned)(nextdata << (-nextbits));        \
  |  |  370|  63.2k|                GetNextData(nextdata, bp);                                     \
  |  |  ------------------
  |  |  |  |  335|  63.2k|    memcpy(&nextdata, bp, sizeof(nextdata));                                   \
  |  |  |  |  336|  63.2k|    nextdata = __builtin_bswap64(nextdata)
  |  |  ------------------
  |  |  371|  63.2k|                bp += SIZEOF_WORDTYPE;                                         \
  |  |  ------------------
  |  |  |  |   45|  63.2k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  63.2k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  63.2k|                nextbits += 8 * SIZEOF_WORDTYPE;                               \
  |  |  ------------------
  |  |  |  |   45|  63.2k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  63.2k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  373|  63.2k|                dec_bitsleft -= 8 * SIZEOF_WORDTYPE;                           \
  |  |  ------------------
  |  |  |  |   45|  63.2k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  63.2k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  374|  63.2k|                code = (WordType)((codetmp | (nextdata >> nextbits)) &         \
  |  |  375|  63.2k|                                  (WordType)nbitsmask);                        \
  |  |  376|  63.2k|                break;                                                         \
  |  |  377|  63.2k|            }                                                                  \
  |  |  378|  67.3k|            else                                                               \
  |  |  379|  67.3k|            {                                                                  \
  |  |  380|  4.11k|                if (dec_bitsleft < 8)                                          \
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 670, False: 3.44k]
  |  |  ------------------
  |  |  381|  4.11k|                {                                                              \
  |  |  382|    670|                    goto no_eoi;                                               \
  |  |  383|    670|                }                                                              \
  |  |  384|  4.11k|                nextdata = (nextdata << 8) | *(bp)++;                          \
  |  |  385|  3.44k|                nextbits += 8;                                                 \
  |  |  386|  3.44k|                dec_bitsleft -= 8;                                             \
  |  |  387|  3.44k|                if (nextbits < 0)                                              \
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 2.09k, False: 1.35k]
  |  |  ------------------
  |  |  388|  3.44k|                {                                                              \
  |  |  389|  2.09k|                    if (dec_bitsleft < 8)                                      \
  |  |  ------------------
  |  |  |  Branch (389:25): [True: 1.38k, False: 711]
  |  |  ------------------
  |  |  390|  2.09k|                    {                                                          \
  |  |  391|  1.38k|                        goto no_eoi;                                           \
  |  |  392|  1.38k|                    }                                                          \
  |  |  393|  2.09k|                    nextdata = (nextdata << 8) | *(bp)++;                      \
  |  |  394|    711|                    nextbits += 8;                                             \
  |  |  395|    711|                    dec_bitsleft -= 8;                                         \
  |  |  396|    711|                }                                                              \
  |  |  397|  3.44k|            }                                                                  \
  |  |  398|  67.3k|        }                                                                      \
  |  |  399|   354k|        code = (WordType)((nextdata >> nextbits) & (WordType)nbitsmask);       \
  |  |  400|   289k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (400:14): [Folded, False: 289k]
  |  |  ------------------
  ------------------
  497|   352k|    codep = dec_codetab + (unsigned long)code;
  498|   352k|    if (code >= CODE_FIRST)
  ------------------
  |  |   73|   352k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  |  Branch (498:9): [True: 104k, False: 248k]
  ------------------
  499|   104k|        goto code_above_or_equal_to_258;
  500|   248k|    if (code < 256)
  ------------------
  |  Branch (500:9): [True: 242k, False: 6.43k]
  ------------------
  501|   242k|        goto code_below_256;
  502|  6.43k|    if (code == CODE_EOI)
  ------------------
  |  |   72|  6.43k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (502:9): [True: 48, False: 6.38k]
  ------------------
  503|     48|        goto after_loop;
  504|  6.38k|    goto code_clear;
  505|       |
  506|   242k|code_below_256:
  507|   242k|{
  508|   242k|    if (codep > free_entp)
  ------------------
  |  Branch (508:9): [True: 7.44k, False: 234k]
  ------------------
  509|  7.44k|        goto error_code;
  510|   234k|    free_entp->next = oldcodep;
  511|   234k|    free_entp->firstchar = oldcodep->firstchar;
  512|   234k|    free_entp->length = (uint16_t)(oldcodep->length + 1);
  513|   234k|    free_entp->value = (uint8_t)code;
  514|   234k|    free_entp->repeated =
  515|   234k|        (bool)(oldcodep->repeated & (oldcodep->value == code));
  516|   234k|    if (++free_entp > maxcodep)
  ------------------
  |  Branch (516:9): [True: 7.40k, False: 227k]
  ------------------
  517|  7.40k|    {
  518|  7.40k|        if (++nbits > BITS_MAX) /* should not happen for a conformant encoder */
  ------------------
  |  |   69|  7.40k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  |  Branch (518:13): [True: 7.27k, False: 131]
  ------------------
  519|  7.27k|            nbits = BITS_MAX;
  ------------------
  |  |   69|  7.27k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  520|  7.40k|        nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|  7.40k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  521|  7.40k|        maxcodep = dec_codetab + nbitsmask - 1;
  522|  7.40k|        if (free_entp >= &dec_codetab[CSIZE])
  ------------------
  |  |   79|  7.40k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|  7.40k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (522:13): [True: 4, False: 7.40k]
  ------------------
  523|      4|        {
  524|       |            /* At that point, the next valid states are either EOI or a */
  525|       |            /* CODE_CLEAR. If a regular code is read, at the next */
  526|       |            /* attempt at registering a new entry, we will error out */
  527|       |            /* due to setting free_entp before any valid code */
  528|      4|            free_entp = dec_codetab - 1;
  529|      4|        }
  530|  7.40k|    }
  531|   234k|    oldcodep = codep;
  532|   234k|    *op++ = (uint8_t)code;
  533|   234k|    occ--;
  534|   234k|    if (occ == 0)
  ------------------
  |  Branch (534:9): [True: 1.82k, False: 232k]
  ------------------
  535|  1.82k|        goto after_loop;
  536|   232k|    goto begin;
  537|   234k|}
  538|       |
  539|   232k|code_above_or_equal_to_258:
  540|   104k|{
  541|       |    /*
  542|       |     * Add the new entry to the code table.
  543|       |     */
  544|       |
  545|   104k|    if (codep >= free_entp)
  ------------------
  |  Branch (545:9): [True: 11.2k, False: 93.1k]
  ------------------
  546|  11.2k|    {
  547|  11.2k|        if (codep != free_entp)
  ------------------
  |  Branch (547:13): [True: 1.91k, False: 9.29k]
  ------------------
  548|  1.91k|            goto error_code;
  549|  9.29k|        free_entp->value = oldcodep->firstchar;
  550|  9.29k|    }
  551|  93.1k|    else
  552|  93.1k|    {
  553|  93.1k|        free_entp->value = codep->firstchar;
  554|  93.1k|    }
  555|   102k|    free_entp->repeated =
  556|   102k|        (bool)(oldcodep->repeated & (oldcodep->value == free_entp->value));
  557|   102k|    free_entp->next = oldcodep;
  558|       |
  559|   102k|    free_entp->firstchar = oldcodep->firstchar;
  560|   102k|    free_entp->length = (uint16_t)(oldcodep->length + 1);
  561|   102k|    if (++free_entp > maxcodep)
  ------------------
  |  Branch (561:9): [True: 1.60k, False: 100k]
  ------------------
  562|  1.60k|    {
  563|  1.60k|        if (++nbits > BITS_MAX) /* should not happen for a conformant encoder */
  ------------------
  |  |   69|  1.60k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  |  Branch (563:13): [True: 1.55k, False: 46]
  ------------------
  564|  1.55k|            nbits = BITS_MAX;
  ------------------
  |  |   69|  1.55k|#define BITS_MAX 12 /* max of 12 bit strings */
  ------------------
  565|  1.60k|        nbitsmask = MAXCODE(nbits);
  ------------------
  |  |   63|  1.60k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  566|  1.60k|        maxcodep = dec_codetab + nbitsmask - 1;
  567|  1.60k|        if (free_entp >= &dec_codetab[CSIZE])
  ------------------
  |  |   79|  1.60k|#define CSIZE (MAXCODE(BITS_MAX) + 1024L)
  |  |  ------------------
  |  |  |  |   63|  1.60k|#define MAXCODE(n) ((1 << (n)) - 1)
  |  |  ------------------
  ------------------
  |  Branch (567:13): [True: 1, False: 1.60k]
  ------------------
  568|      1|        {
  569|       |            /* At that point, the next valid states are either EOI or a */
  570|       |            /* CODE_CLEAR. If a regular code is read, at the next */
  571|       |            /* attempt at registering a new entry, we will error out */
  572|       |            /* due to setting free_entp before any valid code */
  573|      1|            free_entp = dec_codetab - 1;
  574|      1|        }
  575|  1.60k|    }
  576|   102k|    oldcodep = codep;
  577|       |
  578|       |    /*
  579|       |     * Code maps to a string, copy string
  580|       |     * value to output (written in reverse).
  581|       |     */
  582|       |    /* tiny bit faster on x86_64 to store in unsigned short than int */
  583|   102k|    unsigned short len = codep->length;
  584|       |
  585|   102k|    if (len < 3) /* equivalent to len == 2 given all other conditions */
  ------------------
  |  Branch (585:9): [True: 49.4k, False: 52.9k]
  ------------------
  586|  49.4k|    {
  587|  49.4k|        if (occ <= 2)
  ------------------
  |  Branch (587:13): [True: 941, False: 48.4k]
  ------------------
  588|    941|        {
  589|    941|            if (occ == 2)
  ------------------
  |  Branch (589:17): [True: 427, False: 514]
  ------------------
  590|    427|            {
  591|    427|                memcpy(op, &(codep->firstchar), 2);
  592|    427|                op += 2;
  593|    427|                occ -= 2;
  594|    427|                goto after_loop;
  595|    427|            }
  596|    514|            goto too_short_buffer;
  597|    941|        }
  598|       |
  599|  48.4k|        memcpy(op, &(codep->firstchar), 2);
  600|  48.4k|        op += 2;
  601|  48.4k|        occ -= 2;
  602|  48.4k|        goto begin; /* we can save the comparison occ > 0 */
  603|  49.4k|    }
  604|       |
  605|  52.9k|    if (len == 3)
  ------------------
  |  Branch (605:9): [True: 35.6k, False: 17.3k]
  ------------------
  606|  35.6k|    {
  607|  35.6k|        if (occ <= 3)
  ------------------
  |  Branch (607:13): [True: 1.15k, False: 34.4k]
  ------------------
  608|  1.15k|        {
  609|  1.15k|            if (occ == 3)
  ------------------
  |  Branch (609:17): [True: 368, False: 783]
  ------------------
  610|    368|            {
  611|    368|                op[0] = codep->firstchar;
  612|    368|                op[1] = codep->next->value;
  613|    368|                op[2] = codep->value;
  614|    368|                op += 3;
  615|    368|                occ -= 3;
  616|    368|                goto after_loop;
  617|    368|            }
  618|    783|            goto too_short_buffer;
  619|  1.15k|        }
  620|       |
  621|  34.4k|        op[0] = codep->firstchar;
  622|  34.4k|        op[1] = codep->next->value;
  623|  34.4k|        op[2] = codep->value;
  624|  34.4k|        op += 3;
  625|  34.4k|        occ -= 3;
  626|  34.4k|        goto begin; /* we can save the comparison occ > 0 */
  627|  35.6k|    }
  628|       |
  629|  17.3k|    if (len > occ)
  ------------------
  |  Branch (629:9): [True: 873, False: 16.4k]
  ------------------
  630|    873|    {
  631|    873|        goto too_short_buffer;
  632|    873|    }
  633|       |
  634|  16.4k|    if (codep->repeated)
  ------------------
  |  Branch (634:9): [True: 9.31k, False: 7.17k]
  ------------------
  635|  9.31k|    {
  636|  9.31k|        memset(op, codep->value, len);
  637|  9.31k|        op += len;
  638|  9.31k|        occ -= len;
  639|  9.31k|        if (occ == 0)
  ------------------
  |  Branch (639:13): [True: 227, False: 9.08k]
  ------------------
  640|    227|            goto after_loop;
  641|  9.08k|        goto begin;
  642|  9.31k|    }
  643|       |
  644|  7.17k|    uint8_t *tp = op + len;
  645|       |
  646|  7.17k|    assert(len >= 4);
  ------------------
  |  Branch (646:5): [True: 0, False: 7.17k]
  |  Branch (646:5): [True: 7.17k, False: 0]
  ------------------
  647|       |
  648|  7.17k|    *--tp = codep->value;
  649|  7.17k|    codep = codep->next;
  650|  7.17k|    *--tp = codep->value;
  651|  7.17k|    codep = codep->next;
  652|  7.17k|    *--tp = codep->value;
  653|  7.17k|    codep = codep->next;
  654|  7.17k|    *--tp = codep->value;
  655|  7.17k|    if (tp > op)
  ------------------
  |  Branch (655:9): [True: 3.67k, False: 3.50k]
  ------------------
  656|  3.67k|    {
  657|  3.67k|        do
  658|  7.92k|        {
  659|  7.92k|            codep = codep->next;
  660|  7.92k|            *--tp = codep->value;
  661|  7.92k|        } while (tp > op);
  ------------------
  |  Branch (661:18): [True: 4.25k, False: 3.67k]
  ------------------
  662|  3.67k|    }
  663|       |
  664|  7.17k|    assert(occ >= len);
  ------------------
  |  Branch (664:5): [True: 0, False: 7.17k]
  |  Branch (664:5): [True: 7.17k, False: 0]
  ------------------
  665|  7.17k|    op += len;
  666|  7.17k|    occ -= len;
  667|  7.17k|    if (occ == 0)
  ------------------
  |  Branch (667:9): [True: 280, False: 6.89k]
  ------------------
  668|    280|        goto after_loop;
  669|  6.89k|    goto begin;
  670|  7.17k|}
  671|       |
  672|  6.89k|code_clear:
  673|  6.38k|{
  674|  6.38k|    free_entp = dec_codetab + CODE_FIRST;
  ------------------
  |  |   73|  6.38k|#define CODE_FIRST 258 /* first free code entry */
  ------------------
  675|  6.38k|    nbits = BITS_MIN;
  ------------------
  |  |   68|  6.38k|#define BITS_MIN 9  /* start with 9 bits */
  ------------------
  676|  6.38k|    nbitsmask = MAXCODE(BITS_MIN);
  ------------------
  |  |   63|  6.38k|#define MAXCODE(n) ((1 << (n)) - 1)
  ------------------
  677|  6.38k|    maxcodep = dec_codetab + (unsigned long)nbitsmask - 1;
  678|  6.38k|    do
  679|  7.09k|    {
  680|  7.09k|        GetNextCodeLZW();
  ------------------
  |  |  362|  7.09k|    do                                                                         \
  |  |  363|  7.09k|    {                                                                          \
  |  |  364|  7.09k|        nextbits -= nbits;                                                     \
  |  |  365|  7.09k|        if (nextbits < 0)                                                      \
  |  |  ------------------
  |  |  |  Branch (365:13): [True: 1.76k, False: 5.33k]
  |  |  ------------------
  |  |  366|  7.09k|        {                                                                      \
  |  |  367|  1.76k|            if (dec_bitsleft >= 8 * SIZEOF_WORDTYPE)                           \
  |  |  ------------------
  |  |  |  |   45|  1.76k|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|  1.76k|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (367:17): [True: 663, False: 1.10k]
  |  |  ------------------
  |  |  368|  1.76k|            {                                                                  \
  |  |  369|    663|                unsigned codetmp = (unsigned)(nextdata << (-nextbits));        \
  |  |  370|    663|                GetNextData(nextdata, bp);                                     \
  |  |  ------------------
  |  |  |  |  335|    663|    memcpy(&nextdata, bp, sizeof(nextdata));                                   \
  |  |  |  |  336|    663|    nextdata = __builtin_bswap64(nextdata)
  |  |  ------------------
  |  |  371|    663|                bp += SIZEOF_WORDTYPE;                                         \
  |  |  ------------------
  |  |  |  |   45|    663|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|    663|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|    663|                nextbits += 8 * SIZEOF_WORDTYPE;                               \
  |  |  ------------------
  |  |  |  |   45|    663|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|    663|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  373|    663|                dec_bitsleft -= 8 * SIZEOF_WORDTYPE;                           \
  |  |  ------------------
  |  |  |  |   45|    663|#define SIZEOF_WORDTYPE SIZEOF_SIZE_T
  |  |  |  |  ------------------
  |  |  |  |  |  |  116|    663|#define SIZEOF_SIZE_T 8
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  374|    663|                code = (WordType)((codetmp | (nextdata >> nextbits)) &         \
  |  |  375|    663|                                  (WordType)nbitsmask);                        \
  |  |  376|    663|                break;                                                         \
  |  |  377|    663|            }                                                                  \
  |  |  378|  1.76k|            else                                                               \
  |  |  379|  1.76k|            {                                                                  \
  |  |  380|  1.10k|                if (dec_bitsleft < 8)                                          \
  |  |  ------------------
  |  |  |  Branch (380:21): [True: 264, False: 838]
  |  |  ------------------
  |  |  381|  1.10k|                {                                                              \
  |  |  382|    264|                    goto no_eoi;                                               \
  |  |  383|    264|                }                                                              \
  |  |  384|  1.10k|                nextdata = (nextdata << 8) | *(bp)++;                          \
  |  |  385|    838|                nextbits += 8;                                                 \
  |  |  386|    838|                dec_bitsleft -= 8;                                             \
  |  |  387|    838|                if (nextbits < 0)                                              \
  |  |  ------------------
  |  |  |  Branch (387:21): [True: 442, False: 396]
  |  |  ------------------
  |  |  388|    838|                {                                                              \
  |  |  389|    442|                    if (dec_bitsleft < 8)                                      \
  |  |  ------------------
  |  |  |  Branch (389:25): [True: 212, False: 230]
  |  |  ------------------
  |  |  390|    442|                    {                                                          \
  |  |  391|    212|                        goto no_eoi;                                           \
  |  |  392|    212|                    }                                                          \
  |  |  393|    442|                    nextdata = (nextdata << 8) | *(bp)++;                      \
  |  |  394|    230|                    nextbits += 8;                                             \
  |  |  395|    230|                    dec_bitsleft -= 8;                                         \
  |  |  396|    230|                }                                                              \
  |  |  397|    838|            }                                                                  \
  |  |  398|  1.76k|        }                                                                      \
  |  |  399|  7.09k|        code = (WordType)((nextdata >> nextbits) & (WordType)nbitsmask);       \
  |  |  400|  5.95k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (400:14): [Folded, False: 5.95k]
  |  |  ------------------
  ------------------
  681|  7.09k|    } while (code == CODE_CLEAR); /* consecutive CODE_CLEAR codes */
  ------------------
  |  |   71|  6.62k|#define CODE_CLEAR 256 /* code to clear string table */
  ------------------
  |  Branch (681:14): [True: 710, False: 5.91k]
  ------------------
  682|  5.91k|    if (code == CODE_EOI)
  ------------------
  |  |   72|  5.91k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (682:9): [True: 130, False: 5.78k]
  ------------------
  683|    130|        goto after_loop;
  684|  5.78k|    if (code > CODE_EOI)
  ------------------
  |  |   72|  5.78k|#define CODE_EOI 257   /* end-of-information code */
  ------------------
  |  Branch (684:9): [True: 273, False: 5.50k]
  ------------------
  685|    273|    {
  686|    273|        goto error_code;
  687|    273|    }
  688|  5.50k|    *op++ = (uint8_t)code;
  689|  5.50k|    occ--;
  690|  5.50k|    oldcodep = dec_codetab + code;
  691|  5.50k|    if (occ == 0)
  ------------------
  |  Branch (691:9): [True: 147, False: 5.36k]
  ------------------
  692|    147|        goto after_loop;
  693|  5.36k|    goto begin;
  694|  5.50k|}
  695|  5.50k|}
  696|       |
  697|  5.36k|too_short_buffer:
  698|  2.17k|{
  699|       |    /*
  700|       |     * String is too long for decode buffer,
  701|       |     * locate portion that will fit, copy to
  702|       |     * the decode buffer, and setup restart
  703|       |     * logic for the next decoding call.
  704|       |     */
  705|  2.17k|    sp->dec_codep = codep;
  706|  2.17k|    do
  707|  4.09k|    {
  708|  4.09k|        codep = codep->next;
  709|  4.09k|    } while (codep->length > occ);
  ------------------
  |  Branch (709:14): [True: 1.92k, False: 2.17k]
  ------------------
  710|       |
  711|  2.17k|    sp->dec_restart = occ;
  712|  2.17k|    uint8_t *tp = op + occ;
  713|  2.17k|    do
  714|  3.72k|    {
  715|  3.72k|        *--tp = codep->value;
  716|  3.72k|        codep = codep->next;
  717|  3.72k|    } while (--occ);
  ------------------
  |  Branch (717:14): [True: 1.55k, False: 2.17k]
  ------------------
  718|  2.17k|}
  719|       |
  720|  6.05k|after_loop:
  721|  6.05k|    tif->tif_rawcc -= (tmsize_t)((uint8_t *)bp - tif->tif_rawcp);
  722|  6.05k|    tif->tif_rawcp = (uint8_t *)bp;
  723|  6.05k|    sp->old_tif_rawcc = tif->tif_rawcc;
  724|  6.05k|    sp->dec_bitsleft = dec_bitsleft;
  725|  6.05k|    sp->lzw_nbits = (unsigned short)nbits;
  ------------------
  |  |  102|  6.05k|#define lzw_nbits base.nbits
  ------------------
  726|  6.05k|    sp->lzw_nextdata = nextdata;
  ------------------
  |  |  105|  6.05k|#define lzw_nextdata base.nextdata
  ------------------
  727|  6.05k|    sp->lzw_nextbits = nextbits;
  ------------------
  |  |  106|  6.05k|#define lzw_nextbits base.nextbits
  ------------------
  728|  6.05k|    sp->dec_nbitsmask = nbitsmask;
  729|  6.05k|    sp->dec_oldcodep = oldcodep;
  730|  6.05k|    sp->dec_free_entp = free_entp;
  731|  6.05k|    sp->dec_maxcodep = maxcodep;
  732|       |
  733|  6.05k|    if (occ > 0)
  ------------------
  |  Branch (733:9): [True: 178, False: 5.87k]
  ------------------
  734|    178|    {
  735|    178|        memset(op, 0, (size_t)occ);
  736|    178|        sp->read_error = 1;
  737|    178|        TIFFErrorExtR(tif, module,
  738|    178|                      "Not enough data at scanline %" PRIu32 " (short %" PRIu64
  739|    178|                      " bytes)",
  740|    178|                      tif->tif_dir.td_row, (uint64_t)occ);
  741|    178|        return (0);
  742|    178|    }
  743|  5.87k|    return (1);
  744|       |
  745|  2.52k|no_eoi:
  746|  2.52k|    memset(op, 0, (size_t)occ);
  747|  2.52k|    sp->read_error = 1;
  748|  2.52k|    TIFFErrorExtR(tif, module,
  749|  2.52k|                  "LZWDecode: Strip %" PRIu32 " not terminated with EOI code",
  750|  2.52k|                  tif->tif_dir.td_curstrip);
  751|  2.52k|    return 0;
  752|  9.63k|error_code:
  753|  9.63k|    memset(op, 0, (size_t)occ);
  754|  9.63k|    sp->read_error = 1;
  755|  9.63k|    TIFFErrorExtR(tif, tif->tif_name, "Using code not yet in table");
  756|  9.63k|    return 0;
  757|  6.05k|}
tif_lzw.c:LZWGetMaxCompressionRatio:
 1396|      4|{
 1397|      4|    (void)tif;
 1398|       |
 1399|       |    /* See README_for_libtiff_developpers.md for raw data used to estimate
 1400|       |     * the maximum compression rate. */
 1401|       |
 1402|       |    /* 1024x1024: 562 */
 1403|       |    /* 4096x4096: 1243 */
 1404|       |    /* 16383x16383: 1353 */
 1405|       |    /* 65536x65536: 1362 */
 1406|       |
 1407|      4|    return 1400;
 1408|      4|}
tif_lzw.c:LZWCleanup:
 1378|    481|{
 1379|    481|    (void)TIFFPredictorCleanup(tif);
 1380|       |
 1381|    481|    assert(tif->tif_data != NULL);
  ------------------
  |  Branch (1381:5): [True: 0, False: 481]
  |  Branch (1381:5): [True: 481, False: 0]
  ------------------
 1382|       |
 1383|    481|    if (LZWDecoderState(tif)->dec_codetab)
  ------------------
  |  |  164|    481|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    481|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  |  Branch (1383:9): [True: 451, False: 30]
  ------------------
 1384|    451|        _TIFFfreeExt(tif, LZWDecoderState(tif)->dec_codetab);
  ------------------
  |  |  164|    451|#define LZWDecoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    451|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1385|       |
 1386|    481|    if (LZWEncoderState(tif)->enc_hashtab)
  ------------------
  |  |  165|    481|#define LZWEncoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|    481|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  |  Branch (1386:9): [True: 0, False: 481]
  ------------------
 1387|      0|        _TIFFfreeExt(tif, LZWEncoderState(tif)->enc_hashtab);
  ------------------
  |  |  165|      0|#define LZWEncoderState(tif) ((LZWCodecState *)LZWState(tif))
  |  |  ------------------
  |  |  |  |  163|      0|#define LZWState(tif) ((LZWBaseState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
 1388|       |
 1389|    481|    _TIFFfreeExt(tif, tif->tif_data);
 1390|    481|    tif->tif_data = NULL;
 1391|       |
 1392|    481|    _TIFFSetDefaultCompressionState(tif);
 1393|    481|}

TIFFInitNeXT:
  187|     37|{
  188|     37|    (void)scheme;
  189|     37|    tif->tif_predecode = NeXTPreDecode;
  190|     37|    tif->tif_decoderow = NeXTDecode;
  191|     37|    tif->tif_decodestrip = NeXTDecode;
  192|     37|    tif->tif_decodetile = NeXTDecode;
  193|     37|    return (1);
  194|     37|}
tif_next.c:NeXTPreDecode:
  172|  1.81k|{
  173|  1.81k|    static const char module[] = "NeXTPreDecode";
  174|  1.81k|    TIFFDirectory *td = &tif->tif_dir;
  175|  1.81k|    (void)s;
  176|       |
  177|  1.81k|    if (td->td_bitspersample != 2)
  ------------------
  |  Branch (177:9): [True: 0, False: 1.81k]
  ------------------
  178|      0|    {
  179|      0|        TIFFErrorExtR(tif, module, "Unsupported BitsPerSample = %" PRIu16,
  180|      0|                      td->td_bitspersample);
  181|      0|        return (0);
  182|      0|    }
  183|  1.81k|    return (1);
  184|  1.81k|}
tif_next.c:NeXTDecode:
   59|  7.43k|{
   60|  7.43k|    static const char module[] = "NeXTDecode";
   61|  7.43k|    unsigned char *bp, *op;
   62|  7.43k|    tmsize_t cc;
   63|  7.43k|    uint8_t *row;
   64|  7.43k|    tmsize_t scanline, n;
   65|       |
   66|  7.43k|    (void)s;
   67|       |    /*
   68|       |     * Each scanline is assumed to start off as all
   69|       |     * white (we assume a PhotometricInterpretation
   70|       |     * of ``min-is-black'').
   71|       |     */
   72|  14.7M|    for (op = (unsigned char *)buf, cc = occ; cc-- > 0;)
  ------------------
  |  Branch (72:47): [True: 14.7M, False: 7.43k]
  ------------------
   73|  14.7M|        *op++ = 0xff;
   74|       |
   75|  7.43k|    bp = (unsigned char *)tif->tif_rawcp;
   76|  7.43k|    cc = tif->tif_rawcc;
   77|  7.43k|    scanline = tif->tif_dir.td_scanlinesize;
   78|  7.43k|    if (occ % scanline)
  ------------------
  |  Branch (78:9): [True: 165, False: 7.27k]
  ------------------
   79|    165|    {
   80|    165|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
   81|    165|        return (0);
   82|    165|    }
   83|   126k|    for (row = buf; cc > 0 && occ > 0; occ -= scanline, row += scanline)
  ------------------
  |  Branch (83:21): [True: 124k, False: 2.47k]
  |  Branch (83:31): [True: 121k, False: 3.28k]
  ------------------
   84|   121k|    {
   85|   121k|        n = *bp++;
   86|   121k|        cc--;
   87|   121k|        switch (n)
   88|   121k|        {
   89|  4.40k|            case LITERALROW:
  ------------------
  |  |   55|  4.40k|#define LITERALROW 0x00
  ------------------
  |  Branch (89:13): [True: 4.40k, False: 116k]
  ------------------
   90|       |                /*
   91|       |                 * The entire scanline is given as literal values.
   92|       |                 */
   93|  4.40k|                if (cc < scanline)
  ------------------
  |  Branch (93:21): [True: 325, False: 4.07k]
  ------------------
   94|    325|                    goto bad;
   95|  4.07k|                _TIFFmemcpy(row, bp, scanline);
   96|  4.07k|                bp += scanline;
   97|  4.07k|                cc -= scanline;
   98|  4.07k|                break;
   99|    861|            case LITERALSPAN:
  ------------------
  |  |   56|    861|#define LITERALSPAN 0x40
  ------------------
  |  Branch (99:13): [True: 861, False: 120k]
  ------------------
  100|    861|            {
  101|    861|                tmsize_t off;
  102|       |                /*
  103|       |                 * The scanline has a literal span that begins at some
  104|       |                 * offset.
  105|       |                 */
  106|    861|                if (cc < 4)
  ------------------
  |  Branch (106:21): [True: 143, False: 718]
  ------------------
  107|    143|                    goto bad;
  108|    718|                off = (bp[0] * 256) + bp[1];
  109|    718|                n = (bp[2] * 256) + bp[3];
  110|    718|                if (cc < 4 + n || off + n > scanline)
  ------------------
  |  Branch (110:21): [True: 319, False: 399]
  |  Branch (110:35): [True: 202, False: 197]
  ------------------
  111|    521|                    goto bad;
  112|    197|                _TIFFmemcpy(row + off, bp + 4, n);
  113|    197|                bp += 4 + n;
  114|    197|                cc -= 4 + n;
  115|    197|                break;
  116|    718|            }
  117|   115k|            default:
  ------------------
  |  Branch (117:13): [True: 115k, False: 5.26k]
  ------------------
  118|   115k|            {
  119|   115k|                uint32_t npixels = 0, grey;
  120|   115k|                tmsize_t op_offset = 0;
  121|   115k|                uint32_t imagewidth = tif->tif_dir.td_imagewidth;
  122|   115k|                if (isTiled(tif))
  ------------------
  |  |  278|   115k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|   115k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 109k, False: 6.36k]
  |  |  ------------------
  ------------------
  123|   109k|                    imagewidth = tif->tif_dir.td_tilewidth;
  124|       |
  125|       |                /*
  126|       |                 * The scanline is composed of a sequence of constant
  127|       |                 * color ``runs''.  We shift into ``run mode'' and
  128|       |                 * interpret bytes as codes of the form
  129|       |                 * <color><npixels> until we've filled the scanline.
  130|       |                 */
  131|   115k|                op = row;
  132|   115k|                for (;;)
  133|   267k|                {
  134|   267k|                    grey = (uint32_t)((n >> 6) & 0x3);
  135|   267k|                    n &= 0x3f;
  136|       |                    /*
  137|       |                     * Ensure the run does not exceed the scanline
  138|       |                     * bounds, potentially resulting in a security
  139|       |                     * issue.
  140|       |                     */
  141|  6.13M|                    while (n-- > 0 && npixels < imagewidth &&
  ------------------
  |  Branch (141:28): [True: 5.97M, False: 156k]
  |  Branch (141:39): [True: 5.86M, False: 110k]
  ------------------
  142|  5.86M|                           op_offset < scanline)
  ------------------
  |  Branch (142:28): [True: 5.86M, False: 135]
  ------------------
  143|  5.86M|                        SETPIXEL(op, grey);
  ------------------
  |  |   34|  5.86M|    {                                                                          \
  |  |   35|  5.86M|        switch (npixels++ & 3)                                                 \
  |  |   36|  5.86M|        {                                                                      \
  |  |   37|  1.48M|            case 0:                                                            \
  |  |  ------------------
  |  |  |  Branch (37:13): [True: 1.48M, False: 4.37M]
  |  |  ------------------
  |  |   38|  1.48M|                op[0] = (unsigned char)((v) << 6);                             \
  |  |   39|  1.48M|                break;                                                         \
  |  |   40|  1.46M|            case 1:                                                            \
  |  |  ------------------
  |  |  |  Branch (40:13): [True: 1.46M, False: 4.40M]
  |  |  ------------------
  |  |   41|  1.46M|                op[0] |= (unsigned char)((v) << 4);                            \
  |  |   42|  1.46M|                break;                                                         \
  |  |   43|  1.46M|            case 2:                                                            \
  |  |  ------------------
  |  |  |  Branch (43:13): [True: 1.46M, False: 4.40M]
  |  |  ------------------
  |  |   44|  1.46M|                op[0] |= (unsigned char)((v) << 2);                            \
  |  |   45|  1.46M|                break;                                                         \
  |  |   46|  1.45M|            case 3:                                                            \
  |  |  ------------------
  |  |  |  Branch (46:13): [True: 1.45M, False: 4.40M]
  |  |  ------------------
  |  |   47|  1.45M|                *op++ |= (unsigned char)(v);                                   \
  |  |   48|  1.45M|                op_offset++;                                                   \
  |  |   49|  1.45M|                break;                                                         \
  |  |   50|      0|            default:                                                           \
  |  |  ------------------
  |  |  |  Branch (50:13): [True: 0, False: 5.86M]
  |  |  ------------------
  |  |   51|      0|                break;                                                         \
  |  |   52|  5.86M|        }                                                                      \
  |  |   53|  5.86M|    }
  ------------------
  144|   267k|                    if (npixels >= imagewidth)
  ------------------
  |  Branch (144:25): [True: 115k, False: 151k]
  ------------------
  145|   115k|                        break;
  146|   151k|                    if (op_offset >= scanline)
  ------------------
  |  Branch (146:25): [True: 136, False: 151k]
  ------------------
  147|    136|                    {
  148|    136|                        TIFFErrorExtR(tif, module,
  149|    136|                                      "Invalid data for scanline %" PRIu32,
  150|    136|                                      tif->tif_dir.td_row);
  151|    136|                        return (0);
  152|    136|                    }
  153|   151k|                    if (cc == 0)
  ------------------
  |  Branch (153:25): [True: 394, False: 151k]
  ------------------
  154|    394|                        goto bad;
  155|   151k|                    n = *bp++;
  156|   151k|                    cc--;
  157|   151k|                }
  158|   115k|                break;
  159|   115k|            }
  160|   121k|        }
  161|   121k|    }
  162|  5.75k|    tif->tif_rawcp = (uint8_t *)bp;
  163|  5.75k|    tif->tif_rawcc = cc;
  164|  5.75k|    return (1);
  165|  1.38k|bad:
  166|       |    TIFFErrorExtR(tif, module, "Not enough data for scanline %" PRIu32,
  167|  1.38k|                  tif->tif_dir.td_row);
  168|  1.38k|    return (0);
  169|  7.27k|}

TIFFInitOJPEG:
  454|  1.03k|{
  455|  1.03k|    static const char module[] = "TIFFInitOJPEG";
  456|  1.03k|    OJPEGState *sp;
  457|       |
  458|  1.03k|    (void)scheme;
  459|  1.03k|    assert(scheme == COMPRESSION_OJPEG);
  ------------------
  |  Branch (459:5): [True: 0, False: 1.03k]
  |  Branch (459:5): [True: 1.03k, False: 0]
  ------------------
  460|       |
  461|       |    /*
  462|       |     * Merge codec-specific tag information.
  463|       |     */
  464|  1.03k|    if (!_TIFFMergeFields(tif, ojpegFields, TIFFArrayCount(ojpegFields)))
  ------------------
  |  |  339|  1.03k|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (464:9): [True: 0, False: 1.03k]
  ------------------
  465|      0|    {
  466|      0|        TIFFErrorExtR(tif, module,
  467|      0|                      "Merging Old JPEG codec-specific tags failed");
  468|      0|        return 0;
  469|      0|    }
  470|       |
  471|       |    /* state block */
  472|  1.03k|    sp = (OJPEGState *)_TIFFmallocExt(tif, sizeof(OJPEGState));
  473|  1.03k|    if (sp == NULL)
  ------------------
  |  Branch (473:9): [True: 0, False: 1.03k]
  ------------------
  474|      0|    {
  475|      0|        TIFFErrorExtR(tif, module, "No space for OJPEG state block");
  476|      0|        return (0);
  477|      0|    }
  478|  1.03k|    _TIFFmemset(sp, 0, sizeof(OJPEGState));
  479|  1.03k|    sp->tif = tif;
  480|  1.03k|    sp->jpeg_proc = 1;
  481|  1.03k|    sp->subsampling_hor = 2;
  482|  1.03k|    sp->subsampling_ver = 2;
  483|  1.03k|    TIFFSetField(tif, TIFFTAG_YCBCRSUBSAMPLING, 2, 2);
  ------------------
  |  |  388|  1.03k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  484|       |    /* tif codec methods */
  485|  1.03k|    tif->tif_fixuptags = OJPEGFixupTags;
  486|  1.03k|    tif->tif_setupdecode = OJPEGSetupDecode;
  487|  1.03k|    tif->tif_predecode = OJPEGPreDecode;
  488|  1.03k|    tif->tif_postdecode = OJPEGPostDecode;
  489|  1.03k|    tif->tif_decoderow = OJPEGDecode;
  490|  1.03k|    tif->tif_decodestrip = OJPEGDecode;
  491|  1.03k|    tif->tif_decodetile = OJPEGDecode;
  492|  1.03k|    tif->tif_setupencode = OJPEGSetupEncode;
  493|  1.03k|    tif->tif_preencode = OJPEGPreEncode;
  494|  1.03k|    tif->tif_postencode = OJPEGPostEncode;
  495|  1.03k|    tif->tif_encoderow = OJPEGEncode;
  496|  1.03k|    tif->tif_encodestrip = OJPEGEncode;
  497|  1.03k|    tif->tif_encodetile = OJPEGEncode;
  498|  1.03k|    tif->tif_cleanup = OJPEGCleanup;
  499|  1.03k|    tif->tif_data = (uint8_t *)sp;
  500|       |    /* tif tag methods */
  501|  1.03k|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
  502|  1.03k|    tif->tif_tagmethods.vgetfield = OJPEGVGetField;
  503|  1.03k|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
  504|  1.03k|    tif->tif_tagmethods.vsetfield = OJPEGVSetField;
  505|  1.03k|    sp->printdir = tif->tif_tagmethods.printdir;
  506|  1.03k|    tif->tif_tagmethods.printdir = OJPEGPrintDir;
  507|       |    /* Some OJPEG files don't have strip or tile offsets or bytecounts tags.
  508|       |       Some others do, but have totally meaningless or corrupt values
  509|       |       in these tags. In these cases, the JpegInterchangeFormat stream is
  510|       |       reliable. In any case, this decoder reads the compressed data itself,
  511|       |       from the most reliable locations, and we need to notify encapsulating
  512|       |       LibTiff not to read raw strips or tiles for us. */
  513|  1.03k|    tif->tif_flags |= TIFF_NOREADRAW;
  ------------------
  |  |  138|  1.03k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  514|  1.03k|    return (1);
  515|  1.03k|}
tif_ojpeg.c:OJPEGVGetField:
  518|  16.2k|{
  519|  16.2k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  520|  16.2k|    switch (tag)
  521|  16.2k|    {
  522|      0|        case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|      0|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (522:9): [True: 0, False: 16.2k]
  ------------------
  523|      0|            *va_arg(ap, uint64_t *) = (uint64_t)sp->jpeg_interchange_format;
  524|      0|            break;
  525|      0|        case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  380|      0|#define TIFFTAG_JPEGIFBYTECOUNT 514        /* !JFIF stream length */
  ------------------
  |  Branch (525:9): [True: 0, False: 16.2k]
  ------------------
  526|      0|            *va_arg(ap, uint64_t *) =
  527|      0|                (uint64_t)sp->jpeg_interchange_format_length;
  528|      0|            break;
  529|  2.63k|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|  2.63k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (529:9): [True: 2.63k, False: 13.6k]
  ------------------
  530|  2.63k|            if (sp->subsamplingcorrect_done == 0)
  ------------------
  |  Branch (530:17): [True: 948, False: 1.68k]
  ------------------
  531|    948|                OJPEGSubsamplingCorrect(tif);
  532|  2.63k|            *va_arg(ap, uint16_t *) = (uint16_t)sp->subsampling_hor;
  533|  2.63k|            *va_arg(ap, uint16_t *) = (uint16_t)sp->subsampling_ver;
  534|  2.63k|            break;
  535|      0|        case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|      0|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (535:9): [True: 0, False: 16.2k]
  ------------------
  536|      0|            *va_arg(ap, uint32_t *) = (uint32_t)sp->qtable_offset_count;
  537|      0|            *va_arg(ap, const void **) = (const void *)sp->qtable_offset;
  538|      0|            break;
  539|      0|        case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  385|      0|#define TIFFTAG_JPEGDCTABLES 520           /* !DCT table offsets */
  ------------------
  |  Branch (539:9): [True: 0, False: 16.2k]
  ------------------
  540|      0|            *va_arg(ap, uint32_t *) = (uint32_t)sp->dctable_offset_count;
  541|      0|            *va_arg(ap, const void **) = (const void *)sp->dctable_offset;
  542|      0|            break;
  543|      0|        case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  386|      0|#define TIFFTAG_JPEGACTABLES 521           /* !AC coefficient offsets */
  ------------------
  |  Branch (543:9): [True: 0, False: 16.2k]
  ------------------
  544|      0|            *va_arg(ap, uint32_t *) = (uint32_t)sp->actable_offset_count;
  545|      0|            *va_arg(ap, const void **) = (const void *)sp->actable_offset;
  546|      0|            break;
  547|      0|        case TIFFTAG_JPEGPROC:
  ------------------
  |  |  376|      0|#define TIFFTAG_JPEGPROC 512               /* !JPEG processing algorithm */
  ------------------
  |  Branch (547:9): [True: 0, False: 16.2k]
  ------------------
  548|      0|            *va_arg(ap, uint16_t *) = (uint16_t)sp->jpeg_proc;
  549|      0|            break;
  550|      0|        case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  381|      0|#define TIFFTAG_JPEGRESTARTINTERVAL 515    /* !restart interval length */
  ------------------
  |  Branch (550:9): [True: 0, False: 16.2k]
  ------------------
  551|      0|            *va_arg(ap, uint16_t *) = sp->restart_interval;
  552|      0|            break;
  553|  13.6k|        default:
  ------------------
  |  Branch (553:9): [True: 13.6k, False: 2.63k]
  ------------------
  554|  13.6k|            return (*sp->vgetparent)(tif, tag, ap);
  555|  16.2k|    }
  556|  2.63k|    return (1);
  557|  16.2k|}
tif_ojpeg.c:OJPEGSubsamplingCorrect:
 1082|    970|{
 1083|    970|    static const char module[] = "OJPEGSubsamplingCorrect";
 1084|    970|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1085|    970|    uint8_t mh;
 1086|    970|    uint8_t mv;
 1087|       |
 1088|    970|    assert(sp->subsamplingcorrect_done == 0);
  ------------------
  |  Branch (1088:5): [True: 0, False: 970]
  |  Branch (1088:5): [True: 970, False: 0]
  ------------------
 1089|    970|    if ((tif->tif_dir.td_samplesperpixel != 3) ||
  ------------------
  |  Branch (1089:9): [True: 28, False: 942]
  ------------------
 1090|    942|        ((tif->tif_dir.td_photometric != PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|    942|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (1090:10): [True: 22, False: 920]
  ------------------
 1091|     22|         (tif->tif_dir.td_photometric != PHOTOMETRIC_ITULAB)))
  ------------------
  |  |  230|     22|#define PHOTOMETRIC_ITULAB 10              /* ITU L*a*b* */
  ------------------
  |  Branch (1091:10): [True: 21, False: 1]
  ------------------
 1092|     49|    {
 1093|     49|        if (sp->subsampling_tag != 0)
  ------------------
  |  Branch (1093:13): [True: 1, False: 48]
  ------------------
 1094|      1|            TIFFWarningExtR(tif, module,
 1095|      1|                            "Subsampling tag not appropriate for this "
 1096|      1|                            "Photometric and/or SamplesPerPixel");
 1097|     49|        sp->subsampling_hor = 1;
 1098|     49|        sp->subsampling_ver = 1;
 1099|     49|        sp->subsampling_force_desubsampling_inside_decompression = 0;
 1100|     49|    }
 1101|    921|    else
 1102|    921|    {
 1103|    921|        sp->subsamplingcorrect_done = 1;
 1104|    921|        mh = sp->subsampling_hor;
 1105|    921|        mv = sp->subsampling_ver;
 1106|    921|        sp->subsamplingcorrect = 1;
 1107|    921|        OJPEGReadHeaderInfoSec(tif);
 1108|    921|        if (sp->subsampling_force_desubsampling_inside_decompression != 0)
  ------------------
  |  Branch (1108:13): [True: 30, False: 891]
  ------------------
 1109|     30|        {
 1110|     30|            sp->subsampling_hor = 1;
 1111|     30|            sp->subsampling_ver = 1;
 1112|     30|        }
 1113|    921|        sp->subsamplingcorrect = 0;
 1114|    921|        if (((sp->subsampling_hor != mh) || (sp->subsampling_ver != mv)) &&
  ------------------
  |  Branch (1114:14): [True: 34, False: 887]
  |  Branch (1114:45): [True: 0, False: 887]
  ------------------
 1115|     34|            (sp->subsampling_force_desubsampling_inside_decompression == 0))
  ------------------
  |  Branch (1115:13): [True: 4, False: 30]
  ------------------
 1116|      4|        {
 1117|      4|            if (sp->subsampling_tag == 0)
  ------------------
  |  Branch (1117:17): [True: 3, False: 1]
  ------------------
 1118|      3|                TIFFWarningExtR(
 1119|      3|                    tif, module,
 1120|      3|                    "Subsampling tag is not set, yet subsampling inside JPEG "
 1121|      3|                    "data [%" PRIu8 ",%" PRIu8
 1122|      3|                    "] does not match default values [2,2]; assuming "
 1123|      3|                    "subsampling inside JPEG data is correct",
 1124|      3|                    sp->subsampling_hor, sp->subsampling_ver);
 1125|      1|            else
 1126|      1|                TIFFWarningExtR(
 1127|      1|                    tif, module,
 1128|      1|                    "Subsampling inside JPEG data [%" PRIu8 ",%" PRIu8
 1129|      1|                    "] does not match subsampling tag values [%" PRIu8
 1130|      1|                    ",%" PRIu8
 1131|      1|                    "]; assuming subsampling inside JPEG data is correct",
 1132|      1|                    sp->subsampling_hor, sp->subsampling_ver, mh, mv);
 1133|      4|        }
 1134|    921|        if (sp->subsampling_force_desubsampling_inside_decompression != 0)
  ------------------
  |  Branch (1134:13): [True: 30, False: 891]
  ------------------
 1135|     30|        {
 1136|     30|            if (sp->subsampling_tag == 0)
  ------------------
  |  Branch (1136:17): [True: 29, False: 1]
  ------------------
 1137|     29|                TIFFWarningExtR(
 1138|     29|                    tif, module,
 1139|     29|                    "Subsampling tag is not set, yet subsampling inside JPEG "
 1140|     29|                    "data does not match default values [2,2] (nor any other "
 1141|     29|                    "values allowed in TIFF); assuming subsampling inside JPEG "
 1142|     29|                    "data is correct and desubsampling inside JPEG "
 1143|     29|                    "decompression");
 1144|      1|            else
 1145|      1|                TIFFWarningExtR(
 1146|      1|                    tif, module,
 1147|      1|                    "Subsampling inside JPEG data does not match subsampling "
 1148|      1|                    "tag values [%" PRIu8 ",%" PRIu8
 1149|      1|                    "] (nor any other values allowed in TIFF); assuming "
 1150|      1|                    "subsampling inside JPEG data is correct and desubsampling "
 1151|      1|                    "inside JPEG decompression",
 1152|      1|                    mh, mv);
 1153|     30|        }
 1154|    921|        if (sp->subsampling_force_desubsampling_inside_decompression == 0)
  ------------------
  |  Branch (1154:13): [True: 891, False: 30]
  ------------------
 1155|    891|        {
 1156|    891|            if (sp->subsampling_hor < sp->subsampling_ver)
  ------------------
  |  Branch (1156:17): [True: 15, False: 876]
  ------------------
 1157|     15|                TIFFWarningExtR(tif, module,
 1158|     15|                                "Subsampling values [%" PRIu8 ",%" PRIu8
 1159|     15|                                "] are not allowed in TIFF",
 1160|     15|                                sp->subsampling_hor, sp->subsampling_ver);
 1161|    891|        }
 1162|    921|    }
 1163|    970|    sp->subsamplingcorrect_done = 1;
 1164|    970|}
tif_ojpeg.c:OJPEGReadHeaderInfoSec:
 1536|  1.84k|{
 1537|  1.84k|    static const char module[] = "OJPEGReadHeaderInfoSec";
 1538|  1.84k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1539|  1.84k|    uint8_t m;
 1540|  1.84k|    uint16_t n;
 1541|  1.84k|    uint8_t o;
 1542|  1.84k|    if (sp->file_size == 0)
  ------------------
  |  Branch (1542:9): [True: 964, False: 885]
  ------------------
 1543|    964|        sp->file_size = TIFFGetFileSize(tif);
  ------------------
  |  |  289|    964|#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
  ------------------
 1544|  1.84k|    if (sp->jpeg_interchange_format != 0)
  ------------------
  |  Branch (1544:9): [True: 539, False: 1.31k]
  ------------------
 1545|    539|    {
 1546|    539|        if (sp->jpeg_interchange_format >= sp->file_size)
  ------------------
  |  Branch (1546:13): [True: 3, False: 536]
  ------------------
 1547|      3|        {
 1548|      3|            sp->jpeg_interchange_format = 0;
 1549|      3|            sp->jpeg_interchange_format_length = 0;
 1550|      3|        }
 1551|    536|        else
 1552|    536|        {
 1553|    536|            if ((sp->jpeg_interchange_format_length == 0) ||
  ------------------
  |  Branch (1553:17): [True: 261, False: 275]
  ------------------
 1554|    275|                (sp->jpeg_interchange_format >
  ------------------
  |  Branch (1554:17): [True: 0, False: 275]
  ------------------
 1555|    275|                 UINT64_MAX - sp->jpeg_interchange_format_length) ||
 1556|    275|                (sp->jpeg_interchange_format +
  ------------------
  |  Branch (1556:17): [True: 1, False: 274]
  ------------------
 1557|    275|                     sp->jpeg_interchange_format_length >
 1558|    275|                 sp->file_size))
 1559|    262|                sp->jpeg_interchange_format_length =
 1560|    262|                    sp->file_size - sp->jpeg_interchange_format;
 1561|    536|        }
 1562|    539|    }
 1563|  1.84k|    sp->in_buffer_source = osibsNotSetYet;
 1564|  1.84k|    sp->in_buffer_next_strile = 0;
 1565|  1.84k|    sp->in_buffer_strile_count = tif->tif_dir.td_nstrips;
 1566|  1.84k|    sp->in_buffer_file_togo = 0;
 1567|  1.84k|    sp->in_buffer_togo = 0;
 1568|  1.84k|    do
 1569|  13.0k|    {
 1570|  13.0k|        if (OJPEGReadBytePeek(sp, &m) == 0)
  ------------------
  |  Branch (1570:13): [True: 67, False: 12.9k]
  ------------------
 1571|     67|            return (0);
 1572|  12.9k|        if (m != 255)
  ------------------
  |  Branch (1572:13): [True: 1.62k, False: 11.3k]
  ------------------
 1573|  1.62k|            break;
 1574|  11.3k|        OJPEGReadByteAdvance(sp);
 1575|  11.3k|        do
 1576|   534k|        {
 1577|   534k|            if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (1577:17): [True: 3, False: 534k]
  ------------------
 1578|      3|                return (0);
 1579|   534k|        } while (m == 255);
  ------------------
  |  Branch (1579:18): [True: 522k, False: 11.3k]
  ------------------
 1580|  11.3k|        switch (m)
 1581|  11.3k|        {
 1582|  4.00k|            case JPEG_MARKER_SOI:
  ------------------
  |  |  163|  4.00k|#define JPEG_MARKER_SOI 0xD8
  ------------------
  |  Branch (1582:13): [True: 4.00k, False: 7.34k]
  ------------------
 1583|       |                /* this type of marker has no data, and should be skipped */
 1584|  4.00k|                break;
 1585|     47|            case JPEG_MARKER_COM:
  ------------------
  |  |  169|     47|#define JPEG_MARKER_COM 0xFE
  ------------------
  |  Branch (1585:13): [True: 47, False: 11.3k]
  ------------------
 1586|     47|            case JPEG_MARKER_APP0:
  ------------------
  |  |  168|     47|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1586:13): [True: 0, False: 11.3k]
  ------------------
 1587|     47|            case JPEG_MARKER_APP0 + 1:
  ------------------
  |  |  168|     47|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1587:13): [True: 0, False: 11.3k]
  ------------------
 1588|     47|            case JPEG_MARKER_APP0 + 2:
  ------------------
  |  |  168|     47|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1588:13): [True: 0, False: 11.3k]
  ------------------
 1589|     84|            case JPEG_MARKER_APP0 + 3:
  ------------------
  |  |  168|     84|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1589:13): [True: 37, False: 11.3k]
  ------------------
 1590|    362|            case JPEG_MARKER_APP0 + 4:
  ------------------
  |  |  168|    362|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1590:13): [True: 278, False: 11.0k]
  ------------------
 1591|    366|            case JPEG_MARKER_APP0 + 5:
  ------------------
  |  |  168|    366|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1591:13): [True: 4, False: 11.3k]
  ------------------
 1592|    366|            case JPEG_MARKER_APP0 + 6:
  ------------------
  |  |  168|    366|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1592:13): [True: 0, False: 11.3k]
  ------------------
 1593|    369|            case JPEG_MARKER_APP0 + 7:
  ------------------
  |  |  168|    369|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1593:13): [True: 3, False: 11.3k]
  ------------------
 1594|    978|            case JPEG_MARKER_APP0 + 8:
  ------------------
  |  |  168|    978|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1594:13): [True: 609, False: 10.7k]
  ------------------
 1595|    978|            case JPEG_MARKER_APP0 + 9:
  ------------------
  |  |  168|    978|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1595:13): [True: 0, False: 11.3k]
  ------------------
 1596|    978|            case JPEG_MARKER_APP0 + 10:
  ------------------
  |  |  168|    978|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1596:13): [True: 0, False: 11.3k]
  ------------------
 1597|  1.26k|            case JPEG_MARKER_APP0 + 11:
  ------------------
  |  |  168|  1.26k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1597:13): [True: 282, False: 11.0k]
  ------------------
 1598|  1.26k|            case JPEG_MARKER_APP0 + 12:
  ------------------
  |  |  168|  1.26k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1598:13): [True: 0, False: 11.3k]
  ------------------
 1599|  1.26k|            case JPEG_MARKER_APP0 + 13:
  ------------------
  |  |  168|  1.26k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1599:13): [True: 0, False: 11.3k]
  ------------------
 1600|  1.26k|            case JPEG_MARKER_APP0 + 14:
  ------------------
  |  |  168|  1.26k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1600:13): [True: 2, False: 11.3k]
  ------------------
 1601|  1.26k|            case JPEG_MARKER_APP0 + 15:
  ------------------
  |  |  168|  1.26k|#define JPEG_MARKER_APP0 0xE0
  ------------------
  |  Branch (1601:13): [True: 0, False: 11.3k]
  ------------------
 1602|       |                /* this type of marker has data, but it has no use to us (and no
 1603|       |                 * place here) and should be skipped */
 1604|  1.26k|                if (OJPEGReadWord(sp, &n) == 0)
  ------------------
  |  Branch (1604:21): [True: 3, False: 1.25k]
  ------------------
 1605|      3|                    return (0);
 1606|  1.25k|                if (n < 2)
  ------------------
  |  Branch (1606:21): [True: 0, False: 1.25k]
  ------------------
 1607|      0|                {
 1608|      0|                    if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1608:25): [True: 0, False: 0]
  ------------------
 1609|      0|                        TIFFErrorExtR(tif, module, "Corrupt JPEG data");
 1610|      0|                    return (0);
 1611|      0|                }
 1612|  1.25k|                if (n > 2)
  ------------------
  |  Branch (1612:21): [True: 977, False: 282]
  ------------------
 1613|    977|                    OJPEGReadSkip(sp, (uint16_t)(n - 2));
 1614|  1.25k|                break;
 1615|    344|            case JPEG_MARKER_DRI:
  ------------------
  |  |  167|    344|#define JPEG_MARKER_DRI 0xDD
  ------------------
  |  Branch (1615:13): [True: 344, False: 11.0k]
  ------------------
 1616|    344|                if (OJPEGReadHeaderInfoSecStreamDri(tif) == 0)
  ------------------
  |  Branch (1616:21): [True: 14, False: 330]
  ------------------
 1617|     14|                    return (0);
 1618|    330|                break;
 1619|  4.11k|            case JPEG_MARKER_DQT:
  ------------------
  |  |  166|  4.11k|#define JPEG_MARKER_DQT 0xDB
  ------------------
  |  Branch (1619:13): [True: 4.11k, False: 7.23k]
  ------------------
 1620|  4.11k|                if (OJPEGReadHeaderInfoSecStreamDqt(tif) == 0)
  ------------------
  |  Branch (1620:21): [True: 10, False: 4.10k]
  ------------------
 1621|     10|                    return (0);
 1622|  4.10k|                break;
 1623|  4.10k|            case JPEG_MARKER_DHT:
  ------------------
  |  |  161|  1.49k|#define JPEG_MARKER_DHT 0xC4
  ------------------
  |  Branch (1623:13): [True: 1.49k, False: 9.85k]
  ------------------
 1624|  1.49k|                if (OJPEGReadHeaderInfoSecStreamDht(tif) == 0)
  ------------------
  |  Branch (1624:21): [True: 14, False: 1.47k]
  ------------------
 1625|     14|                    return (0);
 1626|  1.47k|                break;
 1627|  1.47k|            case JPEG_MARKER_SOF0:
  ------------------
  |  |  158|     41|#define JPEG_MARKER_SOF0 0xC0
  ------------------
  |  Branch (1627:13): [True: 41, False: 11.3k]
  ------------------
 1628|     43|            case JPEG_MARKER_SOF1:
  ------------------
  |  |  159|     43|#define JPEG_MARKER_SOF1 0xC1
  ------------------
  |  Branch (1628:13): [True: 2, False: 11.3k]
  ------------------
 1629|    104|            case JPEG_MARKER_SOF3:
  ------------------
  |  |  160|    104|#define JPEG_MARKER_SOF3 0xC3
  ------------------
  |  Branch (1629:13): [True: 61, False: 11.2k]
  ------------------
 1630|    104|                if (OJPEGReadHeaderInfoSecStreamSof(tif, m) == 0)
  ------------------
  |  Branch (1630:21): [True: 49, False: 55]
  ------------------
 1631|     49|                    return (0);
 1632|     55|                if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1632:21): [True: 34, False: 21]
  ------------------
 1633|     34|                    return (1);
 1634|     21|                break;
 1635|     21|            case JPEG_MARKER_SOS:
  ------------------
  |  |  165|     20|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1635:13): [True: 20, False: 11.3k]
  ------------------
 1636|     20|                if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1636:21): [True: 0, False: 20]
  ------------------
 1637|      0|                    return (1);
 1638|     20|                assert(sp->plane_sample_offset == 0);
  ------------------
  |  Branch (1638:17): [True: 0, False: 20]
  |  Branch (1638:17): [True: 20, False: 0]
  ------------------
 1639|     20|                if (OJPEGReadHeaderInfoSecStreamSos(tif) == 0)
  ------------------
  |  Branch (1639:21): [True: 4, False: 16]
  ------------------
 1640|      4|                    return (0);
 1641|     16|                break;
 1642|     16|            default:
  ------------------
  |  Branch (1642:13): [True: 14, False: 11.3k]
  ------------------
 1643|     14|                TIFFErrorExtR(tif, module,
 1644|     14|                              "Unknown marker type %" PRIu8 " in JPEG data", m);
 1645|     14|                return (0);
 1646|  11.3k|        }
 1647|  11.3k|    } while (m != JPEG_MARKER_SOS);
  ------------------
  |  |  165|  11.2k|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1647:14): [True: 11.1k, False: 16]
  ------------------
 1648|  1.63k|    if (sp->subsamplingcorrect)
  ------------------
  |  Branch (1648:9): [True: 796, False: 841]
  ------------------
 1649|    796|        return (1);
 1650|    841|    if (sp->sof_log == 0)
  ------------------
  |  Branch (1650:9): [True: 794, False: 47]
  ------------------
 1651|    794|    {
 1652|    794|        if (OJPEGReadHeaderInfoSecTablesQTable(tif) == 0)
  ------------------
  |  Branch (1652:13): [True: 44, False: 750]
  ------------------
 1653|     44|            return (0);
 1654|    750|        sp->sof_marker_id = JPEG_MARKER_SOF0;
  ------------------
  |  |  158|    750|#define JPEG_MARKER_SOF0 0xC0
  ------------------
 1655|  2.97k|        for (o = 0; o < sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1655:21): [True: 2.22k, False: 750]
  ------------------
 1656|  2.22k|            sp->sof_c[o] = (uint8_t)o;
 1657|    750|        sp->sof_hv[0] =
 1658|    750|            (uint8_t)((sp->subsampling_hor << 4) | sp->subsampling_ver);
 1659|  2.22k|        for (o = 1; o < sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1659:21): [True: 1.47k, False: 750]
  ------------------
 1660|  1.47k|            sp->sof_hv[o] = 17;
 1661|    750|        sp->sof_x = sp->strile_width;
 1662|    750|        sp->sof_y = sp->strile_length_total;
 1663|    750|        sp->sof_log = 1;
 1664|    750|        if (OJPEGReadHeaderInfoSecTablesDcTable(tif) == 0)
  ------------------
  |  Branch (1664:13): [True: 28, False: 722]
  ------------------
 1665|     28|            return (0);
 1666|    722|        if (OJPEGReadHeaderInfoSecTablesAcTable(tif) == 0)
  ------------------
  |  Branch (1666:13): [True: 50, False: 672]
  ------------------
 1667|     50|            return (0);
 1668|  2.01k|        for (o = 1; o < sp->samples_per_pixel; o++)
  ------------------
  |  Branch (1668:21): [True: 1.34k, False: 672]
  ------------------
 1669|  1.34k|            sp->sos_cs[o] = o;
 1670|    672|    }
 1671|    719|    return (1);
 1672|    841|}
tif_ojpeg.c:OJPEGReadBytePeek:
 2364|  13.0k|{
 2365|  13.0k|    if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2365:9): [True: 3.98k, False: 9.05k]
  ------------------
 2366|  3.98k|    {
 2367|  3.98k|        if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2367:13): [True: 67, False: 3.91k]
  ------------------
 2368|     67|            return (0);
 2369|  3.98k|        assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2369:9): [True: 0, False: 3.91k]
  |  Branch (2369:9): [True: 3.91k, False: 0]
  ------------------
 2370|  3.91k|    }
 2371|  12.9k|    *byte = *(sp->in_buffer_cur);
 2372|  12.9k|    return (1);
 2373|  13.0k|}
tif_ojpeg.c:OJPEGReadBufferFill:
 2256|   811k|{
 2257|   811k|    uint16_t m;
 2258|   811k|    tmsize_t n;
 2259|       |    /* TODO: double-check: when subsamplingcorrect is set, no call to
 2260|       |     * TIFFErrorExt or TIFFWarningExt should be made in any other case, seek or
 2261|       |     * read errors should be passed through */
 2262|   811k|    do
 2263|  10.1M|    {
 2264|  10.1M|        if (sp->in_buffer_file_togo != 0)
  ------------------
  |  Branch (2264:13): [True: 432k, False: 9.76M]
  ------------------
 2265|   432k|        {
 2266|   432k|            if (sp->in_buffer_file_pos_log == 0)
  ------------------
  |  Branch (2266:17): [True: 426k, False: 6.33k]
  ------------------
 2267|   426k|            {
 2268|   426k|                TIFFSeekFile(sp->tif, sp->in_buffer_file_pos, SEEK_SET);
  ------------------
  |  |  287|   426k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2269|   426k|                sp->in_buffer_file_pos_log = 1;
 2270|   426k|            }
 2271|   432k|            m = OJPEG_BUFFER;
  ------------------
  |  |  155|   432k|#define OJPEG_BUFFER 2048
  ------------------
 2272|   432k|            if ((uint64_t)m > sp->in_buffer_file_togo)
  ------------------
  |  Branch (2272:17): [True: 424k, False: 8.34k]
  ------------------
 2273|   424k|                m = (uint16_t)sp->in_buffer_file_togo;
 2274|   432k|            n = TIFFReadFile(sp->tif, sp->in_buffer, (tmsize_t)m);
  ------------------
  |  |  283|   432k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2275|   432k|            if (n <= 0)
  ------------------
  |  Branch (2275:17): [True: 2, False: 432k]
  ------------------
 2276|      2|                return (0);
 2277|   432k|            assert(n > 0);
  ------------------
  |  Branch (2277:13): [True: 0, False: 432k]
  |  Branch (2277:13): [True: 432k, False: 0]
  ------------------
 2278|   432k|            assert(n <= OJPEG_BUFFER);
  ------------------
  |  Branch (2278:13): [True: 0, False: 432k]
  |  Branch (2278:13): [True: 432k, False: 0]
  ------------------
 2279|   432k|            assert(n < 65536);
  ------------------
  |  Branch (2279:13): [True: 0, False: 432k]
  |  Branch (2279:13): [True: 432k, False: 0]
  ------------------
 2280|   432k|            assert((uint64_t)n <= sp->in_buffer_file_togo);
  ------------------
  |  Branch (2280:13): [True: 0, False: 432k]
  |  Branch (2280:13): [True: 432k, False: 0]
  ------------------
 2281|   432k|            m = (uint16_t)n;
 2282|   432k|            sp->in_buffer_togo = m;
 2283|   432k|            sp->in_buffer_cur = sp->in_buffer;
 2284|   432k|            sp->in_buffer_file_togo -= m;
 2285|   432k|            sp->in_buffer_file_pos += m;
 2286|   432k|            break;
 2287|   432k|        }
 2288|  9.76M|        sp->in_buffer_file_pos_log = 0;
 2289|  9.76M|        switch (sp->in_buffer_source)
 2290|  9.76M|        {
 2291|  1.84k|            case osibsNotSetYet:
  ------------------
  |  Branch (2291:13): [True: 1.84k, False: 9.76M]
  ------------------
 2292|  1.84k|                if (sp->jpeg_interchange_format != 0)
  ------------------
  |  Branch (2292:21): [True: 536, False: 1.31k]
  ------------------
 2293|    536|                {
 2294|    536|                    sp->in_buffer_file_pos = sp->jpeg_interchange_format;
 2295|    536|                    sp->in_buffer_file_togo =
 2296|    536|                        sp->jpeg_interchange_format_length;
 2297|    536|                }
 2298|  1.84k|                sp->in_buffer_source = osibsJpegInterchangeFormat;
 2299|  1.84k|                break;
 2300|   364k|            case osibsJpegInterchangeFormat:
  ------------------
  |  Branch (2300:13): [True: 364k, False: 9.40M]
  ------------------
 2301|   364k|                sp->in_buffer_source = osibsStrile;
 2302|   364k|                break;
 2303|  9.38M|            case osibsStrile:
  ------------------
  |  Branch (2303:13): [True: 9.38M, False: 381k]
  ------------------
 2304|  9.38M|                if (sp->in_buffer_next_strile == sp->in_buffer_strile_count)
  ------------------
  |  Branch (2304:21): [True: 13.2k, False: 9.37M]
  ------------------
 2305|  13.2k|                    sp->in_buffer_source = osibsEof;
 2306|  9.37M|                else
 2307|  9.37M|                {
 2308|  9.37M|                    int err = 0;
 2309|  9.37M|                    sp->in_buffer_file_pos = TIFFGetStrileOffsetWithErr(
 2310|  9.37M|                        sp->tif, sp->in_buffer_next_strile, &err);
 2311|  9.37M|                    if (err)
  ------------------
  |  Branch (2311:25): [True: 353k, False: 9.01M]
  ------------------
 2312|   353k|                        return 0;
 2313|  9.01M|                    if (sp->in_buffer_file_pos != 0)
  ------------------
  |  Branch (2313:25): [True: 386k, False: 8.63M]
  ------------------
 2314|   386k|                    {
 2315|   386k|                        uint64_t bytecount = TIFFGetStrileByteCountWithErr(
 2316|   386k|                            sp->tif, sp->in_buffer_next_strile, &err);
 2317|   386k|                        if (err)
  ------------------
  |  Branch (2317:29): [True: 9.03k, False: 377k]
  ------------------
 2318|  9.03k|                            return 0;
 2319|   377k|                        if (sp->in_buffer_file_pos >= sp->file_size)
  ------------------
  |  Branch (2319:29): [True: 363k, False: 14.0k]
  ------------------
 2320|   363k|                            sp->in_buffer_file_pos = 0;
 2321|  14.0k|                        else if (bytecount == 0)
  ------------------
  |  Branch (2321:34): [True: 1.85k, False: 12.1k]
  ------------------
 2322|  1.85k|                            sp->in_buffer_file_togo =
 2323|  1.85k|                                sp->file_size - sp->in_buffer_file_pos;
 2324|  12.1k|                        else
 2325|  12.1k|                        {
 2326|  12.1k|                            sp->in_buffer_file_togo = bytecount;
 2327|  12.1k|                            if (sp->in_buffer_file_togo == 0)
  ------------------
  |  Branch (2327:33): [True: 0, False: 12.1k]
  ------------------
 2328|      0|                                sp->in_buffer_file_pos = 0;
 2329|  12.1k|                            else if (sp->in_buffer_file_pos >
  ------------------
  |  Branch (2329:38): [True: 678, False: 11.5k]
  ------------------
 2330|  12.1k|                                         UINT64_MAX - sp->in_buffer_file_togo ||
 2331|  11.5k|                                     sp->in_buffer_file_pos +
  ------------------
  |  Branch (2331:38): [True: 6.41k, False: 5.09k]
  ------------------
 2332|  11.5k|                                             sp->in_buffer_file_togo >
 2333|  11.5k|                                         sp->file_size)
 2334|  7.09k|                                sp->in_buffer_file_togo =
 2335|  7.09k|                                    sp->file_size - sp->in_buffer_file_pos;
 2336|  12.1k|                        }
 2337|   377k|                    }
 2338|  9.00M|                    sp->in_buffer_next_strile++;
 2339|  9.00M|                }
 2340|  9.02M|                break;
 2341|  9.02M|            case osibsEof:
  ------------------
  |  Branch (2341:13): [True: 15.3k, False: 9.75M]
  ------------------
 2342|  15.3k|            default:
  ------------------
  |  Branch (2342:13): [True: 0, False: 9.76M]
  ------------------
 2343|  15.3k|                return (0);
 2344|  9.76M|        }
 2345|  9.76M|    } while (1);
  ------------------
  |  Branch (2345:14): [True: 9.38M, Folded]
  ------------------
 2346|   432k|    return (1);
 2347|   811k|}
tif_ojpeg.c:OJPEGReadByteAdvance:
 2376|  11.3k|{
 2377|  11.3k|    assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2377:5): [True: 0, False: 11.3k]
  |  Branch (2377:5): [True: 11.3k, False: 0]
  ------------------
 2378|  11.3k|    sp->in_buffer_cur++;
 2379|  11.3k|    sp->in_buffer_togo--;
 2380|  11.3k|}
tif_ojpeg.c:OJPEGReadByte:
 2350|   167M|{
 2351|   167M|    if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2351:9): [True: 765k, False: 167M]
  ------------------
 2352|   765k|    {
 2353|   765k|        if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2353:13): [True: 374k, False: 391k]
  ------------------
 2354|   374k|            return (0);
 2355|   765k|        assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2355:9): [True: 0, False: 391k]
  |  Branch (2355:9): [True: 391k, False: 0]
  ------------------
 2356|   391k|    }
 2357|   167M|    *byte = *(sp->in_buffer_cur);
 2358|   167M|    sp->in_buffer_cur++;
 2359|   167M|    sp->in_buffer_togo--;
 2360|   167M|    return (1);
 2361|   167M|}
tif_ojpeg.c:OJPEGReadWord:
 2383|  16.5k|{
 2384|  16.5k|    uint8_t m;
 2385|  16.5k|    if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (2385:9): [True: 524, False: 16.0k]
  ------------------
 2386|    524|        return (0);
 2387|  16.0k|    *word = (uint16_t)(m << 8);
 2388|  16.0k|    if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (2388:9): [True: 2.00k, False: 14.0k]
  ------------------
 2389|  2.00k|        return (0);
 2390|  14.0k|    *word |= m;
 2391|  14.0k|    return (1);
 2392|  16.0k|}
tif_ojpeg.c:OJPEGReadSkip:
 2423|  6.29k|{
 2424|  6.29k|    uint16_t m;
 2425|  6.29k|    uint16_t n;
 2426|  6.29k|    m = len;
 2427|  6.29k|    n = m;
 2428|  6.29k|    if (n > sp->in_buffer_togo)
  ------------------
  |  Branch (2428:9): [True: 2.16k, False: 4.12k]
  ------------------
 2429|  2.16k|        n = sp->in_buffer_togo;
 2430|  6.29k|    sp->in_buffer_cur += n;
 2431|  6.29k|    sp->in_buffer_togo = (uint16_t)(sp->in_buffer_togo - n);
 2432|  6.29k|    m = (uint16_t)(m - n);
 2433|  6.29k|    if (m > 0)
  ------------------
  |  Branch (2433:9): [True: 2.16k, False: 4.12k]
  ------------------
 2434|  2.16k|    {
 2435|  2.16k|        assert(sp->in_buffer_togo == 0);
  ------------------
  |  Branch (2435:9): [True: 0, False: 2.16k]
  |  Branch (2435:9): [True: 2.16k, False: 0]
  ------------------
 2436|  2.16k|        n = m;
 2437|  2.16k|        if ((uint64_t)n > sp->in_buffer_file_togo)
  ------------------
  |  Branch (2437:13): [True: 1.30k, False: 865]
  ------------------
 2438|  1.30k|            n = (uint16_t)sp->in_buffer_file_togo;
 2439|  2.16k|        sp->in_buffer_file_pos += n;
 2440|  2.16k|        sp->in_buffer_file_togo -= n;
 2441|  2.16k|        sp->in_buffer_file_pos_log = 0;
 2442|       |        /* we don't skip past jpeginterchangeformat/strile block...
 2443|       |         * if that is asked from us, we're dealing with totally bazurk
 2444|       |         * data anyway, and we've not seen this happening on any
 2445|       |         * testfile, so we might as well likely cause some other
 2446|       |         * meaningless error to be passed at some later time
 2447|       |         */
 2448|  2.16k|    }
 2449|  6.29k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDri:
 1675|    344|{
 1676|       |    /* This could easily cause trouble in some cases... but no such cases have
 1677|       |       occurred so far */
 1678|    344|    static const char module[] = "OJPEGReadHeaderInfoSecStreamDri";
 1679|    344|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1680|    344|    uint16_t m;
 1681|    344|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1681:9): [True: 5, False: 339]
  ------------------
 1682|      5|        return (0);
 1683|    339|    if (m != 4)
  ------------------
  |  Branch (1683:9): [True: 3, False: 336]
  ------------------
 1684|      3|    {
 1685|      3|        TIFFErrorExtR(tif, module, "Corrupt DRI marker in JPEG data");
 1686|      3|        return (0);
 1687|      3|    }
 1688|    336|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1688:9): [True: 6, False: 330]
  ------------------
 1689|      6|        return (0);
 1690|    330|    sp->restart_interval = m;
 1691|    330|    return (1);
 1692|    336|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDqt:
 1695|  4.11k|{
 1696|       |    /* this is a table marker, and it is to be saved as a whole for exact
 1697|       |     * pushing on the jpeg stream later on */
 1698|  4.11k|    static const char module[] = "OJPEGReadHeaderInfoSecStreamDqt";
 1699|  4.11k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1700|  4.11k|    uint16_t m;
 1701|  4.11k|    uint32_t na;
 1702|  4.11k|    uint8_t *nb;
 1703|  4.11k|    uint8_t o;
 1704|  4.11k|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1704:9): [True: 0, False: 4.11k]
  ------------------
 1705|      0|        return (0);
 1706|  4.11k|    if (m <= 2)
  ------------------
  |  Branch (1706:9): [True: 0, False: 4.11k]
  ------------------
 1707|      0|    {
 1708|      0|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1708:13): [True: 0, False: 0]
  ------------------
 1709|      0|            TIFFErrorExtR(tif, module, "Corrupt DQT marker in JPEG data");
 1710|      0|        return (0);
 1711|      0|    }
 1712|  4.11k|    if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1712:9): [True: 3.69k, False: 414]
  ------------------
 1713|  3.69k|        OJPEGReadSkip(sp, (uint16_t)(m - 2));
 1714|    414|    else
 1715|    414|    {
 1716|    414|        m = (uint16_t)(m - 2);
 1717|    414|        do
 1718|    669|        {
 1719|    669|            if (m < 65)
  ------------------
  |  Branch (1719:17): [True: 1, False: 668]
  ------------------
 1720|      1|            {
 1721|      1|                TIFFErrorExtR(tif, module, "Corrupt DQT marker in JPEG data");
 1722|      1|                return (0);
 1723|      1|            }
 1724|    668|            na = sizeof(uint32_t) + 69;
 1725|    668|            nb = (uint8_t *)_TIFFmallocExt(tif, na);
 1726|    668|            if (nb == 0)
  ------------------
  |  Branch (1726:17): [True: 0, False: 668]
  ------------------
 1727|      0|            {
 1728|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 1729|      0|                return (0);
 1730|      0|            }
 1731|    668|            *(uint32_t *)nb = na;
 1732|    668|            nb[sizeof(uint32_t)] = 255;
 1733|    668|            nb[sizeof(uint32_t) + 1] = JPEG_MARKER_DQT;
  ------------------
  |  |  166|    668|#define JPEG_MARKER_DQT 0xDB
  ------------------
 1734|    668|            nb[sizeof(uint32_t) + 2] = 0;
 1735|    668|            nb[sizeof(uint32_t) + 3] = 67;
 1736|    668|            if (OJPEGReadBlock(sp, 65, &nb[sizeof(uint32_t) + 4]) == 0)
  ------------------
  |  Branch (1736:17): [True: 2, False: 666]
  ------------------
 1737|      2|            {
 1738|      2|                _TIFFfreeExt(tif, nb);
 1739|      2|                return (0);
 1740|      2|            }
 1741|    666|            o = nb[sizeof(uint32_t) + 4] & 15;
 1742|    666|            if (3 < o)
  ------------------
  |  Branch (1742:17): [True: 7, False: 659]
  ------------------
 1743|      7|            {
 1744|      7|                TIFFErrorExtR(tif, module, "Corrupt DQT marker in JPEG data");
 1745|      7|                _TIFFfreeExt(tif, nb);
 1746|      7|                return (0);
 1747|      7|            }
 1748|    659|            if (sp->qtable[o] != 0)
  ------------------
  |  Branch (1748:17): [True: 636, False: 23]
  ------------------
 1749|    636|                _TIFFfreeExt(tif, sp->qtable[o]);
 1750|    659|            sp->qtable[o] = nb;
 1751|    659|            m = (uint16_t)(m - 65);
 1752|    659|        } while (m > 0);
  ------------------
  |  Branch (1752:18): [True: 255, False: 404]
  ------------------
 1753|    414|    }
 1754|  4.10k|    return (1);
 1755|  4.11k|}
tif_ojpeg.c:OJPEGReadBlock:
 2395|  1.08k|{
 2396|  1.08k|    uint16_t mlen;
 2397|  1.08k|    uint8_t *mmem;
 2398|  1.08k|    uint16_t n;
 2399|  1.08k|    assert(len > 0);
  ------------------
  |  Branch (2399:5): [True: 0, False: 1.08k]
  |  Branch (2399:5): [True: 1.08k, False: 0]
  ------------------
 2400|  1.08k|    mlen = len;
 2401|  1.08k|    mmem = (uint8_t *)mem;
 2402|  1.08k|    do
 2403|  2.18k|    {
 2404|  2.18k|        if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2404:13): [True: 1.10k, False: 1.08k]
  ------------------
 2405|  1.10k|        {
 2406|  1.10k|            if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2406:17): [True: 9, False: 1.09k]
  ------------------
 2407|      9|                return (0);
 2408|  1.10k|            assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2408:13): [True: 0, False: 1.09k]
  |  Branch (2408:13): [True: 1.09k, False: 0]
  ------------------
 2409|  1.09k|        }
 2410|  2.18k|        n = mlen;
 2411|  2.18k|        if (n > sp->in_buffer_togo)
  ------------------
  |  Branch (2411:13): [True: 1.10k, False: 1.07k]
  ------------------
 2412|  1.10k|            n = sp->in_buffer_togo;
 2413|  2.18k|        _TIFFmemcpy(mmem, sp->in_buffer_cur, n);
 2414|  2.18k|        sp->in_buffer_cur += n;
 2415|  2.18k|        sp->in_buffer_togo = (uint16_t)(sp->in_buffer_togo - n);
 2416|  2.18k|        mlen = (uint16_t)(mlen - n);
 2417|  2.18k|        mmem += n;
 2418|  2.18k|    } while (mlen > 0);
  ------------------
  |  Branch (2418:14): [True: 1.10k, False: 1.07k]
  ------------------
 2419|  1.07k|    return (1);
 2420|  1.08k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamDht:
 1758|  1.49k|{
 1759|       |    /* this is a table marker, and it is to be saved as a whole for exact
 1760|       |     * pushing on the jpeg stream later on */
 1761|       |    /* TODO: the following assumes there is only one table in this marker... but
 1762|       |     * i'm not quite sure that assumption is guaranteed correct */
 1763|  1.49k|    static const char module[] = "OJPEGReadHeaderInfoSecStreamDht";
 1764|  1.49k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1765|  1.49k|    uint16_t m;
 1766|  1.49k|    uint32_t na;
 1767|  1.49k|    uint8_t *nb;
 1768|  1.49k|    uint8_t o;
 1769|  1.49k|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1769:9): [True: 3, False: 1.48k]
  ------------------
 1770|      3|        return (0);
 1771|  1.48k|    if (m <= 2)
  ------------------
  |  Branch (1771:9): [True: 0, False: 1.48k]
  ------------------
 1772|      0|    {
 1773|      0|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1773:13): [True: 0, False: 0]
  ------------------
 1774|      0|            TIFFErrorExtR(tif, module, "Corrupt DHT marker in JPEG data");
 1775|      0|        return (0);
 1776|      0|    }
 1777|  1.48k|    if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1777:9): [True: 1.07k, False: 415]
  ------------------
 1778|  1.07k|    {
 1779|  1.07k|        OJPEGReadSkip(sp, (uint16_t)(m - 2));
 1780|  1.07k|    }
 1781|    415|    else
 1782|    415|    {
 1783|    415|        na = (uint32_t)(sizeof(uint32_t) + 2 + m);
 1784|    415|        nb = (uint8_t *)_TIFFmallocExt(tif, na);
 1785|    415|        if (nb == 0)
  ------------------
  |  Branch (1785:13): [True: 0, False: 415]
  ------------------
 1786|      0|        {
 1787|      0|            TIFFErrorExtR(tif, module, "Out of memory");
 1788|      0|            return (0);
 1789|      0|        }
 1790|    415|        *(uint32_t *)nb = na;
 1791|    415|        nb[sizeof(uint32_t)] = 255;
 1792|    415|        nb[sizeof(uint32_t) + 1] = JPEG_MARKER_DHT;
  ------------------
  |  |  161|    415|#define JPEG_MARKER_DHT 0xC4
  ------------------
 1793|    415|        nb[sizeof(uint32_t) + 2] = (uint8_t)(m >> 8);
 1794|    415|        nb[sizeof(uint32_t) + 3] = (uint8_t)(m & 255);
 1795|    415|        if (OJPEGReadBlock(sp, (uint16_t)(m - 2), &nb[sizeof(uint32_t) + 4]) ==
  ------------------
  |  Branch (1795:13): [True: 7, False: 408]
  ------------------
 1796|    415|            0)
 1797|      7|        {
 1798|      7|            _TIFFfreeExt(tif, nb);
 1799|      7|            return (0);
 1800|      7|        }
 1801|    408|        o = nb[sizeof(uint32_t) + 4];
 1802|    408|        if ((o & 240) == 0)
  ------------------
  |  Branch (1802:13): [True: 191, False: 217]
  ------------------
 1803|    191|        {
 1804|    191|            if (3 < o)
  ------------------
  |  Branch (1804:17): [True: 2, False: 189]
  ------------------
 1805|      2|            {
 1806|      2|                TIFFErrorExtR(tif, module, "Corrupt DHT marker in JPEG data");
 1807|      2|                _TIFFfreeExt(tif, nb);
 1808|      2|                return (0);
 1809|      2|            }
 1810|    189|            if (sp->dctable[o] != 0)
  ------------------
  |  Branch (1810:17): [True: 138, False: 51]
  ------------------
 1811|    138|                _TIFFfreeExt(tif, sp->dctable[o]);
 1812|    189|            sp->dctable[o] = nb;
 1813|    189|        }
 1814|    217|        else
 1815|    217|        {
 1816|    217|            if ((o & 240) != 16)
  ------------------
  |  Branch (1816:17): [True: 2, False: 215]
  ------------------
 1817|      2|            {
 1818|      2|                TIFFErrorExtR(tif, module, "Corrupt DHT marker in JPEG data");
 1819|      2|                _TIFFfreeExt(tif, nb);
 1820|      2|                return (0);
 1821|      2|            }
 1822|    215|            o &= 15;
 1823|    215|            if (3 < o)
  ------------------
  |  Branch (1823:17): [True: 0, False: 215]
  ------------------
 1824|      0|            {
 1825|      0|                TIFFErrorExtR(tif, module, "Corrupt DHT marker in JPEG data");
 1826|      0|                _TIFFfreeExt(tif, nb);
 1827|      0|                return (0);
 1828|      0|            }
 1829|    215|            if (sp->actable[o] != 0)
  ------------------
  |  Branch (1829:17): [True: 203, False: 12]
  ------------------
 1830|    203|                _TIFFfreeExt(tif, sp->actable[o]);
 1831|    215|            sp->actable[o] = nb;
 1832|    215|        }
 1833|    408|    }
 1834|  1.47k|    return (1);
 1835|  1.48k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamSof:
 1838|    104|{
 1839|       |    /* this marker needs to be checked, and part of its data needs to be saved
 1840|       |     * for regeneration later on */
 1841|    104|    static const char module[] = "OJPEGReadHeaderInfoSecStreamSof";
 1842|    104|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1843|    104|    uint16_t m;
 1844|    104|    uint16_t n;
 1845|    104|    uint8_t o;
 1846|    104|    uint16_t p;
 1847|    104|    uint16_t q;
 1848|    104|    if (sp->sof_log != 0)
  ------------------
  |  Branch (1848:9): [True: 3, False: 101]
  ------------------
 1849|      3|    {
 1850|      3|        TIFFErrorExtR(tif, module, "Corrupt JPEG data");
 1851|      3|        return (0);
 1852|      3|    }
 1853|    101|    if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1853:9): [True: 53, False: 48]
  ------------------
 1854|     53|        sp->sof_marker_id = marker_id;
 1855|       |    /* Lf: data length */
 1856|    101|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (1856:9): [True: 0, False: 101]
  ------------------
 1857|      0|        return (0);
 1858|    101|    if (m < 11)
  ------------------
  |  Branch (1858:9): [True: 2, False: 99]
  ------------------
 1859|      2|    {
 1860|      2|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1860:13): [True: 2, False: 0]
  ------------------
 1861|      2|            TIFFErrorExtR(tif, module, "Corrupt SOF marker in JPEG data");
 1862|      2|        return (0);
 1863|      2|    }
 1864|     99|    m = (uint16_t)(m - 8);
 1865|     99|    if (m % 3 != 0)
  ------------------
  |  Branch (1865:9): [True: 0, False: 99]
  ------------------
 1866|      0|    {
 1867|      0|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1867:13): [True: 0, False: 0]
  ------------------
 1868|      0|            TIFFErrorExtR(tif, module, "Corrupt SOF marker in JPEG data");
 1869|      0|        return (0);
 1870|      0|    }
 1871|     99|    n = m / 3;
 1872|     99|    if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1872:9): [True: 51, False: 48]
  ------------------
 1873|     51|    {
 1874|     51|        if (n != sp->samples_per_pixel)
  ------------------
  |  Branch (1874:13): [True: 6, False: 45]
  ------------------
 1875|      6|        {
 1876|      6|            TIFFErrorExtR(
 1877|      6|                tif, module,
 1878|      6|                "JPEG compressed data indicates unexpected number of samples");
 1879|      6|            return (0);
 1880|      6|        }
 1881|     51|    }
 1882|       |    /* P: Sample precision */
 1883|     93|    if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1883:9): [True: 5, False: 88]
  ------------------
 1884|      5|        return (0);
 1885|     88|    if (o != 8)
  ------------------
  |  Branch (1885:9): [True: 6, False: 82]
  ------------------
 1886|      6|    {
 1887|      6|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1887:13): [True: 1, False: 5]
  ------------------
 1888|      1|            TIFFErrorExtR(tif, module,
 1889|      1|                          "JPEG compressed data indicates unexpected number of "
 1890|      1|                          "bits per sample");
 1891|      6|        return (0);
 1892|      6|    }
 1893|       |    /* Y: Number of lines, X: Number of samples per line */
 1894|     82|    if (sp->subsamplingcorrect)
  ------------------
  |  Branch (1894:9): [True: 41, False: 41]
  ------------------
 1895|     41|        OJPEGReadSkip(sp, 4);
 1896|     41|    else
 1897|     41|    {
 1898|       |        /* Y: Number of lines */
 1899|     41|        if (OJPEGReadWord(sp, &p) == 0)
  ------------------
  |  Branch (1899:13): [True: 2, False: 39]
  ------------------
 1900|      2|            return (0);
 1901|     39|        if (((uint32_t)p < sp->image_length) &&
  ------------------
  |  Branch (1901:13): [True: 3, False: 36]
  ------------------
 1902|      3|            ((uint32_t)p < sp->strile_length_total))
  ------------------
  |  Branch (1902:13): [True: 3, False: 0]
  ------------------
 1903|      3|        {
 1904|      3|            TIFFErrorExtR(tif, module,
 1905|      3|                          "JPEG compressed data indicates unexpected height");
 1906|      3|            return (0);
 1907|      3|        }
 1908|     36|        sp->sof_y = p;
 1909|       |        /* X: Number of samples per line */
 1910|     36|        if (OJPEGReadWord(sp, &p) == 0)
  ------------------
  |  Branch (1910:13): [True: 0, False: 36]
  ------------------
 1911|      0|            return (0);
 1912|     36|        if (((uint32_t)p < sp->image_width) && ((uint32_t)p < sp->strile_width))
  ------------------
  |  Branch (1912:13): [True: 24, False: 12]
  |  Branch (1912:48): [True: 4, False: 20]
  ------------------
 1913|      4|        {
 1914|      4|            TIFFErrorExtR(tif, module,
 1915|      4|                          "JPEG compressed data indicates unexpected width");
 1916|      4|            return (0);
 1917|      4|        }
 1918|     32|        if ((uint32_t)p > sp->strile_width)
  ------------------
  |  Branch (1918:13): [True: 0, False: 32]
  ------------------
 1919|      0|        {
 1920|      0|            TIFFErrorExtR(tif, module,
 1921|      0|                          "JPEG compressed data image width exceeds expected "
 1922|      0|                          "image width");
 1923|      0|            return (0);
 1924|      0|        }
 1925|     32|        sp->sof_x = p;
 1926|     32|    }
 1927|       |    /* Nf: Number of image components in frame */
 1928|     73|    if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1928:9): [True: 5, False: 68]
  ------------------
 1929|      5|        return (0);
 1930|     68|    if (o != n)
  ------------------
  |  Branch (1930:9): [True: 4, False: 64]
  ------------------
 1931|      4|    {
 1932|      4|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1932:13): [True: 0, False: 4]
  ------------------
 1933|      0|            TIFFErrorExtR(tif, module, "Corrupt SOF marker in JPEG data");
 1934|      4|        return (0);
 1935|      4|    }
 1936|       |    /* per component stuff */
 1937|       |    /* TODO: double-check that flow implies that n cannot be as big as to make
 1938|       |     * us overflow sof_c, sof_hv and sof_tq arrays */
 1939|    797|    for (q = 0; q < n; q++)
  ------------------
  |  Branch (1939:17): [True: 742, False: 55]
  ------------------
 1940|    742|    {
 1941|       |        /* C: Component identifier */
 1942|    742|        if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1942:13): [True: 0, False: 742]
  ------------------
 1943|      0|            return (0);
 1944|    742|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1944:13): [True: 79, False: 663]
  ------------------
 1945|     79|            sp->sof_c[q] = o;
 1946|       |        /* H: Horizontal sampling factor, and V: Vertical sampling factor */
 1947|    742|        if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1947:13): [True: 0, False: 742]
  ------------------
 1948|      0|            return (0);
 1949|    742|        if (sp->subsamplingcorrect != 0)
  ------------------
  |  Branch (1949:13): [True: 663, False: 79]
  ------------------
 1950|    663|        {
 1951|    663|            if (q == 0)
  ------------------
  |  Branch (1951:17): [True: 35, False: 628]
  ------------------
 1952|     35|            {
 1953|     35|                sp->subsampling_hor = (o >> 4);
 1954|     35|                sp->subsampling_ver = (o & 15);
 1955|     35|                if (((sp->subsampling_hor != 1) && (sp->subsampling_hor != 2) &&
  ------------------
  |  Branch (1955:22): [True: 28, False: 7]
  |  Branch (1955:52): [True: 19, False: 9]
  ------------------
 1956|     19|                     (sp->subsampling_hor != 4)) ||
  ------------------
  |  Branch (1956:22): [True: 12, False: 7]
  ------------------
 1957|     23|                    ((sp->subsampling_ver != 1) && (sp->subsampling_ver != 2) &&
  ------------------
  |  Branch (1957:22): [True: 10, False: 13]
  |  Branch (1957:52): [True: 3, False: 7]
  ------------------
 1958|      3|                     (sp->subsampling_ver != 4)))
  ------------------
  |  Branch (1958:22): [True: 0, False: 3]
  ------------------
 1959|     12|                    sp->subsampling_force_desubsampling_inside_decompression =
 1960|     12|                        1;
 1961|     35|            }
 1962|    628|            else
 1963|    628|            {
 1964|    628|                if (o != 17)
  ------------------
  |  Branch (1964:21): [True: 615, False: 13]
  ------------------
 1965|    615|                    sp->subsampling_force_desubsampling_inside_decompression =
 1966|    615|                        1;
 1967|    628|            }
 1968|    663|        }
 1969|     79|        else
 1970|     79|        {
 1971|     79|            sp->sof_hv[q] = o;
 1972|     79|            if (sp->subsampling_force_desubsampling_inside_decompression == 0)
  ------------------
  |  Branch (1972:17): [True: 22, False: 57]
  ------------------
 1973|     22|            {
 1974|     22|                if (q == 0)
  ------------------
  |  Branch (1974:21): [True: 10, False: 12]
  ------------------
 1975|     10|                {
 1976|     10|                    if (o != ((sp->subsampling_hor << 4) | sp->subsampling_ver))
  ------------------
  |  Branch (1976:25): [True: 3, False: 7]
  ------------------
 1977|      3|                    {
 1978|      3|                        TIFFErrorExtR(tif, module,
 1979|      3|                                      "JPEG compressed data indicates "
 1980|      3|                                      "unexpected subsampling values");
 1981|      3|                        return (0);
 1982|      3|                    }
 1983|     10|                }
 1984|     12|                else
 1985|     12|                {
 1986|     12|                    if (o != 17)
  ------------------
  |  Branch (1986:25): [True: 3, False: 9]
  ------------------
 1987|      3|                    {
 1988|      3|                        TIFFErrorExtR(tif, module,
 1989|      3|                                      "JPEG compressed data indicates "
 1990|      3|                                      "unexpected subsampling values");
 1991|      3|                        return (0);
 1992|      3|                    }
 1993|     12|                }
 1994|     22|            }
 1995|     79|        }
 1996|       |        /* Tq: Quantization table destination selector */
 1997|    736|        if (OJPEGReadByte(sp, &o) == 0)
  ------------------
  |  Branch (1997:13): [True: 3, False: 733]
  ------------------
 1998|      3|            return (0);
 1999|    733|        if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (1999:13): [True: 71, False: 662]
  ------------------
 2000|     71|            sp->sof_tq[q] = o;
 2001|    733|    }
 2002|     55|    if (sp->subsamplingcorrect == 0)
  ------------------
  |  Branch (2002:9): [True: 21, False: 34]
  ------------------
 2003|     21|        sp->sof_log = 1;
 2004|     55|    return (1);
 2005|     64|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecStreamSos:
 2008|  8.80k|{
 2009|       |    /* this marker needs to be checked, and part of its data needs to be saved
 2010|       |     * for regeneration later on */
 2011|  8.80k|    static const char module[] = "OJPEGReadHeaderInfoSecStreamSos";
 2012|  8.80k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2013|  8.80k|    uint16_t m;
 2014|  8.80k|    uint8_t n;
 2015|  8.80k|    uint8_t o;
 2016|  8.80k|    assert(sp->subsamplingcorrect == 0);
  ------------------
  |  Branch (2016:5): [True: 0, False: 8.80k]
  |  Branch (2016:5): [True: 8.80k, False: 0]
  ------------------
 2017|  8.80k|    if (sp->sof_log == 0)
  ------------------
  |  Branch (2017:9): [True: 2, False: 8.80k]
  ------------------
 2018|      2|    {
 2019|      2|        TIFFErrorExtR(tif, module, "Corrupt SOS marker in JPEG data");
 2020|      2|        return (0);
 2021|      2|    }
 2022|       |    /* Ls */
 2023|  8.80k|    if (OJPEGReadWord(sp, &m) == 0)
  ------------------
  |  Branch (2023:9): [True: 2.50k, False: 6.29k]
  ------------------
 2024|  2.50k|        return (0);
 2025|  6.29k|    if (m != 6 + sp->samples_per_pixel_per_plane * 2)
  ------------------
  |  Branch (2025:9): [True: 1.70k, False: 4.59k]
  ------------------
 2026|  1.70k|    {
 2027|  1.70k|        TIFFErrorExtR(tif, module, "Corrupt SOS marker in JPEG data");
 2028|  1.70k|        return (0);
 2029|  1.70k|    }
 2030|       |    /* Ns */
 2031|  4.59k|    if (OJPEGReadByte(sp, &n) == 0)
  ------------------
  |  Branch (2031:9): [True: 474, False: 4.12k]
  ------------------
 2032|    474|        return (0);
 2033|  4.12k|    if (n != sp->samples_per_pixel_per_plane)
  ------------------
  |  Branch (2033:9): [True: 2.86k, False: 1.26k]
  ------------------
 2034|  2.86k|    {
 2035|  2.86k|        TIFFErrorExtR(tif, module, "Corrupt SOS marker in JPEG data");
 2036|  2.86k|        return (0);
 2037|  2.86k|    }
 2038|       |    /* Cs, Td, and Ta */
 2039|  1.79k|    for (o = 0; o < sp->samples_per_pixel_per_plane; o++)
  ------------------
  |  Branch (2039:17): [True: 1.29k, False: 505]
  ------------------
 2040|  1.29k|    {
 2041|       |        /* Cs */
 2042|  1.29k|        if (OJPEGReadByte(sp, &n) == 0)
  ------------------
  |  Branch (2042:13): [True: 221, False: 1.07k]
  ------------------
 2043|    221|            return (0);
 2044|  1.07k|        sp->sos_cs[sp->plane_sample_offset + o] = n;
 2045|       |        /* Td and Ta */
 2046|  1.07k|        if (OJPEGReadByte(sp, &n) == 0)
  ------------------
  |  Branch (2046:13): [True: 534, False: 538]
  ------------------
 2047|    534|            return (0);
 2048|    538|        sp->sos_tda[sp->plane_sample_offset + o] = n;
 2049|    538|    }
 2050|       |    /* skip Ss, Se, Ah, en Al -> no check, as per Tom Lane recommendation, as
 2051|       |     * per LibJpeg source */
 2052|    505|    OJPEGReadSkip(sp, 3);
 2053|    505|    return (1);
 2054|  1.26k|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesQTable:
 2057|    794|{
 2058|    794|    static const char module[] = "OJPEGReadHeaderInfoSecTablesQTable";
 2059|    794|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2060|    794|    uint8_t m;
 2061|    794|    uint8_t n;
 2062|    794|    uint32_t oa;
 2063|    794|    uint8_t *ob;
 2064|    794|    uint32_t p;
 2065|    794|    if (sp->qtable_offset[0] == 0)
  ------------------
  |  Branch (2065:9): [True: 14, False: 780]
  ------------------
 2066|     14|    {
 2067|     14|        TIFFErrorExtR(tif, module, "Missing JPEG tables");
 2068|     14|        return (0);
 2069|     14|    }
 2070|    780|    sp->in_buffer_file_pos_log = 0;
 2071|  3.01k|    for (m = 0; m < sp->samples_per_pixel; m++)
  ------------------
  |  Branch (2071:17): [True: 2.26k, False: 750]
  ------------------
 2072|  2.26k|    {
 2073|  2.26k|        if ((sp->qtable_offset[m] != 0) &&
  ------------------
  |  Branch (2073:13): [True: 889, False: 1.37k]
  ------------------
 2074|    889|            ((m == 0) || (sp->qtable_offset[m] != sp->qtable_offset[m - 1])))
  ------------------
  |  Branch (2074:14): [True: 780, False: 109]
  |  Branch (2074:26): [True: 107, False: 2]
  ------------------
 2075|    887|        {
 2076|    919|            for (n = 0; n < m - 1; n++)
  ------------------
  |  Branch (2076:25): [True: 35, False: 884]
  ------------------
 2077|     35|            {
 2078|     35|                if (sp->qtable_offset[m] == sp->qtable_offset[n])
  ------------------
  |  Branch (2078:21): [True: 3, False: 32]
  ------------------
 2079|      3|                {
 2080|      3|                    TIFFErrorExtR(tif, module, "Corrupt JpegQTables tag value");
 2081|      3|                    return (0);
 2082|      3|                }
 2083|     35|            }
 2084|    884|            oa = sizeof(uint32_t) + 69;
 2085|    884|            ob = (uint8_t *)_TIFFmallocExt(tif, oa);
 2086|    884|            if (ob == 0)
  ------------------
  |  Branch (2086:17): [True: 0, False: 884]
  ------------------
 2087|      0|            {
 2088|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 2089|      0|                return (0);
 2090|      0|            }
 2091|    884|            *(uint32_t *)ob = oa;
 2092|    884|            ob[sizeof(uint32_t)] = 255;
 2093|    884|            ob[sizeof(uint32_t) + 1] = JPEG_MARKER_DQT;
  ------------------
  |  |  166|    884|#define JPEG_MARKER_DQT 0xDB
  ------------------
 2094|    884|            ob[sizeof(uint32_t) + 2] = 0;
 2095|    884|            ob[sizeof(uint32_t) + 3] = 67;
 2096|    884|            ob[sizeof(uint32_t) + 4] = m;
 2097|    884|            TIFFSeekFile(tif, sp->qtable_offset[m], SEEK_SET);
  ------------------
  |  |  287|    884|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2098|    884|            p = (uint32_t)TIFFReadFile(tif, &ob[sizeof(uint32_t) + 5], 64);
  ------------------
  |  |  283|    884|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2099|    884|            if (p != 64)
  ------------------
  |  Branch (2099:17): [True: 27, False: 857]
  ------------------
 2100|     27|            {
 2101|     27|                _TIFFfreeExt(tif, ob);
 2102|     27|                return (0);
 2103|     27|            }
 2104|    857|            if (sp->qtable[m] != 0)
  ------------------
  |  Branch (2104:17): [True: 2, False: 855]
  ------------------
 2105|      2|                _TIFFfreeExt(tif, sp->qtable[m]);
 2106|    857|            sp->qtable[m] = ob;
 2107|    857|            sp->sof_tq[m] = m;
 2108|    857|        }
 2109|  1.37k|        else
 2110|  1.37k|            sp->sof_tq[m] = sp->sof_tq[m - 1];
 2111|  2.26k|    }
 2112|    750|    return (1);
 2113|    780|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesDcTable:
 2116|    750|{
 2117|    750|    static const char module[] = "OJPEGReadHeaderInfoSecTablesDcTable";
 2118|    750|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2119|    750|    uint8_t m;
 2120|    750|    uint8_t n;
 2121|    750|    uint8_t o[16];
 2122|    750|    uint32_t p;
 2123|    750|    uint32_t q;
 2124|    750|    uint32_t ra;
 2125|    750|    uint8_t *rb;
 2126|    750|    if (sp->dctable_offset[0] == 0)
  ------------------
  |  Branch (2126:9): [True: 18, False: 732]
  ------------------
 2127|     18|    {
 2128|     18|        TIFFErrorExtR(tif, module, "Missing JPEG tables");
 2129|     18|        return (0);
 2130|     18|    }
 2131|    732|    sp->in_buffer_file_pos_log = 0;
 2132|  2.90k|    for (m = 0; m < sp->samples_per_pixel; m++)
  ------------------
  |  Branch (2132:17): [True: 2.17k, False: 722]
  ------------------
 2133|  2.17k|    {
 2134|  2.17k|        if ((sp->dctable_offset[m] != 0) &&
  ------------------
  |  Branch (2134:13): [True: 1.38k, False: 797]
  ------------------
 2135|  1.38k|            ((m == 0) || (sp->dctable_offset[m] != sp->dctable_offset[m - 1])))
  ------------------
  |  Branch (2135:14): [True: 732, False: 649]
  |  Branch (2135:26): [True: 638, False: 11]
  ------------------
 2136|  1.37k|        {
 2137|  1.69k|            for (n = 0; n < m - 1; n++)
  ------------------
  |  Branch (2137:25): [True: 328, False: 1.36k]
  ------------------
 2138|    328|            {
 2139|    328|                if (sp->dctable_offset[m] == sp->dctable_offset[n])
  ------------------
  |  Branch (2139:21): [True: 1, False: 327]
  ------------------
 2140|      1|                {
 2141|      1|                    TIFFErrorExtR(tif, module,
 2142|      1|                                  "Corrupt JpegDcTables tag value");
 2143|      1|                    return (0);
 2144|      1|                }
 2145|    328|            }
 2146|  1.36k|            TIFFSeekFile(tif, sp->dctable_offset[m], SEEK_SET);
  ------------------
  |  |  287|  1.36k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2147|  1.36k|            p = (uint32_t)TIFFReadFile(tif, o, 16);
  ------------------
  |  |  283|  1.36k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2148|  1.36k|            if (p != 16)
  ------------------
  |  Branch (2148:17): [True: 3, False: 1.36k]
  ------------------
 2149|      3|                return (0);
 2150|  1.36k|            q = 0;
 2151|  23.2k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2151:25): [True: 21.8k, False: 1.36k]
  ------------------
 2152|  21.8k|                q += o[n];
 2153|  1.36k|            ra = (uint32_t)(sizeof(uint32_t) + 21 + q);
 2154|  1.36k|            rb = (uint8_t *)_TIFFmallocExt(tif, ra);
 2155|  1.36k|            if (rb == 0)
  ------------------
  |  Branch (2155:17): [True: 0, False: 1.36k]
  ------------------
 2156|      0|            {
 2157|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 2158|      0|                return (0);
 2159|      0|            }
 2160|  1.36k|            *(uint32_t *)rb = ra;
 2161|  1.36k|            rb[sizeof(uint32_t)] = 255;
 2162|  1.36k|            rb[sizeof(uint32_t) + 1] = JPEG_MARKER_DHT;
  ------------------
  |  |  161|  1.36k|#define JPEG_MARKER_DHT 0xC4
  ------------------
 2163|  1.36k|            rb[sizeof(uint32_t) + 2] = (uint8_t)((19 + q) >> 8);
 2164|  1.36k|            rb[sizeof(uint32_t) + 3] = ((19 + q) & 255);
 2165|  1.36k|            rb[sizeof(uint32_t) + 4] = m;
 2166|  23.2k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2166:25): [True: 21.8k, False: 1.36k]
  ------------------
 2167|  21.8k|                rb[sizeof(uint32_t) + 5 + n] = o[n];
 2168|  1.36k|            p = (uint32_t)TIFFReadFile(tif, &(rb[sizeof(uint32_t) + 21]), q);
  ------------------
  |  |  283|  1.36k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2169|  1.36k|            if (p != q)
  ------------------
  |  Branch (2169:17): [True: 6, False: 1.36k]
  ------------------
 2170|      6|            {
 2171|      6|                _TIFFfreeExt(tif, rb);
 2172|      6|                return (0);
 2173|      6|            }
 2174|  1.36k|            if (sp->dctable[m] != 0)
  ------------------
  |  Branch (2174:17): [True: 4, False: 1.35k]
  ------------------
 2175|      4|                _TIFFfreeExt(tif, sp->dctable[m]);
 2176|  1.36k|            sp->dctable[m] = rb;
 2177|  1.36k|            sp->sos_tda[m] = (uint8_t)(m << 4);
 2178|  1.36k|        }
 2179|    808|        else
 2180|    808|            sp->sos_tda[m] = sp->sos_tda[m - 1];
 2181|  2.17k|    }
 2182|    722|    return (1);
 2183|    732|}
tif_ojpeg.c:OJPEGReadHeaderInfoSecTablesAcTable:
 2186|    722|{
 2187|    722|    static const char module[] = "OJPEGReadHeaderInfoSecTablesAcTable";
 2188|    722|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2189|    722|    uint8_t m;
 2190|    722|    uint8_t n;
 2191|    722|    uint8_t o[16];
 2192|    722|    uint32_t p;
 2193|    722|    uint32_t q;
 2194|    722|    uint32_t ra;
 2195|    722|    uint8_t *rb;
 2196|    722|    if (sp->actable_offset[0] == 0)
  ------------------
  |  Branch (2196:9): [True: 14, False: 708]
  ------------------
 2197|     14|    {
 2198|     14|        TIFFErrorExtR(tif, module, "Missing JPEG tables");
 2199|     14|        return (0);
 2200|     14|    }
 2201|    708|    sp->in_buffer_file_pos_log = 0;
 2202|  2.74k|    for (m = 0; m < sp->samples_per_pixel; m++)
  ------------------
  |  Branch (2202:17): [True: 2.06k, False: 672]
  ------------------
 2203|  2.06k|    {
 2204|  2.06k|        if ((sp->actable_offset[m] != 0) &&
  ------------------
  |  Branch (2204:13): [True: 1.32k, False: 746]
  ------------------
 2205|  1.32k|            ((m == 0) || (sp->actable_offset[m] != sp->actable_offset[m - 1])))
  ------------------
  |  Branch (2205:14): [True: 708, False: 614]
  |  Branch (2205:26): [True: 587, False: 27]
  ------------------
 2206|  1.29k|        {
 2207|  1.39k|            for (n = 0; n < m - 1; n++)
  ------------------
  |  Branch (2207:25): [True: 105, False: 1.29k]
  ------------------
 2208|    105|            {
 2209|    105|                if (sp->actable_offset[m] == sp->actable_offset[n])
  ------------------
  |  Branch (2209:21): [True: 1, False: 104]
  ------------------
 2210|      1|                {
 2211|      1|                    TIFFErrorExtR(tif, module,
 2212|      1|                                  "Corrupt JpegAcTables tag value");
 2213|      1|                    return (0);
 2214|      1|                }
 2215|    105|            }
 2216|  1.29k|            TIFFSeekFile(tif, sp->actable_offset[m], SEEK_SET);
  ------------------
  |  |  287|  1.29k|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
 2217|  1.29k|            p = (uint32_t)TIFFReadFile(tif, o, 16);
  ------------------
  |  |  283|  1.29k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2218|  1.29k|            if (p != 16)
  ------------------
  |  Branch (2218:17): [True: 28, False: 1.26k]
  ------------------
 2219|     28|                return (0);
 2220|  1.26k|            q = 0;
 2221|  21.5k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2221:25): [True: 20.2k, False: 1.26k]
  ------------------
 2222|  20.2k|                q += o[n];
 2223|  1.26k|            ra = (uint32_t)(sizeof(uint32_t) + 21 + q);
 2224|  1.26k|            rb = (uint8_t *)_TIFFmallocExt(tif, ra);
 2225|  1.26k|            if (rb == 0)
  ------------------
  |  Branch (2225:17): [True: 0, False: 1.26k]
  ------------------
 2226|      0|            {
 2227|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 2228|      0|                return (0);
 2229|      0|            }
 2230|  1.26k|            *(uint32_t *)rb = ra;
 2231|  1.26k|            rb[sizeof(uint32_t)] = 255;
 2232|  1.26k|            rb[sizeof(uint32_t) + 1] = JPEG_MARKER_DHT;
  ------------------
  |  |  161|  1.26k|#define JPEG_MARKER_DHT 0xC4
  ------------------
 2233|  1.26k|            rb[sizeof(uint32_t) + 2] = (uint8_t)((19 + q) >> 8);
 2234|  1.26k|            rb[sizeof(uint32_t) + 3] = ((19 + q) & 255);
 2235|  1.26k|            rb[sizeof(uint32_t) + 4] = (16 | m);
 2236|  21.5k|            for (n = 0; n < 16; n++)
  ------------------
  |  Branch (2236:25): [True: 20.2k, False: 1.26k]
  ------------------
 2237|  20.2k|                rb[sizeof(uint32_t) + 5 + n] = o[n];
 2238|  1.26k|            p = (uint32_t)TIFFReadFile(tif, &(rb[sizeof(uint32_t) + 21]), q);
  ------------------
  |  |  283|  1.26k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
 2239|  1.26k|            if (p != q)
  ------------------
  |  Branch (2239:17): [True: 7, False: 1.25k]
  ------------------
 2240|      7|            {
 2241|      7|                _TIFFfreeExt(tif, rb);
 2242|      7|                return (0);
 2243|      7|            }
 2244|  1.25k|            if (sp->actable[m] != 0)
  ------------------
  |  Branch (2244:17): [True: 3, False: 1.25k]
  ------------------
 2245|      3|                _TIFFfreeExt(tif, sp->actable[m]);
 2246|  1.25k|            sp->actable[m] = rb;
 2247|  1.25k|            sp->sos_tda[m] = (sp->sos_tda[m] | m);
 2248|  1.25k|        }
 2249|    773|        else
 2250|    773|            sp->sos_tda[m] = (sp->sos_tda[m] | (sp->sos_tda[m - 1] & 15));
 2251|  2.06k|    }
 2252|    672|    return (1);
 2253|    708|}
tif_ojpeg.c:OJPEGVSetField:
  560|  12.5k|{
  561|  12.5k|    static const char module[] = "OJPEGVSetField";
  562|  12.5k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  563|  12.5k|    uint32_t ma;
  564|  12.5k|    uint64_t *mb;
  565|  12.5k|    uint32_t n;
  566|  12.5k|    const TIFFField *fip;
  567|       |
  568|  12.5k|    switch (tag)
  569|  12.5k|    {
  570|    280|        case TIFFTAG_JPEGIFOFFSET:
  ------------------
  |  |  379|    280|#define TIFFTAG_JPEGIFOFFSET 513           /* !pointer to SOI marker */
  ------------------
  |  Branch (570:9): [True: 280, False: 12.3k]
  ------------------
  571|    280|            sp->jpeg_interchange_format = (uint64_t)va_arg(ap, uint64_t);
  572|    280|            break;
  573|      7|        case TIFFTAG_JPEGIFBYTECOUNT:
  ------------------
  |  |  380|      7|#define TIFFTAG_JPEGIFBYTECOUNT 514        /* !JFIF stream length */
  ------------------
  |  Branch (573:9): [True: 7, False: 12.5k]
  ------------------
  574|      7|            sp->jpeg_interchange_format_length = (uint64_t)va_arg(ap, uint64_t);
  575|      7|            break;
  576|    691|        case TIFFTAG_YCBCRSUBSAMPLING:
  ------------------
  |  |  388|    691|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  |  Branch (576:9): [True: 691, False: 11.9k]
  ------------------
  577|    691|            sp->subsampling_tag = 1;
  578|    691|            sp->subsampling_hor = (uint8_t)va_arg(ap, uint16_vap);
  579|    691|            sp->subsampling_ver = (uint8_t)va_arg(ap, uint16_vap);
  580|    691|            tif->tif_dir.td_ycbcrsubsampling[0] = sp->subsampling_hor;
  581|    691|            tif->tif_dir.td_ycbcrsubsampling[1] = sp->subsampling_ver;
  582|    691|            break;
  583|    853|        case TIFFTAG_JPEGQTABLES:
  ------------------
  |  |  384|    853|#define TIFFTAG_JPEGQTABLES 519            /* !Q matrix offsets */
  ------------------
  |  Branch (583:9): [True: 853, False: 11.7k]
  ------------------
  584|    853|            ma = (uint32_t)va_arg(ap, uint32_t);
  585|    853|            if (ma != 0)
  ------------------
  |  Branch (585:17): [True: 853, False: 0]
  ------------------
  586|    853|            {
  587|    853|                if (ma > 3)
  ------------------
  |  Branch (587:21): [True: 2, False: 851]
  ------------------
  588|      2|                {
  589|      2|                    TIFFErrorExtR(tif, module,
  590|      2|                                  "JpegQTables tag has incorrect count");
  591|      2|                    return (0);
  592|      2|                }
  593|    851|                sp->qtable_offset_count = (uint8_t)ma;
  594|    851|                mb = (uint64_t *)va_arg(ap, uint64_t *);
  595|  2.03k|                for (n = 0; n < ma; n++)
  ------------------
  |  Branch (595:29): [True: 1.18k, False: 851]
  ------------------
  596|  1.18k|                    sp->qtable_offset[n] = mb[n];
  597|    851|            }
  598|    851|            break;
  599|    851|        case TIFFTAG_JPEGDCTABLES:
  ------------------
  |  |  385|    799|#define TIFFTAG_JPEGDCTABLES 520           /* !DCT table offsets */
  ------------------
  |  Branch (599:9): [True: 799, False: 11.7k]
  ------------------
  600|    799|            ma = (uint32_t)va_arg(ap, uint32_t);
  601|    799|            if (ma != 0)
  ------------------
  |  Branch (601:17): [True: 798, False: 1]
  ------------------
  602|    798|            {
  603|    798|                if (ma > 3)
  ------------------
  |  Branch (603:21): [True: 1, False: 797]
  ------------------
  604|      1|                {
  605|      1|                    TIFFErrorExtR(tif, module,
  606|      1|                                  "JpegDcTables tag has incorrect count");
  607|      1|                    return (0);
  608|      1|                }
  609|    797|                sp->dctable_offset_count = (uint8_t)ma;
  610|    797|                mb = (uint64_t *)va_arg(ap, uint64_t *);
  611|  2.37k|                for (n = 0; n < ma; n++)
  ------------------
  |  Branch (611:29): [True: 1.58k, False: 797]
  ------------------
  612|  1.58k|                    sp->dctable_offset[n] = mb[n];
  613|    797|            }
  614|    798|            break;
  615|    798|        case TIFFTAG_JPEGACTABLES:
  ------------------
  |  |  386|    778|#define TIFFTAG_JPEGACTABLES 521           /* !AC coefficient offsets */
  ------------------
  |  Branch (615:9): [True: 778, False: 11.8k]
  ------------------
  616|    778|            ma = (uint32_t)va_arg(ap, uint32_t);
  617|    778|            if (ma != 0)
  ------------------
  |  Branch (617:17): [True: 774, False: 4]
  ------------------
  618|    774|            {
  619|    774|                if (ma > 3)
  ------------------
  |  Branch (619:21): [True: 4, False: 770]
  ------------------
  620|      4|                {
  621|      4|                    TIFFErrorExtR(tif, module,
  622|      4|                                  "JpegAcTables tag has incorrect count");
  623|      4|                    return (0);
  624|      4|                }
  625|    770|                sp->actable_offset_count = (uint8_t)ma;
  626|    770|                mb = (uint64_t *)va_arg(ap, uint64_t *);
  627|  3.07k|                for (n = 0; n < ma; n++)
  ------------------
  |  Branch (627:29): [True: 2.30k, False: 770]
  ------------------
  628|  2.30k|                    sp->actable_offset[n] = mb[n];
  629|    770|            }
  630|    774|            break;
  631|    774|        case TIFFTAG_JPEGPROC:
  ------------------
  |  |  376|      1|#define TIFFTAG_JPEGPROC 512               /* !JPEG processing algorithm */
  ------------------
  |  Branch (631:9): [True: 1, False: 12.5k]
  ------------------
  632|      1|            sp->jpeg_proc = (uint8_t)va_arg(ap, uint16_vap);
  633|      1|            break;
  634|     15|        case TIFFTAG_JPEGRESTARTINTERVAL:
  ------------------
  |  |  381|     15|#define TIFFTAG_JPEGRESTARTINTERVAL 515    /* !restart interval length */
  ------------------
  |  Branch (634:9): [True: 15, False: 12.5k]
  ------------------
  635|     15|            sp->restart_interval = (uint16_t)va_arg(ap, uint16_vap);
  636|     15|            break;
  637|  9.17k|        default:
  ------------------
  |  Branch (637:9): [True: 9.17k, False: 3.42k]
  ------------------
  638|  9.17k|            return (*sp->vsetparent)(tif, tag, ap);
  639|  12.5k|    }
  640|  3.41k|    fip = TIFFFieldWithTag(tif, tag);
  641|  3.41k|    if (fip == NULL) /* shouldn't happen */
  ------------------
  |  Branch (641:9): [True: 0, False: 3.41k]
  ------------------
  642|      0|        return (0);
  643|  3.41k|    TIFFSetFieldBit(tif, fip->field_bit);
  ------------------
  |  |  249|  3.41k|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|  3.41k|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|  3.41k|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
  644|  3.41k|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|  3.41k|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
  645|  3.41k|    return (1);
  646|  3.41k|}
tif_ojpeg.c:OJPEGFixupTags:
  691|    980|{
  692|    980|    (void)tif;
  693|    980|    return (1);
  694|    980|}
tif_ojpeg.c:OJPEGSetupDecode:
  697|    900|{
  698|    900|    static const char module[] = "OJPEGSetupDecode";
  699|    900|    TIFFWarningExtR(tif, module,
  700|    900|                    "Deprecated and troublesome old-style JPEG compression "
  701|    900|                    "mode, please convert to new-style JPEG compression and "
  702|    900|                    "notify vendor of writing software");
  703|    900|    return (1);
  704|    900|}
tif_ojpeg.c:OJPEGPreDecode:
  707|   616k|{
  708|   616k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  709|   616k|    uint32_t m;
  710|   616k|    if (sp->subsamplingcorrect_done == 0)
  ------------------
  |  Branch (710:9): [True: 22, False: 616k]
  ------------------
  711|     22|        OJPEGSubsamplingCorrect(tif);
  712|   616k|    if (sp->readheader_done == 0)
  ------------------
  |  Branch (712:9): [True: 961, False: 615k]
  ------------------
  713|    961|    {
  714|    961|        if (OJPEGReadHeaderInfo(tif) == 0)
  ------------------
  |  Branch (714:13): [True: 242, False: 719]
  ------------------
  715|    242|            return (0);
  716|    961|    }
  717|   616k|    if (sp->sos_end[s].log == 0)
  ------------------
  |  Branch (717:9): [True: 379k, False: 237k]
  ------------------
  718|   379k|    {
  719|   379k|        if (OJPEGReadSecondarySos(tif, s) == 0)
  ------------------
  |  Branch (719:13): [True: 378k, False: 489]
  ------------------
  720|   378k|            return (0);
  721|   379k|    }
  722|   237k|    if (isTiled(tif))
  ------------------
  |  |  278|   237k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|   237k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 232k, False: 5.01k]
  |  |  ------------------
  ------------------
  723|   232k|        m = tif->tif_dir.td_curtile;
  724|  5.01k|    else
  725|  5.01k|        m = tif->tif_dir.td_curstrip;
  726|   237k|    if ((sp->writeheader_done != 0) &&
  ------------------
  |  Branch (726:9): [True: 229k, False: 8.26k]
  ------------------
  727|   229k|        ((sp->write_cursample != s) || (sp->write_curstrile > m)))
  ------------------
  |  Branch (727:10): [True: 33.0k, False: 196k]
  |  Branch (727:40): [True: 1.26k, False: 194k]
  ------------------
  728|  34.3k|    {
  729|  34.3k|        if (sp->libjpeg_session_active != 0)
  ------------------
  |  Branch (729:13): [True: 34.3k, False: 0]
  ------------------
  730|  34.3k|            OJPEGLibjpegSessionAbort(tif);
  731|  34.3k|        sp->writeheader_done = 0;
  732|  34.3k|    }
  733|   237k|    if (sp->writeheader_done == 0)
  ------------------
  |  Branch (733:9): [True: 42.6k, False: 194k]
  ------------------
  734|  42.6k|    {
  735|  42.6k|        sp->plane_sample_offset = (uint8_t)s;
  736|  42.6k|        sp->write_cursample = s;
  737|  42.6k|        sp->write_curstrile = s * tif->tif_dir.td_stripsperimage;
  738|  42.6k|        if ((sp->in_buffer_file_pos_log == 0) ||
  ------------------
  |  Branch (738:13): [True: 21.2k, False: 21.3k]
  ------------------
  739|  21.3k|            (sp->in_buffer_file_pos - sp->in_buffer_togo !=
  ------------------
  |  Branch (739:13): [True: 19.0k, False: 2.30k]
  ------------------
  740|  21.3k|             sp->sos_end[s].in_buffer_file_pos))
  741|  40.3k|        {
  742|  40.3k|            sp->in_buffer_source = sp->sos_end[s].in_buffer_source;
  743|  40.3k|            sp->in_buffer_next_strile = sp->sos_end[s].in_buffer_next_strile;
  744|  40.3k|            sp->in_buffer_file_pos = sp->sos_end[s].in_buffer_file_pos;
  745|  40.3k|            sp->in_buffer_file_pos_log = 0;
  746|  40.3k|            sp->in_buffer_file_togo = sp->sos_end[s].in_buffer_file_togo;
  747|  40.3k|            sp->in_buffer_togo = 0;
  748|  40.3k|            sp->in_buffer_cur = 0;
  749|  40.3k|        }
  750|  42.6k|        if (OJPEGWriteHeaderInfo(tif) == 0)
  ------------------
  |  Branch (750:13): [True: 7.30k, False: 35.3k]
  ------------------
  751|  7.30k|            return (0);
  752|  42.6k|    }
  753|       |
  754|   230k|    sp->subsampling_convert_state = 0;
  755|       |
  756|  4.65M|    while (sp->write_curstrile < m)
  ------------------
  |  Branch (756:12): [True: 4.42M, False: 225k]
  ------------------
  757|  4.42M|    {
  758|  4.42M|        if (sp->libjpeg_jpeg_query_style == 0)
  ------------------
  |  Branch (758:13): [True: 241k, False: 4.18M]
  ------------------
  759|   241k|        {
  760|   241k|            if (OJPEGPreDecodeSkipRaw(tif) == 0)
  ------------------
  |  Branch (760:17): [True: 852, False: 241k]
  ------------------
  761|    852|                return (0);
  762|   241k|        }
  763|  4.18M|        else
  764|  4.18M|        {
  765|  4.18M|            if (OJPEGPreDecodeSkipScanlines(tif) == 0)
  ------------------
  |  Branch (765:17): [True: 4.28k, False: 4.17M]
  ------------------
  766|  4.28k|                return (0);
  767|  4.18M|        }
  768|  4.42M|        sp->write_curstrile++;
  769|  4.42M|    }
  770|   225k|    sp->decoder_ok = 1;
  771|   225k|    return (1);
  772|   230k|}
tif_ojpeg.c:OJPEGReadHeaderInfo:
 1167|    961|{
 1168|    961|    static const char module[] = "OJPEGReadHeaderInfo";
 1169|    961|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1170|    961|    assert(sp->readheader_done == 0);
  ------------------
  |  Branch (1170:5): [True: 0, False: 961]
  |  Branch (1170:5): [True: 961, False: 0]
  ------------------
 1171|    961|    sp->image_width = tif->tif_dir.td_imagewidth;
 1172|    961|    sp->image_length = tif->tif_dir.td_imagelength;
 1173|    961|    if (isTiled(tif))
  ------------------
  |  |  278|    961|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    961|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 714, False: 247]
  |  |  ------------------
  ------------------
 1174|    714|    {
 1175|    714|        sp->strile_width = tif->tif_dir.td_tilewidth;
 1176|    714|        sp->strile_length = tif->tif_dir.td_tilelength;
 1177|    714|        sp->strile_length_total =
 1178|    714|            ((sp->image_length + sp->strile_length - 1) / sp->strile_length) *
 1179|    714|            sp->strile_length;
 1180|    714|    }
 1181|    247|    else
 1182|    247|    {
 1183|    247|        sp->strile_width = sp->image_width;
 1184|    247|        sp->strile_length = tif->tif_dir.td_rowsperstrip;
 1185|    247|        if (sp->strile_length == (uint32_t)-1)
  ------------------
  |  Branch (1185:13): [True: 0, False: 247]
  ------------------
 1186|      0|            sp->strile_length = sp->image_length;
 1187|    247|        sp->strile_length_total = sp->image_length;
 1188|    247|    }
 1189|    961|    if (tif->tif_dir.td_samplesperpixel == 1)
  ------------------
  |  Branch (1189:9): [True: 43, False: 918]
  ------------------
 1190|     43|    {
 1191|     43|        sp->samples_per_pixel = 1;
 1192|     43|        sp->plane_sample_offset = 0;
 1193|     43|        sp->samples_per_pixel_per_plane = sp->samples_per_pixel;
 1194|     43|        sp->subsampling_hor = 1;
 1195|     43|        sp->subsampling_ver = 1;
 1196|     43|    }
 1197|    918|    else
 1198|    918|    {
 1199|    918|        if (tif->tif_dir.td_samplesperpixel != 3)
  ------------------
  |  Branch (1199:13): [True: 7, False: 911]
  ------------------
 1200|      7|        {
 1201|      7|            TIFFErrorExtR(tif, module,
 1202|      7|                          "SamplesPerPixel %" PRIu8
 1203|      7|                          " not supported for this compression scheme",
 1204|      7|                          sp->samples_per_pixel);
 1205|      7|            return (0);
 1206|      7|        }
 1207|    911|        sp->samples_per_pixel = 3;
 1208|    911|        sp->plane_sample_offset = 0;
 1209|    911|        if (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|    911|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (1209:13): [True: 267, False: 644]
  ------------------
 1210|    267|            sp->samples_per_pixel_per_plane = 3;
 1211|    644|        else
 1212|    644|            sp->samples_per_pixel_per_plane = 1;
 1213|    911|    }
 1214|    954|    if (sp->strile_length < sp->image_length)
  ------------------
  |  Branch (1214:9): [True: 202, False: 752]
  ------------------
 1215|    202|    {
 1216|    202|        if (((sp->subsampling_hor != 1) && (sp->subsampling_hor != 2) &&
  ------------------
  |  Branch (1216:14): [True: 66, False: 136]
  |  Branch (1216:44): [True: 8, False: 58]
  ------------------
 1217|      8|             (sp->subsampling_hor != 4)) ||
  ------------------
  |  Branch (1217:14): [True: 3, False: 5]
  ------------------
 1218|    199|            ((sp->subsampling_ver != 1) && (sp->subsampling_ver != 2) &&
  ------------------
  |  Branch (1218:14): [True: 69, False: 130]
  |  Branch (1218:44): [True: 9, False: 60]
  ------------------
 1219|      9|             (sp->subsampling_ver != 4)))
  ------------------
  |  Branch (1219:14): [True: 3, False: 6]
  ------------------
 1220|      6|        {
 1221|      6|            TIFFErrorExtR(tif, module, "Invalid subsampling values");
 1222|      6|            return (0);
 1223|      6|        }
 1224|    196|        if (sp->strile_length % ((uint32_t)sp->subsampling_ver * 8) != 0)
  ------------------
  |  Branch (1224:13): [True: 18, False: 178]
  ------------------
 1225|     18|        {
 1226|     18|            TIFFErrorExtR(tif, module,
 1227|     18|                          "Incompatible vertical subsampling and image "
 1228|     18|                          "strip/tile length");
 1229|     18|            return (0);
 1230|     18|        }
 1231|    178|        {
 1232|       |            /* Values were validated above as 1, 2, or 4. */
 1233|    178|            uint32_t mcu_width = (uint32_t)sp->subsampling_hor * 8;
 1234|    178|            uint32_t mcu_height = (uint32_t)sp->subsampling_ver * 8;
 1235|    178|            uint32_t mcu_cols =
 1236|    178|                TIFFhowmany_32_maxuint_compat(sp->strile_width, mcu_width);
  ------------------
  |  |  318|    178|    (((uint32_t)(x) / (uint32_t)(y)) +                                         \
  |  |  319|    178|     ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
  |  |  ------------------
  |  |  |  Branch (319:7): [True: 127, False: 51]
  |  |  ------------------
  ------------------
 1237|    178|            uint32_t mcu_rows = sp->strile_length / mcu_height;
 1238|    178|            if (mcu_cols == 0 || mcu_rows == 0)
  ------------------
  |  Branch (1238:17): [True: 0, False: 178]
  |  Branch (1238:34): [True: 0, False: 178]
  ------------------
 1239|      0|            {
 1240|      0|                sp->restart_interval = 0;
 1241|      0|            }
 1242|    178|            else
 1243|    178|            {
 1244|    178|                uint32_t restart_interval =
 1245|    178|                    _TIFFMultiply32(tif, mcu_cols, mcu_rows, module);
 1246|    178|                if (restart_interval == 0 || restart_interval > UINT16_MAX)
  ------------------
  |  Branch (1246:21): [True: 0, False: 178]
  |  Branch (1246:46): [True: 2, False: 176]
  ------------------
 1247|      2|                {
 1248|      2|                    TIFFErrorExtR(tif, module,
 1249|      2|                                  "Integer overflow in restart interval");
 1250|      2|                    return (0);
 1251|      2|                }
 1252|    176|                sp->restart_interval = (uint16_t)restart_interval;
 1253|    176|            }
 1254|    178|        }
 1255|    178|    }
 1256|    928|    if (OJPEGReadHeaderInfoSec(tif) == 0)
  ------------------
  |  Branch (1256:9): [True: 209, False: 719]
  ------------------
 1257|    209|        return (0);
 1258|    719|    sp->sos_end[0].log = 1;
 1259|    719|    sp->sos_end[0].in_buffer_source = sp->in_buffer_source;
 1260|    719|    sp->sos_end[0].in_buffer_next_strile = sp->in_buffer_next_strile;
 1261|    719|    sp->sos_end[0].in_buffer_file_pos =
 1262|    719|        sp->in_buffer_file_pos - sp->in_buffer_togo;
 1263|    719|    sp->sos_end[0].in_buffer_file_togo =
 1264|    719|        sp->in_buffer_file_togo + sp->in_buffer_togo;
 1265|    719|    sp->readheader_done = 1;
 1266|    719|    return (1);
 1267|    928|}
tif_ojpeg.c:OJPEGReadSecondarySos:
 1270|   379k|{
 1271|   379k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1272|   379k|    uint8_t m;
 1273|   379k|    assert(s > 0);
  ------------------
  |  Branch (1273:5): [True: 0, False: 379k]
  |  Branch (1273:5): [True: 379k, False: 0]
  ------------------
 1274|   379k|    assert(s < 3);
  ------------------
  |  Branch (1274:5): [True: 0, False: 379k]
  |  Branch (1274:5): [True: 379k, False: 0]
  ------------------
 1275|   379k|    assert(sp->sos_end[0].log != 0);
  ------------------
  |  Branch (1275:5): [True: 0, False: 379k]
  |  Branch (1275:5): [True: 379k, False: 0]
  ------------------
 1276|   379k|    assert(sp->sos_end[s].log == 0);
  ------------------
  |  Branch (1276:5): [True: 0, False: 379k]
  |  Branch (1276:5): [True: 379k, False: 0]
  ------------------
 1277|   379k|    sp->plane_sample_offset = (uint8_t)(s - 1);
 1278|   560k|    while (sp->sos_end[sp->plane_sample_offset].log == 0)
  ------------------
  |  Branch (1278:12): [True: 181k, False: 379k]
  ------------------
 1279|   181k|        sp->plane_sample_offset--;
 1280|   379k|    sp->in_buffer_source =
 1281|   379k|        sp->sos_end[sp->plane_sample_offset].in_buffer_source;
 1282|   379k|    sp->in_buffer_next_strile =
 1283|   379k|        sp->sos_end[sp->plane_sample_offset].in_buffer_next_strile;
 1284|   379k|    sp->in_buffer_file_pos =
 1285|   379k|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_pos;
 1286|   379k|    sp->in_buffer_file_pos_log = 0;
 1287|   379k|    sp->in_buffer_file_togo =
 1288|   379k|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_togo;
 1289|   379k|    sp->in_buffer_togo = 0;
 1290|   379k|    sp->in_buffer_cur = 0;
 1291|   379k|    while (sp->plane_sample_offset < s)
  ------------------
  |  Branch (1291:12): [True: 379k, False: 489]
  ------------------
 1292|   379k|    {
 1293|   379k|        do
 1294|   158M|        {
 1295|   158M|            if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (1295:17): [True: 366k, False: 157M]
  ------------------
 1296|   366k|                return (0);
 1297|   157M|            if (m == 255)
  ------------------
  |  Branch (1297:17): [True: 5.63M, False: 152M]
  ------------------
 1298|  5.63M|            {
 1299|  5.63M|                do
 1300|  9.02M|                {
 1301|  9.02M|                    if (OJPEGReadByte(sp, &m) == 0)
  ------------------
  |  Branch (1301:25): [True: 3.90k, False: 9.02M]
  ------------------
 1302|  3.90k|                        return (0);
 1303|  9.02M|                    if (m != 255)
  ------------------
  |  Branch (1303:25): [True: 5.63M, False: 3.39M]
  ------------------
 1304|  5.63M|                        break;
 1305|  9.02M|                } while (1);
  ------------------
  |  Branch (1305:26): [True: 3.39M, Folded]
  ------------------
 1306|  5.63M|                if (m == JPEG_MARKER_SOS)
  ------------------
  |  |  165|  5.63M|#define JPEG_MARKER_SOS 0xDA
  ------------------
  |  Branch (1306:21): [True: 8.78k, False: 5.62M]
  ------------------
 1307|  8.78k|                    break;
 1308|  5.63M|            }
 1309|   157M|        } while (1);
  ------------------
  |  Branch (1309:18): [True: 157M, Folded]
  ------------------
 1310|  8.78k|        sp->plane_sample_offset++;
 1311|  8.78k|        if (OJPEGReadHeaderInfoSecStreamSos(tif) == 0)
  ------------------
  |  Branch (1311:13): [True: 8.29k, False: 489]
  ------------------
 1312|  8.29k|            return (0);
 1313|    489|        sp->sos_end[sp->plane_sample_offset].log = 1;
 1314|    489|        sp->sos_end[sp->plane_sample_offset].in_buffer_source =
 1315|    489|            sp->in_buffer_source;
 1316|    489|        sp->sos_end[sp->plane_sample_offset].in_buffer_next_strile =
 1317|    489|            sp->in_buffer_next_strile;
 1318|    489|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_pos =
 1319|    489|            sp->in_buffer_file_pos - sp->in_buffer_togo;
 1320|    489|        sp->sos_end[sp->plane_sample_offset].in_buffer_file_togo =
 1321|    489|            sp->in_buffer_file_togo + sp->in_buffer_togo;
 1322|    489|    }
 1323|    489|    return (1);
 1324|   379k|}
tif_ojpeg.c:OJPEGLibjpegSessionAbort:
 1527|  35.4k|{
 1528|  35.4k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1529|  35.4k|    assert(sp->libjpeg_session_active != 0);
  ------------------
  |  Branch (1529:5): [True: 0, False: 35.4k]
  |  Branch (1529:5): [True: 35.4k, False: 0]
  ------------------
 1530|  35.4k|    jpeg_destroy(
 1531|  35.4k|        (tiff_ojpeg_common_struct *)(&(sp->libjpeg_jpeg_decompress_struct)));
 1532|  35.4k|    sp->libjpeg_session_active = 0;
 1533|  35.4k|}
tif_ojpeg.c:OJPEGWriteHeaderInfo:
 1327|  42.6k|{
 1328|  42.6k|    static const char module[] = "OJPEGWriteHeaderInfo";
 1329|  42.6k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1330|  42.6k|    uint8_t **m;
 1331|  42.6k|    uint32_t n;
 1332|       |    /* if a previous attempt failed, don't try again */
 1333|  42.6k|    if (sp->libjpeg_session_active != 0)
  ------------------
  |  Branch (1333:9): [True: 7.16k, False: 35.4k]
  ------------------
 1334|  7.16k|        return 0;
 1335|  35.4k|    sp->out_state = ososSoi;
 1336|  35.4k|    sp->restart_index = 0;
 1337|  35.4k|    jpeg_std_error(&(sp->libjpeg_jpeg_error_mgr));
 1338|  35.4k|    sp->libjpeg_jpeg_error_mgr.output_message =
 1339|  35.4k|        OJPEGLibjpegJpegErrorMgrOutputMessage;
 1340|  35.4k|    sp->libjpeg_jpeg_error_mgr.error_exit = OJPEGLibjpegJpegErrorMgrErrorExit;
 1341|  35.4k|    sp->libjpeg_jpeg_decompress_struct.err = &(sp->libjpeg_jpeg_error_mgr);
 1342|  35.4k|    sp->libjpeg_jpeg_decompress_struct.client_data = (void *)tif;
 1343|  35.4k|    if (jpeg_create_decompress_encap(
  ------------------
  |  Branch (1343:9): [True: 0, False: 35.4k]
  ------------------
 1344|  35.4k|            sp, &(sp->libjpeg_jpeg_decompress_struct)) == 0)
 1345|      0|        return (0);
 1346|  35.4k|    sp->libjpeg_session_active = 1;
 1347|  35.4k|    sp->libjpeg_jpeg_source_mgr.bytes_in_buffer = 0;
 1348|  35.4k|    sp->libjpeg_jpeg_source_mgr.init_source =
 1349|  35.4k|        OJPEGLibjpegJpegSourceMgrInitSource;
 1350|  35.4k|    sp->libjpeg_jpeg_source_mgr.fill_input_buffer =
 1351|  35.4k|        OJPEGLibjpegJpegSourceMgrFillInputBuffer;
 1352|  35.4k|    sp->libjpeg_jpeg_source_mgr.skip_input_data =
 1353|  35.4k|        OJPEGLibjpegJpegSourceMgrSkipInputData;
 1354|  35.4k|    sp->libjpeg_jpeg_source_mgr.resync_to_restart =
 1355|  35.4k|        OJPEGLibjpegJpegSourceMgrResyncToRestart;
 1356|  35.4k|    sp->libjpeg_jpeg_source_mgr.term_source =
 1357|  35.4k|        OJPEGLibjpegJpegSourceMgrTermSource;
 1358|  35.4k|    sp->libjpeg_jpeg_decompress_struct.src = &(sp->libjpeg_jpeg_source_mgr);
 1359|  35.4k|    if (jpeg_read_header_encap(sp, &(sp->libjpeg_jpeg_decompress_struct), 1) ==
  ------------------
  |  Branch (1359:9): [True: 77, False: 35.3k]
  ------------------
 1360|  35.4k|        0)
 1361|     77|        return (0);
 1362|  35.3k|    if ((sp->subsampling_force_desubsampling_inside_decompression == 0) &&
  ------------------
  |  Branch (1362:9): [True: 34.6k, False: 676]
  ------------------
 1363|  34.6k|        (sp->samples_per_pixel_per_plane > 1))
  ------------------
  |  Branch (1363:9): [True: 951, False: 33.7k]
  ------------------
 1364|    951|    {
 1365|    951|        sp->libjpeg_jpeg_decompress_struct.raw_data_out = 1;
 1366|       |#if JPEG_LIB_VERSION >= 70
 1367|       |        sp->libjpeg_jpeg_decompress_struct.do_fancy_upsampling = FALSE;
 1368|       |#endif
 1369|    951|        sp->libjpeg_jpeg_query_style = 0;
 1370|    951|        if (sp->subsampling_convert_log == 0)
  ------------------
  |  Branch (1370:13): [True: 100, False: 851]
  ------------------
 1371|    100|        {
 1372|    100|            assert(sp->subsampling_convert_ycbcrbuf == 0);
  ------------------
  |  Branch (1372:13): [True: 0, False: 100]
  |  Branch (1372:13): [True: 100, False: 0]
  ------------------
 1373|    100|            assert(sp->subsampling_convert_ycbcrimage == 0);
  ------------------
  |  Branch (1373:13): [True: 0, False: 100]
  |  Branch (1373:13): [True: 100, False: 0]
  ------------------
 1374|       |            /* Check for division by zero. */
 1375|    100|            if (sp->subsampling_hor == 0 || sp->subsampling_ver == 0)
  ------------------
  |  Branch (1375:17): [True: 0, False: 100]
  |  Branch (1375:45): [True: 0, False: 100]
  ------------------
 1376|      0|                return (0);
 1377|       |            /* Check for potential overflow in subsampling_convert_ylinelen
 1378|       |             * computation.
 1379|       |             */
 1380|    100|            if (sp->strile_width >
  ------------------
  |  Branch (1380:17): [True: 0, False: 100]
  ------------------
 1381|    100|                UINT32_MAX - ((uint32_t)sp->subsampling_hor * 8 - 1))
 1382|      0|                return (0);
 1383|    100|            sp->subsampling_convert_ylinelen =
 1384|    100|                ((sp->strile_width + (uint32_t)sp->subsampling_hor * 8 - 1) /
 1385|    100|                 ((uint32_t)sp->subsampling_hor * 8) *
 1386|    100|                 ((uint32_t)sp->subsampling_hor * 8));
 1387|    100|            sp->subsampling_convert_ylines = (uint32_t)sp->subsampling_ver * 8;
 1388|    100|            sp->subsampling_convert_clinelen =
 1389|    100|                sp->subsampling_convert_ylinelen / sp->subsampling_hor;
 1390|    100|            sp->subsampling_convert_clines = 8;
 1391|       |            /* Check for potential overflow in buffer length computations.
 1392|       |             * Use 64-bit intermediates to detect uint32_t overflow in
 1393|       |             * ylinelen * ylines, clinelen * clines, and their sum.
 1394|       |             */
 1395|    100|            {
 1396|    100|                uint64_t ybuflen64 =
 1397|    100|                    (uint64_t)sp->subsampling_convert_ylinelen *
 1398|    100|                    sp->subsampling_convert_ylines;
 1399|    100|                uint64_t cbuflen64 =
 1400|    100|                    (uint64_t)sp->subsampling_convert_clinelen *
 1401|    100|                    sp->subsampling_convert_clines;
 1402|    100|                uint64_t ycbcrbuflen64 = ybuflen64 + 2 * cbuflen64;
 1403|    100|                if (ybuflen64 > UINT32_MAX || cbuflen64 > UINT32_MAX ||
  ------------------
  |  Branch (1403:21): [True: 0, False: 100]
  |  Branch (1403:47): [True: 0, False: 100]
  ------------------
 1404|    100|                    ycbcrbuflen64 > UINT32_MAX)
  ------------------
  |  Branch (1404:21): [True: 0, False: 100]
  ------------------
 1405|      0|                {
 1406|      0|                    TIFFErrorExtR(tif, module,
 1407|      0|                                  "Integer overflow in OJPEG buffer size");
 1408|      0|                    return (0);
 1409|      0|                }
 1410|    100|                sp->subsampling_convert_ybuflen = (uint32_t)ybuflen64;
 1411|    100|                sp->subsampling_convert_cbuflen = (uint32_t)cbuflen64;
 1412|    100|                sp->subsampling_convert_ycbcrbuflen = (uint32_t)ycbcrbuflen64;
 1413|    100|            }
 1414|       |            /* The calloc is not normally necessary, except in some edge/broken
 1415|       |             * cases */
 1416|       |            /* for example for a tiled image of height 1 with a tile height of 1
 1417|       |             * and subsampling_hor=subsampling_ver=2 */
 1418|       |            /* In that case, libjpeg will only fill the 8 first lines of the 16
 1419|       |             * lines */
 1420|       |            /* See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16844
 1421|       |             */
 1422|       |            /* Even if this case is allowed (?), its handling is broken because
 1423|       |             * OJPEGPreDecode() should also likely */
 1424|       |            /* reset subsampling_convert_state to 0 when changing tile. */
 1425|      0|            sp->subsampling_convert_ycbcrbuf = (uint8_t *)_TIFFcallocExt(
 1426|    100|                tif, 1, sp->subsampling_convert_ycbcrbuflen);
 1427|    100|            if (sp->subsampling_convert_ycbcrbuf == 0)
  ------------------
  |  Branch (1427:17): [True: 0, False: 100]
  ------------------
 1428|      0|            {
 1429|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 1430|      0|                return (0);
 1431|      0|            }
 1432|    100|            sp->subsampling_convert_ybuf = sp->subsampling_convert_ycbcrbuf;
 1433|    100|            sp->subsampling_convert_cbbuf =
 1434|    100|                sp->subsampling_convert_ybuf + sp->subsampling_convert_ybuflen;
 1435|    100|            sp->subsampling_convert_crbuf =
 1436|    100|                sp->subsampling_convert_cbbuf + sp->subsampling_convert_cbuflen;
 1437|    100|            sp->subsampling_convert_ycbcrimagelen =
 1438|    100|                3 + sp->subsampling_convert_ylines +
 1439|    100|                2 * sp->subsampling_convert_clines;
 1440|    100|            sp->subsampling_convert_ycbcrimage = (uint8_t **)_TIFFmallocExt(
 1441|    100|                tif, (tmsize_t)((size_t)sp->subsampling_convert_ycbcrimagelen *
 1442|    100|                                sizeof(uint8_t *)));
 1443|    100|            if (sp->subsampling_convert_ycbcrimage == 0)
  ------------------
  |  Branch (1443:17): [True: 0, False: 100]
  ------------------
 1444|      0|            {
 1445|      0|                TIFFErrorExtR(tif, module, "Out of memory");
 1446|      0|                return (0);
 1447|      0|            }
 1448|    100|            m = sp->subsampling_convert_ycbcrimage;
 1449|    100|            *m++ = (uint8_t *)(sp->subsampling_convert_ycbcrimage + 3);
 1450|    100|            *m++ = (uint8_t *)(sp->subsampling_convert_ycbcrimage + 3 +
 1451|    100|                               sp->subsampling_convert_ylines);
 1452|    100|            *m++ = (uint8_t *)(sp->subsampling_convert_ycbcrimage + 3 +
 1453|    100|                               sp->subsampling_convert_ylines +
 1454|    100|                               sp->subsampling_convert_clines);
 1455|  1.25k|            for (n = 0; n < sp->subsampling_convert_ylines; n++)
  ------------------
  |  Branch (1455:25): [True: 1.15k, False: 100]
  ------------------
 1456|  1.15k|                *m++ = sp->subsampling_convert_ybuf +
 1457|  1.15k|                       n * sp->subsampling_convert_ylinelen;
 1458|    900|            for (n = 0; n < sp->subsampling_convert_clines; n++)
  ------------------
  |  Branch (1458:25): [True: 800, False: 100]
  ------------------
 1459|    800|                *m++ = sp->subsampling_convert_cbbuf +
 1460|    800|                       n * sp->subsampling_convert_clinelen;
 1461|    900|            for (n = 0; n < sp->subsampling_convert_clines; n++)
  ------------------
  |  Branch (1461:25): [True: 800, False: 100]
  ------------------
 1462|    800|                *m++ = sp->subsampling_convert_crbuf +
 1463|    800|                       n * sp->subsampling_convert_clinelen;
 1464|    100|            sp->subsampling_convert_clinelenout =
 1465|    100|                sp->strile_width / sp->subsampling_hor +
 1466|    100|                ((sp->strile_width % sp->subsampling_hor) != 0 ? 1 : 0);
  ------------------
  |  Branch (1466:18): [True: 24, False: 76]
  ------------------
 1467|    100|            sp->subsampling_convert_state = 0;
 1468|    100|            sp->error_in_raw_data_decoding = 0;
 1469|       |
 1470|    100|            const uint64_t bpl =
 1471|    100|                (uint64_t)sp->subsampling_convert_clinelenout *
 1472|    100|                ((uint64_t)sp->subsampling_ver * sp->subsampling_hor + 2);
 1473|    100|            if (bpl > UINT32_MAX)
  ------------------
  |  Branch (1473:17): [True: 0, False: 100]
  ------------------
 1474|      0|                return (0);
 1475|    100|            sp->bytes_per_line = (uint32_t)bpl;
 1476|       |
 1477|    100|            sp->lines_per_strile =
 1478|    100|                sp->strile_length / sp->subsampling_ver +
 1479|    100|                ((sp->strile_length % sp->subsampling_ver) != 0 ? 1 : 0);
  ------------------
  |  Branch (1479:18): [True: 7, False: 93]
  ------------------
 1480|    100|            sp->subsampling_convert_log = 1;
 1481|    100|        }
 1482|    951|    }
 1483|  34.4k|    else
 1484|  34.4k|    {
 1485|  34.4k|        sp->libjpeg_jpeg_decompress_struct.jpeg_color_space = JCS_UNKNOWN;
 1486|  34.4k|        sp->libjpeg_jpeg_decompress_struct.out_color_space = JCS_UNKNOWN;
 1487|  34.4k|        sp->libjpeg_jpeg_query_style = 1;
 1488|  34.4k|        sp->bytes_per_line =
 1489|  34.4k|            _TIFFMultiply32(tif, sp->samples_per_pixel_per_plane,
 1490|  34.4k|                            sp->strile_width, "OJPEGWriteHeaderInfo");
 1491|  34.4k|        if (sp->bytes_per_line == 0)
  ------------------
  |  Branch (1491:13): [True: 0, False: 34.4k]
  ------------------
 1492|      0|            return (0);
 1493|  34.4k|        sp->lines_per_strile = sp->strile_length;
 1494|  34.4k|    }
 1495|  35.3k|    if (jpeg_start_decompress_encap(sp,
  ------------------
  |  Branch (1495:9): [True: 58, False: 35.3k]
  ------------------
 1496|  35.3k|                                    &(sp->libjpeg_jpeg_decompress_struct)) == 0)
 1497|     58|        return (0);
 1498|  35.3k|    if (sp->libjpeg_jpeg_decompress_struct.image_width != sp->strile_width)
  ------------------
  |  Branch (1498:9): [True: 1, False: 35.3k]
  ------------------
 1499|      1|    {
 1500|      1|        TIFFErrorExtR(tif, module,
 1501|      1|                      "jpeg_start_decompress() returned image_width = %u, "
 1502|      1|                      "expected %" PRIu32,
 1503|      1|                      sp->libjpeg_jpeg_decompress_struct.image_width,
 1504|      1|                      sp->strile_width);
 1505|      1|        return 0;
 1506|      1|    }
 1507|  35.3k|    if (sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor !=
  ------------------
  |  Branch (1507:9): [True: 1, False: 35.3k]
  ------------------
 1508|  35.3k|            sp->subsampling_hor ||
 1509|  35.3k|        sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor !=
  ------------------
  |  Branch (1509:9): [True: 1, False: 35.3k]
  ------------------
 1510|  35.3k|            sp->subsampling_ver)
 1511|      2|    {
 1512|      2|        TIFFErrorExtR(tif, module,
 1513|      2|                      "jpeg_start_decompress() returned max_h_samp_factor = %d "
 1514|      2|                      "and max_v_samp_factor = %d, expected %" PRIu8
 1515|      2|                      " and %" PRIu8,
 1516|      2|                      sp->libjpeg_jpeg_decompress_struct.max_h_samp_factor,
 1517|      2|                      sp->libjpeg_jpeg_decompress_struct.max_v_samp_factor,
 1518|      2|                      sp->subsampling_hor, sp->subsampling_ver);
 1519|      2|        return 0;
 1520|      2|    }
 1521|       |
 1522|  35.3k|    sp->writeheader_done = 1;
 1523|  35.3k|    return (1);
 1524|  35.3k|}
tif_ojpeg.c:OJPEGLibjpegJpegErrorMgrOutputMessage:
 2803|  34.2k|{
 2804|  34.2k|    char buffer[JMSG_LENGTH_MAX];
 2805|  34.2k|    (*cinfo->err->format_message)(cinfo, buffer);
 2806|  34.2k|    TIFFWarningExtR(((TIFF *)(cinfo->client_data)), "LibJpeg", "%s", buffer);
 2807|  34.2k|}
tif_ojpeg.c:OJPEGLibjpegJpegErrorMgrErrorExit:
 2810|    135|{
 2811|    135|    char buffer[JMSG_LENGTH_MAX];
 2812|    135|    (*cinfo->err->format_message)(cinfo, buffer);
 2813|    135|    TIFFErrorExtR(((TIFF *)(cinfo->client_data)), "LibJpeg", "%s", buffer);
 2814|    135|    jpeg_encap_unwind((TIFF *)(cinfo->client_data));
 2815|    135|}
tif_ojpeg.c:jpeg_encap_unwind:
 2795|  5.43k|{
 2796|  5.43k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2797|  5.43k|    LONGJMP(sp->exit_jmpbuf, 1);
  ------------------
  |  |  153|  5.43k|#define LONGJMP(jbuf, code) longjmp(jbuf, code)
  ------------------
 2798|  5.43k|}
tif_ojpeg.c:jpeg_create_decompress_encap:
 2723|  35.4k|{
 2724|  35.4k|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  35.4k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2724:9): [True: 0, False: 35.4k]
  ------------------
 2725|      0|        return 0;
 2726|  35.4k|    else
 2727|  35.4k|    {
 2728|       |        jpeg_create_decompress(cinfo);
 2729|  35.4k|        return 1;
 2730|  35.4k|    }
 2731|  35.4k|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrInitSource:
 2819|  35.4k|{
 2820|  35.4k|    (void)cinfo;
 2821|  35.4k|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrFillInputBuffer:
 2825|   331k|{
 2826|   331k|    TIFF *tif = (TIFF *)cinfo->client_data;
 2827|   331k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2828|   331k|    void *mem = 0;
 2829|   331k|    uint32_t len = 0U;
 2830|   331k|    if (OJPEGWriteStream(tif, &mem, &len) == 0)
  ------------------
  |  Branch (2830:9): [True: 3.88k, False: 327k]
  ------------------
 2831|  3.88k|    {
 2832|  3.88k|        TIFFErrorExtR(tif, "LibJpeg", "Premature end of JPEG data");
 2833|  3.88k|        jpeg_encap_unwind(tif);
 2834|  3.88k|    }
 2835|   331k|    sp->libjpeg_jpeg_source_mgr.bytes_in_buffer = len;
 2836|   331k|    sp->libjpeg_jpeg_source_mgr.next_input_byte = (const JOCTET *)mem;
 2837|   331k|    return (1);
 2838|   331k|}
tif_ojpeg.c:OJPEGWriteStream:
 2452|   331k|{
 2453|   331k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2454|   331k|    *len = 0;
 2455|   331k|    do
 2456|   613k|    {
 2457|   613k|        assert(sp->out_state <= ososEoi);
  ------------------
  |  Branch (2457:9): [True: 0, False: 613k]
  |  Branch (2457:9): [True: 613k, False: 0]
  ------------------
 2458|   613k|        switch (sp->out_state)
 2459|   613k|        {
 2460|  35.4k|            case ososSoi:
  ------------------
  |  Branch (2460:13): [True: 35.4k, False: 577k]
  ------------------
 2461|  35.4k|                OJPEGWriteStreamSoi(tif, mem, len);
 2462|  35.4k|                break;
 2463|  35.4k|            case ososQTable0:
  ------------------
  |  Branch (2463:13): [True: 35.4k, False: 577k]
  ------------------
 2464|  35.4k|                OJPEGWriteStreamQTable(tif, 0, mem, len);
 2465|  35.4k|                break;
 2466|  35.4k|            case ososQTable1:
  ------------------
  |  Branch (2466:13): [True: 35.4k, False: 577k]
  ------------------
 2467|  35.4k|                OJPEGWriteStreamQTable(tif, 1, mem, len);
 2468|  35.4k|                break;
 2469|  35.4k|            case ososQTable2:
  ------------------
  |  Branch (2469:13): [True: 35.4k, False: 577k]
  ------------------
 2470|  35.4k|                OJPEGWriteStreamQTable(tif, 2, mem, len);
 2471|  35.4k|                break;
 2472|  35.4k|            case ososQTable3:
  ------------------
  |  Branch (2472:13): [True: 35.4k, False: 577k]
  ------------------
 2473|  35.4k|                OJPEGWriteStreamQTable(tif, 3, mem, len);
 2474|  35.4k|                break;
 2475|  35.4k|            case ososDcTable0:
  ------------------
  |  Branch (2475:13): [True: 35.4k, False: 577k]
  ------------------
 2476|  35.4k|                OJPEGWriteStreamDcTable(tif, 0, mem, len);
 2477|  35.4k|                break;
 2478|  35.4k|            case ososDcTable1:
  ------------------
  |  Branch (2478:13): [True: 35.4k, False: 577k]
  ------------------
 2479|  35.4k|                OJPEGWriteStreamDcTable(tif, 1, mem, len);
 2480|  35.4k|                break;
 2481|  35.4k|            case ososDcTable2:
  ------------------
  |  Branch (2481:13): [True: 35.4k, False: 577k]
  ------------------
 2482|  35.4k|                OJPEGWriteStreamDcTable(tif, 2, mem, len);
 2483|  35.4k|                break;
 2484|  35.4k|            case ososDcTable3:
  ------------------
  |  Branch (2484:13): [True: 35.4k, False: 577k]
  ------------------
 2485|  35.4k|                OJPEGWriteStreamDcTable(tif, 3, mem, len);
 2486|  35.4k|                break;
 2487|  35.4k|            case ososAcTable0:
  ------------------
  |  Branch (2487:13): [True: 35.4k, False: 577k]
  ------------------
 2488|  35.4k|                OJPEGWriteStreamAcTable(tif, 0, mem, len);
 2489|  35.4k|                break;
 2490|  35.4k|            case ososAcTable1:
  ------------------
  |  Branch (2490:13): [True: 35.4k, False: 577k]
  ------------------
 2491|  35.4k|                OJPEGWriteStreamAcTable(tif, 1, mem, len);
 2492|  35.4k|                break;
 2493|  35.4k|            case ososAcTable2:
  ------------------
  |  Branch (2493:13): [True: 35.4k, False: 577k]
  ------------------
 2494|  35.4k|                OJPEGWriteStreamAcTable(tif, 2, mem, len);
 2495|  35.4k|                break;
 2496|  35.4k|            case ososAcTable3:
  ------------------
  |  Branch (2496:13): [True: 35.4k, False: 577k]
  ------------------
 2497|  35.4k|                OJPEGWriteStreamAcTable(tif, 3, mem, len);
 2498|  35.4k|                break;
 2499|  35.4k|            case ososDri:
  ------------------
  |  Branch (2499:13): [True: 35.4k, False: 577k]
  ------------------
 2500|  35.4k|                OJPEGWriteStreamDri(tif, mem, len);
 2501|  35.4k|                break;
 2502|  35.4k|            case ososSof:
  ------------------
  |  Branch (2502:13): [True: 35.4k, False: 577k]
  ------------------
 2503|  35.4k|                OJPEGWriteStreamSof(tif, mem, len);
 2504|  35.4k|                break;
 2505|  35.4k|            case ososSos:
  ------------------
  |  Branch (2505:13): [True: 35.4k, False: 577k]
  ------------------
 2506|  35.4k|                OJPEGWriteStreamSos(tif, mem, len);
 2507|  35.4k|                break;
 2508|  41.4k|            case ososCompressed:
  ------------------
  |  Branch (2508:13): [True: 41.4k, False: 571k]
  ------------------
 2509|  41.4k|                if (OJPEGWriteStreamCompressed(tif, mem, len) == 0)
  ------------------
  |  Branch (2509:21): [True: 3.88k, False: 37.5k]
  ------------------
 2510|  3.88k|                    return (0);
 2511|  37.5k|                break;
 2512|  37.5k|            case ososRst:
  ------------------
  |  Branch (2512:13): [True: 4.31k, False: 608k]
  ------------------
 2513|  4.31k|                OJPEGWriteStreamRst(tif, mem, len);
 2514|  4.31k|                break;
 2515|    187|            case ososEoi:
  ------------------
  |  Branch (2515:13): [True: 187, False: 612k]
  ------------------
 2516|    187|                OJPEGWriteStreamEoi(tif, mem, len);
 2517|    187|                break;
 2518|      0|            default:
  ------------------
  |  Branch (2518:13): [True: 0, False: 613k]
  ------------------
 2519|      0|                break;
 2520|   613k|        }
 2521|   613k|    } while (*len == 0);
  ------------------
  |  Branch (2521:14): [True: 281k, False: 327k]
  ------------------
 2522|   327k|    return (1);
 2523|   331k|}
tif_ojpeg.c:OJPEGWriteStreamSoi:
 2526|  35.4k|{
 2527|  35.4k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2528|  35.4k|    assert(OJPEG_BUFFER >= 2);
  ------------------
  |  Branch (2528:5): [True: 0, Folded]
  |  Branch (2528:5): [True: 35.4k, Folded]
  ------------------
 2529|  35.4k|    sp->out_buffer[0] = 255;
 2530|  35.4k|    sp->out_buffer[1] = JPEG_MARKER_SOI;
  ------------------
  |  |  163|  35.4k|#define JPEG_MARKER_SOI 0xD8
  ------------------
 2531|  35.4k|    *len = 2;
 2532|  35.4k|    *mem = (void *)sp->out_buffer;
 2533|  35.4k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2534|  35.4k|}
tif_ojpeg.c:OJPEGWriteStreamQTable:
 2538|   141k|{
 2539|   141k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2540|   141k|    if (sp->qtable[table_index] != 0)
  ------------------
  |  Branch (2540:9): [True: 37.9k, False: 103k]
  ------------------
 2541|  37.9k|    {
 2542|  37.9k|        *mem = (void *)(sp->qtable[table_index] + sizeof(uint32_t));
 2543|  37.9k|        *len = (uint32_t)(*((uint32_t *)sp->qtable[table_index]) -
 2544|  37.9k|                          sizeof(uint32_t));
 2545|  37.9k|    }
 2546|   141k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2547|   141k|}
tif_ojpeg.c:OJPEGWriteStreamDcTable:
 2551|   141k|{
 2552|   141k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2553|   141k|    if (sp->dctable[table_index] != 0)
  ------------------
  |  Branch (2553:9): [True: 64.2k, False: 77.5k]
  ------------------
 2554|  64.2k|    {
 2555|  64.2k|        *mem = (void *)(sp->dctable[table_index] + sizeof(uint32_t));
 2556|  64.2k|        *len = (uint32_t)(*((uint32_t *)sp->dctable[table_index]) -
 2557|  64.2k|                          sizeof(uint32_t));
 2558|  64.2k|    }
 2559|   141k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2560|   141k|}
tif_ojpeg.c:OJPEGWriteStreamAcTable:
 2564|   141k|{
 2565|   141k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2566|   141k|    if (sp->actable[table_index] != 0)
  ------------------
  |  Branch (2566:9): [True: 75.0k, False: 66.6k]
  ------------------
 2567|  75.0k|    {
 2568|  75.0k|        *mem = (void *)(sp->actable[table_index] + sizeof(uint32_t));
 2569|  75.0k|        *len = (uint32_t)(*((uint32_t *)sp->actable[table_index]) -
 2570|  75.0k|                          sizeof(uint32_t));
 2571|  75.0k|    }
 2572|   141k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2573|   141k|}
tif_ojpeg.c:OJPEGWriteStreamDri:
 2576|  35.4k|{
 2577|  35.4k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2578|  35.4k|    assert(OJPEG_BUFFER >= 6);
  ------------------
  |  Branch (2578:5): [True: 0, Folded]
  |  Branch (2578:5): [True: 35.4k, Folded]
  ------------------
 2579|  35.4k|    if (sp->restart_interval != 0)
  ------------------
  |  Branch (2579:9): [True: 1.99k, False: 33.4k]
  ------------------
 2580|  1.99k|    {
 2581|  1.99k|        sp->out_buffer[0] = 255;
 2582|  1.99k|        sp->out_buffer[1] = JPEG_MARKER_DRI;
  ------------------
  |  |  167|  1.99k|#define JPEG_MARKER_DRI 0xDD
  ------------------
 2583|  1.99k|        sp->out_buffer[2] = 0;
 2584|  1.99k|        sp->out_buffer[3] = 4;
 2585|  1.99k|        sp->out_buffer[4] = (uint8_t)(sp->restart_interval >> 8);
 2586|  1.99k|        sp->out_buffer[5] = (uint8_t)(sp->restart_interval & 255);
 2587|  1.99k|        *len = 6;
 2588|  1.99k|        *mem = (void *)sp->out_buffer;
 2589|  1.99k|    }
 2590|  35.4k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2591|  35.4k|}
tif_ojpeg.c:OJPEGWriteStreamSof:
 2594|  35.4k|{
 2595|  35.4k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2596|  35.4k|    uint8_t m;
 2597|  35.4k|    assert(OJPEG_BUFFER >= 2 + 8 + sp->samples_per_pixel_per_plane * 3);
  ------------------
  |  Branch (2597:5): [True: 0, False: 35.4k]
  |  Branch (2597:5): [True: 35.4k, False: 0]
  ------------------
 2598|  35.4k|    assert(255 >= 8 + sp->samples_per_pixel_per_plane * 3);
  ------------------
  |  Branch (2598:5): [True: 0, False: 35.4k]
  |  Branch (2598:5): [True: 35.4k, False: 0]
  ------------------
 2599|  35.4k|    sp->out_buffer[0] = 255;
 2600|  35.4k|    sp->out_buffer[1] = sp->sof_marker_id;
 2601|       |    /* Lf */
 2602|  35.4k|    sp->out_buffer[2] = 0;
 2603|  35.4k|    sp->out_buffer[3] = (uint8_t)(8 + sp->samples_per_pixel_per_plane * 3);
 2604|       |    /* P */
 2605|  35.4k|    sp->out_buffer[4] = 8;
 2606|       |    /* Y */
 2607|  35.4k|    sp->out_buffer[5] = (uint8_t)(sp->sof_y >> 8);
 2608|  35.4k|    sp->out_buffer[6] = (uint8_t)(sp->sof_y & 255);
 2609|       |    /* X */
 2610|  35.4k|    sp->out_buffer[7] = (uint8_t)(sp->sof_x >> 8);
 2611|  35.4k|    sp->out_buffer[8] = (uint8_t)(sp->sof_x & 255);
 2612|       |    /* Nf */
 2613|  35.4k|    sp->out_buffer[9] = sp->samples_per_pixel_per_plane;
 2614|  72.8k|    for (m = 0; m < sp->samples_per_pixel_per_plane; m++)
  ------------------
  |  Branch (2614:17): [True: 37.3k, False: 35.4k]
  ------------------
 2615|  37.3k|    {
 2616|       |        /* C */
 2617|  37.3k|        sp->out_buffer[10 + m * 3] = sp->sof_c[sp->plane_sample_offset + m];
 2618|       |        /* H and V */
 2619|  37.3k|        sp->out_buffer[10 + m * 3 + 1] =
 2620|  37.3k|            sp->sof_hv[sp->plane_sample_offset + m];
 2621|       |        /* Tq */
 2622|  37.3k|        sp->out_buffer[10 + m * 3 + 2] =
 2623|  37.3k|            sp->sof_tq[sp->plane_sample_offset + m];
 2624|  37.3k|    }
 2625|  35.4k|    *len = 10 + (uint32_t)sp->samples_per_pixel_per_plane * 3;
 2626|  35.4k|    *mem = (void *)sp->out_buffer;
 2627|  35.4k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2628|  35.4k|}
tif_ojpeg.c:OJPEGWriteStreamSos:
 2631|  35.4k|{
 2632|  35.4k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2633|  35.4k|    uint8_t m;
 2634|  35.4k|    assert(OJPEG_BUFFER >= 2 + 6 + sp->samples_per_pixel_per_plane * 2);
  ------------------
  |  Branch (2634:5): [True: 0, False: 35.4k]
  |  Branch (2634:5): [True: 35.4k, False: 0]
  ------------------
 2635|  35.4k|    assert(255 >= 6 + sp->samples_per_pixel_per_plane * 2);
  ------------------
  |  Branch (2635:5): [True: 0, False: 35.4k]
  |  Branch (2635:5): [True: 35.4k, False: 0]
  ------------------
 2636|  35.4k|    sp->out_buffer[0] = 255;
 2637|  35.4k|    sp->out_buffer[1] = JPEG_MARKER_SOS;
  ------------------
  |  |  165|  35.4k|#define JPEG_MARKER_SOS 0xDA
  ------------------
 2638|       |    /* Ls */
 2639|  35.4k|    sp->out_buffer[2] = 0;
 2640|  35.4k|    sp->out_buffer[3] = (uint8_t)(6 + sp->samples_per_pixel_per_plane * 2);
 2641|       |    /* Ns */
 2642|  35.4k|    sp->out_buffer[4] = sp->samples_per_pixel_per_plane;
 2643|  72.8k|    for (m = 0; m < sp->samples_per_pixel_per_plane; m++)
  ------------------
  |  Branch (2643:17): [True: 37.3k, False: 35.4k]
  ------------------
 2644|  37.3k|    {
 2645|       |        /* Cs */
 2646|  37.3k|        sp->out_buffer[5 + m * 2] = sp->sos_cs[sp->plane_sample_offset + m];
 2647|       |        /* Td and Ta */
 2648|  37.3k|        sp->out_buffer[5 + m * 2 + 1] =
 2649|  37.3k|            sp->sos_tda[sp->plane_sample_offset + m];
 2650|  37.3k|    }
 2651|       |    /* Ss */
 2652|  35.4k|    sp->out_buffer[5 + sp->samples_per_pixel_per_plane * 2] = 0;
 2653|       |    /* Se */
 2654|  35.4k|    sp->out_buffer[5 + sp->samples_per_pixel_per_plane * 2 + 1] = 63;
 2655|       |    /* Ah and Al */
 2656|  35.4k|    sp->out_buffer[5 + sp->samples_per_pixel_per_plane * 2 + 2] = 0;
 2657|  35.4k|    *len = 8 + (uint32_t)sp->samples_per_pixel_per_plane * 2;
 2658|  35.4k|    *mem = (void *)sp->out_buffer;
 2659|  35.4k|    sp->out_state = (OJPEGStateOutState)(sp->out_state + 1);
 2660|  35.4k|}
tif_ojpeg.c:OJPEGWriteStreamCompressed:
 2663|  41.4k|{
 2664|  41.4k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2665|  41.4k|    if (sp->in_buffer_togo == 0)
  ------------------
  |  Branch (2665:9): [True: 40.2k, False: 1.19k]
  ------------------
 2666|  40.2k|    {
 2667|  40.2k|        if (OJPEGReadBufferFill(sp) == 0)
  ------------------
  |  Branch (2667:13): [True: 3.88k, False: 36.3k]
  ------------------
 2668|  3.88k|            return (0);
 2669|  40.2k|        assert(sp->in_buffer_togo > 0);
  ------------------
  |  Branch (2669:9): [True: 0, False: 36.3k]
  |  Branch (2669:9): [True: 36.3k, False: 0]
  ------------------
 2670|  36.3k|    }
 2671|  37.5k|    *len = sp->in_buffer_togo;
 2672|  37.5k|    *mem = (void *)sp->in_buffer_cur;
 2673|  37.5k|    sp->in_buffer_togo = 0;
 2674|  37.5k|    if (sp->in_buffer_file_togo == 0)
  ------------------
  |  Branch (2674:9): [True: 36.1k, False: 1.42k]
  ------------------
 2675|  36.1k|    {
 2676|  36.1k|        switch (sp->in_buffer_source)
 2677|  36.1k|        {
 2678|  24.8k|            case osibsStrile:
  ------------------
  |  Branch (2678:13): [True: 24.8k, False: 11.2k]
  ------------------
 2679|  24.8k|                if (sp->in_buffer_next_strile < sp->in_buffer_strile_count)
  ------------------
  |  Branch (2679:21): [True: 24.4k, False: 423]
  ------------------
 2680|  24.4k|                    sp->out_state = ososRst;
 2681|    423|                else
 2682|    423|                    sp->out_state = ososEoi;
 2683|  24.8k|                break;
 2684|      0|            case osibsEof:
  ------------------
  |  Branch (2684:13): [True: 0, False: 36.1k]
  ------------------
 2685|      0|                sp->out_state = ososEoi;
 2686|      0|                break;
 2687|      0|            case osibsNotSetYet:
  ------------------
  |  Branch (2687:13): [True: 0, False: 36.1k]
  ------------------
 2688|  11.2k|            case osibsJpegInterchangeFormat:
  ------------------
  |  Branch (2688:13): [True: 11.2k, False: 24.8k]
  ------------------
 2689|  11.2k|            default:
  ------------------
  |  Branch (2689:13): [True: 0, False: 36.1k]
  ------------------
 2690|  11.2k|                break;
 2691|  36.1k|        }
 2692|  36.1k|    }
 2693|  37.5k|    return (1);
 2694|  37.5k|}
tif_ojpeg.c:OJPEGWriteStreamRst:
 2697|  4.31k|{
 2698|  4.31k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2699|  4.31k|    assert(OJPEG_BUFFER >= 2);
  ------------------
  |  Branch (2699:5): [True: 0, Folded]
  |  Branch (2699:5): [True: 4.31k, Folded]
  ------------------
 2700|  4.31k|    sp->out_buffer[0] = 255;
 2701|  4.31k|    sp->out_buffer[1] = (uint8_t)(JPEG_MARKER_RST0 + sp->restart_index);
  ------------------
  |  |  162|  4.31k|#define JPEG_MARKER_RST0 0XD0
  ------------------
 2702|  4.31k|    sp->restart_index++;
 2703|  4.31k|    if (sp->restart_index == 8)
  ------------------
  |  Branch (2703:9): [True: 193, False: 4.12k]
  ------------------
 2704|    193|        sp->restart_index = 0;
 2705|  4.31k|    *len = 2;
 2706|  4.31k|    *mem = (void *)sp->out_buffer;
 2707|  4.31k|    sp->out_state = ososCompressed;
 2708|  4.31k|}
tif_ojpeg.c:OJPEGWriteStreamEoi:
 2711|    187|{
 2712|    187|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 2713|    187|    assert(OJPEG_BUFFER >= 2);
  ------------------
  |  Branch (2713:5): [True: 0, Folded]
  |  Branch (2713:5): [True: 187, Folded]
  ------------------
 2714|    187|    sp->out_buffer[0] = 255;
 2715|    187|    sp->out_buffer[1] = JPEG_MARKER_EOI;
  ------------------
  |  |  164|    187|#define JPEG_MARKER_EOI 0xD9
  ------------------
 2716|    187|    *len = 2;
 2717|    187|    *mem = (void *)sp->out_buffer;
 2718|    187|}
tif_ojpeg.c:OJPEGLibjpegJpegSourceMgrResyncToRestart:
 2857|  1.41k|{
 2858|  1.41k|    TIFF *tif = (TIFF *)cinfo->client_data;
 2859|  1.41k|    (void)desired;
 2860|  1.41k|    TIFFErrorExtR(tif, "LibJpeg", "Unexpected error");
 2861|  1.41k|    jpeg_encap_unwind(tif);
 2862|  1.41k|    return (0);
 2863|  1.41k|}
tif_ojpeg.c:jpeg_read_header_encap:
 2738|  35.4k|{
 2739|  35.4k|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  35.4k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2739:9): [True: 77, False: 35.3k]
  ------------------
 2740|     77|        return 0;
 2741|  35.3k|    else
 2742|  35.3k|    {
 2743|  35.3k|        jpeg_read_header(cinfo, require_image);
 2744|  35.3k|        return 1;
 2745|  35.3k|    }
 2746|  35.4k|}
tif_ojpeg.c:jpeg_start_decompress_encap:
 2752|  35.3k|{
 2753|  35.3k|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  35.3k|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2753:9): [True: 58, False: 35.3k]
  ------------------
 2754|     58|        return 0;
 2755|  35.3k|    else
 2756|  35.3k|    {
 2757|  35.3k|        jpeg_start_decompress(cinfo);
 2758|  35.3k|        return 1;
 2759|  35.3k|    }
 2760|  35.3k|}
tif_ojpeg.c:OJPEGPreDecodeSkipRaw:
  775|   241k|{
  776|   241k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  777|   241k|    uint32_t m;
  778|   241k|    m = sp->lines_per_strile;
  779|   241k|    if (sp->subsampling_convert_state != 0)
  ------------------
  |  Branch (779:9): [True: 0, False: 241k]
  ------------------
  780|      0|    {
  781|      0|        if (sp->subsampling_convert_clines - sp->subsampling_convert_state >= m)
  ------------------
  |  Branch (781:13): [True: 0, False: 0]
  ------------------
  782|      0|        {
  783|      0|            sp->subsampling_convert_state += m;
  784|      0|            if (sp->subsampling_convert_state == sp->subsampling_convert_clines)
  ------------------
  |  Branch (784:17): [True: 0, False: 0]
  ------------------
  785|      0|                sp->subsampling_convert_state = 0;
  786|      0|            return (1);
  787|      0|        }
  788|      0|        m -= sp->subsampling_convert_clines - sp->subsampling_convert_state;
  789|      0|        sp->subsampling_convert_state = 0;
  790|      0|        sp->error_in_raw_data_decoding = 0;
  791|      0|    }
  792|  1.20M|    while (m >= sp->subsampling_convert_clines)
  ------------------
  |  Branch (792:12): [True: 964k, False: 241k]
  ------------------
  793|   964k|    {
  794|   964k|        if (jpeg_read_raw_data_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (794:13): [True: 531, False: 964k]
  ------------------
  795|   964k|                                     sp->subsampling_convert_ycbcrimage,
  796|   964k|                                     (uint32_t)sp->subsampling_ver * 8) == 0)
  797|    531|            return (0);
  798|   964k|        m -= sp->subsampling_convert_clines;
  799|   964k|    }
  800|   241k|    if (m > 0)
  ------------------
  |  Branch (800:9): [True: 321, False: 241k]
  ------------------
  801|    321|    {
  802|    321|        if (jpeg_read_raw_data_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (802:13): [True: 321, False: 0]
  ------------------
  803|    321|                                     sp->subsampling_convert_ycbcrimage,
  804|    321|                                     (uint32_t)sp->subsampling_ver * 8) == 0)
  805|    321|            return (0);
  806|      0|        sp->subsampling_convert_state = m;
  807|      0|    }
  808|   241k|    return (1);
  809|   241k|}
tif_ojpeg.c:jpeg_read_raw_data_encap:
 2782|  1.02M|{
 2783|  1.02M|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  1.02M|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2783:9): [True: 887, False: 1.02M]
  ------------------
 2784|    887|        return 0;
 2785|  1.02M|    else
 2786|  1.02M|    {
 2787|  1.02M|        jpeg_read_raw_data(cinfo, (JSAMPIMAGE)data, max_lines);
 2788|  1.02M|        return 1;
 2789|  1.02M|    }
 2790|  1.02M|}
tif_ojpeg.c:OJPEGPreDecodeSkipScanlines:
  812|  4.18M|{
  813|  4.18M|    static const char module[] = "OJPEGPreDecodeSkipScanlines";
  814|  4.18M|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  815|  4.18M|    uint32_t m;
  816|  4.18M|    if (sp->skip_buffer == NULL)
  ------------------
  |  Branch (816:9): [True: 327, False: 4.18M]
  ------------------
  817|    327|    {
  818|    327|        sp->skip_buffer = (uint8_t *)_TIFFmallocExt(tif, sp->bytes_per_line);
  819|    327|        if (sp->skip_buffer == NULL)
  ------------------
  |  Branch (819:13): [True: 0, False: 327]
  ------------------
  820|      0|        {
  821|      0|            TIFFErrorExtR(tif, module, "Out of memory");
  822|      0|            return (0);
  823|      0|        }
  824|    327|    }
  825|  81.8M|    for (m = 0; m < sp->lines_per_strile; m++)
  ------------------
  |  Branch (825:17): [True: 77.6M, False: 4.17M]
  ------------------
  826|  77.6M|    {
  827|  77.6M|        if (jpeg_read_scanlines_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (827:13): [True: 4.28k, False: 77.6M]
  ------------------
  828|  77.6M|                                      &sp->skip_buffer, 1) == 0)
  829|  4.28k|            return (0);
  830|  77.6M|    }
  831|  4.17M|    return (1);
  832|  4.18M|}
tif_ojpeg.c:jpeg_read_scanlines_encap:
 2767|  93.5M|{
 2768|  93.5M|    if (SETJMP(sp->exit_jmpbuf))
  ------------------
  |  |  152|  93.5M|#define SETJMP(jbuf) setjmp(jbuf)
  ------------------
  |  Branch (2768:9): [True: 4.41k, False: 93.5M]
  ------------------
 2769|  4.41k|        return 0;
 2770|  93.5M|    else
 2771|  93.5M|    {
 2772|  93.5M|        jpeg_read_scanlines(cinfo, (JSAMPARRAY)scanlines, max_lines);
 2773|  93.5M|        return 1;
 2774|  93.5M|    }
 2775|  93.5M|}
tif_ojpeg.c:OJPEGDecode:
  835|   262k|{
  836|   262k|    static const char module[] = "OJPEGDecode";
  837|   262k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  838|   262k|    (void)s;
  839|   262k|    if (!sp->decoder_ok)
  ------------------
  |  Branch (839:9): [True: 0, False: 262k]
  ------------------
  840|      0|    {
  841|      0|        memset(buf, 0, (size_t)cc);
  842|      0|        TIFFErrorExtR(tif, module,
  843|      0|                      "Cannot decode: decoder not correctly initialized");
  844|      0|        return 0;
  845|      0|    }
  846|   262k|    if (sp->libjpeg_session_active == 0)
  ------------------
  |  Branch (846:9): [True: 36, False: 262k]
  ------------------
  847|     36|    {
  848|     36|        memset(buf, 0, (size_t)cc);
  849|       |        /* This should normally not happen, except that it does when */
  850|       |        /* using TIFFReadScanline() which calls OJPEGPostDecode() for */
  851|       |        /* each scanline, which assumes that a whole strile was read */
  852|       |        /* and may thus incorrectly consider it has read the whole image,
  853|       |         * causing */
  854|       |        /* OJPEGLibjpegSessionAbort() to be called prematurely. */
  855|       |        /* Triggered by https://gitlab.com/libtiff/libtiff/-/issues/337 */
  856|     36|        TIFFErrorExtR(tif, module,
  857|     36|                      "Cannot decode: libjpeg_session_active == 0");
  858|     36|        return 0;
  859|     36|    }
  860|   262k|    if (sp->error_in_raw_data_decoding)
  ------------------
  |  Branch (860:9): [True: 12, False: 262k]
  ------------------
  861|     12|    {
  862|     12|        memset(buf, 0, (size_t)cc);
  863|     12|        return 0;
  864|     12|    }
  865|   262k|    if (sp->libjpeg_jpeg_query_style == 0)
  ------------------
  |  Branch (865:9): [True: 37.5k, False: 224k]
  ------------------
  866|  37.5k|    {
  867|  37.5k|        if (OJPEGDecodeRaw(tif, buf, cc) == 0)
  ------------------
  |  Branch (867:13): [True: 36, False: 37.5k]
  ------------------
  868|     36|        {
  869|     36|            memset(buf, 0, (size_t)cc);
  870|     36|            return (0);
  871|     36|        }
  872|  37.5k|    }
  873|   224k|    else
  874|   224k|    {
  875|   224k|        if (OJPEGDecodeScanlines(tif, buf, cc) == 0)
  ------------------
  |  Branch (875:13): [True: 128, False: 224k]
  ------------------
  876|    128|        {
  877|    128|            memset(buf, 0, (size_t)cc);
  878|    128|            return (0);
  879|    128|        }
  880|   224k|    }
  881|   262k|    return (1);
  882|   262k|}
tif_ojpeg.c:OJPEGDecodeRaw:
  885|  37.5k|{
  886|  37.5k|    static const char module[] = "OJPEGDecodeRaw";
  887|  37.5k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  888|  37.5k|    uint8_t *m;
  889|  37.5k|    tmsize_t n;
  890|  37.5k|    uint8_t *oy;
  891|  37.5k|    uint8_t *ocb;
  892|  37.5k|    uint8_t *ocr;
  893|  37.5k|    uint8_t *p;
  894|  37.5k|    uint32_t q;
  895|  37.5k|    uint8_t *r;
  896|  37.5k|    uint8_t sx, sy;
  897|  37.5k|    if (cc % sp->bytes_per_line != 0)
  ------------------
  |  Branch (897:9): [True: 1, False: 37.5k]
  ------------------
  898|      1|    {
  899|      1|        TIFFErrorExtR(tif, module, "Fractional scanline not read");
  900|      1|        return (0);
  901|      1|    }
  902|  37.5k|    assert(cc > 0);
  ------------------
  |  Branch (902:5): [True: 0, False: 37.5k]
  |  Branch (902:5): [True: 37.5k, False: 0]
  ------------------
  903|  37.5k|    m = buf;
  904|  37.5k|    n = cc;
  905|  37.5k|    do
  906|   412k|    {
  907|   412k|        if (sp->subsampling_convert_state == 0)
  ------------------
  |  Branch (907:13): [True: 59.0k, False: 353k]
  ------------------
  908|  59.0k|        {
  909|  59.0k|            if (jpeg_read_raw_data_encap(
  ------------------
  |  Branch (909:17): [True: 35, False: 58.9k]
  ------------------
  910|  59.0k|                    sp, &(sp->libjpeg_jpeg_decompress_struct),
  911|  59.0k|                    sp->subsampling_convert_ycbcrimage,
  912|  59.0k|                    (uint32_t)sp->subsampling_ver * 8) == 0)
  913|     35|            {
  914|     35|                sp->error_in_raw_data_decoding = 1;
  915|     35|                return (0);
  916|     35|            }
  917|  59.0k|        }
  918|   412k|        oy = sp->subsampling_convert_ybuf +
  919|   412k|             sp->subsampling_convert_state * sp->subsampling_ver *
  920|   412k|                 sp->subsampling_convert_ylinelen;
  921|   412k|        ocb = sp->subsampling_convert_cbbuf +
  922|   412k|              sp->subsampling_convert_state * sp->subsampling_convert_clinelen;
  923|   412k|        ocr = sp->subsampling_convert_crbuf +
  924|   412k|              sp->subsampling_convert_state * sp->subsampling_convert_clinelen;
  925|   412k|        p = m;
  926|   314M|        for (q = 0; q < sp->subsampling_convert_clinelenout; q++)
  ------------------
  |  Branch (926:21): [True: 314M, False: 412k]
  ------------------
  927|   314M|        {
  928|   314M|            r = oy;
  929|   681M|            for (sy = 0; sy < sp->subsampling_ver; sy++)
  ------------------
  |  Branch (929:26): [True: 367M, False: 314M]
  ------------------
  930|   367M|            {
  931|   864M|                for (sx = 0; sx < sp->subsampling_hor; sx++)
  ------------------
  |  Branch (931:30): [True: 497M, False: 367M]
  ------------------
  932|   497M|                    *p++ = *r++;
  933|   367M|                r += sp->subsampling_convert_ylinelen - sp->subsampling_hor;
  934|   367M|            }
  935|   314M|            oy += sp->subsampling_hor;
  936|   314M|            *p++ = *ocb++;
  937|   314M|            *p++ = *ocr++;
  938|   314M|        }
  939|   412k|        sp->subsampling_convert_state++;
  940|   412k|        if (sp->subsampling_convert_state == sp->subsampling_convert_clines)
  ------------------
  |  Branch (940:13): [True: 49.0k, False: 363k]
  ------------------
  941|  49.0k|            sp->subsampling_convert_state = 0;
  942|   412k|        m += sp->bytes_per_line;
  943|   412k|        n -= sp->bytes_per_line;
  944|   412k|    } while (n > 0);
  ------------------
  |  Branch (944:14): [True: 375k, False: 37.5k]
  ------------------
  945|  37.5k|    return (1);
  946|  37.5k|}
tif_ojpeg.c:OJPEGDecodeScanlines:
  949|   224k|{
  950|   224k|    static const char module[] = "OJPEGDecodeScanlines";
  951|   224k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  952|   224k|    uint8_t *m;
  953|   224k|    tmsize_t n;
  954|   224k|    if (cc % sp->bytes_per_line != 0)
  ------------------
  |  Branch (954:9): [True: 0, False: 224k]
  ------------------
  955|      0|    {
  956|      0|        TIFFErrorExtR(tif, module, "Fractional scanline not read");
  957|      0|        return (0);
  958|      0|    }
  959|   224k|    assert(cc > 0);
  ------------------
  |  Branch (959:5): [True: 0, False: 224k]
  |  Branch (959:5): [True: 224k, False: 0]
  ------------------
  960|   224k|    m = buf;
  961|   224k|    n = cc;
  962|   224k|    do
  963|  15.8M|    {
  964|  15.8M|        if (jpeg_read_scanlines_encap(sp, &(sp->libjpeg_jpeg_decompress_struct),
  ------------------
  |  Branch (964:13): [True: 128, False: 15.8M]
  ------------------
  965|  15.8M|                                      &m, 1) == 0)
  966|    128|            return (0);
  967|  15.8M|        m += sp->bytes_per_line;
  968|  15.8M|        n -= sp->bytes_per_line;
  969|  15.8M|    } while (n > 0);
  ------------------
  |  Branch (969:14): [True: 15.6M, False: 224k]
  ------------------
  970|   224k|    return (1);
  971|   224k|}
tif_ojpeg.c:OJPEGPostDecode:
  974|   262k|{
  975|   262k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
  976|   262k|    (void)buf;
  977|   262k|    (void)cc;
  978|       |    /* This function somehow incorrectly assumes that a whole strile was read,
  979|       |     */
  980|       |    /* which is not true when TIFFReadScanline() is called, */
  981|       |    /* and may thus incorrectly consider it has read the whole image, causing */
  982|       |    /* OJPEGLibjpegSessionAbort() to be called prematurely. */
  983|       |    /* So this logic should be fixed to take into account cc, or disable */
  984|       |    /* the scan line reading interface. */
  985|       |    /* Triggered by https://gitlab.com/libtiff/libtiff/-/issues/337 */
  986|   262k|    sp->write_curstrile++;
  987|   262k|    if (sp->write_curstrile % tif->tif_dir.td_stripsperimage == 0)
  ------------------
  |  Branch (987:9): [True: 821, False: 261k]
  ------------------
  988|    821|    {
  989|    821|        assert(sp->libjpeg_session_active != 0);
  ------------------
  |  Branch (989:9): [True: 0, False: 821]
  |  Branch (989:9): [True: 821, False: 0]
  ------------------
  990|    821|        OJPEGLibjpegSessionAbort(tif);
  991|    821|        sp->writeheader_done = 0;
  992|    821|    }
  993|   262k|}
tif_ojpeg.c:OJPEGCleanup:
 1036|  1.03k|{
 1037|  1.03k|    OJPEGState *sp = (OJPEGState *)tif->tif_data;
 1038|  1.03k|    if (sp != 0)
  ------------------
  |  Branch (1038:9): [True: 1.03k, False: 0]
  ------------------
 1039|  1.03k|    {
 1040|  1.03k|        tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1041|  1.03k|        tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1042|  1.03k|        tif->tif_tagmethods.printdir = sp->printdir;
 1043|  1.03k|        if (sp->qtable[0] != 0)
  ------------------
  |  Branch (1043:13): [True: 764, False: 269]
  ------------------
 1044|    764|            _TIFFfreeExt(tif, sp->qtable[0]);
 1045|  1.03k|        if (sp->qtable[1] != 0)
  ------------------
  |  Branch (1045:13): [True: 73, False: 960]
  ------------------
 1046|     73|            _TIFFfreeExt(tif, sp->qtable[1]);
 1047|  1.03k|        if (sp->qtable[2] != 0)
  ------------------
  |  Branch (1047:13): [True: 31, False: 1.00k]
  ------------------
 1048|     31|            _TIFFfreeExt(tif, sp->qtable[2]);
 1049|  1.03k|        if (sp->qtable[3] != 0)
  ------------------
  |  Branch (1049:13): [True: 10, False: 1.02k]
  ------------------
 1050|     10|            _TIFFfreeExt(tif, sp->qtable[3]);
 1051|  1.03k|        if (sp->dctable[0] != 0)
  ------------------
  |  Branch (1051:13): [True: 747, False: 286]
  ------------------
 1052|    747|            _TIFFfreeExt(tif, sp->dctable[0]);
 1053|  1.03k|        if (sp->dctable[1] != 0)
  ------------------
  |  Branch (1053:13): [True: 310, False: 723]
  ------------------
 1054|    310|            _TIFFfreeExt(tif, sp->dctable[1]);
 1055|  1.03k|        if (sp->dctable[2] != 0)
  ------------------
  |  Branch (1055:13): [True: 324, False: 709]
  ------------------
 1056|    324|            _TIFFfreeExt(tif, sp->dctable[2]);
 1057|  1.03k|        if (sp->dctable[3] != 0)
  ------------------
  |  Branch (1057:13): [True: 26, False: 1.00k]
  ------------------
 1058|     26|            _TIFFfreeExt(tif, sp->dctable[3]);
 1059|  1.03k|        if (sp->actable[0] != 0)
  ------------------
  |  Branch (1059:13): [True: 687, False: 346]
  ------------------
 1060|    687|            _TIFFfreeExt(tif, sp->actable[0]);
 1061|  1.03k|        if (sp->actable[1] != 0)
  ------------------
  |  Branch (1061:13): [True: 472, False: 561]
  ------------------
 1062|    472|            _TIFFfreeExt(tif, sp->actable[1]);
 1063|  1.03k|        if (sp->actable[2] != 0)
  ------------------
  |  Branch (1063:13): [True: 101, False: 932]
  ------------------
 1064|    101|            _TIFFfreeExt(tif, sp->actable[2]);
 1065|  1.03k|        if (sp->actable[3] != 0)
  ------------------
  |  Branch (1065:13): [True: 8, False: 1.02k]
  ------------------
 1066|      8|            _TIFFfreeExt(tif, sp->actable[3]);
 1067|  1.03k|        if (sp->libjpeg_session_active != 0)
  ------------------
  |  Branch (1067:13): [True: 277, False: 756]
  ------------------
 1068|    277|            OJPEGLibjpegSessionAbort(tif);
 1069|  1.03k|        if (sp->subsampling_convert_ycbcrbuf != 0)
  ------------------
  |  Branch (1069:13): [True: 100, False: 933]
  ------------------
 1070|    100|            _TIFFfreeExt(tif, sp->subsampling_convert_ycbcrbuf);
 1071|  1.03k|        if (sp->subsampling_convert_ycbcrimage != 0)
  ------------------
  |  Branch (1071:13): [True: 100, False: 933]
  ------------------
 1072|    100|            _TIFFfreeExt(tif, sp->subsampling_convert_ycbcrimage);
 1073|  1.03k|        if (sp->skip_buffer != 0)
  ------------------
  |  Branch (1073:13): [True: 327, False: 706]
  ------------------
 1074|    327|            _TIFFfreeExt(tif, sp->skip_buffer);
 1075|  1.03k|        _TIFFfreeExt(tif, sp);
 1076|       |        tif->tif_data = NULL;
 1077|  1.03k|        _TIFFSetDefaultCompressionState(tif);
 1078|  1.03k|    }
 1079|  1.03k|}

_TIFFgetMode:
   57|  5.98k|{
   58|  5.98k|    int m = -1;
   59|       |
   60|  5.98k|    switch (mode[0])
   61|  5.98k|    {
   62|  5.98k|        case 'r':
  ------------------
  |  Branch (62:9): [True: 5.98k, False: 0]
  ------------------
   63|  5.98k|            m = O_RDONLY;
   64|  5.98k|            if (mode[1] == '+')
  ------------------
  |  Branch (64:17): [True: 0, False: 5.98k]
  ------------------
   65|      0|                m = O_RDWR;
   66|  5.98k|            break;
   67|      0|        case 'w':
  ------------------
  |  Branch (67:9): [True: 0, False: 5.98k]
  ------------------
   68|      0|        case 'a':
  ------------------
  |  Branch (68:9): [True: 0, False: 5.98k]
  ------------------
   69|      0|            m = O_RDWR | O_CREAT;
   70|      0|            if (mode[0] == 'w')
  ------------------
  |  Branch (70:17): [True: 0, False: 0]
  ------------------
   71|      0|                m |= O_TRUNC;
   72|      0|            break;
   73|      0|        default:
  ------------------
  |  Branch (73:9): [True: 0, False: 5.98k]
  ------------------
   74|      0|            _TIFFErrorEarly(opts, clientdata, module, "\"%s\": Bad mode", mode);
   75|      0|            break;
   76|  5.98k|    }
   77|  5.98k|    return (m);
   78|  5.98k|}
_TIFFmallocExt:
  174|  2.02M|{
  175|  2.02M|    if (tif != NULL && tif->tif_max_single_mem_alloc > 0 &&
  ------------------
  |  Branch (175:9): [True: 2.01M, False: 5.98k]
  |  Branch (175:24): [True: 0, False: 2.01M]
  ------------------
  176|      0|        s > tif->tif_max_single_mem_alloc)
  ------------------
  |  Branch (176:9): [True: 0, False: 0]
  ------------------
  177|      0|    {
  178|      0|        _TIFFEmitErrorAboveMaxSingleMemAlloc(tif, "_TIFFmallocExt", s);
  179|      0|        return NULL;
  180|      0|    }
  181|  2.02M|    if (tif != NULL && tif->tif_max_cumulated_mem_alloc > 0)
  ------------------
  |  Branch (181:9): [True: 2.01M, False: 5.98k]
  |  Branch (181:24): [True: 0, False: 2.01M]
  ------------------
  182|      0|    {
  183|      0|        if (s > tif->tif_max_cumulated_mem_alloc -
  ------------------
  |  Branch (183:13): [True: 0, False: 0]
  ------------------
  184|      0|                    tif->tif_cur_cumulated_mem_alloc ||
  185|      0|            s > TIFF_TMSIZE_T_MAX - LEADING_AREA_TO_STORE_ALLOC_SIZE)
  ------------------
  |  |   68|      0|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
                          s > TIFF_TMSIZE_T_MAX - LEADING_AREA_TO_STORE_ALLOC_SIZE)
  ------------------
  |  |  170|      0|#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
  |  |  ------------------
  |  |  |  |  116|      0|#define SIZEOF_SIZE_T 8
  |  |  ------------------
  ------------------
  |  Branch (185:13): [True: 0, False: 0]
  ------------------
  186|      0|        {
  187|      0|            _TIFFEmitErrorAboveMaxCumulatedMemAlloc(tif, "_TIFFmallocExt", s);
  188|      0|            return NULL;
  189|      0|        }
  190|      0|        void *ptr = _TIFFmalloc(LEADING_AREA_TO_STORE_ALLOC_SIZE + s);
  ------------------
  |  |  170|      0|#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
  |  |  ------------------
  |  |  |  |  116|      0|#define SIZEOF_SIZE_T 8
  |  |  ------------------
  ------------------
  191|      0|        if (!ptr)
  ------------------
  |  Branch (191:13): [True: 0, False: 0]
  ------------------
  192|      0|            return NULL;
  193|      0|        tif->tif_cur_cumulated_mem_alloc += s;
  194|      0|        memcpy(ptr, &s, sizeof(s));
  195|      0|        return (char *)ptr + LEADING_AREA_TO_STORE_ALLOC_SIZE;
  ------------------
  |  |  170|      0|#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
  |  |  ------------------
  |  |  |  |  116|      0|#define SIZEOF_SIZE_T 8
  |  |  ------------------
  ------------------
  196|      0|    }
  197|  2.02M|    return _TIFFmalloc(s);
  198|  2.02M|}
_TIFFcallocExt:
  202|  1.46k|{
  203|  1.46k|    if (nmemb <= 0 || siz <= 0 || nmemb > TIFF_TMSIZE_T_MAX / siz)
  ------------------
  |  |   68|  1.46k|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (203:9): [True: 0, False: 1.46k]
  |  Branch (203:23): [True: 0, False: 1.46k]
  |  Branch (203:35): [True: 0, False: 1.46k]
  ------------------
  204|      0|        return NULL;
  205|  1.46k|    if (tif != NULL && tif->tif_max_single_mem_alloc > 0)
  ------------------
  |  Branch (205:9): [True: 1.46k, False: 0]
  |  Branch (205:24): [True: 0, False: 1.46k]
  ------------------
  206|      0|    {
  207|      0|        if (nmemb * siz > tif->tif_max_single_mem_alloc)
  ------------------
  |  Branch (207:13): [True: 0, False: 0]
  ------------------
  208|      0|        {
  209|      0|            _TIFFEmitErrorAboveMaxSingleMemAlloc(tif, "_TIFFcallocExt",
  210|      0|                                                 nmemb * siz);
  211|      0|            return NULL;
  212|      0|        }
  213|      0|    }
  214|  1.46k|    if (tif != NULL && tif->tif_max_cumulated_mem_alloc > 0)
  ------------------
  |  Branch (214:9): [True: 1.46k, False: 0]
  |  Branch (214:24): [True: 0, False: 1.46k]
  ------------------
  215|      0|    {
  216|      0|        const tmsize_t s = nmemb * siz;
  217|      0|        if (s > tif->tif_max_cumulated_mem_alloc -
  ------------------
  |  Branch (217:13): [True: 0, False: 0]
  ------------------
  218|      0|                    tif->tif_cur_cumulated_mem_alloc ||
  219|      0|            s > TIFF_TMSIZE_T_MAX - LEADING_AREA_TO_STORE_ALLOC_SIZE)
  ------------------
  |  |   68|      0|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
                          s > TIFF_TMSIZE_T_MAX - LEADING_AREA_TO_STORE_ALLOC_SIZE)
  ------------------
  |  |  170|      0|#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
  |  |  ------------------
  |  |  |  |  116|      0|#define SIZEOF_SIZE_T 8
  |  |  ------------------
  ------------------
  |  Branch (219:13): [True: 0, False: 0]
  ------------------
  220|      0|        {
  221|      0|            _TIFFEmitErrorAboveMaxCumulatedMemAlloc(tif, "_TIFFcallocExt", s);
  222|      0|            return NULL;
  223|      0|        }
  224|      0|        void *ptr = _TIFFcalloc(LEADING_AREA_TO_STORE_ALLOC_SIZE + s, 1);
  ------------------
  |  |  170|      0|#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
  |  |  ------------------
  |  |  |  |  116|      0|#define SIZEOF_SIZE_T 8
  |  |  ------------------
  ------------------
  225|      0|        if (!ptr)
  ------------------
  |  Branch (225:13): [True: 0, False: 0]
  ------------------
  226|      0|            return NULL;
  227|      0|        tif->tif_cur_cumulated_mem_alloc += s;
  228|      0|        memcpy(ptr, &s, sizeof(s));
  229|      0|        return (char *)ptr + LEADING_AREA_TO_STORE_ALLOC_SIZE;
  ------------------
  |  |  170|      0|#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
  |  |  ------------------
  |  |  |  |  116|      0|#define SIZEOF_SIZE_T 8
  |  |  ------------------
  ------------------
  230|      0|    }
  231|  1.46k|    return _TIFFcalloc(nmemb, siz);
  232|  1.46k|}
_TIFFreallocExt:
  236|   208k|{
  237|   208k|    if (tif != NULL && tif->tif_max_single_mem_alloc > 0 &&
  ------------------
  |  Branch (237:9): [True: 208k, False: 0]
  |  Branch (237:24): [True: 0, False: 208k]
  ------------------
  238|      0|        s > tif->tif_max_single_mem_alloc)
  ------------------
  |  Branch (238:9): [True: 0, False: 0]
  ------------------
  239|      0|    {
  240|      0|        _TIFFEmitErrorAboveMaxSingleMemAlloc(tif, "_TIFFreallocExt", s);
  241|      0|        return NULL;
  242|      0|    }
  243|   208k|    if (tif != NULL && tif->tif_max_cumulated_mem_alloc > 0)
  ------------------
  |  Branch (243:9): [True: 208k, False: 0]
  |  Branch (243:24): [True: 0, False: 208k]
  ------------------
  244|      0|    {
  245|      0|        void *oldPtr = p;
  246|      0|        tmsize_t oldSize = 0;
  247|      0|        if (p)
  ------------------
  |  Branch (247:13): [True: 0, False: 0]
  ------------------
  248|      0|        {
  249|      0|            oldPtr = (char *)p - LEADING_AREA_TO_STORE_ALLOC_SIZE;
  ------------------
  |  |  170|      0|#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
  |  |  ------------------
  |  |  |  |  116|      0|#define SIZEOF_SIZE_T 8
  |  |  ------------------
  ------------------
  250|      0|            memcpy(&oldSize, oldPtr, sizeof(oldSize));
  251|      0|            assert(oldSize <= tif->tif_cur_cumulated_mem_alloc);
  ------------------
  |  Branch (251:13): [True: 0, False: 0]
  |  Branch (251:13): [True: 0, False: 0]
  ------------------
  252|      0|        }
  253|      0|        if (s > oldSize &&
  ------------------
  |  Branch (253:13): [True: 0, False: 0]
  ------------------
  254|      0|            (s > tif->tif_max_cumulated_mem_alloc -
  ------------------
  |  Branch (254:14): [True: 0, False: 0]
  ------------------
  255|      0|                     (tif->tif_cur_cumulated_mem_alloc - oldSize) ||
  256|      0|             s > TIFF_TMSIZE_T_MAX - LEADING_AREA_TO_STORE_ALLOC_SIZE))
  ------------------
  |  |   68|      0|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
                           s > TIFF_TMSIZE_T_MAX - LEADING_AREA_TO_STORE_ALLOC_SIZE))
  ------------------
  |  |  170|      0|#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
  |  |  ------------------
  |  |  |  |  116|      0|#define SIZEOF_SIZE_T 8
  |  |  ------------------
  ------------------
  |  Branch (256:14): [True: 0, False: 0]
  ------------------
  257|      0|        {
  258|      0|            _TIFFEmitErrorAboveMaxCumulatedMemAlloc(tif, "_TIFFreallocExt",
  259|      0|                                                    s - oldSize);
  260|      0|            return NULL;
  261|      0|        }
  262|      0|        void *newPtr =
  263|      0|            _TIFFrealloc(oldPtr, LEADING_AREA_TO_STORE_ALLOC_SIZE + s);
  ------------------
  |  |  170|      0|#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
  |  |  ------------------
  |  |  |  |  116|      0|#define SIZEOF_SIZE_T 8
  |  |  ------------------
  ------------------
  264|      0|        if (newPtr == NULL)
  ------------------
  |  Branch (264:13): [True: 0, False: 0]
  ------------------
  265|      0|            return NULL;
  266|      0|        tif->tif_cur_cumulated_mem_alloc -= oldSize;
  267|      0|        tif->tif_cur_cumulated_mem_alloc += s;
  268|      0|        memcpy(newPtr, &s, sizeof(s));
  269|      0|        return (char *)newPtr + LEADING_AREA_TO_STORE_ALLOC_SIZE;
  ------------------
  |  |  170|      0|#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
  |  |  ------------------
  |  |  |  |  116|      0|#define SIZEOF_SIZE_T 8
  |  |  ------------------
  ------------------
  270|      0|    }
  271|   208k|    return _TIFFrealloc(p, s);
  272|   208k|}
_TIFFfreeExt:
  276|  2.10M|{
  277|  2.10M|    if (p != NULL && tif != NULL && tif->tif_max_cumulated_mem_alloc > 0)
  ------------------
  |  Branch (277:9): [True: 2.09M, False: 6.78k]
  |  Branch (277:22): [True: 2.09M, False: 5.98k]
  |  Branch (277:37): [True: 0, False: 2.09M]
  ------------------
  278|      0|    {
  279|      0|        void *oldPtr = (char *)p - LEADING_AREA_TO_STORE_ALLOC_SIZE;
  ------------------
  |  |  170|      0|#define LEADING_AREA_TO_STORE_ALLOC_SIZE (2 * SIZEOF_SIZE_T)
  |  |  ------------------
  |  |  |  |  116|      0|#define SIZEOF_SIZE_T 8
  |  |  ------------------
  ------------------
  280|      0|        tmsize_t oldSize;
  281|      0|        memcpy(&oldSize, oldPtr, sizeof(oldSize));
  282|      0|        assert(oldSize <= tif->tif_cur_cumulated_mem_alloc);
  ------------------
  |  Branch (282:9): [True: 0, False: 0]
  |  Branch (282:9): [True: 0, False: 0]
  ------------------
  283|      0|        tif->tif_cur_cumulated_mem_alloc -= oldSize;
  284|      0|        p = oldPtr;
  285|      0|    }
  286|  2.10M|    _TIFFfree(p);
  287|  2.10M|}
TIFFClientOpen:
  294|  5.98k|{
  295|  5.98k|    return TIFFClientOpenExt(name, mode, clientdata, readproc, writeproc,
  296|  5.98k|                             seekproc, closeproc, sizeproc, mapproc, unmapproc,
  297|       |                             NULL);
  298|  5.98k|}
TIFFClientOpenExt:
  306|  5.98k|{
  307|  5.98k|    static const char module[] = "TIFFClientOpenExt";
  308|  5.98k|    TIFF *tif;
  309|  5.98k|    int m;
  310|  5.98k|    const char *cp;
  311|  5.98k|    tmsize_t size_to_alloc;
  312|       |
  313|       |    /* The following are configuration checks. They should be redundant, but
  314|       |     * should not compile to any actual code in an optimised release build
  315|       |     * anyway. If any of them fail, (makefile-based or other) configuration is
  316|       |     * not correct */
  317|  5.98k|    assert(sizeof(uint8_t) == 1);
  ------------------
  |  Branch (317:5): [True: 0, Folded]
  |  Branch (317:5): [True: 5.98k, Folded]
  ------------------
  318|  5.98k|    assert(sizeof(int8_t) == 1);
  ------------------
  |  Branch (318:5): [True: 0, Folded]
  |  Branch (318:5): [True: 5.98k, Folded]
  ------------------
  319|  5.98k|    assert(sizeof(uint16_t) == 2);
  ------------------
  |  Branch (319:5): [True: 0, Folded]
  |  Branch (319:5): [True: 5.98k, Folded]
  ------------------
  320|  5.98k|    assert(sizeof(int16_t) == 2);
  ------------------
  |  Branch (320:5): [True: 0, Folded]
  |  Branch (320:5): [True: 5.98k, Folded]
  ------------------
  321|  5.98k|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (321:5): [True: 0, Folded]
  |  Branch (321:5): [True: 5.98k, Folded]
  ------------------
  322|  5.98k|    assert(sizeof(int32_t) == 4);
  ------------------
  |  Branch (322:5): [True: 0, Folded]
  |  Branch (322:5): [True: 5.98k, Folded]
  ------------------
  323|  5.98k|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (323:5): [True: 0, Folded]
  |  Branch (323:5): [True: 5.98k, Folded]
  ------------------
  324|  5.98k|    assert(sizeof(int64_t) == 8);
  ------------------
  |  Branch (324:5): [True: 0, Folded]
  |  Branch (324:5): [True: 5.98k, Folded]
  ------------------
  325|  5.98k|    {
  326|  5.98k|        union
  327|  5.98k|        {
  328|  5.98k|            uint8_t a8[2];
  329|  5.98k|            uint16_t a16;
  330|  5.98k|        } n;
  331|  5.98k|        n.a8[0] = 1;
  332|  5.98k|        n.a8[1] = 0;
  333|  5.98k|        (void)n;
  334|       |#if WORDS_BIGENDIAN
  335|       |        assert(n.a16 == 256);
  336|       |#else
  337|  5.98k|        assert(n.a16 == 1);
  ------------------
  |  Branch (337:9): [True: 0, False: 5.98k]
  |  Branch (337:9): [True: 5.98k, False: 0]
  ------------------
  338|  5.98k|#endif
  339|  5.98k|    }
  340|       |
  341|  5.98k|    m = _TIFFgetMode(opts, clientdata, mode, module);
  342|  5.98k|    if (m == -1)
  ------------------
  |  Branch (342:9): [True: 0, False: 5.98k]
  ------------------
  343|      0|        goto bad2;
  344|  5.98k|    size_to_alloc = (tmsize_t)(sizeof(TIFF) + strlen(name) + 1);
  345|  5.98k|    if (opts && opts->max_single_mem_alloc > 0 &&
  ------------------
  |  Branch (345:9): [True: 0, False: 5.98k]
  |  Branch (345:17): [True: 0, False: 0]
  ------------------
  346|      0|        size_to_alloc > opts->max_single_mem_alloc)
  ------------------
  |  Branch (346:9): [True: 0, False: 0]
  ------------------
  347|      0|    {
  348|      0|        _TIFFErrorEarly(opts, clientdata, module,
  349|      0|                        "%s: Memory allocation of %" PRIu64
  350|      0|                        " bytes is beyond the %" PRIu64
  351|      0|                        " byte limit defined in open options",
  352|      0|                        name, (uint64_t)size_to_alloc,
  353|      0|                        (uint64_t)opts->max_single_mem_alloc);
  354|      0|        goto bad2;
  355|      0|    }
  356|  5.98k|    if (opts && opts->max_cumulated_mem_alloc > 0 &&
  ------------------
  |  Branch (356:9): [True: 0, False: 5.98k]
  |  Branch (356:17): [True: 0, False: 0]
  ------------------
  357|      0|        size_to_alloc > opts->max_cumulated_mem_alloc)
  ------------------
  |  Branch (357:9): [True: 0, False: 0]
  ------------------
  358|      0|    {
  359|      0|        _TIFFErrorEarly(opts, clientdata, module,
  360|      0|                        "%s: Memory allocation of %" PRIu64
  361|      0|                        " bytes is beyond the %" PRIu64
  362|      0|                        " cumulated byte limit defined in open options",
  363|      0|                        name, (uint64_t)size_to_alloc,
  364|      0|                        (uint64_t)opts->max_cumulated_mem_alloc);
  365|      0|        goto bad2;
  366|      0|    }
  367|  5.98k|    tif = (TIFF *)_TIFFmallocExt(NULL, size_to_alloc);
  368|  5.98k|    if (tif == NULL)
  ------------------
  |  Branch (368:9): [True: 0, False: 5.98k]
  ------------------
  369|      0|    {
  370|      0|        _TIFFErrorEarly(opts, clientdata, module,
  371|      0|                        "%s: Out of memory (TIFF structure)", name);
  372|      0|        goto bad2;
  373|      0|    }
  374|  5.98k|    _TIFFmemset(tif, 0, sizeof(*tif));
  375|  5.98k|    tif->tif_name = (char *)tif + sizeof(TIFF);
  376|  5.98k|    strcpy(tif->tif_name, name);
  377|  5.98k|    tif->tif_mode = m & ~(O_CREAT | O_TRUNC);
  378|  5.98k|    tif->tif_curdir = TIFF_NON_EXISTENT_DIR_NUMBER; /* non-existent directory */
  ------------------
  |  |   65|  5.98k|#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
  ------------------
  379|  5.98k|    tif->tif_curdircount = TIFF_NON_EXISTENT_DIR_NUMBER;
  ------------------
  |  |   65|  5.98k|#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
  ------------------
  380|  5.98k|    tif->tif_curoff = 0;
  381|  5.98k|    tif->tif_clientdata = clientdata;
  382|  5.98k|    tif->tif_readproc = readproc;
  383|  5.98k|    tif->tif_writeproc = writeproc;
  384|  5.98k|    tif->tif_seekproc = seekproc;
  385|  5.98k|    tif->tif_closeproc = closeproc;
  386|  5.98k|    tif->tif_sizeproc = sizeproc;
  387|  5.98k|    tif->tif_mapproc = mapproc ? mapproc : _tiffDummyMapProc;
  ------------------
  |  Branch (387:24): [True: 5.98k, False: 0]
  ------------------
  388|  5.98k|    tif->tif_unmapproc = unmapproc ? unmapproc : _tiffDummyUnmapProc;
  ------------------
  |  Branch (388:26): [True: 5.98k, False: 0]
  ------------------
  389|  5.98k|    if (opts)
  ------------------
  |  Branch (389:9): [True: 0, False: 5.98k]
  ------------------
  390|      0|    {
  391|      0|        tif->tif_errorhandler = opts->errorhandler;
  392|      0|        tif->tif_errorhandler_user_data = opts->errorhandler_user_data;
  393|      0|        tif->tif_warnhandler = opts->warnhandler;
  394|      0|        tif->tif_warnhandler_user_data = opts->warnhandler_user_data;
  395|      0|        tif->tif_max_single_mem_alloc = opts->max_single_mem_alloc;
  396|      0|        tif->tif_max_cumulated_mem_alloc = opts->max_cumulated_mem_alloc;
  397|      0|        tif->tif_warn_about_unknown_tags = opts->warn_about_unknown_tags;
  398|      0|    }
  399|       |
  400|       |    /* Reset tif->tif_dir structure to zero and
  401|       |     * initialize some IFD strile counter and index parameters. */
  402|  5.98k|    _TIFFResetTifDirAndInitStrileCounters(&tif->tif_dir);
  403|       |
  404|  5.98k|    if (!readproc || !writeproc || !seekproc || !closeproc || !sizeproc)
  ------------------
  |  Branch (404:9): [True: 0, False: 5.98k]
  |  Branch (404:22): [True: 0, False: 5.98k]
  |  Branch (404:36): [True: 0, False: 5.98k]
  |  Branch (404:49): [True: 0, False: 5.98k]
  |  Branch (404:63): [True: 0, False: 5.98k]
  ------------------
  405|      0|    {
  406|      0|        TIFFErrorExtR(tif, module,
  407|      0|                      "One of the client procedures is NULL pointer.");
  408|      0|        _TIFFfreeExt(NULL, tif);
  409|      0|        goto bad2;
  410|      0|    }
  411|       |
  412|  5.98k|    _TIFFSetDefaultCompressionState(tif); /* setup default state */
  413|       |    /*
  414|       |     * Default is to return data MSB2LSB and enable the
  415|       |     * use of memory-mapped files and strip chopping when
  416|       |     * a file is opened read-only.
  417|       |     */
  418|  5.98k|    tif->tif_flags = FILLORDER_MSB2LSB;
  ------------------
  |  |  241|  5.98k|#define FILLORDER_MSB2LSB 1                /* most significant -> least */
  ------------------
  419|  5.98k|    if (m == O_RDONLY)
  ------------------
  |  Branch (419:9): [True: 5.98k, False: 0]
  ------------------
  420|  5.98k|        tif->tif_flags |= TIFF_MAPPED;
  ------------------
  |  |  130|  5.98k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  ------------------
  421|       |
  422|  5.98k|#ifdef STRIPCHOP_DEFAULT
  423|  5.98k|    if (m == O_RDONLY || m == O_RDWR)
  ------------------
  |  Branch (423:9): [True: 5.98k, False: 0]
  |  Branch (423:26): [True: 0, False: 0]
  ------------------
  424|  5.98k|        tif->tif_flags |= STRIPCHOP_DEFAULT;
  ------------------
  |  |  113|  5.98k|#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
  |  |  ------------------
  |  |  |  |  134|  5.98k|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  |  |  ------------------
  ------------------
  425|  5.98k|#endif
  426|       |
  427|       |    /*
  428|       |     * Process library-specific flags in the open mode string.
  429|       |     * The following flags may be used to control intrinsic library
  430|       |     * behavior that may or may not be desirable (usually for
  431|       |     * compatibility with some application that claims to support
  432|       |     * TIFF but only supports some brain dead idea of what the
  433|       |     * vendor thinks TIFF is):
  434|       |     *
  435|       |     * 'l' use little-endian byte order for creating a file
  436|       |     * 'b' use big-endian byte order for creating a file
  437|       |     * 'L' read/write information using LSB2MSB bit order
  438|       |     * 'B' read/write information using MSB2LSB bit order
  439|       |     * 'H' read/write information using host bit order
  440|       |     * 'M' enable use of memory-mapped files when supported
  441|       |     * 'm' disable use of memory-mapped files
  442|       |     * 'C' enable strip chopping support when reading
  443|       |     * 'c' disable strip chopping support
  444|       |     * 'h' read TIFF header only, do not load the first IFD
  445|       |     * '4' ClassicTIFF for creating a file (default)
  446|       |     * '8' BigTIFF for creating a file
  447|       |     * 'D' enable use of deferred strip/tile offset/bytecount array loading.
  448|       |     * 'O' on-demand loading of values instead of whole array loading (implies
  449|       |     * D)
  450|       |     *
  451|       |     * The use of the 'l' and 'b' flags is strongly discouraged.
  452|       |     * These flags are provided solely because numerous vendors,
  453|       |     * typically on the PC, do not correctly support TIFF; they
  454|       |     * only support the Intel little-endian byte order.  This
  455|       |     * support is not configured by default because it supports
  456|       |     * the violation of the TIFF spec that says that readers *MUST*
  457|       |     * support both byte orders.  It is strongly recommended that
  458|       |     * you not use this feature except to deal with busted apps
  459|       |     * that write invalid TIFF.  And even in those cases you should
  460|       |     * bang on the vendors to fix their software.
  461|       |     *
  462|       |     * The 'L', 'B', and 'H' flags are intended for applications
  463|       |     * that can optimize operations on data by using a particular
  464|       |     * bit order.  By default the library returns data in MSB2LSB
  465|       |     * bit order for compatibility with older versions of this
  466|       |     * library.  Returning data in the bit order of the native CPU
  467|       |     * makes the most sense but also requires applications to check
  468|       |     * the value of the FillOrder tag; something they probably do
  469|       |     * not do right now.
  470|       |     *
  471|       |     * The 'M' and 'm' flags are provided because some virtual memory
  472|       |     * systems exhibit poor behavior when large images are mapped.
  473|       |     * These options permit clients to control the use of memory-mapped
  474|       |     * files on a per-file basis.
  475|       |     *
  476|       |     * The 'C' and 'c' flags are provided because the library support
  477|       |     * for chopping up large strips into multiple smaller strips is not
  478|       |     * application-transparent and as such can cause problems.  The 'c'
  479|       |     * option permits applications that only want to look at the tags,
  480|       |     * for example, to get the unadulterated TIFF tag information.
  481|       |     */
  482|  17.9k|    for (cp = mode; *cp; cp++)
  ------------------
  |  Branch (482:21): [True: 11.9k, False: 5.98k]
  ------------------
  483|  11.9k|        switch (*cp)
  484|  11.9k|        {
  485|      0|            case 'b':
  ------------------
  |  Branch (485:13): [True: 0, False: 11.9k]
  ------------------
  486|      0|#if !WORDS_BIGENDIAN
  487|      0|                if (m & O_CREAT)
  ------------------
  |  Branch (487:21): [True: 0, False: 0]
  ------------------
  488|      0|                    tif->tif_flags |= TIFF_SWAB;
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  489|      0|#endif
  490|      0|                break;
  491|      0|            case 'l':
  ------------------
  |  Branch (491:13): [True: 0, False: 11.9k]
  ------------------
  492|       |#if WORDS_BIGENDIAN
  493|       |                if ((m & O_CREAT))
  494|       |                    tif->tif_flags |= TIFF_SWAB;
  495|       |#endif
  496|      0|                break;
  497|      0|            case 'B':
  ------------------
  |  Branch (497:13): [True: 0, False: 11.9k]
  ------------------
  498|      0|                tif->tif_flags =
  499|      0|                    (tif->tif_flags & ~TIFF_FILLORDER) | FILLORDER_MSB2LSB;
  ------------------
  |  |  120|      0|#define TIFF_FILLORDER 0x00003U   /* natural bit fill order for machine */
  ------------------
                                  (tif->tif_flags & ~TIFF_FILLORDER) | FILLORDER_MSB2LSB;
  ------------------
  |  |  241|      0|#define FILLORDER_MSB2LSB 1                /* most significant -> least */
  ------------------
  500|      0|                break;
  501|      0|            case 'L':
  ------------------
  |  Branch (501:13): [True: 0, False: 11.9k]
  ------------------
  502|      0|                tif->tif_flags =
  503|      0|                    (tif->tif_flags & ~TIFF_FILLORDER) | FILLORDER_LSB2MSB;
  ------------------
  |  |  120|      0|#define TIFF_FILLORDER 0x00003U   /* natural bit fill order for machine */
  ------------------
                                  (tif->tif_flags & ~TIFF_FILLORDER) | FILLORDER_LSB2MSB;
  ------------------
  |  |  242|      0|#define FILLORDER_LSB2MSB 2                /* least significant -> most */
  ------------------
  504|      0|                break;
  505|      0|            case 'H':
  ------------------
  |  Branch (505:13): [True: 0, False: 11.9k]
  ------------------
  506|      0|                TIFFWarningExtR(tif, name,
  507|      0|                                "H(ost) mode is deprecated. Since "
  508|      0|                                "libtiff 4.5.1, it is an alias of 'B' / "
  509|      0|                                "FILLORDER_MSB2LSB.");
  510|      0|                tif->tif_flags =
  511|      0|                    (tif->tif_flags & ~TIFF_FILLORDER) | FILLORDER_MSB2LSB;
  ------------------
  |  |  120|      0|#define TIFF_FILLORDER 0x00003U   /* natural bit fill order for machine */
  ------------------
                                  (tif->tif_flags & ~TIFF_FILLORDER) | FILLORDER_MSB2LSB;
  ------------------
  |  |  241|      0|#define FILLORDER_MSB2LSB 1                /* most significant -> least */
  ------------------
  512|      0|                break;
  513|      0|            case 'M':
  ------------------
  |  Branch (513:13): [True: 0, False: 11.9k]
  ------------------
  514|      0|                if (m == O_RDONLY)
  ------------------
  |  Branch (514:21): [True: 0, False: 0]
  ------------------
  515|      0|                    tif->tif_flags |= TIFF_MAPPED;
  ------------------
  |  |  130|      0|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  ------------------
  516|      0|                break;
  517|  5.98k|            case 'm':
  ------------------
  |  Branch (517:13): [True: 5.98k, False: 5.98k]
  ------------------
  518|  5.98k|                if (m == O_RDONLY)
  ------------------
  |  Branch (518:21): [True: 5.98k, False: 0]
  ------------------
  519|  5.98k|                    tif->tif_flags &= ~TIFF_MAPPED;
  ------------------
  |  |  130|  5.98k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  ------------------
  520|  5.98k|                break;
  521|      0|            case 'C':
  ------------------
  |  Branch (521:13): [True: 0, False: 11.9k]
  ------------------
  522|      0|                if (m == O_RDONLY)
  ------------------
  |  Branch (522:21): [True: 0, False: 0]
  ------------------
  523|      0|                    tif->tif_flags |= TIFF_STRIPCHOP;
  ------------------
  |  |  134|      0|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
  524|      0|                break;
  525|      0|            case 'c':
  ------------------
  |  Branch (525:13): [True: 0, False: 11.9k]
  ------------------
  526|      0|                if (m == O_RDONLY)
  ------------------
  |  Branch (526:21): [True: 0, False: 0]
  ------------------
  527|      0|                    tif->tif_flags &= ~TIFF_STRIPCHOP;
  ------------------
  |  |  134|      0|#define TIFF_STRIPCHOP 0x08000U   /* enable strip chopping support */
  ------------------
  528|      0|                break;
  529|      0|            case 'h':
  ------------------
  |  Branch (529:13): [True: 0, False: 11.9k]
  ------------------
  530|      0|                tif->tif_flags |= TIFF_HEADERONLY;
  ------------------
  |  |  136|      0|    0x10000U /* read header only, do not process the first directory */
  ------------------
  531|      0|                break;
  532|      0|            case '8':
  ------------------
  |  Branch (532:13): [True: 0, False: 11.9k]
  ------------------
  533|      0|                if (m & O_CREAT)
  ------------------
  |  Branch (533:21): [True: 0, False: 0]
  ------------------
  534|      0|                    tif->tif_flags |= TIFF_BIGTIFF;
  ------------------
  |  |  140|      0|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  535|      0|                break;
  536|      0|            case 'D':
  ------------------
  |  Branch (536:13): [True: 0, False: 11.9k]
  ------------------
  537|      0|                tif->tif_flags |= TIFF_DEFERSTRILELOAD;
  ------------------
  |  |  147|      0|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  538|      0|                break;
  539|      0|            case 'O':
  ------------------
  |  Branch (539:13): [True: 0, False: 11.9k]
  ------------------
  540|      0|                if (m == O_RDONLY)
  ------------------
  |  Branch (540:21): [True: 0, False: 0]
  ------------------
  541|      0|                    tif->tif_flags |=
  542|      0|                        (TIFF_LAZYSTRILELOAD_ASKED | TIFF_DEFERSTRILELOAD);
  ------------------
  |  |  156|      0|    0x8000000U /* set when lazy/ondemand loading of strip/tile                 \
  ------------------
                                      (TIFF_LAZYSTRILELOAD_ASKED | TIFF_DEFERSTRILELOAD);
  ------------------
  |  |  147|      0|    0x1000000U /* defer strip/tile offset/bytecount array loading. */
  ------------------
  543|      0|                break;
  544|  5.98k|            default:
  ------------------
  |  Branch (544:13): [True: 5.98k, False: 5.98k]
  ------------------
  545|  5.98k|                break;
  546|  11.9k|        }
  547|       |
  548|       |#ifdef DEFER_STRILE_LOAD
  549|       |    /* Compatibility with old DEFER_STRILE_LOAD compilation flag */
  550|       |    /* Probably unneeded, since to the best of my knowledge (E. Rouault) */
  551|       |    /* GDAL was the only user of this, and will now use the new 'D' flag */
  552|       |    tif->tif_flags |= TIFF_DEFERSTRILELOAD;
  553|       |#endif
  554|       |
  555|       |    /*
  556|       |     * Read in TIFF header.
  557|       |     */
  558|  5.98k|    if ((m & O_TRUNC) ||
  ------------------
  |  Branch (558:9): [True: 0, False: 5.98k]
  ------------------
  559|  5.98k|        !ReadOK(tif, &tif->tif_header, sizeof(TIFFHeaderClassic)))
  ------------------
  |  |  300|  5.98k|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|  5.98k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (559:9): [True: 0, False: 5.98k]
  ------------------
  560|      0|    {
  561|      0|        if (tif->tif_mode == O_RDONLY)
  ------------------
  |  Branch (561:13): [True: 0, False: 0]
  ------------------
  562|      0|        {
  563|      0|            TIFFErrorExtR(tif, name, "Cannot read TIFF header");
  564|      0|            goto bad;
  565|      0|        }
  566|       |        /*
  567|       |         * Setup header and write.
  568|       |         */
  569|       |#if WORDS_BIGENDIAN
  570|       |        tif->tif_header.common.tiff_magic =
  571|       |            (tif->tif_flags & TIFF_SWAB) ? TIFF_LITTLEENDIAN : TIFF_BIGENDIAN;
  572|       |#else
  573|      0|        tif->tif_header.common.tiff_magic =
  574|      0|            (tif->tif_flags & TIFF_SWAB) ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN;
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
                          (tif->tif_flags & TIFF_SWAB) ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN;
  ------------------
  |  |   51|      0|#define TIFF_BIGENDIAN 0x4d4d
  ------------------
                          (tif->tif_flags & TIFF_SWAB) ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN;
  ------------------
  |  |   52|      0|#define TIFF_LITTLEENDIAN 0x4949
  ------------------
  |  Branch (574:13): [True: 0, False: 0]
  ------------------
  575|      0|#endif
  576|      0|        TIFFHeaderUnion tif_header_swapped;
  577|      0|        if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|      0|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (577:13): [True: 0, False: 0]
  ------------------
  578|      0|        {
  579|      0|            tif->tif_header.common.tiff_version = TIFF_VERSION_CLASSIC;
  ------------------
  |  |   48|      0|#define TIFF_VERSION_CLASSIC 42
  ------------------
  580|      0|            tif->tif_header.classic.tiff_diroff = 0;
  581|      0|            tif->tif_header_size = sizeof(TIFFHeaderClassic);
  582|       |            /* Swapped copy for writing */
  583|      0|            _TIFFmemcpy(&tif_header_swapped, &tif->tif_header,
  584|      0|                        sizeof(TIFFHeaderUnion));
  585|      0|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (585:17): [True: 0, False: 0]
  ------------------
  586|      0|                TIFFSwabShort(&tif_header_swapped.common.tiff_version);
  587|      0|        }
  588|      0|        else
  589|      0|        {
  590|      0|            tif->tif_header.common.tiff_version = TIFF_VERSION_BIG;
  ------------------
  |  |   49|      0|#define TIFF_VERSION_BIG 43
  ------------------
  591|      0|            tif->tif_header.big.tiff_offsetsize = 8;
  592|      0|            tif->tif_header.big.tiff_unused = 0;
  593|      0|            tif->tif_header.big.tiff_diroff = 0;
  594|      0|            tif->tif_header_size = sizeof(TIFFHeaderBig);
  595|       |            /* Swapped copy for writing */
  596|      0|            _TIFFmemcpy(&tif_header_swapped, &tif->tif_header,
  597|      0|                        sizeof(TIFFHeaderUnion));
  598|      0|            if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|      0|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (598:17): [True: 0, False: 0]
  ------------------
  599|      0|            {
  600|      0|                TIFFSwabShort(&tif_header_swapped.common.tiff_version);
  601|      0|                TIFFSwabShort(&tif_header_swapped.big.tiff_offsetsize);
  602|      0|            }
  603|      0|        }
  604|       |        /*
  605|       |         * The doc for "fopen" for some STD_C_LIBs says that if you
  606|       |         * open a file for modify ("+"), then you must fseek (or
  607|       |         * fflush?) between any freads and fwrites.  This is not
  608|       |         * necessary on most systems, but has been shown to be needed
  609|       |         * on Solaris.
  610|       |         */
  611|      0|        TIFFSeekFile(tif, 0, SEEK_SET);
  ------------------
  |  |  287|      0|    ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
  ------------------
  612|      0|        if (!WriteOK(tif, &tif_header_swapped,
  ------------------
  |  |  307|      0|    (TIFFWriteFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  285|      0|    ((*(tif)->tif_writeproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (612:13): [True: 0, False: 0]
  ------------------
  613|      0|                     (tmsize_t)(tif->tif_header_size)))
  614|      0|        {
  615|      0|            TIFFErrorExtR(tif, name, "Error writing TIFF header");
  616|      0|            goto bad;
  617|      0|        }
  618|       |        /*
  619|       |         * Setup default directory.
  620|       |         */
  621|      0|        if (!TIFFDefaultDirectory(tif))
  ------------------
  |  Branch (621:13): [True: 0, False: 0]
  ------------------
  622|      0|            goto bad;
  623|      0|        tif->tif_diroff = 0;
  624|      0|        tif->tif_lastdiroff = 0;
  625|      0|        tif->tif_setdirectory_force_absolute = FALSE;
  ------------------
  |  |   72|      0|#define FALSE 0
  ------------------
  626|       |        /* tif_curdircount = 0 means 'empty file opened for writing, but no IFD
  627|       |         * written yet' */
  628|      0|        tif->tif_curdircount = 0;
  629|      0|        return (tif);
  630|      0|    }
  631|       |
  632|       |    /*
  633|       |     * Setup the byte order handling according to the opened file for reading.
  634|       |     */
  635|  5.98k|    if (tif->tif_header.common.tiff_magic != TIFF_BIGENDIAN &&
  ------------------
  |  |   51|  11.9k|#define TIFF_BIGENDIAN 0x4d4d
  ------------------
  |  Branch (635:9): [True: 5.72k, False: 262]
  ------------------
  636|  5.72k|        tif->tif_header.common.tiff_magic != TIFF_LITTLEENDIAN
  ------------------
  |  |   52|  11.7k|#define TIFF_LITTLEENDIAN 0x4949
  ------------------
  |  Branch (636:9): [True: 2, False: 5.72k]
  ------------------
  637|      2|#if MDI_SUPPORT
  638|      2|        &&
  639|       |#if HOST_BIGENDIAN
  640|       |        tif->tif_header.common.tiff_magic != MDI_BIGENDIAN
  641|       |#else
  642|      2|        tif->tif_header.common.tiff_magic != MDI_LITTLEENDIAN
  ------------------
  |  |   53|      2|#define MDI_LITTLEENDIAN 0x5045
  ------------------
  |  Branch (642:9): [True: 2, False: 0]
  ------------------
  643|  5.98k|#endif
  644|  5.98k|    )
  645|      2|    {
  646|      2|        TIFFErrorExtR(tif, name,
  647|      2|                      "Not a TIFF or MDI file, bad magic number %" PRIu16
  648|      2|                      " (0x%" PRIx16 ")",
  649|       |#else
  650|       |    )
  651|       |    {
  652|       |        TIFFErrorExtR(tif, name,
  653|       |                      "Not a TIFF file, bad magic number %" PRIu16
  654|       |                      " (0x%" PRIx16 ")",
  655|       |#endif
  656|      2|                      tif->tif_header.common.tiff_magic,
  657|      2|                      tif->tif_header.common.tiff_magic);
  658|      2|        goto bad;
  659|      2|    }
  660|  5.98k|    if (tif->tif_header.common.tiff_magic == TIFF_BIGENDIAN)
  ------------------
  |  |   51|  5.98k|#define TIFF_BIGENDIAN 0x4d4d
  ------------------
  |  Branch (660:9): [True: 262, False: 5.72k]
  ------------------
  661|    262|    {
  662|    262|#if !WORDS_BIGENDIAN
  663|    262|        tif->tif_flags |= TIFF_SWAB;
  ------------------
  |  |  126|    262|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  664|    262|#endif
  665|    262|    }
  666|  5.72k|    else
  667|  5.72k|    {
  668|       |#if WORDS_BIGENDIAN
  669|       |        tif->tif_flags |= TIFF_SWAB;
  670|       |#endif
  671|  5.72k|    }
  672|  5.98k|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  5.98k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (672:9): [True: 262, False: 5.72k]
  ------------------
  673|    262|        TIFFSwabShort(&tif->tif_header.common.tiff_version);
  674|  5.98k|    if ((tif->tif_header.common.tiff_version != TIFF_VERSION_CLASSIC) &&
  ------------------
  |  |   48|  5.98k|#define TIFF_VERSION_CLASSIC 42
  ------------------
  |  Branch (674:9): [True: 55, False: 5.92k]
  ------------------
  675|     55|        (tif->tif_header.common.tiff_version != TIFF_VERSION_BIG))
  ------------------
  |  |   49|     55|#define TIFF_VERSION_BIG 43
  ------------------
  |  Branch (675:9): [True: 0, False: 55]
  ------------------
  676|      0|    {
  677|      0|        TIFFErrorExtR(tif, name,
  678|      0|                      "Not a TIFF file, bad version number %" PRIu16
  679|      0|                      " (0x%" PRIx16 ")",
  680|      0|                      tif->tif_header.common.tiff_version,
  681|      0|                      tif->tif_header.common.tiff_version);
  682|      0|        goto bad;
  683|      0|    }
  684|  5.98k|    if (tif->tif_header.common.tiff_version == TIFF_VERSION_CLASSIC)
  ------------------
  |  |   48|  5.98k|#define TIFF_VERSION_CLASSIC 42
  ------------------
  |  Branch (684:9): [True: 5.92k, False: 55]
  ------------------
  685|  5.92k|    {
  686|  5.92k|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  5.92k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (686:13): [True: 258, False: 5.66k]
  ------------------
  687|    258|            TIFFSwabLong(&tif->tif_header.classic.tiff_diroff);
  688|  5.92k|        tif->tif_header_size = sizeof(TIFFHeaderClassic);
  689|  5.92k|    }
  690|     55|    else
  691|     55|    {
  692|     55|        if (!ReadOK(tif,
  ------------------
  |  |  300|     55|    (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
  |  |  ------------------
  |  |  |  |  283|     55|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  |  |  ------------------
  ------------------
  |  Branch (692:13): [True: 0, False: 55]
  ------------------
  693|     55|                    ((uint8_t *)(&tif->tif_header) + sizeof(TIFFHeaderClassic)),
  694|     55|                    (sizeof(TIFFHeaderBig) - sizeof(TIFFHeaderClassic))))
  695|      0|        {
  696|      0|            TIFFErrorExtR(tif, name, "Cannot read TIFF header");
  697|      0|            goto bad;
  698|      0|        }
  699|     55|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     55|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (699:13): [True: 4, False: 51]
  ------------------
  700|      4|        {
  701|      4|            TIFFSwabShort(&tif->tif_header.big.tiff_offsetsize);
  702|      4|            TIFFSwabLong8(&tif->tif_header.big.tiff_diroff);
  703|      4|        }
  704|     55|        if (tif->tif_header.big.tiff_offsetsize != 8)
  ------------------
  |  Branch (704:13): [True: 0, False: 55]
  ------------------
  705|      0|        {
  706|      0|            TIFFErrorExtR(tif, name,
  707|      0|                          "Not a TIFF file, bad BigTIFF offsetsize %" PRIu16
  708|      0|                          " (0x%" PRIx16 ")",
  709|      0|                          tif->tif_header.big.tiff_offsetsize,
  710|      0|                          tif->tif_header.big.tiff_offsetsize);
  711|      0|            goto bad;
  712|      0|        }
  713|     55|        if (tif->tif_header.big.tiff_unused != 0)
  ------------------
  |  Branch (713:13): [True: 0, False: 55]
  ------------------
  714|      0|        {
  715|      0|            TIFFErrorExtR(tif, name,
  716|      0|                          "Not a TIFF file, bad BigTIFF unused %" PRIu16
  717|      0|                          " (0x%" PRIx16 ")",
  718|      0|                          tif->tif_header.big.tiff_unused,
  719|      0|                          tif->tif_header.big.tiff_unused);
  720|      0|            goto bad;
  721|      0|        }
  722|     55|        tif->tif_header_size = sizeof(TIFFHeaderBig);
  723|     55|        tif->tif_flags |= TIFF_BIGTIFF;
  ------------------
  |  |  140|     55|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  724|     55|    }
  725|  5.98k|    tif->tif_flags |= TIFF_MYBUFFER;
  ------------------
  |  |  128|  5.98k|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  726|  5.98k|    tif->tif_rawcp = tif->tif_rawdata = 0;
  727|  5.98k|    tif->tif_rawdatasize = 0;
  728|  5.98k|    tif->tif_rawdataoff = 0;
  729|  5.98k|    tif->tif_rawdataloaded = 0;
  730|       |
  731|  5.98k|    switch (mode[0])
  732|  5.98k|    {
  733|  5.98k|        case 'r':
  ------------------
  |  Branch (733:9): [True: 5.98k, False: 0]
  ------------------
  734|  5.98k|            if (!(tif->tif_flags & TIFF_BIGTIFF))
  ------------------
  |  |  140|  5.98k|#define TIFF_BIGTIFF 0x80000U     /* read/write bigtiff */
  ------------------
  |  Branch (734:17): [True: 5.92k, False: 55]
  ------------------
  735|  5.92k|                tif->tif_nextdiroff = tif->tif_header.classic.tiff_diroff;
  736|     55|            else
  737|     55|                tif->tif_nextdiroff = tif->tif_header.big.tiff_diroff;
  738|       |            /*
  739|       |             * Try to use a memory-mapped file if the client
  740|       |             * has not explicitly suppressed usage with the
  741|       |             * 'm' flag in the open mode (see above).
  742|       |             */
  743|  5.98k|            if (tif->tif_flags & TIFF_MAPPED)
  ------------------
  |  |  130|  5.98k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  ------------------
  |  Branch (743:17): [True: 0, False: 5.98k]
  ------------------
  744|      0|            {
  745|      0|                toff_t n;
  746|      0|                if (TIFFMapFileContents(tif, (void **)(&tif->tif_base), &n))
  ------------------
  |  |  291|      0|    ((*(tif)->tif_mapproc)((tif)->tif_clientdata, (paddr), (psize)))
  |  |  ------------------
  |  |  |  Branch (291:5): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  747|      0|                {
  748|      0|                    tif->tif_size = (tmsize_t)n;
  749|      0|                    assert((toff_t)tif->tif_size == n);
  ------------------
  |  Branch (749:21): [True: 0, False: 0]
  |  Branch (749:21): [True: 0, False: 0]
  ------------------
  750|      0|                }
  751|      0|                else
  752|      0|                    tif->tif_flags &= ~TIFF_MAPPED;
  ------------------
  |  |  130|      0|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  ------------------
  753|      0|            }
  754|       |            /*
  755|       |             * Sometimes we do not want to read the first directory (for
  756|       |             * example, it may be broken) and want to proceed to other
  757|       |             * directories. I this case we use the TIFF_HEADERONLY flag to open
  758|       |             * file and return immediately after reading TIFF header.
  759|       |             * However, the pointer to TIFFSetField() and TIFFGetField()
  760|       |             * (i.e. tif->tif_tagmethods.vsetfield and
  761|       |             * tif->tif_tagmethods.vgetfield) need to be initialized, which is
  762|       |             * done in TIFFDefaultDirectory().
  763|       |             */
  764|  5.98k|            if (tif->tif_flags & TIFF_HEADERONLY)
  ------------------
  |  |  136|  5.98k|    0x10000U /* read header only, do not process the first directory */
  ------------------
  |  Branch (764:17): [True: 0, False: 5.98k]
  ------------------
  765|      0|            {
  766|      0|                if (!TIFFDefaultDirectory(tif))
  ------------------
  |  Branch (766:21): [True: 0, False: 0]
  ------------------
  767|      0|                    goto bad;
  768|      0|                return (tif);
  769|      0|            }
  770|       |
  771|       |            /*
  772|       |             * Setup initial directory.
  773|       |             */
  774|  5.98k|            if (TIFFReadDirectory(tif))
  ------------------
  |  Branch (774:17): [True: 4.38k, False: 1.59k]
  ------------------
  775|  4.38k|            {
  776|  4.38k|                return (tif);
  777|  4.38k|            }
  778|  1.59k|            break;
  779|  1.59k|        case 'a':
  ------------------
  |  Branch (779:9): [True: 0, False: 5.98k]
  ------------------
  780|       |            /*
  781|       |             * New directories are automatically append
  782|       |             * to the end of the directory chain when they
  783|       |             * are written out (see TIFFWriteDirectory).
  784|       |             */
  785|      0|            if (!TIFFDefaultDirectory(tif))
  ------------------
  |  Branch (785:17): [True: 0, False: 0]
  ------------------
  786|      0|                goto bad;
  787|      0|            return (tif);
  788|      0|        default:
  ------------------
  |  Branch (788:9): [True: 0, False: 5.98k]
  ------------------
  789|      0|            break;
  790|  5.98k|    }
  791|  1.59k|bad:
  792|  1.59k|    tif->tif_mode = O_RDONLY; /* XXX avoid flush */
  793|  1.59k|    TIFFCleanup(tif);
  794|  1.59k|bad2:
  795|  1.59k|    return ((TIFF *)0);
  796|  1.59k|}
TIFFFileName:
  805|  1.24k|const char *TIFFFileName(TIFF *tif) { return (tif->tif_name); }
TIFFIsTiled:
  866|  11.8k|int TIFFIsTiled(TIFF *tif) { return (isTiled(tif)); }
  ------------------
  |  |  278|  11.8k|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  11.8k|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------

TIFFInitPackBits:
  331|     32|{
  332|     32|    (void)scheme;
  333|     32|    tif->tif_decoderow = PackBitsDecode;
  334|     32|    tif->tif_decodestrip = PackBitsDecode;
  335|     32|    tif->tif_decodetile = PackBitsDecode;
  336|     32|#ifndef PACKBITS_READ_ONLY
  337|     32|    tif->tif_preencode = PackBitsPreEncode;
  338|     32|    tif->tif_postencode = PackBitsPostEncode;
  339|     32|    tif->tif_encoderow = PackBitsEncode;
  340|     32|    tif->tif_encodestrip = PackBitsEncodeChunk;
  341|     32|    tif->tif_encodetile = PackBitsEncodeChunk;
  342|     32|#endif
  343|     32|    tif->tif_getmaxcompressionratio = PackBitsGetMaxCompressionRatio;
  344|       |
  345|     32|    return (1);
  346|     32|}
tif_packbits.c:PackBitsDecode:
  244|    492|{
  245|    492|    static const char module[] = "PackBitsDecode";
  246|    492|    int8_t *bp;
  247|    492|    tmsize_t cc;
  248|    492|    long n;
  249|    492|    int b;
  250|       |
  251|    492|    (void)s;
  252|    492|    bp = (int8_t *)tif->tif_rawcp;
  253|    492|    cc = tif->tif_rawcc;
  254|   244k|    while (cc > 0 && occ > 0)
  ------------------
  |  Branch (254:12): [True: 244k, False: 4]
  |  Branch (254:22): [True: 243k, False: 469]
  ------------------
  255|   243k|    {
  256|   243k|        n = (long)*bp++;
  257|   243k|        cc--;
  258|   243k|        if (n < 0)
  ------------------
  |  Branch (258:13): [True: 19.1k, False: 224k]
  ------------------
  259|  19.1k|        {                  /* replicate next byte -n+1 times */
  260|  19.1k|            if (n == -128) /* nop */
  ------------------
  |  Branch (260:17): [True: 165, False: 19.0k]
  ------------------
  261|    165|                continue;
  262|  19.0k|            n = -n + 1;
  263|  19.0k|            if (occ < (tmsize_t)n)
  ------------------
  |  Branch (263:17): [True: 199, False: 18.8k]
  ------------------
  264|    199|            {
  265|    199|                TIFFWarningExtR(tif, module,
  266|    199|                                "Discarding %" TIFF_SSIZE_FORMAT
  267|    199|                                " bytes to avoid buffer overrun",
  268|    199|                                (tmsize_t)n - occ);
  269|    199|                n = (long)occ;
  270|    199|            }
  271|  19.0k|            if (cc == 0)
  ------------------
  |  Branch (271:17): [True: 0, False: 19.0k]
  ------------------
  272|      0|            {
  273|      0|                TIFFWarningExtR(
  274|      0|                    tif, module,
  275|      0|                    "Terminating PackBitsDecode due to lack of data.");
  276|      0|                break;
  277|      0|            }
  278|  19.0k|            occ -= n;
  279|  19.0k|            b = *bp++;
  280|  19.0k|            cc--;
  281|   421k|            while (n-- > 0)
  ------------------
  |  Branch (281:20): [True: 402k, False: 19.0k]
  ------------------
  282|   402k|                *op++ = (uint8_t)b;
  283|  19.0k|        }
  284|   224k|        else
  285|   224k|        { /* copy next n+1 bytes literally */
  286|   224k|            if (occ < (tmsize_t)(n + 1))
  ------------------
  |  Branch (286:17): [True: 227, False: 224k]
  ------------------
  287|    227|            {
  288|    227|                TIFFWarningExtR(tif, module,
  289|    227|                                "Discarding %" TIFF_SSIZE_FORMAT
  290|    227|                                " bytes to avoid buffer overrun",
  291|    227|                                (tmsize_t)n - occ + 1);
  292|    227|                n = (long)occ - 1;
  293|    227|            }
  294|   224k|            if (cc < (tmsize_t)(n + 1))
  ------------------
  |  Branch (294:17): [True: 19, False: 224k]
  ------------------
  295|     19|            {
  296|     19|                TIFFWarningExtR(
  297|     19|                    tif, module,
  298|     19|                    "Terminating PackBitsDecode due to lack of data.");
  299|     19|                break;
  300|     19|            }
  301|   224k|            _TIFFmemcpy(op, bp, ++n);
  302|   224k|            op += n;
  303|   224k|            occ -= n;
  304|   224k|            bp += n;
  305|   224k|            cc -= n;
  306|   224k|        }
  307|   243k|    }
  308|    492|    tif->tif_rawcp = (uint8_t *)bp;
  309|    492|    tif->tif_rawcc = cc;
  310|    492|    if (occ > 0)
  ------------------
  |  Branch (310:9): [True: 22, False: 470]
  ------------------
  311|     22|    {
  312|     22|        memset(op, 0, (size_t)occ);
  313|     22|        TIFFErrorExtR(tif, module, "Not enough data for scanline %" PRIu32,
  314|     22|                      tif->tif_dir.td_row);
  315|     22|        return (0);
  316|     22|    }
  317|    470|    return (1);
  318|    492|}

TIFFInitPixarLog:
 1804|    162|{
 1805|    162|    static const char module[] = "TIFFInitPixarLog";
 1806|       |
 1807|    162|    PixarLogState *sp;
 1808|       |
 1809|    162|    (void)scheme;
 1810|    162|    assert(scheme == COMPRESSION_PIXARLOG);
  ------------------
  |  Branch (1810:5): [True: 0, False: 162]
  |  Branch (1810:5): [True: 162, False: 0]
  ------------------
 1811|       |
 1812|       |    /*
 1813|       |     * Merge codec-specific tag information.
 1814|       |     */
 1815|    162|    if (!_TIFFMergeFields(tif, pixarlogFields, TIFFArrayCount(pixarlogFields)))
  ------------------
  |  |  339|    162|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1815:9): [True: 0, False: 162]
  ------------------
 1816|      0|    {
 1817|      0|        TIFFErrorExtR(tif, module,
 1818|      0|                      "Merging PixarLog codec-specific tags failed");
 1819|      0|        return 0;
 1820|      0|    }
 1821|       |
 1822|       |    /*
 1823|       |     * Allocate state block so tag methods have storage to record values.
 1824|       |     */
 1825|    162|    tif->tif_data = (uint8_t *)_TIFFmallocExt(tif, sizeof(PixarLogState));
 1826|    162|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (1826:9): [True: 0, False: 162]
  ------------------
 1827|      0|        goto bad;
 1828|    162|    sp = (PixarLogState *)tif->tif_data;
 1829|    162|    _TIFFmemset(sp, 0, sizeof(*sp));
 1830|    162|    sp->stream.data_type = Z_BINARY;
 1831|    162|    sp->user_datafmt = PIXARLOGDATAFMT_UNKNOWN;
  ------------------
  |  |  765|    162|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
 1832|       |
 1833|       |    /*
 1834|       |     * Install codec methods.
 1835|       |     */
 1836|    162|    tif->tif_fixuptags = PixarLogFixupTags;
 1837|    162|    tif->tif_setupdecode = PixarLogSetupDecode;
 1838|    162|    tif->tif_predecode = PixarLogPreDecode;
 1839|    162|    tif->tif_decoderow = PixarLogDecode;
 1840|    162|    tif->tif_decodestrip = PixarLogDecode;
 1841|    162|    tif->tif_decodetile = PixarLogDecode;
 1842|    162|    tif->tif_setupencode = PixarLogSetupEncode;
 1843|    162|    tif->tif_preencode = PixarLogPreEncode;
 1844|    162|    tif->tif_postencode = PixarLogPostEncode;
 1845|    162|    tif->tif_encoderow = PixarLogEncode;
 1846|    162|    tif->tif_encodestrip = PixarLogEncode;
 1847|    162|    tif->tif_encodetile = PixarLogEncode;
 1848|    162|    tif->tif_close = PixarLogClose;
 1849|    162|    tif->tif_cleanup = PixarLogCleanup;
 1850|    162|    tif->tif_getmaxcompressionratio = PixarLogGetMaxCompressionRatio;
 1851|       |
 1852|       |    /* Override SetField so we can handle our private pseudo-tag */
 1853|    162|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1854|    162|    tif->tif_tagmethods.vgetfield = PixarLogVGetField; /* hook for codec tags */
 1855|    162|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1856|    162|    tif->tif_tagmethods.vsetfield = PixarLogVSetField; /* hook for codec tags */
 1857|       |
 1858|       |    /* Default values for codec-specific fields */
 1859|    162|    sp->quality = Z_DEFAULT_COMPRESSION; /* default comp. level */
 1860|    162|    sp->state = 0;
 1861|       |
 1862|       |    /* we don't wish to use the predictor,
 1863|       |     * the default is none, which predictor value 1
 1864|       |     */
 1865|    162|    (void)TIFFPredictorInit(tif);
 1866|       |
 1867|       |    /*
 1868|       |     * build the companding tables
 1869|       |     */
 1870|    162|    PixarLogMakeTables(tif, sp);
 1871|       |
 1872|    162|    return (1);
 1873|      0|bad:
 1874|      0|    TIFFErrorExtR(tif, module, "No space for PixarLog state block");
 1875|      0|    return (0);
 1876|    162|}
tif_pixarlog.c:PixarLogFixupTags:
  822|    152|{
  823|    152|    (void)tif;
  824|    152|    return (1);
  825|    152|}
tif_pixarlog.c:PixarLogSetupDecode:
  828|    155|{
  829|    155|    static const char module[] = "PixarLogSetupDecode";
  830|    155|    TIFFDirectory *td = &tif->tif_dir;
  831|    155|    PixarLogState *sp = PixarLogDecoderState(tif);
  ------------------
  |  |  759|    155|#define PixarLogDecoderState(tif) ((PixarLogState *)(tif)->tif_data)
  ------------------
  832|    155|    tmsize_t tbuf_size;
  833|    155|    uint32_t strip_height;
  834|       |
  835|    155|    assert(sp != NULL);
  ------------------
  |  Branch (835:5): [True: 0, False: 155]
  |  Branch (835:5): [True: 155, False: 0]
  ------------------
  836|       |
  837|       |    /* This function can possibly be called several times by */
  838|       |    /* PredictorSetupDecode() if this function succeeds but */
  839|       |    /* PredictorSetup() fails */
  840|    155|    if ((sp->state & PLSTATE_INIT) != 0)
  ------------------
  |  |  615|    155|#define PLSTATE_INIT 1
  ------------------
  |  Branch (840:9): [True: 1, False: 154]
  ------------------
  841|      1|        return 1;
  842|       |
  843|    154|    strip_height = td->td_rowsperstrip;
  844|    154|    if (strip_height > td->td_imagelength)
  ------------------
  |  Branch (844:9): [True: 133, False: 21]
  ------------------
  845|    133|        strip_height = td->td_imagelength;
  846|       |
  847|       |    /* Make sure no byte swapping happens on the data
  848|       |     * after decompression. */
  849|    154|    tif->tif_postdecode = _TIFFNoPostDecode;
  850|       |
  851|       |    /* for some reason, we can't do this in TIFFInitPixarLog */
  852|       |
  853|    154|    sp->stride =
  854|    154|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|    154|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (854:10): [True: 142, False: 12]
  ------------------
  855|    154|                                                    : 1);
  856|    154|    tbuf_size = multiply_ms(
  857|    154|        multiply_ms(multiply_ms(sp->stride, td->td_imagewidth), strip_height),
  858|    154|        sizeof(uint16_t));
  859|       |    /* add one more stride in case input ends mid-stride */
  860|    154|    tbuf_size =
  861|    154|        add_ms(tbuf_size, (tmsize_t)(sizeof(uint16_t) * (size_t)sp->stride));
  862|    154|    if (tbuf_size == 0)
  ------------------
  |  Branch (862:9): [True: 0, False: 154]
  ------------------
  863|      0|        return (0); /* TODO: this is an error return without error report
  864|       |                       through TIFFErrorExt */
  865|    154|    sp->tbuf = (uint16_t *)_TIFFmallocExt(tif, tbuf_size);
  866|    154|    if (sp->tbuf == NULL)
  ------------------
  |  Branch (866:9): [True: 0, False: 154]
  ------------------
  867|      0|        return (0);
  868|    154|    sp->tbuf_size = tbuf_size;
  869|    154|    if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
  ------------------
  |  |  765|    154|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (869:9): [True: 154, False: 0]
  ------------------
  870|    154|        sp->user_datafmt = PixarLogGuessDataFmt(td);
  871|    154|    if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
  ------------------
  |  |  765|    154|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
  |  Branch (871:9): [True: 11, False: 143]
  ------------------
  872|     11|    {
  873|     11|        _TIFFfreeExt(tif, sp->tbuf);
  874|     11|        sp->tbuf = NULL;
  875|     11|        sp->tbuf_size = 0;
  876|     11|        TIFFErrorExtR(tif, module,
  877|     11|                      "PixarLog compression can't handle bits depth/data "
  878|     11|                      "format combination (depth: %" PRIu16 ")",
  879|     11|                      td->td_bitspersample);
  880|     11|        return (0);
  881|     11|    }
  882|       |
  883|    143|    if (inflateInit(&sp->stream) != Z_OK)
  ------------------
  |  Branch (883:9): [True: 0, False: 143]
  ------------------
  884|      0|    {
  885|      0|        _TIFFfreeExt(tif, sp->tbuf);
  886|      0|        sp->tbuf = NULL;
  887|      0|        sp->tbuf_size = 0;
  888|      0|        TIFFErrorExtR(tif, module, "%s",
  889|      0|                      sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (889:23): [True: 0, False: 0]
  ------------------
  890|      0|        return (0);
  891|      0|    }
  892|    143|    else
  893|    143|    {
  894|    143|        sp->state |= PLSTATE_INIT;
  ------------------
  |  |  615|    143|#define PLSTATE_INIT 1
  ------------------
  895|    143|        return (1);
  896|    143|    }
  897|    143|}
tif_pixarlog.c:multiply_ms:
  805|    462|{
  806|    462|    return _TIFFMultiplySSize(NULL, m1, m2, NULL);
  807|    462|}
tif_pixarlog.c:add_ms:
  810|    154|{
  811|    154|    assert(m1 >= 0 && m2 >= 0);
  ------------------
  |  Branch (811:5): [True: 0, False: 154]
  |  Branch (811:5): [True: 0, False: 0]
  |  Branch (811:5): [True: 154, False: 0]
  |  Branch (811:5): [True: 154, False: 0]
  ------------------
  812|       |    /* if either input is zero, assume overflow already occurred */
  813|    154|    if (m1 == 0 || m2 == 0)
  ------------------
  |  Branch (813:9): [True: 0, False: 154]
  |  Branch (813:20): [True: 0, False: 154]
  ------------------
  814|      0|        return 0;
  815|    154|    else if (m1 > TIFF_TMSIZE_T_MAX - m2)
  ------------------
  |  |   68|    154|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (815:14): [True: 0, False: 154]
  ------------------
  816|      0|        return 0;
  817|       |
  818|    154|    return m1 + m2;
  819|    154|}
tif_pixarlog.c:PixarLogGuessDataFmt:
  768|    154|{
  769|    154|    int guess = PIXARLOGDATAFMT_UNKNOWN;
  ------------------
  |  |  765|    154|#define PIXARLOGDATAFMT_UNKNOWN -1
  ------------------
  770|    154|    int format = td->td_sampleformat;
  771|       |
  772|       |    /* If the user didn't tell us his datafmt,
  773|       |     * take our best guess from the bitspersample.
  774|       |     */
  775|    154|    switch (td->td_bitspersample)
  776|    154|    {
  777|      0|        case 32:
  ------------------
  |  Branch (777:9): [True: 0, False: 154]
  ------------------
  778|      0|            if (format == SAMPLEFORMAT_IEEEFP)
  ------------------
  |  |  336|      0|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  |  Branch (778:17): [True: 0, False: 0]
  ------------------
  779|      0|                guess = PIXARLOGDATAFMT_FLOAT;
  ------------------
  |  |  720|      0|#define PIXARLOGDATAFMT_FLOAT 5       /* IEEE float samples */
  ------------------
  780|      0|            break;
  781|     54|        case 16:
  ------------------
  |  Branch (781:9): [True: 54, False: 100]
  ------------------
  782|     54|            if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  337|    108|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
                          if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  334|     53|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  |  Branch (782:17): [True: 1, False: 53]
  |  Branch (782:48): [True: 51, False: 2]
  ------------------
  783|     52|                guess = PIXARLOGDATAFMT_16BIT;
  ------------------
  |  |  719|     52|#define PIXARLOGDATAFMT_16BIT 4       /* signed short samples */
  ------------------
  784|     54|            break;
  785|     16|        case 12:
  ------------------
  |  Branch (785:9): [True: 16, False: 138]
  ------------------
  786|     16|            if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_INT)
  ------------------
  |  |  337|     32|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
                          if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_INT)
  ------------------
  |  |  335|     16|#define SAMPLEFORMAT_INT 2                 /* !signed integer data */
  ------------------
  |  Branch (786:17): [True: 0, False: 16]
  |  Branch (786:48): [True: 15, False: 1]
  ------------------
  787|     15|                guess = PIXARLOGDATAFMT_12BITPICIO;
  ------------------
  |  |  718|     15|#define PIXARLOGDATAFMT_12BITPICIO 3  /* as per PICIO (1.0==2048) */
  ------------------
  788|     16|            break;
  789|      1|        case 11:
  ------------------
  |  Branch (789:9): [True: 1, False: 153]
  ------------------
  790|      1|            if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  337|      2|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
                          if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  334|      0|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  |  Branch (790:17): [True: 1, False: 0]
  |  Branch (790:48): [True: 0, False: 0]
  ------------------
  791|      1|                guess = PIXARLOGDATAFMT_11BITLOG;
  ------------------
  |  |  717|      1|#define PIXARLOGDATAFMT_11BITLOG 2    /* 11-bit log-encoded (raw) */
  ------------------
  792|      1|            break;
  793|     77|        case 8:
  ------------------
  |  Branch (793:9): [True: 77, False: 77]
  ------------------
  794|     77|            if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  337|    154|#define SAMPLEFORMAT_VOID 4                /* !untyped data */
  ------------------
                          if (format == SAMPLEFORMAT_VOID || format == SAMPLEFORMAT_UINT)
  ------------------
  |  |  334|     76|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
  |  Branch (794:17): [True: 1, False: 76]
  |  Branch (794:48): [True: 74, False: 2]
  ------------------
  795|     75|                guess = PIXARLOGDATAFMT_8BIT;
  ------------------
  |  |  715|     75|#define PIXARLOGDATAFMT_8BIT 0        /* regular u_char samples */
  ------------------
  796|     77|            break;
  797|      6|        default:
  ------------------
  |  Branch (797:9): [True: 6, False: 148]
  ------------------
  798|      6|            break;
  799|    154|    }
  800|       |
  801|    154|    return guess;
  802|    154|}
tif_pixarlog.c:PixarLogPreDecode:
  903|  10.1k|{
  904|  10.1k|    static const char module[] = "PixarLogPreDecode";
  905|  10.1k|    PixarLogState *sp = PixarLogDecoderState(tif);
  ------------------
  |  |  759|  10.1k|#define PixarLogDecoderState(tif) ((PixarLogState *)(tif)->tif_data)
  ------------------
  906|       |
  907|  10.1k|    (void)s;
  908|  10.1k|    assert(sp != NULL);
  ------------------
  |  Branch (908:5): [True: 0, False: 10.1k]
  |  Branch (908:5): [True: 10.1k, False: 0]
  ------------------
  909|  10.1k|    sp->stream.next_in = tif->tif_rawdata;
  910|  10.1k|    assert(sizeof(sp->stream.avail_in) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (910:5): [True: 0, Folded]
  |  Branch (910:5): [True: 10.1k, Folded]
  ------------------
  911|       |         we need to simplify this code to reflect a ZLib that is likely updated
  912|       |         to deal with 8byte memory sizes, though this code will respond
  913|       |         appropriately even before we simplify it */
  914|  10.1k|    sp->stream.avail_in = (uInt)tif->tif_rawcc;
  915|  10.1k|    if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc)
  ------------------
  |  Branch (915:9): [True: 0, False: 10.1k]
  ------------------
  916|      0|    {
  917|      0|        TIFFErrorExtR(tif, module, "ZLib cannot deal with buffers this size");
  918|      0|        return (0);
  919|      0|    }
  920|  10.1k|    return (inflateReset(&sp->stream) == Z_OK);
  921|  10.1k|}
tif_pixarlog.c:PixarLogDecode:
  924|  10.6k|{
  925|  10.6k|    static const char module[] = "PixarLogDecode";
  926|  10.6k|    TIFFDirectory *td = &tif->tif_dir;
  927|  10.6k|    PixarLogState *sp = PixarLogDecoderState(tif);
  ------------------
  |  |  759|  10.6k|#define PixarLogDecoderState(tif) ((PixarLogState *)(tif)->tif_data)
  ------------------
  928|  10.6k|    tmsize_t i;
  929|  10.6k|    tmsize_t nsamples;
  930|  10.6k|    tmsize_t llen;
  931|  10.6k|    uint16_t *up;
  932|       |
  933|  10.6k|    switch (sp->user_datafmt)
  934|  10.6k|    {
  935|      0|        case PIXARLOGDATAFMT_FLOAT:
  ------------------
  |  |  720|      0|#define PIXARLOGDATAFMT_FLOAT 5       /* IEEE float samples */
  ------------------
  |  Branch (935:9): [True: 0, False: 10.6k]
  ------------------
  936|      0|            nsamples = (tmsize_t)((uint64_t)occ /
  937|      0|                                  sizeof(float)); /* XXX float == 32 bits */
  938|      0|            break;
  939|  4.55k|        case PIXARLOGDATAFMT_16BIT:
  ------------------
  |  |  719|  4.55k|#define PIXARLOGDATAFMT_16BIT 4       /* signed short samples */
  ------------------
  |  Branch (939:9): [True: 4.55k, False: 6.12k]
  ------------------
  940|  5.10k|        case PIXARLOGDATAFMT_12BITPICIO:
  ------------------
  |  |  718|  5.10k|#define PIXARLOGDATAFMT_12BITPICIO 3  /* as per PICIO (1.0==2048) */
  ------------------
  |  Branch (940:9): [True: 550, False: 10.1k]
  ------------------
  941|  5.10k|        case PIXARLOGDATAFMT_11BITLOG:
  ------------------
  |  |  717|  5.10k|#define PIXARLOGDATAFMT_11BITLOG 2    /* 11-bit log-encoded (raw) */
  ------------------
  |  Branch (941:9): [True: 1, False: 10.6k]
  ------------------
  942|  5.10k|            nsamples =
  943|  5.10k|                (tmsize_t)((uint64_t)occ /
  944|  5.10k|                           sizeof(uint16_t)); /* XXX uint16_t == 16 bits */
  945|  5.10k|            break;
  946|  5.57k|        case PIXARLOGDATAFMT_8BIT:
  ------------------
  |  |  715|  5.57k|#define PIXARLOGDATAFMT_8BIT 0        /* regular u_char samples */
  ------------------
  |  Branch (946:9): [True: 5.57k, False: 5.10k]
  ------------------
  947|  5.57k|        case PIXARLOGDATAFMT_8BITABGR:
  ------------------
  |  |  716|  5.57k|#define PIXARLOGDATAFMT_8BITABGR 1    /* ABGR-order u_chars */
  ------------------
  |  Branch (947:9): [True: 0, False: 10.6k]
  ------------------
  948|  5.57k|            nsamples = occ;
  949|  5.57k|            break;
  950|      0|        default:
  ------------------
  |  Branch (950:9): [True: 0, False: 10.6k]
  ------------------
  951|      0|            TIFFErrorExtR(tif, module,
  952|      0|                          "%" PRIu16 " bit input not supported in PixarLog",
  953|      0|                          td->td_bitspersample);
  954|      0|            memset(op, 0, (size_t)occ);
  955|      0|            return 0;
  956|  10.6k|    }
  957|       |
  958|       |    /* stride (≤ td_samplesperpixel, max 65535) × imagewidth: fits tmsize_t */
  959|  10.6k|    llen = (tmsize_t)sp->stride * td->td_imagewidth;
  960|       |
  961|       |    /* Fix: ABGR with stride=3 expands 3 samples to 4 output bytes per pixel */
  962|  10.6k|    if (sp->user_datafmt == PIXARLOGDATAFMT_8BITABGR && sp->stride == 3)
  ------------------
  |  |  716|  21.3k|#define PIXARLOGDATAFMT_8BITABGR 1    /* ABGR-order u_chars */
  ------------------
  |  Branch (962:9): [True: 0, False: 10.6k]
  |  Branch (962:57): [True: 0, False: 0]
  ------------------
  963|      0|    {
  964|       |        /* imagewidth × 4: fits tmsize_t (imagewidth is uint32) */
  965|      0|        tmsize_t required = (tmsize_t)td->td_imagewidth * 4;
  966|      0|        tmsize_t max_rows;
  967|      0|        tmsize_t max_nsamples;
  968|       |
  969|       |        /*
  970|       |         * Ensure at least one expanded output row fits.
  971|       |         */
  972|      0|        if (occ < required)
  ------------------
  |  Branch (972:13): [True: 0, False: 0]
  ------------------
  973|      0|        {
  974|      0|            TIFFErrorExtR(tif, module,
  975|      0|                          "Output buffer too small for PixarLog ABGR data");
  976|      0|            memset(op, 0, (size_t)occ);
  977|      0|            return (0);
  978|      0|        }
  979|       |
  980|       |        /*
  981|       |         * The caller-provided output buffer size must represent a whole
  982|       |         * number of expanded ABGR scanlines.
  983|       |         */
  984|      0|        if (occ % required)
  ------------------
  |  Branch (984:13): [True: 0, False: 0]
  ------------------
  985|      0|        {
  986|      0|            TIFFErrorExtR(
  987|      0|                tif, module,
  988|      0|                "Fractional scanline not supported for PixarLog ABGR data");
  989|      0|            memset(op, 0, (size_t)occ);
  990|      0|            return (0);
  991|      0|        }
  992|       |
  993|       |        /*
  994|       |         * PixarLogDecode() may process multiple rows per call
  995|       |         * (e.g. strip decoding). Limit nsamples so the total
  996|       |         * output written by the loop below never exceeds occ.
  997|       |         */
  998|      0|        max_rows = occ / required;
  999|      0|        max_nsamples = max_rows * llen;
 1000|       |
 1001|      0|        if (nsamples > max_nsamples)
  ------------------
  |  Branch (1001:13): [True: 0, False: 0]
  ------------------
 1002|      0|        {
 1003|      0|            TIFFErrorExtR(tif, module,
 1004|      0|                          "Output buffer too small for PixarLog ABGR data");
 1005|      0|            memset(op, 0, (size_t)occ);
 1006|      0|            return (0);
 1007|      0|        }
 1008|      0|    }
 1009|       |
 1010|  10.6k|    (void)s;
 1011|  10.6k|    assert(sp != NULL);
  ------------------
  |  Branch (1011:5): [True: 0, False: 10.6k]
  |  Branch (1011:5): [True: 10.6k, False: 0]
  ------------------
 1012|       |
 1013|  10.6k|    sp->stream.next_in = tif->tif_rawcp;
 1014|  10.6k|    sp->stream.avail_in = (uInt)tif->tif_rawcc;
 1015|       |
 1016|  10.6k|    sp->stream.next_out = (unsigned char *)sp->tbuf;
 1017|  10.6k|    assert(sizeof(sp->stream.avail_out) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (1017:5): [True: 0, Folded]
  |  Branch (1017:5): [True: 10.6k, Folded]
  ------------------
 1018|       |         we need to simplify this code to reflect a ZLib that is likely updated
 1019|       |         to deal with 8byte memory sizes, though this code will respond
 1020|       |         appropriately even before we simplify it */
 1021|  10.6k|    sp->stream.avail_out = (uInt)((unsigned long)nsamples * sizeof(uint16_t));
 1022|  10.6k|    if (sp->stream.avail_out != (unsigned long)nsamples * sizeof(uint16_t))
  ------------------
  |  Branch (1022:9): [True: 0, False: 10.6k]
  ------------------
 1023|      0|    {
 1024|      0|        TIFFErrorExtR(tif, module, "ZLib cannot deal with buffers this size");
 1025|      0|        memset(op, 0, (size_t)occ);
 1026|      0|        return (0);
 1027|      0|    }
 1028|       |    /* Check that we will not fill more than what was allocated */
 1029|  10.6k|    if ((tmsize_t)sp->stream.avail_out > sp->tbuf_size)
  ------------------
  |  Branch (1029:9): [True: 318, False: 10.3k]
  ------------------
 1030|    318|    {
 1031|    318|        TIFFErrorExtR(tif, module, "sp->stream.avail_out > sp->tbuf_size");
 1032|    318|        memset(op, 0, (size_t)occ);
 1033|    318|        return (0);
 1034|    318|    }
 1035|  10.3k|    do
 1036|  11.6k|    {
 1037|  11.6k|        int state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
 1038|  11.6k|        if (state == Z_STREAM_END)
  ------------------
  |  Branch (1038:13): [True: 209, False: 11.4k]
  ------------------
 1039|    209|        {
 1040|    209|            break; /* XXX */
 1041|    209|        }
 1042|  11.4k|        if (state == Z_DATA_ERROR)
  ------------------
  |  Branch (1042:13): [True: 6.25k, False: 5.17k]
  ------------------
 1043|  6.25k|        {
 1044|  6.25k|            TIFFErrorExtR(tif, module,
 1045|  6.25k|                          "Decoding error at scanline %" PRIu32 ", %s",
 1046|  6.25k|                          tif->tif_dir.td_row,
 1047|  6.25k|                          sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (1047:27): [True: 6.25k, False: 0]
  ------------------
 1048|  6.25k|            memset(op, 0, (size_t)occ);
 1049|  6.25k|            return (0);
 1050|  6.25k|        }
 1051|  5.17k|        if (state != Z_OK)
  ------------------
  |  Branch (1051:13): [True: 1.28k, False: 3.89k]
  ------------------
 1052|  1.28k|        {
 1053|  1.28k|            TIFFErrorExtR(tif, module, "ZLib error: %s",
 1054|  1.28k|                          sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (1054:27): [True: 0, False: 1.28k]
  ------------------
 1055|  1.28k|            memset(op, 0, (size_t)occ);
 1056|  1.28k|            return (0);
 1057|  1.28k|        }
 1058|  5.17k|    } while (sp->stream.avail_out > 0);
  ------------------
  |  Branch (1058:14): [True: 1.28k, False: 2.61k]
  ------------------
 1059|       |
 1060|       |    /* hopefully, we got all the bytes we needed */
 1061|  2.82k|    if (sp->stream.avail_out != 0)
  ------------------
  |  Branch (1061:9): [True: 209, False: 2.61k]
  ------------------
 1062|    209|    {
 1063|    209|        TIFFErrorExtR(tif, module,
 1064|    209|                      "Not enough data at scanline %" PRIu32
 1065|    209|                      " (short %u bytes)",
 1066|    209|                      tif->tif_dir.td_row, sp->stream.avail_out);
 1067|    209|        memset(op, 0, (size_t)occ);
 1068|    209|        return (0);
 1069|    209|    }
 1070|       |
 1071|  2.61k|    tif->tif_rawcp = sp->stream.next_in;
 1072|  2.61k|    tif->tif_rawcc = sp->stream.avail_in;
 1073|       |
 1074|  2.61k|    up = sp->tbuf;
 1075|       |    /* Swap bytes in the data if from a different endian machine. */
 1076|  2.61k|    if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|  2.61k|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (1076:9): [True: 0, False: 2.61k]
  ------------------
 1077|      0|        TIFFSwabArrayOfShort(up, nsamples);
 1078|       |
 1079|       |    /*
 1080|       |     * if llen is not an exact multiple of nsamples, the decode operation
 1081|       |     * may overflow the output buffer, so truncate it enough to prevent
 1082|       |     * that but still salvage as much data as possible.
 1083|       |     */
 1084|  2.61k|    if (nsamples % llen)
  ------------------
  |  Branch (1084:9): [True: 509, False: 2.10k]
  ------------------
 1085|    509|    {
 1086|    509|        TIFFWarningExtR(tif, module,
 1087|    509|                        "stride %" TIFF_SSIZE_FORMAT
 1088|    509|                        " is not a multiple of sample count, "
 1089|    509|                        "%" TIFF_SSIZE_FORMAT ", data truncated.",
 1090|    509|                        llen, nsamples);
 1091|    509|        nsamples -= nsamples % llen;
 1092|    509|    }
 1093|       |
 1094|  7.91k|    for (i = 0; i < nsamples; i += llen, up += llen)
  ------------------
  |  Branch (1094:17): [True: 5.30k, False: 2.61k]
  ------------------
 1095|  5.30k|    {
 1096|  5.30k|        switch (sp->user_datafmt)
 1097|  5.30k|        {
 1098|      0|            case PIXARLOGDATAFMT_FLOAT:
  ------------------
  |  |  720|      0|#define PIXARLOGDATAFMT_FLOAT 5       /* IEEE float samples */
  ------------------
  |  Branch (1098:13): [True: 0, False: 5.30k]
  ------------------
 1099|      0|                horizontalAccumulateF(up, llen, sp->stride, op, sp->ToLinearF);
 1100|      0|                op += (unsigned long)llen * sizeof(float);
 1101|      0|                break;
 1102|  1.52k|            case PIXARLOGDATAFMT_16BIT:
  ------------------
  |  |  719|  1.52k|#define PIXARLOGDATAFMT_16BIT 4       /* signed short samples */
  ------------------
  |  Branch (1102:13): [True: 1.52k, False: 3.77k]
  ------------------
 1103|  1.52k|                horizontalAccumulate16(up, llen, sp->stride, op,
 1104|  1.52k|                                       sp->ToLinear16);
 1105|  1.52k|                op += (unsigned long)llen * sizeof(uint16_t);
 1106|  1.52k|                break;
 1107|    527|            case PIXARLOGDATAFMT_12BITPICIO:
  ------------------
  |  |  718|    527|#define PIXARLOGDATAFMT_12BITPICIO 3  /* as per PICIO (1.0==2048) */
  ------------------
  |  Branch (1107:13): [True: 527, False: 4.77k]
  ------------------
 1108|    527|                horizontalAccumulate12(up, llen, sp->stride, op, sp->ToLinearF);
 1109|    527|                op += (unsigned long)llen * sizeof(int16_t);
 1110|    527|                break;
 1111|      0|            case PIXARLOGDATAFMT_11BITLOG:
  ------------------
  |  |  717|      0|#define PIXARLOGDATAFMT_11BITLOG 2    /* 11-bit log-encoded (raw) */
  ------------------
  |  Branch (1111:13): [True: 0, False: 5.30k]
  ------------------
 1112|      0|                horizontalAccumulate11(up, llen, sp->stride, op);
 1113|      0|                op += (unsigned long)llen * sizeof(uint16_t);
 1114|      0|                break;
 1115|  3.24k|            case PIXARLOGDATAFMT_8BIT:
  ------------------
  |  |  715|  3.24k|#define PIXARLOGDATAFMT_8BIT 0        /* regular u_char samples */
  ------------------
  |  Branch (1115:13): [True: 3.24k, False: 2.05k]
  ------------------
 1116|  3.24k|                horizontalAccumulate8(up, llen, sp->stride, (unsigned char *)op,
 1117|  3.24k|                                      sp->ToLinear8);
 1118|  3.24k|                op += (unsigned long)llen * sizeof(unsigned char);
 1119|  3.24k|                break;
 1120|      0|            case PIXARLOGDATAFMT_8BITABGR:
  ------------------
  |  |  716|      0|#define PIXARLOGDATAFMT_8BITABGR 1    /* ABGR-order u_chars */
  ------------------
  |  Branch (1120:13): [True: 0, False: 5.30k]
  ------------------
 1121|      0|                horizontalAccumulate8abgr(up, llen, sp->stride,
 1122|      0|                                          (unsigned char *)op, sp->ToLinear8);
 1123|       |
 1124|       |                /* For stride == 3 (RGB), horizontalAccumulate8abgr expands to 4
 1125|       |                 * bytes/pixel (ABGR) */
 1126|      0|                if (sp->stride == 3)
  ------------------
  |  Branch (1126:21): [True: 0, False: 0]
  ------------------
 1127|      0|                    op += (unsigned long)td->td_imagewidth * 4;
 1128|      0|                else
 1129|      0|                    op += (unsigned long)llen * sizeof(unsigned char);
 1130|      0|                break;
 1131|      0|            default:
  ------------------
  |  Branch (1131:13): [True: 0, False: 5.30k]
  ------------------
 1132|      0|                TIFFErrorExtR(tif, module, "Unsupported bits/sample: %" PRIu16,
 1133|      0|                              td->td_bitspersample);
 1134|      0|                memset(op, 0, (size_t)occ);
 1135|      0|                return (0);
 1136|  5.30k|        }
 1137|  5.30k|    }
 1138|       |
 1139|  2.61k|    return (1);
 1140|  2.61k|}
tif_pixarlog.c:horizontalAccumulate16:
  317|  1.52k|{
  318|  1.52k|    unsigned int cr, cg, cb, ca, mask;
  319|       |
  320|  1.52k|    if (n >= stride)
  ------------------
  |  Branch (320:9): [True: 1.52k, False: 0]
  ------------------
  321|  1.52k|    {
  322|  1.52k|        mask = CODE_MASK;
  ------------------
  |  |  104|  1.52k|#define CODE_MASK 0x7ff /* 11 bits. */
  ------------------
  323|  1.52k|        if (stride == 3)
  ------------------
  |  Branch (323:13): [True: 558, False: 969]
  ------------------
  324|    558|        {
  325|    558|            PixarLogStore16NativeUnaligned(op, ToLinear16[cr = (wp[0] & mask)]);
  326|    558|            PixarLogStore16NativeUnaligned(op + sizeof(uint16_t),
  327|    558|                                           ToLinear16[cg = (wp[1] & mask)]);
  328|    558|            PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t),
  329|    558|                                           ToLinear16[cb = (wp[2] & mask)]);
  330|    558|            n -= 3;
  331|  1.85k|            while (n > 0)
  ------------------
  |  Branch (331:20): [True: 1.29k, False: 558]
  ------------------
  332|  1.29k|            {
  333|  1.29k|                wp += 3;
  334|  1.29k|                op += 3 * sizeof(uint16_t);
  335|  1.29k|                n -= 3;
  336|  1.29k|                PixarLogStore16NativeUnaligned(
  337|  1.29k|                    op, ToLinear16[(cr += wp[0]) & mask]);
  338|  1.29k|                PixarLogStore16NativeUnaligned(
  339|  1.29k|                    op + sizeof(uint16_t), ToLinear16[(cg += wp[1]) & mask]);
  340|  1.29k|                PixarLogStore16NativeUnaligned(
  341|  1.29k|                    op + 2 * sizeof(uint16_t),
  342|  1.29k|                    ToLinear16[(cb += wp[2]) & mask]);
  343|  1.29k|            }
  344|    558|        }
  345|    969|        else if (stride == 4)
  ------------------
  |  Branch (345:18): [True: 515, False: 454]
  ------------------
  346|    515|        {
  347|    515|            PixarLogStore16NativeUnaligned(op, ToLinear16[cr = (wp[0] & mask)]);
  348|    515|            PixarLogStore16NativeUnaligned(op + sizeof(uint16_t),
  349|    515|                                           ToLinear16[cg = (wp[1] & mask)]);
  350|    515|            PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t),
  351|    515|                                           ToLinear16[cb = (wp[2] & mask)]);
  352|    515|            PixarLogStore16NativeUnaligned(op + 3 * sizeof(uint16_t),
  353|    515|                                           ToLinear16[ca = (wp[3] & mask)]);
  354|    515|            n -= 4;
  355|  1.47k|            while (n > 0)
  ------------------
  |  Branch (355:20): [True: 962, False: 515]
  ------------------
  356|    962|            {
  357|    962|                wp += 4;
  358|    962|                op += 4 * sizeof(uint16_t);
  359|    962|                n -= 4;
  360|    962|                PixarLogStore16NativeUnaligned(
  361|    962|                    op, ToLinear16[(cr += wp[0]) & mask]);
  362|    962|                PixarLogStore16NativeUnaligned(
  363|    962|                    op + sizeof(uint16_t), ToLinear16[(cg += wp[1]) & mask]);
  364|    962|                PixarLogStore16NativeUnaligned(
  365|    962|                    op + 2 * sizeof(uint16_t),
  366|    962|                    ToLinear16[(cb += wp[2]) & mask]);
  367|    962|                PixarLogStore16NativeUnaligned(
  368|    962|                    op + 3 * sizeof(uint16_t),
  369|    962|                    ToLinear16[(ca += wp[3]) & mask]);
  370|    962|            }
  371|    515|        }
  372|    454|        else
  373|    454|        {
  374|    454|            REPEAT(stride,
  ------------------
  |  |  110|    454|    {                                                                          \
  |  |  111|    454|        int i;                                                                 \
  |  |  112|    454|        i = n;                                                                 \
  |  |  113|    454|        do                                                                     \
  |  |  114|  1.37k|        {                                                                      \
  |  |  115|  1.37k|            i--;                                                               \
  |  |  116|  1.37k|            op;                                                                \
  |  |  117|  1.37k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 922, False: 454]
  |  |  ------------------
  |  |  118|    454|    }
  ------------------
  375|    454|                   PixarLogStore16NativeUnaligned(op, ToLinear16[*wp & mask]);
  376|    454|                   wp++; op += sizeof(uint16_t))
  377|    454|            n -= stride;
  378|  2.99k|            while (n > 0)
  ------------------
  |  Branch (378:20): [True: 2.54k, False: 454]
  ------------------
  379|  2.54k|            {
  380|  2.54k|                REPEAT(
  ------------------
  |  |  110|  2.54k|    {                                                                          \
  |  |  111|  2.54k|        int i;                                                                 \
  |  |  112|  2.54k|        i = n;                                                                 \
  |  |  113|  2.54k|        do                                                                     \
  |  |  114|  7.23k|        {                                                                      \
  |  |  115|  7.23k|            i--;                                                               \
  |  |  116|  7.23k|            op;                                                                \
  |  |  117|  7.23k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 4.69k, False: 2.54k]
  |  |  ------------------
  |  |  118|  2.54k|    }
  ------------------
  381|  2.54k|                    stride, *wp = (uint16_t)(*wp + wp[-stride]);
  382|  2.54k|                    PixarLogStore16NativeUnaligned(op, ToLinear16[*wp & mask]);
  383|  2.54k|                    wp++; op += sizeof(uint16_t))
  384|  2.54k|                n -= stride;
  385|  2.54k|            }
  386|    454|        }
  387|  1.52k|    }
  388|  1.52k|}
tif_pixarlog.c:PixarLogStore16NativeUnaligned:
  147|  20.6k|{
  148|  20.6k|    memcpy(cp, &v, sizeof(v));
  149|  20.6k|}
tif_pixarlog.c:horizontalAccumulate12:
  228|    527|{
  229|    527|    unsigned int cr, cg, cb, ca, mask;
  230|    527|    float t0, t1, t2, t3;
  231|       |
  232|    527|#define SCALE12 2048.0f
  233|    527|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  234|       |
  235|    527|    if (n >= stride)
  ------------------
  |  Branch (235:9): [True: 527, False: 0]
  ------------------
  236|    527|    {
  237|    527|        mask = CODE_MASK;
  ------------------
  |  |  104|    527|#define CODE_MASK 0x7ff /* 11 bits. */
  ------------------
  238|    527|        if (stride == 3)
  ------------------
  |  Branch (238:13): [True: 0, False: 527]
  ------------------
  239|      0|        {
  240|      0|            t0 = ToLinearF[cr = (wp[0] & mask)] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  241|      0|            t1 = ToLinearF[cg = (wp[1] & mask)] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  242|      0|            t2 = ToLinearF[cb = (wp[2] & mask)] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  243|      0|            PixarLogStore16NativeUnaligned(op, (uint16_t)CLAMP12(t0));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  244|      0|            PixarLogStore16NativeUnaligned(op + sizeof(uint16_t),
  245|      0|                                           (uint16_t)CLAMP12(t1));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  246|      0|            PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t),
  247|      0|                                           (uint16_t)CLAMP12(t2));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  248|      0|            n -= 3;
  249|      0|            while (n > 0)
  ------------------
  |  Branch (249:20): [True: 0, False: 0]
  ------------------
  250|      0|            {
  251|      0|                wp += 3;
  252|      0|                op += 3 * sizeof(uint16_t);
  253|      0|                n -= 3;
  254|      0|                t0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  255|      0|                t1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  256|      0|                t2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  257|      0|                PixarLogStore16NativeUnaligned(op, (uint16_t)CLAMP12(t0));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  258|      0|                PixarLogStore16NativeUnaligned(op + sizeof(uint16_t),
  259|      0|                                               (uint16_t)CLAMP12(t1));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  260|      0|                PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t),
  261|      0|                                               (uint16_t)CLAMP12(t2));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  262|      0|            }
  263|      0|        }
  264|    527|        else if (stride == 4)
  ------------------
  |  Branch (264:18): [True: 0, False: 527]
  ------------------
  265|      0|        {
  266|      0|            t0 = ToLinearF[cr = (wp[0] & mask)] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  267|      0|            t1 = ToLinearF[cg = (wp[1] & mask)] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  268|      0|            t2 = ToLinearF[cb = (wp[2] & mask)] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  269|      0|            t3 = ToLinearF[ca = (wp[3] & mask)] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  270|      0|            PixarLogStore16NativeUnaligned(op, (uint16_t)CLAMP12(t0));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  271|      0|            PixarLogStore16NativeUnaligned(op + sizeof(uint16_t),
  272|      0|                                           (uint16_t)CLAMP12(t1));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  273|      0|            PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t),
  274|      0|                                           (uint16_t)CLAMP12(t2));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  275|      0|            PixarLogStore16NativeUnaligned(op + 3 * sizeof(uint16_t),
  276|      0|                                           (uint16_t)CLAMP12(t3));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  277|      0|            n -= 4;
  278|      0|            while (n > 0)
  ------------------
  |  Branch (278:20): [True: 0, False: 0]
  ------------------
  279|      0|            {
  280|      0|                wp += 4;
  281|      0|                op += 4 * sizeof(uint16_t);
  282|      0|                n -= 4;
  283|      0|                t0 = ToLinearF[(cr += wp[0]) & mask] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  284|      0|                t1 = ToLinearF[(cg += wp[1]) & mask] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  285|      0|                t2 = ToLinearF[(cb += wp[2]) & mask] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  286|      0|                t3 = ToLinearF[(ca += wp[3]) & mask] * SCALE12;
  ------------------
  |  |  232|      0|#define SCALE12 2048.0f
  ------------------
  287|      0|                PixarLogStore16NativeUnaligned(op, (uint16_t)CLAMP12(t0));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  288|      0|                PixarLogStore16NativeUnaligned(op + sizeof(uint16_t),
  289|      0|                                               (uint16_t)CLAMP12(t1));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  290|      0|                PixarLogStore16NativeUnaligned(op + 2 * sizeof(uint16_t),
  291|      0|                                               (uint16_t)CLAMP12(t2));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  292|      0|                PixarLogStore16NativeUnaligned(op + 3 * sizeof(uint16_t),
  293|      0|                                               (uint16_t)CLAMP12(t3));
  ------------------
  |  |  233|      0|#define CLAMP12(t) (((t) < 3071) ? (int16_t)(uint16_t)(t) : (int16_t)3071)
  |  |  ------------------
  |  |  |  Branch (233:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  294|      0|            }
  295|      0|        }
  296|    527|        else
  297|    527|        {
  298|    527|            REPEAT(stride, t0 = ToLinearF[*wp & mask] * SCALE12;
  ------------------
  |  |  110|    527|    {                                                                          \
  |  |  111|    527|        int i;                                                                 \
  |  |  112|    527|        i = n;                                                                 \
  |  |  113|    527|        do                                                                     \
  |  |  114|    527|        {                                                                      \
  |  |  115|    527|            i--;                                                               \
  |  |  116|  1.05k|            op;                                                                \
  |  |  ------------------
  |  |  |  Branch (116:13): [True: 293, False: 234]
  |  |  ------------------
  |  |  117|    527|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 0, False: 527]
  |  |  ------------------
  |  |  118|    527|    }
  ------------------
  299|    527|                   PixarLogStore16NativeUnaligned(op, (uint16_t)CLAMP12(t0));
  300|    527|                   wp++; op += sizeof(uint16_t))
  301|    527|            n -= stride;
  302|    527|            while (n > 0)
  ------------------
  |  Branch (302:20): [True: 0, False: 527]
  ------------------
  303|      0|            {
  304|      0|                REPEAT(
  ------------------
  |  |  110|      0|    {                                                                          \
  |  |  111|      0|        int i;                                                                 \
  |  |  112|      0|        i = n;                                                                 \
  |  |  113|      0|        do                                                                     \
  |  |  114|      0|        {                                                                      \
  |  |  115|      0|            i--;                                                               \
  |  |  116|      0|            op;                                                                \
  |  |  ------------------
  |  |  |  Branch (116:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  117|      0|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  118|      0|    }
  ------------------
  305|      0|                    stride, *wp = (uint16_t)(*wp + wp[-stride]);
  306|      0|                    t0 = ToLinearF[*wp & mask] * SCALE12;
  307|      0|                    PixarLogStore16NativeUnaligned(op, (uint16_t)CLAMP12(t0));
  308|      0|                    wp++; op += sizeof(uint16_t))
  309|      0|                n -= stride;
  310|      0|            }
  311|    527|        }
  312|    527|    }
  313|    527|}
tif_pixarlog.c:horizontalAccumulate8:
  473|  3.24k|{
  474|  3.24k|    unsigned int cr, cg, cb, ca, mask;
  475|       |
  476|  3.24k|    if (n >= stride)
  ------------------
  |  Branch (476:9): [True: 3.24k, False: 0]
  ------------------
  477|  3.24k|    {
  478|  3.24k|        mask = CODE_MASK;
  ------------------
  |  |  104|  3.24k|#define CODE_MASK 0x7ff /* 11 bits. */
  ------------------
  479|  3.24k|        if (stride == 3)
  ------------------
  |  Branch (479:13): [True: 1.26k, False: 1.98k]
  ------------------
  480|  1.26k|        {
  481|  1.26k|            op[0] = ToLinear8[cr = (wp[0] & mask)];
  482|  1.26k|            op[1] = ToLinear8[cg = (wp[1] & mask)];
  483|  1.26k|            op[2] = ToLinear8[cb = (wp[2] & mask)];
  484|  1.26k|            n -= 3;
  485|  6.76k|            while (n > 0)
  ------------------
  |  Branch (485:20): [True: 5.49k, False: 1.26k]
  ------------------
  486|  5.49k|            {
  487|  5.49k|                n -= 3;
  488|  5.49k|                wp += 3;
  489|  5.49k|                op += 3;
  490|  5.49k|                op[0] = ToLinear8[(cr += wp[0]) & mask];
  491|  5.49k|                op[1] = ToLinear8[(cg += wp[1]) & mask];
  492|  5.49k|                op[2] = ToLinear8[(cb += wp[2]) & mask];
  493|  5.49k|            }
  494|  1.26k|        }
  495|  1.98k|        else if (stride == 4)
  ------------------
  |  Branch (495:18): [True: 596, False: 1.38k]
  ------------------
  496|    596|        {
  497|    596|            op[0] = ToLinear8[cr = (wp[0] & mask)];
  498|    596|            op[1] = ToLinear8[cg = (wp[1] & mask)];
  499|    596|            op[2] = ToLinear8[cb = (wp[2] & mask)];
  500|    596|            op[3] = ToLinear8[ca = (wp[3] & mask)];
  501|    596|            n -= 4;
  502|  7.21k|            while (n > 0)
  ------------------
  |  Branch (502:20): [True: 6.61k, False: 596]
  ------------------
  503|  6.61k|            {
  504|  6.61k|                n -= 4;
  505|  6.61k|                wp += 4;
  506|  6.61k|                op += 4;
  507|  6.61k|                op[0] = ToLinear8[(cr += wp[0]) & mask];
  508|  6.61k|                op[1] = ToLinear8[(cg += wp[1]) & mask];
  509|  6.61k|                op[2] = ToLinear8[(cb += wp[2]) & mask];
  510|  6.61k|                op[3] = ToLinear8[(ca += wp[3]) & mask];
  511|  6.61k|            }
  512|    596|        }
  513|  1.38k|        else
  514|  1.38k|        {
  515|  1.38k|            REPEAT(stride, *op = ToLinear8[*wp & mask]; wp++; op++)
  ------------------
  |  |  110|  1.38k|    {                                                                          \
  |  |  111|  1.38k|        int i;                                                                 \
  |  |  112|  1.38k|        i = n;                                                                 \
  |  |  113|  1.38k|        do                                                                     \
  |  |  114|  4.07k|        {                                                                      \
  |  |  115|  4.07k|            i--;                                                               \
  |  |  116|  4.07k|            op;                                                                \
  |  |  117|  4.07k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 2.68k, False: 1.38k]
  |  |  ------------------
  |  |  118|  1.38k|    }
  ------------------
  516|  1.38k|            n -= stride;
  517|  21.2k|            while (n > 0)
  ------------------
  |  Branch (517:20): [True: 19.8k, False: 1.38k]
  ------------------
  518|  19.8k|            {
  519|  19.8k|                REPEAT(stride, *wp = (uint16_t)(*wp + wp[-stride]);
  ------------------
  |  |  110|  19.8k|    {                                                                          \
  |  |  111|  19.8k|        int i;                                                                 \
  |  |  112|  19.8k|        i = n;                                                                 \
  |  |  113|  19.8k|        do                                                                     \
  |  |  114|  26.7k|        {                                                                      \
  |  |  115|  26.7k|            i--;                                                               \
  |  |  116|  26.7k|            op;                                                                \
  |  |  117|  26.7k|        } while (i > 0);                                                       \
  |  |  ------------------
  |  |  |  Branch (117:18): [True: 6.82k, False: 19.8k]
  |  |  ------------------
  |  |  118|  19.8k|    }
  ------------------
  520|  19.8k|                       *op = ToLinear8[*wp & mask]; wp++; op++)
  521|  19.8k|                n -= stride;
  522|  19.8k|            }
  523|  1.38k|        }
  524|  3.24k|    }
  525|  3.24k|}
tif_pixarlog.c:PixarLogCleanup:
 1663|    162|{
 1664|    162|    PixarLogState *sp = (PixarLogState *)tif->tif_data;
 1665|       |
 1666|    162|    assert(sp != 0);
  ------------------
  |  Branch (1666:5): [True: 0, False: 162]
  |  Branch (1666:5): [True: 162, False: 0]
  ------------------
 1667|       |
 1668|    162|    (void)TIFFPredictorCleanup(tif);
 1669|       |
 1670|    162|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1671|    162|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1672|       |
 1673|    162|    if (sp->FromLT2)
  ------------------
  |  Branch (1673:9): [True: 162, False: 0]
  ------------------
 1674|    162|        _TIFFfreeExt(tif, sp->FromLT2);
 1675|    162|    if (sp->From14)
  ------------------
  |  Branch (1675:9): [True: 162, False: 0]
  ------------------
 1676|    162|        _TIFFfreeExt(tif, sp->From14);
 1677|    162|    if (sp->From8)
  ------------------
  |  Branch (1677:9): [True: 162, False: 0]
  ------------------
 1678|    162|        _TIFFfreeExt(tif, sp->From8);
 1679|    162|    if (sp->ToLinearF)
  ------------------
  |  Branch (1679:9): [True: 162, False: 0]
  ------------------
 1680|    162|        _TIFFfreeExt(tif, sp->ToLinearF);
 1681|    162|    if (sp->ToLinear16)
  ------------------
  |  Branch (1681:9): [True: 162, False: 0]
  ------------------
 1682|    162|        _TIFFfreeExt(tif, sp->ToLinear16);
 1683|    162|    if (sp->ToLinear8)
  ------------------
  |  Branch (1683:9): [True: 162, False: 0]
  ------------------
 1684|    162|        _TIFFfreeExt(tif, sp->ToLinear8);
 1685|    162|    if (sp->state & PLSTATE_INIT)
  ------------------
  |  |  615|    162|#define PLSTATE_INIT 1
  ------------------
  |  Branch (1685:9): [True: 143, False: 19]
  ------------------
 1686|    143|    {
 1687|    143|        if (tif->tif_mode == O_RDONLY)
  ------------------
  |  Branch (1687:13): [True: 143, False: 0]
  ------------------
 1688|    143|            inflateEnd(&sp->stream);
 1689|      0|        else
 1690|      0|            deflateEnd(&sp->stream);
 1691|    143|    }
 1692|    162|    if (sp->tbuf)
  ------------------
  |  Branch (1692:9): [True: 143, False: 19]
  ------------------
 1693|    143|        _TIFFfreeExt(tif, sp->tbuf);
 1694|    162|    _TIFFfreeExt(tif, sp);
 1695|    162|    tif->tif_data = NULL;
 1696|       |
 1697|    162|    _TIFFSetDefaultCompressionState(tif);
 1698|    162|}
tif_pixarlog.c:PixarLogGetMaxCompressionRatio:
 1794|      5|{
 1795|      5|    (void)tif;
 1796|       |    /* cf https://zlib.net/zlib_tech.html */
 1797|      5|    const uint64_t MAX_DEFLATE_RATIO = 1032;
 1798|       |
 1799|       |    /* security margin as I don't understand what this codec does */
 1800|      5|    return MAX_DEFLATE_RATIO * (uint64_t)4;
 1801|      5|}
tif_pixarlog.c:PixarLogVGetField:
 1770|   135k|{
 1771|   135k|    PixarLogState *sp = (PixarLogState *)tif->tif_data;
 1772|       |
 1773|   135k|    switch (tag)
 1774|   135k|    {
 1775|      0|        case TIFFTAG_PIXARLOGQUALITY:
  ------------------
  |  |  740|      0|#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
  ------------------
  |  Branch (1775:9): [True: 0, False: 135k]
  ------------------
 1776|      0|            *va_arg(ap, int *) = sp->quality;
 1777|      0|            break;
 1778|      0|        case TIFFTAG_PIXARLOGDATAFMT:
  ------------------
  |  |  714|      0|#define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */
  ------------------
  |  Branch (1778:9): [True: 0, False: 135k]
  ------------------
 1779|      0|            *va_arg(ap, int *) = sp->user_datafmt;
 1780|      0|            break;
 1781|   135k|        default:
  ------------------
  |  Branch (1781:9): [True: 135k, False: 0]
  ------------------
 1782|   135k|            return (*sp->vgetparent)(tif, tag, ap);
 1783|   135k|    }
 1784|      0|    return (1);
 1785|   135k|}
tif_pixarlog.c:PixarLogVSetField:
 1701|  1.25k|{
 1702|  1.25k|    static const char module[] = "PixarLogVSetField";
 1703|  1.25k|    PixarLogState *sp = (PixarLogState *)tif->tif_data;
 1704|  1.25k|    int result;
 1705|       |
 1706|  1.25k|    switch (tag)
 1707|  1.25k|    {
 1708|      0|        case TIFFTAG_PIXARLOGQUALITY:
  ------------------
  |  |  740|      0|#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
  ------------------
  |  Branch (1708:9): [True: 0, False: 1.25k]
  ------------------
 1709|      0|            sp->quality = (int)va_arg(ap, int);
 1710|      0|            if (tif->tif_mode != O_RDONLY && (sp->state & PLSTATE_INIT))
  ------------------
  |  |  615|      0|#define PLSTATE_INIT 1
  ------------------
  |  Branch (1710:17): [True: 0, False: 0]
  |  Branch (1710:46): [True: 0, False: 0]
  ------------------
 1711|      0|            {
 1712|      0|                if (deflateParams(&sp->stream, sp->quality,
  ------------------
  |  Branch (1712:21): [True: 0, False: 0]
  ------------------
 1713|      0|                                  Z_DEFAULT_STRATEGY) != Z_OK)
 1714|      0|                {
 1715|      0|                    TIFFErrorExtR(tif, module, "ZLib error: %s",
 1716|      0|                                  sp->stream.msg ? sp->stream.msg : "(null)");
  ------------------
  |  Branch (1716:35): [True: 0, False: 0]
  ------------------
 1717|      0|                    return (0);
 1718|      0|                }
 1719|      0|            }
 1720|      0|            return (1);
 1721|      0|        case TIFFTAG_PIXARLOGDATAFMT:
  ------------------
  |  |  714|      0|#define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */
  ------------------
  |  Branch (1721:9): [True: 0, False: 1.25k]
  ------------------
 1722|      0|            sp->user_datafmt = (int)va_arg(ap, int);
 1723|       |            /* Tweak the TIFF header so that the rest of libtiff knows what
 1724|       |             * size of data will be passed between app and library, and
 1725|       |             * assume that the app knows what it is doing and is not
 1726|       |             * confused by these header manipulations...
 1727|       |             */
 1728|      0|            switch (sp->user_datafmt)
 1729|      0|            {
 1730|      0|                case PIXARLOGDATAFMT_8BIT:
  ------------------
  |  |  715|      0|#define PIXARLOGDATAFMT_8BIT 0        /* regular u_char samples */
  ------------------
  |  Branch (1730:17): [True: 0, False: 0]
  ------------------
 1731|      0|                case PIXARLOGDATAFMT_8BITABGR:
  ------------------
  |  |  716|      0|#define PIXARLOGDATAFMT_8BITABGR 1    /* ABGR-order u_chars */
  ------------------
  |  Branch (1731:17): [True: 0, False: 0]
  ------------------
 1732|      0|                    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
  ------------------
  |  |  180|      0|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1733|      0|                    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  333|      0|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
                                  TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  334|      0|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
 1734|      0|                    break;
 1735|      0|                case PIXARLOGDATAFMT_11BITLOG:
  ------------------
  |  |  717|      0|#define PIXARLOGDATAFMT_11BITLOG 2    /* 11-bit log-encoded (raw) */
  ------------------
  |  Branch (1735:17): [True: 0, False: 0]
  ------------------
 1736|      0|                    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
  ------------------
  |  |  180|      0|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1737|      0|                    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  333|      0|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
                                  TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  334|      0|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
 1738|      0|                    break;
 1739|      0|                case PIXARLOGDATAFMT_12BITPICIO:
  ------------------
  |  |  718|      0|#define PIXARLOGDATAFMT_12BITPICIO 3  /* as per PICIO (1.0==2048) */
  ------------------
  |  Branch (1739:17): [True: 0, False: 0]
  ------------------
 1740|      0|                    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
  ------------------
  |  |  180|      0|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1741|      0|                    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
  ------------------
  |  |  333|      0|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
                                  TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
  ------------------
  |  |  335|      0|#define SAMPLEFORMAT_INT 2                 /* !signed integer data */
  ------------------
 1742|      0|                    break;
 1743|      0|                case PIXARLOGDATAFMT_16BIT:
  ------------------
  |  |  719|      0|#define PIXARLOGDATAFMT_16BIT 4       /* signed short samples */
  ------------------
  |  Branch (1743:17): [True: 0, False: 0]
  ------------------
 1744|      0|                    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 16);
  ------------------
  |  |  180|      0|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1745|      0|                    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  333|      0|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
                                  TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
  ------------------
  |  |  334|      0|#define SAMPLEFORMAT_UINT 1                /* !unsigned integer data */
  ------------------
 1746|      0|                    break;
 1747|      0|                case PIXARLOGDATAFMT_FLOAT:
  ------------------
  |  |  720|      0|#define PIXARLOGDATAFMT_FLOAT 5       /* IEEE float samples */
  ------------------
  |  Branch (1747:17): [True: 0, False: 0]
  ------------------
 1748|      0|                    TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 32);
  ------------------
  |  |  180|      0|#define TIFFTAG_BITSPERSAMPLE 258     /* bits per channel (sample) */
  ------------------
 1749|      0|                    TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT,
  ------------------
  |  |  333|      0|#define TIFFTAG_SAMPLEFORMAT 339           /* !data sample format */
  ------------------
 1750|      0|                                 SAMPLEFORMAT_IEEEFP);
  ------------------
  |  |  336|      0|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
 1751|      0|                    break;
 1752|      0|                default:
  ------------------
  |  Branch (1752:17): [True: 0, False: 0]
  ------------------
 1753|      0|                    break;
 1754|      0|            }
 1755|       |            /*
 1756|       |             * Must recalculate sizes should bits/sample change.
 1757|       |             */
 1758|      0|            tif->tif_dir.td_tilesize =
 1759|      0|                isTiled(tif) ? TIFFTileSize(tif) : (tmsize_t)(-1);
  ------------------
  |  |  278|      0|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|      0|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1760|      0|            tif->tif_dir.td_scanlinesize = TIFFScanlineSize(tif);
 1761|      0|            result = 1; /* NB: pseudo tag */
 1762|      0|            break;
 1763|  1.25k|        default:
  ------------------
  |  Branch (1763:9): [True: 1.25k, False: 0]
  ------------------
 1764|  1.25k|            result = (*sp->vsetparent)(tif, tag, ap);
 1765|  1.25k|    }
 1766|  1.25k|    return (result);
 1767|  1.25k|}
tif_pixarlog.c:PixarLogMakeTables:
  630|    162|{
  631|       |
  632|       |    /*
  633|       |     *    We make several tables here to convert between various external
  634|       |     *    representations (float, 16-bit, and 8-bit) and the internal
  635|       |     *    11-bit companded representation.  The 11-bit representation has two
  636|       |     *    distinct regions.  A linear bottom end up through .018316 in steps
  637|       |     *    of about .000073, and a region of constant ratio up to about 25.
  638|       |     *    These floating point numbers are stored in the main table ToLinearF.
  639|       |     *    All other tables are derived from this one.  The tables (and the
  640|       |     *    ratios) are continuous at the internal seam.
  641|       |     */
  642|       |
  643|    162|    int nlin, lt2size;
  644|    162|    int i, j;
  645|    162|    double b, c, linstep, v;
  646|    162|    float *ToLinearF;
  647|    162|    uint16_t *ToLinear16;
  648|    162|    unsigned char *ToLinear8;
  649|    162|    uint16_t *FromLT2;
  650|    162|    uint16_t *From14; /* Really for 16-bit data, but we shift down 2 */
  651|    162|    uint16_t *From8;
  652|       |
  653|    162|    c = log(RATIO);
  ------------------
  |  |  102|    162|#define RATIO 1.004  /* nominal ratio for log part */
  ------------------
  654|    162|    nlin = (int)(1. / c); /* nlin must be an integer */
  655|    162|    c = 1. / nlin;
  656|    162|    b = exp(-c * ONE); /* multiplicative scale factor [b*exp(c*ONE) = 1] */
  ------------------
  |  |  101|    162|#define ONE 1250     /* token value of 1.0 exactly */
  ------------------
  657|    162|    linstep = b * c * exp(1.);
  658|       |
  659|    162|    LogK1 = (float)(1. / c); /* if (v >= 2)  token = k1*log(v*k2) */
  660|    162|    LogK2 = (float)(1. / b);
  661|    162|    lt2size = (int)(2. / linstep) + 1;
  662|    162|    FromLT2 = (uint16_t *)_TIFFmallocExt(
  663|    162|        tif, (tmsize_t)((size_t)lt2size * sizeof(uint16_t)));
  664|    162|    From14 = (uint16_t *)_TIFFmallocExt(tif, 16384 * sizeof(uint16_t));
  665|    162|    From8 = (uint16_t *)_TIFFmallocExt(tif, 256 * sizeof(uint16_t));
  666|    162|    ToLinearF = (float *)_TIFFmallocExt(tif, TSIZEP1 * sizeof(float));
  ------------------
  |  |  100|    162|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  667|    162|    ToLinear16 = (uint16_t *)_TIFFmallocExt(tif, TSIZEP1 * sizeof(uint16_t));
  ------------------
  |  |  100|    162|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  668|    162|    ToLinear8 =
  669|    162|        (unsigned char *)_TIFFmallocExt(tif, TSIZEP1 * sizeof(unsigned char));
  ------------------
  |  |  100|    162|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  670|    162|    if (FromLT2 == NULL || From14 == NULL || From8 == NULL ||
  ------------------
  |  Branch (670:9): [True: 0, False: 162]
  |  Branch (670:28): [True: 0, False: 162]
  |  Branch (670:46): [True: 0, False: 162]
  ------------------
  671|    162|        ToLinearF == NULL || ToLinear16 == NULL || ToLinear8 == NULL)
  ------------------
  |  Branch (671:9): [True: 0, False: 162]
  |  Branch (671:30): [True: 0, False: 162]
  |  Branch (671:52): [True: 0, False: 162]
  ------------------
  672|      0|    {
  673|      0|        if (FromLT2)
  ------------------
  |  Branch (673:13): [True: 0, False: 0]
  ------------------
  674|      0|            _TIFFfreeExt(tif, FromLT2);
  675|      0|        if (From14)
  ------------------
  |  Branch (675:13): [True: 0, False: 0]
  ------------------
  676|      0|            _TIFFfreeExt(tif, From14);
  677|      0|        if (From8)
  ------------------
  |  Branch (677:13): [True: 0, False: 0]
  ------------------
  678|      0|            _TIFFfreeExt(tif, From8);
  679|      0|        if (ToLinearF)
  ------------------
  |  Branch (679:13): [True: 0, False: 0]
  ------------------
  680|      0|            _TIFFfreeExt(tif, ToLinearF);
  681|      0|        if (ToLinear16)
  ------------------
  |  Branch (681:13): [True: 0, False: 0]
  ------------------
  682|      0|            _TIFFfreeExt(tif, ToLinear16);
  683|      0|        if (ToLinear8)
  ------------------
  |  Branch (683:13): [True: 0, False: 0]
  ------------------
  684|      0|            _TIFFfreeExt(tif, ToLinear8);
  685|      0|        sp->FromLT2 = NULL;
  686|      0|        sp->From14 = NULL;
  687|      0|        sp->From8 = NULL;
  688|      0|        sp->ToLinearF = NULL;
  689|      0|        sp->ToLinear16 = NULL;
  690|      0|        sp->ToLinear8 = NULL;
  691|      0|        return 0;
  692|      0|    }
  693|       |
  694|    162|    j = 0;
  695|       |
  696|  40.6k|    for (i = 0; i < nlin; i++)
  ------------------
  |  Branch (696:17): [True: 40.5k, False: 162]
  ------------------
  697|  40.5k|    {
  698|  40.5k|        v = i * linstep;
  699|  40.5k|        ToLinearF[j++] = (float)v;
  700|  40.5k|    }
  701|       |
  702|   291k|    for (i = nlin; i < TSIZE; i++)
  ------------------
  |  |   99|   291k|#define TSIZE 2048   /* decode table size (11-bit tokens) */
  ------------------
  |  Branch (702:20): [True: 291k, False: 162]
  ------------------
  703|   291k|        ToLinearF[j++] = (float)(b * exp(c * i));
  704|       |
  705|    162|    ToLinearF[2048] = ToLinearF[2047];
  706|       |
  707|   332k|    for (i = 0; i < TSIZEP1; i++)
  ------------------
  |  |  100|   332k|#define TSIZEP1 2049 /* Plus one for slop */
  ------------------
  |  Branch (707:17): [True: 331k, False: 162]
  ------------------
  708|   331k|    {
  709|   331k|        v = (double)ToLinearF[i] * 65535.0 + 0.5;
  710|   331k|        ToLinear16[i] = (v > 65535.0) ? 65535 : (uint16_t)v;
  ------------------
  |  Branch (710:25): [True: 129k, False: 202k]
  ------------------
  711|   331k|        v = (double)ToLinearF[i] * 255.0 + 0.5;
  712|   331k|        ToLinear8[i] = (v > 255.0) ? 255 : (unsigned char)v;
  ------------------
  |  Branch (712:24): [True: 129k, False: 202k]
  ------------------
  713|   331k|    }
  714|       |
  715|    162|    j = 0;
  716|  4.42M|    for (i = 0; i < lt2size; i++)
  ------------------
  |  Branch (716:17): [True: 4.42M, False: 162]
  ------------------
  717|  4.42M|    {
  718|  4.42M|        if ((i * linstep) * (i * linstep) >
  ------------------
  |  Branch (718:13): [True: 230k, False: 4.19M]
  ------------------
  719|  4.42M|            (double)ToLinearF[j] * (double)ToLinearF[j + 1])
  720|   230k|            j++;
  721|  4.42M|        FromLT2[i] = (uint16_t)j;
  722|  4.42M|    }
  723|       |
  724|       |    /*
  725|       |     * Since we lose info anyway on 16-bit data, we set up a 14-bit
  726|       |     * table and shift 16-bit values down two bits on input.
  727|       |     * saves a little table space.
  728|       |     */
  729|    162|    j = 0;
  730|  2.65M|    for (i = 0; i < 16384; i++)
  ------------------
  |  Branch (730:17): [True: 2.65M, False: 162]
  ------------------
  731|  2.65M|    {
  732|  2.85M|        while ((i / 16383.) * (i / 16383.) >
  ------------------
  |  Branch (732:16): [True: 202k, False: 2.65M]
  ------------------
  733|  2.85M|               (double)ToLinearF[j] * (double)ToLinearF[j + 1])
  734|   202k|            j++;
  735|  2.65M|        From14[i] = (uint16_t)j;
  736|  2.65M|    }
  737|       |
  738|    162|    j = 0;
  739|  41.6k|    for (i = 0; i < 256; i++)
  ------------------
  |  Branch (739:17): [True: 41.4k, False: 162]
  ------------------
  740|  41.4k|    {
  741|   243k|        while ((i / 255.) * (i / 255.) >
  ------------------
  |  Branch (741:16): [True: 202k, False: 41.4k]
  ------------------
  742|   243k|               (double)ToLinearF[j] * (double)ToLinearF[j + 1])
  743|   202k|            j++;
  744|  41.4k|        From8[i] = (uint16_t)j;
  745|  41.4k|    }
  746|       |
  747|    162|    Fltsize = (float)(lt2size / 2);
  748|       |
  749|    162|    sp->ToLinearF = ToLinearF;
  750|    162|    sp->ToLinear16 = ToLinear16;
  751|    162|    sp->ToLinear8 = ToLinear8;
  752|    162|    sp->FromLT2 = FromLT2;
  753|    162|    sp->From14 = From14;
  754|    162|    sp->From8 = From8;
  755|       |
  756|    162|    return 1;
  757|    162|}

TIFFPredictorInit:
 1205|    906|{
 1206|    906|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|    906|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1207|       |
 1208|    906|    assert(sp != 0);
  ------------------
  |  Branch (1208:5): [True: 0, False: 906]
  |  Branch (1208:5): [True: 906, False: 0]
  ------------------
 1209|       |
 1210|       |    /*
 1211|       |     * Merge codec-specific tag information.
 1212|       |     */
 1213|    906|    if (!_TIFFMergeFields(tif, predictFields, TIFFArrayCount(predictFields)))
  ------------------
  |  |  339|    906|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (1213:9): [True: 0, False: 906]
  ------------------
 1214|      0|    {
 1215|      0|        TIFFErrorExtR(tif, "TIFFPredictorInit",
 1216|      0|                      "Merging Predictor codec-specific tags failed");
 1217|      0|        return 0;
 1218|      0|    }
 1219|       |
 1220|       |    /*
 1221|       |     * Override parent get/set field methods.
 1222|       |     */
 1223|    906|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
 1224|    906|    tif->tif_tagmethods.vgetfield =
 1225|    906|        PredictorVGetField; /* hook for predictor tag */
 1226|    906|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
 1227|    906|    tif->tif_tagmethods.vsetfield =
 1228|    906|        PredictorVSetField; /* hook for predictor tag */
 1229|    906|    sp->printdir = tif->tif_tagmethods.printdir;
 1230|    906|    tif->tif_tagmethods.printdir =
 1231|    906|        PredictorPrintDir; /* hook for predictor tag */
 1232|       |
 1233|    906|    sp->setupdecode = tif->tif_setupdecode;
 1234|    906|    tif->tif_setupdecode = PredictorSetupDecode;
 1235|    906|    sp->setupencode = tif->tif_setupencode;
 1236|    906|    tif->tif_setupencode = PredictorSetupEncode;
 1237|       |
 1238|    906|    sp->predictor = 1;      /* default value */
 1239|    906|    sp->encodepfunc = NULL; /* no predictor routine */
 1240|       |    sp->decodepfunc = NULL; /* no predictor routine */
 1241|    906|    return 1;
 1242|    906|}
TIFFPredictorCleanup:
 1245|    906|{
 1246|    906|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|    906|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1247|       |
 1248|    906|    assert(sp != 0);
  ------------------
  |  Branch (1248:5): [True: 0, False: 906]
  |  Branch (1248:5): [True: 906, False: 0]
  ------------------
 1249|       |
 1250|    906|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
 1251|    906|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
 1252|    906|    tif->tif_tagmethods.printdir = sp->printdir;
 1253|    906|    tif->tif_setupdecode = sp->setupdecode;
 1254|    906|    tif->tif_setupencode = sp->setupencode;
 1255|       |
 1256|    906|    return 1;
 1257|    906|}
tif_predict.c:PredictorVGetField:
 1159|   142k|{
 1160|   142k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|   142k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1161|       |
 1162|   142k|    assert(sp != NULL);
  ------------------
  |  Branch (1162:5): [True: 0, False: 142k]
  |  Branch (1162:5): [True: 142k, False: 0]
  ------------------
 1163|   142k|    assert(sp->vgetparent != NULL);
  ------------------
  |  Branch (1163:5): [True: 0, False: 142k]
  |  Branch (1163:5): [True: 142k, False: 0]
  ------------------
 1164|       |
 1165|   142k|    switch (tag)
 1166|   142k|    {
 1167|      0|        case TIFFTAG_PREDICTOR:
  ------------------
  |  |  303|      0|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1167:9): [True: 0, False: 142k]
  ------------------
 1168|      0|            *va_arg(ap, uint16_t *) = (uint16_t)sp->predictor;
 1169|      0|            break;
 1170|   142k|        default:
  ------------------
  |  Branch (1170:9): [True: 142k, False: 0]
  ------------------
 1171|   142k|            return (*sp->vgetparent)(tif, tag, ap);
 1172|   142k|    }
 1173|      0|    return 1;
 1174|   142k|}
tif_predict.c:PredictorVSetField:
 1139|  8.59k|{
 1140|  8.59k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  8.59k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
 1141|       |
 1142|  8.59k|    assert(sp != NULL);
  ------------------
  |  Branch (1142:5): [True: 0, False: 8.59k]
  |  Branch (1142:5): [True: 8.59k, False: 0]
  ------------------
 1143|  8.59k|    assert(sp->vsetparent != NULL);
  ------------------
  |  Branch (1143:5): [True: 0, False: 8.59k]
  |  Branch (1143:5): [True: 8.59k, False: 0]
  ------------------
 1144|       |
 1145|  8.59k|    switch (tag)
 1146|  8.59k|    {
 1147|    434|        case TIFFTAG_PREDICTOR:
  ------------------
  |  |  303|    434|#define TIFFTAG_PREDICTOR 317              /* prediction scheme w/ LZW */
  ------------------
  |  Branch (1147:9): [True: 434, False: 8.15k]
  ------------------
 1148|    434|            sp->predictor = (uint16_t)va_arg(ap, uint16_vap);
 1149|    434|            TIFFSetFieldBit(tif, FIELD_PREDICTOR);
  ------------------
  |  |  249|    434|#define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  247|    434|#define BITFIELDn(tif, n) ((tif)->tif_dir.td_fieldsset[(n) / 32])
  |  |  ------------------
  |  |               #define TIFFSetFieldBit(tif, field) (BITFIELDn(tif, field) |= BITn(field))
  |  |  ------------------
  |  |  |  |  246|    434|#define BITn(n) (1U << ((n) & 0x1f))
  |  |  ------------------
  ------------------
 1150|    434|            break;
 1151|  8.15k|        default:
  ------------------
  |  Branch (1151:9): [True: 8.15k, False: 434]
  ------------------
 1152|  8.15k|            return (*sp->vsetparent)(tif, tag, ap);
 1153|  8.59k|    }
 1154|    434|    tif->tif_flags |= TIFF_DIRTYDIRECT;
  ------------------
  |  |  122|    434|#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
  ------------------
 1155|    434|    return 1;
 1156|  8.59k|}
tif_predict.c:PredictorSetupDecode:
  128|    924|{
  129|    924|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|    924|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  130|    924|    TIFFDirectory *td = &tif->tif_dir;
  131|       |
  132|       |    /* Note: when PredictorSetup() fails, the effets of setupdecode() */
  133|       |    /* will not be "canceled" so setupdecode() might be robust to */
  134|       |    /* be called several times. */
  135|    924|    if (!(*sp->setupdecode)(tif) || !PredictorSetup(tif))
  ------------------
  |  Branch (135:9): [True: 11, False: 913]
  |  Branch (135:37): [True: 18, False: 895]
  ------------------
  136|     29|        return 0;
  137|       |
  138|    895|    if (sp->predictor == 2)
  ------------------
  |  Branch (138:9): [True: 277, False: 618]
  ------------------
  139|    277|    {
  140|    277|        switch (td->td_bitspersample)
  141|    277|        {
  142|    104|            case 8:
  ------------------
  |  Branch (142:13): [True: 104, False: 173]
  ------------------
  143|    104|                sp->decodepfunc = horAcc8;
  144|    104|                break;
  145|     66|            case 16:
  ------------------
  |  Branch (145:13): [True: 66, False: 211]
  ------------------
  146|     66|                sp->decodepfunc = horAcc16;
  147|     66|                break;
  148|     30|            case 32:
  ------------------
  |  Branch (148:13): [True: 30, False: 247]
  ------------------
  149|     30|                sp->decodepfunc = horAcc32;
  150|     30|                break;
  151|     77|            case 64:
  ------------------
  |  Branch (151:13): [True: 77, False: 200]
  ------------------
  152|     77|                sp->decodepfunc = horAcc64;
  153|     77|                break;
  154|      0|            default:
  ------------------
  |  Branch (154:13): [True: 0, False: 277]
  ------------------
  155|      0|                break;
  156|    277|        }
  157|       |        /*
  158|       |         * Override default decoding method with one that does the
  159|       |         * predictor stuff.
  160|       |         */
  161|    277|        if (tif->tif_decoderow != PredictorDecodeRow)
  ------------------
  |  Branch (161:13): [True: 277, False: 0]
  ------------------
  162|    277|        {
  163|    277|            sp->decoderow = tif->tif_decoderow;
  164|    277|            tif->tif_decoderow = PredictorDecodeRow;
  165|    277|            sp->decodestrip = tif->tif_decodestrip;
  166|    277|            tif->tif_decodestrip = PredictorDecodeTile;
  167|    277|            sp->decodetile = tif->tif_decodetile;
  168|    277|            tif->tif_decodetile = PredictorDecodeTile;
  169|    277|        }
  170|       |
  171|       |        /*
  172|       |         * If the data is horizontally differenced 16-bit data that
  173|       |         * requires byte-swapping, then it must be byte swapped before
  174|       |         * the accumulation step.  We do this with a special-purpose
  175|       |         * routine and override the normal post decoding logic that
  176|       |         * the library setup when the directory was read.
  177|       |         */
  178|    277|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|    277|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (178:13): [True: 94, False: 183]
  ------------------
  179|     94|        {
  180|     94|            if (sp->decodepfunc == horAcc16)
  ------------------
  |  Branch (180:17): [True: 12, False: 82]
  ------------------
  181|     12|            {
  182|     12|                sp->decodepfunc = swabHorAcc16;
  183|     12|                tif->tif_postdecode = _TIFFNoPostDecode;
  184|     12|            }
  185|     82|            else if (sp->decodepfunc == horAcc32)
  ------------------
  |  Branch (185:22): [True: 26, False: 56]
  ------------------
  186|     26|            {
  187|     26|                sp->decodepfunc = swabHorAcc32;
  188|     26|                tif->tif_postdecode = _TIFFNoPostDecode;
  189|     26|            }
  190|     56|            else if (sp->decodepfunc == horAcc64)
  ------------------
  |  Branch (190:22): [True: 53, False: 3]
  ------------------
  191|     53|            {
  192|     53|                sp->decodepfunc = swabHorAcc64;
  193|     53|                tif->tif_postdecode = _TIFFNoPostDecode;
  194|     53|            }
  195|     94|        }
  196|    277|    }
  197|       |
  198|    618|    else if (sp->predictor == 3)
  ------------------
  |  Branch (198:14): [True: 40, False: 578]
  ------------------
  199|     40|    {
  200|     40|        sp->decodepfunc = fpAcc;
  201|       |        /*
  202|       |         * Override default decoding method with one that does the
  203|       |         * predictor stuff.
  204|       |         */
  205|     40|        if (tif->tif_decoderow != PredictorDecodeRow)
  ------------------
  |  Branch (205:13): [True: 40, False: 0]
  ------------------
  206|     40|        {
  207|     40|            sp->decoderow = tif->tif_decoderow;
  208|     40|            tif->tif_decoderow = PredictorDecodeRow;
  209|     40|            sp->decodestrip = tif->tif_decodestrip;
  210|     40|            tif->tif_decodestrip = PredictorDecodeTile;
  211|     40|            sp->decodetile = tif->tif_decodetile;
  212|     40|            tif->tif_decodetile = PredictorDecodeTile;
  213|     40|        }
  214|       |        /*
  215|       |         * The data should not be swapped outside of the floating
  216|       |         * point predictor, the accumulation routine should return
  217|       |         * bytes in the native order.
  218|       |         */
  219|     40|        if (tif->tif_flags & TIFF_SWAB)
  ------------------
  |  |  126|     40|#define TIFF_SWAB 0x00080U        /* byte swap file information */
  ------------------
  |  Branch (219:13): [True: 11, False: 29]
  ------------------
  220|     11|        {
  221|     11|            tif->tif_postdecode = _TIFFNoPostDecode;
  222|     11|        }
  223|     40|    }
  224|       |
  225|    895|    return 1;
  226|    895|}
tif_predict.c:PredictorSetup:
   64|    913|{
   65|    913|    static const char module[] = "PredictorSetup";
   66|       |
   67|    913|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|    913|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
   68|    913|    TIFFDirectory *td = &tif->tif_dir;
   69|       |
   70|    913|    switch (sp->predictor) /* no differencing */
   71|    913|    {
   72|    578|        case PREDICTOR_NONE:
  ------------------
  |  |  304|    578|#define PREDICTOR_NONE 1                   /* no prediction scheme used */
  ------------------
  |  Branch (72:9): [True: 578, False: 335]
  ------------------
   73|    578|            return 1;
   74|    291|        case PREDICTOR_HORIZONTAL:
  ------------------
  |  |  305|    291|#define PREDICTOR_HORIZONTAL 2             /* horizontal differencing */
  ------------------
  |  Branch (74:9): [True: 291, False: 622]
  ------------------
   75|    291|            if (td->td_bitspersample != 8 && td->td_bitspersample != 16 &&
  ------------------
  |  Branch (75:17): [True: 187, False: 104]
  |  Branch (75:46): [True: 121, False: 66]
  ------------------
   76|    121|                td->td_bitspersample != 32 && td->td_bitspersample != 64)
  ------------------
  |  Branch (76:17): [True: 91, False: 30]
  |  Branch (76:47): [True: 14, False: 77]
  ------------------
   77|     14|            {
   78|     14|                TIFFErrorExtR(tif, module,
   79|     14|                              "Horizontal differencing \"Predictor\" not "
   80|     14|                              "supported with %" PRIu16 "-bit samples",
   81|     14|                              td->td_bitspersample);
   82|     14|                return 0;
   83|     14|            }
   84|    277|            break;
   85|    277|        case PREDICTOR_FLOATINGPOINT:
  ------------------
  |  |  306|     40|#define PREDICTOR_FLOATINGPOINT 3          /* floating point predictor */
  ------------------
  |  Branch (85:9): [True: 40, False: 873]
  ------------------
   86|     40|            if (td->td_sampleformat != SAMPLEFORMAT_IEEEFP)
  ------------------
  |  |  336|     40|#define SAMPLEFORMAT_IEEEFP 3              /* !IEEE floating point data */
  ------------------
  |  Branch (86:17): [True: 0, False: 40]
  ------------------
   87|      0|            {
   88|      0|                TIFFErrorExtR(
   89|      0|                    tif, module,
   90|      0|                    "Floating point \"Predictor\" not supported with %" PRIu16
   91|      0|                    " data format",
   92|      0|                    td->td_sampleformat);
   93|      0|                return 0;
   94|      0|            }
   95|     40|            if (td->td_bitspersample != 16 && td->td_bitspersample != 24 &&
  ------------------
  |  Branch (95:17): [True: 26, False: 14]
  |  Branch (95:47): [True: 10, False: 16]
  ------------------
   96|     10|                td->td_bitspersample != 32 && td->td_bitspersample != 64)
  ------------------
  |  Branch (96:17): [True: 3, False: 7]
  |  Branch (96:47): [True: 0, False: 3]
  ------------------
   97|      0|            { /* Should 64 be allowed? */
   98|      0|                TIFFErrorExtR(
   99|      0|                    tif, module,
  100|      0|                    "Floating point \"Predictor\" not supported with %" PRIu16
  101|      0|                    "-bit samples",
  102|      0|                    td->td_bitspersample);
  103|      0|                return 0;
  104|      0|            }
  105|     40|            break;
  106|     40|        default:
  ------------------
  |  Branch (106:9): [True: 4, False: 909]
  ------------------
  107|      4|            TIFFErrorExtR(tif, module, "\"Predictor\" value %d not supported",
  108|      4|                          sp->predictor);
  109|      4|            return 0;
  110|    913|    }
  111|    317|    sp->stride =
  112|    317|        (td->td_planarconfig == PLANARCONFIG_CONTIG ? td->td_samplesperpixel
  ------------------
  |  |  265|    317|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (112:10): [True: 310, False: 7]
  ------------------
  113|    317|                                                    : 1);
  114|       |    /*
  115|       |     * Calculate the scanline/tile-width size in bytes.
  116|       |     */
  117|    317|    if (isTiled(tif))
  ------------------
  |  |  278|    317|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|    317|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  |  |  |  Branch (278:22): [True: 87, False: 230]
  |  |  ------------------
  ------------------
  118|     87|        sp->rowsize = TIFFTileRowSize(tif);
  119|    230|    else
  120|    230|        sp->rowsize = TIFFScanlineSize(tif);
  121|    317|    if (sp->rowsize == 0)
  ------------------
  |  Branch (121:9): [True: 0, False: 317]
  ------------------
  122|      0|        return 0;
  123|       |
  124|    317|    return 1;
  125|    317|}
tif_predict.c:horAcc8:
  446|  3.33k|{
  447|  3.33k|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|  3.33k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  448|       |
  449|  3.33k|    uint8_t *cp = cp0;
  450|  3.33k|    if ((cc % stride) != 0)
  ------------------
  |  Branch (450:9): [True: 0, False: 3.33k]
  ------------------
  451|      0|    {
  452|      0|        TIFFErrorExtR(tif, "horAcc8", "%s", "(cc%stride)!=0");
  453|      0|        return 0;
  454|      0|    }
  455|       |
  456|  3.33k|    if (cc > stride)
  ------------------
  |  Branch (456:9): [True: 2.64k, False: 692]
  ------------------
  457|  2.64k|    {
  458|       |        /*
  459|       |         * Pipeline the most common cases.
  460|       |         */
  461|  2.64k|        if (stride == 1)
  ------------------
  |  Branch (461:13): [True: 946, False: 1.69k]
  ------------------
  462|    946|        {
  463|    946|            uint32_t acc = cp[0];
  464|    946|            tmsize_t i = stride;
  465|  5.02k|            for (; i < cc - 3; i += 4)
  ------------------
  |  Branch (465:20): [True: 4.08k, False: 946]
  ------------------
  466|  4.08k|            {
  467|  4.08k|                cp[i + 0] = (uint8_t)((acc += cp[i + 0]) & 0xff);
  468|  4.08k|                cp[i + 1] = (uint8_t)((acc += cp[i + 1]) & 0xff);
  469|  4.08k|                cp[i + 2] = (uint8_t)((acc += cp[i + 2]) & 0xff);
  470|  4.08k|                cp[i + 3] = (uint8_t)((acc += cp[i + 3]) & 0xff);
  471|  4.08k|            }
  472|  2.07k|            for (; i < cc; i++)
  ------------------
  |  Branch (472:20): [True: 1.12k, False: 946]
  ------------------
  473|  1.12k|            {
  474|  1.12k|                cp[i + 0] = (uint8_t)((acc += cp[i + 0]) & 0xff);
  475|  1.12k|            }
  476|    946|        }
  477|  1.69k|        else if (stride == 3)
  ------------------
  |  Branch (477:18): [True: 455, False: 1.24k]
  ------------------
  478|    455|        {
  479|    455|            uint32_t cr = cp[0];
  480|    455|            uint32_t cg = cp[1];
  481|    455|            uint32_t cb = cp[2];
  482|    455|            tmsize_t i = stride;
  483|  3.05k|            for (; i < cc; i += stride)
  ------------------
  |  Branch (483:20): [True: 2.60k, False: 455]
  ------------------
  484|  2.60k|            {
  485|  2.60k|                cp[i + 0] = (uint8_t)((cr += cp[i + 0]) & 0xff);
  486|  2.60k|                cp[i + 1] = (uint8_t)((cg += cp[i + 1]) & 0xff);
  487|  2.60k|                cp[i + 2] = (uint8_t)((cb += cp[i + 2]) & 0xff);
  488|  2.60k|            }
  489|    455|        }
  490|  1.24k|        else if (stride == 4)
  ------------------
  |  Branch (490:18): [True: 712, False: 529]
  ------------------
  491|    712|        {
  492|    712|            uint32_t cr = cp[0];
  493|    712|            uint32_t cg = cp[1];
  494|    712|            uint32_t cb = cp[2];
  495|    712|            uint32_t ca = cp[3];
  496|    712|            tmsize_t i = stride;
  497|  7.17k|            for (; i < cc; i += stride)
  ------------------
  |  Branch (497:20): [True: 6.45k, False: 712]
  ------------------
  498|  6.45k|            {
  499|  6.45k|                cp[i + 0] = (uint8_t)((cr += cp[i + 0]) & 0xff);
  500|  6.45k|                cp[i + 1] = (uint8_t)((cg += cp[i + 1]) & 0xff);
  501|  6.45k|                cp[i + 2] = (uint8_t)((cb += cp[i + 2]) & 0xff);
  502|  6.45k|                cp[i + 3] = (uint8_t)((ca += cp[i + 3]) & 0xff);
  503|  6.45k|            }
  504|    712|        }
  505|    529|        else
  506|    529|        {
  507|    529|            cc -= stride;
  508|    529|            do
  509|  2.78k|            {
  510|  2.78k|                REPEAT4(stride,
  ------------------
  |  |  327|  2.78k|    switch (n)                                                                 \
  |  |  328|  2.78k|    {                                                                          \
  |  |  329|  1.44k|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 1.44k, False: 1.34k]
  |  |  ------------------
  |  |  330|  1.44k|        {                                                                      \
  |  |  331|  1.44k|            tmsize_t i;                                                        \
  |  |  332|  3.36k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 1.91k, False: 1.44k]
  |  |  ------------------
  |  |  333|  1.91k|            {                                                                  \
  |  |  334|  1.91k|                op;                                                            \
  |  |  335|  1.91k|            }                                                                  \
  |  |  336|  1.44k|        } /*-fallthrough*/                                                     \
  |  |  337|  1.44k|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 0, False: 2.78k]
  |  |  ------------------
  |  |  338|  1.44k|            op; /*-fallthrough*/                                               \
  |  |  339|  1.44k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 0, False: 2.78k]
  |  |  ------------------
  |  |  340|  1.44k|            op; /*-fallthrough*/                                               \
  |  |  341|  2.78k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 1.34k, False: 1.44k]
  |  |  ------------------
  |  |  342|  2.78k|            op; /*-fallthrough*/                                               \
  |  |  343|  2.78k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 0, False: 2.78k]
  |  |  ------------------
  |  |  344|  2.78k|            op; /*-fallthrough*/                                               \
  |  |  345|  2.78k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 2.78k]
  |  |  ------------------
  |  |  346|  2.78k|    }
  ------------------
  511|  2.78k|                        cp[stride] = (uint8_t)((cp[stride] + *cp) & 0xff);
  512|  2.78k|                        cp++)
  513|  2.78k|                cc -= stride;
  514|  2.78k|            } while (cc > 0);
  ------------------
  |  Branch (514:22): [True: 2.25k, False: 529]
  ------------------
  515|    529|        }
  516|  2.64k|    }
  517|  3.33k|    return 1;
  518|  3.33k|}
tif_predict.c:horAcc16:
  530|  1.68k|{
  531|  1.68k|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|  1.68k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  532|  1.68k|    uint8_t *cp = cp0;
  533|  1.68k|    tmsize_t wc = cc / 2;
  534|       |
  535|  1.68k|    if ((cc % (2 * stride)) != 0)
  ------------------
  |  Branch (535:9): [True: 0, False: 1.68k]
  ------------------
  536|      0|    {
  537|      0|        TIFFErrorExtR(tif, "horAcc16", "%s", "cc%(2*stride))!=0");
  538|      0|        return 0;
  539|      0|    }
  540|       |
  541|  1.68k|    if (wc > stride)
  ------------------
  |  Branch (541:9): [True: 959, False: 726]
  ------------------
  542|    959|    {
  543|    959|        wc -= stride;
  544|    959|        do
  545|  9.55k|        {
  546|  9.55k|            REPEAT4(stride,
  ------------------
  |  |  327|  9.55k|    switch (n)                                                                 \
  |  |  328|  9.55k|    {                                                                          \
  |  |  329|    813|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 813, False: 8.73k]
  |  |  ------------------
  |  |  330|    813|        {                                                                      \
  |  |  331|    813|            tmsize_t i;                                                        \
  |  |  332|  2.51k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 1.70k, False: 813]
  |  |  ------------------
  |  |  333|  1.70k|            {                                                                  \
  |  |  334|  1.70k|                op;                                                            \
  |  |  335|  1.70k|            }                                                                  \
  |  |  336|    813|        } /*-fallthrough*/                                                     \
  |  |  337|  1.11k|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 297, False: 9.25k]
  |  |  ------------------
  |  |  338|  1.11k|            op; /*-fallthrough*/                                               \
  |  |  339|  7.51k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 6.40k, False: 3.14k]
  |  |  ------------------
  |  |  340|  7.51k|            op; /*-fallthrough*/                                               \
  |  |  341|  8.30k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 785, False: 8.76k]
  |  |  ------------------
  |  |  342|  8.30k|            op; /*-fallthrough*/                                               \
  |  |  343|  9.55k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 1.24k, False: 8.30k]
  |  |  ------------------
  |  |  344|  9.55k|            op; /*-fallthrough*/                                               \
  |  |  345|  9.55k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 9.55k]
  |  |  ------------------
  |  |  346|  9.55k|    }
  ------------------
  547|  9.55k|                    PredictorAccumulate16NativeUnaligned(cp + 2 * stride, cp);
  548|  9.55k|                    cp += 2)
  549|  9.55k|            wc -= stride;
  550|  9.55k|        } while (wc > 0);
  ------------------
  |  Branch (550:18): [True: 8.59k, False: 959]
  ------------------
  551|    959|    }
  552|  1.68k|    return 1;
  553|  1.68k|}
tif_predict.c:PredictorAccumulate16NativeUnaligned:
  365|  28.1k|{
  366|  28.1k|    uint16_t thisval;
  367|  28.1k|    uint16_t prevval;
  368|  28.1k|    memcpy(&thisval, current, sizeof(thisval));
  369|  28.1k|    memcpy(&prevval, previous, sizeof(prevval));
  370|  28.1k|    thisval =
  371|  28.1k|        (uint16_t)(((unsigned int)thisval + (unsigned int)prevval) & 0xffff);
  372|  28.1k|    memcpy(current, &thisval, sizeof(thisval));
  373|  28.1k|}
tif_predict.c:horAcc32:
  565|    608|{
  566|    608|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|    608|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  567|    608|    uint8_t *cp = cp0;
  568|    608|    tmsize_t wc = cc / 4;
  569|       |
  570|    608|    if ((cc % (4 * stride)) != 0)
  ------------------
  |  Branch (570:9): [True: 0, False: 608]
  ------------------
  571|      0|    {
  572|      0|        TIFFErrorExtR(tif, "horAcc32", "%s", "cc%(4*stride))!=0");
  573|      0|        return 0;
  574|      0|    }
  575|       |
  576|    608|    if (wc > stride)
  ------------------
  |  Branch (576:9): [True: 322, False: 286]
  ------------------
  577|    322|    {
  578|    322|        wc -= stride;
  579|    322|        do
  580|  2.51k|        {
  581|  2.51k|            REPEAT4(stride,
  ------------------
  |  |  327|  2.51k|    switch (n)                                                                 \
  |  |  328|  2.51k|    {                                                                          \
  |  |  329|  1.08k|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 1.08k, False: 1.43k]
  |  |  ------------------
  |  |  330|  1.08k|        {                                                                      \
  |  |  331|  1.08k|            tmsize_t i;                                                        \
  |  |  332|  2.59k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 1.51k, False: 1.08k]
  |  |  ------------------
  |  |  333|  1.51k|            {                                                                  \
  |  |  334|  1.51k|                op;                                                            \
  |  |  335|  1.51k|            }                                                                  \
  |  |  336|  1.08k|        } /*-fallthrough*/                                                     \
  |  |  337|  1.40k|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 319, False: 2.19k]
  |  |  ------------------
  |  |  338|  1.40k|            op; /*-fallthrough*/                                               \
  |  |  339|  1.80k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 406, False: 2.11k]
  |  |  ------------------
  |  |  340|  1.80k|            op; /*-fallthrough*/                                               \
  |  |  341|  2.13k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 328, False: 2.18k]
  |  |  ------------------
  |  |  342|  2.13k|            op; /*-fallthrough*/                                               \
  |  |  343|  2.51k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 382, False: 2.13k]
  |  |  ------------------
  |  |  344|  2.51k|            op; /*-fallthrough*/                                               \
  |  |  345|  2.51k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 2.51k]
  |  |  ------------------
  |  |  346|  2.51k|    }
  ------------------
  582|  2.51k|                    PredictorAccumulate32NativeUnaligned(cp + 4 * stride, cp);
  583|  2.51k|                    cp += 4)
  584|  2.51k|            wc -= stride;
  585|  2.51k|        } while (wc > 0);
  ------------------
  |  Branch (585:18): [True: 2.19k, False: 322]
  ------------------
  586|    322|    }
  587|    608|    return 1;
  588|    608|}
tif_predict.c:PredictorAccumulate32NativeUnaligned:
  378|  9.37k|{
  379|  9.37k|    uint32_t thisval;
  380|  9.37k|    uint32_t prevval;
  381|  9.37k|    memcpy(&thisval, current, sizeof(thisval));
  382|  9.37k|    memcpy(&prevval, previous, sizeof(prevval));
  383|  9.37k|    thisval += prevval;
  384|  9.37k|    memcpy(current, &thisval, sizeof(thisval));
  385|  9.37k|}
tif_predict.c:horAcc64:
  600|    360|{
  601|    360|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|    360|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  602|    360|    uint8_t *cp = cp0;
  603|    360|    tmsize_t wc = cc / 8;
  604|       |
  605|    360|    if ((cc % (8 * stride)) != 0)
  ------------------
  |  Branch (605:9): [True: 0, False: 360]
  ------------------
  606|      0|    {
  607|      0|        TIFFErrorExtR(tif, "horAcc64", "%s", "cc%(8*stride))!=0");
  608|      0|        return 0;
  609|      0|    }
  610|       |
  611|    360|    if (wc > stride)
  ------------------
  |  Branch (611:9): [True: 271, False: 89]
  ------------------
  612|    271|    {
  613|    271|        wc -= stride;
  614|    271|        do
  615|  3.16k|        {
  616|  3.16k|            REPEAT4(stride,
  ------------------
  |  |  327|  3.16k|    switch (n)                                                                 \
  |  |  328|  3.16k|    {                                                                          \
  |  |  329|  1.59k|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 1.59k, False: 1.57k]
  |  |  ------------------
  |  |  330|  1.59k|        {                                                                      \
  |  |  331|  1.59k|            tmsize_t i;                                                        \
  |  |  332|  4.63k|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 3.03k, False: 1.59k]
  |  |  ------------------
  |  |  333|  3.03k|            {                                                                  \
  |  |  334|  3.03k|                op;                                                            \
  |  |  335|  3.03k|            }                                                                  \
  |  |  336|  1.59k|        } /*-fallthrough*/                                                     \
  |  |  337|  2.23k|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 643, False: 2.52k]
  |  |  ------------------
  |  |  338|  2.23k|            op; /*-fallthrough*/                                               \
  |  |  339|  2.44k|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 207, False: 2.96k]
  |  |  ------------------
  |  |  340|  2.44k|            op; /*-fallthrough*/                                               \
  |  |  341|  2.71k|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 268, False: 2.90k]
  |  |  ------------------
  |  |  342|  2.71k|            op; /*-fallthrough*/                                               \
  |  |  343|  3.16k|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 458, False: 2.71k]
  |  |  ------------------
  |  |  344|  3.16k|            op; /*-fallthrough*/                                               \
  |  |  345|  3.16k|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 3.16k]
  |  |  ------------------
  |  |  346|  3.16k|    }
  ------------------
  617|  3.16k|                    PredictorAccumulate64NativeUnaligned(cp + 8 * stride, cp);
  618|  3.16k|                    cp += 8)
  619|  3.16k|            wc -= stride;
  620|  3.16k|        } while (wc > 0);
  ------------------
  |  Branch (620:18): [True: 2.89k, False: 271]
  ------------------
  621|    271|    }
  622|    360|    return 1;
  623|    360|}
tif_predict.c:PredictorAccumulate64NativeUnaligned:
  390|  13.5k|{
  391|  13.5k|    uint64_t thisval;
  392|  13.5k|    uint64_t prevval;
  393|  13.5k|    memcpy(&thisval, current, sizeof(thisval));
  394|  13.5k|    memcpy(&prevval, previous, sizeof(prevval));
  395|  13.5k|    thisval += prevval;
  396|  13.5k|    memcpy(current, &thisval, sizeof(thisval));
  397|  13.5k|}
tif_predict.c:PredictorDecodeRow:
  746|  2.67k|{
  747|  2.67k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  2.67k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  748|       |
  749|  2.67k|    assert(sp != NULL);
  ------------------
  |  Branch (749:5): [True: 0, False: 2.67k]
  |  Branch (749:5): [True: 2.67k, False: 0]
  ------------------
  750|  2.67k|    assert(sp->decoderow != NULL);
  ------------------
  |  Branch (750:5): [True: 0, False: 2.67k]
  |  Branch (750:5): [True: 2.67k, False: 0]
  ------------------
  751|  2.67k|    assert(sp->decodepfunc != NULL);
  ------------------
  |  Branch (751:5): [True: 0, False: 2.67k]
  |  Branch (751:5): [True: 2.67k, False: 0]
  ------------------
  752|       |
  753|  2.67k|    if ((*sp->decoderow)(tif, op0, occ0, s))
  ------------------
  |  Branch (753:9): [True: 2.49k, False: 175]
  ------------------
  754|  2.49k|    {
  755|  2.49k|        return (*sp->decodepfunc)(tif, op0, occ0);
  756|  2.49k|    }
  757|    175|    else
  758|    175|        return 0;
  759|  2.67k|}
tif_predict.c:PredictorDecodeTile:
  770|  6.61k|{
  771|  6.61k|    TIFFPredictorState *sp = PredictorState(tif);
  ------------------
  |  |   37|  6.61k|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  772|       |
  773|  6.61k|    assert(sp != NULL);
  ------------------
  |  Branch (773:5): [True: 0, False: 6.61k]
  |  Branch (773:5): [True: 6.61k, False: 0]
  ------------------
  774|  6.61k|    assert(sp->decodetile != NULL);
  ------------------
  |  Branch (774:5): [True: 0, False: 6.61k]
  |  Branch (774:5): [True: 6.61k, False: 0]
  ------------------
  775|       |
  776|  6.61k|    if ((*sp->decodetile)(tif, op0, occ0, s))
  ------------------
  |  Branch (776:9): [True: 1.58k, False: 5.03k]
  ------------------
  777|  1.58k|    {
  778|  1.58k|        tmsize_t rowsize = sp->rowsize;
  779|  1.58k|        assert(rowsize > 0);
  ------------------
  |  Branch (779:9): [True: 0, False: 1.58k]
  |  Branch (779:9): [True: 1.58k, False: 0]
  ------------------
  780|  1.58k|        if ((occ0 % rowsize) != 0)
  ------------------
  |  Branch (780:13): [True: 263, False: 1.32k]
  ------------------
  781|    263|        {
  782|    263|            TIFFErrorExtR(tif, "PredictorDecodeTile", "%s",
  783|    263|                          "occ0%rowsize != 0");
  784|    263|            return 0;
  785|    263|        }
  786|  1.58k|        assert(sp->decodepfunc != NULL);
  ------------------
  |  Branch (786:9): [True: 0, False: 1.32k]
  |  Branch (786:9): [True: 1.32k, False: 0]
  ------------------
  787|  5.09k|        while (occ0 > 0)
  ------------------
  |  Branch (787:16): [True: 3.77k, False: 1.32k]
  ------------------
  788|  3.77k|        {
  789|  3.77k|            if (!(*sp->decodepfunc)(tif, op0, rowsize))
  ------------------
  |  Branch (789:17): [True: 0, False: 3.77k]
  ------------------
  790|      0|                return 0;
  791|  3.77k|            occ0 -= rowsize;
  792|  3.77k|            op0 += rowsize;
  793|  3.77k|        }
  794|  1.32k|        return 1;
  795|  1.32k|    }
  796|  5.03k|    else
  797|  5.03k|        return 0;
  798|  6.61k|}
tif_predict.c:swabHorAcc16:
  521|    390|{
  522|    390|    tmsize_t wc = cc / 2;
  523|       |
  524|    390|    PredictorSwabByteStream16(cp0, wc);
  525|    390|    return horAcc16(tif, cp0, cc);
  526|    390|}
tif_predict.c:PredictorSwabByteStream16:
  400|    390|{
  401|  17.7k|    while (n-- > 0)
  ------------------
  |  Branch (401:12): [True: 17.4k, False: 390]
  ------------------
  402|  17.4k|    {
  403|  17.4k|        uint8_t tmp = cp[0];
  404|  17.4k|        cp[0] = cp[1];
  405|  17.4k|        cp[1] = tmp;
  406|  17.4k|        cp += 2;
  407|  17.4k|    }
  408|    390|}
tif_predict.c:swabHorAcc32:
  556|    572|{
  557|    572|    tmsize_t wc = cc / 4;
  558|       |
  559|    572|    PredictorSwabByteStream32(cp0, wc);
  560|    572|    return horAcc32(tif, cp0, cc);
  561|    572|}
tif_predict.c:PredictorSwabByteStream32:
  411|    572|{
  412|  11.0k|    while (n-- > 0)
  ------------------
  |  Branch (412:12): [True: 10.4k, False: 572]
  ------------------
  413|  10.4k|    {
  414|  10.4k|        uint8_t tmp = cp[0];
  415|  10.4k|        cp[0] = cp[3];
  416|  10.4k|        cp[3] = tmp;
  417|  10.4k|        tmp = cp[1];
  418|  10.4k|        cp[1] = cp[2];
  419|  10.4k|        cp[2] = tmp;
  420|  10.4k|        cp += 4;
  421|  10.4k|    }
  422|    572|}
tif_predict.c:swabHorAcc64:
  591|    265|{
  592|    265|    tmsize_t wc = cc / 8;
  593|       |
  594|    265|    PredictorSwabByteStream64(cp0, wc);
  595|    265|    return horAcc64(tif, cp0, cc);
  596|    265|}
tif_predict.c:PredictorSwabByteStream64:
  425|    265|{
  426|  14.5k|    while (n-- > 0)
  ------------------
  |  Branch (426:12): [True: 14.2k, False: 265]
  ------------------
  427|  14.2k|    {
  428|  14.2k|        uint8_t tmp = cp[0];
  429|  14.2k|        cp[0] = cp[7];
  430|  14.2k|        cp[7] = tmp;
  431|  14.2k|        tmp = cp[1];
  432|  14.2k|        cp[1] = cp[6];
  433|  14.2k|        cp[6] = tmp;
  434|  14.2k|        tmp = cp[2];
  435|  14.2k|        cp[2] = cp[5];
  436|  14.2k|        cp[5] = tmp;
  437|  14.2k|        tmp = cp[3];
  438|  14.2k|        cp[3] = cp[4];
  439|  14.2k|        cp[4] = tmp;
  440|  14.2k|        cp += 8;
  441|  14.2k|    }
  442|    265|}
tif_predict.c:fpAcc:
  629|    280|{
  630|    280|    tmsize_t stride = PredictorState(tif)->stride;
  ------------------
  |  |   37|    280|#define PredictorState(tif) ((TIFFPredictorState *)(tif)->tif_data)
  ------------------
  631|    280|    uint32_t bps = tif->tif_dir.td_bitspersample / 8;
  632|    280|    tmsize_t wc = cc / bps;
  633|    280|    tmsize_t count = cc;
  634|    280|    uint8_t *cp = cp0;
  635|    280|    uint8_t *tmp;
  636|       |
  637|    280|    if (cc % (bps * stride) != 0)
  ------------------
  |  Branch (637:9): [True: 0, False: 280]
  ------------------
  638|      0|    {
  639|      0|        TIFFErrorExtR(tif, "fpAcc", "%s", "cc%(bps*stride))!=0");
  640|      0|        return 0;
  641|      0|    }
  642|       |
  643|    280|    tmp = (uint8_t *)_TIFFmallocExt(tif, cc);
  644|    280|    if (!tmp)
  ------------------
  |  Branch (644:9): [True: 0, False: 280]
  ------------------
  645|      0|        return 0;
  646|       |
  647|    280|    if (stride == 1)
  ------------------
  |  Branch (647:9): [True: 258, False: 22]
  ------------------
  648|    258|    {
  649|       |        /* Optimization of general case */
  650|    258|#define OP                                                                     \
  651|    258|    do                                                                         \
  652|    258|    {                                                                          \
  653|    258|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  654|    258|        ++cp;                                                                  \
  655|    258|    } while (0)
  656|    740|        for (; count > 8; count -= 8)
  ------------------
  |  Branch (656:16): [True: 482, False: 258]
  ------------------
  657|    482|        {
  658|    482|            OP;
  ------------------
  |  |  651|    482|    do                                                                         \
  |  |  652|    482|    {                                                                          \
  |  |  653|    482|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    482|        ++cp;                                                                  \
  |  |  655|    482|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 482]
  |  |  ------------------
  ------------------
  659|    482|            OP;
  ------------------
  |  |  651|    482|    do                                                                         \
  |  |  652|    482|    {                                                                          \
  |  |  653|    482|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    482|        ++cp;                                                                  \
  |  |  655|    482|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 482]
  |  |  ------------------
  ------------------
  660|    482|            OP;
  ------------------
  |  |  651|    482|    do                                                                         \
  |  |  652|    482|    {                                                                          \
  |  |  653|    482|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    482|        ++cp;                                                                  \
  |  |  655|    482|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 482]
  |  |  ------------------
  ------------------
  661|    482|            OP;
  ------------------
  |  |  651|    482|    do                                                                         \
  |  |  652|    482|    {                                                                          \
  |  |  653|    482|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    482|        ++cp;                                                                  \
  |  |  655|    482|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 482]
  |  |  ------------------
  ------------------
  662|    482|            OP;
  ------------------
  |  |  651|    482|    do                                                                         \
  |  |  652|    482|    {                                                                          \
  |  |  653|    482|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    482|        ++cp;                                                                  \
  |  |  655|    482|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 482]
  |  |  ------------------
  ------------------
  663|    482|            OP;
  ------------------
  |  |  651|    482|    do                                                                         \
  |  |  652|    482|    {                                                                          \
  |  |  653|    482|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    482|        ++cp;                                                                  \
  |  |  655|    482|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 482]
  |  |  ------------------
  ------------------
  664|    482|            OP;
  ------------------
  |  |  651|    482|    do                                                                         \
  |  |  652|    482|    {                                                                          \
  |  |  653|    482|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    482|        ++cp;                                                                  \
  |  |  655|    482|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 482]
  |  |  ------------------
  ------------------
  665|    482|            OP;
  ------------------
  |  |  651|    482|    do                                                                         \
  |  |  652|    482|    {                                                                          \
  |  |  653|    482|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    482|        ++cp;                                                                  \
  |  |  655|    482|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 482]
  |  |  ------------------
  ------------------
  666|    482|        }
  667|    533|        for (; count > 1; count -= 1)
  ------------------
  |  Branch (667:16): [True: 275, False: 258]
  ------------------
  668|    275|        {
  669|    275|            OP;
  ------------------
  |  |  651|    275|    do                                                                         \
  |  |  652|    275|    {                                                                          \
  |  |  653|    275|        cp[1] = (uint8_t)((cp[1] + cp[0]) & 0xff);                             \
  |  |  654|    275|        ++cp;                                                                  \
  |  |  655|    275|    } while (0)
  |  |  ------------------
  |  |  |  Branch (655:14): [Folded, False: 275]
  |  |  ------------------
  ------------------
  670|    275|        }
  671|    258|#undef OP
  672|    258|    }
  673|     22|    else
  674|     22|    {
  675|    582|        while (count > stride)
  ------------------
  |  Branch (675:16): [True: 560, False: 22]
  ------------------
  676|    560|        {
  677|    560|            REPEAT4(stride, cp[stride] = (uint8_t)((cp[stride] + cp[0]) & 0xff);
  ------------------
  |  |  327|    560|    switch (n)                                                                 \
  |  |  328|    560|    {                                                                          \
  |  |  329|      6|        default:                                                               \
  |  |  ------------------
  |  |  |  Branch (329:9): [True: 6, False: 554]
  |  |  ------------------
  |  |  330|      6|        {                                                                      \
  |  |  331|      6|            tmsize_t i;                                                        \
  |  |  332|     18|            for (i = n - 4; i > 0; i--)                                        \
  |  |  ------------------
  |  |  |  Branch (332:29): [True: 12, False: 6]
  |  |  ------------------
  |  |  333|     12|            {                                                                  \
  |  |  334|     12|                op;                                                            \
  |  |  335|     12|            }                                                                  \
  |  |  336|      6|        } /*-fallthrough*/                                                     \
  |  |  337|     15|        case 4:                                                                \
  |  |  ------------------
  |  |  |  Branch (337:9): [True: 9, False: 551]
  |  |  ------------------
  |  |  338|     15|            op; /*-fallthrough*/                                               \
  |  |  339|     18|        case 3:                                                                \
  |  |  ------------------
  |  |  |  Branch (339:9): [True: 3, False: 557]
  |  |  ------------------
  |  |  340|     18|            op; /*-fallthrough*/                                               \
  |  |  341|    560|        case 2:                                                                \
  |  |  ------------------
  |  |  |  Branch (341:9): [True: 542, False: 18]
  |  |  ------------------
  |  |  342|    560|            op; /*-fallthrough*/                                               \
  |  |  343|    560|        case 1:                                                                \
  |  |  ------------------
  |  |  |  Branch (343:9): [True: 0, False: 560]
  |  |  ------------------
  |  |  344|    560|            op; /*-fallthrough*/                                               \
  |  |  345|    560|        case 0:;                                                               \
  |  |  ------------------
  |  |  |  Branch (345:9): [True: 0, False: 560]
  |  |  ------------------
  |  |  346|    560|    }
  ------------------
  678|    560|                    cp++)
  679|    560|            count -= stride;
  680|    560|        }
  681|     22|    }
  682|       |
  683|    280|    _TIFFmemcpy(tmp, cp0, cc);
  684|    280|    cp = (uint8_t *)cp0;
  685|    280|    count = 0;
  686|       |
  687|    280|#if defined(__x86_64__) || (defined(_M_X64) && !defined(_M_ARM64EC))
  688|    280|    if (bps == 4)
  ------------------
  |  Branch (688:9): [True: 9, False: 271]
  ------------------
  689|      9|    {
  690|       |        /* Optimization of general case */
  691|     75|        for (; count + 15 < wc; count += 16)
  ------------------
  |  Branch (691:16): [True: 66, False: 9]
  ------------------
  692|     66|        {
  693|       |            /* Interlace 4*16 byte values */
  694|       |
  695|     66|            __m128i xmm0 =
  696|     66|                _mm_loadu_si128((const __m128i *)(tmp + count + 3 * wc));
  697|     66|            __m128i xmm1 =
  698|     66|                _mm_loadu_si128((const __m128i *)(tmp + count + 2 * wc));
  699|     66|            __m128i xmm2 =
  700|     66|                _mm_loadu_si128((const __m128i *)(tmp + count + 1 * wc));
  701|     66|            __m128i xmm3 =
  702|     66|                _mm_loadu_si128((const __m128i *)(tmp + count + 0 * wc));
  703|       |            /* (xmm0_0, xmm1_0, xmm0_1, xmm1_1, xmm0_2, xmm1_2, ...) */
  704|     66|            __m128i tmp0 = _mm_unpacklo_epi8(xmm0, xmm1);
  705|       |            /* (xmm0_8, xmm1_8, xmm0_9, xmm1_9, xmm0_10, xmm1_10, ...) */
  706|     66|            __m128i tmp1 = _mm_unpackhi_epi8(xmm0, xmm1);
  707|       |            /* (xmm2_0, xmm3_0, xmm2_1, xmm3_1, xmm2_2, xmm3_2, ...) */
  708|     66|            __m128i tmp2 = _mm_unpacklo_epi8(xmm2, xmm3);
  709|       |            /* (xmm2_8, xmm3_8, xmm2_9, xmm3_9, xmm2_10, xmm3_10, ...) */
  710|     66|            __m128i tmp3 = _mm_unpackhi_epi8(xmm2, xmm3);
  711|       |            /* (xmm0_0, xmm1_0, xmm2_0, xmm3_0, xmm0_1, xmm1_1, xmm2_1, xmm3_1,
  712|       |             * ...) */
  713|     66|            __m128i tmp2_0 = _mm_unpacklo_epi16(tmp0, tmp2);
  714|     66|            __m128i tmp2_1 = _mm_unpackhi_epi16(tmp0, tmp2);
  715|     66|            __m128i tmp2_2 = _mm_unpacklo_epi16(tmp1, tmp3);
  716|     66|            __m128i tmp2_3 = _mm_unpackhi_epi16(tmp1, tmp3);
  717|     66|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 0 * 16), tmp2_0);
  718|     66|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 1 * 16), tmp2_1);
  719|     66|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 2 * 16), tmp2_2);
  720|     66|            _mm_storeu_si128((__m128i *)(cp + 4 * count + 3 * 16), tmp2_3);
  721|     66|        }
  722|      9|    }
  723|    280|#endif
  724|       |
  725|    810|    for (; count < wc; count++)
  ------------------
  |  Branch (725:12): [True: 530, False: 280]
  ------------------
  726|    530|    {
  727|    530|        uint32_t byte;
  728|  1.94k|        for (byte = 0; byte < bps; byte++)
  ------------------
  |  Branch (728:24): [True: 1.41k, False: 530]
  ------------------
  729|  1.41k|        {
  730|       |#if WORDS_BIGENDIAN
  731|       |            cp[bps * count + byte] = tmp[byte * wc + count];
  732|       |#else
  733|  1.41k|            cp[bps * count + byte] = tmp[(bps - byte - 1) * wc + count];
  734|  1.41k|#endif
  735|  1.41k|        }
  736|    530|    }
  737|    280|    _TIFFfreeExt(tif, tmp);
  738|    280|    return 1;
  739|    280|}

TIFFReadScanline:
  490|  1.92M|{
  491|  1.92M|    int e;
  492|       |
  493|  1.92M|    if (!TIFFCheckRead(tif, 0))
  ------------------
  |  Branch (493:9): [True: 0, False: 1.92M]
  ------------------
  494|      0|        return (-1);
  495|  1.92M|    if ((e = TIFFSeek(tif, row, sample)) != 0)
  ------------------
  |  Branch (495:9): [True: 1.92M, False: 339]
  ------------------
  496|  1.92M|    {
  497|       |        /*
  498|       |         * Decompress desired row into user buffer.
  499|       |         */
  500|  1.92M|        e = (*tif->tif_decoderow)(tif, (uint8_t *)buf,
  501|  1.92M|                                  tif->tif_dir.td_scanlinesize, sample);
  502|       |
  503|       |        /* we are now poised at the beginning of the next row */
  504|  1.92M|        tif->tif_dir.td_row = row + 1;
  505|       |
  506|  1.92M|        if (e)
  ------------------
  |  Branch (506:13): [True: 1.92M, False: 824]
  ------------------
  507|  1.92M|            (*tif->tif_postdecode)(tif, (uint8_t *)buf,
  508|  1.92M|                                   tif->tif_dir.td_scanlinesize);
  509|  1.92M|    }
  510|    339|    else
  511|    339|    {
  512|       |        /* See TIFFReadEncodedStrip comment regarding TIFFTAG_FAXFILLFUNC. */
  513|    339|        if (buf)
  ------------------
  |  Branch (513:13): [True: 339, False: 0]
  ------------------
  514|    339|            memset(buf, 0, (size_t)tif->tif_dir.td_scanlinesize);
  515|    339|    }
  516|  1.92M|    return (e > 0 ? 1 : -1);
  ------------------
  |  Branch (516:13): [True: 1.92M, False: 1.19k]
  ------------------
  517|  1.92M|}
TIFFReadEncodedStrip:
  572|   552k|{
  573|   552k|    static const char module[] = "TIFFReadEncodedStrip";
  574|   552k|    TIFFDirectory *td = &tif->tif_dir;
  575|   552k|    tmsize_t stripsize;
  576|   552k|    uint16_t plane;
  577|       |
  578|   552k|    stripsize = TIFFReadEncodedStripGetStripSize(tif, strip, &plane);
  579|   552k|    if (stripsize == ((tmsize_t)(-1)))
  ------------------
  |  Branch (579:9): [True: 0, False: 552k]
  ------------------
  580|      0|        return ((tmsize_t)(-1));
  581|       |
  582|       |    /* shortcut to avoid an extra memcpy() */
  583|   552k|    if (td->td_compression == COMPRESSION_NONE && size != (tmsize_t)(-1) &&
  ------------------
  |  |  182|  1.10M|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (583:9): [True: 382k, False: 170k]
  |  Branch (583:51): [True: 382k, False: 0]
  ------------------
  584|   382k|        size >= stripsize && !isMapped(tif) &&
  ------------------
  |  |  279|   807k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|   254k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (584:9): [True: 254k, False: 127k]
  |  Branch (584:30): [True: 254k, False: 0]
  ------------------
  585|   254k|        ((tif->tif_flags & TIFF_NOREADRAW) == 0))
  ------------------
  |  |  138|   254k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (585:9): [True: 254k, False: 0]
  ------------------
  586|   254k|    {
  587|   254k|        if (TIFFReadRawStrip1(tif, strip, buf, stripsize, module) != stripsize)
  ------------------
  |  Branch (587:13): [True: 153k, False: 101k]
  ------------------
  588|   153k|            return ((tmsize_t)(-1));
  589|       |
  590|   101k|        if (!isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  280|   202k|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (590:13): [True: 700, False: 100k]
  ------------------
  591|    700|            (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |  127|    700|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (591:13): [True: 700, False: 0]
  ------------------
  592|    700|            TIFFReverseBits((uint8_t *)buf, stripsize);
  593|       |
  594|   101k|        (*tif->tif_postdecode)(tif, (uint8_t *)buf, stripsize);
  595|   101k|        return (stripsize);
  596|   254k|    }
  597|       |
  598|   298k|    if ((size != (tmsize_t)(-1)) && (size < stripsize))
  ------------------
  |  Branch (598:9): [True: 298k, False: 0]
  |  Branch (598:37): [True: 127k, False: 170k]
  ------------------
  599|   127k|        stripsize = size;
  600|   298k|    if (!TIFFFillStrip(tif, strip))
  ------------------
  |  Branch (600:9): [True: 282k, False: 15.8k]
  ------------------
  601|   282k|    {
  602|       |        /* The output buf may be NULL, in particular if TIFFTAG_FAXFILLFUNC
  603|       |           is being used. Thus, memset must be conditional on buf not NULL. */
  604|   282k|        if (buf)
  ------------------
  |  Branch (604:13): [True: 282k, False: 0]
  ------------------
  605|   282k|            memset(buf, 0, (size_t)stripsize);
  606|   282k|        return ((tmsize_t)(-1));
  607|   282k|    }
  608|  15.8k|    if ((*tif->tif_decodestrip)(tif, (uint8_t *)buf, stripsize, plane) <= 0)
  ------------------
  |  Branch (608:9): [True: 11.6k, False: 4.23k]
  ------------------
  609|  11.6k|        return ((tmsize_t)(-1));
  610|  4.23k|    (*tif->tif_postdecode)(tif, (uint8_t *)buf, stripsize);
  611|  4.23k|    return (stripsize);
  612|  15.8k|}
_TIFFReadEncodedStripAndAllocBuffer:
  624|   348k|{
  625|   348k|    tmsize_t this_stripsize;
  626|   348k|    uint16_t plane;
  627|       |
  628|   348k|    if (*buf != NULL)
  ------------------
  |  Branch (628:9): [True: 348k, False: 701]
  ------------------
  629|   348k|    {
  630|   348k|        return TIFFReadEncodedStrip(tif, strip, *buf, size_to_read);
  631|   348k|    }
  632|       |
  633|    701|    this_stripsize = TIFFReadEncodedStripGetStripSize(tif, strip, &plane);
  634|    701|    if (this_stripsize == ((tmsize_t)(-1)))
  ------------------
  |  Branch (634:9): [True: 0, False: 701]
  ------------------
  635|      0|        return ((tmsize_t)(-1));
  636|       |
  637|    701|    if ((size_to_read != (tmsize_t)(-1)) && (size_to_read < this_stripsize))
  ------------------
  |  Branch (637:9): [True: 701, False: 0]
  |  Branch (637:45): [True: 31, False: 670]
  ------------------
  638|     31|        this_stripsize = size_to_read;
  639|    701|    if (!TIFFFillStrip(tif, strip))
  ------------------
  |  Branch (639:9): [True: 116, False: 585]
  ------------------
  640|    116|        return ((tmsize_t)(-1));
  641|       |
  642|       |    /* Sanity checks to avoid excessive memory allocation */
  643|       |    /* Max compression ratio experimentally determined. Might be fragile...
  644|       |     * Only apply this heuristics to situations where the memory allocation
  645|       |     * would be big, to avoid breaking nominal use cases.
  646|       |     */
  647|    585|    if (bufsizetoalloc > 100 * 1024 * 1024)
  ------------------
  |  Branch (647:9): [True: 9, False: 576]
  ------------------
  648|      9|    {
  649|      9|        const uint64_t maxCompressionRatio = TIFFGetMaxCompressionRatio(tif);
  650|      9|        if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (650:13): [True: 3, False: 6]
  ------------------
  651|      3|            (uint64_t)tif->tif_rawdatasize <
  ------------------
  |  Branch (651:13): [True: 3, False: 0]
  ------------------
  652|      3|                (uint64_t)this_stripsize / maxCompressionRatio)
  653|      3|        {
  654|      3|            TIFFErrorExtR(tif, TIFFFileName(tif),
  655|      3|                          "Likely invalid strip byte count for strip %u. "
  656|      3|                          "Uncompressed strip size is %" PRIu64 ", "
  657|      3|                          "compressed one is %" PRIu64,
  658|      3|                          strip, (uint64_t)this_stripsize,
  659|      3|                          (uint64_t)tif->tif_rawdatasize);
  660|      3|            return ((tmsize_t)(-1));
  661|      3|        }
  662|      9|    }
  663|       |
  664|    582|    *buf = _TIFFcallocExt(tif, 1, bufsizetoalloc);
  665|    582|    if (*buf == NULL)
  ------------------
  |  Branch (665:9): [True: 0, False: 582]
  ------------------
  666|      0|    {
  667|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "No space for strip buffer");
  668|      0|        return ((tmsize_t)(-1));
  669|      0|    }
  670|       |
  671|    582|    if ((*tif->tif_decodestrip)(tif, (uint8_t *)*buf, this_stripsize, plane) <=
  ------------------
  |  Branch (671:9): [True: 333, False: 249]
  ------------------
  672|    582|        0)
  673|    333|        return ((tmsize_t)(-1));
  674|    249|    (*tif->tif_postdecode)(tif, (uint8_t *)*buf, this_stripsize);
  675|    249|    return (this_stripsize);
  676|    582|}
TIFFFillStrip:
  818|   306k|{
  819|   306k|    static const char module[] = "TIFFFillStrip";
  820|   306k|    TIFFDirectory *td = &tif->tif_dir;
  821|       |
  822|   306k|    if ((tif->tif_flags & TIFF_NOREADRAW) == 0)
  ------------------
  |  |  138|   306k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (822:9): [True: 300k, False: 5.45k]
  ------------------
  823|   300k|    {
  824|   300k|        uint64_t bytecount = TIFFGetStrileByteCount(tif, strip);
  825|   300k|        if (bytecount == 0 || bytecount > (uint64_t)TIFF_INT64_MAX)
  ------------------
  |  |   49|  26.3k|#define TIFF_INT64_MAX ((((int64_t)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
  ------------------
  |  Branch (825:13): [True: 274k, False: 26.3k]
  |  Branch (825:31): [True: 2, False: 26.3k]
  ------------------
  826|   274k|        {
  827|   274k|            TIFFErrorExtR(tif, module,
  828|   274k|                          "Invalid strip byte count %" PRIu64
  829|   274k|                          ", strip %" PRIu32,
  830|   274k|                          bytecount, strip);
  831|   274k|            return (0);
  832|   274k|        }
  833|       |
  834|       |        /* To avoid excessive memory allocations: */
  835|  26.3k|        const tmsize_t stripsize = TIFFStripSize(tif);
  836|  26.3k|        if (stripsize > 0)
  ------------------
  |  Branch (836:13): [True: 26.3k, False: 0]
  ------------------
  837|  26.3k|        {
  838|  26.3k|            if (bytecount > 1024 * 1024 &&
  ------------------
  |  Branch (838:17): [True: 742, False: 25.6k]
  ------------------
  839|    742|                (bytecount - 4096) / 10 > (uint64_t)stripsize)
  ------------------
  |  Branch (839:17): [True: 404, False: 338]
  ------------------
  840|    404|            {
  841|       |                /* Byte count should normally not be larger than a number of */
  842|       |                /* times the uncompressed size plus some margin */
  843|       |                /* 10 and 4096 are just values that could be adjusted. */
  844|       |                /* Hopefully they are safe enough for all codecs */
  845|       |                /* What happens next will depend on whether only the bytecount
  846|       |                 */
  847|       |                /* was corrupted to a large value but the strip/tile data is */
  848|       |                /* fine. In that situation most codecs should work fine and */
  849|       |                /* only used part of the tile/strip data. If the strip/tile */
  850|       |                /* data is corrupted too, then codecs will later error out. */
  851|    404|                uint64_t newbytecount = (uint64_t)stripsize * 10 + 4096;
  852|    404|                TIFFWarningExtR(tif, module,
  853|    404|                                "Too large strip byte count %" PRIu64
  854|    404|                                ", strip %" PRIu32 ". Limiting to %" PRIu64,
  855|    404|                                bytecount, strip, newbytecount);
  856|    404|                bytecount = newbytecount;
  857|    404|            }
  858|  25.9k|            else if (stripsize > 100 * 1024 * 1024)
  ------------------
  |  Branch (858:22): [True: 97, False: 25.8k]
  ------------------
  859|     97|            {
  860|       |                /* Max compression ratio experimentally determined. Might be
  861|       |                 * fragile... Only apply this heuristics to situations where the
  862|       |                 * memory allocation would be big, to avoid breaking nominal use
  863|       |                 * cases.
  864|       |                 */
  865|     97|                const uint64_t maxCompressionRatio =
  866|     97|                    TIFFGetMaxCompressionRatio(tif);
  867|     97|                if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (867:21): [True: 16, False: 81]
  ------------------
  868|     16|                    bytecount < (uint64_t)stripsize / maxCompressionRatio)
  ------------------
  |  Branch (868:21): [True: 12, False: 4]
  ------------------
  869|     12|                {
  870|     12|                    TIFFErrorExtR(
  871|     12|                        tif, module,
  872|     12|                        "Likely invalid strip byte count for strip %u. "
  873|     12|                        "Uncompressed strip size is %" PRIu64 ", "
  874|     12|                        "compressed one is %" PRIu64,
  875|     12|                        strip, (uint64_t)stripsize, bytecount);
  876|     12|                    return 0;
  877|     12|                }
  878|     97|            }
  879|  26.3k|        }
  880|       |
  881|  26.3k|        if (isMapped(tif))
  ------------------
  |  |  279|  26.3k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  26.3k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 26.3k]
  |  |  ------------------
  ------------------
  882|      0|        {
  883|       |            /*
  884|       |             * We must check for overflow, potentially causing
  885|       |             * an OOB read. Instead of simple
  886|       |             *
  887|       |             *  TIFFGetStrileOffset(tif, strip)+bytecount > tif->tif_size
  888|       |             *
  889|       |             * comparison (which can overflow) we do the following
  890|       |             * two comparisons:
  891|       |             */
  892|      0|            if (bytecount > (uint64_t)tif->tif_size ||
  ------------------
  |  Branch (892:17): [True: 0, False: 0]
  ------------------
  893|      0|                TIFFGetStrileOffset(tif, strip) >
  ------------------
  |  Branch (893:17): [True: 0, False: 0]
  ------------------
  894|      0|                    (uint64_t)tif->tif_size - bytecount)
  895|      0|            {
  896|       |                /*
  897|       |                 * This error message might seem strange, but
  898|       |                 * it's what would happen if a read were done
  899|       |                 * instead.
  900|       |                 */
  901|      0|                TIFFErrorExtR(
  902|      0|                    tif, module,
  903|       |
  904|      0|                    "Read error on strip %" PRIu32 "; "
  905|      0|                    "got %" PRIu64 " bytes, expected %" PRIu64,
  906|      0|                    strip,
  907|      0|                    NoSanitizeSubUInt64((uint64_t)tif->tif_size,
  908|      0|                                        TIFFGetStrileOffset(tif, strip)),
  909|      0|                    bytecount);
  910|      0|                tif->tif_dir.td_curstrip = NOSTRIP;
  ------------------
  |  |  111|      0|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
  911|      0|                return (0);
  912|      0|            }
  913|      0|        }
  914|       |
  915|  26.3k|        if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) ||
  ------------------
  |  |  279|  52.7k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  26.3k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 26.3k]
  |  |  ------------------
  ------------------
                      if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) ||
  ------------------
  |  |  280|      0|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  |  |  ------------------
  |  |  |  Branch (280:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  916|      0|                              (tif->tif_flags & TIFF_NOBITREV)))
  ------------------
  |  |  127|      0|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (916:31): [True: 0, False: 0]
  ------------------
  917|      0|        {
  918|       |            /*
  919|       |             * The image is mapped into memory and we either don't
  920|       |             * need to flip bits or the compression routine is
  921|       |             * going to handle this operation itself.  In this
  922|       |             * case, avoid copying the raw data and instead just
  923|       |             * reference the data from the memory mapped file
  924|       |             * image.  This assumes that the decompression
  925|       |             * routines do not modify the contents of the raw data
  926|       |             * buffer (if they try to, the application will get a
  927|       |             * fault since the file is mapped read-only).
  928|       |             */
  929|      0|            if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)
  ------------------
  |  |  128|      0|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (929:17): [True: 0, False: 0]
  |  Branch (929:53): [True: 0, False: 0]
  ------------------
  930|      0|            {
  931|      0|                _TIFFfreeExt(tif, tif->tif_rawdata);
  932|      0|                tif->tif_rawdata = NULL;
  933|      0|                tif->tif_rawdatasize = 0;
  934|      0|            }
  935|      0|            tif->tif_flags &= ~TIFF_MYBUFFER;
  ------------------
  |  |  128|      0|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  936|      0|            tif->tif_rawdatasize = (tmsize_t)bytecount;
  937|      0|            tif->tif_rawdata =
  938|      0|                tif->tif_base + (tmsize_t)TIFFGetStrileOffset(tif, strip);
  939|      0|            tif->tif_rawdataoff = 0;
  940|      0|            tif->tif_rawdataloaded = (tmsize_t)bytecount;
  941|       |
  942|       |            /*
  943|       |             * When we have tif_rawdata reference directly into the memory
  944|       |             * mapped file we need to be pretty careful about how we use the
  945|       |             * rawdata.  It is not a general purpose working buffer as it
  946|       |             * normally otherwise is.  So we keep track of this fact to avoid
  947|       |             * using it improperly.
  948|       |             */
  949|      0|            tif->tif_flags |= TIFF_BUFFERMMAP;
  ------------------
  |  |  145|      0|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  950|      0|        }
  951|  26.3k|        else
  952|  26.3k|        {
  953|       |            /*
  954|       |             * Expand raw data buffer, if needed, to hold data
  955|       |             * strip coming from file (perhaps should set upper
  956|       |             * bound on the size of a buffer we'll use?).
  957|       |             */
  958|  26.3k|            tmsize_t bytecountm;
  959|  26.3k|            bytecountm = (tmsize_t)bytecount;
  960|  26.3k|            if ((uint64_t)bytecountm != bytecount)
  ------------------
  |  Branch (960:17): [True: 0, False: 26.3k]
  ------------------
  961|      0|            {
  962|      0|                TIFFErrorExtR(tif, module, "Integer overflow");
  963|      0|                return (0);
  964|      0|            }
  965|  26.3k|            if (bytecountm > tif->tif_rawdatasize)
  ------------------
  |  Branch (965:17): [True: 2.46k, False: 23.9k]
  ------------------
  966|  2.46k|            {
  967|  2.46k|                tif->tif_dir.td_curstrip = NOSTRIP;
  ------------------
  |  |  111|  2.46k|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
  968|  2.46k|                if ((tif->tif_flags & TIFF_MYBUFFER) == 0)
  ------------------
  |  |  128|  2.46k|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (968:21): [True: 0, False: 2.46k]
  ------------------
  969|      0|                {
  970|      0|                    TIFFErrorExtR(
  971|      0|                        tif, module,
  972|      0|                        "Data buffer too small to hold strip %" PRIu32, strip);
  973|      0|                    return (0);
  974|      0|                }
  975|  2.46k|            }
  976|  26.3k|            if (tif->tif_flags & TIFF_BUFFERMMAP)
  ------------------
  |  |  145|  26.3k|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  |  Branch (976:17): [True: 0, False: 26.3k]
  ------------------
  977|      0|            {
  978|      0|                tif->tif_dir.td_curstrip = NOSTRIP;
  ------------------
  |  |  111|      0|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
  979|      0|                tif->tif_rawdata = NULL;
  980|      0|                tif->tif_rawdatasize = 0;
  981|      0|                tif->tif_flags &= ~TIFF_BUFFERMMAP;
  ------------------
  |  |  145|      0|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  982|      0|            }
  983|       |
  984|  26.3k|            if (isMapped(tif))
  ------------------
  |  |  279|  26.3k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|  26.3k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 26.3k]
  |  |  ------------------
  ------------------
  985|      0|            {
  986|      0|                if (bytecountm > tif->tif_rawdatasize &&
  ------------------
  |  Branch (986:21): [True: 0, False: 0]
  ------------------
  987|      0|                    !TIFFReadBufferSetup(tif, 0, bytecountm))
  ------------------
  |  Branch (987:21): [True: 0, False: 0]
  ------------------
  988|      0|                {
  989|      0|                    return (0);
  990|      0|                }
  991|      0|                if (TIFFReadRawStrip1(tif, strip, tif->tif_rawdata, bytecountm,
  ------------------
  |  Branch (991:21): [True: 0, False: 0]
  ------------------
  992|      0|                                      module) != bytecountm)
  993|      0|                {
  994|      0|                    return (0);
  995|      0|                }
  996|      0|            }
  997|  26.3k|            else
  998|  26.3k|            {
  999|  26.3k|                if (TIFFReadRawStripOrTile2(tif, strip, 1, bytecountm,
  ------------------
  |  Branch (999:21): [True: 5.17k, False: 21.1k]
  ------------------
 1000|  26.3k|                                            module) != bytecountm)
 1001|  5.17k|                {
 1002|  5.17k|                    return (0);
 1003|  5.17k|                }
 1004|  26.3k|            }
 1005|       |
 1006|  21.1k|            tif->tif_rawdataoff = 0;
 1007|  21.1k|            tif->tif_rawdataloaded = bytecountm;
 1008|       |
 1009|  21.1k|            if (!isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  280|  42.3k|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (1009:17): [True: 76, False: 21.1k]
  ------------------
 1010|     76|                (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |  127|     76|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (1010:17): [True: 6, False: 70]
  ------------------
 1011|      6|                TIFFReverseBits(tif->tif_rawdata, bytecountm);
 1012|  21.1k|        }
 1013|  26.3k|    }
 1014|  26.6k|    return (TIFFStartStrip(tif, strip));
 1015|   306k|}
TIFFReadTile:
 1028|   869k|{
 1029|   869k|    if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
  ------------------
  |  Branch (1029:9): [True: 0, False: 869k]
  |  Branch (1029:35): [True: 366, False: 869k]
  ------------------
 1030|    366|        return ((tmsize_t)(-1));
 1031|   869k|    return (TIFFReadEncodedTile(tif, TIFFComputeTile(tif, x, y, z, s), buf,
 1032|   869k|                                (tmsize_t)(-1)));
 1033|   869k|}
TIFFReadEncodedTile:
 1040|  1.52M|{
 1041|  1.52M|    static const char module[] = "TIFFReadEncodedTile";
 1042|  1.52M|    TIFFDirectory *td = &tif->tif_dir;
 1043|  1.52M|    tmsize_t tilesize = tif->tif_dir.td_tilesize;
 1044|       |
 1045|  1.52M|    if (!TIFFCheckRead(tif, 1))
  ------------------
  |  Branch (1045:9): [True: 0, False: 1.52M]
  ------------------
 1046|      0|        return ((tmsize_t)(-1));
 1047|  1.52M|    if (tile >= td->td_nstrips)
  ------------------
  |  Branch (1047:9): [True: 0, False: 1.52M]
  ------------------
 1048|      0|    {
 1049|      0|        TIFFErrorExtR(tif, module,
 1050|      0|                      "%" PRIu32 ": Tile out of range, max %" PRIu32, tile,
 1051|      0|                      td->td_nstrips);
 1052|      0|        return ((tmsize_t)(-1));
 1053|      0|    }
 1054|       |
 1055|       |    /* shortcut to avoid an extra memcpy() */
 1056|  1.52M|    if (td->td_compression == COMPRESSION_NONE && size != (tmsize_t)(-1) &&
  ------------------
  |  |  182|  3.05M|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (1056:9): [True: 239k, False: 1.28M]
  |  Branch (1056:51): [True: 0, False: 239k]
  ------------------
 1057|      0|        size >= tilesize && !isMapped(tif) &&
  ------------------
  |  |  279|  1.52M|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|      0|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (1057:9): [True: 0, False: 0]
  |  Branch (1057:29): [True: 0, False: 0]
  ------------------
 1058|      0|        ((tif->tif_flags & TIFF_NOREADRAW) == 0))
  ------------------
  |  |  138|      0|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1058:9): [True: 0, False: 0]
  ------------------
 1059|      0|    {
 1060|      0|        if (TIFFReadRawTile1(tif, tile, buf, tilesize, module) != tilesize)
  ------------------
  |  Branch (1060:13): [True: 0, False: 0]
  ------------------
 1061|      0|            return ((tmsize_t)(-1));
 1062|       |
 1063|      0|        if (!isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  280|      0|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (1063:13): [True: 0, False: 0]
  ------------------
 1064|      0|            (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |  127|      0|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (1064:13): [True: 0, False: 0]
  ------------------
 1065|      0|            TIFFReverseBits((uint8_t *)buf, tilesize);
 1066|       |
 1067|      0|        (*tif->tif_postdecode)(tif, (uint8_t *)buf, tilesize);
 1068|      0|        return (tilesize);
 1069|      0|    }
 1070|       |
 1071|  1.52M|    if (size == (tmsize_t)(-1))
  ------------------
  |  Branch (1071:9): [True: 1.52M, False: 0]
  ------------------
 1072|  1.52M|        size = tilesize;
 1073|      0|    else if (size > tilesize)
  ------------------
  |  Branch (1073:14): [True: 0, False: 0]
  ------------------
 1074|      0|        size = tilesize;
 1075|  1.52M|    if (!TIFFFillTile(tif, tile))
  ------------------
  |  Branch (1075:9): [True: 1.21M, False: 307k]
  ------------------
 1076|  1.21M|    {
 1077|       |        /* See TIFFReadEncodedStrip comment regarding TIFFTAG_FAXFILLFUNC. */
 1078|  1.21M|        if (buf)
  ------------------
  |  Branch (1078:13): [True: 1.21M, False: 0]
  ------------------
 1079|  1.21M|            memset(buf, 0, (size_t)size);
 1080|  1.21M|        return ((tmsize_t)(-1));
 1081|  1.21M|    }
 1082|   307k|    else if ((*tif->tif_decodetile)(tif, (uint8_t *)buf, size,
  ------------------
  |  Branch (1082:14): [True: 269k, False: 38.0k]
  ------------------
 1083|   307k|                                    (uint16_t)(tile / td->td_stripsperimage)))
 1084|   269k|    {
 1085|   269k|        (*tif->tif_postdecode)(tif, (uint8_t *)buf, size);
 1086|   269k|        return (size);
 1087|   269k|    }
 1088|  38.0k|    else
 1089|  38.0k|        return ((tmsize_t)(-1));
 1090|  1.52M|}
_TIFFReadTileAndAllocBuffer:
 1101|   659k|{
 1102|   659k|    if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
  ------------------
  |  Branch (1102:9): [True: 0, False: 659k]
  |  Branch (1102:35): [True: 0, False: 659k]
  ------------------
 1103|      0|        return ((tmsize_t)(-1));
 1104|   659k|    return (_TIFFReadEncodedTileAndAllocBuffer(
 1105|   659k|        tif, TIFFComputeTile(tif, x, y, z, s), buf, bufsizetoalloc,
 1106|   659k|        (tmsize_t)(-1)));
 1107|   659k|}
_TIFFReadEncodedTileAndAllocBuffer:
 1118|   659k|{
 1119|   659k|    static const char module[] = "_TIFFReadEncodedTileAndAllocBuffer";
 1120|   659k|    TIFFDirectory *td = &tif->tif_dir;
 1121|   659k|    tmsize_t tilesize = tif->tif_dir.td_tilesize;
 1122|       |
 1123|   659k|    if (*buf != NULL)
  ------------------
  |  Branch (1123:9): [True: 656k, False: 2.43k]
  ------------------
 1124|   656k|    {
 1125|   656k|        return TIFFReadEncodedTile(tif, tile, *buf, size_to_read);
 1126|   656k|    }
 1127|       |
 1128|  2.43k|    if (!TIFFCheckRead(tif, 1))
  ------------------
  |  Branch (1128:9): [True: 0, False: 2.43k]
  ------------------
 1129|      0|        return ((tmsize_t)(-1));
 1130|  2.43k|    if (tile >= td->td_nstrips)
  ------------------
  |  Branch (1130:9): [True: 0, False: 2.43k]
  ------------------
 1131|      0|    {
 1132|      0|        TIFFErrorExtR(tif, module,
 1133|      0|                      "%" PRIu32 ": Tile out of range, max %" PRIu32, tile,
 1134|      0|                      td->td_nstrips);
 1135|      0|        return ((tmsize_t)(-1));
 1136|      0|    }
 1137|       |
 1138|  2.43k|    if (!TIFFFillTile(tif, tile))
  ------------------
  |  Branch (1138:9): [True: 277, False: 2.15k]
  ------------------
 1139|    277|        return ((tmsize_t)(-1));
 1140|       |
 1141|       |    /* Sanity checks to avoid excessive memory allocation */
 1142|       |    /* Cf https://gitlab.com/libtiff/libtiff/-/issues/479 */
 1143|  2.15k|    if (td->td_compression == COMPRESSION_NONE)
  ------------------
  |  |  182|  2.15k|#define COMPRESSION_NONE 1            /* dump mode */
  ------------------
  |  Branch (1143:9): [True: 25, False: 2.13k]
  ------------------
 1144|     25|    {
 1145|     25|        if (tif->tif_rawdatasize != tilesize)
  ------------------
  |  Branch (1145:13): [True: 10, False: 15]
  ------------------
 1146|     10|        {
 1147|     10|            TIFFErrorExtR(tif, TIFFFileName(tif),
 1148|     10|                          "Invalid tile byte count for tile %u. "
 1149|     10|                          "Expected %" PRIu64 ", got %" PRIu64,
 1150|     10|                          tile, (uint64_t)tilesize,
 1151|     10|                          (uint64_t)tif->tif_rawdatasize);
 1152|     10|            return ((tmsize_t)(-1));
 1153|     10|        }
 1154|     25|    }
 1155|  2.13k|    else
 1156|  2.13k|    {
 1157|       |        /* Max compression ratio experimentally determined. Might be fragile...
 1158|       |         * Only apply this heuristics to situations where the memory allocation
 1159|       |         * would be big, to avoid breaking nominal use cases.
 1160|       |         */
 1161|  2.13k|        if (bufsizetoalloc > 100 * 1024 * 1024)
  ------------------
  |  Branch (1161:13): [True: 29, False: 2.10k]
  ------------------
 1162|     29|        {
 1163|     29|            const uint64_t maxCompressionRatio =
 1164|     29|                TIFFGetMaxCompressionRatio(tif);
 1165|     29|            if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (1165:17): [True: 14, False: 15]
  ------------------
 1166|     14|                (uint64_t)tif->tif_rawdatasize <
  ------------------
  |  Branch (1166:17): [True: 0, False: 14]
  ------------------
 1167|     14|                    (uint64_t)tilesize / maxCompressionRatio)
 1168|      0|            {
 1169|      0|                TIFFErrorExtR(tif, TIFFFileName(tif),
 1170|      0|                              "Likely invalid tile byte count for tile %u. "
 1171|      0|                              "Uncompressed tile size is %" PRIu64 ", "
 1172|      0|                              "compressed one is %" PRIu64,
 1173|      0|                              tile, (uint64_t)tilesize,
 1174|      0|                              (uint64_t)tif->tif_rawdatasize);
 1175|      0|                return ((tmsize_t)(-1));
 1176|      0|            }
 1177|     29|        }
 1178|  2.13k|    }
 1179|       |
 1180|  2.14k|    *buf = _TIFFmallocExt(tif, bufsizetoalloc);
 1181|  2.14k|    if (*buf == NULL)
  ------------------
  |  Branch (1181:9): [True: 0, False: 2.14k]
  ------------------
 1182|      0|    {
 1183|      0|        TIFFErrorExtR(tif, TIFFFileName(tif), "No space for tile buffer");
 1184|      0|        return ((tmsize_t)(-1));
 1185|      0|    }
 1186|  2.14k|    _TIFFmemset(*buf, 0, bufsizetoalloc);
 1187|       |
 1188|  2.14k|    if (size_to_read == (tmsize_t)(-1))
  ------------------
  |  Branch (1188:9): [True: 2.14k, False: 0]
  ------------------
 1189|  2.14k|        size_to_read = tilesize;
 1190|      0|    else if (size_to_read > tilesize)
  ------------------
  |  Branch (1190:14): [True: 0, False: 0]
  ------------------
 1191|      0|        size_to_read = tilesize;
 1192|  2.14k|    if ((*tif->tif_decodetile)(tif, (uint8_t *)*buf, size_to_read,
  ------------------
  |  Branch (1192:9): [True: 1.65k, False: 495]
  ------------------
 1193|  2.14k|                               (uint16_t)(tile / td->td_stripsperimage)))
 1194|  1.65k|    {
 1195|  1.65k|        (*tif->tif_postdecode)(tif, (uint8_t *)*buf, size_to_read);
 1196|  1.65k|        return (size_to_read);
 1197|  1.65k|    }
 1198|    495|    else
 1199|    495|        return ((tmsize_t)(-1));
 1200|  2.14k|}
TIFFFillTile:
 1300|  1.52M|{
 1301|  1.52M|    static const char module[] = "TIFFFillTile";
 1302|  1.52M|    TIFFDirectory *td = &tif->tif_dir;
 1303|       |
 1304|  1.52M|    if ((tif->tif_flags & TIFF_NOREADRAW) == 0)
  ------------------
  |  |  138|  1.52M|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1304:9): [True: 917k, False: 611k]
  ------------------
 1305|   917k|    {
 1306|   917k|        uint64_t bytecount = TIFFGetStrileByteCount(tif, tile);
 1307|   917k|        if (bytecount == 0 || bytecount > (uint64_t)TIFF_INT64_MAX)
  ------------------
  |  |   49|   218k|#define TIFF_INT64_MAX ((((int64_t)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
  ------------------
  |  Branch (1307:13): [True: 698k, False: 218k]
  |  Branch (1307:31): [True: 519, False: 217k]
  ------------------
 1308|   699k|        {
 1309|   699k|            TIFFErrorExtR(tif, module,
 1310|   699k|                          "%" PRIu64 ": Invalid tile byte count, tile %" PRIu32,
 1311|   699k|                          bytecount, tile);
 1312|   699k|            return (0);
 1313|   699k|        }
 1314|       |
 1315|       |        /* To avoid excessive memory allocations: */
 1316|   217k|        const tmsize_t tilesize = TIFFTileSize(tif);
 1317|   217k|        if (tilesize > 0)
  ------------------
  |  Branch (1317:13): [True: 217k, False: 0]
  ------------------
 1318|   217k|        {
 1319|   217k|            if (bytecount > 1024 * 1024 &&
  ------------------
  |  Branch (1319:17): [True: 1.19k, False: 216k]
  ------------------
 1320|  1.19k|                (bytecount - 4096) / 10 > (uint64_t)tilesize)
  ------------------
  |  Branch (1320:17): [True: 984, False: 206]
  ------------------
 1321|    984|            {
 1322|       |                /* Byte count should normally not be larger than a number of */
 1323|       |                /* times the uncompressed size plus some margin */
 1324|       |                /* 10 and 4096 are just values that could be adjusted. */
 1325|       |                /* Hopefully they are safe enough for all codecs */
 1326|       |                /* What happens next will depend on whether only the bytecount
 1327|       |                 */
 1328|       |                /* was corrupted to a large value but the strip/tile data is */
 1329|       |                /* fine. In that situation most codecs should work fine and */
 1330|       |                /* only used part of the tile/strip data. If the strip/tile */
 1331|       |                /* data is corrupted too, then codecs will later error out. */
 1332|    984|                uint64_t newbytecount = (uint64_t)tilesize * 10 + 4096;
 1333|    984|                TIFFWarningExtR(tif, module,
 1334|    984|                                "Too large tile byte count %" PRIu64
 1335|    984|                                ", tile %" PRIu32 ". Limiting to %" PRIu64,
 1336|    984|                                bytecount, tile, newbytecount);
 1337|    984|                bytecount = newbytecount;
 1338|    984|            }
 1339|   216k|            else if (tilesize > 100 * 1024 * 1024)
  ------------------
  |  Branch (1339:22): [True: 311, False: 216k]
  ------------------
 1340|    311|            {
 1341|       |                /* Max compression ratio experimentally determined. Might be
 1342|       |                 * fragile... Only apply this heuristics to situations where the
 1343|       |                 * memory allocation would be big, to avoid breaking nominal use
 1344|       |                 * cases.
 1345|       |                 */
 1346|    311|                const uint64_t maxCompressionRatio =
 1347|    311|                    TIFFGetMaxCompressionRatio(tif);
 1348|    311|                if (maxCompressionRatio > 0 &&
  ------------------
  |  Branch (1348:21): [True: 230, False: 81]
  ------------------
 1349|    230|                    bytecount < (uint64_t)tilesize / maxCompressionRatio)
  ------------------
  |  Branch (1349:21): [True: 145, False: 85]
  ------------------
 1350|    145|                {
 1351|    145|                    TIFFErrorExtR(tif, module,
 1352|    145|                                  "Likely invalid tile byte count for tile %u. "
 1353|    145|                                  "Uncompressed tile size is %" PRIu64 ", "
 1354|    145|                                  "compressed one is %" PRIu64,
 1355|    145|                                  tile, (uint64_t)tilesize, bytecount);
 1356|    145|                    return 0;
 1357|    145|                }
 1358|    311|            }
 1359|   217k|        }
 1360|       |
 1361|   217k|        if (isMapped(tif))
  ------------------
  |  |  279|   217k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|   217k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 217k]
  |  |  ------------------
  ------------------
 1362|      0|        {
 1363|       |            /*
 1364|       |             * We must check for overflow, potentially causing
 1365|       |             * an OOB read. Instead of simple
 1366|       |             *
 1367|       |             *  TIFFGetStrileOffset(tif, tile)+bytecount > tif->tif_size
 1368|       |             *
 1369|       |             * comparison (which can overflow) we do the following
 1370|       |             * two comparisons:
 1371|       |             */
 1372|      0|            if (bytecount > (uint64_t)tif->tif_size ||
  ------------------
  |  Branch (1372:17): [True: 0, False: 0]
  ------------------
 1373|      0|                TIFFGetStrileOffset(tif, tile) >
  ------------------
  |  Branch (1373:17): [True: 0, False: 0]
  ------------------
 1374|      0|                    (uint64_t)tif->tif_size - bytecount)
 1375|      0|            {
 1376|      0|                tif->tif_dir.td_curtile = NOTILE;
  ------------------
  |  |  116|      0|#define NOTILE ((uint32_t)(-1)) /* undefined state */
  ------------------
 1377|      0|                return (0);
 1378|      0|            }
 1379|      0|        }
 1380|       |
 1381|   217k|        if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) ||
  ------------------
  |  |  279|   435k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|   217k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 217k]
  |  |  ------------------
  ------------------
                      if (isMapped(tif) && (isFillOrder(tif, td->td_fillorder) ||
  ------------------
  |  |  280|      0|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  |  |  ------------------
  |  |  |  Branch (280:29): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1382|      0|                              (tif->tif_flags & TIFF_NOBITREV)))
  ------------------
  |  |  127|      0|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (1382:31): [True: 0, False: 0]
  ------------------
 1383|      0|        {
 1384|       |            /*
 1385|       |             * The image is mapped into memory and we either don't
 1386|       |             * need to flip bits or the compression routine is
 1387|       |             * going to handle this operation itself.  In this
 1388|       |             * case, avoid copying the raw data and instead just
 1389|       |             * reference the data from the memory mapped file
 1390|       |             * image.  This assumes that the decompression
 1391|       |             * routines do not modify the contents of the raw data
 1392|       |             * buffer (if they try to, the application will get a
 1393|       |             * fault since the file is mapped read-only).
 1394|       |             */
 1395|      0|            if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata)
  ------------------
  |  |  128|      0|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (1395:17): [True: 0, False: 0]
  |  Branch (1395:53): [True: 0, False: 0]
  ------------------
 1396|      0|            {
 1397|      0|                _TIFFfreeExt(tif, tif->tif_rawdata);
 1398|      0|                tif->tif_rawdata = NULL;
 1399|      0|                tif->tif_rawdatasize = 0;
 1400|      0|            }
 1401|      0|            tif->tif_flags &= ~TIFF_MYBUFFER;
  ------------------
  |  |  128|      0|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
 1402|       |
 1403|      0|            tif->tif_rawdatasize = (tmsize_t)bytecount;
 1404|      0|            tif->tif_rawdata =
 1405|      0|                tif->tif_base + (tmsize_t)TIFFGetStrileOffset(tif, tile);
 1406|      0|            tif->tif_rawdataoff = 0;
 1407|      0|            tif->tif_rawdataloaded = (tmsize_t)bytecount;
 1408|      0|            tif->tif_flags |= TIFF_BUFFERMMAP;
  ------------------
  |  |  145|      0|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
 1409|      0|        }
 1410|   217k|        else
 1411|   217k|        {
 1412|       |            /*
 1413|       |             * Expand raw data buffer, if needed, to hold data
 1414|       |             * tile coming from file (perhaps should set upper
 1415|       |             * bound on the size of a buffer we'll use?).
 1416|       |             */
 1417|   217k|            tmsize_t bytecountm;
 1418|   217k|            bytecountm = (tmsize_t)bytecount;
 1419|   217k|            if ((uint64_t)bytecountm != bytecount)
  ------------------
  |  Branch (1419:17): [True: 0, False: 217k]
  ------------------
 1420|      0|            {
 1421|      0|                TIFFErrorExtR(tif, module, "Integer overflow");
 1422|      0|                return (0);
 1423|      0|            }
 1424|   217k|            if (bytecountm > tif->tif_rawdatasize)
  ------------------
  |  Branch (1424:17): [True: 2.70k, False: 215k]
  ------------------
 1425|  2.70k|            {
 1426|  2.70k|                tif->tif_dir.td_curtile = NOTILE;
  ------------------
  |  |  116|  2.70k|#define NOTILE ((uint32_t)(-1)) /* undefined state */
  ------------------
 1427|  2.70k|                if ((tif->tif_flags & TIFF_MYBUFFER) == 0)
  ------------------
  |  |  128|  2.70k|#define TIFF_MYBUFFER 0x00200U    /* my raw data buffer; free on close */
  ------------------
  |  Branch (1427:21): [True: 0, False: 2.70k]
  ------------------
 1428|      0|                {
 1429|      0|                    TIFFErrorExtR(tif, module,
 1430|      0|                                  "Data buffer too small to hold tile %" PRIu32,
 1431|      0|                                  tile);
 1432|      0|                    return (0);
 1433|      0|                }
 1434|  2.70k|            }
 1435|   217k|            if (tif->tif_flags & TIFF_BUFFERMMAP)
  ------------------
  |  |  145|   217k|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
  |  Branch (1435:17): [True: 0, False: 217k]
  ------------------
 1436|      0|            {
 1437|      0|                tif->tif_dir.td_curtile = NOTILE;
  ------------------
  |  |  116|      0|#define NOTILE ((uint32_t)(-1)) /* undefined state */
  ------------------
 1438|      0|                tif->tif_rawdata = NULL;
 1439|      0|                tif->tif_rawdatasize = 0;
 1440|      0|                tif->tif_flags &= ~TIFF_BUFFERMMAP;
  ------------------
  |  |  145|      0|    0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
  ------------------
 1441|      0|            }
 1442|       |
 1443|   217k|            if (isMapped(tif))
  ------------------
  |  |  279|   217k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|   217k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  |  |  |  Branch (279:23): [True: 0, False: 217k]
  |  |  ------------------
  ------------------
 1444|      0|            {
 1445|      0|                if (bytecountm > tif->tif_rawdatasize &&
  ------------------
  |  Branch (1445:21): [True: 0, False: 0]
  ------------------
 1446|      0|                    !TIFFReadBufferSetup(tif, 0, bytecountm))
  ------------------
  |  Branch (1446:21): [True: 0, False: 0]
  ------------------
 1447|      0|                {
 1448|      0|                    return (0);
 1449|      0|                }
 1450|      0|                if (TIFFReadRawTile1(tif, tile, tif->tif_rawdata, bytecountm,
  ------------------
  |  Branch (1450:21): [True: 0, False: 0]
  ------------------
 1451|      0|                                     module) != bytecountm)
 1452|      0|                {
 1453|      0|                    return (0);
 1454|      0|                }
 1455|      0|            }
 1456|   217k|            else
 1457|   217k|            {
 1458|   217k|                if (TIFFReadRawStripOrTile2(tif, tile, 0, bytecountm, module) !=
  ------------------
  |  Branch (1458:21): [True: 20.5k, False: 197k]
  ------------------
 1459|   217k|                    bytecountm)
 1460|  20.5k|                {
 1461|  20.5k|                    return (0);
 1462|  20.5k|                }
 1463|   217k|            }
 1464|       |
 1465|   197k|            tif->tif_rawdataoff = 0;
 1466|   197k|            tif->tif_rawdataloaded = bytecountm;
 1467|       |
 1468|   197k|            if (tif->tif_rawdata != NULL &&
  ------------------
  |  Branch (1468:17): [True: 197k, False: 0]
  ------------------
 1469|   197k|                !isFillOrder(tif, td->td_fillorder) &&
  ------------------
  |  |  280|   394k|#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
  ------------------
  |  Branch (1469:17): [True: 212, False: 196k]
  ------------------
 1470|    212|                (tif->tif_flags & TIFF_NOBITREV) == 0)
  ------------------
  |  |  127|    212|#define TIFF_NOBITREV 0x00100U    /* inhibit bit reversal logic */
  ------------------
  |  Branch (1470:17): [True: 212, False: 0]
  ------------------
 1471|    212|                TIFFReverseBits(tif->tif_rawdata, tif->tif_rawdataloaded);
 1472|   197k|        }
 1473|   217k|    }
 1474|   808k|    return (TIFFStartTile(tif, tile));
 1475|  1.52M|}
_TIFFNoPostDecode:
 1799|  2.03M|{
 1800|  2.03M|    (void)tif;
 1801|  2.03M|    (void)buf;
 1802|  2.03M|    (void)cc;
 1803|  2.03M|}
_TIFFSwab16BitData:
 1806|  3.14k|{
 1807|  3.14k|    (void)tif;
 1808|  3.14k|    assert((cc & 1) == 0);
  ------------------
  |  Branch (1808:5): [True: 0, False: 3.14k]
  |  Branch (1808:5): [True: 3.14k, False: 0]
  ------------------
 1809|  3.14k|    TIFFSwabArrayOfShort((uint16_t *)buf, cc / 2);
 1810|  3.14k|}
_TIFFSwab24BitData:
 1813|    388|{
 1814|    388|    (void)tif;
 1815|    388|    assert((cc % 3) == 0);
  ------------------
  |  Branch (1815:5): [True: 0, False: 388]
  |  Branch (1815:5): [True: 388, False: 0]
  ------------------
 1816|    388|    TIFFSwabArrayOfTriples((uint8_t *)buf, cc / 3);
 1817|    388|}
_TIFFSwab32BitData:
 1820|    332|{
 1821|    332|    (void)tif;
 1822|    332|    assert((cc & 3) == 0);
  ------------------
  |  Branch (1822:5): [True: 0, False: 332]
  |  Branch (1822:5): [True: 332, False: 0]
  ------------------
 1823|    332|    TIFFSwabArrayOfLong((uint32_t *)buf, cc / 4);
 1824|    332|}
_TIFFSwab64BitData:
 1827|    259|{
 1828|    259|    (void)tif;
 1829|    259|    assert((cc & 7) == 0);
  ------------------
  |  Branch (1829:5): [True: 0, False: 259]
  |  Branch (1829:5): [True: 259, False: 0]
  ------------------
 1830|    259|    TIFFSwabArrayOfDouble((double *)buf, cc / 8);
 1831|    259|}
tif_read.c:TIFFSeek:
  327|  1.92M|{
  328|  1.92M|    TIFFDirectory *td = &tif->tif_dir;
  329|  1.92M|    uint32_t strip;
  330|  1.92M|    int whole_strip;
  331|  1.92M|    tmsize_t read_ahead = 0;
  332|       |
  333|       |    /*
  334|       |    ** Establish what strip we are working from.
  335|       |    */
  336|  1.92M|    if (row >= td->td_imagelength)
  ------------------
  |  Branch (336:9): [True: 0, False: 1.92M]
  ------------------
  337|      0|    { /* out of range */
  338|      0|        TIFFErrorExtR(tif, tif->tif_name,
  339|      0|                      "%" PRIu32 ": Row out of range, max %" PRIu32 "", row,
  340|      0|                      td->td_imagelength);
  341|      0|        return (0);
  342|      0|    }
  343|  1.92M|    if (td->td_rowsperstrip == 0)
  ------------------
  |  Branch (343:9): [True: 0, False: 1.92M]
  ------------------
  344|      0|    {
  345|      0|        TIFFErrorExtR(tif, tif->tif_name,
  346|      0|                      "Cannot compute strip: RowsPerStrip is zero");
  347|      0|        return (0);
  348|      0|    }
  349|  1.92M|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  1.92M|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (349:9): [True: 109k, False: 1.81M]
  ------------------
  350|   109k|    {
  351|   109k|        uint64_t sample_offset;
  352|   109k|        uint64_t strip64;
  353|   109k|        if (sample >= td->td_samplesperpixel)
  ------------------
  |  Branch (353:13): [True: 0, False: 109k]
  ------------------
  354|      0|        {
  355|      0|            TIFFErrorExtR(tif, tif->tif_name,
  356|      0|                          "%" PRIu16 ": Sample out of range, max %" PRIu16 "",
  357|      0|                          sample, td->td_samplesperpixel);
  358|      0|            return (0);
  359|      0|        }
  360|   109k|        sample_offset =
  361|   109k|            _TIFFMultiply64(tif, sample, td->td_stripsperimage, "TIFFSeek");
  362|   109k|        if (sample_offset == 0 && sample != 0 && td->td_stripsperimage != 0)
  ------------------
  |  Branch (362:13): [True: 109k, False: 0]
  |  Branch (362:35): [True: 0, False: 109k]
  |  Branch (362:50): [True: 0, False: 0]
  ------------------
  363|      0|            return (0);
  364|   109k|        strip64 = _TIFFAdd64(tif, sample_offset, row / td->td_rowsperstrip,
  365|   109k|                             "TIFFSeek");
  366|   109k|        if (strip64 == 0 &&
  ------------------
  |  Branch (366:13): [True: 106k, False: 2.55k]
  ------------------
  367|   106k|            (sample_offset != 0 || (row / td->td_rowsperstrip) != 0))
  ------------------
  |  Branch (367:14): [True: 0, False: 106k]
  |  Branch (367:36): [True: 0, False: 106k]
  ------------------
  368|      0|            return (0);
  369|   109k|        strip = _TIFFCastUInt64ToUInt32(tif, strip64, "TIFFSeek");
  370|   109k|        if (strip == 0 && strip64 != 0)
  ------------------
  |  Branch (370:13): [True: 106k, False: 2.55k]
  |  Branch (370:27): [True: 0, False: 106k]
  ------------------
  371|      0|            return (0);
  372|   109k|    }
  373|  1.81M|    else
  374|  1.81M|        strip = row / td->td_rowsperstrip;
  375|       |
  376|       |    /*
  377|       |     * Do we want to treat this strip as one whole chunk or
  378|       |     * read it a few lines at a time?
  379|       |     */
  380|       |#if defined(CHUNKY_STRIP_READ_SUPPORT)
  381|       |    whole_strip = TIFFGetStrileByteCount(tif, strip) < 10 || isMapped(tif);
  382|       |    if (td->td_compression == COMPRESSION_LERC ||
  383|       |        td->td_compression == COMPRESSION_JBIG)
  384|       |    {
  385|       |        /* Ideally plugins should have a way to declare they don't support
  386|       |         * chunk strip */
  387|       |        whole_strip = 1;
  388|       |    }
  389|       |
  390|       |    if (!whole_strip)
  391|       |    {
  392|       |        /* 16 is for YCbCr mode where we may need to read 16 */
  393|       |        /* lines at a time to get a decompressed line, and 5000 */
  394|       |        /* is some constant value, for example for JPEG tables */
  395|       |
  396|       |        /* coverity[dead_error_line:SUPPRESS] */
  397|       |        if (tif->tif_dir.td_scanlinesize < TIFF_TMSIZE_T_MAX / 16 &&
  398|       |            tif->tif_dir.td_scanlinesize * 16 < TIFF_TMSIZE_T_MAX - 5000)
  399|       |        {
  400|       |            read_ahead = tif->tif_dir.td_scanlinesize * 16 + 5000;
  401|       |        }
  402|       |        else
  403|       |        {
  404|       |            read_ahead = tif->tif_dir.td_scanlinesize;
  405|       |        }
  406|       |    }
  407|       |#else
  408|  1.92M|    whole_strip = 1;
  409|  1.92M|#endif
  410|       |
  411|       |    /*
  412|       |     * If we haven't loaded this strip, do so now, possibly
  413|       |     * only reading the first part.
  414|       |     */
  415|  1.92M|    if (strip != tif->tif_dir.td_curstrip)
  ------------------
  |  Branch (415:9): [True: 7.30k, False: 1.91M]
  ------------------
  416|  7.30k|    { /* different strip, refill */
  417|       |
  418|  7.30k|        if (whole_strip)
  ------------------
  |  Branch (418:13): [True: 7.30k, False: 0]
  ------------------
  419|  7.30k|        {
  420|  7.30k|            if (!TIFFFillStrip(tif, strip))
  ------------------
  |  Branch (420:17): [True: 334, False: 6.97k]
  ------------------
  421|    334|                return (0);
  422|  7.30k|        }
  423|       |#if defined(CHUNKY_STRIP_READ_SUPPORT)
  424|       |        else
  425|       |        {
  426|       |            if (!TIFFFillStripPartial(tif, strip, read_ahead, 1))
  427|       |                return 0;
  428|       |        }
  429|       |#endif
  430|  7.30k|    }
  431|       |
  432|       |#if defined(CHUNKY_STRIP_READ_SUPPORT)
  433|       |    /*
  434|       |    ** If we already have some data loaded, do we need to read some more?
  435|       |    */
  436|       |    else if (!whole_strip)
  437|       |    {
  438|       |        /* coverity[dead_error_line:SUPPRESS] */
  439|       |        if (((tif->tif_rawdata + tif->tif_rawdataloaded) - tif->tif_rawcp) <
  440|       |                read_ahead &&
  441|       |            (uint64_t)tif->tif_rawdataoff + tif->tif_rawdataloaded <
  442|       |                TIFFGetStrileByteCount(tif, strip))
  443|       |        {
  444|       |            if (!TIFFFillStripPartial(tif, strip, read_ahead, 0))
  445|       |                return 0;
  446|       |        }
  447|       |    }
  448|       |#endif
  449|       |
  450|  1.92M|    if (row < tif->tif_dir.td_row)
  ------------------
  |  Branch (450:9): [True: 10, False: 1.92M]
  ------------------
  451|     10|    {
  452|       |        /*
  453|       |         * Moving backwards within the same strip: backup
  454|       |         * to the start and then decode forward (below).
  455|       |         *
  456|       |         * NB: If you're planning on lots of random access within a
  457|       |         * strip, it's better to just read and decode the entire
  458|       |         * strip, and then access the decoded data in a random fashion.
  459|       |         */
  460|       |
  461|     10|        if (tif->tif_rawdataoff != 0)
  ------------------
  |  Branch (461:13): [True: 0, False: 10]
  ------------------
  462|      0|        {
  463|      0|            if (!TIFFFillStripPartial(tif, (int)strip, read_ahead, 1))
  ------------------
  |  Branch (463:17): [True: 0, False: 0]
  ------------------
  464|      0|                return 0;
  465|      0|        }
  466|     10|        else
  467|     10|        {
  468|     10|            if (!TIFFStartStrip(tif, strip))
  ------------------
  |  Branch (468:17): [True: 5, False: 5]
  ------------------
  469|      5|                return (0);
  470|     10|        }
  471|     10|    }
  472|       |
  473|  1.92M|    if (row != tif->tif_dir.td_row)
  ------------------
  |  Branch (473:9): [True: 0, False: 1.92M]
  ------------------
  474|      0|    {
  475|       |        /*
  476|       |         * Seek forward to the desired row.
  477|       |         */
  478|       |
  479|       |        /* TODO: Will this really work with partial buffers? */
  480|       |
  481|      0|        if (!(*tif->tif_seek)(tif, row - tif->tif_dir.td_row))
  ------------------
  |  Branch (481:13): [True: 0, False: 0]
  ------------------
  482|      0|            return (0);
  483|      0|        tif->tif_dir.td_row = row;
  484|      0|    }
  485|       |
  486|  1.92M|    return (1);
  487|  1.92M|}
tif_read.c:TIFFReadAndRealloc:
   56|   218k|{
   57|   218k|#if SIZEOF_SIZE_T == 8
   58|   218k|    tmsize_t threshold = INITIAL_THRESHOLD;
  ------------------
  |  |   43|   218k|#define INITIAL_THRESHOLD (1024 * 1024)
  ------------------
   59|   218k|#endif
   60|   218k|    tmsize_t already_read = 0;
   61|       |
   62|       |#if SIZEOF_SIZE_T != 8
   63|       |    /* On 32 bit processes, if the request is large enough, check against */
   64|       |    /* file size */
   65|       |    if (size > 1000 * 1000 * 1000)
   66|       |    {
   67|       |        uint64_t filesize = TIFFGetFileSize(tif);
   68|       |        if ((uint64_t)size >= filesize)
   69|       |        {
   70|       |            TIFFErrorExtR(tif, module,
   71|       |                          "Chunk size requested is larger than file size.");
   72|       |            return 0;
   73|       |        }
   74|       |    }
   75|       |#endif
   76|       |
   77|       |    /* On 64 bit processes, read first a maximum of 1 MB, then 10 MB, etc */
   78|       |    /* so as to avoid allocating too much memory in case the file is too */
   79|       |    /* short. We could ask for the file size, but this might be */
   80|       |    /* expensive with some I/O layers (think of reading a gzipped file) */
   81|       |    /* Restrict to 64 bit processes, so as to avoid reallocs() */
   82|       |    /* on 32 bit processes where virtual memory is scarce.  */
   83|   437k|    while (already_read < size)
  ------------------
  |  Branch (83:12): [True: 218k, False: 218k]
  ------------------
   84|   218k|    {
   85|   218k|        tmsize_t bytes_read;
   86|   218k|        tmsize_t to_read = size - already_read;
   87|   218k|#if SIZEOF_SIZE_T == 8
   88|   218k|        if (to_read >= threshold && threshold < MAX_THRESHOLD &&
  ------------------
  |  |   46|   218k|    (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  |   44|     35|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  |   44|     35|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |                   (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER *      \
  |  |  ------------------
  |  |  |  |   44|     35|#define THRESHOLD_MULTIPLIER 10
  |  |  ------------------
  |  |   47|   218k|     INITIAL_THRESHOLD)
  |  |  ------------------
  |  |  |  |   43|     35|#define INITIAL_THRESHOLD (1024 * 1024)
  |  |  ------------------
  ------------------
  |  Branch (88:13): [True: 35, False: 218k]
  |  Branch (88:37): [True: 35, False: 0]
  ------------------
   89|     35|            already_read + to_read + rawdata_offset > tif->tif_rawdatasize)
  ------------------
  |  Branch (89:13): [True: 24, False: 11]
  ------------------
   90|     24|        {
   91|     24|            to_read = threshold;
   92|     24|            threshold *= THRESHOLD_MULTIPLIER;
  ------------------
  |  |   44|     24|#define THRESHOLD_MULTIPLIER 10
  ------------------
   93|     24|        }
   94|   218k|#endif
   95|   218k|        if (already_read + to_read + rawdata_offset > tif->tif_rawdatasize)
  ------------------
  |  Branch (95:13): [True: 3.38k, False: 215k]
  ------------------
   96|  3.38k|        {
   97|  3.38k|            uint8_t *new_rawdata;
   98|  3.38k|            assert((tif->tif_flags & TIFF_MYBUFFER) != 0);
  ------------------
  |  Branch (98:13): [True: 0, False: 3.38k]
  |  Branch (98:13): [True: 3.38k, False: 0]
  ------------------
   99|  3.38k|            tif->tif_rawdatasize = (tmsize_t)TIFFroundup_64(
  ------------------
  |  |  327|  3.38k|#define TIFFroundup_64(x, y) ((uint64_t)(TIFFhowmany_64(x, y) * (uint64_t)(y)))
  |  |  ------------------
  |  |  |  |  324|  3.38k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  |  |  ------------------
  ------------------
  100|  3.38k|                (uint64_t)already_read + (uint64_t)to_read +
  101|  3.38k|                    (uint64_t)rawdata_offset,
  102|  3.38k|                1024);
  103|  3.38k|            if (tif->tif_rawdatasize == 0)
  ------------------
  |  Branch (103:17): [True: 0, False: 3.38k]
  ------------------
  104|      0|            {
  105|      0|                TIFFErrorExtR(tif, module, "Invalid buffer size");
  106|      0|                return 0;
  107|      0|            }
  108|  3.38k|            new_rawdata = (uint8_t *)_TIFFreallocExt(tif, tif->tif_rawdata,
  109|  3.38k|                                                     tif->tif_rawdatasize);
  110|  3.38k|            if (new_rawdata == 0)
  ------------------
  |  Branch (110:17): [True: 0, False: 3.38k]
  ------------------
  111|      0|            {
  112|      0|                TIFFErrorExtR(tif, module,
  113|      0|                              "No space for data buffer at scanline %" PRIu32,
  114|      0|                              tif->tif_dir.td_row);
  115|      0|                _TIFFfreeExt(tif, tif->tif_rawdata);
  116|      0|                tif->tif_rawdata = 0;
  117|      0|                tif->tif_rawdatasize = 0;
  118|      0|                return 0;
  119|      0|            }
  120|  3.38k|            tif->tif_rawdata = new_rawdata;
  121|  3.38k|        }
  122|   218k|        if (tif->tif_rawdata == NULL)
  ------------------
  |  Branch (122:13): [True: 0, False: 218k]
  ------------------
  123|      0|        {
  124|       |            /* should not happen in practice but helps CoverityScan */
  125|      0|            return 0;
  126|      0|        }
  127|       |
  128|   218k|        bytes_read = TIFFReadFile(
  ------------------
  |  |  283|   218k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
  129|   218k|            tif, tif->tif_rawdata + rawdata_offset + already_read, to_read);
  130|   218k|        if (bytes_read < 0)
  ------------------
  |  Branch (130:13): [True: 0, False: 218k]
  ------------------
  131|       |            /* Treat read errors as short reads before updating offsets. */
  132|      0|            bytes_read = 0;
  133|   218k|        already_read += bytes_read;
  134|   218k|        if (bytes_read != to_read)
  ------------------
  |  Branch (134:13): [True: 503, False: 218k]
  ------------------
  135|    503|        {
  136|    503|            memset(
  137|    503|                tif->tif_rawdata + rawdata_offset + already_read, 0,
  138|    503|                (size_t)(tif->tif_rawdatasize - rawdata_offset - already_read));
  139|    503|            if (is_strip)
  ------------------
  |  Branch (139:17): [True: 91, False: 412]
  ------------------
  140|     91|            {
  141|     91|                TIFFErrorExtR(tif, module,
  142|     91|                              "Read error at scanline %" PRIu32
  143|     91|                              "; got %" TIFF_SSIZE_FORMAT " bytes, "
  144|     91|                              "expected %" TIFF_SSIZE_FORMAT,
  ------------------
  |  |  142|     91|#  define TIFF_SSIZE_FORMAT PRId64
  ------------------
  145|     91|                              tif->tif_dir.td_row, already_read, size);
  146|     91|            }
  147|    412|            else
  148|    412|            {
  149|    412|                TIFFErrorExtR(tif, module,
  150|    412|                              "Read error at row %" PRIu32 ", col %" PRIu32
  151|    412|                              ", tile %" PRIu32 "; "
  152|    412|                              "got %" TIFF_SSIZE_FORMAT
  153|    412|                              " bytes, expected %" TIFF_SSIZE_FORMAT "",
  154|    412|                              tif->tif_dir.td_row, tif->tif_dir.td_col,
  155|    412|                              strip_or_tile, already_read, size);
  156|    412|            }
  157|    503|            return 0;
  158|    503|        }
  159|   218k|    }
  160|   218k|    return 1;
  161|   218k|}
tif_read.c:TIFFReadEncodedStripGetStripSize:
  526|   553k|{
  527|   553k|    static const char module[] = "TIFFReadEncodedStrip";
  528|   553k|    TIFFDirectory *td = &tif->tif_dir;
  529|   553k|    uint32_t rowsperstrip;
  530|   553k|    uint32_t stripsperplane;
  531|   553k|    uint32_t stripinplane;
  532|   553k|    uint32_t rows;
  533|   553k|    tmsize_t stripsize;
  534|   553k|    if (!TIFFCheckRead(tif, 0))
  ------------------
  |  Branch (534:9): [True: 0, False: 553k]
  ------------------
  535|      0|        return ((tmsize_t)(-1));
  536|   553k|    if (strip >= td->td_nstrips)
  ------------------
  |  Branch (536:9): [True: 0, False: 553k]
  ------------------
  537|      0|    {
  538|      0|        TIFFErrorExtR(tif, module,
  539|      0|                      "%" PRIu32 ": Strip out of range, max %" PRIu32, strip,
  540|      0|                      td->td_nstrips);
  541|      0|        return ((tmsize_t)(-1));
  542|      0|    }
  543|       |
  544|   553k|    rowsperstrip = td->td_rowsperstrip;
  545|   553k|    if (rowsperstrip > td->td_imagelength)
  ------------------
  |  Branch (545:9): [True: 394, False: 552k]
  ------------------
  546|    394|        rowsperstrip = td->td_imagelength;
  547|   553k|    if (rowsperstrip == 0)
  ------------------
  |  Branch (547:9): [True: 0, False: 553k]
  ------------------
  548|      0|    {
  549|      0|        TIFFErrorExtR(tif, module, "rowsperstrip is zero");
  550|      0|        return ((tmsize_t)(-1));
  551|      0|    }
  552|   553k|    stripsperplane =
  553|   553k|        TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
  ------------------
  |  |  318|   553k|    (((uint32_t)(x) / (uint32_t)(y)) +                                         \
  |  |  319|   553k|     ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
  |  |  ------------------
  |  |  |  Branch (319:7): [True: 397k, False: 155k]
  |  |  ------------------
  ------------------
  554|   553k|    stripinplane = (strip % stripsperplane);
  555|   553k|    if (pplane)
  ------------------
  |  Branch (555:9): [True: 553k, False: 0]
  ------------------
  556|   553k|        *pplane = (uint16_t)(strip / stripsperplane);
  557|   553k|    rows = td->td_imagelength - stripinplane * rowsperstrip;
  558|   553k|    if (rows > rowsperstrip)
  ------------------
  |  Branch (558:9): [True: 552k, False: 893]
  ------------------
  559|   552k|        rows = rowsperstrip;
  560|   553k|    stripsize = TIFFVStripSize(tif, rows);
  561|   553k|    if (stripsize == 0)
  ------------------
  |  Branch (561:9): [True: 0, False: 553k]
  ------------------
  562|      0|        return ((tmsize_t)(-1));
  563|   553k|    return stripsize;
  564|   553k|}
tif_read.c:TIFFReadRawStrip1:
  680|   254k|{
  681|   254k|    assert((tif->tif_flags & TIFF_NOREADRAW) == 0);
  ------------------
  |  Branch (681:5): [True: 0, False: 254k]
  |  Branch (681:5): [True: 254k, False: 0]
  ------------------
  682|   254k|    if (!isMapped(tif))
  ------------------
  |  |  279|   254k|#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
  |  |  ------------------
  |  |  |  |  130|   254k|#define TIFF_MAPPED 0x00800U      /* file is mapped into memory */
  |  |  ------------------
  ------------------
  |  Branch (682:9): [True: 254k, False: 0]
  ------------------
  683|   254k|    {
  684|   254k|        tmsize_t cc;
  685|       |
  686|   254k|        if (!SeekOK(tif, TIFFGetStrileOffset(tif, strip)))
  ------------------
  |  |  303|   254k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (686:13): [True: 153k, False: 101k]
  ------------------
  687|   153k|        {
  688|   153k|            TIFFErrorExtR(tif, module,
  689|   153k|                          "Seek error at scanline %" PRIu32 ", strip %" PRIu32,
  690|   153k|                          tif->tif_dir.td_row, strip);
  691|   153k|            return ((tmsize_t)(-1));
  692|   153k|        }
  693|   101k|        cc = TIFFReadFile(tif, buf, size);
  ------------------
  |  |  283|   101k|    ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
  ------------------
  694|   101k|        if (cc != size)
  ------------------
  |  Branch (694:13): [True: 70, False: 101k]
  ------------------
  695|     70|        {
  696|     70|            TIFFErrorExtR(tif, module,
  697|     70|                          "Read error at scanline %" PRIu32
  698|     70|                          "; got %" TIFF_SSIZE_FORMAT
  699|     70|                          " bytes, expected %" TIFF_SSIZE_FORMAT,
  ------------------
  |  |  142|     70|#  define TIFF_SSIZE_FORMAT PRId64
  ------------------
  700|     70|                          tif->tif_dir.td_row, cc, size);
  701|     70|            return ((tmsize_t)(-1));
  702|     70|        }
  703|   101k|    }
  704|      0|    else
  705|      0|    {
  706|      0|        tmsize_t ma = 0;
  707|      0|        tmsize_t n;
  708|      0|        if ((TIFFGetStrileOffset(tif, strip) > (uint64_t)TIFF_TMSIZE_T_MAX) ||
  ------------------
  |  |   68|      0|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (708:13): [True: 0, False: 0]
  ------------------
  709|      0|            ((ma = (tmsize_t)TIFFGetStrileOffset(tif, strip)) > tif->tif_size))
  ------------------
  |  Branch (709:13): [True: 0, False: 0]
  ------------------
  710|      0|        {
  711|      0|            n = 0;
  712|      0|        }
  713|      0|        else if (ma > TIFF_TMSIZE_T_MAX - size)
  ------------------
  |  |   68|      0|#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
  ------------------
  |  Branch (713:18): [True: 0, False: 0]
  ------------------
  714|      0|        {
  715|      0|            n = 0;
  716|      0|        }
  717|      0|        else
  718|      0|        {
  719|      0|            tmsize_t mb = ma + size;
  720|      0|            if (mb > tif->tif_size)
  ------------------
  |  Branch (720:17): [True: 0, False: 0]
  ------------------
  721|      0|                n = tif->tif_size - ma;
  722|      0|            else
  723|      0|                n = size;
  724|      0|        }
  725|      0|        if (n != size)
  ------------------
  |  Branch (725:13): [True: 0, False: 0]
  ------------------
  726|      0|        {
  727|      0|            TIFFErrorExtR(tif, module,
  728|      0|                          "Read error at scanline %" PRIu32 ", strip %" PRIu32
  729|      0|                          "; got %" TIFF_SSIZE_FORMAT
  730|      0|                          " bytes, expected %" TIFF_SSIZE_FORMAT,
  ------------------
  |  |  142|      0|#  define TIFF_SSIZE_FORMAT PRId64
  ------------------
  731|      0|                          tif->tif_dir.td_row, strip, n, size);
  732|      0|            return ((tmsize_t)(-1));
  733|      0|        }
  734|      0|        _TIFFmemcpy(buf, tif->tif_base + ma, size);
  735|      0|    }
  736|   101k|    return (size);
  737|   254k|}
tif_read.c:TIFFReadRawStripOrTile2:
  742|   244k|{
  743|   244k|    assert(!isMapped(tif));
  ------------------
  |  Branch (743:5): [True: 0, False: 244k]
  |  Branch (743:5): [True: 244k, False: 0]
  ------------------
  744|   244k|    assert((tif->tif_flags & TIFF_NOREADRAW) == 0);
  ------------------
  |  Branch (744:5): [True: 0, False: 244k]
  |  Branch (744:5): [True: 244k, False: 0]
  ------------------
  745|       |
  746|   244k|    if (!SeekOK(tif, TIFFGetStrileOffset(tif, strip_or_tile)))
  ------------------
  |  |  303|   244k|#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
  ------------------
  |  Branch (746:9): [True: 25.1k, False: 218k]
  ------------------
  747|  25.1k|    {
  748|  25.1k|        if (is_strip)
  ------------------
  |  Branch (748:13): [True: 5.08k, False: 20.1k]
  ------------------
  749|  5.08k|        {
  750|  5.08k|            TIFFErrorExtR(tif, module,
  751|  5.08k|                          "Seek error at scanline %" PRIu32 ", strip %" PRIu32,
  752|  5.08k|                          tif->tif_dir.td_row, strip_or_tile);
  753|  5.08k|        }
  754|  20.1k|        else
  755|  20.1k|        {
  756|  20.1k|            TIFFErrorExtR(
  757|  20.1k|                tif, module,
  758|  20.1k|                "Seek error at row %" PRIu32 ", col %" PRIu32 ", tile %" PRIu32,
  759|  20.1k|                tif->tif_dir.td_row, tif->tif_dir.td_col, strip_or_tile);
  760|  20.1k|        }
  761|  25.1k|        return ((tmsize_t)(-1));
  762|  25.1k|    }
  763|       |
  764|   218k|    if (!TIFFReadAndRealloc(tif, size, 0, is_strip, strip_or_tile, module))
  ------------------
  |  Branch (764:9): [True: 503, False: 218k]
  ------------------
  765|    503|    {
  766|    503|        return ((tmsize_t)(-1));
  767|    503|    }
  768|       |
  769|   218k|    return (size);
  770|   218k|}
tif_read.c:TIFFStartStrip:
 1542|  26.6k|{
 1543|  26.6k|    TIFFDirectory *td = &tif->tif_dir;
 1544|       |
 1545|  26.6k|    if ((tif->tif_flags & TIFF_CODERSETUP) == 0)
  ------------------
  |  |  124|  26.6k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
  |  Branch (1545:9): [True: 1.83k, False: 24.8k]
  ------------------
 1546|  1.83k|    {
 1547|  1.83k|        if (!(*tif->tif_setupdecode)(tif))
  ------------------
  |  Branch (1547:13): [True: 40, False: 1.79k]
  ------------------
 1548|     40|            return (0);
 1549|  1.79k|        tif->tif_flags |= TIFF_CODERSETUP;
  ------------------
  |  |  124|  1.79k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
 1550|  1.79k|    }
 1551|  26.6k|    if (td->td_stripsperimage == 0)
  ------------------
  |  Branch (1551:9): [True: 0, False: 26.6k]
  ------------------
 1552|      0|    {
 1553|      0|        TIFFErrorExtR(tif, "TIFFStartStrip", "Zero strips per image");
 1554|      0|        return 0;
 1555|      0|    }
 1556|  26.6k|    tif->tif_dir.td_curstrip = strip;
 1557|  26.6k|    tif->tif_dir.td_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip;
 1558|  26.6k|    tif->tif_flags &= ~TIFF_BUF4WRITE;
  ------------------
  |  |  141|  26.6k|#define TIFF_BUF4WRITE 0x100000U  /* rawcc bytes are for writing */
  ------------------
 1559|       |
 1560|  26.6k|    if (tif->tif_flags & TIFF_NOREADRAW)
  ------------------
  |  |  138|  26.6k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1560:9): [True: 5.45k, False: 21.1k]
  ------------------
 1561|  5.45k|    {
 1562|  5.45k|        tif->tif_rawcp = NULL;
 1563|  5.45k|        tif->tif_rawcc = 0;
 1564|  5.45k|    }
 1565|  21.1k|    else
 1566|  21.1k|    {
 1567|  21.1k|        tif->tif_rawcp = tif->tif_rawdata;
 1568|  21.1k|        if (tif->tif_rawdataloaded > 0)
  ------------------
  |  Branch (1568:13): [True: 21.1k, False: 0]
  ------------------
 1569|  21.1k|            tif->tif_rawcc = tif->tif_rawdataloaded;
 1570|      0|        else
 1571|      0|            tif->tif_rawcc = (tmsize_t)TIFFGetStrileByteCount(tif, strip);
 1572|  21.1k|    }
 1573|  26.6k|    if ((*tif->tif_predecode)(tif, (uint16_t)(strip / td->td_stripsperimage)) ==
  ------------------
  |  Branch (1573:9): [True: 3.19k, False: 23.4k]
  ------------------
 1574|  26.6k|        0)
 1575|  3.19k|    {
 1576|       |        /* Needed for example for scanline access, if tif_predecode */
 1577|       |        /* fails, and we try to read the same strip again. Without invalidating
 1578|       |         */
 1579|       |        /* tif_curstrip, we'd call tif_decoderow() on a possibly invalid */
 1580|       |        /* codec state. */
 1581|  3.19k|        tif->tif_dir.td_curstrip = NOSTRIP;
  ------------------
  |  |  111|  3.19k|#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
  ------------------
 1582|  3.19k|        return 0;
 1583|  3.19k|    }
 1584|  23.4k|    return 1;
 1585|  26.6k|}
tif_read.c:TIFFStartTile:
 1592|   808k|{
 1593|   808k|    static const char module[] = "TIFFStartTile";
 1594|   808k|    TIFFDirectory *td = &tif->tif_dir;
 1595|   808k|    uint32_t howmany32;
 1596|   808k|    uint32_t tilemod;
 1597|       |
 1598|   808k|    if ((tif->tif_flags & TIFF_CODERSETUP) == 0)
  ------------------
  |  |  124|   808k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
  |  Branch (1598:9): [True: 2.39k, False: 806k]
  ------------------
 1599|  2.39k|    {
 1600|  2.39k|        if (!(*tif->tif_setupdecode)(tif))
  ------------------
  |  Branch (1600:13): [True: 6, False: 2.39k]
  ------------------
 1601|      6|            return (0);
 1602|  2.39k|        tif->tif_flags |= TIFF_CODERSETUP;
  ------------------
  |  |  124|  2.39k|#define TIFF_CODERSETUP 0x00020U  /* encoder/decoder setup done */
  ------------------
 1603|  2.39k|    }
 1604|   808k|    tif->tif_dir.td_curtile = tile;
 1605|   808k|    if (td->td_tilewidth == 0)
  ------------------
  |  Branch (1605:9): [True: 0, False: 808k]
  ------------------
 1606|      0|    {
 1607|      0|        TIFFErrorExtR(tif, module, "Zero tilewidth");
 1608|      0|        return 0;
 1609|      0|    }
 1610|   808k|    howmany32 = TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth);
  ------------------
  |  |  312|   808k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 808k, False: 0]
  |  |  ------------------
  |  |  313|   808k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|   808k|         : 0U)
  ------------------
 1611|   808k|    if (howmany32 == 0)
  ------------------
  |  Branch (1611:9): [True: 0, False: 808k]
  ------------------
 1612|      0|    {
 1613|      0|        TIFFErrorExtR(tif, module, "Zero tiles");
 1614|      0|        return 0;
 1615|      0|    }
 1616|   808k|    tilemod = tile % howmany32;
 1617|   808k|    if (td->td_tilelength == 0)
  ------------------
  |  Branch (1617:9): [True: 0, False: 808k]
  ------------------
 1618|      0|    {
 1619|      0|        TIFFErrorExtR(tif, module, "Zero tilelength");
 1620|      0|        return 0;
 1621|      0|    }
 1622|   808k|    if (tilemod == 0)
  ------------------
  |  Branch (1622:9): [True: 74.1k, False: 734k]
  ------------------
 1623|  74.1k|    {
 1624|  74.1k|        tif->tif_dir.td_row = 0;
 1625|  74.1k|    }
 1626|   734k|    else
 1627|   734k|    {
 1628|   734k|        tif->tif_dir.td_row =
 1629|   734k|            _TIFFMultiply32(tif, tilemod, td->td_tilelength, module);
 1630|   734k|        if (tif->tif_dir.td_row == 0)
  ------------------
  |  Branch (1630:13): [True: 435, False: 733k]
  ------------------
 1631|    435|            return 0;
 1632|   734k|    }
 1633|   807k|    howmany32 = TIFFhowmany_32(td->td_imagelength, td->td_tilelength);
  ------------------
  |  |  312|   807k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 807k, False: 0]
  |  |  ------------------
  |  |  313|   807k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|   807k|         : 0U)
  ------------------
 1634|   807k|    if (howmany32 == 0)
  ------------------
  |  Branch (1634:9): [True: 0, False: 807k]
  ------------------
 1635|      0|    {
 1636|      0|        TIFFErrorExtR(tif, module, "Zero tiles");
 1637|      0|        return 0;
 1638|      0|    }
 1639|   807k|    tilemod = tile % howmany32;
 1640|   807k|    if (tilemod == 0)
  ------------------
  |  Branch (1640:9): [True: 688k, False: 119k]
  ------------------
 1641|   688k|    {
 1642|   688k|        tif->tif_dir.td_col = 0;
 1643|   688k|    }
 1644|   119k|    else
 1645|   119k|    {
 1646|   119k|        tif->tif_dir.td_col =
 1647|   119k|            _TIFFMultiply32(tif, tilemod, td->td_tilewidth, module);
 1648|   119k|        if (tif->tif_dir.td_col == 0)
  ------------------
  |  Branch (1648:13): [True: 169, False: 118k]
  ------------------
 1649|    169|            return 0;
 1650|   119k|    }
 1651|   807k|    tif->tif_flags &= ~TIFF_BUF4WRITE;
  ------------------
  |  |  141|   807k|#define TIFF_BUF4WRITE 0x100000U  /* rawcc bytes are for writing */
  ------------------
 1652|   807k|    if (tif->tif_flags & TIFF_NOREADRAW)
  ------------------
  |  |  138|   807k|    0x20000U /* skip reading of raw uncompressed image data */
  ------------------
  |  Branch (1652:9): [True: 611k, False: 196k]
  ------------------
 1653|   611k|    {
 1654|   611k|        tif->tif_rawcp = NULL;
 1655|   611k|        tif->tif_rawcc = 0;
 1656|   611k|    }
 1657|   196k|    else
 1658|   196k|    {
 1659|   196k|        tif->tif_rawcp = tif->tif_rawdata;
 1660|   196k|        if (tif->tif_rawdataloaded > 0)
  ------------------
  |  Branch (1660:13): [True: 196k, False: 0]
  ------------------
 1661|   196k|            tif->tif_rawcc = tif->tif_rawdataloaded;
 1662|      0|        else
 1663|      0|            tif->tif_rawcc = (tmsize_t)TIFFGetStrileByteCount(tif, tile);
 1664|   196k|    }
 1665|   807k|    return (
 1666|   807k|        (*tif->tif_predecode)(tif, (uint16_t)(tile / td->td_stripsperimage)));
 1667|   807k|}
tif_read.c:TIFFCheckRead:
 1670|  5.53M|{
 1671|  5.53M|    if (tif->tif_mode == O_WRONLY)
  ------------------
  |  Branch (1671:9): [True: 0, False: 5.53M]
  ------------------
 1672|      0|    {
 1673|      0|        TIFFErrorExtR(tif, tif->tif_name, "File not open for reading");
 1674|      0|        return (0);
 1675|      0|    }
 1676|  5.53M|    if (tiles ^ isTiled(tif))
  ------------------
  |  |  278|  5.53M|#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
  |  |  ------------------
  |  |  |  |  129|  5.53M|#define TIFF_ISTILED 0x00400U     /* file is tile, not strip- based */
  |  |  ------------------
  ------------------
  |  Branch (1676:9): [True: 0, False: 5.53M]
  ------------------
 1677|      0|    {
 1678|      0|        TIFFErrorExtR(tif, tif->tif_name,
 1679|      0|                      tiles ? "Can not read tiles from a striped image"
  ------------------
  |  Branch (1679:23): [True: 0, False: 0]
  ------------------
 1680|      0|                            : "Can not read scanlines from a tiled image");
 1681|      0|        return (0);
 1682|      0|    }
 1683|  5.53M|    return (1);
 1684|  5.53M|}

_Z14TIFFStreamOpenPKcPNSt3__113basic_istreamIcNS1_11char_traitsIcEEEE:
  456|  5.98k|{
  457|       |    // NB: We don't support mapped files with streams so add 'm'
  458|  5.98k|    return _tiffStreamOpen(name, "rm", is);
  459|  5.98k|}
tif_stream.cxx:_ZL15_tiffStreamOpenPKcS0_Pv:
  399|  5.98k|    {
  400|  5.98k|        TIFF *tif;
  401|       |
  402|  5.98k|        if (strchr(mode, 'w'))
  ------------------
  |  Branch (402:13): [True: 0, False: 5.98k]
  ------------------
  403|      0|        {
  404|      0|            tiffos_data *data = new tiffos_data;
  405|      0|            data->stream = reinterpret_cast<ostream *>(fd);
  406|      0|            data->start_pos = data->stream->tellp();
  407|       |
  408|       |            // Open for writing.
  409|      0|            tif = TIFFClientOpen(
  410|      0|                name, mode, reinterpret_cast<thandle_t>(data), _tiffosReadProc,
  411|      0|                _tiffosWriteProc, _tiffosSeekProc, _tiffosCloseProc,
  412|      0|                _tiffosSizeProc, _tiffDummyMapProcCxx, _tiffDummyUnmapProcCxx);
  413|      0|            if (!tif)
  ------------------
  |  Branch (413:17): [True: 0, False: 0]
  ------------------
  414|      0|            {
  415|      0|                delete data;
  416|      0|            }
  417|      0|        }
  418|  5.98k|        else
  419|  5.98k|        {
  420|  5.98k|            tiffis_data *data = new tiffis_data;
  421|  5.98k|            data->stream = reinterpret_cast<istream *>(fd);
  422|  5.98k|            data->start_pos = data->stream->tellg();
  423|       |            // Open for reading.
  424|  5.98k|            tif = TIFFClientOpen(
  425|  5.98k|                name, mode, reinterpret_cast<thandle_t>(data), _tiffisReadProc,
  426|  5.98k|                _tiffisWriteProc, _tiffisSeekProc, _tiffisCloseProc,
  427|  5.98k|                _tiffisSizeProc, _tiffDummyMapProcCxx, _tiffDummyUnmapProcCxx);
  428|  5.98k|            if (!tif)
  ------------------
  |  Branch (428:17): [True: 1.59k, False: 4.38k]
  ------------------
  429|  1.59k|            {
  430|  1.59k|                delete data;
  431|  1.59k|            }
  432|  5.98k|        }
  433|       |
  434|  5.98k|        return (tif);
  435|  5.98k|    }
tif_stream.cxx:_ZL15_tiffisReadProcPvS_l:
  109|   808k|    {
  110|   808k|        tiffis_data *data = reinterpret_cast<tiffis_data *>(fd);
  111|       |
  112|       |        // Verify that type does not overflow.
  113|   808k|        streamsize request_size = size;
  114|   808k|        if (static_cast<tmsize_t>(request_size) != size)
  ------------------
  |  Branch (114:13): [True: 0, False: 808k]
  ------------------
  115|      0|            return static_cast<tmsize_t>(-1);
  116|       |
  117|   808k|        data->stream->read((char *)buf, request_size);
  118|       |
  119|   808k|        return static_cast<tmsize_t>(data->stream->gcount());
  120|   808k|    }
tif_stream.cxx:_ZL15_tiffisSeekProcPvmi:
  242|   963k|    {
  243|   963k|        tiffis_data *data = reinterpret_cast<tiffis_data *>(fd);
  244|       |
  245|   963k|        if (data->start_pos == ios::pos_type(-1))
  ------------------
  |  Branch (245:13): [True: 0, False: 963k]
  ------------------
  246|      0|            return static_cast<uint64_t>(-1);
  247|       |
  248|   963k|        switch (whence)
  ------------------
  |  Branch (248:17): [True: 963k, False: 0]
  ------------------
  249|   963k|        {
  250|   963k|            case SEEK_SET:
  ------------------
  |  Branch (250:13): [True: 963k, False: 0]
  ------------------
  251|   963k|            {
  252|       |                // Compute 64-bit offset
  253|   963k|                uint64_t new_offset =
  254|   963k|                    static_cast<uint64_t>(data->start_pos) + off;
  255|       |
  256|       |                // Verify that value does not overflow
  257|   963k|                ios::off_type offset = static_cast<ios::off_type>(new_offset);
  258|   963k|                if (static_cast<uint64_t>(offset) != new_offset)
  ------------------
  |  Branch (258:21): [True: 0, False: 963k]
  ------------------
  259|      0|                    return static_cast<uint64_t>(-1);
  260|       |
  261|   963k|                data->stream->seekg(offset, ios::beg);
  262|   963k|                break;
  263|   963k|            }
  264|      0|            case SEEK_CUR:
  ------------------
  |  Branch (264:13): [True: 0, False: 963k]
  ------------------
  265|      0|            {
  266|       |                // Verify that value does not overflow
  267|      0|                ios::off_type offset = static_cast<ios::off_type>(off);
  268|      0|                if (static_cast<uint64_t>(offset) != off)
  ------------------
  |  Branch (268:21): [True: 0, False: 0]
  ------------------
  269|      0|                    return static_cast<uint64_t>(-1);
  270|       |
  271|      0|                data->stream->seekg(offset, ios::cur);
  272|      0|                break;
  273|      0|            }
  274|      0|            case SEEK_END:
  ------------------
  |  Branch (274:13): [True: 0, False: 963k]
  ------------------
  275|      0|            {
  276|       |                // Verify that value does not overflow
  277|      0|                ios::off_type offset = static_cast<ios::off_type>(off);
  278|      0|                if (static_cast<uint64_t>(offset) != off)
  ------------------
  |  Branch (278:21): [True: 0, False: 0]
  ------------------
  279|      0|                    return static_cast<uint64_t>(-1);
  280|       |
  281|      0|                data->stream->seekg(offset, ios::end);
  282|      0|                break;
  283|      0|            }
  284|   963k|        }
  285|       |
  286|   963k|        ios::pos_type pos = data->stream->tellg();
  287|   963k|        if (pos == ios::pos_type(-1))
  ------------------
  |  Branch (287:13): [True: 184k, False: 779k]
  ------------------
  288|   184k|            return static_cast<uint64_t>(-1);
  289|       |
  290|   779k|        ios::off_type relative_pos = pos - data->start_pos;
  291|   779k|        if (relative_pos < 0)
  ------------------
  |  Branch (291:13): [True: 0, False: 779k]
  ------------------
  292|      0|            return static_cast<uint64_t>(-1);
  293|       |
  294|   779k|        return static_cast<uint64_t>(relative_pos);
  295|   779k|    }
tif_stream.cxx:_ZL16_tiffisCloseProcPv:
  376|  4.38k|    {
  377|       |        // Our stream was not allocated by us, so it shouldn't be closed by us.
  378|  4.38k|        delete reinterpret_cast<tiffis_data *>(fd);
  379|  4.38k|        return 0;
  380|  4.38k|    }
tif_stream.cxx:_ZL15_tiffisSizeProcPv:
  334|  2.84k|    {
  335|  2.84k|        tiffis_data *data = reinterpret_cast<tiffis_data *>(fd);
  336|  2.84k|        ios::pos_type pos = data->stream->tellg();
  337|  2.84k|        ios::pos_type len;
  338|       |
  339|       |        // Failed stream positions must not be converted to unsigned sizes.
  340|  2.84k|        if (pos == ios::pos_type(-1))
  ------------------
  |  Branch (340:13): [True: 679, False: 2.16k]
  ------------------
  341|    679|            return 0;
  342|       |
  343|  2.16k|        data->stream->seekg(0, ios::end);
  344|  2.16k|        if (data->stream->fail())
  ------------------
  |  Branch (344:13): [True: 0, False: 2.16k]
  ------------------
  345|      0|        {
  346|      0|            ios::iostate old_state = data->stream->rdstate();
  347|       |            // Temporarily clear failbit to restore the original position.
  348|      0|            data->stream->clear(data->stream->rdstate() & ~ios::failbit);
  349|      0|            data->stream->seekg(pos);
  350|      0|            data->stream->clear(old_state);
  351|      0|            return 0;
  352|      0|        }
  353|  2.16k|        len = data->stream->tellg();
  354|  2.16k|        if (len == ios::pos_type(-1))
  ------------------
  |  Branch (354:13): [True: 0, False: 2.16k]
  ------------------
  355|      0|        {
  356|      0|            ios::iostate old_state = data->stream->rdstate();
  357|       |            // Temporarily clear failbit to restore the original position.
  358|      0|            data->stream->clear(data->stream->rdstate() & ~ios::failbit);
  359|      0|            data->stream->seekg(pos);
  360|      0|            data->stream->clear(old_state);
  361|      0|            return 0;
  362|      0|        }
  363|  2.16k|        data->stream->seekg(pos);
  364|       |
  365|  2.16k|        return static_cast<uint64_t>(len);
  366|  2.16k|    }

TIFFComputeStrip:
   36|   553k|{
   37|   553k|    static const char module[] = "TIFFComputeStrip";
   38|   553k|    TIFFDirectory *td = &tif->tif_dir;
   39|   553k|    uint32_t strip;
   40|       |
   41|   553k|    if (td->td_rowsperstrip == 0)
  ------------------
  |  Branch (41:9): [True: 0, False: 553k]
  ------------------
   42|      0|    {
   43|      0|        TIFFErrorExtR(tif, module,
   44|      0|                      "Cannot compute strip: RowsPerStrip is zero");
   45|      0|        return 0;
   46|      0|    }
   47|   553k|    strip = row / td->td_rowsperstrip;
   48|   553k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|   553k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (48:9): [True: 205k, False: 347k]
  ------------------
   49|   205k|    {
   50|   205k|        uint64_t sample_offset;
   51|   205k|        uint64_t strip64;
   52|   205k|        if (sample >= td->td_samplesperpixel)
  ------------------
  |  Branch (52:13): [True: 2.28k, False: 203k]
  ------------------
   53|  2.28k|        {
   54|  2.28k|            TIFFErrorExtR(tif, module, "%lu: Sample out of range, max %lu",
   55|  2.28k|                          (unsigned long)sample,
   56|  2.28k|                          (unsigned long)td->td_samplesperpixel);
   57|  2.28k|            return (0);
   58|  2.28k|        }
   59|   203k|        sample_offset = _TIFFMultiply64(tif, sample, td->td_stripsperimage,
   60|   203k|                                        "TIFFComputeStrip");
   61|   203k|        if (sample_offset == 0 && sample != 0 && td->td_stripsperimage != 0)
  ------------------
  |  Branch (61:13): [True: 99.3k, False: 103k]
  |  Branch (61:35): [True: 0, False: 99.3k]
  |  Branch (61:50): [True: 0, False: 0]
  ------------------
   62|      0|            return (0);
   63|   203k|        strip64 = _TIFFAdd64(tif, sample_offset, strip, "TIFFComputeStrip");
   64|   203k|        if (strip64 == 0 && (sample_offset != 0 || strip != 0))
  ------------------
  |  Branch (64:13): [True: 174, False: 202k]
  |  Branch (64:30): [True: 0, False: 174]
  |  Branch (64:52): [True: 0, False: 174]
  ------------------
   65|      0|            return (0);
   66|   203k|        strip = _TIFFCastUInt64ToUInt32(tif, strip64, "TIFFComputeStrip");
   67|   203k|        if (strip == 0 && strip64 != 0)
  ------------------
  |  Branch (67:13): [True: 174, False: 202k]
  |  Branch (67:27): [True: 0, False: 174]
  ------------------
   68|      0|            return (0);
   69|   203k|    }
   70|   551k|    return (strip);
   71|   553k|}
TIFFNumberOfStrips:
   77|  3.33k|{
   78|  3.33k|    TIFFDirectory *td = &tif->tif_dir;
   79|  3.33k|    uint32_t nstrips;
   80|       |
   81|  3.33k|    if (td->td_rowsperstrip == 0)
  ------------------
  |  Branch (81:9): [True: 0, False: 3.33k]
  ------------------
   82|      0|    {
   83|      0|        TIFFWarningExtR(tif, "TIFFNumberOfStrips", "RowsPerStrip is zero");
   84|      0|        return 0;
   85|      0|    }
   86|  3.33k|    nstrips = (td->td_rowsperstrip == (uint32_t)-1
  ------------------
  |  Branch (86:16): [True: 1.40k, False: 1.93k]
  ------------------
   87|  3.33k|                   ? 1
   88|  3.33k|                   : TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
  ------------------
  |  |  312|  1.93k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 1.93k, False: 0]
  |  |  ------------------
  |  |  313|  1.93k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  1.93k|         : 0U)
  ------------------
   89|  3.33k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  3.33k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (89:9): [True: 460, False: 2.87k]
  ------------------
   90|    460|        nstrips =
   91|    460|            _TIFFMultiply32(tif, nstrips, (uint32_t)td->td_samplesperpixel,
   92|    460|                            "TIFFNumberOfStrips");
   93|  3.33k|    return (nstrips);
   94|  3.33k|}
_TIFFStrileSize64:
  101|   817k|{
  102|   817k|    static const char module[] = "_TIFFStrileSize64";
  103|   817k|    TIFFDirectory *td = &tif->tif_dir;
  104|   817k|    if (isStrip)
  ------------------
  |  Branch (104:9): [True: 585k, False: 231k]
  ------------------
  105|   585k|    {
  106|   585k|        if (nrows == (uint32_t)(-1))
  ------------------
  |  Branch (106:13): [True: 3, False: 585k]
  ------------------
  107|      3|            nrows = td->td_imagelength;
  108|   585k|    }
  109|   231k|    else
  110|   231k|    {
  111|   231k|        if (td->td_tilelength == 0 || td->td_tilewidth == 0 ||
  ------------------
  |  Branch (111:13): [True: 0, False: 231k]
  |  Branch (111:39): [True: 4, False: 231k]
  ------------------
  112|   231k|            td->td_tiledepth == 0)
  ------------------
  |  Branch (112:13): [True: 0, False: 231k]
  ------------------
  113|      4|            return (0);
  114|   231k|    }
  115|   817k|    if ((td->td_planarconfig == PLANARCONFIG_CONTIG) &&
  ------------------
  |  |  265|   817k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (115:9): [True: 602k, False: 215k]
  ------------------
  116|   602k|        (td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  227|   602k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
                      (td->td_photometric == PHOTOMETRIC_YCBCR) && (!isUpSampled(tif)))
  ------------------
  |  |  281|   357k|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  133|   357k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (116:9): [True: 357k, False: 244k]
  |  Branch (116:54): [True: 307k, False: 50.2k]
  ------------------
  117|   307k|    {
  118|       |        /*
  119|       |         * Packed YCbCr data contain one Cb+Cr for every
  120|       |         * HorizontalSampling*VerticalSampling Y values.
  121|       |         * Must also roundup width and height when calculating
  122|       |         * since images that are not a multiple of the
  123|       |         * horizontal/vertical subsampling area include
  124|       |         * YCbCr data for the extended image.
  125|       |         */
  126|   307k|        uint16_t ycbcrsubsampling[2];
  127|   307k|        uint16_t samplingblock_samples;
  128|   307k|        uint32_t samplingblocks_hor;
  129|   307k|        uint32_t samplingblocks_ver;
  130|   307k|        uint64_t samplingrow_samples;
  131|   307k|        uint64_t samplingrow_size;
  132|   307k|        if (td->td_samplesperpixel != 3)
  ------------------
  |  Branch (132:13): [True: 3, False: 307k]
  ------------------
  133|      3|        {
  134|      3|            TIFFErrorExtR(tif, module, "Invalid td_samplesperpixel value");
  135|      3|            return 0;
  136|      3|        }
  137|   307k|        TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|   307k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  138|   307k|                              ycbcrsubsampling + 0, ycbcrsubsampling + 1);
  139|   307k|        if ((ycbcrsubsampling[0] != 1 && ycbcrsubsampling[0] != 2 &&
  ------------------
  |  Branch (139:14): [True: 305k, False: 2.48k]
  |  Branch (139:42): [True: 295k, False: 9.78k]
  ------------------
  140|   295k|             ycbcrsubsampling[0] != 4) ||
  ------------------
  |  Branch (140:14): [True: 0, False: 295k]
  ------------------
  141|   307k|            (ycbcrsubsampling[1] != 1 && ycbcrsubsampling[1] != 2 &&
  ------------------
  |  Branch (141:14): [True: 306k, False: 1.09k]
  |  Branch (141:42): [True: 128k, False: 178k]
  ------------------
  142|   128k|             ycbcrsubsampling[1] != 4) ||
  ------------------
  |  Branch (142:14): [True: 0, False: 128k]
  ------------------
  143|   307k|            (ycbcrsubsampling[0] == 0 || ycbcrsubsampling[1] == 0))
  ------------------
  |  Branch (143:14): [True: 0, False: 307k]
  |  Branch (143:42): [True: 0, False: 307k]
  ------------------
  144|      0|        {
  145|      0|            TIFFErrorExtR(tif, module, "Invalid YCbCr subsampling (%dx%d)",
  146|      0|                          ycbcrsubsampling[0], ycbcrsubsampling[1]);
  147|      0|            return 0;
  148|      0|        }
  149|   307k|        samplingblock_samples =
  150|   307k|            (uint16_t)(ycbcrsubsampling[0] * ycbcrsubsampling[1] + 2);
  151|   307k|        const uint32_t width = isStrip ? td->td_imagewidth : td->td_tilewidth;
  ------------------
  |  Branch (151:32): [True: 303k, False: 4.63k]
  ------------------
  152|   307k|        samplingblocks_hor = TIFFhowmany_32(width, ycbcrsubsampling[0]);
  ------------------
  |  |  312|   307k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 307k, False: 0]
  |  |  ------------------
  |  |  313|   307k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|   307k|         : 0U)
  ------------------
  153|   307k|        samplingblocks_ver = TIFFhowmany_32(nrows, ycbcrsubsampling[1]);
  ------------------
  |  |  312|   307k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 307k, False: 46]
  |  |  ------------------
  |  |  313|   307k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|   307k|         : 0U)
  ------------------
  154|   307k|        samplingrow_samples = _TIFFMultiply64(tif, samplingblocks_hor,
  155|   307k|                                              samplingblock_samples, module);
  156|   307k|        samplingrow_size = TIFFhowmany8_64(_TIFFMultiply64(
  ------------------
  |  |  326|   307k|    (((x) & 0x07) ? ((uint64_t)(x) >> 3) + 1 : (uint64_t)(x) >> 3)
  |  |  ------------------
  |  |  |  Branch (326:6): [True: 4.68k, False: 303k]
  |  |  ------------------
  ------------------
  157|   307k|            tif, samplingrow_samples, td->td_bitspersample, module));
  158|   307k|        return (
  159|   307k|            _TIFFMultiply64(tif, samplingrow_size, samplingblocks_ver, module));
  160|   307k|    }
  161|   509k|    else
  162|   509k|        return (_TIFFMultiply64(tif, nrows,
  163|   509k|                                isStrip ? TIFFScanlineSize64(tif)
  ------------------
  |  Branch (163:33): [True: 282k, False: 227k]
  ------------------
  164|   509k|                                        : TIFFTileRowSize64(tif),
  165|   509k|                                module));
  166|   817k|}
TIFFVStripSize64:
  172|   585k|{
  173|   585k|    return _TIFFStrileSize64(tif, nrows, /* isStrip = */ TRUE);
  ------------------
  |  |   71|   585k|#define TRUE 1
  ------------------
  174|   585k|}
TIFFVStripSize:
  177|   553k|{
  178|   553k|    static const char module[] = "TIFFVStripSize";
  179|   553k|    uint64_t m;
  180|   553k|    m = TIFFVStripSize64(tif, nrows);
  181|   553k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  182|   553k|}
TIFFStripSize64:
  231|  32.1k|{
  232|  32.1k|    TIFFDirectory *td = &tif->tif_dir;
  233|  32.1k|    uint32_t rps = td->td_rowsperstrip;
  234|  32.1k|    if (rps > td->td_imagelength)
  ------------------
  |  Branch (234:9): [True: 4.64k, False: 27.4k]
  ------------------
  235|  4.64k|        rps = td->td_imagelength;
  236|  32.1k|    return (TIFFVStripSize64(tif, rps));
  237|  32.1k|}
TIFFStripSize:
  239|  31.9k|{
  240|  31.9k|    static const char module[] = "TIFFStripSize";
  241|  31.9k|    uint64_t m;
  242|  31.9k|    m = TIFFStripSize64(tif);
  243|  31.9k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  244|  31.9k|}
TIFFScanlineSize64:
  292|   292k|{
  293|   292k|    static const char module[] = "TIFFScanlineSize64";
  294|   292k|    TIFFDirectory *td = &tif->tif_dir;
  295|   292k|    uint64_t scanline_size;
  296|   292k|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|   292k|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (296:9): [True: 83.3k, False: 209k]
  ------------------
  297|  83.3k|    {
  298|  83.3k|        if ((td->td_photometric == PHOTOMETRIC_YCBCR) &&
  ------------------
  |  |  227|  83.3k|#define PHOTOMETRIC_YCBCR 6                /* !CCIR 601 */
  ------------------
  |  Branch (298:13): [True: 2.59k, False: 80.7k]
  ------------------
  299|  2.59k|            (td->td_samplesperpixel == 3) && (!isUpSampled(tif)))
  ------------------
  |  |  281|  2.59k|#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
  |  |  ------------------
  |  |  |  |  133|  2.59k|#define TIFF_UPSAMPLED 0x04000U   /* library is doing data up-sampling */
  |  |  ------------------
  ------------------
  |  Branch (299:13): [True: 2.59k, False: 3]
  |  Branch (299:46): [True: 2.09k, False: 502]
  ------------------
  300|  2.09k|        {
  301|  2.09k|            uint16_t ycbcrsubsampling[2];
  302|  2.09k|            uint16_t samplingblock_samples;
  303|  2.09k|            uint32_t samplingblocks_hor;
  304|  2.09k|            uint64_t samplingrow_samples;
  305|  2.09k|            uint64_t samplingrow_size;
  306|  2.09k|            if (td->td_samplesperpixel != 3)
  ------------------
  |  Branch (306:17): [True: 0, False: 2.09k]
  ------------------
  307|      0|            {
  308|      0|                TIFFErrorExtR(tif, module, "Invalid td_samplesperpixel value");
  309|      0|                return 0;
  310|      0|            }
  311|  2.09k|            TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
  ------------------
  |  |  388|  2.09k|#define TIFFTAG_YCBCRSUBSAMPLING 530       /* !YCbCr subsampling factors */
  ------------------
  312|  2.09k|                                  ycbcrsubsampling + 0, ycbcrsubsampling + 1);
  313|  2.09k|            if (((ycbcrsubsampling[0] != 1) && (ycbcrsubsampling[0] != 2) &&
  ------------------
  |  Branch (313:18): [True: 1.89k, False: 204]
  |  Branch (313:48): [True: 355, False: 1.53k]
  ------------------
  314|    355|                 (ycbcrsubsampling[0] != 4)) ||
  ------------------
  |  Branch (314:18): [True: 1, False: 354]
  ------------------
  315|  2.09k|                ((ycbcrsubsampling[1] != 1) && (ycbcrsubsampling[1] != 2) &&
  ------------------
  |  Branch (315:18): [True: 1.86k, False: 230]
  |  Branch (315:48): [True: 200, False: 1.66k]
  ------------------
  316|    200|                 (ycbcrsubsampling[1] != 4)) ||
  ------------------
  |  Branch (316:18): [True: 1, False: 199]
  ------------------
  317|  2.09k|                ((ycbcrsubsampling[0] == 0) || (ycbcrsubsampling[1] == 0)))
  ------------------
  |  Branch (317:18): [True: 0, False: 2.09k]
  |  Branch (317:48): [True: 0, False: 2.09k]
  ------------------
  318|      2|            {
  319|      2|                TIFFErrorExtR(tif, module, "Invalid YCbCr subsampling");
  320|      2|                return 0;
  321|      2|            }
  322|  2.09k|            samplingblock_samples =
  323|  2.09k|                (uint16_t)(ycbcrsubsampling[0] * ycbcrsubsampling[1] + 2);
  324|  2.09k|            samplingblocks_hor =
  325|  2.09k|                TIFFhowmany_32(td->td_imagewidth, ycbcrsubsampling[0]);
  ------------------
  |  |  312|  2.09k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 2.08k, False: 7]
  |  |  ------------------
  |  |  313|  2.09k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  2.09k|         : 0U)
  ------------------
  326|  2.09k|            samplingrow_samples = _TIFFMultiply64(
  327|  2.09k|                tif, samplingblocks_hor, samplingblock_samples, module);
  328|  2.09k|            samplingrow_size =
  329|  2.09k|                TIFFhowmany_64(_TIFFMultiply64(tif, samplingrow_samples,
  ------------------
  |  |  324|  2.09k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  ------------------
  330|  2.09k|                                               td->td_bitspersample, module),
  331|  2.09k|                               8);
  332|  2.09k|            scanline_size = (samplingrow_size / ycbcrsubsampling[1]);
  333|  2.09k|        }
  334|  81.2k|        else
  335|  81.2k|        {
  336|  81.2k|            uint64_t scanline_samples;
  337|  81.2k|            uint32_t scanline_width = td->td_imagewidth;
  338|       |
  339|       |#if 0
  340|       |            // Tries to fix https://gitlab.com/libtiff/libtiff/-/merge_requests/564
  341|       |            // but causes regression when decoding legit files with tiffcp -c none
  342|       |            // Cf https://gitlab.com/libtiff/libtiff/-/merge_requests/644
  343|       |            if (td->td_photometric == PHOTOMETRIC_YCBCR)
  344|       |            {
  345|       |                uint16_t subsampling_hor;
  346|       |                uint16_t ignored;
  347|       |                TIFFGetFieldDefaulted(tif, TIFFTAG_YCBCRSUBSAMPLING,
  348|       |                                      &subsampling_hor, &ignored);
  349|       |                if (subsampling_hor > 1) // roundup width for YCbCr
  350|       |                    scanline_width =
  351|       |                        TIFFroundup_32(scanline_width, subsampling_hor);
  352|       |            }
  353|       |#endif
  354|       |
  355|  81.2k|            scanline_samples = _TIFFMultiply64(tif, scanline_width,
  356|  81.2k|                                               td->td_samplesperpixel, module);
  357|  81.2k|            scanline_size =
  358|  81.2k|                TIFFhowmany_64(_TIFFMultiply64(tif, scanline_samples,
  ------------------
  |  |  324|  81.2k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  ------------------
  359|  81.2k|                                               td->td_bitspersample, module),
  360|  81.2k|                               8);
  361|  81.2k|        }
  362|  83.3k|    }
  363|   209k|    else
  364|   209k|    {
  365|   209k|        scanline_size =
  366|   209k|            TIFFhowmany_64(_TIFFMultiply64(tif, td->td_imagewidth,
  ------------------
  |  |  324|   209k|    ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
  ------------------
  367|   209k|                                           td->td_bitspersample, module),
  368|   209k|                           8);
  369|   209k|    }
  370|   292k|    if (scanline_size == 0)
  ------------------
  |  Branch (370:9): [True: 43, False: 292k]
  ------------------
  371|     43|    {
  372|     43|        TIFFErrorExtR(tif, module, "Computed scanline size is zero");
  373|     43|        return 0;
  374|     43|    }
  375|   292k|    return (scanline_size);
  376|   292k|}
TIFFScanlineSize:
  378|  9.99k|{
  379|  9.99k|    static const char module[] = "TIFFScanlineSize";
  380|  9.99k|    uint64_t m;
  381|  9.99k|    m = TIFFScanlineSize64(tif);
  382|  9.99k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  383|  9.99k|}

TIFFSwabShort:
   34|  20.5k|{
   35|  20.5k|    unsigned char *cp = (unsigned char *)wp;
   36|  20.5k|    unsigned char t;
   37|  20.5k|    assert(sizeof(uint16_t) == 2);
  ------------------
  |  Branch (37:5): [True: 0, Folded]
  |  Branch (37:5): [True: 20.5k, Folded]
  ------------------
   38|  20.5k|    t = cp[1];
   39|  20.5k|    cp[1] = cp[0];
   40|  20.5k|    cp[0] = t;
   41|  20.5k|}
TIFFSwabLong:
   46|  15.2k|{
   47|  15.2k|    unsigned char *cp = (unsigned char *)lp;
   48|  15.2k|    unsigned char t;
   49|  15.2k|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (49:5): [True: 0, Folded]
  |  Branch (49:5): [True: 15.2k, Folded]
  ------------------
   50|  15.2k|    t = cp[3];
   51|  15.2k|    cp[3] = cp[0];
   52|  15.2k|    cp[0] = t;
   53|  15.2k|    t = cp[2];
   54|  15.2k|    cp[2] = cp[1];
   55|  15.2k|    cp[1] = t;
   56|  15.2k|}
TIFFSwabLong8:
   61|  2.62k|{
   62|  2.62k|    unsigned char *cp = (unsigned char *)lp;
   63|  2.62k|    unsigned char t;
   64|  2.62k|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (64:5): [True: 0, Folded]
  |  Branch (64:5): [True: 2.62k, Folded]
  ------------------
   65|  2.62k|    t = cp[7];
   66|  2.62k|    cp[7] = cp[0];
   67|  2.62k|    cp[0] = t;
   68|  2.62k|    t = cp[6];
   69|  2.62k|    cp[6] = cp[1];
   70|  2.62k|    cp[1] = t;
   71|  2.62k|    t = cp[5];
   72|  2.62k|    cp[5] = cp[2];
   73|  2.62k|    cp[2] = t;
   74|  2.62k|    t = cp[4];
   75|  2.62k|    cp[4] = cp[3];
   76|  2.62k|    cp[3] = t;
   77|  2.62k|}
TIFFSwabArrayOfShort:
   82|  3.47k|{
   83|  3.47k|    unsigned char *cp;
   84|  3.47k|    unsigned char t;
   85|  3.47k|    assert(sizeof(uint16_t) == 2);
  ------------------
  |  Branch (85:5): [True: 0, Folded]
  |  Branch (85:5): [True: 3.47k, Folded]
  ------------------
   86|       |    /* XXX unroll loop some */
   87|  16.0k|    while (n-- > 0)
  ------------------
  |  Branch (87:12): [True: 12.5k, False: 3.47k]
  ------------------
   88|  12.5k|    {
   89|  12.5k|        cp = (unsigned char *)wp;
   90|  12.5k|        t = cp[1];
   91|  12.5k|        cp[1] = cp[0];
   92|  12.5k|        cp[0] = t;
   93|  12.5k|        wp++;
   94|  12.5k|    }
   95|  3.47k|}
TIFFSwabArrayOfTriples:
  100|    388|{
  101|    388|    unsigned char *cp;
  102|    388|    unsigned char t;
  103|       |
  104|       |    /* XXX unroll loop some */
  105|  6.80k|    while (n-- > 0)
  ------------------
  |  Branch (105:12): [True: 6.41k, False: 388]
  ------------------
  106|  6.41k|    {
  107|  6.41k|        cp = (unsigned char *)tp;
  108|  6.41k|        t = cp[2];
  109|  6.41k|        cp[2] = cp[0];
  110|  6.41k|        cp[0] = t;
  111|  6.41k|        tp += 3;
  112|  6.41k|    }
  113|    388|}
TIFFSwabArrayOfLong:
  118|    362|{
  119|    362|    unsigned char *cp;
  120|    362|    unsigned char t;
  121|    362|    assert(sizeof(uint32_t) == 4);
  ------------------
  |  Branch (121:5): [True: 0, Folded]
  |  Branch (121:5): [True: 362, Folded]
  ------------------
  122|       |    /* XXX unroll loop some */
  123|  11.5k|    while (n-- > 0)
  ------------------
  |  Branch (123:12): [True: 11.1k, False: 362]
  ------------------
  124|  11.1k|    {
  125|  11.1k|        cp = (unsigned char *)lp;
  126|  11.1k|        t = cp[3];
  127|  11.1k|        cp[3] = cp[0];
  128|  11.1k|        cp[0] = t;
  129|  11.1k|        t = cp[2];
  130|  11.1k|        cp[2] = cp[1];
  131|  11.1k|        cp[1] = t;
  132|  11.1k|        lp++;
  133|  11.1k|    }
  134|    362|}
TIFFSwabArrayOfLong8:
  139|    227|{
  140|    227|    unsigned char *cp;
  141|    227|    unsigned char t;
  142|    227|    assert(sizeof(uint64_t) == 8);
  ------------------
  |  Branch (142:5): [True: 0, Folded]
  |  Branch (142:5): [True: 227, Folded]
  ------------------
  143|       |    /* XXX unroll loop some */
  144|  2.12k|    while (n-- > 0)
  ------------------
  |  Branch (144:12): [True: 1.89k, False: 227]
  ------------------
  145|  1.89k|    {
  146|  1.89k|        cp = (unsigned char *)lp;
  147|  1.89k|        t = cp[7];
  148|  1.89k|        cp[7] = cp[0];
  149|  1.89k|        cp[0] = t;
  150|  1.89k|        t = cp[6];
  151|  1.89k|        cp[6] = cp[1];
  152|  1.89k|        cp[1] = t;
  153|  1.89k|        t = cp[5];
  154|  1.89k|        cp[5] = cp[2];
  155|  1.89k|        cp[2] = t;
  156|  1.89k|        t = cp[4];
  157|  1.89k|        cp[4] = cp[3];
  158|  1.89k|        cp[3] = t;
  159|  1.89k|        lp++;
  160|  1.89k|    }
  161|    227|}
TIFFSwabArrayOfDouble:
  223|    259|{
  224|    259|    unsigned char *cp;
  225|    259|    unsigned char t;
  226|    259|    assert(sizeof(double) == 8);
  ------------------
  |  Branch (226:5): [True: 0, Folded]
  |  Branch (226:5): [True: 259, Folded]
  ------------------
  227|       |    /* XXX unroll loop some */
  228|  1.18k|    while (n-- > 0)
  ------------------
  |  Branch (228:12): [True: 927, False: 259]
  ------------------
  229|    927|    {
  230|    927|        cp = (unsigned char *)dp;
  231|    927|        t = cp[7];
  232|    927|        cp[7] = cp[0];
  233|    927|        cp[0] = t;
  234|    927|        t = cp[6];
  235|    927|        cp[6] = cp[1];
  236|    927|        cp[1] = t;
  237|    927|        t = cp[5];
  238|    927|        cp[5] = cp[2];
  239|    927|        cp[2] = t;
  240|    927|        t = cp[4];
  241|    927|        cp[4] = cp[3];
  242|    927|        cp[3] = t;
  243|    927|        dp++;
  244|    927|    }
  245|    259|}
TIFFGetBitRevTable:
  306|  27.4k|{
  307|  27.4k|    return (reversed ? TIFFBitRevTable : TIFFNoBitRevTable);
  ------------------
  |  Branch (307:13): [True: 27.3k, False: 70]
  ------------------
  308|  27.4k|}
TIFFReverseBits:
  311|    918|{
  312|  20.4k|    for (; n > 8; n -= 8)
  ------------------
  |  Branch (312:12): [True: 19.5k, False: 918]
  ------------------
  313|  19.5k|    {
  314|  19.5k|        cp[0] = TIFFBitRevTable[cp[0]];
  315|  19.5k|        cp[1] = TIFFBitRevTable[cp[1]];
  316|  19.5k|        cp[2] = TIFFBitRevTable[cp[2]];
  317|  19.5k|        cp[3] = TIFFBitRevTable[cp[3]];
  318|  19.5k|        cp[4] = TIFFBitRevTable[cp[4]];
  319|  19.5k|        cp[5] = TIFFBitRevTable[cp[5]];
  320|  19.5k|        cp[6] = TIFFBitRevTable[cp[6]];
  321|  19.5k|        cp[7] = TIFFBitRevTable[cp[7]];
  322|  19.5k|        cp += 8;
  323|  19.5k|    }
  324|  4.52k|    while (n-- > 0)
  ------------------
  |  Branch (324:12): [True: 3.60k, False: 918]
  ------------------
  325|  3.60k|    {
  326|  3.60k|        *cp = TIFFBitRevTable[*cp];
  327|  3.60k|        cp++;
  328|  3.60k|    }
  329|    918|}

TIFFInitThunderScan:
  196|     11|{
  197|     11|    (void)scheme;
  198|       |
  199|     11|    tif->tif_setupdecode = ThunderSetupDecode;
  200|     11|    tif->tif_decoderow = ThunderDecodeRow;
  201|     11|    tif->tif_decodestrip = ThunderDecodeRow;
  202|     11|    return (1);
  203|     11|}
tif_thunder.c:ThunderSetupDecode:
   70|     11|{
   71|     11|    static const char module[] = "ThunderSetupDecode";
   72|       |
   73|     11|    if (tif->tif_dir.td_bitspersample != 4)
  ------------------
  |  Branch (73:9): [True: 0, False: 11]
  ------------------
   74|      0|    {
   75|      0|        TIFFErrorExtR(tif, module,
   76|      0|                      "Wrong bitspersample value (%d), Thunder decoder only "
   77|      0|                      "supports 4bits per sample.",
   78|      0|                      (int)tif->tif_dir.td_bitspersample);
   79|      0|        return 0;
   80|      0|    }
   81|       |
   82|     11|    return (1);
   83|     11|}
tif_thunder.c:ThunderDecodeRow:
  175|    918|{
  176|    918|    static const char module[] = "ThunderDecodeRow";
  177|    918|    uint8_t *row = buf;
  178|       |
  179|    918|    (void)s;
  180|    918|    if (occ % tif->tif_dir.td_scanlinesize)
  ------------------
  |  Branch (180:9): [True: 0, False: 918]
  ------------------
  181|      0|    {
  182|      0|        TIFFErrorExtR(tif, module, "Fractional scanlines cannot be read");
  183|      0|        return (0);
  184|      0|    }
  185|  2.62k|    while (occ > 0)
  ------------------
  |  Branch (185:12): [True: 2.20k, False: 421]
  ------------------
  186|  2.20k|    {
  187|  2.20k|        if (!ThunderDecode(tif, row, tif->tif_dir.td_imagewidth))
  ------------------
  |  Branch (187:13): [True: 497, False: 1.70k]
  ------------------
  188|    497|            return (0);
  189|  1.70k|        occ -= tif->tif_dir.td_scanlinesize;
  190|  1.70k|        row += tif->tif_dir.td_scanlinesize;
  191|  1.70k|    }
  192|    421|    return (1);
  193|    918|}
tif_thunder.c:ThunderDecode:
   86|  2.20k|{
   87|  2.20k|    static const char module[] = "ThunderDecode";
   88|  2.20k|    unsigned char *bp;
   89|  2.20k|    tmsize_t cc;
   90|  2.20k|    unsigned int lastpixel;
   91|  2.20k|    tmsize_t npixels;
   92|  2.20k|    uint8_t *op = op0;
   93|       |
   94|  2.20k|    bp = (unsigned char *)tif->tif_rawcp;
   95|  2.20k|    cc = tif->tif_rawcc;
   96|  2.20k|    lastpixel = 0;
   97|  2.20k|    npixels = 0;
   98|  14.1k|    while (cc > 0 && npixels < maxpixels)
  ------------------
  |  Branch (98:12): [True: 13.8k, False: 299]
  |  Branch (98:22): [True: 11.9k, False: 1.90k]
  ------------------
   99|  11.9k|    {
  100|  11.9k|        int n, delta;
  101|       |
  102|  11.9k|        n = *bp++;
  103|  11.9k|        cc--;
  104|  11.9k|        switch (n & THUNDER_CODE)
  ------------------
  |  |   45|  11.9k|#define THUNDER_CODE 0xc0 /* mask for 2-bit code word */
  ------------------
  105|  11.9k|        {
  106|  5.16k|            case THUNDER_RUN: /* pixel run */
  ------------------
  |  |   47|  5.16k|#define THUNDER_RUN 0x00        /* run of pixels w/ encoded count */
  ------------------
  |  Branch (106:13): [True: 5.16k, False: 6.74k]
  ------------------
  107|       |                /*
  108|       |                 * Replicate the last pixel n times,
  109|       |                 * where n is the lower-order 6 bits.
  110|       |                 */
  111|  5.16k|                if (n == 0)
  ------------------
  |  Branch (111:21): [True: 2.22k, False: 2.93k]
  ------------------
  112|  2.22k|                    break;
  113|  2.93k|                if (npixels & 1)
  ------------------
  |  Branch (113:21): [True: 1.21k, False: 1.72k]
  ------------------
  114|  1.21k|                {
  115|  1.21k|                    op[0] |= (uint8_t)lastpixel;
  116|  1.21k|                    lastpixel = *op++;
  117|  1.21k|                    npixels++;
  118|  1.21k|                    n--;
  119|  1.21k|                }
  120|  1.72k|                else
  121|  1.72k|                    lastpixel |= lastpixel << 4;
  122|  2.93k|                npixels += n;
  123|  2.93k|                if (npixels > maxpixels)
  ------------------
  |  Branch (123:21): [True: 281, False: 2.65k]
  ------------------
  124|    281|                    break;
  125|  13.4k|                for (; n > 0; n -= 2)
  ------------------
  |  Branch (125:24): [True: 10.7k, False: 2.65k]
  ------------------
  126|  10.7k|                    *op++ = (uint8_t)lastpixel;
  127|  2.65k|                if (n == -1)
  ------------------
  |  Branch (127:21): [True: 1.29k, False: 1.36k]
  ------------------
  128|  1.29k|                    *--op &= 0xf0;
  129|  2.65k|                lastpixel &= 0xf;
  130|  2.65k|                break;
  131|  4.72k|            case THUNDER_2BITDELTAS: /* 2-bit deltas */
  ------------------
  |  |   48|  4.72k|#define THUNDER_2BITDELTAS 0x40 /* 3 pixels w/ encoded 2-bit deltas */
  ------------------
  |  Branch (131:13): [True: 4.72k, False: 7.18k]
  ------------------
  132|  4.72k|                if ((delta = ((n >> 4) & 3)) != DELTA2_SKIP)
  ------------------
  |  |   49|  4.72k|#define DELTA2_SKIP 2           /* skip code for 2-bit deltas */
  ------------------
  |  Branch (132:21): [True: 4.14k, False: 586]
  ------------------
  133|  4.14k|                    SETPIXEL(op,
  ------------------
  |  |   58|  4.14k|    {                                                                          \
  |  |   59|  4.14k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  4.14k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 4.14k, False: 0]
  |  |  ------------------
  |  |   61|  4.14k|        {                                                                      \
  |  |   62|  4.14k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 1.45k, False: 2.68k]
  |  |  ------------------
  |  |   63|  4.14k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  4.14k|            else                                                               \
  |  |   65|  4.14k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  4.14k|        }                                                                      \
  |  |   67|  4.14k|    }
  ------------------
  134|  4.72k|                             (unsigned)((int)lastpixel + twobitdeltas[delta]));
  135|  4.72k|                if ((delta = ((n >> 2) & 3)) != DELTA2_SKIP)
  ------------------
  |  |   49|  4.72k|#define DELTA2_SKIP 2           /* skip code for 2-bit deltas */
  ------------------
  |  Branch (135:21): [True: 4.10k, False: 624]
  ------------------
  136|  4.10k|                    SETPIXEL(op,
  ------------------
  |  |   58|  4.10k|    {                                                                          \
  |  |   59|  4.10k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  4.10k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 3.33k, False: 773]
  |  |  ------------------
  |  |   61|  4.10k|        {                                                                      \
  |  |   62|  3.33k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 1.55k, False: 1.77k]
  |  |  ------------------
  |  |   63|  3.33k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  3.33k|            else                                                               \
  |  |   65|  3.33k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  3.33k|        }                                                                      \
  |  |   67|  4.10k|    }
  ------------------
  137|  4.72k|                             (unsigned)((int)lastpixel + twobitdeltas[delta]));
  138|  4.72k|                if ((delta = (n & 3)) != DELTA2_SKIP)
  ------------------
  |  |   49|  4.72k|#define DELTA2_SKIP 2           /* skip code for 2-bit deltas */
  ------------------
  |  Branch (138:21): [True: 3.63k, False: 1.09k]
  ------------------
  139|  3.63k|                    SETPIXEL(op,
  ------------------
  |  |   58|  3.63k|    {                                                                          \
  |  |   59|  3.63k|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|  3.63k|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 3.02k, False: 604]
  |  |  ------------------
  |  |   61|  3.63k|        {                                                                      \
  |  |   62|  3.02k|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 1.60k, False: 1.42k]
  |  |  ------------------
  |  |   63|  3.02k|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|  3.02k|            else                                                               \
  |  |   65|  3.02k|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|  3.02k|        }                                                                      \
  |  |   67|  3.63k|    }
  ------------------
  140|  4.72k|                             (unsigned)((int)lastpixel + twobitdeltas[delta]));
  141|  4.72k|                break;
  142|  1.18k|            case THUNDER_3BITDELTAS: /* 3-bit deltas */
  ------------------
  |  |   50|  1.18k|#define THUNDER_3BITDELTAS 0x80 /* 2 pixels w/ encoded 3-bit deltas */
  ------------------
  |  Branch (142:13): [True: 1.18k, False: 10.7k]
  ------------------
  143|  1.18k|                if ((delta = ((n >> 3) & 7)) != DELTA3_SKIP)
  ------------------
  |  |   51|  1.18k|#define DELTA3_SKIP 4           /* skip code for 3-bit deltas */
  ------------------
  |  Branch (143:21): [True: 986, False: 203]
  ------------------
  144|    986|                    SETPIXEL(
  ------------------
  |  |   58|    986|    {                                                                          \
  |  |   59|    986|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|    986|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 986, False: 0]
  |  |  ------------------
  |  |   61|    986|        {                                                                      \
  |  |   62|    986|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 474, False: 512]
  |  |  ------------------
  |  |   63|    986|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|    986|            else                                                               \
  |  |   65|    986|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|    986|        }                                                                      \
  |  |   67|    986|    }
  ------------------
  145|  1.18k|                        op, (unsigned)((int)lastpixel + threebitdeltas[delta]));
  146|  1.18k|                if ((delta = (n & 7)) != DELTA3_SKIP)
  ------------------
  |  |   51|  1.18k|#define DELTA3_SKIP 4           /* skip code for 3-bit deltas */
  ------------------
  |  Branch (146:21): [True: 895, False: 294]
  ------------------
  147|    895|                    SETPIXEL(
  ------------------
  |  |   58|    895|    {                                                                          \
  |  |   59|    895|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|    895|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 656, False: 239]
  |  |  ------------------
  |  |   61|    895|        {                                                                      \
  |  |   62|    656|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 202, False: 454]
  |  |  ------------------
  |  |   63|    656|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|    656|            else                                                               \
  |  |   65|    656|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|    656|        }                                                                      \
  |  |   67|    895|    }
  ------------------
  148|  1.18k|                        op, (unsigned)((int)lastpixel + threebitdeltas[delta]));
  149|  1.18k|                break;
  150|    829|            case THUNDER_RAW: /* raw data */
  ------------------
  |  |   52|    829|#define THUNDER_RAW 0xc0        /* raw data encoded */
  ------------------
  |  Branch (150:13): [True: 829, False: 11.0k]
  ------------------
  151|    829|                SETPIXEL(op, n);
  ------------------
  |  |   58|    829|    {                                                                          \
  |  |   59|    829|        lastpixel = (v) & 0xf;                                                 \
  |  |   60|    829|        if (npixels < maxpixels)                                               \
  |  |  ------------------
  |  |  |  Branch (60:13): [True: 829, False: 0]
  |  |  ------------------
  |  |   61|    829|        {                                                                      \
  |  |   62|    829|            if (npixels++ & 1)                                                 \
  |  |  ------------------
  |  |  |  Branch (62:17): [True: 346, False: 483]
  |  |  ------------------
  |  |   63|    829|                *op++ |= (uint8_t)lastpixel;                                   \
  |  |   64|    829|            else                                                               \
  |  |   65|    829|                op[0] = (uint8_t)(lastpixel << 4);                             \
  |  |   66|    829|        }                                                                      \
  |  |   67|    829|    }
  ------------------
  152|    829|                break;
  153|      0|            default:
  ------------------
  |  Branch (153:13): [True: 0, False: 11.9k]
  ------------------
  154|      0|                break;
  155|  11.9k|        }
  156|  11.9k|    }
  157|  2.20k|    tif->tif_rawcp = (uint8_t *)bp;
  158|  2.20k|    tif->tif_rawcc = cc;
  159|  2.20k|    if (npixels != maxpixels)
  ------------------
  |  Branch (159:9): [True: 497, False: 1.70k]
  ------------------
  160|    497|    {
  161|    497|        uint8_t *op_end = op0 + (maxpixels + 1) / 2;
  162|    497|        memset(op, 0, (size_t)(op_end - op));
  163|    497|        TIFFErrorExtR(tif, module,
  164|    497|                      "%s data at scanline %lu (%" PRIu64 " != %" PRIu64 ")",
  165|    497|                      npixels < maxpixels ? "Not enough" : "Too much",
  ------------------
  |  Branch (165:23): [True: 216, False: 281]
  ------------------
  166|    497|                      (unsigned long)tif->tif_dir.td_row, (uint64_t)npixels,
  167|    497|                      (uint64_t)maxpixels);
  168|    497|        return (0);
  169|    497|    }
  170|       |
  171|  1.70k|    return (1);
  172|  2.20k|}

TIFFComputeTile:
   37|  1.52M|{
   38|  1.52M|    TIFFDirectory *td = &tif->tif_dir;
   39|  1.52M|    uint32_t dx = td->td_tilewidth;
   40|  1.52M|    uint32_t dy = td->td_tilelength;
   41|  1.52M|    uint32_t dz = td->td_tiledepth;
   42|  1.52M|    uint32_t tile = 1;
   43|       |
   44|  1.52M|    if (td->td_imagedepth == 1)
  ------------------
  |  Branch (44:9): [True: 1.52M, False: 216]
  ------------------
   45|  1.52M|        z = 0;
   46|  1.52M|    if (dx == (uint32_t)-1)
  ------------------
  |  Branch (46:9): [True: 0, False: 1.52M]
  ------------------
   47|      0|        dx = td->td_imagewidth;
   48|  1.52M|    if (dy == (uint32_t)-1)
  ------------------
  |  Branch (48:9): [True: 0, False: 1.52M]
  ------------------
   49|      0|        dy = td->td_imagelength;
   50|  1.52M|    if (dz == (uint32_t)-1)
  ------------------
  |  Branch (50:9): [True: 250, False: 1.52M]
  ------------------
   51|    250|        dz = td->td_imagedepth;
   52|  1.52M|    if (dx != 0 && dy != 0 && dz != 0)
  ------------------
  |  Branch (52:9): [True: 1.52M, False: 0]
  |  Branch (52:20): [True: 1.52M, False: 0]
  |  Branch (52:31): [True: 1.52M, False: 0]
  ------------------
   53|  1.52M|    {
   54|  1.52M|        uint32_t xpt = TIFFhowmany_32(td->td_imagewidth, dx);
  ------------------
  |  |  312|  1.52M|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 1.52M, False: 0]
  |  |  ------------------
  |  |  313|  1.52M|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  1.52M|         : 0U)
  ------------------
   55|  1.52M|        uint32_t ypt = TIFFhowmany_32(td->td_imagelength, dy);
  ------------------
  |  |  312|  1.52M|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 1.52M, False: 0]
  |  |  ------------------
  |  |  313|  1.52M|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  1.52M|         : 0U)
  ------------------
   56|  1.52M|        uint32_t zpt = TIFFhowmany_32(td->td_imagedepth, dz);
  ------------------
  |  |  312|  1.52M|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 1.52M, False: 0]
  |  |  ------------------
  |  |  313|  1.52M|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  1.52M|         : 0U)
  ------------------
   57|  1.52M|        uint32_t xpt_ypt = _TIFFMultiply32(tif, xpt, ypt, "TIFFComputeTile");
   58|  1.52M|        uint32_t xpt_ypt_zpt =
   59|  1.52M|            _TIFFMultiply32(tif, xpt_ypt, zpt, "TIFFComputeTile");
   60|  1.52M|        uint64_t z_offset;
   61|  1.52M|        uint64_t y_offset;
   62|  1.52M|        uint64_t tile64;
   63|       |
   64|  1.52M|        if ((xpt_ypt == 0 && xpt != 0 && ypt != 0) ||
  ------------------
  |  Branch (64:14): [True: 0, False: 1.52M]
  |  Branch (64:30): [True: 0, False: 0]
  |  Branch (64:42): [True: 0, False: 0]
  ------------------
   65|  1.52M|            (xpt_ypt_zpt == 0 && xpt_ypt != 0 && zpt != 0))
  ------------------
  |  Branch (65:14): [True: 0, False: 1.52M]
  |  Branch (65:34): [True: 0, False: 0]
  |  Branch (65:50): [True: 0, False: 0]
  ------------------
   66|      0|            return (0);
   67|       |
   68|  1.52M|        z_offset = _TIFFMultiply64(tif, xpt_ypt, z / dz, "TIFFComputeTile");
   69|  1.52M|        y_offset = _TIFFMultiply64(tif, xpt, y / dy, "TIFFComputeTile");
   70|  1.52M|        if ((z_offset == 0 && xpt_ypt != 0 && (z / dz) != 0) ||
  ------------------
  |  Branch (70:14): [True: 1.52M, False: 0]
  |  Branch (70:31): [True: 1.52M, False: 0]
  |  Branch (70:47): [True: 0, False: 1.52M]
  ------------------
   71|  1.52M|            (y_offset == 0 && xpt != 0 && (y / dy) != 0))
  ------------------
  |  Branch (71:14): [True: 774k, False: 753k]
  |  Branch (71:31): [True: 774k, False: 0]
  |  Branch (71:43): [True: 0, False: 774k]
  ------------------
   72|      0|            return (0);
   73|  1.52M|        tile64 = _TIFFAdd64(tif, z_offset, y_offset, "TIFFComputeTile");
   74|  1.52M|        if (tile64 == 0 && (z_offset != 0 || y_offset != 0))
  ------------------
  |  Branch (74:13): [True: 774k, False: 753k]
  |  Branch (74:29): [True: 0, False: 774k]
  |  Branch (74:46): [True: 0, False: 774k]
  ------------------
   75|      0|            return (0);
   76|  1.52M|        tile64 = _TIFFAdd64(tif, tile64, x / dx, "TIFFComputeTile");
   77|  1.52M|        if (tile64 == 0 && (z_offset != 0 || y_offset != 0 || (x / dx) != 0))
  ------------------
  |  Branch (77:13): [True: 3.48k, False: 1.52M]
  |  Branch (77:29): [True: 0, False: 3.48k]
  |  Branch (77:46): [True: 0, False: 3.48k]
  |  Branch (77:63): [True: 0, False: 3.48k]
  ------------------
   78|      0|            return (0);
   79|  1.52M|        if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  1.52M|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (79:13): [True: 873k, False: 654k]
  ------------------
   80|   873k|        {
   81|   873k|            uint64_t sample_offset;
   82|   873k|            if (s >= td->td_samplesperpixel)
  ------------------
  |  Branch (82:17): [True: 0, False: 873k]
  ------------------
   83|      0|            {
   84|      0|                TIFFErrorExtR(
   85|      0|                    tif, "TIFFComputeTile", "%lu: Sample out of range, max %lu",
   86|      0|                    (unsigned long)s, (unsigned long)td->td_samplesperpixel);
   87|      0|                return (0);
   88|      0|            }
   89|   873k|            sample_offset =
   90|   873k|                _TIFFMultiply64(tif, xpt_ypt_zpt, s, "TIFFComputeTile");
   91|   873k|            if (sample_offset == 0 && xpt_ypt_zpt != 0 && s != 0)
  ------------------
  |  Branch (91:17): [True: 279k, False: 594k]
  |  Branch (91:39): [True: 279k, False: 0]
  |  Branch (91:59): [True: 0, False: 279k]
  ------------------
   92|      0|                return (0);
   93|   873k|            tile64 = _TIFFAdd64(tif, sample_offset, tile64, "TIFFComputeTile");
   94|   873k|            if (tile64 == 0 && (sample_offset != 0 || z_offset != 0 ||
  ------------------
  |  Branch (94:17): [True: 625, False: 873k]
  |  Branch (94:33): [True: 0, False: 625]
  |  Branch (94:55): [True: 0, False: 625]
  ------------------
   95|    625|                                y_offset != 0 || (x / dx) != 0))
  ------------------
  |  Branch (95:33): [True: 0, False: 625]
  |  Branch (95:50): [True: 0, False: 625]
  ------------------
   96|      0|                return (0);
   97|   873k|        }
   98|  1.52M|        tile = _TIFFCastUInt64ToUInt32(tif, tile64, "TIFFComputeTile");
   99|  1.52M|        if (tile == 0 && tile64 != 0)
  ------------------
  |  Branch (99:13): [True: 2.43k, False: 1.52M]
  |  Branch (99:26): [True: 0, False: 2.43k]
  ------------------
  100|      0|            return (0);
  101|  1.52M|    }
  102|  1.52M|    return (tile);
  103|  1.52M|}
TIFFCheckTile:
  110|  1.52M|{
  111|  1.52M|    TIFFDirectory *td = &tif->tif_dir;
  112|       |
  113|  1.52M|    if (x >= td->td_imagewidth)
  ------------------
  |  Branch (113:9): [True: 0, False: 1.52M]
  ------------------
  114|      0|    {
  115|      0|        TIFFErrorExtR(tif, tif->tif_name, "%lu: Col out of range, max %lu",
  116|      0|                      (unsigned long)x, (unsigned long)(td->td_imagewidth - 1));
  117|      0|        return (0);
  118|      0|    }
  119|  1.52M|    if (y >= td->td_imagelength)
  ------------------
  |  Branch (119:9): [True: 0, False: 1.52M]
  ------------------
  120|      0|    {
  121|      0|        TIFFErrorExtR(tif, tif->tif_name, "%lu: Row out of range, max %lu",
  122|      0|                      (unsigned long)y,
  123|      0|                      (unsigned long)(td->td_imagelength - 1));
  124|      0|        return (0);
  125|      0|    }
  126|  1.52M|    if (z >= td->td_imagedepth)
  ------------------
  |  Branch (126:9): [True: 0, False: 1.52M]
  ------------------
  127|      0|    {
  128|      0|        TIFFErrorExtR(tif, tif->tif_name, "%lu: Depth out of range, max %lu",
  129|      0|                      (unsigned long)z, (unsigned long)(td->td_imagedepth - 1));
  130|      0|        return (0);
  131|      0|    }
  132|  1.52M|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE &&
  ------------------
  |  |  266|  3.05M|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (132:9): [True: 874k, False: 654k]
  ------------------
  133|   874k|        s >= td->td_samplesperpixel)
  ------------------
  |  Branch (133:9): [True: 366, False: 873k]
  ------------------
  134|    366|    {
  135|    366|        TIFFErrorExtR(tif, tif->tif_name, "%lu: Sample out of range, max %lu",
  136|    366|                      (unsigned long)s,
  137|    366|                      (unsigned long)(td->td_samplesperpixel - 1));
  138|    366|        return (0);
  139|    366|    }
  140|  1.52M|    return (1);
  141|  1.52M|}
TIFFNumberOfTiles:
  147|  2.59k|{
  148|  2.59k|    TIFFDirectory *td = &tif->tif_dir;
  149|  2.59k|    uint32_t dx = td->td_tilewidth;
  150|  2.59k|    uint32_t dy = td->td_tilelength;
  151|  2.59k|    uint32_t dz = td->td_tiledepth;
  152|  2.59k|    uint32_t ntiles;
  153|       |
  154|  2.59k|    if (dx == (uint32_t)-1)
  ------------------
  |  Branch (154:9): [True: 0, False: 2.59k]
  ------------------
  155|      0|        dx = td->td_imagewidth;
  156|  2.59k|    if (dy == (uint32_t)-1)
  ------------------
  |  Branch (156:9): [True: 0, False: 2.59k]
  ------------------
  157|      0|        dy = td->td_imagelength;
  158|  2.59k|    if (dz == (uint32_t)-1)
  ------------------
  |  Branch (158:9): [True: 3, False: 2.58k]
  ------------------
  159|      3|        dz = td->td_imagedepth;
  160|  2.59k|    ntiles =
  161|  2.59k|        (dx == 0 || dy == 0 || dz == 0)
  ------------------
  |  Branch (161:10): [True: 11, False: 2.57k]
  |  Branch (161:21): [True: 12, False: 2.56k]
  |  Branch (161:32): [True: 1, False: 2.56k]
  ------------------
  162|  2.59k|            ? 0
  163|  2.59k|            : _TIFFMultiply32(
  164|  2.56k|                  tif,
  165|  2.56k|                  _TIFFMultiply32(tif, TIFFhowmany_32(td->td_imagewidth, dx),
  ------------------
  |  |  312|  2.56k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 2.56k, False: 1]
  |  |  ------------------
  |  |  313|  2.56k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  2.56k|         : 0U)
  ------------------
  166|  2.56k|                                  TIFFhowmany_32(td->td_imagelength, dy),
  ------------------
  |  |  312|  2.56k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 2.56k, False: 0]
  |  |  ------------------
  |  |  313|  2.56k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  2.56k|         : 0U)
  ------------------
  167|  2.56k|                                  "TIFFNumberOfTiles"),
  168|  2.56k|                  TIFFhowmany_32(td->td_imagedepth, dz), "TIFFNumberOfTiles");
  ------------------
  |  |  312|  2.56k|    (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1)))                          \
  |  |  ------------------
  |  |  |  Branch (312:6): [True: 2.56k, False: 0]
  |  |  ------------------
  |  |  313|  2.56k|         ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y)))       \
  |  |  314|  2.56k|         : 0U)
  ------------------
  169|  2.59k|    if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
  ------------------
  |  |  266|  2.59k|#define PLANARCONFIG_SEPARATE 2            /* separate planes of data */
  ------------------
  |  Branch (169:9): [True: 656, False: 1.93k]
  ------------------
  170|    656|        ntiles = _TIFFMultiply32(tif, ntiles, td->td_samplesperpixel,
  171|    656|                                 "TIFFNumberOfTiles");
  172|  2.59k|    return (ntiles);
  173|  2.59k|}
TIFFTileRowSize64:
  179|  1.20M|{
  180|  1.20M|    static const char module[] = "TIFFTileRowSize64";
  181|  1.20M|    TIFFDirectory *td = &tif->tif_dir;
  182|  1.20M|    uint64_t rowsize;
  183|  1.20M|    uint64_t tilerowsize;
  184|       |
  185|  1.20M|    if (td->td_tilelength == 0)
  ------------------
  |  Branch (185:9): [True: 0, False: 1.20M]
  ------------------
  186|      0|    {
  187|      0|        TIFFErrorExtR(tif, module, "Tile length is zero");
  188|      0|        return 0;
  189|      0|    }
  190|  1.20M|    if (td->td_tilewidth == 0)
  ------------------
  |  Branch (190:9): [True: 0, False: 1.20M]
  ------------------
  191|      0|    {
  192|      0|        TIFFErrorExtR(tif, module, "Tile width is zero");
  193|      0|        return (0);
  194|      0|    }
  195|  1.20M|    rowsize = _TIFFMultiply64(tif, td->td_bitspersample, td->td_tilewidth,
  196|  1.20M|                              "TIFFTileRowSize");
  197|  1.20M|    if (td->td_planarconfig == PLANARCONFIG_CONTIG)
  ------------------
  |  |  265|  1.20M|#define PLANARCONFIG_CONTIG 1              /* single image plane */
  ------------------
  |  Branch (197:9): [True: 913k, False: 289k]
  ------------------
  198|   913k|    {
  199|   913k|        if (td->td_samplesperpixel == 0)
  ------------------
  |  Branch (199:13): [True: 0, False: 913k]
  ------------------
  200|      0|        {
  201|      0|            TIFFErrorExtR(tif, module, "Samples per pixel is zero");
  202|      0|            return 0;
  203|      0|        }
  204|   913k|        rowsize = _TIFFMultiply64(tif, rowsize, td->td_samplesperpixel,
  205|   913k|                                  "TIFFTileRowSize");
  206|   913k|    }
  207|  1.20M|    tilerowsize = TIFFhowmany8_64(rowsize);
  ------------------
  |  |  326|  1.20M|    (((x) & 0x07) ? ((uint64_t)(x) >> 3) + 1 : (uint64_t)(x) >> 3)
  |  |  ------------------
  |  |  |  Branch (326:6): [True: 104k, False: 1.09M]
  |  |  ------------------
  ------------------
  208|  1.20M|    if (tilerowsize == 0)
  ------------------
  |  Branch (208:9): [True: 0, False: 1.20M]
  ------------------
  209|      0|    {
  210|      0|        TIFFErrorExtR(tif, module, "Computed tile row size is zero");
  211|      0|        return 0;
  212|      0|    }
  213|  1.20M|    return (tilerowsize);
  214|  1.20M|}
TIFFTileRowSize:
  216|   975k|{
  217|   975k|    static const char module[] = "TIFFTileRowSize";
  218|   975k|    uint64_t m;
  219|   975k|    m = TIFFTileRowSize64(tif);
  220|   975k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  221|   975k|}
TIFFVTileSize64:
  227|   231k|{
  228|   231k|    return _TIFFStrileSize64(tif, nrows, /* isStrip = */ FALSE);
  ------------------
  |  |   72|   231k|#define FALSE 0
  ------------------
  229|   231k|}
TIFFTileSize64:
  243|   231k|{
  244|   231k|    return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength));
  245|   231k|}
TIFFTileSize:
  247|   223k|{
  248|   223k|    static const char module[] = "TIFFTileSize";
  249|   223k|    uint64_t m;
  250|   223k|    m = TIFFTileSize64(tif);
  251|   223k|    return _TIFFCastUInt64ToSSize(tif, m, module);
  252|   223k|}

_TIFFmalloc:
  335|  2.03M|{
  336|  2.03M|    if (s == 0)
  ------------------
  |  Branch (336:9): [True: 0, False: 2.03M]
  ------------------
  337|      0|        return ((void *)NULL);
  338|       |
  339|  2.03M|    return (malloc((size_t)s));
  340|  2.03M|}
_TIFFcalloc:
  343|  1.46k|{
  344|  1.46k|    if (nmemb == 0 || siz == 0)
  ------------------
  |  Branch (344:9): [True: 0, False: 1.46k]
  |  Branch (344:23): [True: 0, False: 1.46k]
  ------------------
  345|      0|        return ((void *)NULL);
  346|       |
  347|  1.46k|    return calloc((size_t)nmemb, (size_t)siz);
  348|  1.46k|}
_TIFFfree:
  350|  2.11M|void _TIFFfree(void *p) { free(p); }
_TIFFrealloc:
  352|   208k|void *_TIFFrealloc(void *p, tmsize_t s) { return (realloc(p, (size_t)s)); }
_TIFFmemset:
  354|   397k|void _TIFFmemset(void *p, int v, tmsize_t c) { memset(p, v, (size_t)c); }
_TIFFmemcpy:
  357|   267k|{
  358|   267k|    memcpy(d, s, (size_t)c);
  359|   267k|}

TIFFSetWarningHandler:
   33|  5.98k|{
   34|  5.98k|    TIFFErrorHandler prev = _TIFFwarningHandler;
   35|  5.98k|    _TIFFwarningHandler = handler;
   36|  5.98k|    return (prev);
   37|  5.98k|}
TIFFWarningExtR:
   81|  1.21M|{
   82|  1.21M|    va_list ap;
   83|  1.21M|    if (tif && tif->tif_warnhandler)
  ------------------
  |  Branch (83:9): [True: 1.21M, False: 0]
  |  Branch (83:16): [True: 0, False: 1.21M]
  ------------------
   84|      0|    {
   85|      0|        va_start(ap, fmt);
   86|      0|        int stop = (*tif->tif_warnhandler)(tif, tif->tif_warnhandler_user_data,
   87|      0|                                           module, fmt, ap);
   88|      0|        va_end(ap);
   89|      0|        if (stop)
  ------------------
  |  Branch (89:13): [True: 0, False: 0]
  ------------------
   90|      0|            return;
   91|      0|    }
   92|  1.21M|    if (_TIFFwarningHandler)
  ------------------
  |  Branch (92:9): [True: 1.21M, False: 0]
  ------------------
   93|  1.21M|    {
   94|  1.21M|        va_start(ap, fmt);
   95|  1.21M|        (*_TIFFwarningHandler)(module, fmt, ap);
   96|  1.21M|        va_end(ap);
   97|  1.21M|    }
   98|  1.21M|    if (_TIFFwarningHandlerExt)
  ------------------
  |  Branch (98:9): [True: 0, False: 1.21M]
  ------------------
   99|      0|    {
  100|      0|        va_start(ap, fmt);
  101|      0|        (*_TIFFwarningHandlerExt)(tif ? tif->tif_clientdata : 0, module, fmt,
  ------------------
  |  Branch (101:35): [True: 0, False: 0]
  ------------------
  102|      0|                                  ap);
  103|       |        va_end(ap);
  104|      0|    }
  105|  1.21M|}

TIFFInitZIP:
  711|    240|{
  712|    240|    static const char module[] = "TIFFInitZIP";
  713|    240|    ZIPState *sp;
  714|       |
  715|    240|    assert((scheme == COMPRESSION_DEFLATE) ||
  ------------------
  |  Branch (715:5): [True: 240, False: 0]
  |  Branch (715:5): [True: 0, False: 0]
  |  Branch (715:5): [True: 3, False: 237]
  |  Branch (715:5): [True: 237, False: 0]
  ------------------
  716|    240|           (scheme == COMPRESSION_ADOBE_DEFLATE));
  717|       |#ifdef NDEBUG
  718|       |    (void)scheme;
  719|       |#endif
  720|       |
  721|       |    /*
  722|       |     * Merge codec-specific tag information.
  723|       |     */
  724|    240|    if (!_TIFFMergeFields(tif, zipFields, TIFFArrayCount(zipFields)))
  ------------------
  |  |  339|    240|#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
  ------------------
  |  Branch (724:9): [True: 0, False: 240]
  ------------------
  725|      0|    {
  726|      0|        TIFFErrorExtR(tif, module,
  727|      0|                      "Merging Deflate codec-specific tags failed");
  728|      0|        return 0;
  729|      0|    }
  730|       |
  731|       |    /*
  732|       |     * Allocate state block so tag methods have storage to record values.
  733|       |     */
  734|    240|    tif->tif_data = (uint8_t *)_TIFFcallocExt(tif, sizeof(ZIPState), 1);
  735|    240|    if (tif->tif_data == NULL)
  ------------------
  |  Branch (735:9): [True: 0, False: 240]
  ------------------
  736|      0|        goto bad;
  737|    240|    sp = GetZIPState(tif);
  ------------------
  |  |   88|    240|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  738|    240|    sp->stream.zalloc = TIFF_zalloc;
  739|    240|    sp->stream.zfree = TIFF_zfree;
  740|    240|    sp->stream.opaque = tif;
  741|    240|    sp->stream.data_type = Z_BINARY;
  742|       |
  743|       |    /*
  744|       |     * Override parent get/set field methods.
  745|       |     */
  746|    240|    sp->vgetparent = tif->tif_tagmethods.vgetfield;
  747|    240|    tif->tif_tagmethods.vgetfield = ZIPVGetField; /* hook for codec tags */
  748|    240|    sp->vsetparent = tif->tif_tagmethods.vsetfield;
  749|    240|    tif->tif_tagmethods.vsetfield = ZIPVSetField; /* hook for codec tags */
  750|       |
  751|       |    /* Default values for codec-specific fields */
  752|    240|    sp->zipquality = Z_DEFAULT_COMPRESSION; /* default comp. level */
  753|    240|    sp->state = 0;
  754|       |#if LIBDEFLATE_SUPPORT
  755|       |    sp->subcodec = DEFLATE_SUBCODEC_LIBDEFLATE;
  756|       |#else
  757|    240|    sp->subcodec = DEFLATE_SUBCODEC_ZLIB;
  ------------------
  |  |  767|    240|#define DEFLATE_SUBCODEC_ZLIB 0
  ------------------
  758|    240|#endif
  759|       |
  760|       |    /*
  761|       |     * Install codec methods.
  762|       |     */
  763|    240|    tif->tif_fixuptags = ZIPFixupTags;
  764|    240|    tif->tif_setupdecode = ZIPSetupDecode;
  765|    240|    tif->tif_predecode = ZIPPreDecode;
  766|    240|    tif->tif_decoderow = ZIPDecode;
  767|    240|    tif->tif_decodestrip = ZIPDecode;
  768|    240|    tif->tif_decodetile = ZIPDecode;
  769|    240|    tif->tif_setupencode = ZIPSetupEncode;
  770|    240|    tif->tif_preencode = ZIPPreEncode;
  771|    240|    tif->tif_postencode = ZIPPostEncode;
  772|    240|    tif->tif_encoderow = ZIPEncode;
  773|    240|    tif->tif_encodestrip = ZIPEncode;
  774|    240|    tif->tif_encodetile = ZIPEncode;
  775|    240|    tif->tif_cleanup = ZIPCleanup;
  776|    240|    tif->tif_getmaxcompressionratio = ZIPGetMaxCompressionRatio;
  777|       |    /*
  778|       |     * Setup predictor setup.
  779|       |     */
  780|    240|    (void)TIFFPredictorInit(tif);
  781|    240|    return (1);
  782|      0|bad:
  783|      0|    TIFFErrorExtR(tif, module, "No space for ZIP state block");
  784|      0|    return (0);
  785|    240|}
tif_zip.c:TIFF_zalloc:
  685|    373|{
  686|    373|    static const char module[] = "TIFF_zalloc";
  687|    373|    TIFF *tif = (TIFF *)opaque;
  688|       |
  689|    373|    if (items > ~(size_t)0 / size)
  ------------------
  |  Branch (689:9): [True: 0, False: 373]
  ------------------
  690|      0|    {
  691|      0|        TIFFErrorExtR(tif, module, "Overflow");
  692|      0|        return NULL;
  693|      0|    }
  694|       |
  695|    373|    return _TIFFmallocExt(tif, items * size);
  696|    373|}
tif_zip.c:TIFF_zfree:
  699|    373|{
  700|    373|    _TIFFfreeExt((TIFF *)opaque, ptr);
  701|    373|}
tif_zip.c:ZIPVGetField:
  658|  2.82k|{
  659|  2.82k|    ZIPState *sp = GetZIPState(tif);
  ------------------
  |  |   88|  2.82k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  660|       |
  661|  2.82k|    switch (tag)
  662|  2.82k|    {
  663|      0|        case TIFFTAG_ZIPQUALITY:
  ------------------
  |  |  739|      0|#define TIFFTAG_ZIPQUALITY 65557      /* compression quality level */
  ------------------
  |  Branch (663:9): [True: 0, False: 2.82k]
  ------------------
  664|      0|            *va_arg(ap, int *) = sp->zipquality;
  665|      0|            break;
  666|       |
  667|      0|        case TIFFTAG_DEFLATE_SUBCODEC:
  ------------------
  |  |  766|      0|#define TIFFTAG_DEFLATE_SUBCODEC 65570 /* ZIP codec: to get/set the sub-codec to use. Will default to libdeflate when available */
  ------------------
  |  Branch (667:9): [True: 0, False: 2.82k]
  ------------------
  668|      0|            *va_arg(ap, int *) = sp->subcodec;
  669|      0|            break;
  670|       |
  671|  2.82k|        default:
  ------------------
  |  Branch (671:9): [True: 2.82k, False: 0]
  ------------------
  672|  2.82k|            return (*sp->vgetparent)(tif, tag, ap);
  673|  2.82k|    }
  674|      0|    return (1);
  675|  2.82k|}
tif_zip.c:ZIPVSetField:
  591|  2.32k|{
  592|  2.32k|    static const char module[] = "ZIPVSetField";
  593|  2.32k|    ZIPState *sp = GetZIPState(tif);
  ------------------
  |  |   88|  2.32k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  594|       |
  595|  2.32k|    switch (tag)
  596|  2.32k|    {
  597|      0|        case TIFFTAG_ZIPQUALITY:
  ------------------
  |  |  739|      0|#define TIFFTAG_ZIPQUALITY 65557      /* compression quality level */
  ------------------
  |  Branch (597:9): [True: 0, False: 2.32k]
  ------------------
  598|      0|            sp->zipquality = (int)va_arg(ap, int);
  599|      0|            if (sp->zipquality < Z_DEFAULT_COMPRESSION ||
  ------------------
  |  Branch (599:17): [True: 0, False: 0]
  ------------------
  600|      0|                sp->zipquality > LIBDEFLATE_MAX_COMPRESSION_LEVEL)
  ------------------
  |  |   46|      0|#define LIBDEFLATE_MAX_COMPRESSION_LEVEL 12
  ------------------
  |  Branch (600:17): [True: 0, False: 0]
  ------------------
  601|      0|            {
  602|      0|                TIFFErrorExtR(
  603|      0|                    tif, module,
  604|      0|                    "Invalid ZipQuality value. Should be in [-1,%d] range",
  605|      0|                    LIBDEFLATE_MAX_COMPRESSION_LEVEL);
  ------------------
  |  |   46|      0|#define LIBDEFLATE_MAX_COMPRESSION_LEVEL 12
  ------------------
  606|      0|                return 0;
  607|      0|            }
  608|       |
  609|      0|            if (sp->state & ZSTATE_INIT_ENCODE)
  ------------------
  |  |   82|      0|#define ZSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (609:17): [True: 0, False: 0]
  ------------------
  610|      0|            {
  611|      0|                int cappedQuality = sp->zipquality;
  612|      0|                if (cappedQuality > Z_BEST_COMPRESSION)
  ------------------
  |  Branch (612:21): [True: 0, False: 0]
  ------------------
  613|      0|                    cappedQuality = Z_BEST_COMPRESSION;
  614|      0|                if (deflateParams(&sp->stream, cappedQuality,
  ------------------
  |  Branch (614:21): [True: 0, False: 0]
  ------------------
  615|      0|                                  Z_DEFAULT_STRATEGY) != Z_OK)
  616|      0|                {
  617|      0|                    TIFFErrorExtR(tif, module, "ZLib error: %s", SAFE_MSG(sp));
  ------------------
  |  |   60|      0|#define SAFE_MSG(sp) ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  618|      0|                    return (0);
  619|      0|                }
  620|      0|            }
  621|       |
  622|       |#if LIBDEFLATE_SUPPORT
  623|       |            if (sp->libdeflate_enc)
  624|       |            {
  625|       |                libdeflate_free_compressor(sp->libdeflate_enc);
  626|       |                sp->libdeflate_enc = NULL;
  627|       |            }
  628|       |#endif
  629|       |
  630|      0|            return (1);
  631|       |
  632|      0|        case TIFFTAG_DEFLATE_SUBCODEC:
  ------------------
  |  |  766|      0|#define TIFFTAG_DEFLATE_SUBCODEC 65570 /* ZIP codec: to get/set the sub-codec to use. Will default to libdeflate when available */
  ------------------
  |  Branch (632:9): [True: 0, False: 2.32k]
  ------------------
  633|      0|            sp->subcodec = (int)va_arg(ap, int);
  634|      0|            if (sp->subcodec != DEFLATE_SUBCODEC_ZLIB &&
  ------------------
  |  |  767|      0|#define DEFLATE_SUBCODEC_ZLIB 0
  ------------------
  |  Branch (634:17): [True: 0, False: 0]
  ------------------
  635|      0|                sp->subcodec != DEFLATE_SUBCODEC_LIBDEFLATE)
  ------------------
  |  |  768|      0|#define DEFLATE_SUBCODEC_LIBDEFLATE 1
  ------------------
  |  Branch (635:17): [True: 0, False: 0]
  ------------------
  636|      0|            {
  637|      0|                TIFFErrorExtR(tif, module, "Invalid DeflateCodec value.");
  638|      0|                return 0;
  639|      0|            }
  640|      0|#if !LIBDEFLATE_SUPPORT
  641|      0|            if (sp->subcodec == DEFLATE_SUBCODEC_LIBDEFLATE)
  ------------------
  |  |  768|      0|#define DEFLATE_SUBCODEC_LIBDEFLATE 1
  ------------------
  |  Branch (641:17): [True: 0, False: 0]
  ------------------
  642|      0|            {
  643|      0|                TIFFErrorExtR(tif, module,
  644|      0|                              "DeflateCodec = DEFLATE_SUBCODEC_LIBDEFLATE "
  645|      0|                              "unsupported in this build");
  646|      0|                return 0;
  647|      0|            }
  648|      0|#endif
  649|      0|            return 1;
  650|       |
  651|  2.32k|        default:
  ------------------
  |  Branch (651:9): [True: 2.32k, False: 0]
  ------------------
  652|  2.32k|            return (*sp->vsetparent)(tif, tag, ap);
  653|  2.32k|    }
  654|       |    /*NOTREACHED*/
  655|  2.32k|}
tif_zip.c:ZIPFixupTags:
   96|    227|{
   97|    227|    (void)tif;
   98|    227|    return (1);
   99|    227|}
tif_zip.c:ZIPSetupDecode:
  102|    221|{
  103|    221|    static const char module[] = "ZIPSetupDecode";
  104|    221|    ZIPState *sp = ZIPDecoderState(tif);
  ------------------
  |  |   89|    221|#define ZIPDecoderState(tif) GetZIPState(tif)
  |  |  ------------------
  |  |  |  |   88|    221|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  105|       |
  106|    221|    assert(sp != NULL);
  ------------------
  |  Branch (106:5): [True: 0, False: 221]
  |  Branch (106:5): [True: 221, False: 0]
  ------------------
  107|       |
  108|       |    /* if we were last encoding, terminate this mode */
  109|    221|    if (sp->state & ZSTATE_INIT_ENCODE)
  ------------------
  |  |   82|    221|#define ZSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (109:9): [True: 0, False: 221]
  ------------------
  110|      0|    {
  111|      0|        deflateEnd(&sp->stream);
  112|      0|        sp->state = 0;
  113|      0|    }
  114|       |
  115|       |    /* This function can possibly be called several times by */
  116|       |    /* PredictorSetupDecode() if this function succeeds but */
  117|       |    /* PredictorSetup() fails */
  118|    221|    if ((sp->state & ZSTATE_INIT_DECODE) == 0 &&
  ------------------
  |  |   81|    221|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (118:9): [True: 221, False: 0]
  ------------------
  119|    221|        inflateInit(&sp->stream) != Z_OK)
  ------------------
  |  Branch (119:9): [True: 0, False: 221]
  ------------------
  120|      0|    {
  121|      0|        TIFFErrorExtR(tif, module, "%s", SAFE_MSG(sp));
  ------------------
  |  |   60|      0|#define SAFE_MSG(sp) ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  122|      0|        return (0);
  123|      0|    }
  124|    221|    else
  125|    221|    {
  126|    221|        sp->state |= ZSTATE_INIT_DECODE;
  ------------------
  |  |   81|    221|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  127|    221|        return (1);
  128|    221|    }
  129|    221|}
tif_zip.c:ZIPPreDecode:
  145|  17.0k|{
  146|  17.0k|    ZIPState *sp = ZIPDecoderState(tif);
  ------------------
  |  |   89|  17.0k|#define ZIPDecoderState(tif) GetZIPState(tif)
  |  |  ------------------
  |  |  |  |   88|  17.0k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  147|       |
  148|  17.0k|    (void)s;
  149|  17.0k|    assert(sp != NULL);
  ------------------
  |  Branch (149:5): [True: 0, False: 17.0k]
  |  Branch (149:5): [True: 17.0k, False: 0]
  ------------------
  150|       |
  151|  17.0k|    if ((sp->state & ZSTATE_INIT_DECODE) == 0)
  ------------------
  |  |   81|  17.0k|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (151:9): [True: 0, False: 17.0k]
  ------------------
  152|      0|        tif->tif_setupdecode(tif);
  153|       |
  154|       |#if LIBDEFLATE_SUPPORT
  155|       |    sp->libdeflate_state = -1;
  156|       |#endif
  157|  17.0k|    sp->stream.next_in = tif->tif_rawdata;
  158|  17.0k|    assert(sizeof(sp->stream.avail_in) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (158:5): [True: 0, Folded]
  |  Branch (158:5): [True: 17.0k, Folded]
  ------------------
  159|       |         we need to simplify this code to reflect a ZLib that is likely updated
  160|       |         to deal with 8byte memory sizes, though this code will respond
  161|       |         appropriately even before we simplify it */
  162|  17.0k|    sp->stream.avail_in =
  163|  17.0k|        TIFF_CLAMP_UINT64_TO_INT32_MAX((uint64_t)tif->tif_rawcc);
  164|  17.0k|    if (inflateReset(&sp->stream) == Z_OK)
  ------------------
  |  Branch (164:9): [True: 17.0k, False: 0]
  ------------------
  165|  17.0k|    {
  166|  17.0k|        sp->read_error = 0;
  167|  17.0k|        return 1;
  168|  17.0k|    }
  169|      0|    return 0;
  170|  17.0k|}
tif_zip.c:TIFF_CLAMP_UINT64_TO_INT32_MAX:
  137|   241k|{
  138|       |    return (uInt)TIFF_MIN_UINT64(v, INT32_MAX);
  139|   241k|}
tif_zip.c:TIFF_MIN_UINT64:
  132|   241k|{
  133|   241k|    return a < b ? a : b;
  ------------------
  |  Branch (133:12): [True: 241k, False: 0]
  ------------------
  134|   241k|}
tif_zip.c:ZIPDecode:
  173|   109k|{
  174|   109k|    static const char module[] = "ZIPDecode";
  175|   109k|    ZIPState *sp = ZIPDecoderState(tif);
  ------------------
  |  |   89|   109k|#define ZIPDecoderState(tif) GetZIPState(tif)
  |  |  ------------------
  |  |  |  |   88|   109k|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  |  |  ------------------
  ------------------
  176|       |
  177|   109k|    (void)s;
  178|   109k|    assert(sp != NULL);
  ------------------
  |  Branch (178:5): [True: 0, False: 109k]
  |  Branch (178:5): [True: 109k, False: 0]
  ------------------
  179|   109k|    assert(sp->state == ZSTATE_INIT_DECODE);
  ------------------
  |  Branch (179:5): [True: 0, False: 109k]
  |  Branch (179:5): [True: 109k, False: 0]
  ------------------
  180|       |
  181|   109k|    if (sp->read_error)
  ------------------
  |  Branch (181:9): [True: 2, False: 109k]
  ------------------
  182|      2|    {
  183|      2|        memset(op, 0, (size_t)occ);
  184|      2|        TIFFErrorExtR(tif, module,
  185|      2|                      "ZIPDecode: Scanline %" PRIu32 " cannot be read due to "
  186|      2|                      "previous error",
  187|      2|                      tif->tif_dir.td_row);
  188|      2|        return 0;
  189|      2|    }
  190|       |
  191|       |#if LIBDEFLATE_SUPPORT
  192|       |    if (sp->libdeflate_state == 1)
  193|       |        return 0;
  194|       |
  195|       |    /* If we have libdeflate support and we are asked to read a whole */
  196|       |    /* strip/tile, then go for using it */
  197|       |    do
  198|       |    {
  199|       |        TIFFDirectory *td = &tif->tif_dir;
  200|       |
  201|       |        if (sp->libdeflate_state == 0)
  202|       |            break;
  203|       |        if (sp->subcodec == DEFLATE_SUBCODEC_ZLIB)
  204|       |            break;
  205|       |
  206|       |        /* Check if we are in the situation where we can use libdeflate */
  207|       |        if (isTiled(tif))
  208|       |        {
  209|       |            if (TIFFTileSize64(tif) != (uint64_t)occ)
  210|       |                break;
  211|       |        }
  212|       |        else
  213|       |        {
  214|       |            uint32_t strip_height = td->td_imagelength - tif->tif_dir.td_row;
  215|       |            if (strip_height > td->td_rowsperstrip)
  216|       |                strip_height = td->td_rowsperstrip;
  217|       |            if (TIFFVStripSize64(tif, strip_height) != (uint64_t)occ)
  218|       |                break;
  219|       |        }
  220|       |
  221|       |        /* Check for overflow */
  222|       |        if ((size_t)tif->tif_rawcc != (uint64_t)tif->tif_rawcc)
  223|       |            break;
  224|       |        if ((size_t)occ != (uint64_t)occ)
  225|       |            break;
  226|       |
  227|       |        /* Go for decompression using libdeflate */
  228|       |        {
  229|       |            enum libdeflate_result res;
  230|       |            if (sp->libdeflate_dec == NULL)
  231|       |            {
  232|       |                sp->libdeflate_dec = libdeflate_alloc_decompressor();
  233|       |                if (sp->libdeflate_dec == NULL)
  234|       |                {
  235|       |                    break;
  236|       |                }
  237|       |            }
  238|       |
  239|       |            sp->libdeflate_state = 1;
  240|       |
  241|       |            res = libdeflate_zlib_decompress(sp->libdeflate_dec, tif->tif_rawcp,
  242|       |                                             (size_t)tif->tif_rawcc, op,
  243|       |                                             (size_t)occ, NULL);
  244|       |
  245|       |            tif->tif_rawcp += tif->tif_rawcc;
  246|       |            tif->tif_rawcc = 0;
  247|       |
  248|       |            /* We accept LIBDEFLATE_INSUFFICIENT_SPACE has a return */
  249|       |            /* There are odd files in the wild where the last strip, when */
  250|       |            /* it is smaller in height than td_rowsperstrip, actually contains
  251|       |             */
  252|       |            /* data for td_rowsperstrip lines. Just ignore that silently. */
  253|       |            if (res != LIBDEFLATE_SUCCESS &&
  254|       |                res != LIBDEFLATE_INSUFFICIENT_SPACE)
  255|       |            {
  256|       |                memset(op, 0, (size_t)occ);
  257|       |                TIFFErrorExtR(tif, module, "Decoding error at scanline %lu",
  258|       |                              (unsigned long)tif->tif_dir.td_row);
  259|       |                sp->read_error = 1;
  260|       |                return 0;
  261|       |            }
  262|       |
  263|       |            return 1;
  264|       |        }
  265|       |    } while (0);
  266|       |    sp->libdeflate_state = 0;
  267|       |#endif /* LIBDEFLATE_SUPPORT */
  268|       |
  269|   109k|    sp->stream.next_in = tif->tif_rawcp;
  270|       |
  271|   109k|    sp->stream.next_out = op;
  272|   109k|    assert(sizeof(sp->stream.avail_out) == 4); /* if this assert gets raised,
  ------------------
  |  Branch (272:5): [True: 0, Folded]
  |  Branch (272:5): [True: 109k, Folded]
  ------------------
  273|       |         we need to simplify this code to reflect a ZLib that is likely updated
  274|       |         to deal with 8byte memory sizes, though this code will respond
  275|       |         appropriately even before we simplify it */
  276|   109k|    do
  277|   112k|    {
  278|   112k|        int state;
  279|   112k|        uInt avail_in_before =
  280|   112k|            TIFF_CLAMP_UINT64_TO_INT32_MAX((uint64_t)tif->tif_rawcc);
  281|   112k|        uInt avail_out_before = TIFF_CLAMP_UINT64_TO_INT32_MAX((uint64_t)occ);
  282|   112k|        sp->stream.avail_in = avail_in_before;
  283|   112k|        sp->stream.avail_out = avail_out_before;
  284|   112k|        state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
  285|   112k|        tif->tif_rawcc -= (avail_in_before - sp->stream.avail_in);
  286|   112k|        occ -= (avail_out_before - sp->stream.avail_out);
  287|   112k|        if (state == Z_STREAM_END)
  ------------------
  |  Branch (287:13): [True: 186, False: 112k]
  ------------------
  288|    186|            break;
  289|   112k|        if (state == Z_DATA_ERROR)
  ------------------
  |  Branch (289:13): [True: 8.14k, False: 104k]
  ------------------
  290|  8.14k|        {
  291|  8.14k|            memset(sp->stream.next_out, 0, (size_t)occ);
  292|  8.14k|            TIFFErrorExtR(tif, module, "Decoding error at scanline %lu, %s",
  293|  8.14k|                          (unsigned long)tif->tif_dir.td_row, SAFE_MSG(sp));
  ------------------
  |  |   60|  8.14k|#define SAFE_MSG(sp) ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 0, False: 8.14k]
  |  |  ------------------
  ------------------
  294|  8.14k|            sp->read_error = 1;
  295|  8.14k|            return (0);
  296|  8.14k|        }
  297|   104k|        if (state != Z_OK)
  ------------------
  |  Branch (297:13): [True: 3.35k, False: 100k]
  ------------------
  298|  3.35k|        {
  299|  3.35k|            memset(sp->stream.next_out, 0, (size_t)occ);
  300|  3.35k|            TIFFErrorExtR(tif, module, "ZLib error: %s", SAFE_MSG(sp));
  ------------------
  |  |   60|  3.35k|#define SAFE_MSG(sp) ((sp)->stream.msg == NULL ? "" : (sp)->stream.msg)
  |  |  ------------------
  |  |  |  Branch (60:23): [True: 3.35k, False: 0]
  |  |  ------------------
  ------------------
  301|  3.35k|            sp->read_error = 1;
  302|  3.35k|            return (0);
  303|  3.35k|        }
  304|   104k|    } while (occ > 0);
  ------------------
  |  Branch (304:14): [True: 3.32k, False: 97.3k]
  ------------------
  305|  97.5k|    if (occ != 0)
  ------------------
  |  Branch (305:9): [True: 186, False: 97.3k]
  ------------------
  306|    186|    {
  307|    186|        TIFFErrorExtR(tif, module,
  308|    186|                      "Not enough data at scanline %lu (short %" PRIu64
  309|    186|                      " bytes)",
  310|    186|                      (unsigned long)tif->tif_dir.td_row, (uint64_t)occ);
  311|    186|        memset(sp->stream.next_out, 0, (size_t)occ);
  312|    186|        sp->read_error = 1;
  313|    186|        return (0);
  314|    186|    }
  315|       |
  316|  97.3k|    tif->tif_rawcp = sp->stream.next_in;
  317|       |
  318|  97.3k|    return (1);
  319|  97.5k|}
tif_zip.c:ZIPCleanup:
  556|    240|{
  557|    240|    ZIPState *sp = GetZIPState(tif);
  ------------------
  |  |   88|    240|#define GetZIPState(tif) ((ZIPState *)(tif)->tif_data)
  ------------------
  558|       |
  559|    240|    assert(sp != 0);
  ------------------
  |  Branch (559:5): [True: 0, False: 240]
  |  Branch (559:5): [True: 240, False: 0]
  ------------------
  560|       |
  561|    240|    (void)TIFFPredictorCleanup(tif);
  562|       |
  563|    240|    tif->tif_tagmethods.vgetfield = sp->vgetparent;
  564|    240|    tif->tif_tagmethods.vsetfield = sp->vsetparent;
  565|       |
  566|    240|    if (sp->state & ZSTATE_INIT_ENCODE)
  ------------------
  |  |   82|    240|#define ZSTATE_INIT_ENCODE 0x02
  ------------------
  |  Branch (566:9): [True: 0, False: 240]
  ------------------
  567|      0|    {
  568|      0|        deflateEnd(&sp->stream);
  569|      0|        sp->state = 0;
  570|      0|    }
  571|    240|    else if (sp->state & ZSTATE_INIT_DECODE)
  ------------------
  |  |   81|    240|#define ZSTATE_INIT_DECODE 0x01
  ------------------
  |  Branch (571:14): [True: 221, False: 19]
  ------------------
  572|    221|    {
  573|    221|        inflateEnd(&sp->stream);
  574|    221|        sp->state = 0;
  575|    221|    }
  576|       |
  577|       |#if LIBDEFLATE_SUPPORT
  578|       |    if (sp->libdeflate_dec)
  579|       |        libdeflate_free_decompressor(sp->libdeflate_dec);
  580|       |    if (sp->libdeflate_enc)
  581|       |        libdeflate_free_compressor(sp->libdeflate_enc);
  582|       |#endif
  583|       |
  584|    240|    _TIFFfreeExt(tif, sp);
  585|    240|    tif->tif_data = NULL;
  586|       |
  587|    240|    _TIFFSetDefaultCompressionState(tif);
  588|    240|}
tif_zip.c:ZIPGetMaxCompressionRatio:
  704|     14|{
  705|     14|    (void)tif;
  706|       |    /* cf https://zlib.net/zlib_tech.html */
  707|     14|    return 1032;
  708|     14|}

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

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

inflateResetKeep:
  100|  27.5k|int ZEXPORT inflateResetKeep(z_streamp strm) {
  101|  27.5k|    struct inflate_state FAR *state;
  102|       |
  103|  27.5k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (103:9): [True: 0, False: 27.5k]
  ------------------
  104|  27.5k|    state = (struct inflate_state FAR *)strm->state;
  105|  27.5k|    strm->total_in = strm->total_out = state->total = 0;
  106|  27.5k|    strm->msg = Z_NULL;
  ------------------
  |  |  216|  27.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  107|  27.5k|    strm->data_type = 0;
  108|  27.5k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (108:9): [True: 27.5k, False: 0]
  ------------------
  109|  27.5k|        strm->adler = state->wrap & 1;
  110|  27.5k|    state->mode = HEAD;
  111|  27.5k|    state->last = 0;
  112|  27.5k|    state->havedict = 0;
  113|  27.5k|    state->flags = -1;
  114|  27.5k|    state->dmax = 32768U;
  115|  27.5k|    state->head = Z_NULL;
  ------------------
  |  |  216|  27.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  116|  27.5k|    state->hold = 0;
  117|  27.5k|    state->bits = 0;
  118|  27.5k|    state->lencode = state->distcode = state->next = state->codes;
  119|  27.5k|    state->sane = 1;
  120|  27.5k|    state->back = -1;
  121|  27.5k|    Tracev((stderr, "inflate: reset\n"));
  122|  27.5k|    return Z_OK;
  ------------------
  |  |  181|  27.5k|#define Z_OK            0
  ------------------
  123|  27.5k|}
inflateReset:
  125|  27.5k|int ZEXPORT inflateReset(z_streamp strm) {
  126|  27.5k|    struct inflate_state FAR *state;
  127|       |
  128|  27.5k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (128:9): [True: 0, False: 27.5k]
  ------------------
  129|  27.5k|    state = (struct inflate_state FAR *)strm->state;
  130|  27.5k|    if (state->wbits != state->reqbits) {
  ------------------
  |  Branch (130:9): [True: 0, False: 27.5k]
  ------------------
  131|      0|        if (state->window != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (131:13): [True: 0, False: 0]
  ------------------
  132|      0|            ZFREE(strm, state->window);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  133|      0|            state->window = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  134|      0|        }
  135|      0|        state->wbits = state->reqbits;
  136|      0|    }
  137|  27.5k|    state->wrap = state->reqwrap;
  138|  27.5k|    state->wsize = 0;
  139|  27.5k|    state->whave = 0;
  140|  27.5k|    state->wnext = 0;
  141|  27.5k|    return inflateResetKeep(strm);
  142|  27.5k|}
inflateReset2:
  144|    364|int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
  145|    364|    int wrap;
  146|    364|    struct inflate_state FAR *state;
  147|       |
  148|       |    /* get the state */
  149|    364|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (149:9): [True: 0, False: 364]
  ------------------
  150|    364|    state = (struct inflate_state FAR *)strm->state;
  151|       |
  152|       |    /* extract wrap request from windowBits parameter */
  153|    364|    if (windowBits < 0) {
  ------------------
  |  Branch (153:9): [True: 0, False: 364]
  ------------------
  154|      0|        if (windowBits < -15)
  ------------------
  |  Branch (154:13): [True: 0, False: 0]
  ------------------
  155|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  156|      0|        wrap = 0;
  157|      0|        windowBits = -windowBits;
  158|      0|    }
  159|    364|    else {
  160|    364|        wrap = (windowBits >> 4) + 5;
  161|    364|#ifdef GUNZIP
  162|    364|        if (windowBits < 48)
  ------------------
  |  Branch (162:13): [True: 364, False: 0]
  ------------------
  163|    364|            windowBits &= 15;
  164|    364|#endif
  165|    364|    }
  166|       |
  167|       |    /* set number of window bits, free window if different */
  168|    364|    if (windowBits && (windowBits < 8 || windowBits > 15))
  ------------------
  |  Branch (168:9): [True: 364, False: 0]
  |  Branch (168:24): [True: 0, False: 364]
  |  Branch (168:42): [True: 0, False: 364]
  ------------------
  169|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  170|    364|    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
  ------------------
  |  |  216|    728|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (170:9): [True: 0, False: 364]
  |  Branch (170:36): [True: 0, False: 0]
  ------------------
  171|      0|        ZFREE(strm, state->window);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  172|      0|        state->window = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  173|      0|    }
  174|       |
  175|       |    /* update state and reset the rest of it */
  176|    364|    state->reqwrap = state->wrap = wrap;
  177|    364|    state->reqbits = state->wbits = (unsigned)windowBits;
  178|    364|    return inflateReset(strm);
  179|    364|}
inflateInit2_:
  182|    364|                          const char *version, int stream_size) {
  183|    364|    int ret;
  184|    364|    struct inflate_state FAR *state;
  185|       |
  186|    364|    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |  216|    728|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |   44|    364|#define ZLIB_VERSION "1.3.2.1-motley"
  ------------------
  |  Branch (186:9): [True: 0, False: 364]
  |  Branch (186:30): [True: 0, False: 364]
  ------------------
  187|    364|        stream_size != (int)(sizeof(z_stream)))
  ------------------
  |  Branch (187:9): [True: 0, False: 364]
  ------------------
  188|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  189|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  189|    364|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  216|    364|#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 (189:9): [True: 0, False: 364]
  ------------------
  190|    364|    strm->msg = Z_NULL;                 /* in case we return an error */
  ------------------
  |  |  216|    364|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  191|    364|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (191:9): [True: 143, False: 221]
  ------------------
  192|       |#ifdef Z_SOLO
  193|       |        return Z_STREAM_ERROR;
  194|       |#else
  195|    143|        strm->zalloc = zcalloc;
  196|    143|        strm->opaque = (voidpf)0;
  197|    143|#endif
  198|    143|    }
  199|    364|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (199:9): [True: 143, False: 221]
  ------------------
  200|       |#ifdef Z_SOLO
  201|       |        return Z_STREAM_ERROR;
  202|       |#else
  203|    143|        strm->zfree = zcfree;
  204|    364|#endif
  205|    364|    state = (struct inflate_state FAR *)
  206|    364|            ZALLOC(strm, 1, sizeof(struct inflate_state));
  ------------------
  |  |  253|    364|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  207|    364|    if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  216|    364|#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 (207:9): [True: 0, False: 364]
  ------------------
  208|    364|    zmemzero(state, sizeof(struct inflate_state));
  ------------------
  |  |  218|    364|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  209|    364|    Tracev((stderr, "inflate: allocated\n"));
  210|    364|    strm->state = (struct internal_state FAR *)state;
  211|    364|    state->strm = strm;
  212|    364|    state->window = Z_NULL;
  ------------------
  |  |  216|    364|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  213|    364|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  214|    364|    ret = inflateReset2(strm, windowBits);
  215|    364|    if (ret != Z_OK) {
  ------------------
  |  |  181|    364|#define Z_OK            0
  ------------------
  |  Branch (215:9): [True: 0, False: 364]
  ------------------
  216|      0|        ZFREE(strm, state);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  217|      0|        strm->state = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  218|      0|    }
  219|    364|    return ret;
  220|    364|}
inflateInit_:
  223|    364|                         int stream_size) {
  224|    364|    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
  ------------------
  |  |   76|    364|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |  287|    364|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  225|    364|}
inflate:
  482|   123k|int ZEXPORT inflate(z_streamp strm, int flush) {
  483|   123k|    struct inflate_state FAR *state;
  484|   123k|    z_const unsigned char FAR *next;    /* next input */
  485|   123k|    unsigned char FAR *put;     /* next output */
  486|   123k|    unsigned have, left;        /* available input and output */
  487|   123k|    unsigned long hold;         /* bit buffer */
  488|   123k|    unsigned bits;              /* bits in bit buffer */
  489|   123k|    unsigned in, out;           /* save starting available input and output */
  490|   123k|    unsigned copy;              /* number of stored or match bytes to copy */
  491|   123k|    unsigned char FAR *from;    /* where to copy match bytes from */
  492|   123k|    code here;                  /* current decoding table entry */
  493|   123k|    code last;                  /* parent table entry */
  494|   123k|    unsigned len;               /* length to copy for repeats, bits to drop */
  495|   123k|    int ret;                    /* return code */
  496|   123k|#ifdef GUNZIP
  497|   123k|    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  498|   123k|#endif
  499|   123k|    static const unsigned short order[19] = /* permutation of code lengths */
  500|   123k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  501|       |
  502|   123k|    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
  ------------------
  |  |  216|   247k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (502:9): [True: 0, False: 123k]
  |  Branch (502:36): [True: 0, False: 123k]
  ------------------
  503|   123k|        (strm->next_in == Z_NULL && strm->avail_in != 0))
  ------------------
  |  |  216|   247k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (503:10): [True: 0, False: 123k]
  |  Branch (503:37): [True: 0, False: 0]
  ------------------
  504|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  505|       |
  506|   123k|    state = (struct inflate_state FAR *)strm->state;
  507|   123k|    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
  ------------------
  |  Branch (507:9): [True: 256, False: 123k]
  ------------------
  508|   123k|    LOAD();
  ------------------
  |  |  337|   123k|    do { \
  |  |  338|   123k|        put = strm->next_out; \
  |  |  339|   123k|        left = strm->avail_out; \
  |  |  340|   123k|        next = strm->next_in; \
  |  |  341|   123k|        have = strm->avail_in; \
  |  |  342|   123k|        hold = state->hold; \
  |  |  343|   123k|        bits = state->bits; \
  |  |  344|   123k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (344:14): [Folded, False: 123k]
  |  |  ------------------
  ------------------
  509|   123k|    in = have;
  510|   123k|    out = left;
  511|   123k|    ret = Z_OK;
  ------------------
  |  |  181|   123k|#define Z_OK            0
  ------------------
  512|   123k|    for (;;)
  513|   696k|        switch (state->mode) {
  514|  28.9k|        case HEAD:
  ------------------
  |  Branch (514:9): [True: 28.9k, False: 667k]
  ------------------
  515|  28.9k|            if (state->wrap == 0) {
  ------------------
  |  Branch (515:17): [True: 0, False: 28.9k]
  ------------------
  516|      0|                state->mode = TYPEDO;
  517|      0|                break;
  518|      0|            }
  519|  28.9k|            NEEDBITS(16);
  ------------------
  |  |  377|  28.9k|    do { \
  |  |  378|  80.4k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 55.7k, False: 24.7k]
  |  |  ------------------
  |  |  379|  55.7k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  55.7k|    do { \
  |  |  |  |  368|  55.7k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 4.22k, False: 51.5k]
  |  |  |  |  ------------------
  |  |  |  |  369|  55.7k|        have--; \
  |  |  |  |  370|  51.5k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  51.5k|        bits += 8; \
  |  |  |  |  372|  51.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 51.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  28.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 24.7k]
  |  |  ------------------
  ------------------
  520|  24.7k|#ifdef GUNZIP
  521|  24.7k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (521:17): [True: 0, False: 24.7k]
  |  Branch (521:38): [True: 0, False: 0]
  ------------------
  522|      0|                if (state->wbits == 0)
  ------------------
  |  Branch (522:21): [True: 0, False: 0]
  ------------------
  523|      0|                    state->wbits = 15;
  524|      0|                state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  525|      0|                CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  526|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  527|      0|                state->mode = FLAGS;
  528|      0|                break;
  529|      0|            }
  530|  24.7k|            if (state->head != Z_NULL)
  ------------------
  |  |  216|  24.7k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (530:17): [True: 0, False: 24.7k]
  ------------------
  531|      0|                state->head->done = -1;
  532|  24.7k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (532:17): [True: 0, False: 24.7k]
  ------------------
  533|       |#else
  534|       |            if (
  535|       |#endif
  536|  24.7k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  384|  24.7k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  |  Branch (536:17): [True: 10.5k, False: 14.2k]
  ------------------
  537|  10.5k|                strm->msg = (z_const char *)"incorrect header check";
  538|  10.5k|                state->mode = BAD;
  539|  10.5k|                break;
  540|  10.5k|            }
  541|  14.2k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  384|  14.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  213|  14.2k|#define Z_DEFLATED   8
  ------------------
  |  Branch (541:17): [True: 1.22k, False: 12.9k]
  ------------------
  542|  1.22k|                strm->msg = (z_const char *)"unknown compression method";
  543|  1.22k|                state->mode = BAD;
  544|  1.22k|                break;
  545|  1.22k|            }
  546|  12.9k|            DROPBITS(4);
  ------------------
  |  |  388|  12.9k|    do { \
  |  |  389|  12.9k|        hold >>= (n); \
  |  |  390|  12.9k|        bits -= (unsigned)(n); \
  |  |  391|  12.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 12.9k]
  |  |  ------------------
  ------------------
  547|  12.9k|            len = BITS(4) + 8;
  ------------------
  |  |  384|  12.9k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  548|  12.9k|            if (state->wbits == 0)
  ------------------
  |  Branch (548:17): [True: 0, False: 12.9k]
  ------------------
  549|      0|                state->wbits = len;
  550|  12.9k|            if (len > 15 || len > state->wbits) {
  ------------------
  |  Branch (550:17): [True: 139, False: 12.8k]
  |  Branch (550:29): [True: 0, False: 12.8k]
  ------------------
  551|    139|                strm->msg = (z_const char *)"invalid window size";
  552|    139|                state->mode = BAD;
  553|    139|                break;
  554|    139|            }
  555|  12.8k|            state->dmax = 1U << len;
  556|  12.8k|            state->flags = 0;               /* indicate zlib header */
  557|  12.8k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  558|  12.8k|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|  12.8k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  559|  12.8k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (559:27): [True: 99, False: 12.7k]
  ------------------
  560|  12.8k|            INITBITS();
  ------------------
  |  |  359|  12.8k|    do { \
  |  |  360|  12.8k|        hold = 0; \
  |  |  361|  12.8k|        bits = 0; \
  |  |  362|  12.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 12.8k]
  |  |  ------------------
  ------------------
  561|  12.8k|            break;
  562|      0|#ifdef GUNZIP
  563|      0|        case FLAGS:
  ------------------
  |  Branch (563:9): [True: 0, False: 696k]
  ------------------
  564|      0|            NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  565|      0|            state->flags = (int)(hold);
  566|      0|            if ((state->flags & 0xff) != Z_DEFLATED) {
  ------------------
  |  |  213|      0|#define Z_DEFLATED   8
  ------------------
  |  Branch (566:17): [True: 0, False: 0]
  ------------------
  567|      0|                strm->msg = (z_const char *)"unknown compression method";
  568|      0|                state->mode = BAD;
  569|      0|                break;
  570|      0|            }
  571|      0|            if (state->flags & 0xe000) {
  ------------------
  |  Branch (571:17): [True: 0, False: 0]
  ------------------
  572|      0|                strm->msg = (z_const char *)"unknown header flags set";
  573|      0|                state->mode = BAD;
  574|      0|                break;
  575|      0|            }
  576|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (576:17): [True: 0, False: 0]
  ------------------
  577|      0|                state->head->text = (int)((hold >> 8) & 1);
  578|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (578:17): [True: 0, False: 0]
  |  Branch (578:44): [True: 0, False: 0]
  ------------------
  579|      0|                CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  580|      0|            INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  581|      0|            state->mode = TIME;
  582|       |                /* fallthrough */
  583|      0|        case TIME:
  ------------------
  |  Branch (583:9): [True: 0, False: 696k]
  ------------------
  584|      0|            NEEDBITS(32);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  585|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (585:17): [True: 0, False: 0]
  ------------------
  586|      0|                state->head->time = hold;
  587|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (587:17): [True: 0, False: 0]
  |  Branch (587:44): [True: 0, False: 0]
  ------------------
  588|      0|                CRC4(state->check, hold);
  ------------------
  |  |  326|      0|    do { \
  |  |  327|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  328|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  329|      0|        hbuf[2] = (unsigned char)((word) >> 16); \
  |  |  330|      0|        hbuf[3] = (unsigned char)((word) >> 24); \
  |  |  331|      0|        check = crc32(check, hbuf, 4); \
  |  |  332|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (332:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  589|      0|            INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  590|      0|            state->mode = OS;
  591|       |                /* fallthrough */
  592|      0|        case OS:
  ------------------
  |  Branch (592:9): [True: 0, False: 696k]
  ------------------
  593|      0|            NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  594|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (594:17): [True: 0, False: 0]
  ------------------
  595|      0|                state->head->xflags = (int)(hold & 0xff);
  596|      0|                state->head->os = (int)(hold >> 8);
  597|      0|            }
  598|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (598:17): [True: 0, False: 0]
  |  Branch (598:44): [True: 0, False: 0]
  ------------------
  599|      0|                CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  600|      0|            INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  601|      0|            state->mode = EXLEN;
  602|       |                /* fallthrough */
  603|      0|        case EXLEN:
  ------------------
  |  Branch (603:9): [True: 0, False: 696k]
  ------------------
  604|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (604:17): [True: 0, False: 0]
  ------------------
  605|      0|                NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  606|      0|                state->length = (unsigned)(hold);
  607|      0|                if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (607:21): [True: 0, False: 0]
  ------------------
  608|      0|                    state->head->extra_len = (unsigned)hold;
  609|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (609:21): [True: 0, False: 0]
  |  Branch (609:48): [True: 0, False: 0]
  ------------------
  610|      0|                    CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  611|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  612|      0|            }
  613|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (613:22): [True: 0, False: 0]
  ------------------
  614|      0|                state->head->extra = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  615|      0|            state->mode = EXTRA;
  616|       |                /* fallthrough */
  617|      0|        case EXTRA:
  ------------------
  |  Branch (617:9): [True: 0, False: 696k]
  ------------------
  618|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (618:17): [True: 0, False: 0]
  ------------------
  619|      0|                copy = state->length;
  620|      0|                if (copy > have) copy = have;
  ------------------
  |  Branch (620:21): [True: 0, False: 0]
  ------------------
  621|      0|                if (copy) {
  ------------------
  |  Branch (621:21): [True: 0, False: 0]
  ------------------
  622|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (622:25): [True: 0, False: 0]
  ------------------
  623|      0|                        state->head->extra != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (623:25): [True: 0, False: 0]
  ------------------
  624|      0|                        (len = state->head->extra_len - state->length) <
  ------------------
  |  Branch (624:25): [True: 0, False: 0]
  ------------------
  625|      0|                            state->head->extra_max) {
  626|      0|                        zmemcpy(state->head->extra + len, next,
  ------------------
  |  |  216|      0|#    define zmemcpy memcpy
  ------------------
  627|      0|                                len + copy > state->head->extra_max ?
  ------------------
  |  Branch (627:33): [True: 0, False: 0]
  ------------------
  628|      0|                                state->head->extra_max - len : copy);
  629|      0|                    }
  630|      0|                    if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (630:25): [True: 0, False: 0]
  |  Branch (630:52): [True: 0, False: 0]
  ------------------
  631|      0|                        state->check = crc32(state->check, next, copy);
  632|      0|                    have -= copy;
  633|      0|                    next += copy;
  634|      0|                    state->length -= copy;
  635|      0|                }
  636|      0|                if (state->length) goto inf_leave;
  ------------------
  |  Branch (636:21): [True: 0, False: 0]
  ------------------
  637|      0|            }
  638|      0|            state->length = 0;
  639|      0|            state->mode = NAME;
  640|       |                /* fallthrough */
  641|      0|        case NAME:
  ------------------
  |  Branch (641:9): [True: 0, False: 696k]
  ------------------
  642|      0|            if (state->flags & 0x0800) {
  ------------------
  |  Branch (642:17): [True: 0, False: 0]
  ------------------
  643|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (643:21): [True: 0, False: 0]
  ------------------
  644|      0|                copy = 0;
  645|      0|                do {
  646|      0|                    len = (unsigned)(next[copy++]);
  647|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (647:25): [True: 0, False: 0]
  ------------------
  648|      0|                            state->head->name != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (648:29): [True: 0, False: 0]
  ------------------
  649|      0|                            state->length < state->head->name_max)
  ------------------
  |  Branch (649:29): [True: 0, False: 0]
  ------------------
  650|      0|                        state->head->name[state->length++] = (Bytef)len;
  651|      0|                } while (len && copy < have);
  ------------------
  |  Branch (651:26): [True: 0, False: 0]
  |  Branch (651:33): [True: 0, False: 0]
  ------------------
  652|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (652:21): [True: 0, False: 0]
  |  Branch (652:48): [True: 0, False: 0]
  ------------------
  653|      0|                    state->check = crc32(state->check, next, copy);
  654|      0|                have -= copy;
  655|      0|                next += copy;
  656|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (656:21): [True: 0, False: 0]
  ------------------
  657|      0|            }
  658|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (658:22): [True: 0, False: 0]
  ------------------
  659|      0|                state->head->name = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  660|      0|            state->length = 0;
  661|      0|            state->mode = COMMENT;
  662|       |                /* fallthrough */
  663|      0|        case COMMENT:
  ------------------
  |  Branch (663:9): [True: 0, False: 696k]
  ------------------
  664|      0|            if (state->flags & 0x1000) {
  ------------------
  |  Branch (664:17): [True: 0, False: 0]
  ------------------
  665|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (665:21): [True: 0, False: 0]
  ------------------
  666|      0|                copy = 0;
  667|      0|                do {
  668|      0|                    len = (unsigned)(next[copy++]);
  669|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (669:25): [True: 0, False: 0]
  ------------------
  670|      0|                            state->head->comment != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (670:29): [True: 0, False: 0]
  ------------------
  671|      0|                            state->length < state->head->comm_max)
  ------------------
  |  Branch (671:29): [True: 0, False: 0]
  ------------------
  672|      0|                        state->head->comment[state->length++] = (Bytef)len;
  673|      0|                } while (len && copy < have);
  ------------------
  |  Branch (673:26): [True: 0, False: 0]
  |  Branch (673:33): [True: 0, False: 0]
  ------------------
  674|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (674:21): [True: 0, False: 0]
  |  Branch (674:48): [True: 0, False: 0]
  ------------------
  675|      0|                    state->check = crc32(state->check, next, copy);
  676|      0|                have -= copy;
  677|      0|                next += copy;
  678|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (678:21): [True: 0, False: 0]
  ------------------
  679|      0|            }
  680|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (680:22): [True: 0, False: 0]
  ------------------
  681|      0|                state->head->comment = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  682|      0|            state->mode = HCRC;
  683|       |                /* fallthrough */
  684|      0|        case HCRC:
  ------------------
  |  Branch (684:9): [True: 0, False: 696k]
  ------------------
  685|      0|            if (state->flags & 0x0200) {
  ------------------
  |  Branch (685:17): [True: 0, False: 0]
  ------------------
  686|      0|                NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  687|      0|                if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
  ------------------
  |  Branch (687:21): [True: 0, False: 0]
  |  Branch (687:42): [True: 0, False: 0]
  ------------------
  688|      0|                    strm->msg = (z_const char *)"header crc mismatch";
  689|      0|                    state->mode = BAD;
  690|      0|                    break;
  691|      0|                }
  692|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  693|      0|            }
  694|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (694:17): [True: 0, False: 0]
  ------------------
  695|      0|                state->head->hcrc = (int)((state->flags >> 9) & 1);
  696|      0|                state->head->done = 1;
  697|      0|            }
  698|      0|            strm->adler = state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  699|      0|            state->mode = TYPE;
  700|      0|            break;
  701|      0|#endif
  702|    172|        case DICTID:
  ------------------
  |  Branch (702:9): [True: 172, False: 696k]
  ------------------
  703|    172|            NEEDBITS(32);
  ------------------
  |  |  377|    172|    do { \
  |  |  378|    351|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 325, False: 26]
  |  |  ------------------
  |  |  379|    325|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|    325|    do { \
  |  |  |  |  368|    325|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 146, False: 179]
  |  |  |  |  ------------------
  |  |  |  |  369|    325|        have--; \
  |  |  |  |  370|    179|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|    179|        bits += 8; \
  |  |  |  |  372|    179|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 179]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|    172|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  704|     26|            strm->adler = state->check = ZSWAP32(hold);
  ------------------
  |  |  258|     26|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|     26|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
  705|     26|            INITBITS();
  ------------------
  |  |  359|     26|    do { \
  |  |  360|     26|        hold = 0; \
  |  |  361|     26|        bits = 0; \
  |  |  362|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  706|     26|            state->mode = DICT;
  707|       |                /* fallthrough */
  708|     26|        case DICT:
  ------------------
  |  Branch (708:9): [True: 0, False: 696k]
  ------------------
  709|     26|            if (state->havedict == 0) {
  ------------------
  |  Branch (709:17): [True: 26, False: 0]
  ------------------
  710|     26|                RESTORE();
  ------------------
  |  |  348|     26|    do { \
  |  |  349|     26|        strm->next_out = put; \
  |  |  350|     26|        strm->avail_out = left; \
  |  |  351|     26|        strm->next_in = next; \
  |  |  352|     26|        strm->avail_in = have; \
  |  |  353|     26|        state->hold = hold; \
  |  |  354|     26|        state->bits = bits; \
  |  |  355|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (355:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
  711|     26|                return Z_NEED_DICT;
  ------------------
  |  |  183|     26|#define Z_NEED_DICT     2
  ------------------
  712|     26|            }
  713|      0|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  714|      0|            state->mode = TYPE;
  715|       |                /* fallthrough */
  716|  19.9k|        case TYPE:
  ------------------
  |  Branch (716:9): [True: 19.9k, False: 676k]
  ------------------
  717|  19.9k|            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  177|  39.9k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  19.9k|#define Z_TREES         6
  ------------------
  |  Branch (717:17): [True: 0, False: 19.9k]
  |  Branch (717:37): [True: 0, False: 19.9k]
  ------------------
  718|       |                /* fallthrough */
  719|  20.2k|        case TYPEDO:
  ------------------
  |  Branch (719:9): [True: 256, False: 696k]
  ------------------
  720|  20.2k|            if (state->last) {
  ------------------
  |  Branch (720:17): [True: 801, False: 19.4k]
  ------------------
  721|    801|                BYTEBITS();
  ------------------
  |  |  395|    801|    do { \
  |  |  396|    801|        hold >>= bits & 7; \
  |  |  397|    801|        bits -= bits & 7; \
  |  |  398|    801|    } while (0)
  |  |  ------------------
  |  |  |  Branch (398:14): [Folded, False: 801]
  |  |  ------------------
  ------------------
  722|    801|                state->mode = CHECK;
  723|    801|                break;
  724|    801|            }
  725|  19.4k|            NEEDBITS(3);
  ------------------
  |  |  377|  19.4k|    do { \
  |  |  378|  34.5k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 15.6k, False: 18.9k]
  |  |  ------------------
  |  |  379|  19.4k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  15.6k|    do { \
  |  |  |  |  368|  15.6k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 512, False: 15.1k]
  |  |  |  |  ------------------
  |  |  |  |  369|  15.6k|        have--; \
  |  |  |  |  370|  15.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  15.1k|        bits += 8; \
  |  |  |  |  372|  15.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 15.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  19.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 18.9k]
  |  |  ------------------
  ------------------
  726|  18.9k|            state->last = BITS(1);
  ------------------
  |  |  384|  18.9k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  727|  18.9k|            DROPBITS(1);
  ------------------
  |  |  388|  18.9k|    do { \
  |  |  389|  18.9k|        hold >>= (n); \
  |  |  390|  18.9k|        bits -= (unsigned)(n); \
  |  |  391|  18.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 18.9k]
  |  |  ------------------
  ------------------
  728|  18.9k|            switch (BITS(2)) {
  ------------------
  |  |  384|  18.9k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  729|  1.16k|            case 0:                             /* stored block */
  ------------------
  |  Branch (729:13): [True: 1.16k, False: 17.7k]
  ------------------
  730|  1.16k|                Tracev((stderr, "inflate:     stored block%s\n",
  731|  1.16k|                        state->last ? " (last)" : ""));
  732|  1.16k|                state->mode = STORED;
  733|  1.16k|                break;
  734|  7.61k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (734:13): [True: 7.61k, False: 11.3k]
  ------------------
  735|  7.61k|                inflate_fixed(state);
  736|  7.61k|                Tracev((stderr, "inflate:     fixed codes block%s\n",
  737|  7.61k|                        state->last ? " (last)" : ""));
  738|  7.61k|                state->mode = LEN_;             /* decode codes */
  739|  7.61k|                if (flush == Z_TREES) {
  ------------------
  |  |  178|  7.61k|#define Z_TREES         6
  ------------------
  |  Branch (739:21): [True: 0, False: 7.61k]
  ------------------
  740|      0|                    DROPBITS(2);
  ------------------
  |  |  388|      0|    do { \
  |  |  389|      0|        hold >>= (n); \
  |  |  390|      0|        bits -= (unsigned)(n); \
  |  |  391|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  741|      0|                    goto inf_leave;
  742|      0|                }
  743|  7.61k|                break;
  744|  10.0k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (744:13): [True: 10.0k, False: 8.91k]
  ------------------
  745|  10.0k|                Tracev((stderr, "inflate:     dynamic codes block%s\n",
  746|  10.0k|                        state->last ? " (last)" : ""));
  747|  10.0k|                state->mode = TABLE;
  748|  10.0k|                break;
  749|    133|            default:
  ------------------
  |  Branch (749:13): [True: 133, False: 18.8k]
  ------------------
  750|    133|                strm->msg = (z_const char *)"invalid block type";
  751|    133|                state->mode = BAD;
  752|  18.9k|            }
  753|  18.9k|            DROPBITS(2);
  ------------------
  |  |  388|  18.9k|    do { \
  |  |  389|  18.9k|        hold >>= (n); \
  |  |  390|  18.9k|        bits -= (unsigned)(n); \
  |  |  391|  18.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 18.9k]
  |  |  ------------------
  ------------------
  754|  18.9k|            break;
  755|  1.17k|        case STORED:
  ------------------
  |  Branch (755:9): [True: 1.17k, False: 695k]
  ------------------
  756|  1.17k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  395|  1.17k|    do { \
  |  |  396|  1.17k|        hold >>= bits & 7; \
  |  |  397|  1.17k|        bits -= bits & 7; \
  |  |  398|  1.17k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (398:14): [Folded, False: 1.17k]
  |  |  ------------------
  ------------------
  757|  1.17k|            NEEDBITS(32);
  ------------------
  |  |  377|  1.17k|    do { \
  |  |  378|  5.83k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 4.66k, False: 1.16k]
  |  |  ------------------
  |  |  379|  4.66k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  4.66k|    do { \
  |  |  |  |  368|  4.66k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 10, False: 4.65k]
  |  |  |  |  ------------------
  |  |  |  |  369|  4.66k|        have--; \
  |  |  |  |  370|  4.65k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  4.65k|        bits += 8; \
  |  |  |  |  372|  4.65k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 4.65k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  1.17k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 1.16k]
  |  |  ------------------
  ------------------
  758|  1.16k|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (758:17): [True: 318, False: 845]
  ------------------
  759|    318|                strm->msg = (z_const char *)"invalid stored block lengths";
  760|    318|                state->mode = BAD;
  761|    318|                break;
  762|    318|            }
  763|    845|            state->length = (unsigned)hold & 0xffff;
  764|    845|            Tracev((stderr, "inflate:       stored length %u\n",
  765|    845|                    state->length));
  766|    845|            INITBITS();
  ------------------
  |  |  359|    845|    do { \
  |  |  360|    845|        hold = 0; \
  |  |  361|    845|        bits = 0; \
  |  |  362|    845|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 845]
  |  |  ------------------
  ------------------
  767|    845|            state->mode = COPY_;
  768|    845|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|    845|#define Z_TREES         6
  ------------------
  |  Branch (768:17): [True: 0, False: 845]
  ------------------
  769|       |                /* fallthrough */
  770|    845|        case COPY_:
  ------------------
  |  Branch (770:9): [True: 0, False: 696k]
  ------------------
  771|    845|            state->mode = COPY;
  772|       |                /* fallthrough */
  773|  2.19k|        case COPY:
  ------------------
  |  Branch (773:9): [True: 1.35k, False: 695k]
  ------------------
  774|  2.19k|            copy = state->length;
  775|  2.19k|            if (copy) {
  ------------------
  |  Branch (775:17): [True: 1.77k, False: 417]
  ------------------
  776|  1.77k|                if (copy > have) copy = have;
  ------------------
  |  Branch (776:21): [True: 1.49k, False: 284]
  ------------------
  777|  1.77k|                if (copy > left) copy = left;
  ------------------
  |  Branch (777:21): [True: 864, False: 914]
  ------------------
  778|  1.77k|                if (copy == 0) goto inf_leave;
  ------------------
  |  Branch (778:21): [True: 854, False: 924]
  ------------------
  779|    924|                zmemcpy(put, next, copy);
  ------------------
  |  |  216|    924|#    define zmemcpy memcpy
  ------------------
  780|    924|                have -= copy;
  781|    924|                next += copy;
  782|    924|                left -= copy;
  783|    924|                put += copy;
  784|    924|                state->length -= copy;
  785|    924|                break;
  786|  1.77k|            }
  787|    417|            Tracev((stderr, "inflate:       stored end\n"));
  788|    417|            state->mode = TYPE;
  789|    417|            break;
  790|  10.0k|        case TABLE:
  ------------------
  |  Branch (790:9): [True: 10.0k, False: 686k]
  ------------------
  791|  10.0k|            NEEDBITS(14);
  ------------------
  |  |  377|  10.0k|    do { \
  |  |  378|  28.9k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 18.9k, False: 9.99k]
  |  |  ------------------
  |  |  379|  18.9k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  18.9k|    do { \
  |  |  |  |  368|  18.9k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 55, False: 18.8k]
  |  |  |  |  ------------------
  |  |  |  |  369|  18.9k|        have--; \
  |  |  |  |  370|  18.8k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  18.8k|        bits += 8; \
  |  |  |  |  372|  18.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 18.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  10.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 9.99k]
  |  |  ------------------
  ------------------
  792|  9.99k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  384|  9.99k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  793|  9.99k|            DROPBITS(5);
  ------------------
  |  |  388|  9.99k|    do { \
  |  |  389|  9.99k|        hold >>= (n); \
  |  |  390|  9.99k|        bits -= (unsigned)(n); \
  |  |  391|  9.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 9.99k]
  |  |  ------------------
  ------------------
  794|  9.99k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  384|  9.99k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  795|  9.99k|            DROPBITS(5);
  ------------------
  |  |  388|  9.99k|    do { \
  |  |  389|  9.99k|        hold >>= (n); \
  |  |  390|  9.99k|        bits -= (unsigned)(n); \
  |  |  391|  9.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 9.99k]
  |  |  ------------------
  ------------------
  796|  9.99k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  384|  9.99k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  797|  9.99k|            DROPBITS(4);
  ------------------
  |  |  388|  9.99k|    do { \
  |  |  389|  9.99k|        hold >>= (n); \
  |  |  390|  9.99k|        bits -= (unsigned)(n); \
  |  |  391|  9.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 9.99k]
  |  |  ------------------
  ------------------
  798|  9.99k|#ifndef PKZIP_BUG_WORKAROUND
  799|  9.99k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (799:17): [True: 134, False: 9.85k]
  |  Branch (799:38): [True: 2, False: 9.85k]
  ------------------
  800|    136|                strm->msg = (z_const char *)
  801|    136|                    "too many length or distance symbols";
  802|    136|                state->mode = BAD;
  803|    136|                break;
  804|    136|            }
  805|  9.85k|#endif
  806|  9.85k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  807|  9.85k|            state->have = 0;
  808|  9.85k|            state->mode = LENLENS;
  809|       |                /* fallthrough */
  810|  10.0k|        case LENLENS:
  ------------------
  |  Branch (810:9): [True: 169, False: 696k]
  ------------------
  811|   182k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (811:20): [True: 173k, False: 9.68k]
  ------------------
  812|   173k|                NEEDBITS(3);
  ------------------
  |  |  377|   173k|    do { \
  |  |  378|   231k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 58.6k, False: 172k]
  |  |  ------------------
  |  |  379|   173k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  58.6k|    do { \
  |  |  |  |  368|  58.6k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 342, False: 58.3k]
  |  |  |  |  ------------------
  |  |  |  |  369|  58.6k|        have--; \
  |  |  |  |  370|  58.3k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  58.3k|        bits += 8; \
  |  |  |  |  372|  58.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 58.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|   173k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  813|   172k|                state->lens[order[state->have++]] = (unsigned short)BITS(3);
  ------------------
  |  |  384|   172k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  814|   172k|                DROPBITS(3);
  ------------------
  |  |  388|   172k|    do { \
  |  |  389|   172k|        hold >>= (n); \
  |  |  390|   172k|        bits -= (unsigned)(n); \
  |  |  391|   172k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 172k]
  |  |  ------------------
  ------------------
  815|   172k|            }
  816|  22.0k|            while (state->have < 19)
  ------------------
  |  Branch (816:20): [True: 12.3k, False: 9.68k]
  ------------------
  817|  12.3k|                state->lens[order[state->have++]] = 0;
  818|  9.68k|            state->next = state->codes;
  819|  9.68k|            state->lencode = state->distcode = (const code FAR *)(state->next);
  820|  9.68k|            state->lenbits = 7;
  821|  9.68k|            ret = inflate_table(CODES, state->lens, 19, &(state->next),
  822|  9.68k|                                &(state->lenbits), state->work);
  823|  9.68k|            if (ret) {
  ------------------
  |  Branch (823:17): [True: 441, False: 9.24k]
  ------------------
  824|    441|                strm->msg = (z_const char *)"invalid code lengths set";
  825|    441|                state->mode = BAD;
  826|    441|                break;
  827|    441|            }
  828|  9.24k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  829|  9.24k|            state->have = 0;
  830|  9.24k|            state->mode = CODELENS;
  831|       |                /* fallthrough */
  832|  9.52k|        case CODELENS:
  ------------------
  |  Branch (832:9): [True: 284, False: 696k]
  ------------------
  833|   322k|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (833:20): [True: 313k, False: 8.80k]
  ------------------
  834|   394k|                for (;;) {
  835|   394k|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  384|   394k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  836|   394k|                    if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (836:25): [True: 312k, False: 81.7k]
  ------------------
  837|  81.7k|                    PULLBYTE();
  ------------------
  |  |  367|  81.7k|    do { \
  |  |  368|  81.7k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 519, False: 81.2k]
  |  |  ------------------
  |  |  369|  81.7k|        have--; \
  |  |  370|  81.2k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|  81.2k|        bits += 8; \
  |  |  372|  81.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 81.2k]
  |  |  ------------------
  ------------------
  838|  81.7k|                }
  839|   312k|                if (here.val < 16) {
  ------------------
  |  Branch (839:21): [True: 270k, False: 42.3k]
  ------------------
  840|   270k|                    DROPBITS(here.bits);
  ------------------
  |  |  388|   270k|    do { \
  |  |  389|   270k|        hold >>= (n); \
  |  |  390|   270k|        bits -= (unsigned)(n); \
  |  |  391|   270k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 270k]
  |  |  ------------------
  ------------------
  841|   270k|                    state->lens[state->have++] = here.val;
  842|   270k|                }
  843|  42.3k|                else {
  844|  42.3k|                    if (here.val == 16) {
  ------------------
  |  Branch (844:25): [True: 5.21k, False: 37.1k]
  ------------------
  845|  5.21k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  377|  5.21k|    do { \
  |  |  378|  6.08k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 865, False: 5.21k]
  |  |  ------------------
  |  |  379|  5.21k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|    865|    do { \
  |  |  |  |  368|    865|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 865]
  |  |  |  |  ------------------
  |  |  |  |  369|    865|        have--; \
  |  |  |  |  370|    865|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|    865|        bits += 8; \
  |  |  |  |  372|    865|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 865]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  5.21k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 5.21k]
  |  |  ------------------
  ------------------
  846|  5.21k|                        DROPBITS(here.bits);
  ------------------
  |  |  388|  5.21k|    do { \
  |  |  389|  5.21k|        hold >>= (n); \
  |  |  390|  5.21k|        bits -= (unsigned)(n); \
  |  |  391|  5.21k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 5.21k]
  |  |  ------------------
  ------------------
  847|  5.21k|                        if (state->have == 0) {
  ------------------
  |  Branch (847:29): [True: 131, False: 5.08k]
  ------------------
  848|    131|                            strm->msg = (z_const char *)
  849|    131|                                "invalid bit length repeat";
  850|    131|                            state->mode = BAD;
  851|    131|                            break;
  852|    131|                        }
  853|  5.08k|                        len = state->lens[state->have - 1];
  854|  5.08k|                        copy = 3 + BITS(2);
  ------------------
  |  |  384|  5.08k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  855|  5.08k|                        DROPBITS(2);
  ------------------
  |  |  388|  5.08k|    do { \
  |  |  389|  5.08k|        hold >>= (n); \
  |  |  390|  5.08k|        bits -= (unsigned)(n); \
  |  |  391|  5.08k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 5.08k]
  |  |  ------------------
  ------------------
  856|  5.08k|                    }
  857|  37.1k|                    else if (here.val == 17) {
  ------------------
  |  Branch (857:30): [True: 2.17k, False: 34.9k]
  ------------------
  858|  2.17k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  377|  2.17k|    do { \
  |  |  378|  2.95k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 772, False: 2.17k]
  |  |  ------------------
  |  |  379|  2.17k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|    772|    do { \
  |  |  |  |  368|    772|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 772]
  |  |  |  |  ------------------
  |  |  |  |  369|    772|        have--; \
  |  |  |  |  370|    772|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|    772|        bits += 8; \
  |  |  |  |  372|    772|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 772]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  2.17k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 2.17k]
  |  |  ------------------
  ------------------
  859|  2.17k|                        DROPBITS(here.bits);
  ------------------
  |  |  388|  2.17k|    do { \
  |  |  389|  2.17k|        hold >>= (n); \
  |  |  390|  2.17k|        bits -= (unsigned)(n); \
  |  |  391|  2.17k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 2.17k]
  |  |  ------------------
  ------------------
  860|  2.17k|                        len = 0;
  861|  2.17k|                        copy = 3 + BITS(3);
  ------------------
  |  |  384|  2.17k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  862|  2.17k|                        DROPBITS(3);
  ------------------
  |  |  388|  2.17k|    do { \
  |  |  389|  2.17k|        hold >>= (n); \
  |  |  390|  2.17k|        bits -= (unsigned)(n); \
  |  |  391|  2.17k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 2.17k]
  |  |  ------------------
  ------------------
  863|  2.17k|                    }
  864|  34.9k|                    else {
  865|  34.9k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  377|  34.9k|    do { \
  |  |  378|  69.0k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 34.1k, False: 34.8k]
  |  |  ------------------
  |  |  379|  34.9k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  34.1k|    do { \
  |  |  |  |  368|  34.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 53, False: 34.0k]
  |  |  |  |  ------------------
  |  |  |  |  369|  34.1k|        have--; \
  |  |  |  |  370|  34.0k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  34.0k|        bits += 8; \
  |  |  |  |  372|  34.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 34.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  34.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 34.8k]
  |  |  ------------------
  ------------------
  866|  34.8k|                        DROPBITS(here.bits);
  ------------------
  |  |  388|  34.8k|    do { \
  |  |  389|  34.8k|        hold >>= (n); \
  |  |  390|  34.8k|        bits -= (unsigned)(n); \
  |  |  391|  34.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 34.8k]
  |  |  ------------------
  ------------------
  867|  34.8k|                        len = 0;
  868|  34.8k|                        copy = 11 + BITS(7);
  ------------------
  |  |  384|  34.8k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  869|  34.8k|                        DROPBITS(7);
  ------------------
  |  |  388|  34.8k|    do { \
  |  |  389|  34.8k|        hold >>= (n); \
  |  |  390|  34.8k|        bits -= (unsigned)(n); \
  |  |  391|  34.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 34.8k]
  |  |  ------------------
  ------------------
  870|  34.8k|                    }
  871|  42.1k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (871:25): [True: 21, False: 42.1k]
  ------------------
  872|     21|                        strm->msg = (z_const char *)
  873|     21|                            "invalid bit length repeat";
  874|     21|                        state->mode = BAD;
  875|     21|                        break;
  876|     21|                    }
  877|  2.38M|                    while (copy--)
  ------------------
  |  Branch (877:28): [True: 2.33M, False: 42.1k]
  ------------------
  878|  2.33M|                        state->lens[state->have++] = (unsigned short)len;
  879|  42.1k|                }
  880|   312k|            }
  881|       |
  882|       |            /* handle error breaks in while */
  883|  8.95k|            if (state->mode == BAD) break;
  ------------------
  |  Branch (883:17): [True: 152, False: 8.80k]
  ------------------
  884|       |
  885|       |            /* check for end-of-block code (better have one) */
  886|  8.80k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (886:17): [True: 0, False: 8.80k]
  ------------------
  887|      0|                strm->msg = (z_const char *)
  888|      0|                    "invalid code -- missing end-of-block";
  889|      0|                state->mode = BAD;
  890|      0|                break;
  891|      0|            }
  892|       |
  893|       |            /* build code tables -- note: do not change the lenbits or distbits
  894|       |               values here (9 and 6) without reading the comments in inftrees.h
  895|       |               concerning the ENOUGH constants, which depend on those values */
  896|  8.80k|            state->next = state->codes;
  897|  8.80k|            state->lencode = (const code FAR *)(state->next);
  898|  8.80k|            state->lenbits = 9;
  899|  8.80k|            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
  900|  8.80k|                                &(state->lenbits), state->work);
  901|  8.80k|            if (ret) {
  ------------------
  |  Branch (901:17): [True: 10, False: 8.79k]
  ------------------
  902|     10|                strm->msg = (z_const char *)"invalid literal/lengths set";
  903|     10|                state->mode = BAD;
  904|     10|                break;
  905|     10|            }
  906|  8.79k|            state->distcode = (const code FAR *)(state->next);
  907|  8.79k|            state->distbits = 6;
  908|  8.79k|            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  909|  8.79k|                            &(state->next), &(state->distbits), state->work);
  910|  8.79k|            if (ret) {
  ------------------
  |  Branch (910:17): [True: 346, False: 8.44k]
  ------------------
  911|    346|                strm->msg = (z_const char *)"invalid distances set";
  912|    346|                state->mode = BAD;
  913|    346|                break;
  914|    346|            }
  915|  8.44k|            Tracev((stderr, "inflate:       codes ok\n"));
  916|  8.44k|            state->mode = LEN_;
  917|  8.44k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  8.44k|#define Z_TREES         6
  ------------------
  |  Branch (917:17): [True: 0, False: 8.44k]
  ------------------
  918|       |                /* fallthrough */
  919|  16.0k|        case LEN_:
  ------------------
  |  Branch (919:9): [True: 7.61k, False: 688k]
  ------------------
  920|  16.0k|            state->mode = LEN;
  921|       |                /* fallthrough */
  922|   227k|        case LEN:
  ------------------
  |  Branch (922:9): [True: 211k, False: 484k]
  ------------------
  923|   227k|            if (have >= 6 && left >= 258 && bits < 8) {
  ------------------
  |  Branch (923:17): [True: 217k, False: 10.9k]
  |  Branch (923:30): [True: 46.1k, False: 170k]
  |  Branch (923:45): [True: 46.1k, False: 0]
  ------------------
  924|  46.1k|                RESTORE();
  ------------------
  |  |  348|  46.1k|    do { \
  |  |  349|  46.1k|        strm->next_out = put; \
  |  |  350|  46.1k|        strm->avail_out = left; \
  |  |  351|  46.1k|        strm->next_in = next; \
  |  |  352|  46.1k|        strm->avail_in = have; \
  |  |  353|  46.1k|        state->hold = hold; \
  |  |  354|  46.1k|        state->bits = bits; \
  |  |  355|  46.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (355:14): [Folded, False: 46.1k]
  |  |  ------------------
  ------------------
  925|  46.1k|                inflate_fast(strm, out);
  926|  46.1k|                LOAD();
  ------------------
  |  |  337|  46.1k|    do { \
  |  |  338|  46.1k|        put = strm->next_out; \
  |  |  339|  46.1k|        left = strm->avail_out; \
  |  |  340|  46.1k|        next = strm->next_in; \
  |  |  341|  46.1k|        have = strm->avail_in; \
  |  |  342|  46.1k|        hold = state->hold; \
  |  |  343|  46.1k|        bits = state->bits; \
  |  |  344|  46.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (344:14): [Folded, False: 46.1k]
  |  |  ------------------
  ------------------
  927|  46.1k|                if (state->mode == TYPE)
  ------------------
  |  Branch (927:21): [True: 4.66k, False: 41.4k]
  ------------------
  928|  4.66k|                    state->back = -1;
  929|  46.1k|                break;
  930|  46.1k|            }
  931|   181k|            state->back = 0;
  932|   270k|            for (;;) {
  933|   270k|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  384|   270k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  934|   270k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (934:21): [True: 180k, False: 89.6k]
  ------------------
  935|  89.6k|                PULLBYTE();
  ------------------
  |  |  367|  89.6k|    do { \
  |  |  368|  89.6k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 936, False: 88.7k]
  |  |  ------------------
  |  |  369|  89.6k|        have--; \
  |  |  370|  88.7k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|  88.7k|        bits += 8; \
  |  |  372|  88.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 88.7k]
  |  |  ------------------
  ------------------
  936|  89.6k|            }
  937|   180k|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (937:17): [True: 67.8k, False: 112k]
  |  Branch (937:28): [True: 3.72k, False: 64.1k]
  ------------------
  938|  3.72k|                last = here;
  939|  5.40k|                for (;;) {
  940|  5.40k|                    here = state->lencode[last.val +
  941|  5.40k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  384|  5.40k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  942|  5.40k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (942:25): [True: 3.49k, False: 1.90k]
  ------------------
  943|  1.90k|                    PULLBYTE();
  ------------------
  |  |  367|  1.90k|    do { \
  |  |  368|  1.90k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 226, False: 1.68k]
  |  |  ------------------
  |  |  369|  1.90k|        have--; \
  |  |  370|  1.68k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|  1.68k|        bits += 8; \
  |  |  372|  1.68k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 1.68k]
  |  |  ------------------
  ------------------
  944|  1.90k|                }
  945|  3.49k|                DROPBITS(last.bits);
  ------------------
  |  |  388|  3.49k|    do { \
  |  |  389|  3.49k|        hold >>= (n); \
  |  |  390|  3.49k|        bits -= (unsigned)(n); \
  |  |  391|  3.49k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 3.49k]
  |  |  ------------------
  ------------------
  946|  3.49k|                state->back += last.bits;
  947|  3.49k|            }
  948|   180k|            DROPBITS(here.bits);
  ------------------
  |  |  388|   180k|    do { \
  |  |  389|   180k|        hold >>= (n); \
  |  |  390|   180k|        bits -= (unsigned)(n); \
  |  |  391|   180k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 180k]
  |  |  ------------------
  ------------------
  949|   180k|            state->back += here.bits;
  950|   180k|            state->length = (unsigned)here.val;
  951|   180k|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (951:17): [True: 116k, False: 64.2k]
  ------------------
  952|   116k|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
  953|   116k|                        "inflate:         literal '%c'\n" :
  954|   116k|                        "inflate:         literal 0x%02x\n", here.val));
  955|   116k|                state->mode = LIT;
  956|   116k|                break;
  957|   116k|            }
  958|  64.2k|            if (here.op & 32) {
  ------------------
  |  Branch (958:17): [True: 2.16k, False: 62.0k]
  ------------------
  959|  2.16k|                Tracevv((stderr, "inflate:         end of block\n"));
  960|  2.16k|                state->back = -1;
  961|  2.16k|                state->mode = TYPE;
  962|  2.16k|                break;
  963|  2.16k|            }
  964|  62.0k|            if (here.op & 64) {
  ------------------
  |  Branch (964:17): [True: 140, False: 61.9k]
  ------------------
  965|    140|                strm->msg = (z_const char *)"invalid literal/length code";
  966|    140|                state->mode = BAD;
  967|    140|                break;
  968|    140|            }
  969|  61.9k|            state->extra = (unsigned)(here.op) & 15;
  970|  61.9k|            state->mode = LENEXT;
  971|       |                /* fallthrough */
  972|  62.1k|        case LENEXT:
  ------------------
  |  Branch (972:9): [True: 271, False: 696k]
  ------------------
  973|  62.1k|            if (state->extra) {
  ------------------
  |  Branch (973:17): [True: 9.84k, False: 52.3k]
  ------------------
  974|  9.84k|                NEEDBITS(state->extra);
  ------------------
  |  |  377|  9.84k|    do { \
  |  |  378|  14.5k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 5.29k, False: 9.29k]
  |  |  ------------------
  |  |  379|  9.84k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  5.29k|    do { \
  |  |  |  |  368|  5.29k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 544, False: 4.74k]
  |  |  |  |  ------------------
  |  |  |  |  369|  5.29k|        have--; \
  |  |  |  |  370|  4.74k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  4.74k|        bits += 8; \
  |  |  |  |  372|  4.74k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 4.74k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  9.84k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 9.29k]
  |  |  ------------------
  ------------------
  975|  9.29k|                state->length += BITS(state->extra);
  ------------------
  |  |  384|  9.29k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  976|  9.29k|                DROPBITS(state->extra);
  ------------------
  |  |  388|  9.29k|    do { \
  |  |  389|  9.29k|        hold >>= (n); \
  |  |  390|  9.29k|        bits -= (unsigned)(n); \
  |  |  391|  9.29k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 9.29k]
  |  |  ------------------
  ------------------
  977|  9.29k|                state->back += state->extra;
  978|  9.29k|            }
  979|  61.6k|            Tracevv((stderr, "inflate:         length %u\n", state->length));
  980|  61.6k|            state->was = state->length;
  981|  61.6k|            state->mode = DIST;
  982|       |                /* fallthrough */
  983|  61.9k|        case DIST:
  ------------------
  |  Branch (983:9): [True: 337, False: 696k]
  ------------------
  984|  76.0k|            for (;;) {
  985|  76.0k|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  384|  76.0k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  986|  76.0k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (986:21): [True: 61.6k, False: 14.4k]
  ------------------
  987|  14.4k|                PULLBYTE();
  ------------------
  |  |  367|  14.4k|    do { \
  |  |  368|  14.4k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 375, False: 14.0k]
  |  |  ------------------
  |  |  369|  14.4k|        have--; \
  |  |  370|  14.0k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|  14.0k|        bits += 8; \
  |  |  372|  14.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 14.0k]
  |  |  ------------------
  ------------------
  988|  14.4k|            }
  989|  61.6k|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (989:17): [True: 5.30k, False: 56.3k]
  ------------------
  990|  5.30k|                last = here;
  991|  6.56k|                for (;;) {
  992|  6.56k|                    here = state->distcode[last.val +
  993|  6.56k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  384|  6.56k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  994|  6.56k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (994:25): [True: 4.99k, False: 1.57k]
  ------------------
  995|  1.57k|                    PULLBYTE();
  ------------------
  |  |  367|  1.57k|    do { \
  |  |  368|  1.57k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 306, False: 1.26k]
  |  |  ------------------
  |  |  369|  1.57k|        have--; \
  |  |  370|  1.26k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|  1.26k|        bits += 8; \
  |  |  372|  1.26k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 1.26k]
  |  |  ------------------
  ------------------
  996|  1.57k|                }
  997|  4.99k|                DROPBITS(last.bits);
  ------------------
  |  |  388|  4.99k|    do { \
  |  |  389|  4.99k|        hold >>= (n); \
  |  |  390|  4.99k|        bits -= (unsigned)(n); \
  |  |  391|  4.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
  998|  4.99k|                state->back += last.bits;
  999|  4.99k|            }
 1000|  61.3k|            DROPBITS(here.bits);
  ------------------
  |  |  388|  61.3k|    do { \
  |  |  389|  61.3k|        hold >>= (n); \
  |  |  390|  61.3k|        bits -= (unsigned)(n); \
  |  |  391|  61.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 61.3k]
  |  |  ------------------
  ------------------
 1001|  61.3k|            state->back += here.bits;
 1002|  61.3k|            if (here.op & 64) {
  ------------------
  |  Branch (1002:17): [True: 24, False: 61.2k]
  ------------------
 1003|     24|                strm->msg = (z_const char *)"invalid distance code";
 1004|     24|                state->mode = BAD;
 1005|     24|                break;
 1006|     24|            }
 1007|  61.2k|            state->offset = (unsigned)here.val;
 1008|  61.2k|            state->extra = (unsigned)(here.op) & 15;
 1009|  61.2k|            state->mode = DISTEXT;
 1010|       |                /* fallthrough */
 1011|  61.4k|        case DISTEXT:
  ------------------
  |  Branch (1011:9): [True: 145, False: 696k]
  ------------------
 1012|  61.4k|            if (state->extra) {
  ------------------
  |  Branch (1012:17): [True: 6.48k, False: 54.9k]
  ------------------
 1013|  6.48k|                NEEDBITS(state->extra);
  ------------------
  |  |  377|  6.48k|    do { \
  |  |  378|  9.99k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 3.81k, False: 6.18k]
  |  |  ------------------
  |  |  379|  6.48k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  3.81k|    do { \
  |  |  |  |  368|  3.81k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 292, False: 3.51k]
  |  |  |  |  ------------------
  |  |  |  |  369|  3.81k|        have--; \
  |  |  |  |  370|  3.51k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  3.51k|        bits += 8; \
  |  |  |  |  372|  3.51k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 3.51k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  6.48k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 6.18k]
  |  |  ------------------
  ------------------
 1014|  6.18k|                state->offset += BITS(state->extra);
  ------------------
  |  |  384|  6.18k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1015|  6.18k|                DROPBITS(state->extra);
  ------------------
  |  |  388|  6.18k|    do { \
  |  |  389|  6.18k|        hold >>= (n); \
  |  |  390|  6.18k|        bits -= (unsigned)(n); \
  |  |  391|  6.18k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 6.18k]
  |  |  ------------------
  ------------------
 1016|  6.18k|                state->back += state->extra;
 1017|  6.18k|            }
 1018|       |#ifdef INFLATE_STRICT
 1019|       |            if (state->offset > state->dmax) {
 1020|       |                strm->msg = (z_const char *)"invalid distance too far back";
 1021|       |                state->mode = BAD;
 1022|       |                break;
 1023|       |            }
 1024|       |#endif
 1025|  61.1k|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1026|  61.1k|            state->mode = MATCH;
 1027|       |                /* fallthrough */
 1028|   342k|        case MATCH:
  ------------------
  |  Branch (1028:9): [True: 281k, False: 414k]
  ------------------
 1029|   342k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1029:17): [True: 99.0k, False: 243k]
  ------------------
 1030|   243k|            copy = out - left;
 1031|   243k|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1031:17): [True: 92.0k, False: 151k]
  ------------------
 1032|  92.0k|                copy = state->offset - copy;
 1033|  92.0k|                if (copy > state->whave) {
  ------------------
  |  Branch (1033:21): [True: 8, False: 92.0k]
  ------------------
 1034|      8|                    if (state->sane) {
  ------------------
  |  Branch (1034:25): [True: 8, False: 0]
  ------------------
 1035|      8|                        strm->msg = (z_const char *)
 1036|      8|                            "invalid distance too far back";
 1037|      8|                        state->mode = BAD;
 1038|      8|                        break;
 1039|      8|                    }
 1040|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 1041|       |                    Trace((stderr, "inflate.c too far\n"));
 1042|       |                    copy -= state->whave;
 1043|       |                    if (copy > state->length) copy = state->length;
 1044|       |                    if (copy > left) copy = left;
 1045|       |                    left -= copy;
 1046|       |                    state->length -= copy;
 1047|       |                    do {
 1048|       |                        *put++ = 0;
 1049|       |                    } while (--copy);
 1050|       |                    if (state->length == 0) state->mode = LEN;
 1051|       |                    break;
 1052|       |#endif
 1053|      8|                }
 1054|  92.0k|                if (copy > state->wnext) {
  ------------------
  |  Branch (1054:21): [True: 0, False: 92.0k]
  ------------------
 1055|      0|                    copy -= state->wnext;
 1056|      0|                    from = state->window + (state->wsize - copy);
 1057|      0|                }
 1058|  92.0k|                else
 1059|  92.0k|                    from = state->window + (state->wnext - copy);
 1060|  92.0k|                if (copy > state->length) copy = state->length;
  ------------------
  |  Branch (1060:21): [True: 582, False: 91.4k]
  ------------------
 1061|  92.0k|            }
 1062|   151k|            else {                              /* copy from output */
 1063|   151k|                from = put - state->offset;
 1064|   151k|                copy = state->length;
 1065|   151k|            }
 1066|   243k|            if (copy > left) copy = left;
  ------------------
  |  Branch (1066:17): [True: 98.7k, False: 145k]
  ------------------
 1067|   243k|            left -= copy;
 1068|   243k|            state->length -= copy;
 1069|  11.9M|            do {
 1070|  11.9M|                *put++ = *from++;
 1071|  11.9M|            } while (--copy);
  ------------------
  |  Branch (1071:22): [True: 11.7M, False: 243k]
  ------------------
 1072|   243k|            if (state->length == 0) state->mode = LEN;
  ------------------
  |  Branch (1072:17): [True: 54.0k, False: 189k]
  ------------------
 1073|   243k|            break;
 1074|   116k|        case LIT:
  ------------------
  |  Branch (1074:9): [True: 116k, False: 579k]
  ------------------
 1075|   116k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1075:17): [True: 401, False: 116k]
  ------------------
 1076|   116k|            *put++ = (unsigned char)(state->length);
 1077|   116k|            left--;
 1078|   116k|            state->mode = LEN;
 1079|   116k|            break;
 1080|    944|        case CHECK:
  ------------------
  |  Branch (1080:9): [True: 944, False: 695k]
  ------------------
 1081|    944|            if (state->wrap) {
  ------------------
  |  Branch (1081:17): [True: 944, False: 0]
  ------------------
 1082|    944|                NEEDBITS(32);
  ------------------
  |  |  377|    944|    do { \
  |  |  378|  3.70k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 3.05k, False: 655]
  |  |  ------------------
  |  |  379|  3.05k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  3.05k|    do { \
  |  |  |  |  368|  3.05k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 289, False: 2.76k]
  |  |  |  |  ------------------
  |  |  |  |  369|  3.05k|        have--; \
  |  |  |  |  370|  2.76k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  2.76k|        bits += 8; \
  |  |  |  |  372|  2.76k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 2.76k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|    944|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 655]
  |  |  ------------------
  ------------------
 1083|    655|                out -= left;
 1084|    655|                strm->total_out += out;
 1085|    655|                state->total += out;
 1086|    655|                if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1086:21): [True: 655, False: 0]
  |  Branch (1086:42): [True: 256, False: 399]
  ------------------
 1087|    256|                    strm->adler = state->check =
 1088|    256|                        UPDATE_CHECK(state->check, put - out, out);
  ------------------
  |  |  311|    256|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (311:6): [True: 0, False: 256]
  |  |  ------------------
  ------------------
 1089|    655|                out = left;
 1090|    655|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1090:21): [True: 655, False: 0]
  |  Branch (1090:42): [True: 261, False: 394]
  ------------------
 1091|    655|#ifdef GUNZIP
 1092|    655|                     state->flags ? hold :
  ------------------
  |  Branch (1092:22): [True: 0, False: 655]
  ------------------
 1093|    655|#endif
 1094|    655|                     ZSWAP32(hold)) != state->check) {
  ------------------
  |  |  258|    655|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|    655|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
 1095|    261|                    strm->msg = (z_const char *)"incorrect data check";
 1096|    261|                    state->mode = BAD;
 1097|    261|                    break;
 1098|    261|                }
 1099|    394|                INITBITS();
  ------------------
  |  |  359|    394|    do { \
  |  |  360|    394|        hold = 0; \
  |  |  361|    394|        bits = 0; \
  |  |  362|    394|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 394]
  |  |  ------------------
  ------------------
 1100|    394|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1101|    394|            }
 1102|    394|#ifdef GUNZIP
 1103|    394|            state->mode = LENGTH;
 1104|       |                /* fallthrough */
 1105|    394|        case LENGTH:
  ------------------
  |  Branch (1105:9): [True: 0, False: 696k]
  ------------------
 1106|    394|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1106:17): [True: 394, False: 0]
  |  Branch (1106:32): [True: 0, False: 394]
  ------------------
 1107|      0|                NEEDBITS(32);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1108|      0|                if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
  ------------------
  |  Branch (1108:21): [True: 0, False: 0]
  |  Branch (1108:42): [True: 0, False: 0]
  ------------------
 1109|      0|                    strm->msg = (z_const char *)"incorrect length check";
 1110|      0|                    state->mode = BAD;
 1111|      0|                    break;
 1112|      0|                }
 1113|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1114|      0|                Tracev((stderr, "inflate:   length matches trailer\n"));
 1115|      0|            }
 1116|    394|#endif
 1117|    394|            state->mode = DONE;
 1118|       |                /* fallthrough */
 1119|    395|        case DONE:
  ------------------
  |  Branch (1119:9): [True: 1, False: 696k]
  ------------------
 1120|    395|            ret = Z_STREAM_END;
  ------------------
  |  |  182|    395|#define Z_STREAM_END    1
  ------------------
 1121|    395|            goto inf_leave;
 1122|  14.4k|        case BAD:
  ------------------
  |  Branch (1122:9): [True: 14.4k, False: 682k]
  ------------------
 1123|  14.4k|            ret = Z_DATA_ERROR;
  ------------------
  |  |  186|  14.4k|#define Z_DATA_ERROR   (-3)
  ------------------
 1124|  14.4k|            goto inf_leave;
 1125|      0|        case MEM:
  ------------------
  |  Branch (1125:9): [True: 0, False: 696k]
  ------------------
 1126|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1127|      0|        case SYNC:
  ------------------
  |  Branch (1127:9): [True: 0, False: 696k]
  ------------------
 1128|       |                /* fallthrough */
 1129|      0|        default:
  ------------------
  |  Branch (1129:9): [True: 0, False: 696k]
  ------------------
 1130|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1131|   696k|        }
 1132|       |
 1133|       |    /*
 1134|       |       Return from inflate(), updating the total counts and the check value.
 1135|       |       If there was no progress during the inflate() call, return a buffer
 1136|       |       error.  Call updatewindow() to create and/or update the window state.
 1137|       |       Note: a memory error from inflate() is non-recoverable.
 1138|       |     */
 1139|   123k|  inf_leave:
 1140|   123k|    RESTORE();
  ------------------
  |  |  348|   123k|    do { \
  |  |  349|   123k|        strm->next_out = put; \
  |  |  350|   123k|        strm->avail_out = left; \
  |  |  351|   123k|        strm->next_in = next; \
  |  |  352|   123k|        strm->avail_in = have; \
  |  |  353|   123k|        state->hold = hold; \
  |  |  354|   123k|        state->bits = bits; \
  |  |  355|   123k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (355:14): [Folded, False: 123k]
  |  |  ------------------
  ------------------
 1141|   123k|    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1141:9): [True: 94.8k, False: 29.1k]
  |  Branch (1141:26): [True: 11.5k, False: 17.6k]
  |  Branch (1141:52): [True: 9.69k, False: 1.84k]
  ------------------
 1142|  9.69k|            (state->mode < CHECK || flush != Z_FINISH)))
  ------------------
  |  |  176|    140|#define Z_FINISH        4
  ------------------
  |  Branch (1142:14): [True: 9.55k, False: 140]
  |  Branch (1142:37): [True: 140, False: 0]
  ------------------
 1143|   104k|        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
  ------------------
  |  Branch (1143:13): [True: 0, False: 104k]
  ------------------
 1144|      0|            state->mode = MEM;
 1145|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1146|      0|        }
 1147|   123k|    in -= strm->avail_in;
 1148|   123k|    out -= strm->avail_out;
 1149|   123k|    strm->total_in += in;
 1150|   123k|    strm->total_out += out;
 1151|   123k|    state->total += out;
 1152|   123k|    if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1152:9): [True: 123k, False: 0]
  |  Branch (1152:30): [True: 104k, False: 19.8k]
  ------------------
 1153|   104k|        strm->adler = state->check =
 1154|   104k|            UPDATE_CHECK(state->check, strm->next_out - out, out);
  ------------------
  |  |  311|   104k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (311:6): [True: 0, False: 104k]
  |  |  ------------------
  ------------------
 1155|   123k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1155:43): [True: 3.51k, False: 120k]
  ------------------
 1156|   123k|                      (state->mode == TYPE ? 128 : 0) +
  ------------------
  |  Branch (1156:24): [True: 256, False: 123k]
  ------------------
 1157|   123k|                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1157:24): [True: 0, False: 123k]
  |  Branch (1157:47): [True: 0, False: 123k]
  ------------------
 1158|   123k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  176|   119k|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  181|  4.61k|#define Z_OK            0
  ------------------
  |  Branch (1158:11): [True: 61.6k, False: 62.3k]
  |  Branch (1158:22): [True: 4.61k, False: 57.0k]
  |  Branch (1158:35): [True: 0, False: 119k]
  |  Branch (1158:57): [True: 4.60k, False: 9]
  ------------------
 1159|  4.60k|        ret = Z_BUF_ERROR;
  ------------------
  |  |  188|  4.60k|#define Z_BUF_ERROR    (-5)
  ------------------
 1160|   123k|    return ret;
 1161|   123k|}
inflateEnd:
 1163|    364|int ZEXPORT inflateEnd(z_streamp strm) {
 1164|    364|    struct inflate_state FAR *state;
 1165|    364|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1165:9): [True: 0, False: 364]
  ------------------
 1166|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1167|    364|    state = (struct inflate_state FAR *)strm->state;
 1168|    364|    if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  216|    364|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  254|    268|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  |  Branch (1168:9): [True: 268, False: 96]
  ------------------
 1169|    364|    ZFREE(strm, strm->state);
  ------------------
  |  |  254|    364|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1170|    364|    strm->state = Z_NULL;
  ------------------
  |  |  216|    364|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1171|    364|    Tracev((stderr, "inflate: end\n"));
 1172|    364|    return Z_OK;
  ------------------
  |  |  181|    364|#define Z_OK            0
  ------------------
 1173|    364|}
inflate.c:inflateStateCheck:
   88|   179k|local int inflateStateCheck(z_streamp strm) {
   89|   179k|    struct inflate_state FAR *state;
   90|   179k|    if (strm == Z_NULL ||
  ------------------
  |  |  216|   359k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (90:9): [True: 0, False: 179k]
  ------------------
   91|   179k|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (91:9): [True: 0, False: 179k]
  |  Branch (91:42): [True: 0, False: 179k]
  ------------------
   92|      0|        return 1;
   93|   179k|    state = (struct inflate_state FAR *)strm->state;
   94|   179k|    if (state == Z_NULL || state->strm != strm ||
  ------------------
  |  |  216|   359k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (94:9): [True: 0, False: 179k]
  |  Branch (94:28): [True: 0, False: 179k]
  ------------------
   95|   179k|        state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (95:9): [True: 0, False: 179k]
  |  Branch (95:31): [True: 0, False: 179k]
  ------------------
   96|      0|        return 1;
   97|   179k|    return 0;
   98|   179k|}
inflate.c:updatewindow:
  260|   104k|local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
  261|   104k|    struct inflate_state FAR *state;
  262|   104k|    unsigned dist;
  263|       |
  264|   104k|    state = (struct inflate_state FAR *)strm->state;
  265|       |
  266|       |    /* if it hasn't been done already, allocate space for the window */
  267|   104k|    if (state->window == Z_NULL) {
  ------------------
  |  |  216|   104k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (267:9): [True: 268, False: 104k]
  ------------------
  268|    268|        state->window = (unsigned char FAR *)
  269|    268|                        ZALLOC(strm, 1U << state->wbits,
  ------------------
  |  |  253|    268|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  270|    268|                               sizeof(unsigned char));
  271|    268|        if (state->window == Z_NULL) return 1;
  ------------------
  |  |  216|    268|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (271:13): [True: 0, False: 268]
  ------------------
  272|    268|    }
  273|       |
  274|       |    /* if window not in use yet, initialize */
  275|   104k|    if (state->wsize == 0) {
  ------------------
  |  Branch (275:9): [True: 9.69k, False: 94.8k]
  ------------------
  276|  9.69k|        state->wsize = 1U << state->wbits;
  277|  9.69k|        state->wnext = 0;
  278|  9.69k|        state->whave = 0;
  279|  9.69k|    }
  280|       |
  281|       |    /* copy state->wsize or less output bytes into the circular window */
  282|   104k|    if (copy >= state->wsize) {
  ------------------
  |  Branch (282:9): [True: 895, False: 103k]
  ------------------
  283|    895|        zmemcpy(state->window, end - state->wsize, state->wsize);
  ------------------
  |  |  216|    895|#    define zmemcpy memcpy
  ------------------
  284|    895|        state->wnext = 0;
  285|    895|        state->whave = state->wsize;
  286|    895|    }
  287|   103k|    else {
  288|   103k|        dist = state->wsize - state->wnext;
  289|   103k|        if (dist > copy) dist = copy;
  ------------------
  |  Branch (289:13): [True: 103k, False: 584]
  ------------------
  290|   103k|        zmemcpy(state->window + state->wnext, end - copy, dist);
  ------------------
  |  |  216|   103k|#    define zmemcpy memcpy
  ------------------
  291|   103k|        copy -= dist;
  292|   103k|        if (copy) {
  ------------------
  |  Branch (292:13): [True: 584, False: 103k]
  ------------------
  293|    584|            zmemcpy(state->window, end - copy, copy);
  ------------------
  |  |  216|    584|#    define zmemcpy memcpy
  ------------------
  294|    584|            state->wnext = copy;
  295|    584|            state->whave = state->wsize;
  296|    584|        }
  297|   103k|        else {
  298|   103k|            state->wnext += dist;
  299|   103k|            if (state->wnext == state->wsize) state->wnext = 0;
  ------------------
  |  Branch (299:17): [True: 0, False: 103k]
  ------------------
  300|   103k|            if (state->whave < state->wsize) state->whave += dist;
  ------------------
  |  Branch (300:17): [True: 96.7k, False: 6.24k]
  ------------------
  301|   103k|        }
  302|   103k|    }
  303|   104k|    return 0;
  304|   104k|}

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

zcalloc:
  303|    259|voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
  304|    259|    (void)opaque;
  305|    259|    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
  ------------------
  |  Branch (305:12): [True: 259, Folded]
  ------------------
  306|    259|                              (voidpf)calloc(items, size);
  307|    259|}
zcfree:
  309|    259|void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
  310|    259|    (void)opaque;
  311|    259|    free(ptr);
  312|    259|}

